Skip to content
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

Allow to set a CMAKE_CUDA_STANDARD different from CMAKE_CXX_STANDARD #700

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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 .jenkins/cscs/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pipeline {
axes {
axis {
name 'configuration_name'
values 'gcc-13', 'gcc-12', 'gcc-11', 'gcc-10-apex', 'gcc-9', 'gcc-cuda-11', 'gcc-cuda-12', 'clang-16', 'clang-15', 'clang-14-cuda', 'clang-13', 'clang-12', 'clang-11', 'cce', 'nvhpc'
values 'gcc-13', 'gcc-12', 'gcc-11', 'gcc-10-apex', 'gcc-9', 'gcc-cuda-11', 'gcc-cuda-12', 'clang-16', 'clang-15', 'clang-14-cuda', 'clang-13', 'clang-12', 'clang-11', 'cce', 'nvhpc', 'gcc-cuda-11-stdexec'
}
axis {
name 'build_type'
Expand Down
8 changes: 8 additions & 0 deletions .jenkins/cscs/config-gcc-cuda-11-stdexec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2020 ETH Zurich
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

configuration_slurm_constraint="gpu"
configuration_skip_pr="false"
24 changes: 24 additions & 0 deletions .jenkins/cscs/env-gcc-cuda-11-stdexec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2020 ETH Zurich
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

cxx_std="20"
cuda_std="17"
gcc_version="9.3.0"
boost_version="1.75.0"
hwloc_version="2.0.3"
cuda_version="11.2.0"
fmt_version="9.1.0"
stdexec_version="git.4b441f333adaeb8eb0a6c7f38d36af30fa7ab366=main"
spack_compiler="gcc@${gcc_version}"
spack_arch="cray-cnl7-haswell"

spack_spec="pika@main arch=${spack_arch} %${spack_compiler} +cuda malloc=system cxxstd=${cxx_std} +stdexec ^boost@${boost_version} ^hwloc@${hwloc_version} ^cuda@${cuda_version} ^fmt@${fmt_version} ^stdexec@${stdexec_version}"

configure_extra_options+=" -DPIKA_WITH_CXX_STANDARD=${cxx_std}"
configure_extra_options+=" -DCMAKE_CUDA_STANDARD=${cuda_std}"
configure_extra_options+=" -DPIKA_WITH_MALLOC=system"
configure_extra_options+=" -DPIKA_WITH_CUDA=ON"
configure_extra_options+=" -DPIKA_WITH_EXAMPLES_OPENMP=ON"
8 changes: 6 additions & 2 deletions .jenkins/cscs/env-gcc-cuda-11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

cxx_std="17"
cxx_std="20"
cuda_std="17"
gcc_version="9.3.0"
boost_version="1.75.0"
hwloc_version="2.0.3"
cuda_version="11.2.0"
fmt_version="9.1.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the problem with 10.0.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. During compilation of which file does that happen?

We definitely have that covered here:

template <>
struct fmt::formatter<pika::util::logging::level> : fmt::formatter<std::string>
{
template <typename FormatContext>
auto format(pika::util::logging::level const& value, FormatContext& ctx)
{
return fmt::formatter<std::string>::format(pika::util::logging::levelname(value), ctx);
}
};
. But this may be one (of many) problems that we get from allowing different standards. I'd like to see how badly other things break from this as well before we decide what to do here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of the cuda files, the error I pasted is for cuda_sender_test though, will try to add the GPU stdexec and then see what's happening

spack_compiler="gcc@${gcc_version}"
spack_arch="cray-cnl7-haswell"

spack_spec="pika@main arch=${spack_arch} %${spack_compiler} +cuda malloc=system cxxstd=${cxx_std} ^boost@${boost_version} ^hwloc@${hwloc_version} ^cuda@${cuda_version}"
spack_spec="pika@main arch=${spack_arch} %${spack_compiler} +cuda malloc=system cxxstd=${cxx_std}
^boost@${boost_version} ^hwloc@${hwloc_version} ^cuda@${cuda_version} ^fmt@${fmt_version}"

configure_extra_options+=" -DPIKA_WITH_CXX_STANDARD=${cxx_std}"
configure_extra_options+=" -DCMAKE_CUDA_STANDARD=${cuda_std}"
aurianer marked this conversation as resolved.
Show resolved Hide resolved
aurianer marked this conversation as resolved.
Show resolved Hide resolved
configure_extra_options+=" -DPIKA_WITH_MALLOC=system"
configure_extra_options+=" -DPIKA_WITH_CUDA=ON"
configure_extra_options+=" -DPIKA_WITH_EXAMPLES_OPENMP=ON"
19 changes: 11 additions & 8 deletions cmake/pika_setup_cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ if(PIKA_WITH_CUDA AND NOT TARGET pika_internal::cuda)
# support
if(NOT PIKA_FIND_PACKAGE)
if(DEFINED CMAKE_CUDA_STANDARD AND NOT CMAKE_CUDA_STANDARD STREQUAL
PIKA_WITH_CXX_STANDARD
CMAKE_CXX_STANDARD
)
pika_error(
"You've set CMAKE_CUDA_STANDARD to ${CMAKE_CUDA_STANDARD} and PIKA_WITH_CXX_STANDARD to ${PIKA_WITH_CXX_STANDARD}. Please unset CMAKE_CUDA_STANDARD."
pika_info(
"You've set PIKA_WITH_CXX_STANDARD to ${PIKA_WITH_CXX_STANDARD} and CMAKE_CUDA_STANDARD to ${CMAKE_CUDA_STANDARD}."
)
else()
set(CMAKE_CUDA_STANDARD ${PIKA_WITH_CXX_STANDARD})
endif()

set(CMAKE_CUDA_STANDARD ${PIKA_WITH_CXX_STANDARD})
endif()

set(CMAKE_CUDA_STANDARD_REQUIRED ON)
Expand All @@ -62,10 +63,12 @@ if(PIKA_WITH_CUDA AND NOT TARGET pika_internal::cuda)
pika_internal::cuda INTERFACE CUDA::cublas CUDA::cusolver
)
endif()
# Flag not working for CLANG CUDA
target_compile_features(
pika_internal::cuda INTERFACE cuda_std_${PIKA_WITH_CXX_STANDARD}
)
if(DEFINED CMAKE_CUDA_STANDARD)
aurianer marked this conversation as resolved.
Show resolved Hide resolved
# Flag not working for CLANG CUDA
target_compile_features(
pika_internal::cuda INTERFACE cuda_std_${CMAKE_CUDA_STANDARD}
)
endif()
set_target_properties(
pika_internal::cuda PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON
)
Expand Down