Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ the studio, and as the starting point of new campaigns.
a file of the physics recompiles the kernels of that model at its next run (about 10 s per kernel,
`physics/jit.py`; about 1 min more the first time for a compiler and Kokkos).

canoP runs on the host (Kokkos backend OpenMP) or on a GPU (Cuda, with the architecture of the GPU,
e.g. `kokkos_arch_gpu = AMPERE80` for an A100). canoP builds its shared Kokkos (at the first
canoP runs on the host (Kokkos backend OpenMP) or on a GPU (Cuda for NVIDIA, HIP for AMD, with the
architecture of the GPU, e.g. `kokkos_arch_gpu = AMPERE80` for an A100, `AMD_GFX90A` for an MI250X).
canoP builds its shared Kokkos (at the first
configuration of a build directory, a few minutes), pykokkos-base and pykokkos (submodule
`external/pykokkos`). Each backend has its own environment, CMake options and Slurm lines of the
runs (user only, switched with `kokkos_backend`); the environment gives a python3, from which canoP
runs (user only, switched with `kokkos_backend`, as is the GPU architecture); the environment gives a python3, from which canoP
makes its venv `.local/python<version>` (numpy, h5py, pybind11 3.1.0) when it lacks them.
`build_launcher = sbatch` compiles on a compute node (a Slurm job of `build_jobs` cores; Cuda needs
no GPU to compile). On a GPU the kernels of the physics are compiled by the first run on a GPU node
`build_launcher = sbatch` compiles on a compute node (a Slurm job of `build_jobs` cores; Cuda and HIP
need no GPU to compile). On a GPU the kernels of the physics are compiled by the first run on a GPU node
(20 to 45 s each), not on a login node.

## Developing canoP studio itself
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ The user-visible changes of canoP, by version (see `CONTRIBUTING.md` for the ver
installation, the canoP icon and Claude Code (proxy of the Claude API); `open_studio` of the MCP
bridge recognises a Remote-SSH window and points to the canoP icon or the Ports panel of VS Code
instead of an ssh tunnel.
- HIP backend for AMD GPUs (e.g. MI250X, MI300A): the shared Kokkos, pykokkos-base and the kernels of
the physics are compiled with hipcc. canoP studio offers HIP in its Kokkos backends, keeps the GPU
architecture per backend, and pre-fills the modules and Slurm constraints of Adastra (CINES) for
OpenMP and HIP.
- canoP studio: GPUs can also be requested with `--gpus-per-node` (Slurm request `gpus-per-node`), as
Adastra requires.
- canoP studio in English or in French: a FR/EN switch in the top bar, saved in the settings. New
installations start in English; studios set up before keep French.
- Tutorial of canoP studio in the documentation: the build, a run of the blast example, and a
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ its build settings.
## Quick start from the command line

Dependencies: a C++17 compiler, CMake, MPI, HDF5 and Python 3.11 to 3.14 (numpy and pybind11 3.1.0
are installed in a venv when missing); the CUDA toolkit for GPUs.
are installed in a venv when missing); the CUDA toolkit or ROCm for GPUs.

```bash
git clone --recurse-submodules https://github.com/canoPdev/canoP.git
Expand Down
59 changes: 42 additions & 17 deletions cmake/build_or_find_kalypsso_core.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,55 @@ if(CANOP_KALYPSSO_CORE_BUILD)
GIT_REPOSITORY https://github.com/kalypsso-dev/kalypsso-core.git
GIT_TAG main)
else()
# Cuda with the shared Kokkos of canoP (cmake/pykokkos.cmake): no relocatable device code, so the
# device functions of kalypsso-core must be in its headers; the patch moves them there.
# Cuda or HIP with the shared Kokkos of canoP (cmake/pykokkos.cmake): no relocatable device code,
# so the device functions of kalypsso-core must be in its headers. The patches move them there:
# a series applied in order, the first for Cuda, the second (on top of it) for HIP too. A series
# applied further than needed is kept (it changes nothing for the other backends).
set(_canop_patches ${PROJECT_SOURCE_DIR}/cmake/patches/kalypsso-core-cuda-device-code-in-headers.patch
${PROJECT_SOURCE_DIR}/cmake/patches/kalypsso-core-hip-device-code-in-headers.patch)
if(KALYPSSO_CORE_KOKKOS_BACKEND STREQUAL "Cuda")
set(CANOP_KALYPSSO_CORE_PATCH
${PROJECT_SOURCE_DIR}/cmake/patches/kalypsso-core-cuda-device-code-in-headers.patch)
set(_canop_patches_needed 1)
elseif(KALYPSSO_CORE_KOKKOS_BACKEND STREQUAL "HIP")
set(_canop_patches_needed 2)
else()
set(_canop_patches_needed 0)
endif()
if(_canop_patches_needed GREATER 0)
find_package(Git REQUIRED)
execute_process(
COMMAND ${GIT_EXECUTABLE} apply --reverse --check ${CANOP_KALYPSSO_CORE_PATCH}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/external/kalypsso-core
RESULT_VARIABLE CANOP_KALYPSSO_CORE_PATCHED
OUTPUT_QUIET ERROR_QUIET)
if(NOT CANOP_KALYPSSO_CORE_PATCHED EQUAL 0)
# the number of patches of the series already applied: the last one that can be reverted
set(_canop_patches_applied 0)
list(LENGTH _canop_patches _canop_n)
foreach(_i RANGE ${_canop_n})
if(_i EQUAL 0)
continue()
endif()
math(EXPR _k "${_canop_n} - ${_i}")
list(GET _canop_patches ${_k} _canop_patch)
execute_process(
COMMAND ${GIT_EXECUTABLE} apply --reverse --check ${_canop_patch}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/external/kalypsso-core
RESULT_VARIABLE _canop_result
OUTPUT_QUIET ERROR_QUIET)
if(_canop_result EQUAL 0)
math(EXPR _canop_patches_applied "${_k} + 1")
break()
endif()
endforeach()
while(_canop_patches_applied LESS _canop_patches_needed)
list(GET _canop_patches ${_canop_patches_applied} _canop_patch)
execute_process(
COMMAND ${GIT_EXECUTABLE} apply ${CANOP_KALYPSSO_CORE_PATCH}
COMMAND ${GIT_EXECUTABLE} apply ${_canop_patch}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/external/kalypsso-core
RESULT_VARIABLE CANOP_KALYPSSO_CORE_PATCH_RESULT)
if(NOT CANOP_KALYPSSO_CORE_PATCH_RESULT EQUAL 0)
RESULT_VARIABLE _canop_result)
if(NOT _canop_result EQUAL 0)
message(
FATAL_ERROR
"[canoP / kalypsso-core] cannot apply ${CANOP_KALYPSSO_CORE_PATCH} to external/kalypsso-core "
"(needed by Cuda with a shared Kokkos): has kalypsso-core changed?")
"[canoP / kalypsso-core] cannot apply ${_canop_patch} to external/kalypsso-core "
"(needed by ${KALYPSSO_CORE_KOKKOS_BACKEND} with a shared Kokkos): has kalypsso-core changed?")
endif()
message("[canoP / kalypsso-core] applied ${CANOP_KALYPSSO_CORE_PATCH} (Cuda, shared Kokkos)")
endif()
message("[canoP / kalypsso-core] applied ${_canop_patch} (${KALYPSSO_CORE_KOKKOS_BACKEND}, shared Kokkos)")
math(EXPR _canop_patches_applied "${_canop_patches_applied} + 1")
endwhile()
endif()
FetchContent_Declare(kalypsso_core_external SYSTEM SOURCE_DIR
${PROJECT_SOURCE_DIR}/external/kalypsso-core)
Expand Down
Loading
Loading