File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
numba_cuda/numba/cuda/cudadrv Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,9 @@ class _DeviceContextManager(object):
7070
7171 def __init__ (self , device ):
7272 self ._device = device
73-
74- def get_primary_context (self , * args , ** kwargs ):
75- """This attribute is forwarded directly, to avoid the performance overhead of `__getattr__`."""
76- return self ._device .get_primary_context (* args , ** kwargs )
73+ # Forwarded directly, to avoid the performance overhead of
74+ # `__getattr__` and method lookup for a commonly accessed method
75+ self .get_primary_context = self ._device .get_primary_context
7776
7877 def __getattr__ (self , item ):
7978 return getattr (self ._device , item )
@@ -83,7 +82,7 @@ def __enter__(self):
8382
8483 def __exit__ (self , exc_type , exc_val , exc_tb ):
8584 # this will verify that we are popping the right device context.
86- self ._device . get_primary_context ().pop ()
85+ self .get_primary_context ().pop ()
8786
8887 def __str__ (self ):
8988 return f"<Managed Device { self .id } >"
You can’t perform that action at this time.
0 commit comments