Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit with error code 1 when verification fails #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions src/adam-cuda/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ int main(int argc, char* argv[])

printf("%s\n", ok ? "PASS" : "FAIL");
printf("Checksum: %lf %lf\n", cr / vector_size, cp / vector_size);
if (!ok) exit(1);

free(p);
free(m);
Expand Down
1 change: 1 addition & 0 deletions src/adam-hip/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ int main(int argc, char* argv[])

printf("%s\n", ok ? "PASS" : "FAIL");
printf("Checksum: %lf %lf\n", cr / vector_size, cp / vector_size);
if (!ok) exit(1);

free(p);
free(m);
Expand Down
1 change: 1 addition & 0 deletions src/adam-omp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ int main(int argc, char* argv[])

printf("%s\n", ok ? "PASS" : "FAIL");
printf("Checksum: %lf %lf\n", cr / vector_size, cp / vector_size);
if (!ok) exit(1);

free(p);
free(m);
Expand Down
1 change: 1 addition & 0 deletions src/adam-sycl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ int main(int argc, char* argv[])

printf("%s\n", ok ? "PASS" : "FAIL");
printf("Checksum: %lf %lf\n", cr / vector_size, cp / vector_size);
if (!ok) exit(1);

free(p);
free(m);
Expand Down
4 changes: 3 additions & 1 deletion src/aes-cuda/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ int main(int argc, char * argv[])
/* compare the results and see if they match */
if(memcmp(output, verificationOutput, sizeBytes) == 0)
std::cout<<"Pass\n";
else
else {
std::cout<<"Fail\n";
exit(1);
}

/* release program resources (input memory etc.) */
cudaFree(inputBuffer);
Expand Down
4 changes: 3 additions & 1 deletion src/aes-hip/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ int main(int argc, char * argv[])
/* compare the results and see if they match */
if(memcmp(output, verificationOutput, sizeBytes) == 0)
std::cout<<"Pass\n";
else
else {
std::cout<<"Fail\n";
exit(1);
}

/* release program resources (input memory etc.) */
hipFree(inputBuffer);
Expand Down
4 changes: 3 additions & 1 deletion src/aes-omp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ int main(int argc, char * argv[])
/* compare the results and see if they match */
if(memcmp(output, verificationOutput, sizeBytes) == 0)
std::cout<<"Pass\n";
else
else {
std::cout<<"Fail\n";
exit(1);
}

/* release program resources (input memory etc.) */
if(input) free(input);
Expand Down
4 changes: 3 additions & 1 deletion src/aes-sycl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ int main(int argc, char * argv[])
/* compare the results and see if they match */
if(memcmp(output, verificationOutput, sizeBytes) == 0)
std::cout<<"Pass\n";
else
else {
std::cout<<"Fail\n";
exit(1);
}

sycl::free(inputBuffer, q);
sycl::free(outputBuffer, q);
Expand Down
1 change: 1 addition & 0 deletions src/aidw-cuda/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ int main(int argc, char *argv[])
if (check) {
bool ok = verify (iz.data(), h_iz.data(), inum, EPS);
printf("%s\n", ok ? "PASS" : "FAIL");
if (!ok) exit(1);
}

auto start = std::chrono::steady_clock::now();
Expand Down
1 change: 1 addition & 0 deletions src/aidw-hip/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ int main(int argc, char *argv[])
if (check) {
bool ok = verify (iz.data(), h_iz.data(), inum, EPS);
printf("%s\n", ok ? "PASS" : "FAIL");
if (!ok) exit(1);
}

auto start = std::chrono::steady_clock::now();
Expand Down
1 change: 1 addition & 0 deletions src/aidw-omp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ int main(int argc, char *argv[])
if (check) {
bool ok = verify (iz.data(), h_iz.data(), inum, EPS);
printf("%s\n", ok ? "PASS" : "FAIL");
if (!ok) exit(1);
}

auto start = std::chrono::steady_clock::now();
Expand Down
1 change: 1 addition & 0 deletions src/aidw-sycl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ int main(int argc, char *argv[])
if (check) {
bool ok = verify (iz.data(), h_iz.data(), inum, EPS);
printf("%s\n", ok ? "PASS" : "FAIL");
if (!ok) exit(1);
}

auto start = std::chrono::steady_clock::now();
Expand Down
16 changes: 12 additions & 4 deletions src/all-pairs-distance-cuda/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/o shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");
if (status != 0) {
printf("FAIL\n");
exit(1);
} else {
printf("PASS\n");
}

elapsedTime = 0;
for (int n = 0; n < iterations; n++) {
Expand All @@ -251,8 +255,12 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/ shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");
if (status != 0) {
printf("FAIL\n");
exit(1);
} else {
printf("PASS\n");
}

free(cpu_distance);
free(gpu_distance);
Expand Down
18 changes: 14 additions & 4 deletions src/all-pairs-distance-hip/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,13 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/o shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");
if (status != 0) {
printf("FAIL\n");
exit(1);
}
else {
printf("PASS\n");
}

elapsedTime = 0;
for (int n = 0; n < iterations; n++) {
Expand All @@ -251,8 +256,13 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/ shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");
if (status != 0) {
printf("FAIL\n");
exit(1);
}
else {
printf("PASS\n");
}

free(cpu_distance);
free(gpu_distance);
Expand Down
18 changes: 13 additions & 5 deletions src/all-pairs-distance-omp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,13 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/o shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");

if (status != 0) {
printf("FAIL\n");
exit(1);
} else {
printf("PASS\n");
}

elapsedTime = 0;
for (int n = 0; n < iterations; n++) {
/* shared memory GPU kernel */
Expand Down Expand Up @@ -212,8 +216,12 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/ shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");
if (status != 0) {
printf("FAIL\n");
exit(1);
} else {
printf("PASS\n");
}
}

free(cpu_distance);
Expand Down
18 changes: 14 additions & 4 deletions src/all-pairs-distance-sycl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,13 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/o shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");
if (status != 0) {
printf("FAIL\n");
exit(1);
}
else {
printf("PASS\n");
}

elapsedTime = 0;
for (int n = 0; n < iterations; n++) {
Expand Down Expand Up @@ -244,8 +249,13 @@ int main(int argc, char **argv) {

printf("Average kernel execution time (w/ shared memory): %f (us)\n", elapsedTime / iterations);
status = memcmp(cpu_distance, gpu_distance, INSTANCES * INSTANCES * sizeof(int));
if (status != 0) printf("FAIL\n");
else printf("PASS\n");
if (status != 0) {
printf("FAIL\n");
exit(1);
}
else {
printf("PASS\n");
}

free(cpu_distance);
free(gpu_distance);
Expand Down
2 changes: 2 additions & 0 deletions src/asmooth-cuda/reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ void verify (
printf("Distribution of box sizes:\n");
for (int j = 1; j < MaxRad; j++)
printf("size=%d: %f\n", j, (float)cnt[j]/size);
} else {
exit(1);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/asta-cuda/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ int main(int argc, char **argv) {
// Verify
int status = verify(h_in_out, h_in_backup, tiled_n * p.s, p.m, p.s);
printf("%s\n", (status == 0) ? "PASS" : "FAIL");
if (status != 0) exit(1);

// Free memory
free(h_in_out);
Expand Down
1 change: 1 addition & 0 deletions src/asta-hip/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ int main(int argc, char **argv) {
// Verify
int status = verify(h_in_out, h_in_backup, tiled_n * p.s, p.m, p.s);
printf("%s\n", (status == 0) ? "PASS" : "FAIL");
if (status != 0) exit(1);

// Free memory
free(h_in_out);
Expand Down
1 change: 1 addition & 0 deletions src/asta-omp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ int main(int argc, char **argv) {
// Verify
int status = verify(h_in_out, h_in_backup, tiled_n * p.s, p.m, p.s);
printf("%s\n", (status == 0) ? "PASS" : "FAIL");
if (status != 0) exit(1);

// Free memory
free(h_in_out);
Expand Down
1 change: 1 addition & 0 deletions src/asta-sycl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ int main(int argc, char **argv) {
// Verify
int status = verify(h_in_out, h_in_backup, tiled_n * p.s, p.m, p.s);
printf("%s\n", (status == 0) ? "PASS" : "FAIL");
if (status != 0) exit(1);

// Free memory
free(h_in_out);
Expand Down
8 changes: 6 additions & 2 deletions src/atomicReduction-cuda/reduction.cu
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ int main(int argc, char** argv)

if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
exit(1);
}

t1 = std::chrono::high_resolution_clock::now();
for(int i=0;i<N;i++) {
Expand All @@ -163,8 +165,10 @@ int main(int argc, char** argv)

if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
exit(1);
}
t1 = std::chrono::high_resolution_clock::now();

for(int i=0;i<N;i++) {
Expand Down
23 changes: 15 additions & 8 deletions src/atomicReduction-hip/reduction.cu
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ int main(int argc, char** argv)

if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
exit(1);
}

t1 = std::chrono::high_resolution_clock::now();
for(int i=0;i<N;i++) {
Expand All @@ -163,8 +165,10 @@ int main(int argc, char** argv)

if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
exit(1);
}
t1 = std::chrono::high_resolution_clock::now();

for(int i=0;i<N;i++) {
Expand All @@ -181,8 +185,9 @@ int main(int argc, char** argv)

if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl; exit(1);
}

t1 = std::chrono::high_resolution_clock::now();
for(int i=0;i<N;i++) {
Expand All @@ -199,8 +204,9 @@ int main(int argc, char** argv)

if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl; exit(1);
}

t1 = std::chrono::high_resolution_clock::now();
for(int i=0;i<N;i++) {
Expand All @@ -217,8 +223,9 @@ int main(int argc, char** argv)

if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl; exit(1);
}

hipFree(in);
hipFree(out);
Expand Down
4 changes: 3 additions & 1 deletion src/atomicReduction-omp/reduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ int main(int argc, char** argv)
printf("%d %d\n", sum, checksum);
if(sum==checksum)
std::cout<<"VERIFICATION: result is CORRECT"<<std::endl<<std::endl;
else
else {
std::cout<<"VERIFICATION: result is INCORRECT!!"<<std::endl<<std::endl;
exit(1);
}

t1 = std::chrono::high_resolution_clock::now();
for(int n=0;n<N;n++) {
Expand Down
Loading