Files
rocm-systems/tests/hipify-clang/unit_tests/samples/allocators.cu
T

19 lines
357 B
Plaintext
Raw Normal View History

// RUN: %run_test hipify "%s" "%t" %hipify_args %clang_args
2017-11-11 11:00:40 +00:00
#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;
}