easybuilders / easybuild-framework

EasyBuild is a software installation framework in Python that allows you to install software in a structured and robust way.
https://easybuild.io
GNU General Public License v2.0
152 stars 202 forks source link

`preinstallcmds` for easyconfigs #4694

Open moravveji opened 1 week ago

moravveji commented 1 week ago

Recently, a user asked me a custom LAMMPS installation. In this specific case, first the pair_allegro patch has to be applied to override the CMakeLists.txt, before LAMMPS is built. I eventually misused preconfigopts for the purpose:

preconfigopts = ' && '.join([
    'cd %(builddir)s',
    'git clone https://github.com/mir-group/pair_allegro',
    'cd pair_allegro',
    'export PYTORCH_JIT_USE_NNC_NOT_NVFUSER=1',
    './patch_lammps.sh %(start_dir)s',
    'cd %(builddir)s/easybuild_obj',
     'rm -f CMakeCache.txt',
    '',
])

The official description of preconfigopts is: "Extra options pre-passed to configure".

To alleviate that, I wonder if a new easyconfig attribute could be added to serve such purposes as mentioned above. If I imagine it, it can be called preinstallcmds (or anything else that suits). I would also couple nicely with postinstallcmds which is widely used.

Can you guys consider this for one of the next releases?

ocaisa commented 1 week ago

This would not be a preinstallcmds as the install step happens after the configure step.

The way you implemented this is not reproducible, you should really check out a specific commit of pair_allegro.

Is there a reason you did not just create a patch file for LAMMPS using patch_lammps.sh? That should have the same affect as your preconfigopts (apart from exporting the environment variable)?

ocaisa commented 1 week ago

I'd suspect you also want the PYTORCH_JIT_USE_NNC_NOT_NVFUSER in the final module file as well if it really is intended for JIT compilation.