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
13 changes: 9 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ SPDX-License-Identifier: MIT

# AGENTS.md for SimiLie

<!-- Example usage: "run tests" -->

# Clone
- Clone with `git clone --recurse-submodules git@github.com:blegouix/similie.git` or any similar commande which suits the network configuration. Be sure to pull the submodules recursively.

# Build environment
- **Requirement:** Build and use the `docker/similie/Dockerfile` image before compiling or running tests. Do not build on the host directly. If `docker` is not installed, install it first (refer to the online documentation).
- Configure `CMake` for CPU with `cmake -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=Debug -DKokkos_ENABLE_OPENMP=ON -B build -S .` or for CUDA with `cmake -DCMAKE_CXX_COMPILER=$PWD/vendor/ddc/vendor/kokkos/bin/nvcc_wrapper -DCMAKE_BUILD_TYPE=Debug -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_<YOUR_ARCH_NAMECODE>=ON -B build -S .`. Of course replace `<YOUR_ARCH_NAMECODE>` with the arch namecode which suits the GPU.
- Compile as usual once configured (`make -jN_PROC` from `build`).
- **Requirement:** By default (no particular contradictory instructions), build and run in the `docker/similie_env/Dockerfile` image that you call `similie_env:latest`. You'll need to mount the `similie/` folder before compiling it. Compile directly in the host environment only if specifically asked for (if so, check if all the necessary dependencies listed in `docker/similie_env/Dockerfile` are available in the current environment, in particular `nvcc` and `openmpi`).
- **Mount path in Docker:** If you reuse an existing `build/` or `build_cpu/` directory from the host, mount the repository in Docker at the same absolute path as on the host. Otherwise CMake may fail because the cached source/build paths no longer match.
- **CUDA in Docker:** When building or running the CUDA backend inside Docker, start the container with `--gpus all` so the NVIDIA driver and GPU devices are exposed in the container.
- **Git safe.directory in Docker:** Some vendored submodules query Git metadata during CMake. If Docker reports "detected dubious ownership" on the mounted repository or its submodules, add temporary `git config --global --add safe.directory <path>` entries inside the container for the repository and the relevant submodules before building.
- **Configure CMake:** For CPU with `cmake -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=Debug -DKokkos_ENABLE_OPENMP=ON -B build -S .` or for CUDA with `cmake -DCMAKE_CXX_COMPILER=$PWD/vendor/ddc/vendor/kokkos/bin/nvcc_wrapper -DCMAKE_BUILD_TYPE=Debug -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_<YOUR_ARCH_NAMECODE>=ON -B build -S .`. Of course replace `<YOUR_ARCH_NAMECODE>` with the arch namecode which suits the GPU.
- **Compile:** As usual once configured (`make -jN_PROC` from the `build/` folder). Never exceed N_PROC=8. Be sure to compile in the `build/` for CUDA backend and `build_cpu/` for CPU backend.

## Run tests
- From `build`, run `ctest`
- From `build`, first recompile then run `ctest`.
16 changes: 12 additions & 4 deletions docker/similie/Dockerfile → docker/similie_env/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE = nvidia/cuda:13.1.1-cudnn-devel-ubuntu24.04
ARG BASE_IMAGE=nvidia/cuda:13.1.1-cudnn-devel-ubuntu24.04
FROM $BASE_IMAGE

# SPDX-FileCopyrightText: 2026 Baptiste Legouix
Expand Down Expand Up @@ -52,8 +52,13 @@ RUN apt install -y libfftw3-dev
# LAPACKE
RUN apt install -y liblapacke-dev

# Thrust
RUN if [ "${BACKEND}" = "cuda" ]; then \
apt install -y libthrust-dev; \
fi

# Ginkgo
RUN git clone -b v1.8.0 --depth 1 https://github.com/ginkgo-project/ginkgo.git
RUN git clone -b v1.11.0 --depth 1 https://github.com/ginkgo-project/ginkgo.git
RUN if [ "${BACKEND}" = "cpu" ]; then \
cmake -DCMAKE_BUILD_TYPE=Release \
-DGINKGO_BUILD_OMP=ON \
Expand All @@ -66,8 +71,8 @@ RUN if [ "${BACKEND}" = "cpu" ]; then \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_CUDA_HOST_COMPILER=g++ \
-DCMAKE_BUILD_TYPE=Release \
-DGINKGO_CUDA_ARCHITECTURES=70 \
-DGINKGO_BUILD_CUDA=ON \
-DGINKGO_CUDA_ARCHITECTURES=89 \
-DGINKGO_BUILD_TESTS=OFF \
-DGINKGO_BUILD_EXAMPLES=OFF \
-DGINKGO_BUILD_BENCHMARKS=OFF \
Expand All @@ -76,7 +81,7 @@ RUN if [ "${BACKEND}" = "cpu" ]; then \
echo "ERROR: BACKEND must be 'cpu' or 'cuda' (got: '${BACKEND}')" >&2; \
exit 1; \
fi
RUN cmake --build ginkgo/build -j 8
RUN cmake --build ginkgo/build -j 4
RUN cmake --install ginkgo/build

# PDI
Expand All @@ -91,3 +96,6 @@ EOF
RUN wget -O /usr/share/keyrings/pdidev-archive-automatic.gpg https://repo.pdi.dev/ubuntu/pdidev-archive-keyring.gpg
RUN apt update
RUN apt install -y libpdi-dev pdiplugin-all

# Sympy
RUN apt install -y python3-sympy
Loading