Apply .clangformat to all repo source files
Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
This commit is contained in:
@@ -29,16 +29,15 @@ THE SOFTWARE.
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "test_common.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char* argv[]) {
|
||||
HipTest::parseStandardArguments(argc, argv, true);
|
||||
|
||||
HIPCHECK(hipInit(0));
|
||||
|
||||
hipDevice_t device;
|
||||
hipDevice_t device1;
|
||||
hipCtx_t ctx;
|
||||
hipCtx_t ctx1;
|
||||
hipCtx_t ctx;
|
||||
hipCtx_t ctx1;
|
||||
|
||||
HIPCHECK(hipDeviceGet(&device, 0));
|
||||
HIPCHECK(hipCtxCreate(&ctx, 0, device));
|
||||
|
||||
@@ -19,17 +19,17 @@ THE SOFTWARE.
|
||||
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_runtime_api.h"
|
||||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
hipInit(0);
|
||||
hipDevice_t device;
|
||||
hipDeviceGet(&device, 0);
|
||||
hipDevice_t device;
|
||||
hipDeviceGet(&device, 0);
|
||||
char pciBusId[10];
|
||||
memset(pciBusId,0,10);
|
||||
hipDeviceGetPCIBusId(pciBusId,100,device);
|
||||
printf("PCI Bus ID= %s\n",pciBusId);
|
||||
memset(pciBusId, 0, 10);
|
||||
hipDeviceGetPCIBusId(pciBusId, 100, device);
|
||||
printf("PCI Bus ID= %s\n", pciBusId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -37,30 +37,28 @@ THE SOFTWARE.
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "test_common.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HipTest::parseStandardArguments(argc, argv, true);
|
||||
size_t Nbytes = N*sizeof(char);
|
||||
char *A_h;
|
||||
hipDeviceptr_t A_d;
|
||||
A_h = new char[Nbytes];
|
||||
int main(int argc, char* argv[]) {
|
||||
HipTest::parseStandardArguments(argc, argv, true);
|
||||
size_t Nbytes = N * sizeof(char);
|
||||
char* A_h;
|
||||
hipDeviceptr_t A_d;
|
||||
A_h = new char[Nbytes];
|
||||
|
||||
HIPCHECK ( hipMalloc((void **) &A_d, Nbytes) );
|
||||
HIPCHECK(hipMalloc((void**)&A_d, Nbytes));
|
||||
|
||||
printf ("Size=%zu memsetval=%2x \n", Nbytes, memsetval);
|
||||
HIPCHECK ( hipMemsetD8(A_d, memsetval, Nbytes) );
|
||||
printf("Size=%zu memsetval=%2x \n", Nbytes, memsetval);
|
||||
HIPCHECK(hipMemsetD8(A_d, memsetval, Nbytes));
|
||||
|
||||
HIPCHECK ( hipMemcpy(A_h, (void *) A_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
HIPCHECK(hipMemcpy(A_h, (void*)A_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
for (int i=0; i<N; i++) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
if (A_h[i] != memsetval) {
|
||||
failed("mismatch at index:%d computed:%02x, memsetval:%02x\n", i, (int)A_h[i], (int)memsetval);
|
||||
|
||||
failed("mismatch at index:%d computed:%02x, memsetval:%02x\n", i, (int)A_h[i],
|
||||
(int)memsetval);
|
||||
}
|
||||
}
|
||||
|
||||
hipFree((void *) A_d);
|
||||
delete [] A_h;
|
||||
hipFree((void*)A_d);
|
||||
delete[] A_h;
|
||||
passed();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user