Files
rocm-systems/projects/hip/tests/src/hipDrvMemcpy.cpp
T

27 líneas
532 B
C++
Original Vista normal Histórico

2016-08-26 13:11:01 -05:00
#include<iostream>
#include<hip/hip_runtime.h>
#include<hip/hip_runtime_api.h>
#define LEN 1024
#define SIZE LEN<<2
int main(){
int *A, *B, *C;
hipDeviceptr Ad, Bd;
A = new int[LEN];
B = new int[LEN];
C = new int[LEN];
for(int i=0;i<LEN;i++){
A[i] = i;
}
hipMalloc((void**)&Ad, SIZE);
hipMalloc((void**)&Bd, SIZE);
hipMemcpyHtoD(Ad, A, SIZE);
hipMemcpyDtoD(Bd, Ad, SIZE);
hipMemcpyDtoH(B, Bd, SIZE);
hipMemcpyHtoH(C, B,SIZE);
for(int i=0;i<16;i++){
std::cout<<A[i]<<" "<<C[i]<<std::endl;
}
}