Hello everyone,
I’m beginner in Mathematica and I am trying to implement my first parallelized calculation.
I’ve a function of 7 variables and I want to minimize it in a specific range for the variables.
So I define 7 ‘for loop’ nested in each other to calculate the value of the function by making discrete steps for each variable
For exemple for to loops I would have something like
For [ counter1, counter1<max1,counter1++;
For[counter2, counter2<max2,counter2++;
f(x1+counter1*x1step,x2+counter2*x2step);
]
]
I would like to use my CPUs to parallelize the calculation abd to limit the number of the loop required. I would like to fix the value of the first parameters and perform the calculation only in the second loop by using different CPU and then compare the results given by the different CPUs.
For example I would like to do :
CPU1
x1=1
For[counter2, counter2<max2,counter2++;
f(x1,x2+counter2*x2step);]
CPU2
x1=2
For[counter2, counter2<max2,counter2++;
f(x1,x2+counter2*x2step);]
CPU3
x1=3
For[counter2, counter2<max2,counter2++;
f(x1,x2+counter2*x2step);]
And then compare the results (even not automatically)
I know that a FIndMinimun function exist and that my way of minimizing the function is cleary not efficient but for personal reason I want and need to use this program’s structure with many ‘for loop’
Could you help me to do that step by step because I haven’t understood the Wolfram’s tutorial ?
Thank you very much for your help.
Corentin