Hi all. Thanks for reading
I am totally new to parallel computing and working with different cores, workers, threads, etc (I have no idea of any of it hahaha). At home I have a single core mac and I have always worked like that. At the office we got a new server with 64 cores and now I want to turn some of my workflow to “parallel computing” to run things faster.
Now I have 2 simple cases, I hope you guys can help me change these into parallel and I will extrapolate to my necessities.
CASE 1: 1 Database, 4 Processes, 4 cores: Run 4 different processes in 4 different cores. Return the results to one core
Get Data: get 1e5 angles
Data = rand(0:1:360,10000)
In core 1: Fix data for calculations and wait for the results from other cores
Results=zeros(10000,4);
Results[:,1]=Data*pi/180 # from angles to radians.
In core 2: compute sin
A=sin.(Results[:,1])
In core 3: compute cos
B=cos.(Results[:,1])
In core 4: compute tan
C=tan.(Results[:,1])
In core 1: Receive all computations and save in main variable
Results[:,2]=A;
Results[:,3]=B;
Results[:,4]=C;
CASE 2: 1 Database, 4 Processes. Split the Database and send a piece to the cores. Return the results
Get Data: get 1e5 angles
Data = rand(0:1:360,10000)
In core 1: Fix data for calculations and wait for the results from other cores
Results=zeros(10000,2);
Results[:,1]=Data*pi/180 # from angles to radians.
In core 2: compute sin for the first 25 % of the data
A=sin.(Results[1:2499,1])
In core 3: compute sin for the second 25 % of the data
B=sin.(Results[2500:4999,1])
In core 4: compute sin for the last 50% of the data
C=sin.(Results[5000:10000,1])
In core 1: Receive all computations and save in main variable
Results[1:2499,2]=A;
Results[2500:4999,2]=B;
Results[5000:10000,3]=C;
Thanks!