Suppress false positive warnings about calling host device functions.

This commit is contained in:
Robert Maynard 2017-12-28 16:41:13 -05:00
parent de7162ab8f
commit 93bc0198fe
20 changed files with 140 additions and 57 deletions

@ -35,6 +35,11 @@ target_link_libraries(CosmoHaloFinder_SERIAL PRIVATE ${VTKm_LIBRARIES})
target_compile_options(CosmoHaloFinder_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS}) target_compile_options(CosmoHaloFinder_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
if(VTKm_CUDA_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 compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS}) cuda_include_directories(${VTKm_INCLUDE_DIRS})
@ -47,6 +52,9 @@ if(VTKm_CUDA_FOUND)
target_include_directories(CosmoHaloFinder_CUDA PRIVATE ${VTKm_INCLUDE_DIRS}) target_include_directories(CosmoHaloFinder_CUDA PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(CosmoHaloFinder_CUDA PRIVATE ${VTKm_LIBRARIES}) target_link_libraries(CosmoHaloFinder_CUDA PRIVATE ${VTKm_LIBRARIES})
target_compile_options(CosmoHaloFinder_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS}) target_compile_options(CosmoHaloFinder_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
endif() endif()
if(VTKm_TBB_FOUND) if(VTKm_TBB_FOUND)

@ -28,6 +28,12 @@ find_package(VTKm QUIET REQUIRED
if(VTKm_OSMesa_FOUND AND VTKm_Rendering_FOUND) if(VTKm_OSMesa_FOUND AND VTKm_Rendering_FOUND)
if(VTKm_CUDA_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 compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS}) cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(Demo Demo.cu) cuda_add_executable(Demo Demo.cu)

@ -29,7 +29,16 @@ find_package(VTKm REQUIRED
) )
if(VTKm_CUDA_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_add_executable(GameOfLife GameOfLife.cu LoadShaders.h) cuda_add_executable(GameOfLife GameOfLife.cu LoadShaders.h)
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
else() else()
add_executable(GameOfLife GameOfLife.cxx LoadShaders.h) add_executable(GameOfLife GameOfLife.cxx LoadShaders.h)
endif() endif()

@ -2347,7 +2347,12 @@ static inline VTKM_EXEC_CONT vtkm::Float32 RemainderQuotient(vtkm::Float32 numer
QType& quotient) QType& quotient)
{ {
int iQuotient; 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; quotient = iQuotient;
return result; return result;
} }
@ -2357,7 +2362,12 @@ static inline VTKM_EXEC_CONT vtkm::Float64 RemainderQuotient(vtkm::Float64 numer
QType& quotient) QType& quotient)
{ {
int iQuotient; 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; quotient = iQuotient;
return result; return result;
} }

@ -80,8 +80,8 @@ struct MeasureCopySpeed
VTKM_CONT std::string Description() const VTKM_CONT std::string Description() const
{ {
vtkm::UInt64 actualSize = vtkm::UInt64 actualSize = sizeof(ValueType);
static_cast<vtkm::UInt64>(this->Source.GetNumberOfValues() * sizeof(ValueType)); actualSize *= static_cast<vtkm::UInt64>(this->Source.GetNumberOfValues());
std::ostringstream out; std::ostringstream out;
out << "Copying " << HumanSize(this->NumBytes) << " (actual=" << HumanSize(actualSize) out << "Copying " << HumanSize(this->NumBytes) << " (actual=" << HumanSize(actualSize)
<< ") of " << vtkm::testing::TypeName<ValueType>::Name() << "\n"; << ") of " << vtkm::testing::TypeName<ValueType>::Name() << "\n";

@ -108,7 +108,7 @@ struct BenchDevAlgoConfig
/// @note FixBytes and FixSizes are not mutually exclusive. If both are /// @note FixBytes and FixSizes are not mutually exclusive. If both are
/// specified, both will run. /// specified, both will run.
bool TestArraySizeValues{ false }; 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 /// 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% /// values (5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 75%, 100%
@ -126,7 +126,7 @@ struct BenchDevAlgoConfig
{ {
return this->DoByteSizes return this->DoByteSizes
? static_cast<vtkm::Id>(this->ArraySizeBytes / static_cast<vtkm::UInt64>(sizeof(T))) ? static_cast<vtkm::Id>(this->ArraySizeBytes / static_cast<vtkm::UInt64>(sizeof(T)))
: this->ArraySizeValues; : static_cast<vtkm::Id>(this->ArraySizeValues);
} }
}; };
@ -291,8 +291,8 @@ private:
{ {
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "Copy " << arraySize << " values (" << HumanSize(arraySize * sizeof(Value)) description << "Copy " << arraySize << " values ("
<< ")"; << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
return description.str(); return description.str();
} }
}; };
@ -337,8 +337,8 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "CopyIf on " << arraySize << " values (" description << "CopyIf on " << arraySize << " values ("
<< HumanSize(arraySize * sizeof(Value)) << ") with " << PERCENT_VALID << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
<< "% valid values"; << PERCENT_VALID << "% valid values";
return description.str(); return description.str();
} }
}; };
@ -393,8 +393,8 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "LowerBounds on " << arraySize << " input values (" description << "LowerBounds on " << arraySize << " input values ("
<< "(" << HumanSize(arraySize * sizeof(Value)) << ") (" << PERCENT_VALUES << "(" << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") ("
<< "% configuration)"; << PERCENT_VALUES << "% configuration)";
return description.str(); return description.str();
} }
}; };
@ -451,7 +451,7 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "Reduce on " << arraySize << " values (" description << "Reduce on " << arraySize << " values ("
<< HumanSize(arraySize * sizeof(Value)) << ")"; << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
return description.str(); return description.str();
} }
}; };
@ -496,8 +496,8 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "ReduceByKey on " << arraySize << " values (" description << "ReduceByKey on " << arraySize << " values ("
<< HumanSize(arraySize * sizeof(Value)) << ") with " << N_KEYS << " (" << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
<< PERCENT_KEYS << "%) distinct vtkm::Id keys"; << N_KEYS << " (" << PERCENT_KEYS << "%) distinct vtkm::Id keys";
return description.str(); return description.str();
} }
}; };
@ -543,7 +543,7 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "ScanInclusive on " << arraySize << " values (" description << "ScanInclusive on " << arraySize << " values ("
<< HumanSize(arraySize * sizeof(Value)) << ")"; << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
return description.str(); return description.str();
} }
}; };
@ -579,7 +579,7 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "ScanExclusive on " << arraySize << " values (" description << "ScanExclusive on " << arraySize << " values ("
<< HumanSize(arraySize * sizeof(Value)) << ")"; << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
return description.str(); return description.str();
} }
}; };
@ -621,7 +621,7 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "Sort on " << arraySize << " random values (" description << "Sort on " << arraySize << " random values ("
<< HumanSize(arraySize * sizeof(Value)) << ")"; << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
return description.str(); return description.str();
} }
}; };
@ -674,8 +674,8 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "SortByKey on " << arraySize << " random values (" description << "SortByKey on " << arraySize << " random values ("
<< HumanSize(arraySize * sizeof(Value)) << ") with " << N_KEYS << " (" << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
<< PERCENT_KEYS << "%) different vtkm::Id keys"; << N_KEYS << " (" << PERCENT_KEYS << "%) different vtkm::Id keys";
return description.str(); return description.str();
} }
}; };
@ -731,7 +731,7 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "StableSortIndices::Sort on " << arraySize << " random values (" description << "StableSortIndices::Sort on " << arraySize << " random values ("
<< HumanSize(arraySize * sizeof(Value)) << ")"; << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
return description.str(); return description.str();
} }
}; };
@ -775,8 +775,8 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "StableSortIndices::Unique on " << arraySize << " values (" description << "StableSortIndices::Unique on " << arraySize << " values ("
<< HumanSize(arraySize * sizeof(Value)) << ") with " << this->N_VALID << " (" << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
<< PERCENT_VALID << "%) valid values"; << this->N_VALID << " (" << PERCENT_VALID << "%) valid values";
return description.str(); return description.str();
} }
}; };
@ -831,8 +831,8 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "Unique on " << arraySize << " values (" description << "Unique on " << arraySize << " values ("
<< HumanSize(arraySize * sizeof(Value)) << ") with " << N_VALID << " (" << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
<< PERCENT_VALID << "%) valid values"; << N_VALID << " (" << PERCENT_VALID << "%) valid values";
return description.str(); return description.str();
} }
}; };
@ -887,8 +887,8 @@ private:
vtkm::Id arraySize = Config.ComputeSize<Value>(); vtkm::Id arraySize = Config.ComputeSize<Value>();
std::stringstream description; std::stringstream description;
description << "UpperBounds on " << arraySize << " input and " << N_VALS << " (" description << "UpperBounds on " << arraySize << " input and " << N_VALS << " ("
<< PERCENT_VALS << PERCENT_VALS << "%) values (input array size: "
<< "%) values (input array size: " << HumanSize(arraySize * sizeof(Value)) << ")"; << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
return description.str(); return description.str();
} }
}; };

@ -107,7 +107,6 @@ VTKM_MAKE_BENCHMARK(RayTracing, BenchRayTracing);
int main(int, char* []) int main(int, char* [])
{ {
using TestTypes = vtkm::ListTagBase<vtkm::Float32>;
VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase<vtkm::Float32>()); VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase<vtkm::Float32>());
return 0; return 0;
} }

@ -107,6 +107,7 @@ private:
DimVec3 Min; DimVec3 Min;
DimVec3 Max; DimVec3 Max;
VTKM_EXEC
bool Empty() const bool Empty() const
{ {
return (this->Max[0] < this->Min[0]) || (this->Max[1] < this->Min[1]) || return (this->Max[0] < this->Min[0]) || (this->Max[1] < this->Min[1]) ||

@ -68,6 +68,7 @@ private:
} }
} }
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename InIter, typename OutIter> template <typename InIter, typename OutIter>
VTKM_EXEC static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) VTKM_EXEC static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type)
{ {

@ -98,7 +98,6 @@ struct CopyBody
vtkm::Id InputOffset; vtkm::Id InputOffset;
vtkm::Id OutputOffset; vtkm::Id OutputOffset;
VTKM_EXEC_CONT
CopyBody(const InputPortalType& inPortal, CopyBody(const InputPortalType& inPortal,
const OutputPortalType& outPortal, const OutputPortalType& outPortal,
vtkm::Id inOffset, vtkm::Id inOffset,
@ -127,12 +126,14 @@ struct CopyBody
} }
} }
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename InIter, typename OutIter> template <typename InIter, typename OutIter>
VTKM_EXEC void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) const VTKM_EXEC void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) const
{ {
std::copy(src, srcEnd, dst); std::copy(src, srcEnd, dst);
} }
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC VTKM_EXEC
void operator()(const ::tbb::blocked_range<vtkm::Id>& range) const void operator()(const ::tbb::blocked_range<vtkm::Id>& range) const
{ {

@ -37,12 +37,6 @@ namespace
struct TestExecObject struct TestExecObject
{ {
VTKM_EXEC_CONT
TestExecObject()
: Portal()
{
}
VTKM_EXEC_CONT VTKM_EXEC_CONT
TestExecObject(vtkm::exec::cuda::internal::ArrayPortalFromThrust<vtkm::Id> portal) TestExecObject(vtkm::exec::cuda::internal::ArrayPortalFromThrust<vtkm::Id> portal)
: Portal(portal) : Portal(portal)
@ -62,6 +56,7 @@ struct MyOutputToInputMapPortal
struct MyVisitArrayPortal struct MyVisitArrayPortal
{ {
using ValueType = vtkm::IdComponent; using ValueType = vtkm::IdComponent;
VTKM_EXEC_CONT
vtkm::IdComponent Get(vtkm::Id) const { return 1; } vtkm::IdComponent Get(vtkm::Id) const { return 1; }
}; };

@ -76,12 +76,16 @@ struct ParameterContainer;
template <typename R> template <typename R>
struct ParameterContainer<R()> struct ParameterContainer<R()>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
}; };
template <typename R, template <typename R,
typename P1> typename P1>
struct ParameterContainer<R(P1)> struct ParameterContainer<R(P1)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
}; };
@ -90,6 +94,8 @@ template <typename R,
typename P2> typename P2>
struct ParameterContainer<R(P1, P2)> struct ParameterContainer<R(P1, P2)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
}; };
@ -100,6 +106,8 @@ template <typename R,
typename P3> typename P3>
struct ParameterContainer<R(P1, P2, P3)> struct ParameterContainer<R(P1, P2, P3)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;
@ -112,6 +120,8 @@ template <typename R,
typename P4> typename P4>
struct ParameterContainer<R(P1, P2, P3, P4)> struct ParameterContainer<R(P1, P2, P3, P4)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;
@ -126,6 +136,8 @@ template <typename R,
typename P5> typename P5>
struct ParameterContainer<R(P1, P2, P3, P4, P5)> struct ParameterContainer<R(P1, P2, P3, P4, P5)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;
@ -142,6 +154,8 @@ template <typename R,
typename P6> typename P6>
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6)> struct ParameterContainer<R(P1, P2, P3, P4, P5, P6)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;
@ -160,6 +174,8 @@ template <typename R,
typename P7> typename P7>
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7)> struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;
@ -180,6 +196,8 @@ template <typename R,
typename P8> typename P8>
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8)> struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;
@ -202,6 +220,8 @@ template <typename R,
typename P9> typename P9>
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)> struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;
@ -226,6 +246,8 @@ template <typename R,
typename P10> typename P10>
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)> struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
P1 Parameter1; P1 Parameter1;
P2 Parameter2; P2 Parameter2;
P3 Parameter3; P3 Parameter3;

@ -123,6 +123,8 @@ $for(num_params in range(0, max_parameters+1))\
template <$template_params(num_params)> template <$template_params(num_params)>
struct ParameterContainer<$signature(num_params)> struct ParameterContainer<$signature(num_params)>
{ {
VTKM_SUPPRESS_EXEC_WARNINGS
~ParameterContainer() = default;
$for(param_index in range(1, num_params+1))\ $for(param_index in range(1, num_params+1))\
$ptype(param_index) Parameter$(param_index); $ptype(param_index) Parameter$(param_index);
$endfor\ $endfor\

@ -74,6 +74,7 @@ vtkm::UInt32 ScaleColorComponent(vtkm::Float32 c)
return vtkm::UInt32(t < 0 ? 0 : (t > 255 ? 255 : t)); 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::UInt32 PackColor(vtkm::Float32 r, vtkm::Float32 g, vtkm::Float32 b, vtkm::Float32 a);
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -92,6 +93,7 @@ vtkm::UInt32 PackColor(vtkm::Float32 r, vtkm::Float32 g, vtkm::Float32 b, vtkm::
return packed; return packed;
} }
VTKM_EXEC_CONT
void UnpackColor(vtkm::UInt32 color, void UnpackColor(vtkm::UInt32 color,
vtkm::Float32& r, vtkm::Float32& r,
vtkm::Float32& g, vtkm::Float32& g,

@ -79,7 +79,7 @@ public:
}; };
VTKM_CONT VTKM_CONT
Keys() {} Keys() = default;
/// \b Construct a Keys class from an array of keys. /// \b Construct a Keys class from an array of keys.
/// ///

@ -401,8 +401,22 @@ private:
static_assert(isAllValid::value == expectedLen::value, static_assert(isAllValid::value == expectedLen::value,
"All arguments failed the TypeCheck pass"); "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 = auto fi =
vtkm::internal::make_FunctionInterface<void, typename std::decay<Args>::type...>(args...); vtkm::internal::make_FunctionInterface<void, typename std::decay<Args>::type...>(args...);
#if defined __NVCC__
#pragma pop
#endif
auto ivc = vtkm::internal::Invocation<ParameterInterface, auto ivc = vtkm::internal::Invocation<ParameterInterface,
ControlInterface, ControlInterface,
ExecutionInterface, ExecutionInterface,

@ -21,15 +21,13 @@
#ifndef vtk_m_worklet_KdTree3DNNSearch_h #ifndef vtk_m_worklet_KdTree3DNNSearch_h
#define vtk_m_worklet_KdTree3DNNSearch_h #define vtk_m_worklet_KdTree3DNNSearch_h
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/Math.h> #include <vtkm/Math.h>
#include <vtkm/cont/ArrayHandle.h> #include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleCounting.h> #include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/ArrayHandleReverse.h> #include <vtkm/cont/ArrayHandleReverse.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/arg/ControlSignatureTagBase.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/internal/DispatcherBase.h> #include <vtkm/worklet/internal/DispatcherBase.h>
@ -53,7 +51,7 @@ public:
WholeArrayIn<> treeSplitIdIn, WholeArrayIn<> treeSplitIdIn,
WholeArrayIn<> treeCoordiIn, WholeArrayIn<> treeCoordiIn,
FieldOut<> nnIdOut, FieldOut<> nnIdOut,
FieldOut<> nnDisOut); FieldInOut<> nnDisOut);
typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6); typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6);
VTKM_CONT VTKM_CONT
@ -175,8 +173,6 @@ public:
IdType& nnId, IdType& nnId,
CoordiType& nnDis) const CoordiType& nnDis) const
{ {
nnDis = std::numeric_limits<CoordiType>::max();
NearestNeighborSearch3D(qc, NearestNeighborSearch3D(qc,
nnDis, nnDis,
nnId, nnId,
@ -207,13 +203,24 @@ public:
const vtkm::cont::ArrayHandle<vtkm::Vec<CoordType, 3>, CoordStorageTag2>& qc_Handle, const vtkm::cont::ArrayHandle<vtkm::Vec<CoordType, 3>, CoordStorageTag2>& qc_Handle,
vtkm::cont::ArrayHandle<vtkm::Id>& nnId_Handle, vtkm::cont::ArrayHandle<vtkm::Id>& nnId_Handle,
vtkm::cont::ArrayHandle<CoordType>& nnDis_Handle, vtkm::cont::ArrayHandle<CoordType>& nnDis_Handle,
DeviceAdapter vtkmNotUsed(device)) DeviceAdapter)
{ {
#if VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_CUDA //fill the nnDis_Handle handle array with max values before running
//set up stack size for cuda envinroment auto intialValue = std::numeric_limits<CoordType>::max();
size_t stackSizeBackup; vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::Copy(
cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize); vtkm::cont::make_ArrayHandleConstant(intialValue, qc_Handle.GetNumberOfValues()),
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 16); nnDis_Handle);
//set up stack size for cuda environment
#ifdef VTKM_CUDA
using DeviceAdapterTraits = vtkm::cont::DeviceAdapterTraits<DeviceAdapter>;
std::size_t stackSizeBackup;
(void)stackSizeBackup;
if (DeviceAdapterTraits::GetId() == VTKM_DEVICE_ADAPTER_CUDA)
{
cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize);
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 16);
}
#endif #endif
NearestNeighborSearch3DWorklet nns3dWorklet; NearestNeighborSearch3DWorklet nns3dWorklet;
@ -221,8 +228,12 @@ public:
nns3DDispatcher(nns3dWorklet); nns3DDispatcher(nns3dWorklet);
nns3DDispatcher.Invoke( nns3DDispatcher.Invoke(
qc_Handle, pointId_Handle, splitId_Handle, coordi_Handle, nnId_Handle, nnDis_Handle); 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 #endif
} }
}; };

@ -58,6 +58,7 @@ struct Gaussian : public KernelBase<Gaussian<Dimensions>>
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// return the multiplier between smoothing length and max cutoff distance // return the multiplier between smoothing length and max cutoff distance
VTKM_EXEC_CONT
VTKM_CONSTEXPR double getDilationFactor() const { return 5.0; } VTKM_CONSTEXPR double getDilationFactor() const { return 5.0; }
//--------------------------------------------------------------------- //---------------------------------------------------------------------

@ -39,13 +39,13 @@ struct default_norm_value;
template <> template <>
struct default_norm_value<2> 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 <> template <>
struct default_norm_value<3> 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<Spline3rdOrder<Dimensions>>
maxRadius_ = 2.0 * smoothingLength; maxRadius_ = 2.0 * smoothingLength;
maxRadius2_ = maxRadius_ * maxRadius_; maxRadius2_ = maxRadius_ * maxRadius_;
// //
norm_ = default_norm_value<Dimensions>().value(); norm_ = default_norm_value<Dimensions>().value;
scale_W_ = norm_ * PowerExpansion<Dimensions>(Hinverse_); scale_W_ = norm_ * PowerExpansion<Dimensions>(Hinverse_);
scale_GradW_ = norm_ * PowerExpansion<Dimensions + 1>(Hinverse_); scale_GradW_ = norm_ * PowerExpansion<Dimensions + 1>(Hinverse_);

@ -411,6 +411,7 @@ void TestMarchingCubesExplicit()
int UnitTestMarchingCubes(int, char* []) int UnitTestMarchingCubes(int, char* [])
{ {
return vtkm::cont::testing::Testing::Run(TestMarchingCubesUniformGrid); int result1 = vtkm::cont::testing::Testing::Run(TestMarchingCubesUniformGrid);
return vtkm::cont::testing::Testing::Run(TestMarchingCubesExplicit); int result2 = vtkm::cont::testing::Testing::Run(TestMarchingCubesExplicit);
return result1 == 0 && result2 == 0;
} }