I am a Physics researcher and i am doing Monte-Carlo simulations about magnetic properties of manganites. I wrote a program in C language and all is going fine except that the time of execution is so huge (maybe 1000 year depending in the size of Markov Chain and the size of the lattice). So I have no solution except that I have to parallelize my program and find a super-calculator. Of course I can't parallelize the whole program because if I do that I will lose the causality of the Markov Chain loop. I can parallelize only one loop inside the Markov Chain and this is sufficient. Here below a portion of my program showing the loop that I have to parellelize. If someone can tell me how to divide this loop into threads?
n = 1;
while(n <= Nc)
{
fscanf(voisins,"%d%d%f%f%f%f",&i,&j,&r[0],&r[1],&r[2],&d);
V = 0.0;E = 0.0;F = 0.0;
for(p = 0;p < 3;p++)
{
V += (D/pow(d,3.0))*(spin[3*i-3+p]-w[p])*spin[3*j-3+p];
E += (spin[3*i-3+p]-w[p])*r[p];
F += spin[3*j-3+p]*r[p];
}
G = -3*(D/pow(d,5.0))*E*F;
dU += (V+G);
n++;
}
Aucun commentaire:
Enregistrer un commentaire