mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Only use cuda hints for CUDA 8.0+.
This commit is contained in:
parent
b5b56cd891
commit
5a99dd761b
@ -120,12 +120,14 @@ void CudaAllocator::PrepareForControl(const void* ptr, std::size_t numBytes)
|
||||
|
||||
if (ManagedMemorySupported)
|
||||
{
|
||||
#if CUDART_VERSION >= 8000
|
||||
// TODO these hints need to be benchmarked and adjusted once we start
|
||||
// sharing the pointers between cont/exec
|
||||
VTKM_CUDA_CALL(
|
||||
cudaMemAdvise(ptr, numBytes, cudaMemAdviseSetPreferredLocation, cudaCpuDeviceId));
|
||||
VTKM_CUDA_CALL(cudaMemAdvise(ptr, numBytes, cudaMemAdviseUnsetReadMostly, cudaCpuDeviceId));
|
||||
VTKM_CUDA_CALL(cudaMemPrefetchAsync(ptr, numBytes, cudaCpuDeviceId, cudaStreamPerThread));
|
||||
#endif // CUDA >= 8.0
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,11 +137,13 @@ void CudaAllocator::PrepareForInput(const void* ptr, std::size_t numBytes)
|
||||
|
||||
if (ManagedMemorySupported)
|
||||
{
|
||||
#if CUDART_VERSION >= 8000
|
||||
int dev;
|
||||
VTKM_CUDA_CALL(cudaGetDevice(&dev));
|
||||
VTKM_CUDA_CALL(cudaMemAdvise(ptr, numBytes, cudaMemAdviseSetPreferredLocation, dev));
|
||||
VTKM_CUDA_CALL(cudaMemAdvise(ptr, numBytes, cudaMemAdviseSetReadMostly, dev));
|
||||
VTKM_CUDA_CALL(cudaMemPrefetchAsync(ptr, numBytes, dev, cudaStreamPerThread));
|
||||
#endif // CUDA >= 8.0
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,11 +153,13 @@ void CudaAllocator::PrepareForOutput(const void* ptr, std::size_t numBytes)
|
||||
|
||||
if (ManagedMemorySupported)
|
||||
{
|
||||
#if CUDART_VERSION >= 8000
|
||||
int dev;
|
||||
VTKM_CUDA_CALL(cudaGetDevice(&dev));
|
||||
VTKM_CUDA_CALL(cudaMemAdvise(ptr, numBytes, cudaMemAdviseSetPreferredLocation, dev));
|
||||
VTKM_CUDA_CALL(cudaMemAdvise(ptr, numBytes, cudaMemAdviseUnsetReadMostly, dev));
|
||||
VTKM_CUDA_CALL(cudaMemPrefetchAsync(ptr, numBytes, dev, cudaStreamPerThread));
|
||||
#endif // CUDA >= 8.0
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,11 +169,13 @@ void CudaAllocator::PrepareForInPlace(const void* ptr, std::size_t numBytes)
|
||||
|
||||
if (ManagedMemorySupported)
|
||||
{
|
||||
#if CUDART_VERSION >= 8000
|
||||
int dev;
|
||||
VTKM_CUDA_CALL(cudaGetDevice(&dev));
|
||||
VTKM_CUDA_CALL(cudaMemAdvise(ptr, numBytes, cudaMemAdviseSetPreferredLocation, dev));
|
||||
VTKM_CUDA_CALL(cudaMemAdvise(ptr, numBytes, cudaMemAdviseUnsetReadMostly, dev));
|
||||
VTKM_CUDA_CALL(cudaMemPrefetchAsync(ptr, numBytes, dev, cudaStreamPerThread));
|
||||
#endif // CUDA >= 8.0
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user