Beispiel #1
0
 def setUp(self):
     if self.mempool == 'MemoryAsyncPool':
         if cupy.cuda.runtime.is_hip:
             pytest.skip('HIP does not support async allocator')
         if cupy.cuda.driver.get_build_version() < 11020:
             pytest.skip('malloc_async is supported since CUDA 11.2')
         if cupy.cuda.runtime.driverGetVersion() < 11030:
             pytest.skip('pool statistics is supported with driver 11.3+')
     self.old_pool = cupy.get_default_memory_pool()
     self.pool = getattr(memory, self.mempool)()
     memory.set_allocator(self.pool.malloc)
Beispiel #2
0
 def test_none(self):
     memory.set_allocator(None)
     self._check_pool_not_used()
Beispiel #3
0
 def test(self):
     memory.set_allocator()
     self._check_pool_not_used()
Beispiel #4
0
 def tearDown(self):
     memory.set_allocator(self.pool.malloc)
Beispiel #5
0
 def test_set_allocator_cm(self):
     new_pool = memory.MemoryPool()
     new_pool2 = memory.MemoryPool()
     with memory.using_allocator(new_pool.malloc):
         with self.assertRaises(ValueError):
             memory.set_allocator(new_pool2.malloc)
Beispiel #6
0
 def tearDown(self):
     self.pool.free_all_blocks()
     memory.set_allocator(self.old_pool.malloc)
Beispiel #7
0
 def setUp(self):
     self.old_pool = cupy.get_default_memory_pool()
     self.pool = memory.MemoryPool()
     memory.set_allocator(self.pool.malloc)
Beispiel #8
0
 def tearDown(self):
     memory.set_allocator()
     self.pool.free_all_blocks()
Beispiel #9
0
 def setUp(self):
     self.pool = memory.MemoryPool()
     memory.set_allocator(self.pool.malloc)
Beispiel #10
0
 def setUp(self):
     self.old_pool = cupy.get_default_memory_pool()
     self.alloc = PythonAllocator()
     python_alloc = memory.PythonFunctionAllocator(self.alloc.malloc,
                                                   self.alloc.free)
     memory.set_allocator(python_alloc.malloc)
Beispiel #11
0
 def setUp(self):
     self.old_pool = cupy.get_default_memory_pool()
     memory.set_allocator(memory.malloc_async)
Beispiel #12
0
 def setUp(self):
     if cupy.cuda.runtime.deviceGetAttribute(
             cupy.cuda.runtime.cudaDevAttrMemoryPoolsSupported, 0) == 0:
         pytest.skip('malloc_async is not supported on device 0')
     self.old_pool = cupy.get_default_memory_pool()
     memory.set_allocator(memory.malloc_async)