-
Notifications
You must be signed in to change notification settings - Fork 32
[Env] Adastra AdaptiveCPP environment #1869
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
Open
y-lapeyre
wants to merge
13
commits into
Shamrock-code:main
Choose a base branch
from
y-lapeyre:env/adastra_acpp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e2a66d5
baseline
y-lapeyre e07d464
load prerequisite for boost
y-lapeyre 1899e12
add explicit path to boost libraries
y-lapeyre da8425d
switch Cmake config
y-lapeyre c36caea
find boost dammit
y-lapeyre 12e9010
formatting
y-lapeyre dc99117
find boost
y-lapeyre 632b8a7
linking properly
y-lapeyre a51e1ea
pass flags to modules
y-lapeyre 154ffbe
formatting
y-lapeyre 939d6a3
formatting + fix example batch
y-lapeyre 015cb24
Merge branch 'main' into env/adastra_acpp
y-lapeyre 16bfd2c
Merge branch 'main' into env/adastra_acpp
tdavidcl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # Everything before this line will be provided by the new-env script | ||
|
|
||
| # ---- Modules ---- | ||
| module purge | ||
| module load cpe/25.09 | ||
| module load craype-accel-amd-gfx90a craype-x86-trento | ||
| module load PrgEnv-cray | ||
| module load amd-mixed | ||
| module load rocm | ||
| module load cray-python | ||
| module load cmake | ||
| module load ninja | ||
| module load CCE-GPU-5.0.0 | ||
| module load boost/1.88.0-mpi | ||
|
|
||
| # ---- AdaptiveCpp config ---- | ||
| export ACPP_VERSION=v24.10.0 | ||
| export ACPP_TARGETS="hip:gfx90a" | ||
| export ACPP_GIT_DIR=$BUILD_DIR/.env/acpp-git | ||
| export ACPP_BUILD_DIR=$BUILD_DIR/.env/acpp-builddir | ||
| export ACPP_INSTALL_DIR=$BUILD_DIR/.env/acpp-installdir | ||
|
|
||
| export C_INCLUDE_PATH=$ROCM_PATH/llvm/include | ||
| export CPLUS_INCLUDE_PATH=$ROCM_PATH/llvm/include | ||
|
|
||
| export MPICH_GPU_SUPPORT_ENABLED=1 | ||
|
|
||
| export BOOST_ROOT_PATH="${BOOST_ROOT:-/opt/software/gaia/prod/5.0.0/boost-1.88.0-cce-18.0.0-ml3z}" | ||
| export BOOST_SYMLINK_DIR=$BUILD_DIR/.env/boost-symlinks | ||
|
|
||
| function setupboost { | ||
| # here I lost 2hrs of my life | ||
| mkdir -p "${BOOST_SYMLINK_DIR}" | ||
| for tagged in "${BOOST_ROOT_PATH}/lib"/libboost_*-mt-x64.so; do | ||
| # e.g. libboost_context-mt-x64.so -> libboost_context.so | ||
| base=$(basename "$tagged") | ||
| untagged="${base/-mt-x64/}" | ||
| if [ ! -e "${BOOST_SYMLINK_DIR}/${untagged}" ]; then | ||
| ln -s "$tagged" "${BOOST_SYMLINK_DIR}/${untagged}" | ||
| fi | ||
| done | ||
| } | ||
|
|
||
| setupboost | ||
|
|
||
| export LD_LIBRARY_PATH="${BOOST_SYMLINK_DIR}:${BOOST_ROOT_PATH}/lib:${LD_LIBRARY_PATH}" | ||
|
|
||
| # ---- Compiler setup ---- | ||
| function setupcompiler { | ||
| echo " ---- Running AdaptiveCpp compiler setup ----" | ||
| echo " -- Module list" | ||
| module list | ||
|
|
||
| clone_acpp || return | ||
|
|
||
| cmake -S ${ACPP_GIT_DIR} -B ${ACPP_BUILD_DIR} \ | ||
| -DCMAKE_INSTALL_PREFIX=${ACPP_INSTALL_DIR} \ | ||
| -DROCM_PATH=$ROCM_PATH \ | ||
| -DCMAKE_C_COMPILER=${ROCM_PATH}/llvm/bin/clang \ | ||
| -DCMAKE_CXX_COMPILER=${ROCM_PATH}/llvm/bin/clang++ \ | ||
| -DWITH_ACCELERATED_CPU=ON \ | ||
| -DWITH_CPU_BACKEND=ON \ | ||
| -DWITH_CUDA_BACKEND=OFF \ | ||
| -DWITH_ROCM_BACKEND=ON \ | ||
| -DWITH_OPENCL_BACKEND=OFF \ | ||
| -DWITH_LEVEL_ZERO_BACKEND=OFF \ | ||
| -DACPP_TARGETS="gfx90a" \ | ||
| -DBOOST_ROOT="${BOOST_ROOT_PATH}" \ | ||
| -DBoost_DIR="${BOOST_ROOT_PATH}/lib/cmake" \ | ||
| -DBoost_NO_BOOST_CMAKE=FALSE \ | ||
| -DBoost_NO_SYSTEM_PATHS=TRUE \ | ||
| -DWITH_SSCP_COMPILER=OFF \ | ||
| -DLLVM_DIR=${ROCM_PATH}/llvm/lib/cmake/llvm/ || return | ||
|
y-lapeyre marked this conversation as resolved.
|
||
|
|
||
| (cd ${ACPP_BUILD_DIR} && $MAKE_EXEC "${MAKE_OPT[@]}" && $MAKE_EXEC install) || return | ||
| } | ||
|
|
||
| if [ ! -f "$ACPP_INSTALL_DIR/bin/acpp" ]; then | ||
| echo " ----- acpp is not configured, compiling it ... -----" | ||
| setupcompiler || return | ||
| echo " ----- acpp configured ! -----" | ||
| fi | ||
|
|
||
| # ---- Shamrock configure ---- | ||
| function shamconfigure { | ||
| cmake \ | ||
| -S $SHAMROCK_DIR \ | ||
| -B $BUILD_DIR \ | ||
|
y-lapeyre marked this conversation as resolved.
|
||
| -DSHAMROCK_ENABLE_BACKEND=SYCL \ | ||
| -DSYCL_IMPLEMENTATION=ACPPDirect \ | ||
| -DCMAKE_CXX_COMPILER="${ACPP_INSTALL_DIR}/bin/acpp" \ | ||
| -DACPP_PATH="${ACPP_INSTALL_DIR}" \ | ||
| -DCMAKE_BUILD_TYPE="${SHAMROCK_BUILD_TYPE}" \ | ||
| -DCMAKE_CXX_FLAGS="-march=znver3 -isystem ${CRAY_MPICH_PREFIX}/include" \ | ||
| -DCMAKE_SHARED_LINKER_FLAGS="-L\"${BOOST_SYMLINK_DIR}\" -Wl,-rpath,${BOOST_SYMLINK_DIR}" \ | ||
| -DCMAKE_MODULE_LINKER_FLAGS="-L\"${BOOST_SYMLINK_DIR}\" -Wl,-rpath,${BOOST_SYMLINK_DIR}" \ | ||
| -DCMAKE_EXE_LINKER_FLAGS="-lpthread -L\"${CRAY_MPICH_PREFIX}/lib\" -lmpi ${PE_MPICH_GTL_DIR_amd_gfx90a} ${PE_MPICH_GTL_LIBS_amd_gfx90a} -L\"${BOOST_SYMLINK_DIR}\" -Wl,-rpath,${BOOST_SYMLINK_DIR}" \ | ||
| -DBUILD_TEST=Yes \ | ||
| -DCXX_FLAG_ARCH_NATIVE=off \ | ||
| -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \ | ||
| "${CMAKE_OPT[@]}" || return | ||
| } | ||
|
|
||
| # ---- Shamrock build ---- | ||
| function shammake { | ||
| (cd $BUILD_DIR && $MAKE_EXEC "${MAKE_OPT[@]}" "${@}") || return | ||
| } | ||
|
y-lapeyre marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/bin/bash | ||
| #SBATCH --account=<project account> | ||
| #SBATCH --job-name=<jobname> | ||
| #SBATCH --constraint=MI250 | ||
| #SBATCH --nodes=1 | ||
| #SBATCH --exclusive | ||
| #SBATCH --time=01:00:00 | ||
| #SBATCH --output=job.%j.out | ||
| #SBATCH --error=job.%j.out # Same file for both! | ||
|
|
||
|
|
||
| module purge | ||
| source /opt/cray/pe/cpe/24.07/restore_lmod_system_defaults.sh | ||
| # A CrayPE environment version | ||
| module load cpe/24.11 | ||
| # An architecture | ||
| module load craype-accel-amd-gfx90a craype-x86-trento | ||
| # A compiler to target the architecture | ||
| module load PrgEnv-cray | ||
| # Some architecture related libraries and tools | ||
| module load amd-mixed/6.4.3 | ||
|
|
||
| module list | ||
|
|
||
| export MPICH_GPU_SUPPORT_ENABLED=1 | ||
| export SYCL_DEVICE_ALLOCATOR=aligned | ||
| # export OMP_<ICV=XXX> | ||
| WORKDIR=<path-to-Shamrock-build-directory> | ||
|
|
||
| . /opt/cray/pe/cpe/24.11/restore_lmod_system_defaults.sh | ||
|
|
||
| export SHAM_MAX_ALLOC_SIZE=4294967296 | ||
|
|
||
| . ./activate | ||
|
Comment on lines
+12
to
+34
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are already providing the module loads in the activate script. It should work if you remove the one here i'd assume |
||
|
|
||
| srun --ntasks-per-node=8 --cpus-per-task=8 --threads-per-core=1 --gpus-per-task=1 --gpu-bind=closest -- ./shamrock --smi-full --sycl-cfg auto:HIP --force-dgpu-off --loglevel 1 --rscript runscript.py | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import argparse | ||
| import os | ||
|
|
||
| import utils.amd_arch | ||
| import utils.envscript | ||
| import utils.intel_llvm | ||
| import utils.sysinfo | ||
| from utils.oscmd import * | ||
| from utils.setuparg import * | ||
|
|
||
| NAME = "Adastra Intel AdaptiveCpp ROCM/LLVM" | ||
| PATH = "machine/adastra/mi250/acpp-rocm-llvm" | ||
|
|
||
|
|
||
| def setup(arg: SetupArg, envgen: EnvGen): | ||
| argv = arg.argv | ||
| builddir = arg.builddir | ||
| shamrockdir = arg.shamrockdir | ||
| buildtype = arg.buildtype | ||
| lib_mode = arg.lib_mode | ||
|
|
||
| # Get current file path | ||
| cur_file = os.path.realpath(os.path.expanduser(__file__)) | ||
|
|
||
| parser = argparse.ArgumentParser(prog=PATH, description=NAME + " env for Shamrock") | ||
| args = parser.parse_args(argv) | ||
| args.gen = "ninja" | ||
|
|
||
| gen, gen_opt, cmake_gen, cmake_build_type = utils.sysinfo.select_generator(args, buildtype) | ||
|
|
||
| ############################## | ||
| # Generate env script header | ||
| ############################## | ||
|
|
||
| cmake_extra_args = "" | ||
|
|
||
| envgen.export_list = { | ||
| "SHAMROCK_DIR": shamrockdir, | ||
| "BUILD_DIR": builddir, | ||
| "CMAKE_GENERATOR": cmake_gen, | ||
| "MAKE_EXEC": gen, | ||
| "MAKE_OPT": f"({gen_opt})", | ||
| "CMAKE_OPT": f"({cmake_extra_args})", | ||
| "SHAMROCK_BUILD_TYPE": f"'{cmake_build_type}'", | ||
| } | ||
|
|
||
| envgen.ext_script_list = [ | ||
| shamrockdir + "/env/helpers/clone-acpp.sh", | ||
| shamrockdir + "/env/helpers/pull_reffiles.sh", | ||
| ] | ||
|
|
||
| envgen.copy_env_file("exemple_batch.sh", "exemple_batch.sh") | ||
| envgen.gen_env_file("env_built_acpp.sh") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.