Apply .clangformat to all repo source files

Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
Este commit está contenido en:
Maneesh Gupta
2018-03-12 11:29:03 +05:30
padre 18e70b1e6b
commit 1ba06f63c4
Se han modificado 293 ficheros con 43980 adiciones y 45830 borrados
+23 -30
Ver fichero
@@ -25,18 +25,17 @@ THE SOFTWARE.
// TODO - bug if run both back-to-back, once fixed should just need one command line
#include"test_common.h"
#include<malloc.h>
#include "test_common.h"
#include <malloc.h>
__global__ void Inc(hipLaunchParm lp, float *Ad){
__global__ void Inc(hipLaunchParm lp, float* Ad) {
int tx = threadIdx.x + blockIdx.x * blockDim.x;
Ad[tx] = Ad[tx] + float(1);
}
template<typename T>
void doMemCopy(size_t numElements, int offset, T *A, T *Bh, T *Bd, bool internalRegister)
{
template <typename T>
void doMemCopy(size_t numElements, int offset, T* A, T* Bh, T* Bd, bool internalRegister) {
A = A + offset;
numElements -= offset;
@@ -48,7 +47,7 @@ void doMemCopy(size_t numElements, int offset, T *A, T *Bh, T *Bd, bool internal
// Reset
for(size_t i=0;i<numElements;i++){
for (size_t i = 0; i < numElements; i++) {
A[i] = float(i);
Bh[i] = 0.0f;
}
@@ -57,13 +56,13 @@ void doMemCopy(size_t numElements, int offset, T *A, T *Bh, T *Bd, bool internal
//
HIPCHECK(hipMemcpy(Bd, A, sizeBytes, hipMemcpyHostToDevice));
HIPCHECK(hipMemcpy(Bd, A, sizeBytes, hipMemcpyHostToDevice));
HIPCHECK(hipMemcpy(Bh, Bd, sizeBytes, hipMemcpyDeviceToHost));
// Make sure the copy worked
for(size_t i=0;i<numElements;i++){
for (size_t i = 0; i < numElements; i++) {
if (Bh[i] != A[i]) {
printf ("mismatch at Bh[%zu]=%f, A[%zu]=%f\n", i, Bh[i], i, A[i]);
printf("mismatch at Bh[%zu]=%f, A[%zu]=%f\n", i, Bh[i], i, A[i]);
failed("mismatch");
};
}
@@ -71,12 +70,9 @@ void doMemCopy(size_t numElements, int offset, T *A, T *Bh, T *Bd, bool internal
if (internalRegister) {
HIPCHECK(hipHostUnregister(A));
}
}
int main(int argc, char *argv[])
{
int main(int argc, char* argv[]) {
HipTest::parseStandardArguments(argc, argv, true);
const size_t size = N * sizeof(float);
@@ -90,20 +86,20 @@ int main(int argc, char *argv[])
HIPCHECK(hipHostRegister(A, size, 0));
for(int i=0;i<N;i++){
for (int i = 0; i < N; i++) {
A[i] = float(1);
}
for(int i=0;i<num_devices;i++){
for (int i = 0; i < num_devices; i++) {
HIPCHECK(hipSetDevice(i));
HIPCHECK(hipHostGetDevicePointer((void**)&Ad[i], A, 0));
}
// Reference the registered device pointer Ad from inside the kernel:
for(int i=0;i<num_devices;i++){
for (int i = 0; i < num_devices; i++) {
HIPCHECK(hipSetDevice(i));
hipLaunchKernel(Inc, dim3(N/512), dim3(512), 0, 0, Ad[i]);
hipLaunchKernel(Inc, dim3(N / 512), dim3(512), 0, 0, Ad[i]);
HIPCHECK(hipDeviceSynchronize());
}
@@ -111,7 +107,7 @@ int main(int argc, char *argv[])
HIPCHECK(hipHostUnregister(A));
free (A);
free(A);
}
@@ -120,7 +116,7 @@ int main(int argc, char *argv[])
HIPCHECK(hipSetDevice(0));
float * A = (float*)malloc(size);
float* A = (float*)malloc(size);
// Copy to B, this should be optimal pinned malloc copy:
// Note we are using the host pointer here:
@@ -130,29 +126,26 @@ int main(int argc, char *argv[])
// TODO - set to 128
#define OFFSETS_TO_TRY 128
assert (N>OFFSETS_TO_TRY);
assert(N > OFFSETS_TO_TRY);
if (p_tests & 0x2) {
for (size_t i=0; i<OFFSETS_TO_TRY; i++) {
doMemCopy(N, i, A, Bh, Bd, true/*internalRegister*/);
for (size_t i = 0; i < OFFSETS_TO_TRY; i++) {
doMemCopy(N, i, A, Bh, Bd, true /*internalRegister*/);
}
}
if (p_tests & 0x4) {
HIPCHECK(hipHostRegister(A, size, 0));
for (size_t i=0; i<OFFSETS_TO_TRY; i++) {
doMemCopy(N, i, A, Bh, Bd, false/*internalRegister*/);
for (size_t i = 0; i < OFFSETS_TO_TRY; i++) {
doMemCopy(N, i, A, Bh, Bd, false /*internalRegister*/);
}
HIPCHECK(hipHostUnregister(A));
}
free (A);
free(A);
}
passed();
passed();
}