Skip to content

Commit

Permalink
Merge branch 'main' into annotated_for_each
Browse files Browse the repository at this point in the history
  • Loading branch information
blegouix authored Jan 31, 2025
2 parents 9bf07fc + 18e3e55 commit ff64e39
Show file tree
Hide file tree
Showing 47 changed files with 2,950 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#
# SPDX-License-Identifier: MIT

name: Nightly tests
name: Early integration

on:
schedule:
- cron: "0 1 * * 1-5" # every weekday at 1am
workflow_dispatch:

jobs:
docker-build:
Expand Down Expand Up @@ -35,7 +36,6 @@ jobs:
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} \
-t ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} \
-t ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}}:${GITHUB_SHA:0:7} \
docker/${{matrix.image}}
test:
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
docker run \
--cidfile='docker.cid' \
-v ${PWD}:/src:ro \
ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend.name}}:${GITHUB_SHA:0:7} \
ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend.name}} \
bash /src/run.sh
if docker cp "$(cat docker.cid)":/data/tests.xml /home/runner/work/ddc/ddc/tests.xml
then echo "with_report=true" >> "$GITHUB_OUTPUT"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
#
# SPDX-License-Identifier: MIT

name: pages
name: Pages

on:
push:
branches: [ main ]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref == github.ref_protected && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
id_repo:
runs-on: ubuntu-latest
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
#
# SPDX-License-Identifier: MIT

name: test
name: Tests

on:
push: { branches: [ main ] }
schedule:
- cron: "0 1 * * *" # every day at 1am
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref == github.ref_protected && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -34,6 +38,17 @@ jobs:
if: always()
uses: fsfe/reuse-action@v5

spelling:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Spell Check Repo
uses: crate-ci/[email protected]
with:
files: ./AUTHORS ./benchmarks/ ./cmake/ ./CMakeLists.txt ./docs/ ./examples/ ./include/ ./README.md ./tests/

cmake-format:
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 8 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (C) The DDC development team, see COPYRIGHT.md file
#
# SPDX-License-Identifier: MIT

[default.extend-words]
# Don't correct these word (parts)
iy = "iy"
ND = "ND"
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Julien Bigot - CEA ([email protected])
* Co-maintainer
* Initial designer and first development steps
* Co-developer
* Participation to DDC-based redisign of splines
* Participation to DDC-based redesign of splines

Emily Bourne - CEA ([email protected])
* Work on splines and linear algebra
Expand Down
40 changes: 13 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.22)
project(DDC VERSION 0.4.0 LANGUAGES CXX)
project(DDC VERSION 0.4.2 LANGUAGES CXX)

# List of options

Expand Down Expand Up @@ -63,14 +63,6 @@ elseif("${DDC_Kokkos_DEPENDENCY_POLICY}" STREQUAL "INSTALLED")
ddc_check_required_kokkos_options()
endif()

## PDI

if("${DDC_BUILD_PDI_WRAPPER}")
if(NOT TARGET PDI::PDI_C)
find_package(PDI 1.6...<2 REQUIRED COMPONENTS C)
endif()
endif()

## GoogleTest

if("${BUILD_TESTING}" AND "${DDC_BUILD_TESTS}")
Expand Down Expand Up @@ -131,11 +123,6 @@ endif()

## The library itself

### DDC legacy target
add_library(DDC INTERFACE)
add_library(DDC::DDC ALIAS DDC)
install(TARGETS DDC EXPORT DDCTargets)

add_library(ddc_core INTERFACE)
add_library(DDC::core ALIAS ddc_core)
configure_file(cmake/config.hpp.in generated/ddc/config.hpp NO_SOURCE_PERMISSIONS @ONLY)
Expand All @@ -151,9 +138,6 @@ target_include_directories(
)
target_link_libraries(ddc_core INTERFACE Kokkos::kokkos)

### DDC legacy target
target_link_libraries(DDC INTERFACE DDC::core)

# Link library to DDC

if("${DDC_BUILD_KERNELS_FFT}")
Expand Down Expand Up @@ -183,11 +167,10 @@ if("${DDC_BUILD_KERNELS_FFT}")

add_library(ddc_fft INTERFACE)
add_library(DDC::fft ALIAS ddc_fft)
install(TARGETS ddc_fft EXPORT DDCTargets)
install(TARGETS ddc_fft EXPORT DDCFftTargets)
target_link_libraries(ddc_fft INTERFACE DDC::core Kokkos::kokkos KokkosFFT::fft)

### DDC legacy target
target_link_libraries(DDC INTERFACE DDC::fft)
install(EXPORT DDCFftTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
endif()

if("${DDC_BUILD_KERNELS_SPLINES}")
Expand Down Expand Up @@ -223,23 +206,26 @@ if("${DDC_BUILD_KERNELS_SPLINES}")
add_library(ddc_splines INTERFACE)
add_library(DDC::splines ALIAS ddc_splines)
install(FILES cmake/FindLAPACKE.cmake DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(TARGETS ddc_splines EXPORT DDCTargets)
install(TARGETS ddc_splines EXPORT DDCSplinesTargets)
target_include_directories(ddc_splines SYSTEM INTERFACE ${LAPACKE_INCLUDE_DIRS})
target_link_libraries(
ddc_splines
INTERFACE DDC::core Ginkgo::ginkgo Kokkos::kokkos Kokkos::kokkoskernels ${LAPACKE_LIBRARIES}
)

### DDC legacy target
target_link_libraries(DDC INTERFACE DDC::splines)
install(EXPORT DDCSplinesTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
endif()

## The PDI wrapper

if("${DDC_BUILD_PDI_WRAPPER}")
if(NOT TARGET PDI::PDI_C)
find_package(PDI 1.6...<2 REQUIRED COMPONENTS C)
endif()

add_library(ddc_pdi INTERFACE)
add_library(DDC::pdi ALIAS ddc_pdi)
install(TARGETS ddc_pdi EXPORT DDCTargets)
install(TARGETS ddc_pdi EXPORT DDCPdiTargets)
target_compile_features(ddc_pdi INTERFACE cxx_std_17)
target_include_directories(
ddc_pdi
Expand All @@ -249,8 +235,7 @@ if("${DDC_BUILD_PDI_WRAPPER}")
)
target_link_libraries(ddc_pdi INTERFACE DDC::core PDI::PDI_C)

### DDC legacy target
target_link_libraries(DDC INTERFACE DDC::pdi)
install(EXPORT DDCPdiTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
endif()

## if examples are enabled, build them
Expand Down Expand Up @@ -287,6 +272,8 @@ configure_package_config_file(
cmake/DDCConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/DDCConfig.cmake
INSTALL_DESTINATION ${DDC_INSTALL_CMAKEDIR}
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)

# We use SameMinorVersion until major version 1
Expand All @@ -300,7 +287,6 @@ write_basic_package_version_file(

install(
FILES
cmake/DDCCheckRequiredKokkosOptions.cmake
${CMAKE_CURRENT_BINARY_DIR}/DDCConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/DDCConfigVersion.cmake
DESTINATION ${DDC_INSTALL_CMAKEDIR}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ SPDX-License-Identifier: MIT
-->

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![test](https://github.com/CExA-project/ddc/actions/workflows/tests.yml/badge.svg)](https://github.com/CExA-project/ddc/actions/workflows/tests.yml)
[![Nightly early integration](https://github.com/CExA-project/ddc/actions/workflows/early_integration.yml/badge.svg?event=schedule)](https://github.com/CExA-project/ddc/actions/workflows/early_integration.yml)
[![Nightly tests](https://github.com/CExA-project/ddc/actions/workflows/tests.yml/badge.svg?event=schedule)](https://github.com/CExA-project/ddc/actions/workflows/tests.yml)
[![Pages](https://github.com/CExA-project/ddc/actions/workflows/pages.yml/badge.svg)](https://github.com/CExA-project/ddc/actions/workflows/pages.yml)

See <https://ddc.mdls.fr/>

Expand Down
32 changes: 16 additions & 16 deletions benchmarks/splines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void characteristics_advection_unitary(benchmark::State& state)
std::size_t freeMem = 0;
std::size_t totalMem = 0;
cudaMemGetInfo(&freeMem, &totalMem);
// cudaMemGetInfo gives GPU total memory occupation, we consider that other users of the GPU have constant occupancy and substract it.
// cudaMemGetInfo gives GPU total memory occupation, we consider that other users of the GPU have constant occupancy and subtract it.
std::size_t const initUsedMem = totalMem - freeMem;
#else
std::size_t const initUsedMem = 0;
Expand Down Expand Up @@ -232,35 +232,35 @@ void characteristics_advection(benchmark::State& state)
long const dev = 1;
long const uniform = 0;
long const non_uniform = 1;
// Preallocate 12 unitary benchs for each combination of cpu/gpu execution space, uniform/non-uniform and spline degree we may want to benchmark (those are determined at compile-time, that's why we need to build explicitely 12 variants of the bench even if we call only one of them)
std::map<std::array<long, 3>, std::function<void(benchmark::State&)>> benchs;
benchs[std::array {host, uniform, 3L}]
// Preallocate 12 unitary benchmarks for each combination of cpu/gpu execution space, uniform/non-uniform and spline degree we may want to benchmark (those are determined at compile-time, that's why we need to build explicitly 12 variants of the bench even if we call only one of them)
std::map<std::array<long, 3>, std::function<void(benchmark::State&)>> benchmarks;
benchmarks[std::array {host, uniform, 3L}]
= characteristics_advection_unitary<Kokkos::DefaultHostExecutionSpace, false, 3>;
benchs[std::array {host, uniform, 4L}]
benchmarks[std::array {host, uniform, 4L}]
= characteristics_advection_unitary<Kokkos::DefaultHostExecutionSpace, false, 4>;
benchs[std::array {host, uniform, 5L}]
benchmarks[std::array {host, uniform, 5L}]
= characteristics_advection_unitary<Kokkos::DefaultHostExecutionSpace, false, 5>;
benchs[std::array {host, non_uniform, 3L}]
benchmarks[std::array {host, non_uniform, 3L}]
= characteristics_advection_unitary<Kokkos::DefaultHostExecutionSpace, true, 3>;
benchs[std::array {host, non_uniform, 4L}]
benchmarks[std::array {host, non_uniform, 4L}]
= characteristics_advection_unitary<Kokkos::DefaultHostExecutionSpace, true, 4>;
benchs[std::array {host, non_uniform, 5L}]
benchmarks[std::array {host, non_uniform, 5L}]
= characteristics_advection_unitary<Kokkos::DefaultHostExecutionSpace, true, 5>;
benchs[std::array {dev, uniform, 3L}]
benchmarks[std::array {dev, uniform, 3L}]
= characteristics_advection_unitary<Kokkos::DefaultExecutionSpace, false, 3>;
benchs[std::array {dev, uniform, 4L}]
benchmarks[std::array {dev, uniform, 4L}]
= characteristics_advection_unitary<Kokkos::DefaultExecutionSpace, false, 4>;
benchs[std::array {dev, uniform, 5L}]
benchmarks[std::array {dev, uniform, 5L}]
= characteristics_advection_unitary<Kokkos::DefaultExecutionSpace, false, 5>;
benchs[std::array {dev, non_uniform, 3L}]
benchmarks[std::array {dev, non_uniform, 3L}]
= characteristics_advection_unitary<Kokkos::DefaultExecutionSpace, true, 3>;
benchs[std::array {dev, non_uniform, 4L}]
benchmarks[std::array {dev, non_uniform, 4L}]
= characteristics_advection_unitary<Kokkos::DefaultExecutionSpace, true, 4>;
benchs[std::array {dev, non_uniform, 5L}]
benchmarks[std::array {dev, non_uniform, 5L}]
= characteristics_advection_unitary<Kokkos::DefaultExecutionSpace, true, 5>;

// Run the desired bench
benchs.at(std::array {state.range(0), state.range(1), state.range(2)})(state);
benchmarks.at(std::array {state.range(0), state.range(1), state.range(2)})(state);
}

} // namespace DDC_HIP_5_7_ANONYMOUS_NAMESPACE_WORKAROUND(SPLINES_CPP)
Expand Down
64 changes: 45 additions & 19 deletions cmake/DDCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

@PACKAGE_INIT@

# This macro extends the cmake macro `check_required_components`.
# It checks if all required components for a package are found and
# sets a custom NOT_FOUND_MESSAGE listing missing required components.
macro(ddc_check_required_components _NAME)
set(REQUIRED_COMPONENTS_NOT_FOUND "")
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
list(APPEND REQUIRED_COMPONENTS_NOT_FOUND "${comp}")
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()

if(REQUIRED_COMPONENTS_NOT_FOUND)
set(${_NAME}_NOT_FOUND_MESSAGE "Component(s) not found: ${REQUIRED_COMPONENTS_NOT_FOUND}")
endif()
unset(REQUIRED_COMPONENTS_NOT_FOUND)
endmacro()

# Workaround for rocm <6 setting a cmake_minimum_required <3.12.
# When redefining `find_dependency` we get a better chance
# to use the NEW policy for CMP0074.
Expand All @@ -16,14 +36,22 @@ set(DDC_BUILD_DOUBLE_PRECISION @DDC_BUILD_DOUBLE_PRECISION@)

ddc_find_dependency(Kokkos 4.4...<5)

include(${CMAKE_CURRENT_LIST_DIR}/DDCCheckRequiredKokkosOptions.cmake)
ddc_check_required_kokkos_options()
include(${CMAKE_CURRENT_LIST_DIR}/DDCTargets.cmake)
if(NOT TARGET DDC::core)
add_library(DDC::core ALIAS DDC::impl::ddc_core)
endif()

if(@DDC_BUILD_KERNELS_FFT@)
if(@DDC_BUILD_KERNELS_FFT@ AND ("fft" IN_LIST DDC_FIND_COMPONENTS))
ddc_find_dependency(KokkosFFT 0.2.1...<1)

include(${CMAKE_CURRENT_LIST_DIR}/DDCFftTargets.cmake)
if(NOT TARGET DDC::fft)
add_library(DDC::fft ALIAS DDC::impl::ddc_fft)
endif()
set(DDC_fft_FOUND TRUE)
endif()

if(@DDC_BUILD_KERNELS_SPLINES@)
if(@DDC_BUILD_KERNELS_SPLINES@ AND ("splines" IN_LIST DDC_FIND_COMPONENTS))
ddc_find_dependency(Ginkgo 1.8...<2)
# DDC installs a FindLAPACKE.cmake file.
# We choose to rely on it by prepending to CMAKE_MODULE_PATH
Expand All @@ -32,24 +60,22 @@ if(@DDC_BUILD_KERNELS_SPLINES@)
ddc_find_dependency(LAPACKE)
list(POP_FRONT CMAKE_MODULE_PATH)
ddc_find_dependency(KokkosKernels 4.5.1...<5)
endif()

if(@DDC_BUILD_PDI_WRAPPER@)
ddc_find_dependency(PDI 1.6...<2 COMPONENTS C)
include(${CMAKE_CURRENT_LIST_DIR}/DDCSplinesTargets.cmake)
if(NOT TARGET DDC::splines)
add_library(DDC::splines ALIAS DDC::impl::ddc_splines)
endif()
set(DDC_splines_FOUND TRUE)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/DDCTargets.cmake)

foreach(target core fft pdi splines)
if(TARGET DDC::impl::ddc_${target})
add_library(DDC::${target} ALIAS DDC::impl::ddc_${target})
endif()
endforeach()
if(@DDC_BUILD_PDI_WRAPPER@ AND ("pdi" IN_LIST DDC_FIND_COMPONENTS))
ddc_find_dependency(PDI 1.6...<2 COMPONENTS C)

foreach(target_component fft pdi splines)
if(TARGET DDC::impl::ddc_${target_component})
set(DDC_${target_component}_FOUND TRUE)
include(${CMAKE_CURRENT_LIST_DIR}/DDCPdiTargets.cmake)
if(NOT TARGET DDC::pdi)
add_library(DDC::pdi ALIAS DDC::impl::ddc_pdi)
endif()
endforeach()
set(DDC_pdi_FOUND TRUE)
endif()

check_required_components(DDC)
ddc_check_required_components(DDC)
4 changes: 2 additions & 2 deletions docker/latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ RUN chmod +x /bin/bash_run \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cuda-archive-keyring.asc] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64 /" > /etc/apt/sources.list.d/cuda.list \
&& wget -O /etc/apt/preferences.d/cuda-repository-pin-600 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin \
;; esac \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/pdidev-archive-keyring.gpg] https://raw.githubusercontent.com/pdidev/repo/ubuntu noble main" > /etc/apt/sources.list.d/pdi.list \
&& wget -q -O /etc/apt/keyrings/pdidev-archive-keyring.gpg https://raw.githubusercontent.com/pdidev/repo/ubuntu/pdidev-archive-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/pdidev-archive-keyring.gpg] https://repo.pdi.dev/ubuntu noble main" > /etc/apt/sources.list.d/pdi.list \
&& wget -q -O /etc/apt/keyrings/pdidev-archive-keyring.gpg https://repo.pdi.dev/ubuntu/pdidev-archive-keyring.gpg \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
Expand Down
Loading

0 comments on commit ff64e39

Please sign in to comment.