[Omp] #pragma omp for & pointer

Eric Germaneau eric.germaneau at epfl.ch
Wed Dec 13 05:41:10 PST 2006


Hello,

I'm wondering whether its possible to parallelize a for loop on pointers 
as in the following example.

AtomParam *ptrCour1;
AtomParam moleculeA[NBR_AT_M],*ptrLastElt_moleculeA = 
&moleculeA[NBR_AT_M - 1];

      for ( ptrCour1 = &moleculeA[0] ; ptrCour1 <= ptrLastElt_moleculeA 
; ptrCour1++ )                       
         {
          tempory_molecule_1[ ptrCour1 - &moleculeA[0] ] = 
(AtomParam)coor_mol2crys(*ptrCour1,vect_val_p.vect,vect_val_p.cm) ;        
         }

In serial mode it  works well but if I do

#pragma omp parallel
{
#pragma omp for
      for ( ptrCour1 = &moleculeA[0] ; ptrCour1 <= ptrLastElt_moleculeA 
; ptrCour1++ )                       
         {
          tempory_molecule_1[ ptrCour1 - &moleculeA[0] ] = 
(AtomParam)coor_mol2crys(*ptrCour1,vect_val_p.vect,vect_val_p.cm) ;        
         }
}

I get the following error:

/error: OpenMP for-init does not conform/

What should I do?
Thanks in advance,

            Eric.
-- 
" Reason" in things existed before things themselves existed
and all the changes in things were governed by it.
                                                                            
Zhu Xi.


Eric Germaneau <http://lcr.epfl.ch/page37437.html>
Ecole polytechnique fédérale de Lausanne (EPFL)
FSB - IPMC
Laboratoire de Cristallographie(LCr) <http://lcr.epfl.ch>
BSP 518
CH-1015 Lausanne
Switzerland
eric.germaneau at epfl.ch <mailto:eric.germaneau at epfl.ch>

/Tel.: /+41 (0)21 / 693 06 36
/Fax.: /+41 (0)21 / 693 05 04

/Please consider the environment before printing this email - Considérez 
svp l'environnement avant d'imprimer ce courriel/
-------------- next part --------------
Skipped content of type multipart/related


More information about the Omp mailing list