| 134 | } |
| 135 | |
| 136 | void gpu_data:: |
| 137 | copy_to_host() const |
| 138 | { |
| 139 | if (!host_current) |
| 140 | { |
| 141 | wait_for_transfer_to_finish(); |
| 142 | CHECK_CUDA(cudaMemcpy(data_host.get(), data_device.get(), data_size*sizeof(float), cudaMemcpyDeviceToHost)); |
| 143 | host_current = true; |
| 144 | // At this point we know our RAM block isn't in use because cudaMemcpy() |
| 145 | // implicitly syncs with the device. |
| 146 | device_in_use = false; |
| 147 | // Check for errors. These calls to cudaGetLastError() are what help us find |
| 148 | // out if our kernel launches have been failing. |
| 149 | CHECK_CUDA(cudaGetLastError()); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | void gpu_data:: |
| 154 | async_copy_to_device() const |