mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Get the vtkm cont cuda object to compile properly.
This commit is contained in:
parent
6ecc22bb8c
commit
355eea887c
@ -109,10 +109,15 @@ set(sources ${sources} $<TARGET_OBJECTS:vtkm_cont_serial>)
|
||||
|
||||
add_subdirectory(cuda)
|
||||
if (VTKm_ENABLE_CUDA)
|
||||
# Need to come back to this at some point, but can't make OBJECT libraries
|
||||
# with cuda_add_library:
|
||||
#
|
||||
# set(sources ${sources} $<TARGET_OBJECTS:vtkm_cont_cuda>)
|
||||
get_property(vtkm_cont_cuda_object_files GLOBAL
|
||||
PROPERTY vtkm_cont_cuda_object_files )
|
||||
# mark the file as generated, this needs to be done in this directory
|
||||
# for 'reasons'.
|
||||
set_source_files_properties(${vtkm_cont_cuda_object_files}
|
||||
PROPERTIES GENERATED TRUE)
|
||||
|
||||
set(sources ${sources} ${vtkm_cont_cuda_object_files})
|
||||
|
||||
endif()
|
||||
|
||||
add_subdirectory(tbb)
|
||||
@ -120,11 +125,16 @@ if (VTKm_ENABLE_TBB)
|
||||
set(sources ${sources} $<TARGET_OBJECTS:vtkm_cont_tbb>)
|
||||
endif()
|
||||
|
||||
|
||||
vtkm_library(
|
||||
SOURCES ${sources}
|
||||
WRAP_FOR_CUDA ${device_sources}
|
||||
HEADERS ${header_impls})
|
||||
target_include_directories(vtkm_cont PRIVATE ${VTKm_BACKEND_INCLUDE_DIRS})
|
||||
|
||||
if(VTKm_ENABLE_CUDA)
|
||||
add_dependencies(vtkm_cont vtkm_cont_cuda)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
add_subdirectory(testing)
|
||||
|
@ -18,7 +18,7 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include "ArrayManagerExecutionCuda.h"
|
||||
#include <vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/cuda/internal/DeviceAdapterTagCuda.h>
|
||||
|
||||
#include <vtkm/cont/Storage.h>
|
||||
#include <vtkm/cont/internal/ArrayExportMacros.h>
|
||||
#include <vtkm/cont/internal/ArrayManagerExecution.h>
|
||||
#include <vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h>
|
||||
@ -118,18 +117,16 @@ public:
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// Disabled for now -- see comment in cont/cuda/internal/CMakeLists.txt about
|
||||
// cuda_add_library and OBJECT libraries.
|
||||
|
||||
//#ifdef VTKM_BUILD_PREPARE_FOR_DEVICE
|
||||
//EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(char, DeviceAdapterTagCuda)
|
||||
//EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Int8, DeviceAdapterTagCuda)
|
||||
//EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::UInt8, DeviceAdapterTagCuda)
|
||||
//EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Int32, DeviceAdapterTagCuda)
|
||||
//EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Int64, DeviceAdapterTagCuda)
|
||||
//EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Float32, DeviceAdapterTagCuda)
|
||||
//EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Float64, DeviceAdapterTagCuda)
|
||||
//#endif // VTKM_BUILD_PREPARE_FOR_DEVICE
|
||||
#ifdef VTKM_BUILD_PREPARE_FOR_DEVICE
|
||||
EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(char, DeviceAdapterTagCuda)
|
||||
EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Int8, DeviceAdapterTagCuda)
|
||||
EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::UInt8, DeviceAdapterTagCuda)
|
||||
EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Int32, DeviceAdapterTagCuda)
|
||||
EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Int64, DeviceAdapterTagCuda)
|
||||
EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Float32, DeviceAdapterTagCuda)
|
||||
EXPORT_ARRAYHANDLE_DEVICE_ADAPTER(vtkm::Float64, DeviceAdapterTagCuda)
|
||||
#endif // VTKM_BUILD_PREPARE_FOR_DEVICE
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
@ -34,15 +34,26 @@ vtkm_declare_headers(CUDA ${headers} TESTABLE ${VTKm_ENABLE_CUDA})
|
||||
if (VTKm_ENABLE_CUDA)
|
||||
add_subdirectory(testing)
|
||||
|
||||
# Need to sort this out still...cuda_add_library doesn't support OBJECT
|
||||
# libraries:
|
||||
#
|
||||
# cuda_add_library(vtkm_cont_cuda OBJECT ArrayManagerExecutionCuda.cu)
|
||||
# set_property(TARGET vtkm_cont_cuda PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
# target_compile_features(vtkm_cont_cuda PRIVATE cxx_auto_type)
|
||||
# target_include_directories(vtkm_cont_cuda PRIVATE
|
||||
# "${VTKm_SOURCE_DIR}"
|
||||
# "${VTKm_BINARY_DIR}/include"
|
||||
# ${VTKm_BACKEND_INCLUDE_DIRS}
|
||||
# )
|
||||
#todo we need to add a custom target and feed that as a dependency
|
||||
#for vtkm_cont
|
||||
cuda_include_directories(${VTKm_SOURCE_DIR}
|
||||
${VTKm_BINARY_DIR}/include
|
||||
${VTKm_BACKEND_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(compile_options )
|
||||
if(BUILD_SHARED_LIBS AND NOT WIN32)
|
||||
list(APPEND compile_options -Xcompiler=${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden)
|
||||
list(APPEND compile_options -Xcompiler=-fPIC)
|
||||
endif()
|
||||
|
||||
cuda_compile(vtkm_cont_cuda_object_files ArrayManagerExecutionCuda.cu
|
||||
OPTIONS "${compile_options}")
|
||||
|
||||
#Setup the dependency chain for the custom object build so that
|
||||
add_custom_target(vtkm_cont_cuda DEPENDS ${vtkm_cont_cuda_object_files})
|
||||
|
||||
set_property( GLOBAL
|
||||
PROPERTY vtkm_cont_cuda_object_files ${vtkm_cont_cuda_object_files})
|
||||
|
||||
endif()
|
||||
|
@ -226,7 +226,6 @@ struct load_through_texture<T, typename std::enable_if< UseMultipleScalarTexture
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ArrayPortalFromThrustBase {};
|
||||
|
||||
/// This templated implementation of an ArrayPortal allows you to adapt a pair
|
||||
@ -265,14 +264,14 @@ public:
|
||||
return static_cast<vtkm::Id>( (this->EndIterator - this->BeginIterator) );
|
||||
}
|
||||
|
||||
__host__ __device__
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id index) const {
|
||||
typedef typename ::thrust::iterator_traits<IteratorType>::difference_type
|
||||
SizeType;
|
||||
return *(this->BeginIterator + static_cast<SizeType>(index));
|
||||
}
|
||||
|
||||
__host__ __device__
|
||||
VTKM_EXEC_CONT
|
||||
void Set(vtkm::Id index, ValueType value) const {
|
||||
typedef typename ::thrust::iterator_traits<IteratorType>::difference_type
|
||||
SizeType;
|
||||
@ -343,12 +342,10 @@ public:
|
||||
}
|
||||
|
||||
#else
|
||||
__host__
|
||||
ValueType Get(vtkm::Id vtkmNotUsed(index) ) const {
|
||||
return ValueType();
|
||||
}
|
||||
|
||||
__host__
|
||||
void Set(vtkm::Id vtkmNotUsed(index), ValueType vtkmNotUsed(value)) const {
|
||||
#if ! (defined(VTKM_MSVC) && defined(VTKM_CUDA))
|
||||
VTKM_ASSERT(true && "Cannot set to const array.");
|
||||
|
Loading…
Reference in New Issue
Block a user