Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Support enabling PTDS via CUDA_PTDS environment variable #633

Open
wants to merge 7 commits into
base: branch-21.06
Choose a base branch
from
13 changes: 9 additions & 4 deletions python/rmm/_lib/cuda_stream_view.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,27 @@
import os

from libc.stdint cimport uintptr_t
from rmm._lib.lib cimport cudaStreamPerThread


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):
jakirkham marked this conversation as resolved.
Show resolved Hide resolved
"""Construct a view of the specified CUDA stream

Parameters
----------
stream : uintptr_t, optional
CUDA stream to wrap, default 0
"""
if (stream == 0):
if (stream == cudaStreamDefault):
if int(os.environ.get("RMM_PER_THREAD_DEFAULT_STREAM", "0")) != 0:
self.c_obj.reset(new cuda_stream_view(cudaStreamPerThread))
self.c_obj.reset(new cuda_stream_view(<cudaStream_t>cudaStreamPerThread))
else:
self.c_obj.reset(new cuda_stream_view())
else:
Expand Down
3 changes: 0 additions & 3 deletions python/rmm/_lib/lib.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ cdef extern from * nogil:

ctypedef void* cudaStream_t "cudaStream_t"

cudaStream_t cudaStreamLegacy
cudaStream_t cudaStreamPerThread

ctypedef enum cudaMemcpyKind "cudaMemcpyKind":
cudaMemcpyHostToHost = 0
cudaMemcpyHostToDevice = 1
Expand Down