Apply .clangformat to all repo source files

Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
This commit is contained in:
Maneesh Gupta committed 2018-03-12 11:29:03 +05:30
1 parent eee7fa6072
commit 9e47fccc89
293 files changed
+43974 -45824

No files matched your search

@@ -20,8 +20,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// Test hipEventRecord serialization behavior.
// Through manual inspection of the reported timestamps, can determine if recording a NULL event forces synchronization :
// set
// Through manual inspection of the reported timestamps, can determine if recording a NULL event
// forces synchronization : set
/* HIT_START
* BUILD: %t %s ../../test_common.cpp
@@ -32,82 +32,70 @@ 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);
unsigned blocks = (N+threadsPerBlock-1)/threadsPerBlock;
if (blocks > 1024)
blocks = 1024;
if (blocks ==0 )
blocks = 1;
unsigned blocks = (N + threadsPerBlock - 1) / threadsPerBlock;
if (blocks > 1024) blocks = 1024;
if (blocks == 0) blocks = 1;
printf ("N=%zu (A+B+C= %6.1f MB total) blocks=%u threadsPerBlock=%u iterations=%d\n", N, ((double)3*N*sizeof(float))/1024/1024, blocks, threadsPerBlock, iterations);
printf ("iterations=%d\n", iterations);
printf("N=%zu (A+B+C= %6.1f MB total) blocks=%u threadsPerBlock=%u iterations=%d\n", N,
((double)3 * N * sizeof(float)) / 1024 / 1024, blocks, threadsPerBlock, iterations);
printf("iterations=%d\n", iterations);
size_t Nbytes = N*sizeof(float);
size_t Nbytes = N * sizeof(float);
float * A_h, *B_h, *C_h;
float * A_d, *B_d, *C_d;
HipTest::initArrays (&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N);
float *A_h, *B_h, *C_h;
float *A_d, *B_d, *C_d;
HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N);
hipEvent_t start, stop;
// NULL stream check:
HIPCHECK (hipEventCreate(&start));
HIPCHECK (hipEventCreate(&stop));
HIPCHECK(hipEventCreate(&start));
HIPCHECK(hipEventCreate(&stop));
HIPCHECK ( hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice));
HIPCHECK ( hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice));
HIPCHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice));
HIPCHECK(hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice));
for (int i=0; i<iterations; i++) {
for (int i = 0; i < iterations; i++) {
//--- START TIMED REGION
long long hostStart = HipTest::get_time();
// Record the start event
HIPCHECK(hipEventRecord(start, NULL));
//--- START TIMED REGION
long long hostStart = HipTest::get_time();
// Record the start event
HIPCHECK (hipEventRecord(start, NULL));
hipLaunchKernel(
HipTest::vectorADD,
dim3(blocks),
dim3(threadsPerBlock),
0,
0,
static_cast<const float*>(A_d),
static_cast<const float*>(B_d),
C_d,
N);
hipLaunchKernel(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0,
static_cast<const float*>(A_d), static_cast<const float*>(B_d), C_d, N);
HIPCHECK (hipEventRecord(stop, NULL));
HIPCHECK (hipEventSynchronize(stop) );
long long hostStop = HipTest::get_time();
//--- STOP TIMED REGION
HIPCHECK(hipEventRecord(stop, NULL));
HIPCHECK(hipEventSynchronize(stop));
long long hostStop = HipTest::get_time();
//--- STOP TIMED REGION
float eventMs = 1.0f;
HIPCHECK (hipEventElapsedTime(&eventMs, start, stop));
float hostMs = HipTest::elapsed_time(hostStart, hostStop);
float eventMs = 1.0f;
HIPCHECK(hipEventElapsedTime(&eventMs, start, stop));
float hostMs = HipTest::elapsed_time(hostStart, hostStop);
printf ("host_time (gettimeofday) =%6.3fms\n", hostMs);
printf ("kernel_time (hipEventElapsedTime) =%6.3fms\n", eventMs);
printf ("\n");
printf("host_time (gettimeofday) =%6.3fms\n", hostMs);
printf("kernel_time (hipEventElapsedTime) =%6.3fms\n", eventMs);
printf("\n");
// Make sure timer is timing something...
HIPASSERT(eventMs > 0.0f);
}
// Make sure timer is timing something...
HIPASSERT(eventMs > 0.0f);
}
HIPCHECK (hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
HIPCHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
printf ("check:\n");
printf("check:\n");
HipTest::checkVectorADD(A_h, B_h, C_h, N, true);
passed();
}