Skip to content

Commit 6207b04

Browse files
committed
add stream priority range function
1 parent b67c441 commit 6207b04

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

doc/driver.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,10 @@ Devices and Contexts
644644

645645
See also :mod:`pycuda.autoinit`.
646646

647+
.. function:: get_stream_priority_range()
648+
649+
Returns numerical values that correspond to the least and greatest stream priorities.
650+
647651
.. class:: Device(number)
648652
Device(pci_bus_id)
649653

src/cpp/cuda.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,6 @@ namespace pycuda
531531
* to push contexts that are already active at a deeper stack level, so we
532532
* maintain all contexts floating other than the top one.
533533
*/
534-
535534
// for friend decl
536535
namespace gl {
537536
boost::shared_ptr<context>
@@ -862,6 +861,16 @@ namespace pycuda
862861
return result;
863862
}
864863

864+
inline
865+
py::tuple get_stream_priority_range()
866+
{
867+
int leastPriority;
868+
int greatestPriority;
869+
CUDAPP_CALL_GUARDED(cuCtxGetStreamPriorityRange, (&leastPriority, &greatestPriority));
870+
return py::make_tuple(leastPriority, greatestPriority);
871+
}
872+
873+
865874

866875
#if CUDAPP_CUDA_VERSION >= 7000
867876
inline boost::shared_ptr<context> device::retain_primary_context()

src/wrapper/wrap_cudadrv.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,9 @@ BOOST_PYTHON_MODULE(_driver)
11931193
.add_property("handle", &cl::handle_int)
11941194
;
11951195
}
1196+
1197+
DEF_SIMPLE_FUNCTION(get_stream_priority_range);
1198+
11961199
// }}}
11971200

11981201
// {{{ stream

0 commit comments

Comments
 (0)