Merge pull request #963 from gargrahul/add_module_get_global_test
Test hipModuleGetGlobal
This commit is contained in:
@@ -31,7 +31,6 @@ THE SOFTWARE.
|
|||||||
#define SIZE LEN * sizeof(float)
|
#define SIZE LEN * sizeof(float)
|
||||||
|
|
||||||
#define fileName "vcpy_kernel.code"
|
#define fileName "vcpy_kernel.code"
|
||||||
float myDeviceGlobal;
|
|
||||||
float myDeviceGlobalArray[16];
|
float myDeviceGlobalArray[16];
|
||||||
#define HIP_CHECK(cmd) \
|
#define HIP_CHECK(cmd) \
|
||||||
{ \
|
{ \
|
||||||
@@ -69,7 +68,10 @@ int main() {
|
|||||||
HIP_CHECK(hipModuleLoad(&Module, fileName));
|
HIP_CHECK(hipModuleLoad(&Module, fileName));
|
||||||
|
|
||||||
float myDeviceGlobal_h = 42.0;
|
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
|
#define ARRAY_SIZE 16
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
#define ARRAY_SIZE (16)
|
#define ARRAY_SIZE (16)
|
||||||
|
|
||||||
extern float myDeviceGlobal;
|
__device__ float myDeviceGlobal;
|
||||||
extern float myDeviceGlobalArray[16];
|
extern float myDeviceGlobalArray[16];
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user