openmp do loops

P

Pascal

Hi,

I would like to parallelize this loop:
do i=1,hklsize
fcalctable(i)=structfact(hkltable(1,i),hkltable(2,i),hkltable(3,i))
end do


I thought I would do this:
!$OMP PARALLEL DO default(private) shared(hkltable, fcalctable,hklsize)
do i=1,hklsize
fcalctable(i)=structfact(hkltable(1,i),hkltable(2,i),hkltable(3,i))
end do
!$OMP END PARALLEL DO

However it seems that the order of the final table is not guarantee
compared to the serial version. I need a j element of the table to stay
there because I have an other table and I am using the index to match
the data.

Regards,
Pascal
 
S

Stefan Behnel

Pascal, 04.11.2010 11:13:
I would like to parallelize this loop:
do i=1,hklsize
fcalctable(i)=structfact(hkltable(1,i),hkltable(2,i),hkltable(3,i))
end do

I thought I would do this:
!$OMP PARALLEL DO default(private) shared(hkltable, fcalctable,hklsize)
do i=1,hklsize
fcalctable(i)=structfact(hkltable(1,i),hkltable(2,i),hkltable(3,i))
end do
!$OMP END PARALLEL DO

Seeing this makes me seriously happy that I can write my code in Python (or
Cython, for that purpose).

Stefan
 
A

Alain Ketterlin

(This is Fortan, BTW.)
Seeing this makes me seriously happy that I can write my code in
Python (or Cython, for that purpose).

Does Cython support OpenMP? I've foudn nothing in the docs.

-- Alain.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top