From 46346343af2812fb6b3097afb8395057fa15bdd4 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Fri, 15 Mar 2019 04:08:03 +0530 Subject: [PATCH] Test hipModuleGetGlobal --- hipamd/samples/0_Intro/module_api_global/runKernel.cpp | 6 ++++-- hipamd/samples/0_Intro/module_api_global/vcpy_kernel.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hipamd/samples/0_Intro/module_api_global/runKernel.cpp b/hipamd/samples/0_Intro/module_api_global/runKernel.cpp index 0047f79b7f..715d889558 100644 --- a/hipamd/samples/0_Intro/module_api_global/runKernel.cpp +++ b/hipamd/samples/0_Intro/module_api_global/runKernel.cpp @@ -31,7 +31,6 @@ THE SOFTWARE. #define SIZE LEN * sizeof(float) #define fileName "vcpy_kernel.code" -float myDeviceGlobal; float myDeviceGlobalArray[16]; #define HIP_CHECK(cmd) \ { \ @@ -69,7 +68,10 @@ int main() { HIP_CHECK(hipModuleLoad(&Module, fileName)); float myDeviceGlobal_h = 42.0; - myDeviceGlobal = 42.0; + float* deviceGlobal; + size_t deviceGlobalSize; + HIP_CHECK(hipModuleGetGlobal((void**)&deviceGlobal, &deviceGlobalSize, Module, "myDeviceGlobal")); + *deviceGlobal = 42.0; #define ARRAY_SIZE 16 diff --git a/hipamd/samples/0_Intro/module_api_global/vcpy_kernel.cpp b/hipamd/samples/0_Intro/module_api_global/vcpy_kernel.cpp index f975cee09e..8c4873427f 100644 --- a/hipamd/samples/0_Intro/module_api_global/vcpy_kernel.cpp +++ b/hipamd/samples/0_Intro/module_api_global/vcpy_kernel.cpp @@ -24,7 +24,7 @@ THE SOFTWARE. #define ARRAY_SIZE (16) -extern float myDeviceGlobal; +__device__ float myDeviceGlobal; extern float myDeviceGlobalArray[16]; ;