Skip to content

Add hook for changing `-march=native` to `-march=x86-64-v3` in `Makeconf` file of R installations

Aurel Istrate requested to merge R_march_hook into master

Created by: bedroge

TODO: add another hook that temporarily reverts this change for easyconfigs that install R extensions, e.g. R-bundle-CRAN. Done in https://github.com/rug-cit-hpc/cit-hpc-easybuild/pull/59/commits/12bfd10a0ce08d0dc1cdbb4a368c334d5601d5b0.

This adds a post-extensions hook for the installation of R itself, which will replace -march=native by -march=x86-64-v3 in its Makeconf file when it's done with installing the included extensions. The original file will be copied to Makeconf.bak.

To make sure that our EB-installed R packages are still properly optimized, it also adds a pre-install hook that applies to any easyconfig with easyblock = RPackage, and this hook basically reverts that change temporarily by making a symlink $HOME/.R/Makevars -> $EBROOTR/lib64/R/etc/Makeconf.bak, i.e. to the original Makeconf file of the corresponding R installation. As the user file takes precedence, it will override the values from the Makeconf file in the R installation. A corresponding post-install hook will remove the symlink again. Note that the pre-install hook will error out if it finds an existing $HOME/.R/Makevars, as it would otherwise overwrite it, and it's somewhat dangerous anyway to have such a file in your home directory.

TODO: test it on a bundle, as I'm not sure if it will call the hook in that case (extensions don't seem to call the pre/post-install).

Merge request reports