Add Makevars.site file to R modules on Cheaha to manage "Illegal Instruction" errors during package installation
We may need to include a Makevars.site file with explicit compiler instructions to address installation issues encountered when R packages are compiled on one CPU architecture (e.g., Intel) and later used on another (e.g., AMD). We may also need to provide an option for Open OnDemand (OOD) users to specify a batch constraint that restricts RStudio sessions to a single CPU architecture.
The Makevars.site should be placed here for R4.4.1, /share/apps/rc/software/R/4.4.1-gfbf-2023b/lib64/R/etc/ . We may need to do something similar for other R modules on the cluster.
The Makevars.site file should contain the following instruction.
CFLAGS = -O2 -ftree-vectorize -march=broadwell -fno-math-errno
CXXFLAGS = -O2 -ftree-vectorize -march=broadwell -fno-math-errno
CXX11FLAGS = -O2 -ftree-vectorize -march=broadwell -fno-math-errno
CXX14FLAGS = -O2 -ftree-vectorize -march=broadwell -fno-math-errno
CXX17FLAGS = -O2 -ftree-vectorize -march=broadwell -fno-math-errno
CXX20FLAGS = -O2 -ftree-vectorize -march=broadwell -fno-math-errno