Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation on intel compiler throws an error: "more than one instance of overloaded function" #186

Closed
dfalster opened this issue Nov 10, 2017 · 1 comment

Comments

@dfalster
Copy link
Member

Compilation on a cluster platform using the Intel C compiler (icpc) is throwing an error. It's failing when compiling RcppR6.cpp:

➜  raijin icpc -std=c++11 -I/apps/R/3.4.0/lib64/R/include -DNDEBUG -I../inst/include/ -I"/short/dp72/dsf576/R/3.4/Rcpp/include" -I"/short/dp72/dsf576/R/3.4/BH/include" -I/usr/local/include   -fpic  -g -O2 -c RcppR6.cpp -o RcppR6.o
../inst/include/plant/util.h(117): error: more than one instance of overloaded function "std::to_string" matches the argument list:
            function "std::to_string(long long)"
            function "std::to_string(unsigned long long)"
            function "std::to_string(long double)"
            argument types are: (double)
    return std::to_string(x);
           ^
          detected during:
            instantiation of "std::string plant::util::to_string(T) [with T=double]" at line 257 of "../inst/include/plant/ode_solver.h"
            instantiation of "void plant::ode::Solver<System>::set_time(double) [with System=plant::ode::test::Lorenz]" at line 79 of "../inst/include/plant/ode_solver.h"
            instantiation of "void plant::ode::Solver<System>::set_state_from_system(const System &) [with System=plant::ode::test::Lorenz]" at line 74 of "../inst/include/plant/ode_solver.h"
            instantiation of "void plant::ode::Solver<System>::reset(const System &) [with System=plant::ode::test::Lorenz]" at line 65 of "../inst/include/plant/ode_solver.h"
            instantiation of "plant::ode::Solver<System>::Solver(const System &, plant::ode::OdeControl) [with System=plant::ode::test::Lorenz]" at line 15 of "../inst/include/plant/ode_runner.h"
            instantiation of "plant::ode::Runner<T>::Runner(T, plant::ode::OdeControl) [with T=plant::ode::test::Lorenz]" at line 44 of "RcppR6.cpp"

compilation aborted for RcppR6.cpp (code 2)

Specifically, it's struggling with the to_string function at inst/include/plant/util.h(117).

@dfalster
Copy link
Member Author

dfalster commented Nov 10, 2017

Ok, Martin Thompson at UNSW solved the issue. The issue arose on the raijin cluster, so this fix is for that environment.

Martin says "that the Intel compilers still rely on some components from the GNU compilers, and the default GNU C++ compiler was too old to fully support C++11. So we need to load an environment module for any of the newer GNU compilers. As a consequence of that, we also need to slightly modify the order of directories where R looks for shared libraries."

This is achieved by adding into ${HOME}/.profile:

  module load gcc/4.6.4
  module load intel-fc/16.0.3.210
  module load intel-cc/16.0.3.210
  module load intel-mkl/16.0.3.210
  module load R/3.4.0

  if [ -n "${R_BASE}" -a -n "${GCC_BASE}" -a -n "${INTEL_MKL_BASE}" ]; then
      export R_LD_LIBRARY_PATH=${R_BASE}/lib64/R/lib:${GCC_BASE}/lib64:/usr/local/lib64:${INTEL_MKL_BASE}/lib/intel64_lin
  fi

Thanks Martin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant