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

Function alloc_gpu_tensor

include/common.h:310–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308
309template <class DType>
310DType* alloc_gpu_tensor(std::vector<int> shape) {
311 DType* dt;
312 CUDA_CHECK(cudaMalloc(
313 (void**)&dt,
314 std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<int>()) *
315 sizeof(DType)));
316 return dt;
317}
318
319template <class DType>
320void free_cpu_tensor(DType* ptr) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected