Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Building MCMCpack with Intel C++ Compiler

robkal
Beginner
1,500 Views

Hello,

 

 

 

I'm trying to build the MCMCpack (version 1.3-4) R package using the Intel C++ compiler (16.0.1 on Scientific Linux 6.5). I have already built R 3.2.3 and many packages using the compiler suite of the same version, but have been unable to get MCMCpack built. R was built using the options suggested at https://software.intel.com/en-us/articles/build-r-301-with-intel-c-compiler-and-intel-mkl-on-linux and https://software.intel.com/en-us/articles/using-intel-mkl-with-r. I get the following error numerous times with only the first line number given changing:

/grid/software/intel/2016/compilers_and_libraries_2016.1.150/linux/compiler/include/complex(305): error #308: member "std::complex<double>::_M_value" (declared at line 1302 of "/usr/include/c++/4.4.7/complex") is inaccessible
          return __x._M_value / __y;
                     ^

In file included from ide.h(93),
                 from distributions.h(98),
                 from rng.h(50),
                 from mersenne.h(76),
                 from MCMCrng.h(29),
                 from HMMmultivariateGaussian.cc(22):

The package compiles without error using GCC 4.9.1.

Any help is much appreciated.

 

0 Kudos
8 Replies
Judith_W_Intel
Employee
1,500 Views

 

It looks like you put a Intel system header file in a different directory and did not include it as a system header file.

The directory:

/grid/software/intel/2016/compilers_and_libraries_2016.1.150/linux/compiler/include

should be included with the -isystem not the -I option. This will suppress discretionary errors from system headers.

Judy

 

0 Kudos
robkal
Beginner
1,500 Views

Thank you for your quick help Judy. Unfortunately, I get the same errors:

icpc -I/grid/software/R/3.2.3/lib64/R/include -DNDEBUG -DSCYTHE_COMPILE_DIRECT -DSCYTHE_DEBUG=0 -DSCYTHE_RPACK -DHAVE_TRUNC  -DHAVE_TRUNC  -I/usr/local/include   -isystem/grid/software/intel/2016/compilers_and_libraries_2016.1.150/linux/compiler/include -fpic  -O3 -ipo -xHost -qopenmp -I/grid/software/intel/2016/compilers_and_libraries_2016.1.150/linux/mkl/include  -c HMMmultivariateGaussian.cc -o HMMmultivariateGaussian.o
In file included from ide.h(93),
                 from distributions.h(98),
                 from rng.h(50),
                 from mersenne.h(76),
                 from MCMCrng.h(29),
                 from HMMmultivariateGaussian.cc(22):
/grid/software/intel/2016/compilers_and_libraries_2016.1.150/linux/compiler/include/complex(69): error #308: member "std::complex<double>::_M_value" (declared at line 1302 of "/usr/include/c++/4.4.7/complex") is inaccessible
          _M_value = __z._M_value;
                         ^

Thanks,

Rob

0 Kudos
Judith_W_Intel
Employee
1,500 Views

 

Sorry -- it looks like my advice above was incorrect. The reason this error does not normally show up from the Intel <complex> system header file is because it is suppressed by a #pragma warning disable of diagnostic 308 on line 60 of complex, i.e. do you see this in <complex> header just before line 69?

#if !defined(__INTEL_COMPILER)
# error "This Intel <complex> is for use only with the Intel C++ compilers!"
#endif // __INTEL_COMPILER

// Disable error 308, 373 in order to access the private member of
// complex<float|double>. Considered acceptable as members are used in the
// member specialization as well.
#pragma warning(push)
#pragma warning(disable:308)
#pragma warning(disable:373)    <-- this pragma at line 60 should have disabled the diagnostic at line 69

Can you preprocess the file (add the -E option to the command line) and attach that? I think there's either a problem with the order of inclusion of your headers or the complex header file you are using is not the one from the Intel distribution or there's some other #pragma interfering with the one at line 60 in complex.

thanks

Judy

0 Kudos
robkal
Beginner
1,500 Views

Here it is. Thanks for your help.

0 Kudos
Judith_W_Intel
Employee
1,500 Views

 

What I actually need is a preprocessed source file that reproduces the error, not the build log.

So if you can attach the HMMmultivariateGaussian.o file after compiling with the -E option (this should contain the preprocessed output from the -E command) that would be what  I need.

thanks again,

Judy
 

0 Kudos
robkal
Beginner
1,500 Views

Hi Judy,

Thank you for your continued help. Please see attached.

Best regards, Rob

0 Kudos
Judith_W_Intel
Employee
1,500 Views

 

I can't reproduce the error with the preprocessed file you attached.

I tried the following with the latest 16.0 compiler:

sptel15-76> cp HMM*.txt bug.cpp
sptel15-77> icpc -fpic -O3 -ipo -xHost -qopenmp -c bug.cpp
sptel15-78>

Do you see an error (or not) when you do the same commands?

If so please send me:

(1) The result of adding -dryrun to the command line

(2) the exact build date of the 16.0 compiler you are using (do an icpc -V)

(3) Does the diagnostic go away when you add -diag-disable 308 to the command line?

If you don't see the error with the preprocessed file but you do it in your build environment then I'm not sure how to proceed.

Thanks

Judy

 

 

 

0 Kudos
Ping1
Beginner
1,500 Views

Judy,

I had the same problem when compiling the R package MCMCpack using the Intel compiler 17.0.1. The problem eventually was traced down to one of the R header file which is 'R_ext/Error.h'. This file has the following code:

         #ifndef R_NO_REMAP
         #define error Rf_error
         #define warning Rf_warning            <======= this line of code caused the problem.
         #endif

How can I resolve this?

 

Thanks,

Ping

 

 

 

 

0 Kudos
Reply