Medium
cudaMemcpy from pageable host memory versus cudaMallocHost memory
Version A copies from ordinary malloc'd (pageable) host memory via cudaMemcpy. Version B copies from cudaMallocHost-allocated (pinned/page-locked) host memory of the same size. What's the expected difference, and what's the downside of allocating most of a system's RAM as pinned memory?
kernel.cu
// Version A
float* hostPageable = (float*)malloc(bytes);
cudaMemcpy(dev, hostPageable, bytes, cudaMemcpyHostToDevice);
// Version B
float* hostPinned;
cudaMallocHost(&hostPinned, bytes); // page-locked
cudaMemcpy(dev, hostPinned, bytes, cudaMemcpyHostToDevice);23 of 46 in GPU / CUDA