From 674d14302fff7816aba31b87924f1dab0e65cb90 Mon Sep 17 00:00:00 2001 From: hyperfraise Date: Tue, 26 Apr 2022 17:04:38 +0200 Subject: [PATCH] account for ld versions of cuda --- src/cpp/cuda.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cpp/cuda.hpp b/src/cpp/cuda.hpp index 8704220f..4238c2ca 100644 --- a/src/cpp/cuda.hpp +++ b/src/cpp/cuda.hpp @@ -861,6 +861,7 @@ namespace pycuda return result; } +#if CUDAPP_CUDA_VERSION >= 7500 inline py::tuple get_stream_priority_range() { @@ -869,6 +870,7 @@ namespace pycuda CUDAPP_CALL_GUARDED(cuCtxGetStreamPriorityRange, (&leastPriority, &greatestPriority)); return py::make_tuple(leastPriority, greatestPriority); } +#endif @@ -1006,8 +1008,17 @@ namespace pycuda CUstream m_stream; public: - stream(unsigned int flags=0, int priority=0) - { CUDAPP_CALL_GUARDED(cuStreamCreateWithPriority, (&m_stream, flags, priority)); } + + #if CUDAPP_CUDA_VERSION >= 7500 + stream(unsigned int flags=0, int priority=0) + { CUDAPP_CALL_GUARDED(cuStreamCreateWithPriority, (&m_stream, flags, priority)); } + #else + if (priority != 0) + throw pycuda::error("stream", CUDA_ERROR_INVALID_HANDLE, + "priority!=0 setting isn't supported for your CUDA version"); + stream(unsigned int flags=0) + { CUDAPP_CALL_GUARDED(cuStreamCreate, (&m_stream, flags)); } + #endif ~stream() {