Sets a thread-local allocator for GPU memory inside
context manager
Parameters:allocator (function) – CuPy memory allocator. It must have the same interface as the cupy.cuda.alloc() function, which takes the buffer size as an argument and returns the device buffer of that size. When None is specified, raw memory allocator will be used (i.e., memory pool is disabled).


This wraps an internal version of this function to provide a contextmanager as contextmanger decoration doesn’t behave well in Cython.