Added test for C + HIP

Esse commit está contido em:
Aditya Atluri
2016-03-25 13:45:28 -05:00
commit a5628ddfb4
2 arquivos alterados com 25 adições e 0 exclusões
Arquivo executável
+3
Ver Arquivo
@@ -0,0 +1,3 @@
#!/bin/bash
$HCC_HOME/bin/hcc -I$HCC_HOME/include -I$HSA_PATH/include -I$HIP_PATH/include -std=c11 -c hipC.c
+22
Ver Arquivo
@@ -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);
}