Skip to content

Commit

Permalink
CI: NVHPC 23.1 (AMReX-Codes#3122)
Browse files Browse the repository at this point in the history
Update CI to Test against the latest NVHPC release, v23.1

See AMReX-Codes#2378
  • Loading branch information
ax3l authored Feb 2, 2023
1 parent e6e2fbc commit 2ad5677
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ jobs:
cmake --build build -j 2
# Build libamrex and all tests with NVHPC (recent supported)
tests-nvhpc21-11-nvcc:
name: NVHPC@21.11 NVCC/NVC++ C++17 Release [tests]
tests-nvhpc23-1-nvcc:
name: NVHPC@23.1 NVCC/NVC++ C++17 Release [tests]
runs-on: ubuntu-20.04
env: {CXXFLAGS: "-Werror -Wall -Wextra -Wpedantic -Wshadow"}
env: {CXXFLAGS: "-Werror -Wall -Wextra -Wpedantic -Wshadow --diag_suppress=code_is_unreachable"}
steps:
- uses: actions/checkout@v3
- name: Dependencies
run: .github/workflows/dependencies/dependencies_nvhpc21-11.sh
run: .github/workflows/dependencies/dependencies_nvhpc23-1.sh
- name: Build & Install
run: |
source /etc/profile.d/modules.sh
module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/21.11
module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/23.1
which nvcc || echo "nvcc not in PATH!"
which nvc++ || echo "nvc++ not in PATH!"
Expand All @@ -68,14 +68,10 @@ jobs:
-DAMReX_ENABLE_TESTS=ON \
-DAMReX_PARTICLES=ON \
-DAMReX_FORTRAN=OFF \
-DAMReX_GPU_BACKEND=CUDA \
-DAMReX_OMP=ON \
-DCMAKE_C_COMPILER=$(which nvc) \
-DCMAKE_CXX_COMPILER=$(which nvc++) \
-DCMAKE_CUDA_HOST_COMPILER=$(which nvc++) \
-DCMAKE_Fortran_COMPILER=$(which nvfortran) \
-DAMReX_CUDA_ARCH=8.0 \
-DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON \
-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON
-DCMAKE_Fortran_COMPILER=$(which nvfortran)
cmake --build build -j 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ sudo apt-get install -y \
pkg-config \
wget

echo 'deb [trusted=yes] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | \
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | \
sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | \
sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends nvhpc-21-11
sudo apt-get install -y --no-install-recommends nvhpc-23-1

# things should reside in /opt/nvidia/hpc_sdk now

# activation via:
# source /etc/profile.d/modules.sh
# module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/21.11
# module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/23.1

28 changes: 14 additions & 14 deletions Src/Particle/AMReX_ParticleArray.H
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ struct DataLayoutPolicy<ContainerType, ParticleType<Types...>, DataLayout::AoS>
using raw_type = ParticleType<Types...>*;
using value_type = ParticleType<Types...>&;

constexpr static raw_type get_raw_data (container_type& a_container)
static constexpr raw_type get_raw_data (container_type& a_container)
{
return raw_type(static_cast<ParticleType<Types...>*>(&a_container[0]));
}

constexpr static void resize (container_type& a_container, std::size_t a_size)
static constexpr void resize (container_type& a_container, std::size_t a_size)
{
a_container.resize(a_size);
}

template <typename ValueType>
constexpr static void push_back (container_type& a_container, ValueType&& a_value)
static constexpr void push_back (container_type& a_container, ValueType&& a_value)
{
a_container.push_back(a_value);
}
Expand All @@ -108,7 +108,7 @@ struct DataLayoutPolicyRaw<ParticleType<Types...>, DataLayout::AoS>
using value_type = ParticleType<Types...>&;

AMREX_GPU_HOST_DEVICE
constexpr static value_type get (raw_type a_ptr, std::size_t a_index)
static constexpr value_type get (raw_type a_ptr, std::size_t a_index)
{
return value_type(*static_cast<ParticleType<Types...>*>(&a_ptr[a_index]));
}
Expand All @@ -128,18 +128,18 @@ struct DataLayoutPolicy<ContainerType, ParticleType<Types...>, DataLayout::SoA>
using raw_type = const amrex::GpuTuple<Types*...>;
using value_type = ParticleType<ref_wrapper<Types>...>;

constexpr static raw_type get_raw_data (container_type& a_container)
static constexpr raw_type get_raw_data (container_type& a_container)
{
return get_raw_data_impl(a_container, std::make_index_sequence<sizeof...(Types)>());
}

constexpr static void resize (container_type& a_container, std::size_t a_size)
static constexpr void resize (container_type& a_container, std::size_t a_size)
{
resize_impl(a_container, a_size, std::make_index_sequence<sizeof...(Types)>());
}

template <typename ValueType>
constexpr static void push_back (container_type& a_container, ValueType&& a_value)
static constexpr void push_back (container_type& a_container, ValueType&& a_value)
{
push_back_impl(a_container, std::forward<ValueType>(a_value),
std::make_index_sequence<sizeof...(Types)>());
Expand All @@ -153,22 +153,22 @@ struct DataLayoutPolicy<ContainerType, ParticleType<Types...>, DataLayout::SoA>
private:

template <std::size_t... Is>
constexpr static auto get_raw_data_impl (container_type& a_container,
static constexpr auto get_raw_data_impl (container_type& a_container,
std::index_sequence<Is...>)
{
return raw_type{static_cast<Types*>(&std::get<Is>(a_container)[0])... };
}

template <std::size_t... Is>
constexpr static void resize_impl (container_type& a_container, std::size_t a_size,
static constexpr void resize_impl (container_type& a_container, std::size_t a_size,
std::index_sequence<Is...>)
{
using expander = int[];
(void) expander{ 0, (std::get<Is>(a_container).resize(a_size), 0)... };
}

template <typename ValueType, std::size_t... Is>
constexpr static void push_back_impl(container_type& a_container, ValueType&& a_value,
static constexpr void push_back_impl(container_type& a_container, ValueType&& a_value,
std::index_sequence<Is...>)
{
using expander = int[];
Expand All @@ -186,7 +186,7 @@ struct DataLayoutPolicyRaw<ParticleType<Types...>, DataLayout::SoA> {
using value_type = ParticleType<ref_wrapper<Types>...>;

AMREX_GPU_HOST_DEVICE
constexpr static value_type get (raw_type& a_tuple, std::size_t a_index)
static constexpr value_type get (raw_type& a_tuple, std::size_t a_index)
{
return get_impl(a_tuple, a_index, std::make_index_sequence<sizeof...(Types)>());
}
Expand All @@ -195,7 +195,7 @@ private:

template <std::size_t... Is>
AMREX_GPU_HOST_DEVICE
constexpr static auto get_impl (raw_type& a_tuple, std::size_t a_index,
static constexpr auto get_impl (raw_type& a_tuple, std::size_t a_index,
std::index_sequence<Is...>)
{
return value_type{ref_wrapper<Types>(amrex::get<Is>(a_tuple)[a_index])... };
Expand All @@ -215,7 +215,7 @@ struct ParticleArray
using value_type = typename policy_type::value_type;
using container_type = typename policy_type::container_type;

auto static constexpr data_layout = DataLayoutTag;
static constexpr auto data_layout = DataLayoutTag;

ParticleArray () { resize(0); }

Expand Down Expand Up @@ -252,7 +252,7 @@ struct ParticleArrayAccessor
using value_type = typename policy_type::value_type;
using raw_type = typename policy_type::raw_type;

auto static constexpr data_layout = DataLayoutTag;
static constexpr auto data_layout = DataLayoutTag;

ParticleArrayAccessor (std::size_t a_size, raw_type a_data)
: m_size(a_size), m_data(a_data)
Expand Down

0 comments on commit 2ad5677

Please sign in to comment.