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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ SpacesInParensOptions:
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: c++17
Standard: c++20
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
Expand Down
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Checks: >
modernize-*,
-modernize-pass-by-value,
-modernize-use-auto,
-modernize-use-integer-sign-comparison,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
performance-*,
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/tests-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ jobs:
path: ginkgo
- name: Install Ginkgo
run: |
# Ginkgo 1.8 needs the flags "-undefined dynamic_lookup" to link, recent versions should not need it
cmake \
-D CMAKE_SHARED_LINKER_FLAGS="-undefined dynamic_lookup" \
-D GINKGO_BUILD_BENCHMARKS=OFF \
-D GINKGO_BUILD_EXAMPLES=OFF \
-D GINKGO_BUILD_MPI=OFF \
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/tests-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
- name: 'cpu'
c_compiler: 'gcc'
cxx_compiler: 'g++'
cxx_version: ['17']
cxx_version: ['20']
cmake_build_type: ['None']
runs-on: ubuntu-latest
needs: [docker-build, id_repo]
Expand Down Expand Up @@ -224,18 +224,14 @@ jobs:
cxx_compiler: 'hipcc'
ddc_extra_cxx_flags: ''
kokkos_extra_cmake_flags: '-D Kokkos_ENABLE_HIP=ON -D Kokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=ON -D Kokkos_ENABLE_ROCTHRUST=OFF -D Kokkos_ARCH_AMD_GFX90A=ON'
cxx_version: ['17', '20', '23']
cxx_version: ['20', '23']
build_type:
- cmake_build_type: 'Release'
cxx_flags: ''
- cmake_build_type: 'Debug'
cxx_flags: '-O1'
exclude:
- image: 'oldest' # nvcc 11 only supports C++-17
backend:
name: 'cuda'
cxx_version: '20'
- image: 'oldest' # nvcc 11 only supports C++-17
- image: 'oldest' # nvcc 12 only supports C++-20
backend:
name: 'cuda'
cxx_version: '23'
Expand Down Expand Up @@ -421,7 +417,7 @@ jobs:
- name: 'cpu'
c_compiler: 'gcc'
cxx_compiler: 'g++'
cxx_version: ['17']
cxx_version: ['20']
cmake_build_type: ['Debug']
sanitizer: ['address', 'undefined']
runs-on: ubuntu-latest
Expand Down Expand Up @@ -522,7 +518,7 @@ jobs:
- name: 'cpu'
c_compiler: 'clang-21'
cxx_compiler: 'clang++-21'
cxx_version: ['17']
cxx_version: ['20']
cmake_build_type: ['Release']
runs-on: ubuntu-latest
needs: [docker-build, id_repo]
Expand Down
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ endif()
add_library(ddc_core)
add_library(DDC::core ALIAS ddc_core)
configure_file(cmake/config.hpp.in generated/ddc/config.hpp NO_SOURCE_PERMISSIONS @ONLY)
target_compile_features(ddc_core PUBLIC cxx_std_17)
target_compile_features(ddc_core PUBLIC cxx_std_20)
target_link_libraries(ddc_core PUBLIC Kokkos::kokkos)
target_sources(
ddc_core
Expand All @@ -145,7 +145,6 @@ target_sources(
src/ddc/detail/macros.hpp
src/ddc/detail/tagged_vector.hpp
src/ddc/detail/type_seq.hpp
src/ddc/detail/type_traits.hpp
src/ddc/detail/utils.hpp
src/ddc/aligned_allocator.hpp
src/ddc/chunk.hpp
Expand Down Expand Up @@ -219,7 +218,7 @@ if("${DDC_BUILD_KERNELS_FFT}")

add_library(ddc_fft)
add_library(DDC::fft ALIAS ddc_fft)
target_compile_features(ddc_fft PUBLIC cxx_std_17)
target_compile_features(ddc_fft PUBLIC cxx_std_20)
target_link_libraries(ddc_fft PUBLIC DDC::core Kokkos::kokkos KokkosFFT::fft)
target_sources(
ddc_fft
Expand Down Expand Up @@ -269,7 +268,7 @@ if("${DDC_BUILD_KERNELS_SPLINES}")

add_library(ddc_splines)
add_library(DDC::splines ALIAS ddc_splines)
target_compile_features(ddc_splines INTERFACE cxx_std_17)
target_compile_features(ddc_splines INTERFACE cxx_std_20)
target_link_libraries(
ddc_splines
INTERFACE DDC::core
Expand Down Expand Up @@ -342,7 +341,7 @@ if("${DDC_BUILD_PDI_WRAPPER}")

add_library(ddc_pdi)
add_library(DDC::pdi ALIAS ddc_pdi)
target_compile_features(ddc_pdi PUBLIC cxx_std_17)
target_compile_features(ddc_pdi PUBLIC cxx_std_20)
target_link_libraries(ddc_pdi PUBLIC DDC::core PDI::PDI_C)
target_sources(
ddc_pdi
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If you want to know more, join un on [Slack](https://ddc-lib.slack.com/join/shar

To use DDC core, one needs the following dependencies:

* a C++17-compliant compiler
* a C++20-compliant compiler
* CMake 3.25
* Kokkos 4.4...<6
* (optional, micro benchmarking) Benchmark 1.8...<2
Expand Down
25 changes: 15 additions & 10 deletions docker/oldest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ FROM ubuntu:jammy@sha256:3ba65aa20f86a0fad9df2b2c259c613df006b2e6d0bfcc8a146afb8
LABEL "org.opencontainers.image.source"="https://github.com/CExA-project/ddc"

ARG BACKEND
ARG AMDGPU_VERSION=5.7.3
ARG AMDGPU_VERSION=6.2.4
ARG CMAKE_VERSION=3.25.3
ARG CUDA_MAJOR_VERSION=11
ARG CUDA_MINOR_VERSION=8
ARG CUDA_MAJOR_VERSION=12
ARG CUDA_MINOR_VERSION=2
ARG GINKGO_VERSION=1.8.0
ARG ROCM_VERSION=5.7.3
ARG ROCM_VERSION=6.2.4

COPY bash_run /bin/
ENV BASH_ENV=/etc/profile
Expand Down Expand Up @@ -66,19 +66,20 @@ RUN chmod +x /bin/bash_run \
apt-get install -y --no-install-recommends \
clang \
;; "cuda") \
# libnvjitlink seems to be a missing dependency of cusparse
apt-get install -y --no-install-recommends \
cuda-minimal-build-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
cuda-nvtx-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
libcublas-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
libcufft-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
libcurand-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
libcusparse-dev-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
gcc-10 \
g++-10 \
libnvjitlink-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
;; "hip") \
apt-get install -y --no-install-recommends \
hipblas-dev${ROCM_VERSION} \
hipfft-dev${ROCM_VERSION} \
hiprand-dev${ROCM_VERSION} \
hipsparse-dev${ROCM_VERSION} \
rocm-hip-runtime-dev${ROCM_VERSION} \
rocrand-dev${ROCM_VERSION} \
Expand All @@ -95,9 +96,13 @@ RUN chmod +x /bin/bash_run \
"cpu") \
cmake -DCMAKE_BUILD_TYPE=Release -DGINKGO_BUILD_OMP=ON -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -B ginkgo/build -S ginkgo \
;; "cuda") \
cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_CUDA_HOST_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Release -DGINKGO_CUDA_ARCHITECTURES=70 -DGINKGO_BUILD_CUDA=ON -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -B ginkgo/build -S ginkgo \
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CUDA_HOST_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DGINKGO_CUDA_ARCHITECTURES=70 -DGINKGO_BUILD_CUDA=ON -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -B ginkgo/build -S ginkgo \
;; "hip") \
cmake -DCMAKE_PREFIX_PATH=/opt/rocm -DCMAKE_BUILD_TYPE=Release -DCMAKE_HIP_ARCHITECTURES=gfx90a -DGINKGO_BUILD_HIP=ON -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -B ginkgo/build -S ginkgo \
# HIP_PATH needs to be set to avoid Ginkgo defining it (https://github.com/ginkgo-project/ginkgo/blob/develop/cmake/hip_path.cmake).
# The Ginkgo <1.9 heuristic does not seem to be compatible with the new HIP v6 directory layout.
# This makes amdclang++ fail during cmake compiler test (https://releases.llvm.org/18.1.0/tools/clang/docs/HIPSupport.html#order-of-precedence-for-hip-path)
export HIP_PATH=`hipconfig --path` \
&& cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_HIP_ARCHITECTURES=gfx90a -DGINKGO_BUILD_HIP=ON -DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_BENCHMARKS=OFF -B ginkgo/build -S ginkgo \
;; esac \
&& cmake --build ginkgo/build \
&& cmake --install ginkgo/build --prefix /usr \
Expand All @@ -113,8 +118,8 @@ RUN chmod +x /bin/bash_run \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -d /data -m -U ci \
&& if [ "xcuda" = "x${BACKEND}" ] \
; then echo 'CUDA_GCC=gcc-10' > /etc/profile.d/ddc-cuda.sh \
; echo 'CUDA_GXX=g++-10' >> /etc/profile.d/ddc-cuda.sh \
; then echo 'CUDA_GCC=gcc' > /etc/profile.d/ddc-cuda.sh \
; echo 'CUDA_GXX=g++' >> /etc/profile.d/ddc-cuda.sh \
; fi

USER ci:ci
Expand Down
34 changes: 10 additions & 24 deletions src/ddc/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

#include <cassert>
#include <string>
#include <type_traits>
#include <utility>

#include <Kokkos_Core.hpp>

#include "detail/kokkos.hpp"
#include "detail/type_traits.hpp"

#include "chunk_common.hpp"
#include "chunk_span.hpp"
Expand Down Expand Up @@ -166,21 +164,17 @@ class Chunk : public ChunkCommon<ElementType, SupportType, Kokkos::layout_right>
}

/// Slice out some dimensions
template <
class... QueryDDims,
class SFINAESupportType = SupportType,
std::enable_if_t<is_discrete_domain_v<SFINAESupportType>, int> = 0>
template <class... QueryDDims>
auto operator[](DiscreteDomain<QueryDDims...> const& odomain) const
requires(is_discrete_domain_v<SupportType>)
{
return span_view()[odomain];
}

/// Slice out some dimensions
template <
class... QueryDDims,
class SFINAESupportType = SupportType,
std::enable_if_t<is_discrete_domain_v<SFINAESupportType>, int> = 0>
template <class... QueryDDims>
auto operator[](DiscreteDomain<QueryDDims...> const& odomain)
requires(is_discrete_domain_v<SupportType>)
{
return span_view()[odomain];
}
Expand All @@ -189,9 +183,7 @@ class Chunk : public ChunkCommon<ElementType, SupportType, Kokkos::layout_right>
* @param delems discrete coordinates
* @return const-reference to this element
*/
template <
class... DElems,
std::enable_if_t<detail::all_of_v<is_discrete_element_v<DElems>...>, int> = 0>
template <concepts::discrete_element... DElems>
element_type const& operator()(DElems const&... delems) const noexcept
{
static_assert(
Expand All @@ -207,11 +199,9 @@ class Chunk : public ChunkCommon<ElementType, SupportType, Kokkos::layout_right>
* @param dvects discrete vectors
* @return reference to this element
*/
template <
class... DVects,
std::enable_if_t<detail::all_of_v<is_discrete_vector_v<DVects>...>, int> = 0,
std::enable_if_t<sizeof...(DVects) != 0, int> = 0>
template <concepts::discrete_vector... DVects>
element_type const& operator()(DVects const&... dvects) const noexcept
requires(sizeof...(DVects) != 0)
{
static_assert(
SupportType::rank() == (0 + ... + DVects::size()),
Expand All @@ -225,9 +215,7 @@ class Chunk : public ChunkCommon<ElementType, SupportType, Kokkos::layout_right>
* @param delems discrete coordinates
* @return reference to this element
*/
template <
class... DElems,
std::enable_if_t<detail::all_of_v<is_discrete_element_v<DElems>...>, int> = 0>
template <concepts::discrete_element... DElems>
element_type& operator()(DElems const&... delems) noexcept
{
static_assert(
Expand All @@ -243,11 +231,9 @@ class Chunk : public ChunkCommon<ElementType, SupportType, Kokkos::layout_right>
* @param dvects discrete vectors
* @return reference to this element
*/
template <
class... DVects,
std::enable_if_t<detail::all_of_v<is_discrete_vector_v<DVects>...>, int> = 0,
std::enable_if_t<sizeof...(DVects) != 0, int> = 0>
template <concepts::discrete_vector... DVects>
element_type& operator()(DVects const&... dvects) noexcept
requires(sizeof...(DVects) != 0)
{
static_assert(
SupportType::rank() == (0 + ... + DVects::size()),
Expand Down
13 changes: 5 additions & 8 deletions src/ddc/chunk_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ class ChunkCommon
}

private:
template <class Mapping = mapping_type>
static KOKKOS_FUNCTION constexpr std::
enable_if_t<std::is_constructible_v<Mapping, extents_type>, allocation_mdspan_type>
make_allocation_mdspan(ElementType* ptr, SupportType const& domain)
static KOKKOS_FUNCTION constexpr allocation_mdspan_type make_allocation_mdspan(
ElementType* ptr,
SupportType const& domain)
requires(std::is_constructible_v<mapping_type, extents_type>)
{
return allocation_mdspan_type(ptr, detail::array(domain.extents()));
}
Expand Down Expand Up @@ -212,10 +212,7 @@ class ChunkCommon
* @param ptr the allocation pointer to the data
* @param domain the domain that sustains the view
*/
template <
class Mapping = mapping_type,
std::enable_if_t<std::is_constructible_v<Mapping, extents_type>, int> = 0>
KOKKOS_FUNCTION constexpr ChunkCommon(ElementType* ptr, SupportType const& domain)
KOKKOS_FUNCTION constexpr ChunkCommon(ElementType* ptr, SupportType const& domain) requires(std::is_constructible_v<mapping_type, extents_type>)
: m_allocation_mdspan(make_allocation_mdspan(ptr, domain))
, m_domain(domain)
{
Expand Down
Loading
Loading