0

In Julia Lang, the documentation states you can set the number of worker processes using batch_size:

pmap([::AbstractWorkerPool, ]f, c...; distributed=true, batch_size=1, on_error=nothing, retry_n=0, retry_max_delay=DEFAULT_RETRY_MAX_DELAY, retry_on=DEFAULT_RETRY_ON) → collection

But I can't seem to find a working example of how to pass the parameters.

I tried: pmap(f,x;true,10) and pmap(f,x;distributed=true,batch_size=10) abut both methods didn't work. Does anyone know the correct way to pass the argument for batch_size?

JJTO
  • 847
  • 2
  • 8
  • 13

1 Answers1

0

batch size is meant to split up the list your're mapping over, meaning that if you have a list 1:100 and you choose batch size 10, each time a worker process "goes a round" with the map function it takes fx [1,2,3,4,5,6,7,8,9,10] instead of just 1 or 2, this is preffereble if the function you're mapping over is simple, so it makes it easier for the scheduler (process 1) to schedule

anyway...on to the usage of named arguments...you have confirmed my suspicion on the semicolon, I've wondered if people might think they should type it...you arent supposed to type it, the semicolon is there so you know what are named arguments

i.e dont use a semicolon

pmap(f, c..., batch_size=10)

to understand better what I mean try creating the folliwing method

function foo(x)
    myid()
end

and test calling

pmap(foo, 1:100, batch_size = 1)

and

pmap(foo, 1:100, batch_size = 10)
isebarn
  • 3,812
  • 5
  • 22
  • 38