Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial attempt for supporting presets. #549

Conversation

mwaxmonsky
Copy link
Collaborator

Adds preset file and now to target derecho a100 gpu, we can simply run cmake --preset=derecho-gpu with the following output:

-- CMake build configuration for micm(Release) 3.5.0
-- Found EnvModules: /glade/u/apps/casper/23.10/spack/opt/spack/lmod/8.7.24/gcc/7.5.0/m4jx/lmod/lmod/libexec/lmod  

Lmod is automatically replacing "intel/2023.2.1" with "nvhpc/23.7".


Due to MODULEPATH changes, the following have been reloaded:
  1) hdf5/1.12.2     2) ncarcompilers/1.0.0     3) netcdf/4.9.2     4) openmpi/4.1.6

-- Currently loaded modules: ncarenv/23.10;nvhpc/23.7;ncarcompilers/1.0.0;hdf5/1.12.2;netcdf/4.9.2;gcc-toolchain/12.2.0;cmake/3.26.3
-- The C compiler identification is NVHPC 23.7.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /glade/u/apps/casper/23.10/spack/opt/spack/ncarcompilers/1.0.0/nvhpc/23.7/pw2i/bin/nvc - skipped
-- Detecting C compile features
-- Detecting C compile features - done

@mwaxmonsky mwaxmonsky linked an issue Jun 5, 2024 that may be closed by this pull request
@mwaxmonsky
Copy link
Collaborator Author

Closing this as this is not possible at this time.

Currently, the CMake documentation states to not use this to load build time requirements (https://cmake.org/cmake/help/latest/module/FindEnvModules.html). After some testing, there is the ability to add the module load/unload ... commands to the ALL target that will be called before each target during the make ... phase, but this has two problems:

  1. Each target Makefile is hardcoded to use /bin/sh (https://github.com/Kitware/CMake/blob/de8911120eea6aa8df5e156bce2643c819e7c10f/Source/cmLocalUnixMakefileGenerator3.cxx#L658) which does not throw an error when calling . /path/to/lmod/init/sh but does throw an error when calling module load ... saying module command not found.
  2. Even if we could migrate to setting /bin/bash in the Makefile's, each target is made in a unique shell session and the Makefiles would have to be modified to share environments so the module load ...'s could be propagated through the targets which is non-trivial and would require manual changes to Makefiles after the configure step if it's possible at all.

@mwaxmonsky mwaxmonsky closed this Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate CMakePresets.json to store machine specific settings
1 participant