Skip to content

Commit ca41a43

Browse files
authored
Solve a CUDA deprecation warning (#46)
1 parent 15bd572 commit ca41a43

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ install*/
4343
*.out
4444
*.app
4545

46+
# Logs
47+
*.log
48+

tests/regression/array/implementation.cu

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,16 @@ namespace gpu_array {
3838
}
3939
cudaPointerAttributes attributes;
4040
auto ret = cudaPointerGetAttributes(&attributes, descriptor->data);
41-
if (ret != cudaSuccess || attributes.memoryType != cudaMemoryTypeDevice) {
41+
if (ret != cudaSuccess ||
42+
#if defined(CUDART_VERSION) && CUDART_VERSION < 10000
43+
attributes.memoryType != cudaMemoryTypeDevice
44+
#else
45+
(attributes.type != cudaMemoryTypeDevice && attributes.type != cudaMemoryTypeManaged)
46+
#endif
47+
) {
4248
throw std::runtime_error("no gpu pointer");
4349
}
50+
4451
return my_array<T>{static_cast<T *>(descriptor->data),
4552
{descriptor->dims[0], descriptor->dims[1], descriptor->dims[2]},
4653
{1, descriptor->dims[0], descriptor->dims[0] * descriptor->dims[1]}};

0 commit comments

Comments
 (0)