Julia GPU: Convert CPU-parallel computing codes to JuliaGPU codes

Job ID: 33451700

Budget: $30 – $250 USD

My current Julia codes (a simple example) using 20 CPU cores is the following. Basically, I use distributed package to create CPU workers, send the needed data to each worker, use -pmap- to divide the whole job into batched pieces and distribute them to each worker, then collect them back.

I would like to take advantage of the large number of cores in a GPU.

using Distributed
N_worker = 20
addprocs(N_worker)
using DelimitedFiles
@everywhere using Distributions, Random, ParallelDataTransfer

Data = rand(10000,25) #in real application, this will be imported from a CSV filesendto(workers(), Data = Data)
@everywhere function F(I)
eps = rand(1)
out = Data[i,1] + eps
sleep(5) #this is silly but just an illustration of the real calculation (which will take some time per worker)
return out
end

function parallel(NN)
pool = CachingPool(workers())
f_obj = pmap(F, pool, 1:NN, batch_size = Int(ceil(NN/N_worker)))
f_obj = hcat(f_obj...)
return f_obj
end

result = parallel(10000)
writedlm("result.txt", [result])
rmprocs(workers())
Related categories: CUDA Julia Language Julia Development