File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -370,6 +370,7 @@ def queue_for_pickling(queue, alloc=None):
370370 yield None
371371 finally :
372372 _QUEUE_FOR_PICKLING_TLS .queue = None
373+ _QUEUE_FOR_PICKLING_TLS .alloc = None
373374
374375# }}}
375376
Original file line number Diff line number Diff line change @@ -2434,18 +2434,21 @@ def test_array_pickling(ctx_factory):
24342434
24352435 # {{{ SVM test
24362436
2437- from pyopencl .tools import SVMAllocator , SVMPool
2437+ from pyopencl .characterize import has_coarse_grain_buffer_svm
2438+
2439+ if has_coarse_grain_buffer_svm (queue .device ):
2440+ from pyopencl .tools import SVMAllocator , SVMPool
24382441
2439- alloc = SVMAllocator (context , alignment = 0 , queue = queue )
2440- alloc = SVMPool (alloc )
2442+ alloc = SVMAllocator (context , alignment = 0 , queue = queue )
2443+ alloc = SVMPool (alloc )
24412444
2442- a_dev = cl_array .to_device (queue , a , allocator = alloc )
2445+ a_dev = cl_array .to_device (queue , a , allocator = alloc )
24432446
2444- with cl_array .queue_for_pickling (queue , alloc ):
2445- a_dev_pickled = pickle .loads (pickle .dumps (a_dev ))
2447+ with cl_array .queue_for_pickling (queue , alloc ):
2448+ a_dev_pickled = pickle .loads (pickle .dumps (a_dev ))
24462449
2447- assert np .all (a_dev_pickled .get () == a )
2448- assert a_dev_pickled .allocator is alloc
2450+ assert np .all (a_dev_pickled .get () == a )
2451+ assert a_dev_pickled .allocator is alloc
24492452
24502453 # }}}
24512454
You can’t perform that action at this time.
0 commit comments