Skip to content

Commit

Permalink
fixes for cuda 11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
alfC committed Feb 18, 2025
1 parent 19f7ac7 commit dd63476
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
5 changes: 3 additions & 2 deletions include/boost/multi/adaptors/blas/numeric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,16 @@ auto conj(A&& array) -> A&& {
}

template<
class A, class D = std::decay_t<A>, typename Elem = typename D::element_type,
class A, class D = std::decay_t<A>, typename Elem = typename D::element,
typename Ptr = std::decay_t<decltype(std::declval<A&&>().base())>,
// typename = decltype(std::declval<A>().size()),
// typename = decltype(std::declval<A&&>().template static_array_cast<Elem, conjugater<Ptr>>()),
std::enable_if_t<!is_conjugated<A>{} && is_complex_array<A>{}, int> =0> // NOLINT(modernize-use-constraints) TODO(correaa) for C++20
auto conj(A&& array) -> decltype(auto) {
return std::forward<A>(array).template static_array_cast<Elem, conjugater<Ptr>>();
}

template<class A, class D = std::decay_t<A>, typename Elem = typename D::element_type,
template<class A, class D = std::decay_t<A>, typename Elem = typename D::element,
typename Ptr = typename decltype(std::declval<A&&>().base())::underlying_type,
std::enable_if_t<is_conjugated<A>{}, int> =0> // NOLINT(modernize-use-constraints) TODO(correaa) for C++20
auto conj(A&& array)
Expand Down
5 changes: 3 additions & 2 deletions include/boost/multi/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,13 @@ struct static_array // NOLINT(fuchsia-multiple-inheritance) : multiple inherita

template<
class Range, class = std::enable_if_t<!std::is_base_of<static_array, std::decay_t<Range>>{}>,
class = decltype(/*static_array*/ (std::declval<Range const&>().begin() - std::declval<Range const&>().end())), // instantiation of static_array here gives a compiler error in 11.0, partially defined type?
class = typename Range::iterator, // this solves a problem in cuda 11.x when element_iterator is made to be pointer-like
// class = decltype(/*static_array*/ (std::declval<Range const&>().begin() - std::declval<Range const&>().end())), // instantiation of static_array here gives a compiler error in 11.0, partially defined type?
class = std::enable_if_t<! is_subarray<Range const&>::value> // NOLINT(modernize-use-constraints) TODO(correaa) in C++20
>
// cppcheck-suppress noExplicitConstructor ; because I want to use equal for lazy assigments form range-expressions // NOLINTNEXTLINE(runtime/explicit)
static_array(Range const& rng) // NOLINT(google-explicit-constructor,hicpp-explicit-conversions) : to allow terse syntax // NOSONAR
: static_array{std::begin(rng), std::end(rng)} {} // Sonar: Prefer free functions over member functions when handling objects of generic type "Range".
: static_array(std::begin(rng), std::end(rng)) {} // Sonar: Prefer free functions over member functions when handling objects of generic type "Range".

template<class TT>
auto uninitialized_fill_elements(TT const& value) {
Expand Down
2 changes: 1 addition & 1 deletion include/boost/multi/array_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ struct array_iterator // NOLINT(fuchsia-multiple-inheritance) for facades
using element_ptr = ElementPtr;
using element_const_ptr = typename std::pointer_traits<ElementPtr>::template rebind<element const>;
using value_type = typename subarray<element, D-1, element_ptr>::decay_type;
// using element_type = value_type;
using element_type = value_type;

using pointer = subarray<element, D - 1, element_ptr>*;
using reference = std::conditional_t<
Expand Down
20 changes: 11 additions & 9 deletions include/boost/multi/detail/tuple_zip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,6 @@ constexpr auto get(tuple<T0, Ts...> const& t) -> auto const& { // NOLINT(readab
return get<N - 1>(t.tail());
}
}
#if defined __NVCC__
#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
#pragma nv_diagnostic pop
#else
#pragma diagnostic pop
#endif
#elif defined __NVCOMPILER
#pragma diagnostic pop
#endif

template<std::size_t N, class T0, class... Ts>
constexpr auto get(tuple<T0, Ts...>& tup) -> auto& {
Expand All @@ -330,6 +321,17 @@ constexpr auto get(tuple<T0, Ts...>&& tup) -> auto&& {
return get<N - 1>(std::move(std::move(tup).tail()));
}
}

#if defined __NVCC__
#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
#pragma nv_diagnostic pop
#else
#pragma diagnostic pop
#endif
#elif defined __NVCOMPILER
#pragma diagnostic pop
#endif

#if ! defined(_MSC_VER)
#pragma GCC diagnostic pop
#endif
Expand Down
3 changes: 2 additions & 1 deletion test/array_cref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// https://www.boost.org/LICENSE_1_0.txt

#ifdef __NVCC__ // affects cuda 11.4.3
#pragma diag_suppress 20014 // error #20014-D: calling a __host__ function from a __host__ __device__ function is not allowed
// #pragma diag_suppress 20014 // error #20014-D: calling a __host__ function from a __host__ __device__ function is not allowed
#pragma nv_diag_suppress 20014 // error #20014-D: calling a __host__ function from a __host__ __device__ function is not allowed
#endif

#include <boost/multi/array.hpp> // for array, array_ref, subarray, arra...
Expand Down

0 comments on commit dd63476

Please sign in to comment.