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
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):
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):
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())
jakirkham marked this conversation as resolved.
Show resolved Hide resolved
else:
self.c_obj.reset(new cuda_stream_view(<cudaStream_t>stream))

Expand Down