MCPcopy Create free account
hub / github.com/KnowingNothing/MatmulTutorial / copy_to_gpu

Function copy_to_gpu

include/common.h:330–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328
329template <class DType>
330void copy_to_gpu(DType* hptr, DType* dptr, std::vector<int> shape) {
331 CUDA_CHECK(cudaMemcpy(
332 dptr, hptr,
333 std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<int>()) *
334 sizeof(DType),
335 cudaMemcpyHostToDevice));
336}
337
338template <class DType>
339void copy_to_gpu_async(DType* hptr, DType* dptr, std::vector<int> shape,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected