cupy.cuda.using_allocator#

cupy.cuda.using_allocator(allocator=None)[源代码][源代码]#
在内部为GPU内存设置一个线程本地分配器

上下文管理器

参数:

allocator (function) – CuPy 内存分配器。它必须具有与 cupy.cuda.alloc() 函数相同的接口,该函数接受缓冲区大小作为参数并返回该大小的设备缓冲区。当指定 None 时,将使用原始内存分配器(即,禁用内存池)。