"git@developer.sourcefind.cn:OpenDAS/torchani.git" did not exist on "f6b193bd423f8ce986ac18977c5e956901c0800c"
Commit 7be5f2c7 authored by Tim Dettmers's avatar Tim Dettmers
Browse files

Guard for prefetchAsync GPU capability. #470 #451 #477

parent f3232d13
...@@ -385,6 +385,11 @@ extern "C" ...@@ -385,6 +385,11 @@ extern "C"
void cprefetch(void *ptr, size_t bytes, int device) void cprefetch(void *ptr, size_t bytes, int device)
{ {
int hasPrefetch = 0;
CUDA_CHECK_RETURN(cudaDeviceGetAttribute(&hasPrefetch, cudaDevAttrConcurrentManagedAccess, device)); // 40ns overhead
if (hasPrefetch == 0) return;
CUDA_CHECK_RETURN(cudaMemPrefetchAsync(ptr, bytes, device, 0)); CUDA_CHECK_RETURN(cudaMemPrefetchAsync(ptr, bytes, device, 0));
CUDA_CHECK_RETURN(cudaPeekAtLastError()); CUDA_CHECK_RETURN(cudaPeekAtLastError());
} }
......
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