2efa60a37e
- 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
[ROCm/hip commit: 4152746e26]
27 righe
532 B
C++
27 righe
532 B
C++
#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;
|
|
}
|
|
}
|