Skip to content

chore: replace mamba by pixi #159

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
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
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
145 changes: 30 additions & 115 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,19 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Cache
uses: actions/cache@v3
- uses: prefix-dev/[email protected]
with:
path: |
~/.cache/ccache
~/micromamba/envs/samurai-env
key: cppcheck
pixi-version: v0.10.0
cache: false

- name: Mamba and samurai env installation
uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda/environment.yml
environment-name: samurai-env
cache-environment: true

- name: cppcheck installation
shell: bash -el {0}
run: |
conda install -y cppcheck cxx-compiler
- name: Remove petsc
run: pixi remove -p linux-64 petsc

- name: Configure
shell: bash -el {0}
run: |
cmake . -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEMOS=ON

- name: Run cppcheck on samurai
shell: bash -el {0}
shell: pixi run bash {0}
run: |
cppcheck --enable=all -q --project=./build/compile_commands.json --suppressions-list=.cppcheck --inline-suppr 2> cppcheck_err.txt
cmake -S . -B .build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEMOS=ON
cppcheck --enable=all -q --project=.build/compile_commands.json --inline-suppr --suppressions-list=.cppcheck 2> cppcheck_err.txt

- name: Check for errors
run: |
Expand Down Expand Up @@ -116,74 +100,30 @@ jobs:
package: "clang-15"
cc: "clang-15"
cxx: "clang++-15"

env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}

steps:
- uses: actions/checkout@v3

- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cache/ccache
~/micromamba-root/envs/samurai-env
key: linux-${{ matrix.cpp-version }}
restore-keys: |
linux-${{ matrix.cpp-version }}

- name: Compiler and dev tools installation
- name: Compiler installation
run: |
sudo apt update
sudo apt install ${{ matrix.package }}

# - name: Information about ccache
# run: |
# ccache -s -v

- name: Mamba and samurai env installation
uses: mamba-org/setup-micromamba@v1
- uses: prefix-dev/[email protected]
with:
environment-file: conda/environment.yml
environment-name: samurai-env
cache-environment: true

- name: Petsc installation
shell: bash -l {0}
run: |
conda install -y petsc=3.18 pkg-config

- name: Conda informations
shell: bash -l {0}
run: |
conda info
conda list
pixi-version: v0.10.0
cache: true

- name: Configure
shell: bash -l {0}
run: |
export LDFLAGS="${LDFLAGS} -L$CONDA_PREFIX/lib"
CC=${{ matrix.cc }} CXX=${{ matrix.cxx }} cmake \
. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_DEMOS=ON \
-DBUILD_TESTS=ON

- name: Build
shell: bash -l {0}
run: |
cmake --build build --target all

- name: Test with googletest
shell: bash -l {0}
run: |
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd build
./tests/test_samurai_lib
- name: Run tests
run: pixi run test

- name: Test with pytest
shell: bash -l {0}
shell: pixi run bash {0}
run: |
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd tests
pytest -v -s --h5diff

Expand All @@ -192,42 +132,17 @@ jobs:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Mamba and samurai env installation
uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda/environment.yml
environment-name: samurai-env
cache-environment: true

# - name: Petsc installation
# shell: bash -l {0}
# run: |
# micromamba install -y petsc=3.18 pkg-config

- name: micromamba informations
shell: bash -l {0}
run: |
micromamba info
micromamba list

- name: Configure
shell: bash -l {0}
run: |
cmake \
. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_DEMOS=ON \
-DBUILD_TESTS=ON

- name: Build
shell: bash -l {0}
run: |
cmake --build ./build --config Release
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.10.0
cache: true

- name: Run tests
shell: bash -l {0}
run: pixi run test

- name: Test with pytest
shell: pixi run bash {0}
run: |
./build/tests/test_samurai_lib
cd tests; pytest --h5diff
cd tests
pytest -v -s --h5diff
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ set_target_properties(samurai
CXX_EXTENSIONS NO
)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
include(addHighFive)

# Includes
set(INCLUDE_DIR "include") # must be relative paths
target_include_directories(samurai INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${INCLUDE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")

# Find dependencies:
set(DEPENDENCIES_CONFIGURED xtensor HighFive pugixml fmt)
Expand All @@ -112,12 +115,11 @@ target_link_system_libraries(
HighFive
pugixml::pugixml
fmt::fmt
)
)

target_compile_features(samurai INTERFACE cxx_std_17)
target_compile_features(samurai INTERFACE cxx_std_17)

# target_compile_definitions(samurai INTERFACE _HAS_AUTO_PTR_ETC=0)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# target_compile_definitions(samurai INTERFACE _HAS_AUTO_PTR_ETC=0)

OPTION(BUILD_BENCHMARKS "samurai benchmark suite" OFF)
OPTION(BUILD_DEMOS "samurai build all demos" OFF)
Expand Down
11 changes: 11 additions & 0 deletions cmake/addHighFive.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include(FetchContent)
FetchContent_Declare(HighFive
GIT_REPOSITORY https://github.com/BlueBrain/HighFive
GIT_TAG v2.8.0)
FetchContent_GetProperties(highfive)
if(NOT HighFive_POPULATED)
FetchContent_Populate(HighFive)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE BOOL "")
add_subdirectory(${HighFive_SOURCE_DIR} ${HighFive_BINARY_DIR} EXCLUDE_FROM_ALL)
unset(CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
endif()
2 changes: 1 addition & 1 deletion include/samurai/field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ namespace samurai
}

template <class mesh_t, class value_t, std::size_t size_, bool SOA>
inline auto Field<mesh_t, value_t, size_, SOA>::operator=(const Field& field) -> Field&
inline auto Field<mesh_t, value_t, size_, SOA>::operator=(const Field& field) -> Field& // cppcheck-suppress operatorEqRetRefThis
{
inner_mesh_t::operator=(field.mesh());
m_name = field.m_name;
Expand Down
1 change: 1 addition & 0 deletions include/samurai/numeric/gauss_legendre.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace samurai
{
private:

// cppcheck-suppress unusedPrivateFunction
static constexpr std::size_t n_required_points(int degree)
{
return degree < 0 ? N_IMPLEMENTED_POINTS : static_cast<std::size_t>(ce_ceil((degree + 1.) / 2.));
Expand Down
Loading