diff --git a/.gitlab-ci-correaa.yml b/.gitlab-ci-correaa.yml index ccd51f0ac..1246f958d 100644 --- a/.gitlab-ci-correaa.yml +++ b/.gitlab-ci-correaa.yml @@ -814,31 +814,31 @@ cuda-12.6.3: - mkdir build && cd build - g++ --version - /usr/local/cuda/bin/nvcc --version - - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_CUDA=1 -DCMAKE_CXX_STANDARD=20 -DCMAKE_CUDA_STANDARD=20 -DCMAKE_CUDA_ARCHITECTURES=75 -DCMAKE_CUDA_HOST_COMPILER=g++ + - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_CUDA=1 -DCMAKE_CXX_STANDARD=20 -DCMAKE_CUDA_STANDARD=20 -DCMAKE_CUDA_ARCHITECTURES=native -DCMAKE_CUDA_HOST_COMPILER=g++ - cmake --build . --parallel 2 || cmake --build . --verbose - ctest || ctest --rerun-failed --output-on-failure needs: ["cuda"] -cuda-12.9.0: - stage: build - allow_failure: false - image: nvcr.io/nvidia/cuda:12.9.0-devel-ubuntu24.04 # https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags - tags: - - non-shared - - nvidia-gpu - interruptible: true - script: - - nvidia-smi - - apt-get -qq update - - apt-get install --no-install-recommends -y cmake g++ wget pkg-config make libboost-serialization-dev libboost-timer-dev libblas-dev libfftw3-dev - - cmake --version - - mkdir build && cd build - - g++ --version - - /usr/local/cuda/bin/nvcc --version - - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_CUDA=1 -DCMAKE_CXX_STANDARD=20 -DCMAKE_CUDA_STANDARD=20 -DCMAKE_CUDA_ARCHITECTURES=75 -DCMAKE_CUDA_HOST_COMPILER=g++ - - cmake --build . --verbose --parallel 2 || cmake --build . --verbose - - ctest || ctest --rerun-failed --output-on-failure - needs: ["g++", "clang++", "cuda"] +# cuda-12.9.0: +# stage: build +# allow_failure: false +# image: nvcr.io/nvidia/cuda:12.9.0-devel-ubuntu24.04 # https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags +# tags: +# - non-shared +# - nvidia-gpu +# interruptible: true +# script: +# - nvidia-smi +# - apt-get -qq update +# - apt-get install --no-install-recommends -y cmake g++ wget pkg-config make libboost-serialization-dev libboost-timer-dev libblas-dev libfftw3-dev +# - cmake --version +# - mkdir build && cd build +# - g++ --version +# - /usr/local/cuda/bin/nvcc --version +# - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_CUDA=1 -DCMAKE_CXX_STANDARD=20 -DCMAKE_CUDA_STANDARD=20 -DCMAKE_CUDA_ARCHITECTURES=native -DCMAKE_CUDA_HOST_COMPILER=g++ +# - cmake --build . --verbose --parallel 2 || cmake --build . --verbose +# - ctest || ctest --rerun-failed --output-on-failure +# needs: ["g++", "clang++", "cuda"] cuda-13.0.1: stage: build @@ -847,6 +847,7 @@ cuda-13.0.1: tags: - non-shared - nvidia-gpu + - arch75 interruptible: true script: - nvidia-smi @@ -856,7 +857,7 @@ cuda-13.0.1: - mkdir build && cd build - g++ --version - /usr/local/cuda/bin/nvcc --version - - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_FLAGS="-ftemplate-backtrace-limit=0" -DENABLE_CUDA=1 -DCMAKE_CXX_STANDARD=20 -DCMAKE_CUDA_STANDARD=20 -DCMAKE_CUDA_ARCHITECTURES=75 -DCMAKE_CUDA_HOST_COMPILER=g++ + - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_FLAGS="-ftemplate-backtrace-limit=0" -DENABLE_CUDA=1 -DCMAKE_CXX_STANDARD=20 -DCMAKE_CUDA_STANDARD=20 -DCMAKE_CUDA_ARCHITECTURES=native -DCMAKE_CUDA_HOST_COMPILER=g++ - cmake --build . --verbose --parallel 2 || cmake --build . --verbose - ctest || ctest --rerun-failed --output-on-failure needs: ["g++", "clang++", "cuda"] @@ -882,7 +883,7 @@ culang++-19 cuda-12.6.3 tidy: # https://catalog.ngc.nvidia.com/orgs/nvidia/cont - mkdir build && cd build - clang++-19 --version - clang-tidy-19 --version - - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_FLAGS="-Wno-unknown-cuda-version" -DCMAKE_CXX_CLANG_TIDY=clang-tidy-19 -DENABLE_CUDA=1 -DCMAKE_CUDA_COMPILER=clang++-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CUDA_ARCHITECTURES=75 + - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_FLAGS="-Wno-unknown-cuda-version" -DCMAKE_CXX_CLANG_TIDY=clang-tidy-19 -DENABLE_CUDA=1 -DCMAKE_CUDA_COMPILER=clang++-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CUDA_ARCHITECTURES=native - cmake --build . --parallel 2 || cmake --build . --verbose - ctest -j 2 --output-on-failure needs: ["cuda", "clang++"] @@ -1144,12 +1145,14 @@ qmcpack: qmcpack cuda-12.3.1: stage: test - image: nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04 + image: + name: nvcr.io/nvidia/cuda:12.9.0-devel-ubuntu24.04 # nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu24.04 tags: - non-shared - nvidia-gpu - high-bandwidth interruptible: true + allow_failure: true before_script: - apt-get -qq update && apt-get -qq install --no-install-recommends -y ca-certificates cmake git libopenmpi-dev cmake g++ git gfortran libblas-dev libboost-serialization-dev libfftw3-dev libhdf5-dev liblapack-dev libopenmpi-dev make numdiff pkg-config python3 python3-h5py python3-numpy python3-mpi4py python3-scipy libxml2-dev script: @@ -1163,7 +1166,7 @@ qmcpack cuda-12.3.1: - cd build - nvcc --version - __nvcc_device_query - - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DBUILD_AFQMC=1 -DQMC_CXX_STANDARD=17 -DQMC_GPU=cuda -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_CUDA_HOST_COMPILER=g++ -DCMAKE_CXX_FLAGS="-Wno-deprecated -Wno-deprecated-declarations" -DCMAKE_CUDA_ARCHITECTURES=75 # =80 + - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DBUILD_AFQMC=1 -DQMC_CXX_STANDARD=17 -DQMC_GPU=cuda -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_CUDA_HOST_COMPILER=g++ -DCMAKE_CXX_FLAGS="-Wno-deprecated -Wno-deprecated-declarations" -DCMAKE_CUDA_ARCHITECTURES=native # =80 - make -j 4 ppconvert afqmc test_afqmc_matrix test_afqmc_numerics test_afqmc_slaterdeterminantoperations test_afqmc_walkers test_afqmc_hamiltonians test_afqmc_hamiltonian_operations test_afqmc_phmsd test_afqmc_wfn_factory test_afqmc_prop_factory test_afqmc_estimators qmc-afqmc-performance - OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 ctest -R ppconvert --output-on-failure - OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 ctest -R afqmc --output-on-failure diff --git a/include/boost/multi/detail/index_range.hpp b/include/boost/multi/detail/index_range.hpp index efc52c0f0..36d9b03a1 100644 --- a/include/boost/multi/detail/index_range.hpp +++ b/include/boost/multi/detail/index_range.hpp @@ -22,6 +22,10 @@ #include // for declval, true_type, decay_t, enable_if_t #include // for forward +#if defined(__cplusplus) && (__cplusplus >= 202002L) && __has_include() +#include // IWYU pragma: keep // NOLINT(misc-include-cleaner) +#endif + #ifdef __NVCC__ #define BOOST_MULTI_HD __host__ __device__ #else @@ -129,11 +133,14 @@ class range { using pointer = value_type; range() = default; - // range(range const&) = default; + // range(range&&) = default; + // auto operator=(range const&) -> range& = default; + // auto operator=(range&&) -> range& = default; + // ~range() = default; template>, int> = 0, // NOLINT(modernize-type-traits) for C++20 + std::enable_if_t>, int> = 0, // NOLINT(modernize-type-traits) for C++20 decltype(detail::implicit_cast(std::declval().first()), detail::implicit_cast(std::declval().last()) )* = nullptr> @@ -143,7 +150,7 @@ class range { template< class Range, - std::enable_if_t>, unsigned> = 0, + std::enable_if_t>, unsigned> = 0, // NOLINT(modernize-type-traits) for C++20 decltype(detail::explicit_cast(std::declval().first()), detail::explicit_cast(std::declval().last()) )* = nullptr> @@ -178,7 +185,7 @@ class range { ++curr_; return *this; } - constexpr auto operator--() -> const_iterator& { + constexpr auto operator--() noexcept(noexcept(--curr_)) -> const_iterator& { --curr_; return *this; } @@ -213,8 +220,8 @@ class range { constexpr auto operator[](difference_type n) const -> const_reference { return first() + n; } - [[nodiscard]] BOOST_MULTI_HD constexpr auto front() const -> const_reference { return first(); } - [[nodiscard]] BOOST_MULTI_HD constexpr auto back() const -> const_reference { return last() - 1; } + [[nodiscard]] BOOST_MULTI_HD constexpr auto front() const -> value_type { return first(); } + [[nodiscard]] BOOST_MULTI_HD constexpr auto back() const -> value_type { return last() - 1; } [[nodiscard]] constexpr auto cbegin() const { return const_iterator{first_}; } [[nodiscard]] constexpr auto cend() const { return const_iterator{last_}; } @@ -225,11 +232,11 @@ class range { [[nodiscard]] constexpr auto begin() const -> const_iterator { return cbegin(); } [[nodiscard]] constexpr auto end() const -> const_iterator { return cend(); } - BOOST_MULTI_HD constexpr auto is_empty() const& noexcept { return first_ == last_; } - friend BOOST_MULTI_HD constexpr auto is_empty(range const& self) noexcept { return self.is_empty(); } + BOOST_MULTI_HD constexpr auto is_empty() const noexcept { return first_ == last_; } + // friend BOOST_MULTI_HD constexpr auto is_empty(range const& self) noexcept { return self.is_empty(); } [[nodiscard]] BOOST_MULTI_HD constexpr auto empty() const& noexcept { return is_empty(); } - friend BOOST_MULTI_HD constexpr auto empty(range const& self) noexcept { return self.empty(); } + // friend BOOST_MULTI_HD constexpr auto empty(range const& self) noexcept { return self.empty(); } #ifdef __NVCC__ #pragma nv_diagnostic push @@ -242,10 +249,10 @@ class range { #pragma nv_diagnostic pop #endif - friend BOOST_MULTI_HD constexpr auto size(range const& self) noexcept -> size_type { return self.size(); } + // friend BOOST_MULTI_HD constexpr auto size(range const& self) noexcept -> size_type { return self.size(); } - friend constexpr auto begin(range const& self) { return self.begin(); } - friend constexpr auto end(range const& self) { return self.end(); } + // friend constexpr auto begin(range const& self) { return self.begin(); } + // friend constexpr auto end(range const& self) { return self.end(); } friend BOOST_MULTI_HD constexpr auto operator==(range const& self, range const& other) { return (self.empty() && other.empty()) || (self.first_ == other.first_ && self.last_ == other.last_); @@ -344,8 +351,16 @@ struct extension_t : public range { BOOST_MULTI_HD constexpr extension_t(IndexTypeLast last) noexcept // NOLINT(google-explicit-constructor,hicpp-explicit-conversions) // NOSONAR(cpp:S1709) allow terse syntax : range(IndexType{}, IndexType{} + last) {} + // extension_t() = default; + // extension_t(extension_t const&) = default; + // extension_t(extension_t&&) = default; + // auto operator=(extension_t const&) -> extension_t& = default; + // auto operator=(extension_t&&) -> extension_t& = default; + // ~extension_t() = default; + template< class OtherExtension, + // std::enable_if_t>, int> = 0, // NOLINT(modernize-type-traits) bug in clang-tidy decltype( detail::implicit_cast(std::declval().first()), detail::implicit_cast(std::declval().last()) @@ -365,13 +380,16 @@ struct extension_t : public range { // BOOST_MULTI_HD constexpr explicit extension_t(OtherExtension const& other) noexcept // : extension_t{other.first(), other.last()} {} - template + template, int> =0 // NOLINT(modernize-use-constraints,modernize-type-traits) + > BOOST_MULTI_HD constexpr auto operator=(OtherExtension const& other) -> extension_t& { (*this) = extension_t{other}; return *this; } - BOOST_MULTI_HD constexpr extension_t() noexcept : range() {} + extension_t() = default; + // BOOST_MULTI_HD constexpr extension_t() noexcept : range() {} // friend constexpr auto size(extension_t const& self) -> typename extension_t::size_type { return self.size(); } diff --git a/include/boost/multi/detail/layout.hpp b/include/boost/multi/detail/layout.hpp index b1e7cd972..f5199dc16 100644 --- a/include/boost/multi/detail/layout.hpp +++ b/include/boost/multi/detail/layout.hpp @@ -502,7 +502,7 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t 0) { // mull-ignore: cxx_gt_to_ge curr_ += (rest_it_ - rest_begin_ + n) / (rest_end_ - rest_begin_); rest_it_ = rest_begin_ + ((rest_it_ - rest_begin_ + n) % (rest_end_ - rest_begin_)); - } else if(n < 0) { // mull-ignore: cxx_lt_to_ge, cxx_lt_to_le + } else if(n < 0) { // mull-ignore curr_ -= (rest_end_ - rest_it_ - n) / (rest_end_ - rest_begin_); rest_it_ = rest_end_ - ((rest_end_ - rest_it_ - n) % (rest_end_ - rest_begin_)); if(rest_it_ == rest_end_) { @@ -521,7 +521,7 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t #include // for equal +#include // for size #include // for accumulate #include // for vector // IWYU pragma: no_include // for tuple_element<>::type #include +#if defined(__cplusplus) && (__cplusplus >= 202002L) && __has_include() +#include // IWYU pragma: keep // NOLINT(misc-include-cleaner) +#endif + namespace multi = boost::multi; auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugprone-exception-escape) @@ -72,6 +77,7 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro { multi::index_extension const iex(10); + using std::size; BOOST_TEST( *begin(iex) == 0 ); BOOST_TEST( size(iex) == 10 ); BOOST_TEST( iex[0] == 0 ); @@ -201,7 +207,7 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro multi::range, int> const irng({}, 12); // && !defined(__PGI) && (__cplusplus >= 202002L || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) -#if (__cplusplus >= 202002L) && (__has_cpp_attribute(no_unique_address) >= 201803L) && !defined(__NVCC__) && !defined(__NVCOMPILER) +#if(__cplusplus >= 202002L) && (__has_cpp_attribute(no_unique_address) >= 201803L) && !defined(__NVCC__) && !defined(__NVCOMPILER) static_assert(sizeof(irng) == sizeof(int)); #endif @@ -258,6 +264,30 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro auto sum = std::accumulate(irng.begin(), irng.end(), 0); BOOST_TEST( sum == 5 + 6 + 7 + 8 + 9 + 10 + 11 ); } + { + multi::extension_t const ext(5); + + BOOST_TEST( *ext.begin() == 0 ); + BOOST_TEST( *(ext.end() - 1) == 4 ); + +#if !defined(__clang_major__) || (__clang_major__ != 15) +#if defined(__cpp_lib_ranges) && (__cpp_lib_ranges >= 201911L) && !defined(_MSC_VER) + BOOST_TEST( *std::ranges::begin(ext) == 0 ); + BOOST_TEST( *(std::ranges::end(ext)-1) == 4 ); + + BOOST_TEST( ext[1] == 1 ); + + static_assert(std::ranges::range>); + static_assert(std::ranges::range const>); + static_assert(std::ranges::range>>); + + // std::ranges::ref_view> + auto rext = ext | std::views::reverse; + + BOOST_TEST( rext[1] == 3 ); +#endif +#endif + } return boost::report_errors(); } diff --git a/test/layout.cpp b/test/layout.cpp index c88b8d0ad..672a18150 100644 --- a/test/layout.cpp +++ b/test/layout.cpp @@ -528,6 +528,7 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro auto xA = extensions(arr); using std::get; // needed for C++17 + using std::size; BOOST_TEST( size(get<0>(xA)) == 3 ); BOOST_TEST( size(get<1>(xA)) == 4 ); BOOST_TEST( size(get<2>(xA)) == 5 );