Not using classes inside headers

This commit is contained in:
Aditya Atluri
2016-03-29 02:27:51 -05:00
parent f59b9e0aaf
commit 8e437d0565
3 changed files with 32 additions and 4 deletions
+3 -3
View File
@@ -215,9 +215,9 @@ extern "C" {
#endif
typedef class ihipStream_t* hipStream_t;
typedef struct hipEvent_t {
struct ihipEvent_t *_handle;
} hipEvent_t;
//typedef struct hipEvent_t {
// struct ihipEvent_t *_handle;
//} hipEvent_t;
#ifdef __cplusplus
}
+7 -1
View File
@@ -31,7 +31,7 @@ THE SOFTWARE.
#include <hcc_detail/host_defines.h>
#include <hip_runtime_api.h>
#include "hip_hcc.h"
//#include "hip_hcc.h"
#if defined (__HCC__) && (__hcc_workweek__ < 16074)
#error("This version of HIP requires a newer version of HCC.");
@@ -42,6 +42,12 @@ THE SOFTWARE.
extern "C" {
#endif
typedef struct ihipStream_t *hipStream_t;
typedef struct hipEvent_t {
struct ihipEvent_t *_handle;
} hipEvent_t;
/**
* @addtogroup GlobalDefs More
* @{
+22
View File
@@ -0,0 +1,22 @@
#include"hip_runtime.h"
#include<stdio.h>
#define ITER 1<<20
#define SIZE 1024*1024*sizeof(int)
__global__ void Iter(hipLaunchParm lp, int *Ad){
int tx = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x;
if(tx == 0){
for(int i=0;i<ITER;i++){
Ad[tx] += 1;
}
}
}
int main(){
int A=0, *Ad;
hipMalloc((void**)&Ad, SIZE);
hipMemcpy(Ad, &A, SIZE, hipMemcpyHostToDevice);
hipLaunchKernel(HIP_KERNEL_NAME(Iter), dim3(1), dim3(1), 0, 0, Ad);
hipMemcpy(&A, Ad, SIZE, hipMemcpyDeviceToHost);
}