示例#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)
示例#2
0
 def test_none(self):
     memory.set_allocator(None)
     self._check_pool_not_used()
示例#3
0
 def test(self):
     memory.set_allocator()
     self._check_pool_not_used()
示例#4
0
 def tearDown(self):
     memory.set_allocator(self.pool.malloc)
示例#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)
示例#6
0
 def tearDown(self):
     self.pool.free_all_blocks()
     memory.set_allocator(self.old_pool.malloc)
示例#7
0
 def setUp(self):
     self.old_pool = cupy.get_default_memory_pool()
     self.pool = memory.MemoryPool()
     memory.set_allocator(self.pool.malloc)
示例#8
0
 def tearDown(self):
     memory.set_allocator()
     self.pool.free_all_blocks()
示例#9
0
 def setUp(self):
     self.pool = memory.MemoryPool()
     memory.set_allocator(self.pool.malloc)
示例#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)
示例#11
0
文件: test_memory.py 项目: keckj/cupy
 def setUp(self):
     self.old_pool = cupy.get_default_memory_pool()
     memory.set_allocator(memory.malloc_async)
示例#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)