[Env] add configs for cbp machines for ASNUM tutorial#1788
[Env] add configs for cbp machines for ASNUM tutorial#1788tdavidcl merged 3 commits intoShamrock-code:mainfrom
Conversation
|
Thanks @tdavidcl for opening this PR! You can do multiple things directly here: Once the workflow completes a message will appear displaying informations related to the run. Also the PR gets automatically reviewed by gemini, you can: |
There was a problem hiding this comment.
Code Review
This pull request introduces new environment configurations for CBP Nvidia C4140, DGX A100, and H200x4 machines using AdaptiveCpp (SSCP), alongside path updates for generic CBP machine environments. The review feedback highlights several opportunities for improvement: consolidating duplicated logic across the nearly identical machine configurations to enhance maintainability, removing unused imports and functions in the Python setup scripts, and ensuring robust error propagation in shell scripts by adding '|| return' to CMake commands.
| import argparse | ||
| import os | ||
|
|
||
| import utils.acpp | ||
| import utils.amd_arch | ||
| import utils.cuda_arch | ||
| import utils.envscript | ||
| import utils.sysinfo | ||
| from utils.setuparg import * | ||
|
|
||
| NAME = "CBP Nvidia C4140 (4 V100) AdaptiveCpp (SSCP)" | ||
| PATH = "machine/cbp/c4140/acpp-sscp" | ||
|
|
||
|
|
||
| def is_acpp_already_installed(installfolder): | ||
| return os.path.isfile(installfolder + "/bin/acpp") | ||
|
|
||
|
|
||
| def setup(arg: SetupArg, envgen: EnvGen): | ||
| argv = arg.argv | ||
| builddir = arg.builddir | ||
| shamrockdir = arg.shamrockdir | ||
| buildtype = arg.buildtype | ||
| lib_mode = arg.lib_mode | ||
|
|
||
| parser = argparse.ArgumentParser(prog=PATH, description=NAME + " env for Shamrock") | ||
|
|
||
| parser.add_argument("--gen", action="store", help="generator to use (ninja or make)") | ||
|
|
||
| args = parser.parse_args(argv) | ||
|
|
||
| gen, gen_opt, cmake_gen, cmake_build_type = utils.sysinfo.select_generator(args, buildtype) | ||
|
|
||
| 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.gen_env_file("env_built_acpp.sh") |
There was a problem hiding this comment.
The setup-env.py and env_built_acpp.sh files for the c4140, dgx, and h200x4 machine configurations are nearly identical. To improve maintainability and adhere to the general rule of refactoring duplicated logic, consider consolidating the common parts into a shared utility or a base configuration script.
References
- Refactor duplicated logic into a helper function or lambda to improve readability and maintainability.
| import argparse | ||
| import os | ||
|
|
||
| import utils.acpp | ||
| import utils.amd_arch | ||
| import utils.cuda_arch | ||
| import utils.envscript | ||
| import utils.sysinfo | ||
| from utils.setuparg import * |
There was a problem hiding this comment.
Several imports are unused, and the star import from utils.setuparg should be replaced with explicit imports to improve clarity and avoid namespace pollution.
| import argparse | |
| import os | |
| import utils.acpp | |
| import utils.amd_arch | |
| import utils.cuda_arch | |
| import utils.envscript | |
| import utils.sysinfo | |
| from utils.setuparg import * | |
| import argparse | |
| import utils.sysinfo | |
| from utils.setuparg import SetupArg, EnvGen |
| def is_acpp_already_installed(installfolder): | ||
| return os.path.isfile(installfolder + "/bin/acpp") | ||
|
|
||
|
|
||
| def setup(arg: SetupArg, envgen: EnvGen): | ||
| argv = arg.argv | ||
| builddir = arg.builddir | ||
| shamrockdir = arg.shamrockdir | ||
| buildtype = arg.buildtype | ||
| lib_mode = arg.lib_mode |
There was a problem hiding this comment.
The function is_acpp_already_installed and the variable lib_mode are unused in this script and should be removed to keep the codebase clean.
| def is_acpp_already_installed(installfolder): | |
| return os.path.isfile(installfolder + "/bin/acpp") | |
| def setup(arg: SetupArg, envgen: EnvGen): | |
| argv = arg.argv | |
| builddir = arg.builddir | |
| shamrockdir = arg.shamrockdir | |
| buildtype = arg.buildtype | |
| lib_mode = arg.lib_mode | |
| def setup(arg: SetupArg, envgen: EnvGen): | |
| argv = arg.argv | |
| builddir = arg.builddir | |
| shamrockdir = arg.shamrockdir | |
| buildtype = arg.buildtype |
| cmake \ | ||
| -S $SHAMROCK_DIR \ | ||
| -B $BUILD_DIR \ | ||
| -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}" \ | ||
| -DBUILD_TEST=Yes \ | ||
| "${CMAKE_OPT[@]}" |
There was a problem hiding this comment.
The cmake command in shamconfigure is missing error propagation. Adding || return ensures that if configuration fails, the script stops execution, maintaining consistency with other functions in the environment scripts.
| cmake \ | |
| -S $SHAMROCK_DIR \ | |
| -B $BUILD_DIR \ | |
| -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}" \ | |
| -DBUILD_TEST=Yes \ | |
| "${CMAKE_OPT[@]}" | |
| cmake \ | |
| -S $SHAMROCK_DIR \ | |
| -B $BUILD_DIR \ | |
| -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}" \ | |
| -DBUILD_TEST=Yes \ | |
| "${CMAKE_OPT[@]}" || return |
| import argparse | ||
| import os | ||
|
|
||
| import utils.acpp | ||
| import utils.amd_arch | ||
| import utils.cuda_arch | ||
| import utils.envscript | ||
| import utils.sysinfo | ||
| from utils.setuparg import * |
There was a problem hiding this comment.
Several imports are unused, and the star import from utils.setuparg should be replaced with explicit imports to improve clarity and avoid namespace pollution.
| import argparse | |
| import os | |
| import utils.acpp | |
| import utils.amd_arch | |
| import utils.cuda_arch | |
| import utils.envscript | |
| import utils.sysinfo | |
| from utils.setuparg import * | |
| import argparse | |
| import utils.sysinfo | |
| from utils.setuparg import SetupArg, EnvGen |
| def is_acpp_already_installed(installfolder): | ||
| return os.path.isfile(installfolder + "/bin/acpp") | ||
|
|
||
|
|
||
| def setup(arg: SetupArg, envgen: EnvGen): | ||
| argv = arg.argv | ||
| builddir = arg.builddir | ||
| shamrockdir = arg.shamrockdir | ||
| buildtype = arg.buildtype | ||
| lib_mode = arg.lib_mode |
There was a problem hiding this comment.
The function is_acpp_already_installed and the variable lib_mode are unused in this script and should be removed to keep the codebase clean.
| def is_acpp_already_installed(installfolder): | |
| return os.path.isfile(installfolder + "/bin/acpp") | |
| def setup(arg: SetupArg, envgen: EnvGen): | |
| argv = arg.argv | |
| builddir = arg.builddir | |
| shamrockdir = arg.shamrockdir | |
| buildtype = arg.buildtype | |
| lib_mode = arg.lib_mode | |
| def setup(arg: SetupArg, envgen: EnvGen): | |
| argv = arg.argv | |
| builddir = arg.builddir | |
| shamrockdir = arg.shamrockdir | |
| buildtype = arg.buildtype |
| cmake \ | ||
| -S $SHAMROCK_DIR \ | ||
| -B $BUILD_DIR \ | ||
| -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}" \ | ||
| -DBUILD_TEST=Yes \ | ||
| "${CMAKE_OPT[@]}" |
There was a problem hiding this comment.
The cmake command in shamconfigure is missing error propagation. Adding || return ensures that if configuration fails, the script stops execution, maintaining consistency with other functions in the environment scripts.
| cmake \ | |
| -S $SHAMROCK_DIR \ | |
| -B $BUILD_DIR \ | |
| -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}" \ | |
| -DBUILD_TEST=Yes \ | |
| "${CMAKE_OPT[@]}" | |
| cmake \ | |
| -S $SHAMROCK_DIR \ | |
| -B $BUILD_DIR \ | |
| -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}" \ | |
| -DBUILD_TEST=Yes \ | |
| "${CMAKE_OPT[@]}" || return |
| import argparse | ||
| import os | ||
|
|
||
| import utils.acpp | ||
| import utils.amd_arch | ||
| import utils.cuda_arch | ||
| import utils.envscript | ||
| import utils.sysinfo | ||
| from utils.setuparg import * |
There was a problem hiding this comment.
Several imports are unused, and the star import from utils.setuparg should be replaced with explicit imports to improve clarity and avoid namespace pollution.
| import argparse | |
| import os | |
| import utils.acpp | |
| import utils.amd_arch | |
| import utils.cuda_arch | |
| import utils.envscript | |
| import utils.sysinfo | |
| from utils.setuparg import * | |
| import argparse | |
| import utils.sysinfo | |
| from utils.setuparg import SetupArg, EnvGen |
| def is_acpp_already_installed(installfolder): | ||
| return os.path.isfile(installfolder + "/bin/acpp") | ||
|
|
||
|
|
||
| def setup(arg: SetupArg, envgen: EnvGen): | ||
| argv = arg.argv | ||
| builddir = arg.builddir | ||
| shamrockdir = arg.shamrockdir | ||
| buildtype = arg.buildtype | ||
| lib_mode = arg.lib_mode |
There was a problem hiding this comment.
The function is_acpp_already_installed and the variable lib_mode are unused in this script and should be removed to keep the codebase clean.
| def is_acpp_already_installed(installfolder): | |
| return os.path.isfile(installfolder + "/bin/acpp") | |
| def setup(arg: SetupArg, envgen: EnvGen): | |
| argv = arg.argv | |
| builddir = arg.builddir | |
| shamrockdir = arg.shamrockdir | |
| buildtype = arg.buildtype | |
| lib_mode = arg.lib_mode | |
| def setup(arg: SetupArg, envgen: EnvGen): | |
| argv = arg.argv | |
| builddir = arg.builddir | |
| shamrockdir = arg.shamrockdir | |
| buildtype = arg.buildtype |
| cmake \ | ||
| -S $SHAMROCK_DIR \ | ||
| -B $BUILD_DIR \ | ||
| -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}" \ | ||
| -DBUILD_TEST=Yes \ | ||
| "${CMAKE_OPT[@]}" |
There was a problem hiding this comment.
The cmake command in shamconfigure is missing error propagation. Adding || return ensures that if configuration fails, the script stops execution, maintaining consistency with other functions in the environment scripts.
| cmake \ | |
| -S $SHAMROCK_DIR \ | |
| -B $BUILD_DIR \ | |
| -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}" \ | |
| -DBUILD_TEST=Yes \ | |
| "${CMAKE_OPT[@]}" | |
| cmake \ | |
| -S $SHAMROCK_DIR \ | |
| -B $BUILD_DIR \ | |
| -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}" \ | |
| -DBUILD_TEST=Yes \ | |
| "${CMAKE_OPT[@]}" || return |
Workflow reportworkflow report corresponding to commit 4264d24 Pre-commit check reportPre-commit check: ✅ Test pipeline can run. Clang-tidy diff reportNo relevant changes found. You should now go back to your normal life and enjoy a hopefully sunny day while waiting for the review. Doxygen diff with
|
No description provided.