2016-10-04 22:20:50 +05:30
|
|
|
#include "hip/hip_runtime.h"
|
|
|
|
|
#include "hip/hip_runtime_api.h"
|
2016-03-30 06:08:50 -05:00
|
|
|
|
|
|
|
|
__global__ void Kernel(hipLaunchParm lp, float *Ad){
|
2017-11-19 01:54:12 +00:00
|
|
|
int tx = threadIdx.x + blockIdx.x * blockDim.x;
|
2017-02-03 10:53:36 -06:00
|
|
|
Ad[tx] += Ad[tx-1];
|
2016-03-30 06:08:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
dim3 dimBlock;
|
|
|
|
|
dim3 dimGrid;
|
|
|
|
|
dimGrid.x = 1;
|
|
|
|
|
dimGrid.y = 1;
|
|
|
|
|
dimGrid.z = 1;
|
|
|
|
|
dimBlock.x = 1;
|
|
|
|
|
dimBlock.y = 1;
|
|
|
|
|
dimBlock.z = 1;
|
|
|
|
|
float *A;
|
|
|
|
|
hipLaunchKernel(HIP_KERNEL_NAME(Kernel), dimGrid, dimBlock, 0, 0, A);
|
|
|
|
|
}
|