diff --git a/include/boost/multi/adaptors/cufft.hpp b/include/boost/multi/adaptors/cufft.hpp index fd3628177..10bcc7a6b 100644 --- a/include/boost/multi/adaptors/cufft.hpp +++ b/include/boost/multi/adaptors/cufft.hpp @@ -84,7 +84,7 @@ constexpr sign backward{CUFFT_INVERSE}; static_assert(forward != none && none != backward && backward != forward); -template +template class plan { Alloc alloc_; ::size_t workSize_ = 0; @@ -185,6 +185,8 @@ class plan { } } + static_assert(sizeof(ILayout*) == 0); + if(first_howmany_ == D) { if constexpr(std::is_same_v) { cufftSafeCall(::cufftPlanMany( @@ -286,6 +288,7 @@ class plan { private: + template void ExecZ2Z_(complex_type const* idata, complex_type* odata, int direction) const{ cufftSafeCall(cufftExecZ2Z(h_, const_cast(idata), odata, direction)); // NOLINT(cppcoreguidelines-pro-type-const-cast) wrap legacy interface // cudaDeviceSynchronize(); @@ -293,7 +296,12 @@ class plan { public: template - void execute(IPtr idata, OPtr odata, int direction) { // TODO(correaa) make const + auto execute(IPtr idata, OPtr odata, int direction) + -> decltype((void)( + reinterpret_cast(::thrust::raw_pointer_cast(idata)), + reinterpret_cast(::thrust::raw_pointer_cast(odata)) + )) + { // TODO(correaa) make const if(first_howmany_ == DD) { ExecZ2Z_(reinterpret_cast(::thrust::raw_pointer_cast(idata)), reinterpret_cast(::thrust::raw_pointer_cast(odata)), direction); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) wrap a legacy interface return; @@ -381,24 +389,32 @@ class cached_plan { if(it_ == LEAKY_cache.end()) {it_ = LEAKY_cache.insert(std::make_pair(std::make_tuple(which, in, out), plan(which, in, out, alloc))).first;} } template - void execute(IPtr idata, OPtr odata, int direction) { + auto execute(IPtr idata, OPtr odata, int direction) + -> decltype( + (void) + (std::declval< + typename std::map, multi::layout_t, multi::layout_t>, plan >::iterator& + >()->second.execute(idata, odata, direction) + ) + ) + { // assert(it_ != LEAKY_cache.end()); it_->second.execute(idata, odata, direction); } }; -template::value, int> =0> +template::value, int> =0, typename = decltype(raw_pointer_cast(std::declval().base()))> auto dft(std::array which, In const& in, Out&& out, int sgn) ->decltype(cufft::cached_plan{which, in.layout(), out.layout()}.execute(in.base(), out.base(), sgn), std::forward(out)) { return cufft::cached_plan{which, in.layout(), out.layout()}.execute(in.base(), out.base(), sgn), std::forward(out); } -template::value, int> =0> +template::value, int> =0, typename = decltype(raw_pointer_cast(std::declval().base()))> auto dft(std::array which, In const& in, Out&& out, int sgn) ->decltype(cufft::cached_plan::rebind_alloc*/ >{which, in.layout(), out.layout()/*, i.get_allocator()*/}.execute(in.base(), out.base(), sgn), std::forward(out)) { return cufft::cached_plan::rebind_alloc*/ >{which, in.layout(), out.layout()/*, i.get_allocator()*/}.execute(in.base(), out.base(), sgn), std::forward(out); } template//, std::enable_if_t::value, int> =0> -auto dft_forward(std::array which, In const& in, Out&& out) -> Out&& { +auto dft_forward(std::array which, In const& in, Out&& out) -> Out&& { //->decltype(cufft::plan{which, i.layout(), o.layout()}.execute(i.base(), o.base(), cufft::forward), std::forward(o)) { return cufft::cached_plan{which, in.layout(), out.layout()}.execute(in.base(), out.base(), cufft::forward), std::forward(out); } diff --git a/include/boost/multi/adaptors/cufft/test/CMakeLists.txt b/include/boost/multi/adaptors/cufft/test/CMakeLists.txt index 6f01b0ee3..ce7a9ba17 100644 --- a/include/boost/multi/adaptors/cufft/test/CMakeLists.txt +++ b/include/boost/multi/adaptors/cufft/test/CMakeLists.txt @@ -71,14 +71,14 @@ include(CTest) include_directories(${CMAKE_BINARY_DIR}) # file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) -set(TEST_SRCS cufft.cpp) +#set(TEST_SRCS cufft.cpp) foreach(TEST_FILE ${TEST_SRCS}) set(TEST_EXE "${TEST_FILE}.x") add_executable(${TEST_EXE} ${TEST_FILE}) if(ENABLE_CUDA OR DEFINED CXXCUDA) set_source_files_properties(${TEST_FILE} PROPERTIES LANGUAGE CUDA) - target_compile_options(${TEST_EXE} PRIVATE -std=c++17) + # target_compile_options(${TEST_EXE} PRIVATE -std=c++17) endif() # target_compile_features (${TEST_EXE} PUBLIC cxx_std_17) target_compile_definitions(${TEST_EXE} PRIVATE "BOOST_PP_VARIADICS") # needed by Boost.Test and NVCC diff --git a/include/boost/multi/adaptors/fft.hpp b/include/boost/multi/adaptors/fft.hpp index 8c513b85b..f1d2ffeea 100644 --- a/include/boost/multi/adaptors/fft.hpp +++ b/include/boost/multi/adaptors/fft.hpp @@ -167,7 +167,7 @@ namespace boost::multi::fft{ #endif template auto dft_all(In&& in) { - auto const all_true = std::apply([](auto... es) { return std::array{(es, true)...}; }, std::array::dimensionality>{}); + auto const all_true = std::apply([](auto... es) { return std::array{((void)es, true)...}; }, std::array::dimensionality>{}); return dft(all_true, std::forward(in), fft::forward); } diff --git a/include/boost/multi/adaptors/fftw/test/CMakeLists.txt b/include/boost/multi/adaptors/fftw/test/CMakeLists.txt index 18d5c92bd..a294b7137 100644 --- a/include/boost/multi/adaptors/fftw/test/CMakeLists.txt +++ b/include/boost/multi/adaptors/fftw/test/CMakeLists.txt @@ -58,7 +58,7 @@ foreach(TEST_FILE ${TEST_SRCS}) add_executable(${TEST_EXE} ${TEST_FILE}) if(ENABLE_CUDA OR DEFINED CXXCUDA) set_source_files_properties(${TEST_FILE} PROPERTIES LANGUAGE CUDA) - target_compile_options(${TEST_EXE} PRIVATE -std=c++17) + # target_compile_options(${TEST_EXE} PRIVATE -std=c++17) endif() target_include_directories(${TEST_EXE} PRIVATE ${PROJECT_SOURCE_DIR}/include) diff --git a/include/boost/multi/adaptors/tblis/test/CMakeLists.txt b/include/boost/multi/adaptors/tblis/test/CMakeLists.txt index 7874678de..966a4066e 100644 --- a/include/boost/multi/adaptors/tblis/test/CMakeLists.txt +++ b/include/boost/multi/adaptors/tblis/test/CMakeLists.txt @@ -60,7 +60,7 @@ foreach(TEST_FILE ${TEST_SRCS}) add_executable(${TEST_EXE} ${TEST_FILE}) if(ENABLE_CUDA OR DEFINED CXXCUDA) set_source_files_properties(${TEST_FILE} PROPERTIES LANGUAGE CUDA) - target_compile_options(${TEST_EXE} PRIVATE -std=c++17) + # target_compile_options(${TEST_EXE} PRIVATE -std=c++17) endif() # target_compile_features (${TEST_EXE} PUBLIC cxx_std_17) target_compile_definitions(${TEST_EXE} PRIVATE "BOOST_PP_VARIADICS")