@@ -3,7 +3,7 @@
|
||||
|
||||
#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){
|
||||
@@ -12,7 +12,7 @@ __global__ void Iter(hipLaunchParm lp, int *Ad){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
int main(){
|
||||
int A=0, *Ad;
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include<hip_runtime.h>
|
||||
#include<hip_runtime_api.h>
|
||||
|
||||
__global__ void Kernel(hipLaunchParm lp, float *Ad){
|
||||
int tx = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -53,14 +53,14 @@ __device__ __host__ float PlusOne(float x)
|
||||
|
||||
__global__ void MyKernel (const hipLaunchParm lp, const float *a, const float *b, float *c, unsigned N)
|
||||
{
|
||||
KERNELBEGIN;
|
||||
//KERNELBEGIN;
|
||||
|
||||
unsigned gid = hipThreadIdx_x;
|
||||
if (gid < N) {
|
||||
c[gid] = a[gid] + PlusOne(b[gid]);
|
||||
}
|
||||
|
||||
KERNELEND;
|
||||
//KERNELEND;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ vectorADD(const hipLaunchParm lp,
|
||||
T *C_d,
|
||||
size_t N)
|
||||
{
|
||||
KERNELBEGIN;
|
||||
// KERNELBEGIN;
|
||||
int ws = warpSize;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ vectorADD(const hipLaunchParm lp,
|
||||
C_d[i] = A_d[i] + B_d[i];
|
||||
}
|
||||
|
||||
KERNELEND;
|
||||
// KERNELEND;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user