Commit ff687016 authored by Robert Maynard's avatar Robert Maynard
Browse files

For VTK-m libs all includes of DeviceAdapterTagCuda happen from cuda files

It is very easy to cause ODR violations with DeviceAdapterTagCuda.
If you include that header from a C++ file and a CUDA file inside
the same program we an ODR violation. The reasons is that the C++
versions will say the tag is invalid, and the CUDA will say the
tag is valid.

The solution to this is that any compilation unit that includes
DeviceAdapterTagCuda from a version of VTK-m that has CUDA enabled
must be invoked by the cuda compiler.
parent 2c026508
......@@ -7,12 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/internal/FunctionInterface.h>
#include <vtkm/cont/Timer.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/testing/Testing.h>
#include <sstream>
#include <string>
......@@ -21,6 +17,9 @@
// the most critical invoke (for the instance of a worklet) does not directly
// use the Invoke method.
//#define TEST_INVOKE_TIME
#ifdef TEST_INVOKE_TIME
#include <vtkm/cont/Timer.h>
#endif
namespace
{
......@@ -532,5 +531,5 @@ void TestFunctionInterface()
int UnitTestFunctionInterface(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(TestFunctionInterface, argc, argv);
return vtkm::testing::Testing::Run(TestFunctionInterface, argc, argv);
}
......@@ -42,5 +42,8 @@ elseif(VTKm_ENABLE_GL_CONTEXT AND TARGET vtkm_rendering)
endif()
if(unit_tests)
vtkm_unit_tests(SOURCES ${unit_tests} LIBRARIES vtkm_rendering GLUT::GLUT)
vtkm_unit_tests(SOURCES ${unit_tests}
LIBRARIES vtkm_rendering GLUT::GLUT
DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
endif()
......@@ -12,4 +12,4 @@ set(unit_tests
UnitTestVTKDataSetReader.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests})
vtkm_unit_tests(SOURCES ${unit_tests} ALL_BACKENDS)
......@@ -12,4 +12,4 @@ set(unit_tests
UnitTestVTKDataSetWriter.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests})
vtkm_unit_tests(SOURCES ${unit_tests} ALL_BACKENDS)
......@@ -12,7 +12,6 @@
#include <vtkm/rendering/vtkm_rendering_export.h>
#include <vtkm/cont/DataSet.h>
#include <vtkm/rendering/Color.h>
#include <vtkm/rendering/Scene.h>
#include <vtkm/rendering/WorldAnnotator.h>
......
......@@ -78,34 +78,67 @@ set(headers
)
set(sources
AxisAnnotation.cxx
AxisAnnotation2D.cxx
AxisAnnotation3D.cxx
BitmapFont.cxx
BitmapFontFactory.cxx
BoundingBoxAnnotation.cxx
Camera.cxx
Color.cxx
DecodePNG.cxx
raytracing/Logger.cxx
)
# This list of sources has code that uses devices and so might need to be
# compiled with a device-specific compiler (like CUDA).
set(device_sources
Actor.cxx
AxisAnnotation.cxx
AxisAnnotation2D.cxx
AxisAnnotation3D.cxx
BoundingBoxAnnotation.cxx
Canvas.cxx
CanvasRayTracer.cxx
ColorBarAnnotation.cxx
ColorLegendAnnotation.cxx
DecodePNG.cxx
ConnectivityProxy.cxx
LineRenderer.cxx
Mapper.cxx
MapperConnectivity.cxx
MapperCylinder.cxx
MapperPoint.cxx
MapperQuad.cxx
MapperRayTracer.cxx
MapperVolume.cxx
MapperWireframer.cxx
Scene.cxx
TextAnnotation.cxx
TextAnnotationBillboard.cxx
TextAnnotationScreen.cxx
TextRenderer.cxx
View.cxx
View1D.cxx
View2D.cxx
View3D.cxx
WorldAnnotator.cxx
raytracing/Logger.cxx
internal/RunTriangulator.cxx
raytracing/BoundingVolumeHierarchy.cxx
raytracing/Camera.cxx
raytracing/ChannelBuffer.cxx
raytracing/ConnectivityTracer.cxx
raytracing/CylinderExtractor.cxx
raytracing/CylinderIntersector.cxx
raytracing/MeshConnectivityBuilder.cxx
raytracing/MeshConnectivityContainers.cxx
raytracing/QuadExtractor.cxx
raytracing/QuadIntersector.cxx
raytracing/RayTracer.cxx
raytracing/RayOperations.cxx
raytracing/ShapeIntersector.cxx
raytracing/SphereExtractor.cxx
raytracing/SphereIntersector.cxx
raytracing/TriangleExtractor.cxx
raytracing/TriangleIntersector.cxx
raytracing/VolumeRendererStructured.cxx
)
# Note that EGL and OSMesa Canvas depend on the GL version being built. Only
......@@ -140,38 +173,6 @@ set(osmesa_sources
CanvasOSMesa.cxx
)
# This list of sources has code that uses devices and so might need to be
# compiled with a device-specific compiler (like CUDA).
set(device_sources
Actor.cxx
Canvas.cxx
CanvasRayTracer.cxx
ConnectivityProxy.cxx
Mapper.cxx
MapperWireframer.cxx
TextRenderer.cxx
internal/RunTriangulator.cxx
raytracing/BoundingVolumeHierarchy.cxx
raytracing/Camera.cxx
raytracing/ChannelBuffer.cxx
raytracing/ConnectivityTracer.cxx
raytracing/CylinderExtractor.cxx
raytracing/CylinderIntersector.cxx
raytracing/MeshConnectivityBuilder.cxx
raytracing/MeshConnectivityContainers.cxx
raytracing/QuadExtractor.cxx
raytracing/QuadIntersector.cxx
raytracing/RayTracer.cxx
raytracing/RayOperations.cxx
raytracing/ShapeIntersector.cxx
raytracing/SphereExtractor.cxx
raytracing/SphereIntersector.cxx
raytracing/TriangleExtractor.cxx
raytracing/TriangleIntersector.cxx
raytracing/VolumeRendererStructured.cxx
)
#-----------------------------------------------------------------------------
vtkm_library(
NAME vtkm_rendering
......@@ -196,9 +197,8 @@ endif()
#-----------------------------------------------------------------------------
target_link_libraries(vtkm_rendering PUBLIC vtkm_filter)
if(UNIX AND NOT APPLE)
target_link_libraries(vtkm_rendering PRIVATE rt )
target_link_libraries(vtkm_rendering PRIVATE rt)
endif()
#-----------------------------------------------------------------------------
......
......@@ -13,8 +13,6 @@
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/ExecutionObjectBase.h>
namespace vtkm
......
......@@ -19,8 +19,6 @@
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/testing/Testing.h>
#include <limits>
#define VTKM_MATH_ASSERT(condition, message) \
......
......@@ -8,13 +8,13 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/testing/Testing.h>
#include <vtkm/testing/TestingMath.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/testing/Testing.h>
int UnitTestMath(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(
return vtkm::testing::Testing::Run(
UnitTestMathNamespace::RunMathTests<vtkm::cont::DeviceAdapterTagSerial>, argc, argv);
}
......@@ -12,4 +12,4 @@ set(unit_tests
UnitTestDispatcherBase.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests})
vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment