Illegal instruction error with R

Dear all,

I am trying to run some R script that relies on packages written in Rcpp. I build my packages on the login node. As far as I have understood, this may cause advanced CPU instructions to be used which are not available on all the nodes (e.g., on generation 2).

How do I build my packages so that they can run on any generation nodes?

Thanks a lot for the help

You need to ensure that you pass to gcc the flag -march=westmere. You also need to ensure that every library you use was compiled with the same flag. More details to this issue can be found GCC optimal flag . It may be easier to just indicate to slurm which node you can use, or build your code on a westmere node this will ensure that automatic detection of valid instruction and the use of -march=native does not generate a code with not accessible instruction set.

Hei Paolo, thanks a lot for the answer!

I was also wondering if I just had better to compile on one of the oldest nodes. For this, I tried to get a shell on one of those and then compile my thing there. So I did

salloc -n1 -c1 --constraint=V2 --time=15:00 srun -n1 -N1 --pty $SHELL

which however fails:

salloc: error: Job submit/allocate failed: Requested node configuration is not available

Is this the correct way to do that?

thanks again

Hello Davide,

Slurm is correct. As you didn’t specified a partition, the default partition is used, which is debug-EL7. In this partition there aren’t any V2 node. You should use mono-shared-EL for this.

By the way, depending on what you are compiling, you may or not face the issue that a binary isn’t runable on an old node. Most of the code compiled on the login node can be run without issue on any compute node.


Thanks a lot Yann,

Most of the code compiled on the login node can be run without issue on any compute node.

Unfortunately this does not hold for my R packages. I get the illegal instruction problem when they are run on some V2 node, whereas they run nicely on V6. However, I wouldn’t like to to unnecessarily put constraints to the scheduler.

What do you suggest me to do?


Do as you tried, compile on an old node, it’s the easiest way. Not all code honor specific optimization flag and some code are trying hard to guess the optimal flags to use, which is not what you want here.