Transfering data between RAM and device memory
Host memory (= RAM) and device memory
Very important fact:
Host memory (= RAM)
and
device memory
are
separate memories
Variables
stored in the
host memory (RAM)
are
only
accessible
by
CPU code
Variables
stored in the
device memory
are
only
accessible
by
GPU code
CUDA C-host functions used to transfer data between host memory (RAM) and device memory
Transfering data
from
host memory (RAM)
to
device memory
:
cudaMemcpy( devPtr, ramPtr, nBytes, cudaMemcpyHostToDevice ); Input: