mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Suppress false positive warnings about calling host device functions.
This commit is contained in:
parent
de7162ab8f
commit
93bc0198fe
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
14
vtkm/Math.h
14
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;
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ struct MeasureCopySpeed
|
||||
|
||||
VTKM_CONT std::string Description() const
|
||||
{
|
||||
vtkm::UInt64 actualSize =
|
||||
static_cast<vtkm::UInt64>(this->Source.GetNumberOfValues() * sizeof(ValueType));
|
||||
vtkm::UInt64 actualSize = sizeof(ValueType);
|
||||
actualSize *= static_cast<vtkm::UInt64>(this->Source.GetNumberOfValues());
|
||||
std::ostringstream out;
|
||||
out << "Copying " << HumanSize(this->NumBytes) << " (actual=" << HumanSize(actualSize)
|
||||
<< ") of " << vtkm::testing::TypeName<ValueType>::Name() << "\n";
|
||||
|
@ -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<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>();
|
||||
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();
|
||||
}
|
||||
};
|
||||
@ -337,8 +337,8 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "CopyIf on " << arraySize << " values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ") with " << PERCENT_VALID
|
||||
<< "% valid values";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
|
||||
<< PERCENT_VALID << "% valid values";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -393,8 +393,8 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "LowerBounds on " << arraySize << " input values ("
|
||||
<< "(" << HumanSize(arraySize * sizeof(Value)) << ") (" << PERCENT_VALUES
|
||||
<< "% configuration)";
|
||||
<< "(" << HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") ("
|
||||
<< PERCENT_VALUES << "% configuration)";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -451,7 +451,7 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "Reduce on " << arraySize << " values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ")";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -496,8 +496,8 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "ReduceByKey on " << arraySize << " values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ") with " << N_KEYS << " ("
|
||||
<< PERCENT_KEYS << "%) distinct vtkm::Id keys";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(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<Value>();
|
||||
std::stringstream description;
|
||||
description << "ScanInclusive on " << arraySize << " values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ")";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -579,7 +579,7 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "ScanExclusive on " << arraySize << " values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ")";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -621,7 +621,7 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "Sort on " << arraySize << " random values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ")";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -674,8 +674,8 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
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<vtkm::UInt64>(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<Value>();
|
||||
std::stringstream description;
|
||||
description << "StableSortIndices::Sort on " << arraySize << " random values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ")";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -775,8 +775,8 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "StableSortIndices::Unique on " << arraySize << " values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ") with " << this->N_VALID << " ("
|
||||
<< PERCENT_VALID << "%) valid values";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
|
||||
<< this->N_VALID << " (" << PERCENT_VALID << "%) valid values";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -831,8 +831,8 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
std::stringstream description;
|
||||
description << "Unique on " << arraySize << " values ("
|
||||
<< HumanSize(arraySize * sizeof(Value)) << ") with " << N_VALID << " ("
|
||||
<< PERCENT_VALID << "%) valid values";
|
||||
<< HumanSize(static_cast<vtkm::UInt64>(arraySize) * sizeof(Value)) << ") with "
|
||||
<< N_VALID << " (" << PERCENT_VALID << "%) valid values";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
@ -887,8 +887,8 @@ private:
|
||||
vtkm::Id arraySize = Config.ComputeSize<Value>();
|
||||
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<vtkm::UInt64>(arraySize) * sizeof(Value)) << ")";
|
||||
return description.str();
|
||||
}
|
||||
};
|
||||
|
@ -107,7 +107,6 @@ VTKM_MAKE_BENCHMARK(RayTracing, BenchRayTracing);
|
||||
|
||||
int main(int, char* [])
|
||||
{
|
||||
using TestTypes = vtkm::ListTagBase<vtkm::Float32>;
|
||||
VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase<vtkm::Float32>());
|
||||
return 0;
|
||||
}
|
||||
|
@ -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]) ||
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template <typename InIter, typename OutIter>
|
||||
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 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 <typename InIter, typename OutIter>
|
||||
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<vtkm::Id>& range) const
|
||||
{
|
||||
|
@ -37,12 +37,6 @@ namespace
|
||||
|
||||
struct TestExecObject
|
||||
{
|
||||
VTKM_EXEC_CONT
|
||||
TestExecObject()
|
||||
: Portal()
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
TestExecObject(vtkm::exec::cuda::internal::ArrayPortalFromThrust<vtkm::Id> 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; }
|
||||
};
|
||||
|
||||
|
@ -76,12 +76,16 @@ struct ParameterContainer;
|
||||
template <typename R>
|
||||
struct ParameterContainer<R()>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
};
|
||||
|
||||
template <typename R,
|
||||
typename P1>
|
||||
struct ParameterContainer<R(P1)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
};
|
||||
|
||||
@ -90,6 +94,8 @@ template <typename R,
|
||||
typename P2>
|
||||
struct ParameterContainer<R(P1, P2)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
};
|
||||
@ -100,6 +106,8 @@ template <typename R,
|
||||
typename P3>
|
||||
struct ParameterContainer<R(P1, P2, P3)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
@ -112,6 +120,8 @@ template <typename R,
|
||||
typename P4>
|
||||
struct ParameterContainer<R(P1, P2, P3, P4)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
@ -126,6 +136,8 @@ template <typename R,
|
||||
typename P5>
|
||||
struct ParameterContainer<R(P1, P2, P3, P4, P5)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
@ -142,6 +154,8 @@ template <typename R,
|
||||
typename P6>
|
||||
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
@ -160,6 +174,8 @@ template <typename R,
|
||||
typename P7>
|
||||
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
@ -180,6 +196,8 @@ template <typename R,
|
||||
typename P8>
|
||||
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
@ -202,6 +220,8 @@ template <typename R,
|
||||
typename P9>
|
||||
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
@ -226,6 +246,8 @@ template <typename R,
|
||||
typename P10>
|
||||
struct ParameterContainer<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
~ParameterContainer() = default;
|
||||
P1 Parameter1;
|
||||
P2 Parameter2;
|
||||
P3 Parameter3;
|
||||
|
@ -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\
|
||||
|
@ -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,
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
};
|
||||
|
||||
VTKM_CONT
|
||||
Keys() {}
|
||||
Keys() = default;
|
||||
|
||||
/// \b Construct a Keys class from an array of keys.
|
||||
///
|
||||
|
@ -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<void, typename std::decay<Args>::type...>(args...);
|
||||
#if defined __NVCC__
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
auto ivc = vtkm::internal::Invocation<ParameterInterface,
|
||||
ControlInterface,
|
||||
ExecutionInterface,
|
||||
|
@ -21,15 +21,13 @@
|
||||
#ifndef vtk_m_worklet_KdTree3DNNSearch_h
|
||||
#define vtk_m_worklet_KdTree3DNNSearch_h
|
||||
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.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/WorkletMapField.h>
|
||||
#include <vtkm/worklet/internal/DispatcherBase.h>
|
||||
@ -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<CoordiType>::max();
|
||||
|
||||
NearestNeighborSearch3D(qc,
|
||||
nnDis,
|
||||
nnId,
|
||||
@ -207,13 +203,24 @@ public:
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<CoordType, 3>, CoordStorageTag2>& qc_Handle,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& nnId_Handle,
|
||||
vtkm::cont::ArrayHandle<CoordType>& nnDis_Handle,
|
||||
DeviceAdapter vtkmNotUsed(device))
|
||||
DeviceAdapter)
|
||||
{
|
||||
//fill the nnDis_Handle handle array with max values before running
|
||||
auto intialValue = std::numeric_limits<CoordType>::max();
|
||||
vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::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<DeviceAdapter>;
|
||||
std::size_t stackSizeBackup;
|
||||
(void)stackSizeBackup;
|
||||
if (DeviceAdapterTraits::GetId() == VTKM_DEVICE_ADAPTER_CUDA)
|
||||
{
|
||||
#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);
|
||||
}
|
||||
#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
|
||||
|
||||
#ifdef VTKM_CUDA
|
||||
if (DeviceAdapterTraits::GetId() == VTKM_DEVICE_ADAPTER_CUDA)
|
||||
{
|
||||
cudaDeviceSetLimit(cudaLimitStackSize, stackSizeBackup);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
@ -58,6 +58,7 @@ struct Gaussian : public KernelBase<Gaussian<Dimensions>>
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// return the multiplier between smoothing length and max cutoff distance
|
||||
VTKM_EXEC_CONT
|
||||
VTKM_CONSTEXPR double getDilationFactor() const { return 5.0; }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
@ -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<Spline3rdOrder<Dimensions>>
|
||||
maxRadius_ = 2.0 * smoothingLength;
|
||||
maxRadius2_ = maxRadius_ * maxRadius_;
|
||||
//
|
||||
norm_ = default_norm_value<Dimensions>().value();
|
||||
norm_ = default_norm_value<Dimensions>().value;
|
||||
|
||||
scale_W_ = norm_ * PowerExpansion<Dimensions>(Hinverse_);
|
||||
scale_GradW_ = norm_ * PowerExpansion<Dimensions + 1>(Hinverse_);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user