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 @@ -2433,19 +2433,21 @@ def test_array_pickling(ctx_factory):
24332433 # }}}
24342434
24352435 # {{{ SVM test
2436+ from pyopencl .characterize import has_coarse_grain_buffer_svm
24362437
2437- from pyopencl .tools import SVMAllocator , SVMPool
2438+ if has_coarse_grain_buffer_svm (queue .device ):
2439+ from pyopencl .tools import SVMAllocator , SVMPool
24382440
2439- alloc = SVMAllocator (context , alignment = 0 , queue = queue )
2440- alloc = SVMPool (alloc )
2441+ alloc = SVMAllocator (context , alignment = 0 , queue = queue )
2442+ alloc = SVMPool (alloc )
24412443
2442- a_dev = cl_array .to_device (queue , a , allocator = alloc )
2444+ a_dev = cl_array .to_device (queue , a , allocator = alloc )
24432445
2444- with cl_array .queue_for_pickling (queue , alloc ):
2445- a_dev_pickled = pickle .loads (pickle .dumps (a_dev ))
2446+ with cl_array .queue_for_pickling (queue , alloc ):
2447+ a_dev_pickled = pickle .loads (pickle .dumps (a_dev ))
24462448
2447- assert np .all (a_dev_pickled .get () == a )
2448- assert a_dev_pickled .allocator is alloc
2449+ assert np .all (a_dev_pickled .get () == a )
2450+ assert a_dev_pickled .allocator is alloc
24492451
24502452 # }}}
24512453
You can’t perform that action at this time.
0 commit comments