diff --git a/ci/test_conda.sh b/ci/test_conda.sh index e7e16f44e..dfd2d4c38 100755 --- a/ci/test_conda.sh +++ b/ci/test_conda.sh @@ -4,14 +4,6 @@ set -euo pipefail -DISTRO=`cat /etc/os-release | grep "^ID=" | awk 'BEGIN {FS="="} { print $2 }'` - -if [ "$DISTRO" = "ubuntu" ]; then - apt-get update - apt remove --purge `dpkg --get-selections | grep cuda-nvvm | awk '{print $1}'` -y - apt remove --purge `dpkg --get-selections | grep cuda-nvrtc | awk '{print $1}'` -y -fi - # Constrain oldest supported dependencies for testing if [ "${NUMBA_VERSION:-*}" != "*" ]; then # add to the default environment's dependencies diff --git a/numba_cuda/numba/cuda/cudadrv/driver.py b/numba_cuda/numba/cuda/cudadrv/driver.py index 8039596a5..89cdd54bb 100644 --- a/numba_cuda/numba/cuda/cudadrv/driver.py +++ b/numba_cuda/numba/cuda/cudadrv/driver.py @@ -1329,19 +1329,19 @@ def unload_module(self, module): def get_default_stream(self): handle = drvapi.cu_stream(int(binding.CUstream(CU_STREAM_DEFAULT))) - return Stream(weakref.proxy(self), handle, None) + return Stream(handle) def get_legacy_default_stream(self): handle = drvapi.cu_stream( int(binding.CUstream(binding.CU_STREAM_LEGACY)) ) - return Stream(weakref.proxy(self), handle, None) + return Stream(handle) def get_per_thread_default_stream(self): handle = drvapi.cu_stream( int(binding.CUstream(binding.CU_STREAM_PER_THREAD)) ) - return Stream(weakref.proxy(self), handle, None) + return Stream(handle) def create_stream(self): # The default stream creation flag, specifying that the created @@ -1351,16 +1351,14 @@ def create_stream(self): flags = binding.CUstream_flags.CU_STREAM_DEFAULT.value handle = drvapi.cu_stream(int(driver.cuStreamCreate(flags))) return Stream( - weakref.proxy(self), - handle, - _stream_finalizer(self.deallocations, handle), + handle, finalizer=_stream_finalizer(self.deallocations, handle) ) def create_external_stream(self, ptr): if not isinstance(ptr, int): raise TypeError("ptr for external stream must be an int") handle = drvapi.cu_stream(int(binding.CUstream(ptr))) - return Stream(weakref.proxy(self), handle, None, external=True) + return Stream(handle, external=True) def create_event(self, timing=True): flags = 0 @@ -1368,9 +1366,7 @@ def create_event(self, timing=True): flags |= enums.CU_EVENT_DISABLE_TIMING handle = drvapi.cu_event(int(driver.cuEventCreate(flags))) return Event( - weakref.proxy(self), - handle, - finalizer=_event_finalizer(self.deallocations, handle), + handle, finalizer=_event_finalizer(self.deallocations, handle) ) def synchronize(self): @@ -1383,7 +1379,7 @@ def defer_cleanup(self): yield def __repr__(self): - return "" % (self.handle, self.device.id) + return f"" def __eq__(self, other): if isinstance(other, Context): @@ -2058,9 +2054,8 @@ class ManagedOwnedPointer(OwnedPointer, mviewbuf.MemAlloc): pass -class Stream(object): - def __init__(self, context, handle, finalizer, external=False): - self.context = context +class Stream: + def __init__(self, handle, finalizer=None, external=False): self.handle = handle self.external = external if finalizer is not None: @@ -2077,18 +2072,18 @@ def __cuda_stream__(self): def __repr__(self): default_streams = { - drvapi.CU_STREAM_DEFAULT: "", - drvapi.CU_STREAM_LEGACY: "", - drvapi.CU_STREAM_PER_THREAD: "", + drvapi.CU_STREAM_DEFAULT: "", + drvapi.CU_STREAM_LEGACY: "", + drvapi.CU_STREAM_PER_THREAD: "", } ptr = self.handle.value or drvapi.CU_STREAM_DEFAULT if ptr in default_streams: - return default_streams[ptr] % self.context + return default_streams[ptr] elif self.external: - return "" % (ptr, self.context) + return f"" else: - return "" % (ptr, self.context) + return f"" def synchronize(self): """ @@ -2190,9 +2185,8 @@ def callback(stream, status, future): return future -class Event(object): - def __init__(self, context, handle, finalizer=None): - self.context = context +class Event: + def __init__(self, handle, finalizer=None): self.handle = handle if finalizer is not None: weakref.finalize(self, finalizer)