Files
rocm-systems/tests/hipify-clang/unit_tests/samples/allocators.cu
T
2018-12-04 20:47:34 +03:00

19 lines
343 B
Plaintext

// RUN: %run_test hipify "%s" "%t" %cuda_args
#pragma once
#include <cuda_runtime.h>
/**
* Allocate GPU memory for `count` elements of type `T`.
*/
template<typename T>
static T* gpuMalloc(size_t count) {
T* ret = nullptr;
// CHECK: hipMalloc(&ret, count * sizeof(T));
cudaMalloc(&ret, count * sizeof(T));
return ret;
}