Pmap usage

Hi everyone,

I am trying to execute a custom function in my own server using pmap function. The server accounts for two physical cpus and a 24 threads.
The problem is at the second execution of the functions, the number of procs selected using Distributed.addprocs() are not working at 100%, while at the first execution all threads are running at 100%.

This is my current function:
tmp = Distributed.pmap(bgsIter,nParam,afac,bfac,alTot,alLow,ndivergence,nSfs,nDac);
where bgsIter execute internally another functions. One execution of bgsIter takes about 0.4ms. Am I using pmap correctly or should I move to other Distributed function?

As I far understand from the documentation pmap is designed for these cases: Julia’s pmap is designed for the case where each function call does a large amount of work. In contrast, @distributed for can handle situations where each iteration is tiny, perhaps merely summing two numbers.

I am really a beginner with parallel programming so any advice will be great!

Thanks in advance, Jesús.

Maybe you’re better off using threads, as you are on a single machine (and the 0.4ms seems a rather short execution time to use pmap). You could try https://github.com/tkf/ThreadsX.jl and the map function there.

However, to get more help you really need to provide an executable, minimal example. Otherwise it’s tricky to help you more.

2 Likes