[R-pkg-devel] please help understand an error in openMP statements

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Sep 13 10:43:54 CEST 2019

On Thu, 12 Sep 2019 16:12:17 -0500
Marcin Jurek <marcinjurek1988 using gmail.com> wrote:

> U_NZentries.cpp:258:19: error: ‘covparms’ not specified in enclosing ‘parallel’
>   258 |  covmat= MaternFun(dist,covparms) + diagmat(nug) ; // summation from arma
>       |          ~~~~~~~~~^~~~~~~~~~~~~~~

This might be a compiler bug: const arma::vec covparms from the
argument list should have been automatically predetermined "shared". If
you try to specify #pragma omp shared(...,covparams) manually, you might
hit another error: "covparams" is predetermined "shared" for "shared".
In a similar case, I couldn't find a good workaround and had to switch
to default(shared).

> U_NZentries.cpp:271:12: error: ‘none’ not specified in enclosing ‘parallel’
>   271 |     M=solve(chol(covmat,"upper"),onevec);
>       |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is probably about the temporary returned from
chol(covmat,"upper"). Declare a variable for it inside the loop, and
the compiler will understand that it's private. Again, this shouldn't
be happening, so what I'm offering is a workaround.

What I find really strange is that gcc-4.9.3/mingw_32/bin/g++.exe
doesn't have any problems with this code, while supposedly newer g++-9

Best regards,

More information about the R-package-devel mailing list