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

Store environment file used for building #17

Closed
s-poll opened this issue Jan 12, 2024 · 2 comments
Closed

Store environment file used for building #17

s-poll opened this issue Jan 12, 2024 · 2 comments
Assignees

Comments

@s-poll
Copy link
Member

s-poll commented Jan 12, 2024

Hi all

to my knowledge you can not determine from the INSTALL_DIR, which environment was used to compile the code. I would like to suggest to store the environment file in the install-directory during installation.

e.g.

Step 2

export TSMP2_ENV=${TSMP2_DIR}/env/jsc.2023_Intel.sh
source $TSMP2_ENV

and that while

cmake --install ${BUILD_DIR}

a copy of the environment file is done to the installation directory.

What are your thoughts? Are there any other/better solutions to know the environment, which was used for compilation?

Best

@kvrigor
Copy link
Member

kvrigor commented Jan 13, 2024

Here are some ideas:

  • INSTALL_DIR can be set to include environment info, e.g. ${ROOT_DIR}/${INSTALL_DIR}=tsmp2_jurecadc_intel_stg2023.
  • Standardize the folder structure of ${ROOT_DIR} such that compiler info can be deduced from the path. The $EBROOT* shell variables, which are automatically set whenever a module is loaded, work this way.
  • Log the build process with tee:
INSTALL_DIR="/p/project/cslts/software/$STAGE/${SYSTEMNAME}/${MODEL_ID}"
BUILD_LOG="${INSTALL_DIR}/$(date +%Y.%m.%d_%H.%M).log"

# Load environment
source ${TSMP2_DIR}/env/jsc.2023_Intel.sh |& tee ${BUILD_LOG}

# Configure, build, and install
cmake -S ${TSMP2} -B ${BUILD_DIR}           \
      -DCMAKE_BUILD_TYPE="${BUILD_CONFIG}"  \
      -DOASIS_SRC=${OASIS_SRC}              \
      -DeCLM_SRC=${eCLM_SRC}                \
      -DICON_SRC=${ICON_SRC}                \
      -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
      |& tee -a ${BUILD_LOG}
cmake --build ${BUILD_DIR}   |& tee -a ${BUILD_LOG}
cmake --install ${BUILD_DIR} |& tee -a ${BUILD_LOG}
  • Modify the CMake scripts to automatically generate a tsmp2.settings file. [example]

I prefer the last option which is like what you've suggested @s-poll. Alternatively the other options could provide a quick way to store the environment information.

@s-poll
Copy link
Member Author

s-poll commented Oct 8, 2024

solved by PR #24

@s-poll s-poll closed this as completed Oct 8, 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

No branches or pull requests

2 participants