Apply .clangformat to all repo source files
Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
This commit is contained in:
@@ -1,44 +1,44 @@
|
||||
#include<iostream>
|
||||
#include <iostream>
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_runtime_api.h"
|
||||
|
||||
#define LEN 1024
|
||||
#define SIZE LEN<<2
|
||||
#define SIZE LEN << 2
|
||||
|
||||
int main(){
|
||||
int *A, *B;
|
||||
hipDeviceptr_t Ad, Bd;
|
||||
A = new int[LEN];
|
||||
B = new int[LEN];
|
||||
int main() {
|
||||
int *A, *B;
|
||||
hipDeviceptr_t Ad, Bd;
|
||||
A = new int[LEN];
|
||||
B = new int[LEN];
|
||||
|
||||
for(int i=0;i<LEN;i++){
|
||||
A[i] = i;
|
||||
}
|
||||
for (int i = 0; i < LEN; i++) {
|
||||
A[i] = i;
|
||||
}
|
||||
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
|
||||
hipMemcpyHtoD(Ad, A, SIZE);
|
||||
hipMemcpyDtoD(Bd, Ad, SIZE);
|
||||
hipMemcpyDtoH(B, Bd, SIZE);
|
||||
hipMemcpyHtoD(Ad, A, SIZE);
|
||||
hipMemcpyDtoD(Bd, Ad, SIZE);
|
||||
hipMemcpyDtoH(B, Bd, SIZE);
|
||||
|
||||
for(int i=0;i<16;i++){
|
||||
std::cout<<A[i]<<" "<<B[i]<<std::endl;
|
||||
}
|
||||
for (int i = 0; i < 16; i++) {
|
||||
std::cout << A[i] << " " << B[i] << std::endl;
|
||||
}
|
||||
|
||||
int *Ah, *Bh;
|
||||
hipHostMalloc(&Ah, SIZE, 0);
|
||||
hipHostMalloc(&Bh, SIZE, 0);
|
||||
memcpy(Ah, A, SIZE);
|
||||
hipStream_t stream;
|
||||
hipStreamCreate(&stream);
|
||||
int *Ah, *Bh;
|
||||
hipHostMalloc(&Ah, SIZE, 0);
|
||||
hipHostMalloc(&Bh, SIZE, 0);
|
||||
memcpy(Ah, A, SIZE);
|
||||
hipStream_t stream;
|
||||
hipStreamCreate(&stream);
|
||||
|
||||
hipMemcpyHtoDAsync(Ad, Ah, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipMemcpyDtoDAsync(Bd, Ad, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipMemcpyDtoHAsync(Bh, Bd, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipMemcpyHtoDAsync(Ad, Ah, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipMemcpyDtoDAsync(Bd, Ad, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipMemcpyDtoHAsync(Bh, Bd, SIZE, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
|
||||
std::cout<<Ah[10]<<" "<<Bh[10]<<std::endl;
|
||||
std::cout << Ah[10] << " " << Bh[10] << std::endl;
|
||||
}
|
||||
|
||||
Verwijs in nieuw issue
Block a user