tidyxl icon indicating copy to clipboard operation
tidyxl copied to clipboard

Can you make R Makevars specify gcc? ipcc fails.

Open wdkrnls opened this issue 3 years ago • 9 comments

Hello,

I noticed that the Intel compiler barfs on your package when trying to link with piton.

icpc -std=gnu++11 -I"/opt/R/R-4.0.2-mkl/lib64/R/include" -DNDEBUG  -I'/home/me/R/lib/pro/4.0/Rcpp/include' -I'/home/me/R/lib/pro/4.0/piton/include' -I/usr/local/include   -fpic  -g -O2  -c xlex.cpp -o xlex.o
token_grammar.h(107): error: "seq" is ambiguous
                                     seq< plus< D >, opt< dot, plus< D > > > > {};
                                     ^
          detected during:
            instantiation of class "xltoken::decimal<D> [with D=tao::pegtl::ascii::digit]" at line 35 of "/home/me/R/lib/pro/4.0/piton/include/pegtl/internal/duseltronik.hpp"

It seems to build fine with gcc.

wdkrnls avatar Sep 11 '20 18:09 wdkrnls

Thanks @wdkrnls. I know next to nothing about compilers, so if you can help me with any of these questions then I could do this more quickly.

  1. What is icpc?
  2. Is it reasonable to expect everyone to have gcc on their platform?
  3. Can this be configured in Makevars, or somewhere else?
  4. How can I access a platform similar to yours to reproduce the error?

nacnudus avatar Sep 14 '20 12:09 nacnudus

  1. that is the Intel C++ compiler
  2. I am not sure. I was under the impression that Microsoft R was all compiled with the Intel Compiler. However, in my case GCC is also installed, but Intel is the default compiler on our High Performance Computing cluster.
  3. I think this is the relevant R documentation on making the code more portable to other infrastructures: https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Writing-portable-packages and https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-Makevars - this StackOverflow question might also be useful as it gives examples and answers from Dirk Eddelbuettel.
  4. Great question! I don't know the answer unfortunately.

wdkrnls avatar Sep 25 '20 14:09 wdkrnls

Thanks for replying. The piton package will hopefully be upgraded to the latest version of pegtl (which is the C library that it wraps). I'm going to wait until that happens before doing anything, because that might be where the bug is.

nacnudus avatar Oct 08 '20 21:10 nacnudus

I will look out for that upgrade and give building tidyxl another shot then on the Intel compiler. In the meantime, my friendly sysadmins have graciously gotten me set up with a pure gcc R+openblas setup as well so I and all my colleagues can benefit from this indispensable tool. Thanks so much for sharing your genius.

wdkrnls avatar Oct 09 '20 10:10 wdkrnls

@wdkrnls now that tidyxl and piton have been upgraded, please could you try building tidyxl? Thanks.

nacnudus avatar Nov 19 '20 18:11 nacnudus

Hi @nacnudus,

I just tried again today with the Intel compiler. I'm still seeing "compilation aborted for xlex.cpp (code 2)". Fortunately, I have been able to keep everyone going with tidyxl using the gcc compiler.

wdkrnls avatar Dec 09 '20 18:12 wdkrnls

I wonder whether it would be as simple as putting CC="gcc" and CXX="g++" into src/Makevars. Would you be able to try that?

nacnudus avatar Dec 09 '20 23:12 nacnudus

It turns out that packages can't override CC or CXX https://stackoverflow.com/a/49239581/937932. So I'll have to work out how to build and debug tidyxl with icc.

nacnudus avatar Dec 31 '20 10:12 nacnudus

Perhaps you can check with the rstan developers for tips about what they do? They require the user to setup a special ~/.R/Makevars file to configure the compilation of Stan programs. Honestly, I think just including the warning to stick with gcc is enough. I am thankful you are volunteering your time to support the R community, and don't want to derail your invaluable efforts towards a niche use case which isn't free and thus hard to support.

wdkrnls avatar Jan 02 '21 19:01 wdkrnls