From 93bc0198fea50b05e18380e7d18b60191c9407dd Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 28 Dec 2017 16:41:13 -0500 Subject: [PATCH] Suppress false positive warnings about calling host device functions. --- examples/cosmotools/CMakeLists.txt | 8 ++++ examples/demo/CMakeLists.txt | 6 +++ examples/game_of_life/CMakeLists.txt | 9 ++++ vtkm/Math.h | 14 +++++- vtkm/benchmarking/BenchmarkCopySpeeds.cxx | 4 +- vtkm/benchmarking/BenchmarkDeviceAdapter.cxx | 46 +++++++++---------- vtkm/benchmarking/BenchmarkRayTracing.cxx | 1 - vtkm/cont/CellLocatorTwoLevelUniformGrid.h | 1 + .../internal/DeviceAdapterAlgorithmSerial.h | 1 + vtkm/cont/tbb/internal/FunctorsTBB.h | 3 +- .../testing/UnitTestTaskSingularCuda.cu | 7 +-- vtkm/internal/FunctionInterfaceDetailPre.h | 22 +++++++++ vtkm/internal/FunctionInterfaceDetailPre.h.in | 2 + vtkm/rendering/Wireframer.h | 2 + vtkm/worklet/Keys.h | 2 +- vtkm/worklet/internal/DispatcherBase.h | 14 ++++++ .../spatialstructure/KdTree3DNNSearch.h | 43 ++++++++++------- vtkm/worklet/splatkernels/Gaussian.h | 1 + vtkm/worklet/splatkernels/Spline3rdOrder.h | 6 +-- .../worklet/testing/UnitTestMarchingCubes.cxx | 5 +- 20 files changed, 140 insertions(+), 57 deletions(-) diff --git a/examples/cosmotools/CMakeLists.txt b/examples/cosmotools/CMakeLists.txt index 087bf21a8..d6a8c710b 100644 --- a/examples/cosmotools/CMakeLists.txt +++ b/examples/cosmotools/CMakeLists.txt @@ -35,6 +35,11 @@ target_link_libraries(CosmoHaloFinder_SERIAL PRIVATE ${VTKm_LIBRARIES}) target_compile_options(CosmoHaloFinder_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS}) if(VTKm_CUDA_FOUND) + set(old_nvcc_flags ${CUDA_NVCC_FLAGS}) + set(old_cxx_flags ${CMAKE_CXX_FLAGS}) + vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags) + vtkm_disable_troublesome_thrust_warnings() + # Cuda compiles do not respect target_include_directories cuda_include_directories(${VTKm_INCLUDE_DIRS}) @@ -47,6 +52,9 @@ if(VTKm_CUDA_FOUND) target_include_directories(CosmoHaloFinder_CUDA PRIVATE ${VTKm_INCLUDE_DIRS}) target_link_libraries(CosmoHaloFinder_CUDA PRIVATE ${VTKm_LIBRARIES}) target_compile_options(CosmoHaloFinder_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS}) + + set(CUDA_NVCC_FLAGS ${old_nvcc_flags}) + set(CMAKE_CXX_FLAGS ${old_cxx_flags}) endif() if(VTKm_TBB_FOUND) diff --git a/examples/demo/CMakeLists.txt b/examples/demo/CMakeLists.txt index c2d745c1b..34f555e42 100644 --- a/examples/demo/CMakeLists.txt +++ b/examples/demo/CMakeLists.txt @@ -28,6 +28,12 @@ find_package(VTKm QUIET REQUIRED if(VTKm_OSMesa_FOUND AND VTKm_Rendering_FOUND) if(VTKm_CUDA_FOUND) + + set(old_nvcc_flags ${CUDA_NVCC_FLAGS}) + set(old_cxx_flags ${CMAKE_CXX_FLAGS}) + vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags) + vtkm_disable_troublesome_thrust_warnings() + # Cuda compiles do not respect target_include_directories cuda_include_directories(${VTKm_INCLUDE_DIRS}) cuda_add_executable(Demo Demo.cu) diff --git a/examples/game_of_life/CMakeLists.txt b/examples/game_of_life/CMakeLists.txt index 7b67e0e5c..9756994f0 100644 --- a/examples/game_of_life/CMakeLists.txt +++ b/examples/game_of_life/CMakeLists.txt @@ -29,7 +29,16 @@ find_package(VTKm REQUIRED ) if(VTKm_CUDA_FOUND) + + set(old_nvcc_flags ${CUDA_NVCC_FLAGS}) + set(old_cxx_flags ${CMAKE_CXX_FLAGS}) + vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags) + vtkm_disable_troublesome_thrust_warnings() + cuda_add_executable(GameOfLife GameOfLife.cu LoadShaders.h) + + set(CUDA_NVCC_FLAGS ${old_nvcc_flags}) + set(CMAKE_CXX_FLAGS ${old_cxx_flags}) else() add_executable(GameOfLife GameOfLife.cxx LoadShaders.h) endif() diff --git a/vtkm/Math.h b/vtkm/Math.h index f35c9628b..881e99a3c 100644 --- a/vtkm/Math.h +++ b/vtkm/Math.h @@ -2347,7 +2347,12 @@ static inline VTKM_EXEC_CONT vtkm::Float32 RemainderQuotient(vtkm::Float32 numer QType& quotient) { int iQuotient; - vtkm::Float32 result = std::remquo(numerator, denominator, &iQuotient); +#ifdef VTKM_CUDA + const vtkm::Float64 result = + VTKM_CUDA_MATH_FUNCTION_32(remquo)(numerator, denominator, &iQuotient); +#else + const vtkm::Float32 result = std::remquo(numerator, denominator, &iQuotient); +#endif quotient = iQuotient; return result; } @@ -2357,7 +2362,12 @@ static inline VTKM_EXEC_CONT vtkm::Float64 RemainderQuotient(vtkm::Float64 numer QType& quotient) { int iQuotient; - vtkm::Float64 result = std::remquo(numerator, denominator, &iQuotient); +#ifdef VTKM_CUDA + const vtkm::Float64 result = + VTKM_CUDA_MATH_FUNCTION_64(remquo)(numerator, denominator, &iQuotient); +#else + const vtkm::Float64 result = std::remquo(numerator, denominator, &iQuotient); +#endif quotient = iQuotient; return result; } diff --git a/vtkm/benchmarking/BenchmarkCopySpeeds.cxx b/vtkm/benchmarking/BenchmarkCopySpeeds.cxx index c219b5845..a4fe1e33a 100644 --- a/vtkm/benchmarking/BenchmarkCopySpeeds.cxx +++ b/vtkm/benchmarking/BenchmarkCopySpeeds.cxx @@ -80,8 +80,8 @@ struct MeasureCopySpeed VTKM_CONT std::string Description() const { - vtkm::UInt64 actualSize = - static_cast(this->Source.GetNumberOfValues() * sizeof(ValueType)); + vtkm::UInt64 actualSize = sizeof(ValueType); + actualSize *= static_cast(this->Source.GetNumberOfValues()); std::ostringstream out; out << "Copying " << HumanSize(this->NumBytes) << " (actual=" << HumanSize(actualSize) << ") of " << vtkm::testing::TypeName::Name() << "\n"; diff --git a/vtkm/benchmarking/BenchmarkDeviceAdapter.cxx b/vtkm/benchmarking/BenchmarkDeviceAdapter.cxx index 00cd77c83..5a5715aad 100644 --- a/vtkm/benchmarking/BenchmarkDeviceAdapter.cxx +++ b/vtkm/benchmarking/BenchmarkDeviceAdapter.cxx @@ -108,7 +108,7 @@ struct BenchDevAlgoConfig /// @note FixBytes and FixSizes are not mutually exclusive. If both are /// specified, both will run. bool TestArraySizeValues{ false }; - vtkm::Id ArraySizeValues{ 1 << 21 }; + vtkm::UInt64 ArraySizeValues{ 1 << 21 }; /// If true, operations like "Unique" will test with a wider range of unique /// values (5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 75%, 100% @@ -126,7 +126,7 @@ struct BenchDevAlgoConfig { return this->DoByteSizes ? static_cast(this->ArraySizeBytes / static_cast(sizeof(T))) - : this->ArraySizeValues; + : static_cast(this->ArraySizeValues); } }; @@ -291,8 +291,8 @@ private: { vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; - description << "Copy " << arraySize << " values (" << HumanSize(arraySize * sizeof(Value)) - << ")"; + description << "Copy " << arraySize << " values (" + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -337,8 +337,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "CopyIf on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << PERCENT_VALID - << "% valid values"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << PERCENT_VALID << "% valid values"; return description.str(); } }; @@ -393,8 +393,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "LowerBounds on " << arraySize << " input values (" - << "(" << HumanSize(arraySize * sizeof(Value)) << ") (" << PERCENT_VALUES - << "% configuration)"; + << "(" << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") (" + << PERCENT_VALUES << "% configuration)"; return description.str(); } }; @@ -451,7 +451,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "Reduce on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -496,8 +496,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "ReduceByKey on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << N_KEYS << " (" - << PERCENT_KEYS << "%) distinct vtkm::Id keys"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << N_KEYS << " (" << PERCENT_KEYS << "%) distinct vtkm::Id keys"; return description.str(); } }; @@ -543,7 +543,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "ScanInclusive on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -579,7 +579,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "ScanExclusive on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -621,7 +621,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "Sort on " << arraySize << " random values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -674,8 +674,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "SortByKey on " << arraySize << " random values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << N_KEYS << " (" - << PERCENT_KEYS << "%) different vtkm::Id keys"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << N_KEYS << " (" << PERCENT_KEYS << "%) different vtkm::Id keys"; return description.str(); } }; @@ -731,7 +731,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "StableSortIndices::Sort on " << arraySize << " random values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -775,8 +775,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "StableSortIndices::Unique on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << this->N_VALID << " (" - << PERCENT_VALID << "%) valid values"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << this->N_VALID << " (" << PERCENT_VALID << "%) valid values"; return description.str(); } }; @@ -831,8 +831,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "Unique on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << N_VALID << " (" - << PERCENT_VALID << "%) valid values"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << N_VALID << " (" << PERCENT_VALID << "%) valid values"; return description.str(); } }; @@ -887,8 +887,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "UpperBounds on " << arraySize << " input and " << N_VALS << " (" - << PERCENT_VALS - << "%) values (input array size: " << HumanSize(arraySize * sizeof(Value)) << ")"; + << PERCENT_VALS << "%) values (input array size: " + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; diff --git a/vtkm/benchmarking/BenchmarkRayTracing.cxx b/vtkm/benchmarking/BenchmarkRayTracing.cxx index c32eb137f..7d404e441 100644 --- a/vtkm/benchmarking/BenchmarkRayTracing.cxx +++ b/vtkm/benchmarking/BenchmarkRayTracing.cxx @@ -107,7 +107,6 @@ VTKM_MAKE_BENCHMARK(RayTracing, BenchRayTracing); int main(int, char* []) { - using TestTypes = vtkm::ListTagBase; VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase()); return 0; } diff --git a/vtkm/cont/CellLocatorTwoLevelUniformGrid.h b/vtkm/cont/CellLocatorTwoLevelUniformGrid.h index 286d538e4..01a764a52 100644 --- a/vtkm/cont/CellLocatorTwoLevelUniformGrid.h +++ b/vtkm/cont/CellLocatorTwoLevelUniformGrid.h @@ -107,6 +107,7 @@ private: DimVec3 Min; DimVec3 Max; + VTKM_EXEC bool Empty() const { return (this->Max[0] < this->Min[0]) || (this->Max[1] < this->Min[1]) || diff --git a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h index cd110a105..1354d25e0 100644 --- a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h +++ b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h @@ -68,6 +68,7 @@ private: } } + VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) { diff --git a/vtkm/cont/tbb/internal/FunctorsTBB.h b/vtkm/cont/tbb/internal/FunctorsTBB.h index 10bb2f2b1..03dade15f 100644 --- a/vtkm/cont/tbb/internal/FunctorsTBB.h +++ b/vtkm/cont/tbb/internal/FunctorsTBB.h @@ -98,7 +98,6 @@ struct CopyBody vtkm::Id InputOffset; vtkm::Id OutputOffset; - VTKM_EXEC_CONT CopyBody(const InputPortalType& inPortal, const OutputPortalType& outPortal, vtkm::Id inOffset, @@ -127,12 +126,14 @@ struct CopyBody } } + VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) const { std::copy(src, srcEnd, dst); } + VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC void operator()(const ::tbb::blocked_range& range) const { diff --git a/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu b/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu index 0ce3d8561..f0fd9de82 100644 --- a/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu +++ b/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu @@ -37,12 +37,6 @@ namespace struct TestExecObject { - VTKM_EXEC_CONT - TestExecObject() - : Portal() - { - } - VTKM_EXEC_CONT TestExecObject(vtkm::exec::cuda::internal::ArrayPortalFromThrust portal) : Portal(portal) @@ -62,6 +56,7 @@ struct MyOutputToInputMapPortal struct MyVisitArrayPortal { using ValueType = vtkm::IdComponent; + VTKM_EXEC_CONT vtkm::IdComponent Get(vtkm::Id) const { return 1; } }; diff --git a/vtkm/internal/FunctionInterfaceDetailPre.h b/vtkm/internal/FunctionInterfaceDetailPre.h index 0698d60b3..a241da8ef 100644 --- a/vtkm/internal/FunctionInterfaceDetailPre.h +++ b/vtkm/internal/FunctionInterfaceDetailPre.h @@ -76,12 +76,16 @@ struct ParameterContainer; template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; }; template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; }; @@ -90,6 +94,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; }; @@ -100,6 +106,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -112,6 +120,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -126,6 +136,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -142,6 +154,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -160,6 +174,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -180,6 +196,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -202,6 +220,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -226,6 +246,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; diff --git a/vtkm/internal/FunctionInterfaceDetailPre.h.in b/vtkm/internal/FunctionInterfaceDetailPre.h.in index 911cc5b78..7aa8c7977 100644 --- a/vtkm/internal/FunctionInterfaceDetailPre.h.in +++ b/vtkm/internal/FunctionInterfaceDetailPre.h.in @@ -123,6 +123,8 @@ $for(num_params in range(0, max_parameters+1))\ template <$template_params(num_params)> struct ParameterContainer<$signature(num_params)> { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; $for(param_index in range(1, num_params+1))\ $ptype(param_index) Parameter$(param_index); $endfor\ diff --git a/vtkm/rendering/Wireframer.h b/vtkm/rendering/Wireframer.h index 6eae48dd8..1382c8159 100644 --- a/vtkm/rendering/Wireframer.h +++ b/vtkm/rendering/Wireframer.h @@ -74,6 +74,7 @@ vtkm::UInt32 ScaleColorComponent(vtkm::Float32 c) return vtkm::UInt32(t < 0 ? 0 : (t > 255 ? 255 : t)); } +VTKM_EXEC_CONT vtkm::UInt32 PackColor(vtkm::Float32 r, vtkm::Float32 g, vtkm::Float32 b, vtkm::Float32 a); VTKM_EXEC_CONT @@ -92,6 +93,7 @@ vtkm::UInt32 PackColor(vtkm::Float32 r, vtkm::Float32 g, vtkm::Float32 b, vtkm:: return packed; } +VTKM_EXEC_CONT void UnpackColor(vtkm::UInt32 color, vtkm::Float32& r, vtkm::Float32& g, diff --git a/vtkm/worklet/Keys.h b/vtkm/worklet/Keys.h index c96a9f82d..7fcfe5343 100644 --- a/vtkm/worklet/Keys.h +++ b/vtkm/worklet/Keys.h @@ -79,7 +79,7 @@ public: }; VTKM_CONT - Keys() {} + Keys() = default; /// \b Construct a Keys class from an array of keys. /// diff --git a/vtkm/worklet/internal/DispatcherBase.h b/vtkm/worklet/internal/DispatcherBase.h index 363909b16..3caba1ec0 100644 --- a/vtkm/worklet/internal/DispatcherBase.h +++ b/vtkm/worklet/internal/DispatcherBase.h @@ -401,8 +401,22 @@ private: static_assert(isAllValid::value == expectedLen::value, "All arguments failed the TypeCheck pass"); +#if defined __NVCC__ +// Disable warning "calling a __host__ function from a __host__ __device__" +// In some cases nv_exec_check_disable doesn't work and therefore you need +// to use the following suppressions +// This have been found by eigen: +// https://github.com/RLovelett/eigen/blame/master/Eigen/src/Core/util/DisableStupidWarnings.h +#pragma push +#pragma diag_suppress 2737 +#pragma diag_suppress 2739 +#endif auto fi = vtkm::internal::make_FunctionInterface::type...>(args...); +#if defined __NVCC__ +#pragma pop +#endif + auto ivc = vtkm::internal::Invocation + #include #include #include #include -#include -#include -#include -#include -#include + #include #include #include @@ -53,7 +51,7 @@ public: WholeArrayIn<> treeSplitIdIn, WholeArrayIn<> treeCoordiIn, FieldOut<> nnIdOut, - FieldOut<> nnDisOut); + FieldInOut<> nnDisOut); typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6); VTKM_CONT @@ -175,8 +173,6 @@ public: IdType& nnId, CoordiType& nnDis) const { - nnDis = std::numeric_limits::max(); - NearestNeighborSearch3D(qc, nnDis, nnId, @@ -207,13 +203,24 @@ public: const vtkm::cont::ArrayHandle, CoordStorageTag2>& qc_Handle, vtkm::cont::ArrayHandle& nnId_Handle, vtkm::cont::ArrayHandle& nnDis_Handle, - DeviceAdapter vtkmNotUsed(device)) + DeviceAdapter) { -#if VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_CUDA - //set up stack size for cuda envinroment - size_t stackSizeBackup; - cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize); - cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 16); + //fill the nnDis_Handle handle array with max values before running + auto intialValue = std::numeric_limits::max(); + vtkm::cont::DeviceAdapterAlgorithm::Copy( + vtkm::cont::make_ArrayHandleConstant(intialValue, qc_Handle.GetNumberOfValues()), + nnDis_Handle); + +//set up stack size for cuda environment +#ifdef VTKM_CUDA + using DeviceAdapterTraits = vtkm::cont::DeviceAdapterTraits; + std::size_t stackSizeBackup; + (void)stackSizeBackup; + if (DeviceAdapterTraits::GetId() == VTKM_DEVICE_ADAPTER_CUDA) + { + cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize); + cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 16); + } #endif NearestNeighborSearch3DWorklet nns3dWorklet; @@ -221,8 +228,12 @@ public: nns3DDispatcher(nns3dWorklet); nns3DDispatcher.Invoke( qc_Handle, pointId_Handle, splitId_Handle, coordi_Handle, nnId_Handle, nnDis_Handle); -#if VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_CUDA - cudaDeviceSetLimit(cudaLimitStackSize, stackSizeBackup); + +#ifdef VTKM_CUDA + if (DeviceAdapterTraits::GetId() == VTKM_DEVICE_ADAPTER_CUDA) + { + cudaDeviceSetLimit(cudaLimitStackSize, stackSizeBackup); + } #endif } }; diff --git a/vtkm/worklet/splatkernels/Gaussian.h b/vtkm/worklet/splatkernels/Gaussian.h index e5cdcfca5..e9639175c 100644 --- a/vtkm/worklet/splatkernels/Gaussian.h +++ b/vtkm/worklet/splatkernels/Gaussian.h @@ -58,6 +58,7 @@ struct Gaussian : public KernelBase> //--------------------------------------------------------------------- // return the multiplier between smoothing length and max cutoff distance + VTKM_EXEC_CONT VTKM_CONSTEXPR double getDilationFactor() const { return 5.0; } //--------------------------------------------------------------------- diff --git a/vtkm/worklet/splatkernels/Spline3rdOrder.h b/vtkm/worklet/splatkernels/Spline3rdOrder.h index e0990fd98..fdf5f9a6b 100644 --- a/vtkm/worklet/splatkernels/Spline3rdOrder.h +++ b/vtkm/worklet/splatkernels/Spline3rdOrder.h @@ -39,13 +39,13 @@ struct default_norm_value; template <> struct default_norm_value<2> { - double value() const { return 10.0 / (7.0 * M_PI); } + const double value = 10.0 / (7.0 * M_PI); }; template <> struct default_norm_value<3> { - double value() const { return 1.0 / M_PI; } + const double value = 1.0 / M_PI; }; @@ -65,7 +65,7 @@ struct Spline3rdOrder : public KernelBase> maxRadius_ = 2.0 * smoothingLength; maxRadius2_ = maxRadius_ * maxRadius_; // - norm_ = default_norm_value().value(); + norm_ = default_norm_value().value; scale_W_ = norm_ * PowerExpansion(Hinverse_); scale_GradW_ = norm_ * PowerExpansion(Hinverse_); diff --git a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx index 1fc86dce4..02457d4d7 100644 --- a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx +++ b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx @@ -411,6 +411,7 @@ void TestMarchingCubesExplicit() int UnitTestMarchingCubes(int, char* []) { - return vtkm::cont::testing::Testing::Run(TestMarchingCubesUniformGrid); - return vtkm::cont::testing::Testing::Run(TestMarchingCubesExplicit); + int result1 = vtkm::cont::testing::Testing::Run(TestMarchingCubesUniformGrid); + int result2 = vtkm::cont::testing::Testing::Run(TestMarchingCubesExplicit); + return result1 == 0 && result2 == 0; }