Memory Management
Overview
Tutorial: 5 min
Learn how we can manually manage memory in Numba.
Understand how to transfer data between host and device.
Although Numba can automatically transfer NumPy arrays to the device and back, we can prevent unnecessary transfers by manually controlling the transfer process.
Host to device copy:
1data_cpu = np.arange(10)
2data_gpu = cuda.to_device(data_cpu)
Device to host copy:
1data_cpu = data_gpu.copy_to_host()
or …
1data_gpu.copy_to_host(data_cpu)
Key Points
Data management is automatic in Numba, but we can also manage it manually.