Commit bd544754 authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot
Browse files

Merge topic 'no_odr_violation_on_cuda_tag'

ff687016

 For VTK-m libs all includes of DeviceAdapterTagCuda happen from cuda files
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland's avatarKenneth Moreland <kmorel@sandia.gov>
Merge-request: !1648
parents e7924e76 ff687016
...@@ -270,6 +270,7 @@ endfunction(vtkm_library) ...@@ -270,6 +270,7 @@ endfunction(vtkm_library)
# SOURCES <source_list> # SOURCES <source_list>
# BACKEND <type> # BACKEND <type>
# LIBRARIES <dependent_library_list> # LIBRARIES <dependent_library_list>
# DEFINES <target_compile_definitions>
# TEST_ARGS <argument_list> # TEST_ARGS <argument_list>
# MPI # MPI
# ALL_BACKENDS # ALL_BACKENDS
...@@ -285,6 +286,8 @@ endfunction(vtkm_library) ...@@ -285,6 +286,8 @@ endfunction(vtkm_library)
# #
# [LIBRARIES] : extra libraries that this set of tests need to link too # [LIBRARIES] : extra libraries that this set of tests need to link too
# #
# [DEFINES] : extra defines that need to be set for all unit test sources
#
# [TEST_ARGS] : arguments that should be passed on the command line to the # [TEST_ARGS] : arguments that should be passed on the command line to the
# test executable # test executable
# #
...@@ -301,7 +304,7 @@ function(vtkm_unit_tests) ...@@ -301,7 +304,7 @@ function(vtkm_unit_tests)
set(options) set(options)
set(global_options ${options} MPI ALL_BACKENDS) set(global_options ${options} MPI ALL_BACKENDS)
set(oneValueArgs BACKEND NAME) set(oneValueArgs BACKEND NAME)
set(multiValueArgs SOURCES LIBRARIES TEST_ARGS) set(multiValueArgs SOURCES LIBRARIES DEFINES TEST_ARGS)
cmake_parse_arguments(VTKm_UT cmake_parse_arguments(VTKm_UT
"${global_options}" "${oneValueArgs}" "${multiValueArgs}" "${global_options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN} ${ARGN}
...@@ -370,6 +373,8 @@ function(vtkm_unit_tests) ...@@ -370,6 +373,8 @@ function(vtkm_unit_tests)
target_link_libraries(${test_prog} PRIVATE vtkm_cont ${VTKm_UT_LIBRARIES}) target_link_libraries(${test_prog} PRIVATE vtkm_cont ${VTKm_UT_LIBRARIES})
endif() endif()
target_compile_definitions(${test_prog} PRIVATE ${VTKm_UT_DEFINES})
foreach(current_backend ${all_backends}) foreach(current_backend ${all_backends})
set (device_command_line_argument --device=${current_backend}) set (device_command_line_argument --device=${current_backend})
if (current_backend STREQUAL "NO_BACKEND") if (current_backend STREQUAL "NO_BACKEND")
......
...@@ -121,15 +121,13 @@ set(template_sources ...@@ -121,15 +121,13 @@ set(template_sources
set(sources set(sources
ArrayHandle.cxx ArrayHandle.cxx
ArrayHandleVirtual.cxx
CellLocator.cxx
ColorTablePresets.cxx ColorTablePresets.cxx
DeviceAdapterTag.cxx
EnvironmentTracker.cxx EnvironmentTracker.cxx
ErrorBadDevice.cxx ErrorBadDevice.cxx
ErrorBadType.cxx ErrorBadType.cxx
internal/ArrayHandleBasicImpl.cxx internal/ArrayHandleBasicImpl.cxx
internal/ArrayManagerExecutionShareWithControl.cxx internal/ArrayManagerExecutionShareWithControl.cxx
internal/DeviceAdapterTag.cxx
internal/TransferInfo.cxx internal/TransferInfo.cxx
internal/VirtualObjectTransfer.cxx internal/VirtualObjectTransfer.cxx
Initialize.cxx Initialize.cxx
...@@ -137,16 +135,17 @@ set(sources ...@@ -137,16 +135,17 @@ set(sources
RuntimeDeviceTracker.cxx RuntimeDeviceTracker.cxx
StorageBasic.cxx StorageBasic.cxx
TryExecute.cxx TryExecute.cxx
VariantArrayHandle.cxx
) )
# This list of sources has code that uses devices and so might need to be # This list of sources has code that uses devices and so might need to be
# compiled with a device-specific compiler (like CUDA). # compiled with a device-specific compiler (like CUDA).
set(device_sources set(device_sources
ArrayHandleVirtual.cxx
ArrayRangeCompute.cxx ArrayRangeCompute.cxx
AssignerMultiBlock.cxx AssignerMultiBlock.cxx
BoundsCompute.cxx BoundsCompute.cxx
BoundsGlobalCompute.cxx BoundsGlobalCompute.cxx
CellLocator.cxx
CellLocatorBoundingIntervalHierarchy.cxx CellLocatorBoundingIntervalHierarchy.cxx
CellLocatorGeneral.cxx CellLocatorGeneral.cxx
CellLocatorRectilinearGrid.cxx CellLocatorRectilinearGrid.cxx
...@@ -161,6 +160,7 @@ set(device_sources ...@@ -161,6 +160,7 @@ set(device_sources
DataSetBuilderExplicit.cxx DataSetBuilderExplicit.cxx
DataSetBuilderRectilinear.cxx DataSetBuilderRectilinear.cxx
DataSetBuilderUniform.cxx DataSetBuilderUniform.cxx
internal/VariantArrayHandleContainer.cxx
Field.cxx Field.cxx
FieldRangeCompute.cxx FieldRangeCompute.cxx
FieldRangeGlobalCompute.cxx FieldRangeGlobalCompute.cxx
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <vtkm/Types.h> #include <vtkm/Types.h>
#include <vtkm/cont/DeviceAdapter.h> #include <vtkm/cont/serial/internal/DeviceAdapterTagSerial.h>
namespace vtkm namespace vtkm
{ {
......
...@@ -22,4 +22,4 @@ set(unit_tests ...@@ -22,4 +22,4 @@ set(unit_tests
UnitTestTypeCheckKeys.cxx UnitTestTypeCheckKeys.cxx
) )
vtkm_unit_tests(SOURCES ${unit_tests}) vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
...@@ -15,8 +15,10 @@ ...@@ -15,8 +15,10 @@
//We always create the cuda tag when included, but we only mark it as //We always create the cuda tag when included, but we only mark it as
//a valid tag when VTKM_CUDA is true. This is for easier development //a valid tag when VTKM_CUDA is true. This is for easier development
//of multi-backend systems //of multi-backend systems
#ifdef VTKM_CUDA #if defined(VTKM_CUDA) && defined(VTKM_ENABLE_CUDA)
VTKM_VALID_DEVICE_ADAPTER(Cuda, VTKM_DEVICE_ADAPTER_CUDA); VTKM_VALID_DEVICE_ADAPTER(Cuda, VTKM_DEVICE_ADAPTER_CUDA);
#elif defined(VTKM_ENABLE_CUDA) && !defined(VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
#error When VTK-m is build with CUDA enabled all compilation units that include DeviceAdapterTagCuda must use the cuda compiler
#else #else
VTKM_INVALID_DEVICE_ADAPTER(Cuda, VTKM_DEVICE_ADAPTER_CUDA); VTKM_INVALID_DEVICE_ADAPTER(Cuda, VTKM_DEVICE_ADAPTER_CUDA);
#endif #endif
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <vtkm/cont/RuntimeDeviceTracker.h> #include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h> #include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/testing/TestingMath.h> #include <vtkm/testing/TestingMath.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
......
...@@ -11,10 +11,8 @@ ...@@ -11,10 +11,8 @@
#include <sstream> #include <sstream>
#include <typeindex> #include <typeindex>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/ErrorBadValue.h> #include <vtkm/cont/ErrorBadValue.h>
#include <vtkm/cont/VariantArrayHandle.h> #include <vtkm/cont/internal/VariantArrayHandleContainer.h>
namespace vtkm namespace vtkm
{ {
...@@ -40,8 +38,9 @@ VariantArrayHandleContainerBase::~VariantArrayHandleContainerBase() ...@@ -40,8 +38,9 @@ VariantArrayHandleContainerBase::~VariantArrayHandleContainerBase()
namespace detail namespace detail
{ {
void ThrowCastAndCallException(const vtkm::cont::internal::VariantArrayHandleContainerBase& ref, VTKM_CONT_EXPORT void ThrowCastAndCallException(
const std::type_info& type) const vtkm::cont::internal::VariantArrayHandleContainerBase& ref,
const std::type_info& type)
{ {
std::ostringstream out; std::ostringstream out;
out << "Could not find appropriate cast for array in CastAndCall1.\n" out << "Could not find appropriate cast for array in CastAndCall1.\n"
......
...@@ -15,4 +15,4 @@ set(unit_tests ...@@ -15,4 +15,4 @@ set(unit_tests
UnitTestDynamicTransform.cxx UnitTestDynamicTransform.cxx
UnitTestIteratorFromArrayPortal.cxx UnitTestIteratorFromArrayPortal.cxx
) )
vtkm_unit_tests(SOURCES ${unit_tests}) vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
...@@ -25,7 +25,7 @@ set(unit_tests ...@@ -25,7 +25,7 @@ set(unit_tests
UnitTestOpenMPPointLocatorUniformGrid.cxx UnitTestOpenMPPointLocatorUniformGrid.cxx
UnitTestOpenMPVirtualObjectHandle.cxx UnitTestOpenMPVirtualObjectHandle.cxx
) )
vtkm_unit_tests(OpenMP SOURCES ${unit_tests}) vtkm_unit_tests(OpenMP SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
if (VTKm_ENABLE_TESTING) if (VTKm_ENABLE_TESTING)
#We need to have all OpenMP tests run serially as they #We need to have all OpenMP tests run serially as they
......
...@@ -26,4 +26,4 @@ set(unit_tests ...@@ -26,4 +26,4 @@ set(unit_tests
UnitTestSerialPointLocatorUniformGrid.cxx UnitTestSerialPointLocatorUniformGrid.cxx
UnitTestSerialVirtualObjectHandle.cxx UnitTestSerialVirtualObjectHandle.cxx
) )
vtkm_unit_tests(SOURCES ${unit_tests}) vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
...@@ -26,4 +26,4 @@ set(unit_tests ...@@ -26,4 +26,4 @@ set(unit_tests
UnitTestTBBVirtualObjectHandle.cxx UnitTestTBBVirtualObjectHandle.cxx
) )
vtkm_unit_tests(SOURCES ${unit_tests}) vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
...@@ -78,8 +78,7 @@ set(unit_tests ...@@ -78,8 +78,7 @@ set(unit_tests
UnitTestTryExecute.cxx UnitTestTryExecute.cxx
) )
vtkm_unit_tests(SOURCES ${unit_tests}) vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
# add distributed tests i.e. test to run with MPI # add distributed tests i.e. test to run with MPI
# if MPI is enabled. # if MPI is enabled.
...@@ -88,4 +87,4 @@ set(mpi_unit_tests ...@@ -88,4 +87,4 @@ set(mpi_unit_tests
UnitTestSerializationArrayHandle.cxx UnitTestSerializationArrayHandle.cxx
UnitTestSerializationDataSet.cxx UnitTestSerializationDataSet.cxx
) )
vtkm_unit_tests(MPI SOURCES ${mpi_unit_tests}) vtkm_unit_tests(MPI SOURCES ${mpi_unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#include <vtkm/cont/cuda/DeviceAdapterCuda.h> #include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/testing/Testing.h>
#include <vtkm/exec/FunctorBase.h> #include <vtkm/exec/FunctorBase.h>
#include <vtkm/exec/arg/BasicArg.h> #include <vtkm/exec/arg/BasicArg.h>
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include <vtkm/internal/FunctionInterface.h> #include <vtkm/internal/FunctionInterface.h>
#include <vtkm/internal/Invocation.h> #include <vtkm/internal/Invocation.h>
#include <vtkm/cont/testing/Testing.h>
#if defined(VTKM_MSVC) #if defined(VTKM_MSVC)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4068) //unknown pragma #pragma warning(disable : 4068) //unknown pragma
...@@ -372,8 +370,7 @@ void TestTaskStrided() ...@@ -372,8 +370,7 @@ void TestTaskStrided()
int UnitTestTaskStrided(int argc, char* argv[]) int UnitTestTaskStrided(int argc, char* argv[])
{ {
return vtkm::cont::testing::Testing::Run( return vtkm::testing::Testing::Run(TestTaskStrided<vtkm::cont::DeviceAdapterTagCuda>, argc, argv);
TestTaskStrided<vtkm::cont::DeviceAdapterTagCuda>, argc, argv);
} }
#if defined(__NVCC__) && defined(__CUDACC_VER_MAJOR__) #if defined(__NVCC__) && defined(__CUDACC_VER_MAJOR__)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <vtkm/StaticAssert.h> #include <vtkm/StaticAssert.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h> #include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/testing/Testing.h> #include <vtkm/testing/Testing.h>
#include <vtkm/exec/FunctorBase.h> #include <vtkm/exec/FunctorBase.h>
#include <vtkm/exec/arg/BasicArg.h> #include <vtkm/exec/arg/BasicArg.h>
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <vtkm/internal/Invocation.h> #include <vtkm/internal/Invocation.h>
#include <vtkm/testing/Testing.h> #include <vtkm/testing/Testing.h>
namespace namespace
{ {
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
//============================================================================ //============================================================================
#include <vtkm/cont/openmp/DeviceAdapterOpenMP.h> #include <vtkm/cont/openmp/DeviceAdapterOpenMP.h>
#include <vtkm/exec/internal/testing/TestingTaskTiling.h> #include <vtkm/exec/internal/testing/TestingTaskTiling.h>
#include <vtkm/testing/Testing.h>
int UnitTestTaskTilingOpenMP(int argc, char* argv[]) int UnitTestTaskTilingOpenMP(int argc, char* argv[])
{ {
return vtkm::cont::testing::Testing::Run( return vtkm::testing::Testing::Run(
vtkm::exec::internal::testing::TestTaskTiling<vtkm::cont::DeviceAdapterTagOpenMP>, argc, argv); vtkm::exec::internal::testing::TestTaskTiling<vtkm::cont::DeviceAdapterTagOpenMP>, argc, argv);
} }
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#include <vtkm/cont/serial/DeviceAdapterSerial.h> #include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/exec/internal/testing/TestingTaskTiling.h> #include <vtkm/exec/internal/testing/TestingTaskTiling.h>
#include <vtkm/testing/Testing.h>
int UnitTestTaskTilingSerial(int argc, char* argv[]) int UnitTestTaskTilingSerial(int argc, char* argv[])
{ {
return vtkm::cont::testing::Testing::Run( return vtkm::testing::Testing::Run(
vtkm::exec::internal::testing::TestTaskTiling<vtkm::cont::DeviceAdapterTagSerial>, argc, argv); vtkm::exec::internal::testing::TestTaskTiling<vtkm::cont::DeviceAdapterTagSerial>, argc, argv);
} }
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#include <vtkm/cont/tbb/DeviceAdapterTBB.h> #include <vtkm/cont/tbb/DeviceAdapterTBB.h>
#include <vtkm/exec/internal/testing/TestingTaskTiling.h> #include <vtkm/exec/internal/testing/TestingTaskTiling.h>
#include <vtkm/testing/Testing.h>
int UnitTestTaskTilingTBB(int argc, char* argv[]) int UnitTestTaskTilingTBB(int argc, char* argv[])
{ {
return vtkm::cont::testing::Testing::Run( return vtkm::testing::Testing::Run(
vtkm::exec::internal::testing::TestTaskTiling<vtkm::cont::DeviceAdapterTagTBB>, argc, argv); vtkm::exec::internal::testing::TestTaskTiling<vtkm::cont::DeviceAdapterTagTBB>, argc, argv);
} }
...@@ -8,13 +8,11 @@ ...@@ -8,13 +8,11 @@
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#include <vtkm/internal/ArrayPortalValueReference.h> #include <vtkm/testing/Testing.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/TypeTraits.h> #include <vtkm/TypeTraits.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/testing/Testing.h> #include <vtkm/internal/ArrayPortalValueReference.h>
namespace namespace
{ {
...@@ -304,5 +302,5 @@ void DoTest() ...@@ -304,5 +302,5 @@ void DoTest()
int UnitTestArrayPortalValueReference(int argc, char* argv[]) int UnitTestArrayPortalValueReference(int argc, char* argv[])
{ {
return vtkm::cont::testing::Testing::Run(DoTest, argc, argv); return vtkm::testing::Testing::Run(DoTest, argc, argv);
} }
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