[Omp] #pragma omp for & pointer
James Beyer
beyerj at cray.com
Wed Dec 13 06:22:47 PST 2006
OpenMP API version 2.5 page page 34 states that the init expression for
the for loop and the loop induction variable must be integer type.
Pointers are not integers.
Try rewriting your loop as
int i;
for ( i = 0; i < NBR_AT_M-1; i++) {
tempory_molecule_1[i] =
(AtomParam)coor_mol2crys(&moleculeA[i],vect_val_p.vect,vect_val_p.cm);
}
this should allow you to use omp directives on the loop.
james
Eric Germaneau wrote:
> 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/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Omp mailing list
> Omp at openmp.org
> http://openmp.org/mailman/listinfo/omp
>
More information about the Omp
mailing list