I am relatively new to Julia and I have been exploring how to parallel process functions in IJulia. I have created a Jupyter notebook for 128 cores using the directions given here. I can confirm that it has imported all of the requested cores using the .nthreads
. Now I have a function that calls a bunch of functions inside ( My actual function is very long, so for instance for an explanation as shown).
function calculate(variables) #variables is a vector
x1,x2,x3,x4,x5,x6 = variables
value1 = funct1(x1,x2,x3) # this function returns a real value
value2 = funct2(x3,x4,x3) # this function returns a real value
value3 = funct3(x3,x5,x6) # this function returns a real value
return funct4(value1, value2, value3) # this function returns a vector.
end
numbers = [[rand() for i=1:6] for j=1:100000000]
answer = calculate.(numbers) # I get the expected answer but CPU is not utilised well.
As I execute these codes and when I check the “system monitor”, I see that only one core is being used at a time. Please help how I can use all of the cores. I hope I make some sense. I have also tried FLOOP and multithreading packages but I see that all cores to 100% and never give me an answer. Thanks for your help.
P.S. I use Ubuntu 22.