Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions python/rmm/_lib/cuda_stream_view.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from libc.stdint cimport uintptr_t


cpdef enum cudaStream:
cudaStreamDefault = 0
cudaStreamLegacy = 1
cudaStreamPerThread = 2


cdef class CudaStreamView:

def __cinit__(self, uintptr_t stream=0):
def __cinit__(self, cudaStream stream=cudaStreamDefault):
"""Construct a view of the specified CUDA stream
Parameters
----------
stream : uintptr_t, optional
CUDA stream to wrap, default 0
"""
if (stream == 0):
self.c_obj.reset(new cuda_stream_view())
if (stream == cudaStreamDefault):
if int(os.environ.get("RMM_PER_THREAD_DEFAULT_STREAM", "0")) != 0:
self.c_obj.reset(new cuda_stream_view(<cudaStream_t>cudaStreamPerThread))
else:
self.c_obj.reset(new cuda_stream_view())
else:
self.c_obj.reset(new cuda_stream_view(<cudaStream_t>stream))

Expand Down