Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Sharon_B_
Beginner
112 Views

openmp compilation errors

I try compiling my code as follows, using icc v 15.0.1.

icc  -std=gnu99 -openmp -c foo.c

but I get these errors

 error: "k" can only appear on one data scope attribute clause in an OpenMP pragma (except firstprivate and lastprivate)
  #pragma omp parallel for 
  ^

error: "X1" can only appear on one data scope attribute clause in an OpenMP pragma (except firstprivate and lastprivate)
  #pragma omp parallel for 
  ^

 

#pragma omp parallel for 
   for ( size_t k = 0; k < Nseg; ++k ) {
#pragma omp parallel for 
    for ( size_t X1 = 0; X1 < numDet; ++X1 ) {
#pragma omp parallel for 
      for ( size_t n = 0; n < intN[X1]; ++n ) {

        InputOutputInfo *io = &intInOut[X1];

        gsl_function integrand;
        integrand.params = (void*)&( io->par );

        int stat;
        double res, abserr;

        const double scale1 = GET_COORD_SCALE(io->par.coordSys, io->par.coord1);
        const double scale2 = GET_COORD_SCALE(io->par.coordSys, io->par.coord2);
        const double scale12 = scale1 * scale2;

        /* compute <phi_i phi_j> */
        integrand.function = &CW_am1_am2_Phi_i_Phi_j;
        stat = gsl_integration_qag (&integrand, io->ti, io->tf, epsabs, epsrel, limit, GSL_II
NTEG_GAUSS61, io->wksp, &res, &abserr);
        if ( stat != 0 ) {
          XLALPrintWarning ( "\n%s: GSL-integration 'gsl_integration_qag()' of <Phi_i Phi_j>>
 did not reach requested precision!\n", __func__ );
          XLALPrintWarning ( "xlalErrno=%i, seg=%zu, av_ij_n=%g, abserr=%g\n", io->par.errnuu
m, n, res, abserr );
          io->av_ij = GSL_NAN;
        } else {
          io->av_ij = scale12 * res;
          io->av_ij_err_sq = SQUARE( scale12 * abserr);
        }

        /* compute <phi_i> */
        integrand.function = &CW_Phi_i;

        io->par.coord = io->par.coord2;
        stat = gsl_integration_qag (&integrand, io->ti, io->tf, epsabs, epsrel, limit, GSL_II
NTEG_GAUSS61, io->wksp, &res, &abserr);
        if ( stat != 0 ) {
          XLALPrintWarning ( "\n%s: GSL-integration 'gsl_integration_qag()' of <Phi_j> did nn
ot reach requested precision!\n", __func__ );
          XLALPrintWarning ( "xlalErrno=%i, seg=%zu, av_j_n=%g, abserr=%g\n", io->par.errnumm
, n, res, abserr );
          io->av_j = GSL_NAN;
        } else {
          io->av_j = scale2 * res;
          io->av_j_err_sq = SQUARE( scale2 * abserr);
        }

      } /* for n < intN */
    } // for X1 < numDet
  } // for k < Nseg

 

 

I'd appreciate assistance on how to keep the code accepting -std=gnu99 on the build line, yet make the

source modifications necessary. Adding private and shared clauses has just led to different compilation errors.

thanks.

0 Kudos
3 Replies
112 Views

hello,

First question is why do you need nested parallel for here?

--Vladimir

jimdempseyatthecove
Black Belt
112 Views

Consider using

#pragma omp parallel for 
    for ( size_t k = 0; k < Nseg; ++k ) {
     for ( size_t X1 = 0; X1 < numDet; ++X1 ) {
       for ( size_t n = 0; n < intN[X1]; ++n ) {

or

#pragma omp parallel for collapse(2)
    for ( size_t k = 0; k < Nseg; ++k ) {
     for ( size_t X1 = 0; X1 < numDet; ++X1 ) {
       for ( size_t n = 0; n < intN[X1]; ++n ) {

Jim Dempsey

Sharon_B_
Beginner
112 Views

Thanks much...indeed the nested parallelism wasn't needed and of course the error messages go away when just having one pragma at the top level.

 

Reply