Added explicit memory copy direction apis
- Fixed stale printf in context api - Added 4 sync memcpy apis 1. hipMemcpyHtoD 2. hipMemcpyDtoH 3. hipMemcpyDtoD 4. hipMemcpyHtoH - Added test for added apis Change-Id: I4a9c382445b62631f8d0bcbb9a670322288b72b1
Este commit está contenido en:
@@ -0,0 +1,26 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
Referencia en una nueva incidencia
Block a user