Thank you for your answer.
Do you have any suggestions how to deal with that?

Am Montag, 10. November 2014 23:25:23 UTC+1 schrieb [email protected]:
>
>
>
> On Tuesday, November 11, 2014 5:10:30 AM UTC+11, DrKey wrote:
>>
>> Here is what i tried:
>> variant1:
>>
>> forcp = zeros(3,1);
>>
>> forcp = @parallel (hcat) for partA = 1:nPart
>>         for partB = (partA+1):nPart
>> ...
>> end            
>> forcp = forces[:,partA];
>> end
>>
>> variant2:
>> function calcforces(coords,L,np,i) # with np... number of processes i... 
>> current process
>>         for partA = i+1:np:nPart-1
>>             for partB = (partA+1):nPart
>> ...
>> return forces
>> end
>>
>>     np = nprocs();
>>     parad = Array(RemoteRef,np);
>>
>> and then calling function calcforces with: 
>> for i=1:np parad[i] = @spawn LJ_Force_MT(coords,L,np,i); end
>> for i=1:np forces = fetch(parad[i]); end
>>
>> both ways are giving me wrong results over more than 1 timestep
>>
>
> You have multiple parallel loops modifying the forces array.  They will be 
> generating races for sure.
>
> Cheers
> Lex 
>

Reply via email to