mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Less vtkm_cont cxx files bring in the cuda device
When you have CUDA enabled we need to make sure that all worklet launches come from a cuda file otherwise we will generate ODR violations.
This commit is contained in:
parent
9f55c5efcc
commit
18ff6681fb
@ -28,7 +28,6 @@
|
||||
|
||||
#include <vtkm/cont/ErrorBadType.h>
|
||||
#include <vtkm/cont/Logging.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
@ -141,7 +141,6 @@ set(sources
|
||||
internal/VirtualObjectTransfer.cxx
|
||||
Initialize.cxx
|
||||
Logging.cxx
|
||||
RuntimeDeviceInformation.cxx
|
||||
RuntimeDeviceTracker.cxx
|
||||
StorageBasic.cxx
|
||||
TryExecute.cxx
|
||||
@ -171,6 +170,7 @@ set(device_sources
|
||||
FieldRangeCompute.cxx
|
||||
FieldRangeGlobalCompute.cxx
|
||||
MultiBlock.cxx
|
||||
RuntimeDeviceInformation.cxx
|
||||
StorageVirtual.cxx
|
||||
Timer.cxx
|
||||
)
|
||||
|
@ -20,4 +20,11 @@
|
||||
|
||||
#include <vtkm/cont/CellLocator.h>
|
||||
|
||||
vtkm::cont::CellLocator::~CellLocator() = default;
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
CellLocator::~CellLocator() = default;
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
|
||||
#include <vtkm/exec/CellLocator.h>
|
||||
#include <vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h>
|
||||
|
||||
@ -40,46 +40,41 @@ class VTKM_CONT_EXPORT CellLocator : public vtkm::cont::ExecutionObjectBase
|
||||
{
|
||||
|
||||
public:
|
||||
CellLocator()
|
||||
: Dirty(true)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CellLocator();
|
||||
|
||||
vtkm::cont::DynamicCellSet GetCellSet() const { return CellSet; }
|
||||
vtkm::cont::DynamicCellSet GetCellSet() const { return this->CellSet; }
|
||||
|
||||
void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet)
|
||||
{
|
||||
CellSet = cellSet;
|
||||
SetDirty();
|
||||
this->CellSet = cellSet;
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
vtkm::cont::CoordinateSystem GetCoordinates() const { return Coords; }
|
||||
vtkm::cont::CoordinateSystem GetCoordinates() const { return this->Coords; }
|
||||
|
||||
void SetCoordinates(const vtkm::cont::CoordinateSystem& coords)
|
||||
{
|
||||
Coords = coords;
|
||||
SetDirty();
|
||||
this->Coords = coords;
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Dirty)
|
||||
Build();
|
||||
Dirty = false;
|
||||
if (this->Dirty)
|
||||
this->Build();
|
||||
this->Dirty = false;
|
||||
}
|
||||
|
||||
template <typename DeviceAdapter>
|
||||
VTKM_CONT const vtkm::exec::CellLocator* PrepareForExecution(DeviceAdapter device) const
|
||||
VTKM_CONT const vtkm::exec::CellLocator* PrepareForExecution(
|
||||
const vtkm::cont::DeviceAdapterId device) const
|
||||
{
|
||||
return PrepareForExecutionImpl(device).PrepareForExecution(device);
|
||||
return this->PrepareForExecutionImpl(device).PrepareForExecution(device);
|
||||
}
|
||||
|
||||
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>;
|
||||
|
||||
protected:
|
||||
void SetDirty() { Dirty = true; }
|
||||
void SetDirty() { this->Dirty = true; }
|
||||
|
||||
//This is going to need a TryExecute
|
||||
VTKM_CONT virtual void Build() = 0;
|
||||
@ -90,7 +85,7 @@ protected:
|
||||
private:
|
||||
vtkm::cont::DynamicCellSet CellSet;
|
||||
vtkm::cont::CoordinateSystem Coords;
|
||||
bool Dirty;
|
||||
bool Dirty = true;
|
||||
};
|
||||
|
||||
} // namespace cont
|
||||
|
@ -19,6 +19,7 @@
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/CellLocatorRectilinearGrid.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
|
||||
#include <vtkm/exec/CellLocatorRectilinearGrid.h>
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ColorTableSamples.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
|
||||
#include <set>
|
||||
|
||||
@ -43,6 +42,10 @@ class ColorTableBase;
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
class VirtualObjectHandle;
|
||||
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct ColorTableInternals;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/ArrayHandleTransform.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
|
||||
#include <vtkm/worklet/Invoker.h>
|
||||
#include <vtkm/worklet/colorconversion/LookupTable.h>
|
||||
|
@ -20,23 +20,9 @@
|
||||
|
||||
#include <vtkm/cont/RuntimeDeviceTracker.h>
|
||||
|
||||
#include <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/cont/DeviceAdapterListTag.h>
|
||||
#include <vtkm/cont/ErrorBadValue.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterError.h>
|
||||
|
||||
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
|
||||
|
||||
//Bring in each device adapters runtime class
|
||||
#include <vtkm/cont/cuda/internal/DeviceAdapterRuntimeDetectorCuda.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterError.h>
|
||||
#include <vtkm/cont/openmp/internal/DeviceAdapterRuntimeDetectorOpenMP.h>
|
||||
#include <vtkm/cont/serial/internal/DeviceAdapterRuntimeDetectorSerial.h>
|
||||
#include <vtkm/cont/tbb/internal/DeviceAdapterRuntimeDetectorTBB.h>
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
@ -55,19 +41,6 @@ struct RuntimeDeviceTrackerInternals
|
||||
{
|
||||
bool RuntimeAllowed[VTKM_MAX_DEVICE_ADAPTER_ID];
|
||||
};
|
||||
|
||||
struct RuntimeDeviceTrackerFunctor
|
||||
{
|
||||
template <typename DeviceAdapter>
|
||||
VTKM_CONT void operator()(DeviceAdapter, DeviceAdapterId id, RuntimeDeviceTracker* rdt) const
|
||||
{
|
||||
vtkm::cont::RuntimeDeviceInformation runtimeDevice;
|
||||
if (DeviceAdapter() == id)
|
||||
{
|
||||
rdt->ForceDeviceImpl(DeviceAdapter(), runtimeDevice.Exists(DeviceAdapter()));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
@ -111,25 +84,6 @@ void RuntimeDeviceTracker::SetDeviceState(vtkm::cont::DeviceAdapterId deviceId,
|
||||
this->Internals->RuntimeAllowed[deviceId.GetValue()] = state;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct VTKM_NEVER_EXPORT RuntimeDeviceTrackerResetFunctor
|
||||
{
|
||||
template <typename Device>
|
||||
VTKM_CONT void operator()(Device device, bool runtimeAllowed[VTKM_MAX_DEVICE_ADAPTER_ID]) const
|
||||
{
|
||||
if (device.IsValueValid())
|
||||
{
|
||||
const bool state = vtkm::cont::DeviceAdapterRuntimeDetector<Device>().Exists();
|
||||
runtimeAllowed[device.GetValue()] = state;
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
|
||||
"Reset device '" << device.GetName() << "' to " << state);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void RuntimeDeviceTracker::Reset()
|
||||
{
|
||||
@ -138,12 +92,18 @@ void RuntimeDeviceTracker::Reset()
|
||||
// We use this instead of calling CheckDevice/SetDeviceState so that
|
||||
// when we use logging we get better messages stating we are reseting
|
||||
// the devices.
|
||||
//
|
||||
// 1. We can't log anything as this can be called during startup
|
||||
// and
|
||||
RuntimeDeviceTrackerResetFunctor functor;
|
||||
vtkm::ListForEach(
|
||||
functor, VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG(), std::ref(this->Internals->RuntimeAllowed));
|
||||
vtkm::cont::RuntimeDeviceInformation runtimeDevice;
|
||||
for (vtkm::Int8 i = 0; i < VTKM_MAX_DEVICE_ADAPTER_ID; ++i)
|
||||
{
|
||||
vtkm::cont::DeviceAdapterId device = vtkm::cont::make_DeviceAdapterId(i);
|
||||
if (device.IsValueValid())
|
||||
{
|
||||
const bool state = runtimeDevice.Exists(device);
|
||||
this->Internals->RuntimeAllowed[device.GetValue()] = state;
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
|
||||
"Reset device '" << device.GetName() << "' to " << state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
|
@ -22,11 +22,10 @@
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/DeviceAdapterListTag.h>
|
||||
#include <vtkm/cont/ErrorBadAllocation.h>
|
||||
#include <vtkm/cont/ErrorBadDevice.h>
|
||||
#include <vtkm/cont/RuntimeDeviceInformation.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterTag.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -38,7 +37,6 @@ namespace detail
|
||||
{
|
||||
|
||||
struct RuntimeDeviceTrackerInternals;
|
||||
struct RuntimeDeviceTrackerFunctor;
|
||||
}
|
||||
|
||||
/// A class that can be used to determine if a given device adapter
|
||||
@ -50,7 +48,6 @@ struct RuntimeDeviceTrackerFunctor;
|
||||
///
|
||||
class VTKM_CONT_EXPORT RuntimeDeviceTracker
|
||||
{
|
||||
friend struct detail::RuntimeDeviceTrackerFunctor;
|
||||
friend VTKM_CONT_EXPORT vtkm::cont::RuntimeDeviceTracker& GetRuntimeDeviceTracker();
|
||||
|
||||
public:
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <vtkm/cont/ErrorBadType.h>
|
||||
#include <vtkm/cont/ErrorBadValue.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
#include <vtkm/cont/RuntimeDeviceTracker.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace cont
|
||||
namespace detail
|
||||
{
|
||||
|
||||
void HandleTryExecuteException(vtkm::cont::DeviceAdapterId deviceId,
|
||||
VTKM_CONT_EXPORT void HandleTryExecuteException(vtkm::cont::DeviceAdapterId deviceId,
|
||||
vtkm::cont::RuntimeDeviceTracker tracker,
|
||||
const std::string& functorName)
|
||||
{
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <vtkm/cont/internal/DeviceAdapterError.h>
|
||||
#include <vtkm/cont/internal/ReverseConnectivityBuilder.h>
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
@ -26,10 +26,13 @@
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
|
||||
#include <vtkm/filter/internal/CreateResult.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
struct TypeUInt8 : vtkm::ListTagBase<vtkm::UInt8>
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <vtkm/cont/CellSetPermutation.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/rendering/raytracing/MeshConnectivityBuilder.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include <vtkm/rendering/raytracing/Ray.h>
|
||||
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace rendering
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <vtkm/rendering/raytracing/Camera.h>
|
||||
#include <vtkm/rendering/raytracing/Logger.h>
|
||||
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
namespace vtkm
|
||||
|
@ -39,12 +39,14 @@
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/DispatcherPointNeighborhood.h>
|
||||
#include <vtkm/worklet/DispatcherReduceByKey.h>
|
||||
#include <vtkm/worklet/Keys.h>
|
||||
#include <vtkm/worklet/ScatterCounting.h>
|
||||
#include <vtkm/worklet/ScatterPermutation.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletPointNeighborhood.h>
|
||||
#include <vtkm/worklet/WorkletReduceByKey.h>
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
OutputHandleType Output;
|
||||
OutputPortalType Portal;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
VTKM_CONT
|
||||
Worker(const Vec3F& center,
|
||||
const Vec3F& spacing,
|
||||
const Vec3F& frequency,
|
||||
|
@ -24,8 +24,10 @@
|
||||
|
||||
#include <vtkm/cont/CellSetSingleType.h>
|
||||
#include <vtkm/exec/CellEdge.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/ScatterCounting.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
namespace vtkm
|
||||
|
@ -329,18 +329,6 @@ struct DispatcherBaseTransportFunctor
|
||||
using type = typename TransportType::ExecObjectType;
|
||||
};
|
||||
|
||||
// template<typename ControlParameter, vtkm::IdComponent Index>
|
||||
// VTKM_CONT typename ReturnType<ControlParameter, Index>::type operator()(
|
||||
// ControlParameter const& invokeData,
|
||||
// vtkm::internal::IndexTag<Index>) const
|
||||
// {
|
||||
// using TransportTag =
|
||||
// typename DispatcherBaseTransportInvokeTypes<ControlInterface, Index>::TransportTag;
|
||||
// using T = typename remove_pointer_and_decay<ControlParameter>::type;
|
||||
// vtkm::cont::arg::Transport<TransportTag, T, Device> transport;
|
||||
// return transport(invokeData, as_ref(this->InputDomain), this->InputRange, this->OutputRange);
|
||||
// }
|
||||
|
||||
template <typename ControlParameter, vtkm::IdComponent Index>
|
||||
VTKM_CONT typename ReturnType<ControlParameter, Index>::type operator()(
|
||||
ControlParameter&& invokeData,
|
||||
|
Loading…
Reference in New Issue
Block a user