mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
VTK-m now has defines for the CUDA version even when not using nvcc.
This is needed so so that the CUDA and C++ compiler generate the same code when scanning a shared header but generating different translation units
This commit is contained in:
parent
a60e378003
commit
505e7aa1ec
@ -183,7 +183,8 @@ __host__ __device__::thrust::pair<OutputIterator1, OutputIterator2> reduce_by_ke
|
||||
BinaryFunction binary_op)
|
||||
|
||||
{
|
||||
#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ == 7) && (__CUDACC_VER_MINOR__ >= 5)
|
||||
#if defined(VTKM_CUDA_VERSION_MAJOR) && (VTKM_CUDA_VERSION_MAJOR == 7) && \
|
||||
(VTKM_CUDA_VERSION_MINOR >= 5)
|
||||
::thrust::pair<OutputIterator1, OutputIterator2> result =
|
||||
thrust::reduce_by_key(ThrustCudaPolicyPerThread,
|
||||
keys_first,
|
||||
|
@ -31,6 +31,11 @@ set(VTKM_ENABLE_CUDA ${VTKm_ENABLE_CUDA})
|
||||
set(VTKM_ENABLE_TBB ${VTKm_ENABLE_TBB})
|
||||
set(VTKM_ENABLE_MPI ${VTKm_ENABLE_MPI})
|
||||
|
||||
if(VTKM_ENABLE_CUDA)
|
||||
set(VTKM_CUDA_VERSION_MAJOR ${CUDA_VERSION_MAJOR})
|
||||
set(VTKM_CUDA_VERSION_MINOR ${CUDA_VERSION_MINOR})
|
||||
endif()
|
||||
|
||||
vtkm_get_kit_name(kit_name kit_dir)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in
|
||||
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h
|
||||
|
@ -271,6 +271,14 @@
|
||||
//Mark if we are building with MPI enabled.
|
||||
#cmakedefine VTKM_ENABLE_MPI
|
||||
|
||||
//Mark what version of the CUDA compiler we have. This is needed to correctly
|
||||
//choose consistent implementation ( so we don't violate ODR ) when we compile
|
||||
//with CUDA 7.5
|
||||
#ifdef VTKM_ENABLE_CUDA
|
||||
#define VTKM_CUDA_VERSION_MAJOR @VTKM_CUDA_VERSION_MAJOR@
|
||||
#define VTKM_CUDA_VERSION_MINOR @VTKM_CUDA_VERSION_MINOR@
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L || \
|
||||
( defined(VTKM_MSVC) && _MSC_VER >= 1900 ) || \
|
||||
( defined(VTKM_ICC) && defined(__INTEL_CXX11_MODE__) )
|
||||
|
@ -77,6 +77,15 @@
|
||||
#define VTKM_NEVER_EXPORT __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
|
||||
// cuda 7.5 doesn't support static const or static constexpr variables
|
||||
// that exist inside methods or classes, so in those cases we gracefully
|
||||
// fall back to using just constexpr
|
||||
#if defined(VTKM_CUDA_VERSION_MAJOR) && (VTKM_CUDA_VERSION_MAJOR < 8)
|
||||
#define VTKM_STATIC_CONSTEXPR constexpr
|
||||
#else
|
||||
#define VTKM_STATIC_CONSTEXPR static constexpr
|
||||
#endif
|
||||
|
||||
// Clang will warn about weak vtables (-Wweak-vtables) on exception classes,
|
||||
// but there's no good way to eliminate them in this case because MSVC (See
|
||||
// http://stackoverflow.com/questions/24511376). These macros will silence the
|
||||
|
Loading…
Reference in New Issue
Block a user