diff --git a/src/adam-cuda/main.cu b/src/adam-cuda/main.cu index ada91a2a5..74a70fb4f 100644 --- a/src/adam-cuda/main.cu +++ b/src/adam-cuda/main.cu @@ -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); diff --git a/src/adam-hip/main.cu b/src/adam-hip/main.cu index efcdd20b8..3312efc31 100644 --- a/src/adam-hip/main.cu +++ b/src/adam-hip/main.cu @@ -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); diff --git a/src/adam-omp/main.cpp b/src/adam-omp/main.cpp index d38b7782a..463bd3de8 100644 --- a/src/adam-omp/main.cpp +++ b/src/adam-omp/main.cpp @@ -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); diff --git a/src/adam-sycl/main.cpp b/src/adam-sycl/main.cpp index dd822f4f7..f0ad78c90 100644 --- a/src/adam-sycl/main.cpp +++ b/src/adam-sycl/main.cpp @@ -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); diff --git a/src/aes-cuda/main.cu b/src/aes-cuda/main.cu index daf3d0bc3..7845fa66c 100644 --- a/src/aes-cuda/main.cu +++ b/src/aes-cuda/main.cu @@ -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); diff --git a/src/aes-hip/main.cu b/src/aes-hip/main.cu index 2ed76c110..9182ada5e 100644 --- a/src/aes-hip/main.cu +++ b/src/aes-hip/main.cu @@ -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); diff --git a/src/aes-omp/main.cpp b/src/aes-omp/main.cpp index 105501144..5f07d2381 100644 --- a/src/aes-omp/main.cpp +++ b/src/aes-omp/main.cpp @@ -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); diff --git a/src/aes-sycl/main.cpp b/src/aes-sycl/main.cpp index f0eeb036e..c61ab5982 100644 --- a/src/aes-sycl/main.cpp +++ b/src/aes-sycl/main.cpp @@ -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); diff --git a/src/aidw-cuda/main.cu b/src/aidw-cuda/main.cu index 23f81a678..477bff11a 100644 --- a/src/aidw-cuda/main.cu +++ b/src/aidw-cuda/main.cu @@ -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(); diff --git a/src/aidw-hip/main.cu b/src/aidw-hip/main.cu index bb5531113..dae1326eb 100644 --- a/src/aidw-hip/main.cu +++ b/src/aidw-hip/main.cu @@ -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(); diff --git a/src/aidw-omp/main.cpp b/src/aidw-omp/main.cpp index 6fe12e444..869da34cc 100644 --- a/src/aidw-omp/main.cpp +++ b/src/aidw-omp/main.cpp @@ -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(); diff --git a/src/aidw-sycl/main.cpp b/src/aidw-sycl/main.cpp index 336cf9dc0..1cb034ae7 100644 --- a/src/aidw-sycl/main.cpp +++ b/src/aidw-sycl/main.cpp @@ -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(); diff --git a/src/all-pairs-distance-cuda/main.cu b/src/all-pairs-distance-cuda/main.cu index 8705f556a..7b46b2fe0 100644 --- a/src/all-pairs-distance-cuda/main.cu +++ b/src/all-pairs-distance-cuda/main.cu @@ -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++) { @@ -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); diff --git a/src/all-pairs-distance-hip/main.cu b/src/all-pairs-distance-hip/main.cu index ca78e4b2f..c33d6982e 100644 --- a/src/all-pairs-distance-hip/main.cu +++ b/src/all-pairs-distance-hip/main.cu @@ -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++) { @@ -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); diff --git a/src/all-pairs-distance-omp/main.cpp b/src/all-pairs-distance-omp/main.cpp index 98a288a95..a8a94be7a 100644 --- a/src/all-pairs-distance-omp/main.cpp +++ b/src/all-pairs-distance-omp/main.cpp @@ -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 */ @@ -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); diff --git a/src/all-pairs-distance-sycl/main.cpp b/src/all-pairs-distance-sycl/main.cpp index ef7fa5dcf..9d47a10f3 100644 --- a/src/all-pairs-distance-sycl/main.cpp +++ b/src/all-pairs-distance-sycl/main.cpp @@ -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++) { @@ -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); diff --git a/src/asmooth-cuda/reference.cpp b/src/asmooth-cuda/reference.cpp index d766e3ad6..a004c93a9 100644 --- a/src/asmooth-cuda/reference.cpp +++ b/src/asmooth-cuda/reference.cpp @@ -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); } } diff --git a/src/asta-cuda/main.cu b/src/asta-cuda/main.cu index 99ca6c123..3a23f8b83 100644 --- a/src/asta-cuda/main.cu +++ b/src/asta-cuda/main.cu @@ -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); diff --git a/src/asta-hip/main.cu b/src/asta-hip/main.cu index 91b551889..464bc4f3c 100644 --- a/src/asta-hip/main.cu +++ b/src/asta-hip/main.cu @@ -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); diff --git a/src/asta-omp/main.cpp b/src/asta-omp/main.cpp index d0397a925..445e8fcbd 100644 --- a/src/asta-omp/main.cpp +++ b/src/asta-omp/main.cpp @@ -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); diff --git a/src/asta-sycl/main.cpp b/src/asta-sycl/main.cpp index fcade1d97..bce7bd9b0 100644 --- a/src/asta-sycl/main.cpp +++ b/src/asta-sycl/main.cpp @@ -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); diff --git a/src/atomicReduction-cuda/reduction.cu b/src/atomicReduction-cuda/reduction.cu index d45cee886..7795f1829 100644 --- a/src/atomicReduction-cuda/reduction.cu +++ b/src/atomicReduction-cuda/reduction.cu @@ -145,8 +145,10 @@ int main(int argc, char** argv) if(sum==checksum) std::cout<<"VERIFICATION: result is CORRECT"< max_error) max_error = e; } printf("Maximum error between host and device results: %d\n", max_error); + exit(1); } else { printf("%s\n", "PASS"); diff --git a/src/colorwheel-hip/main.cu b/src/colorwheel-hip/main.cu index 14fa94ded..bdc005ecc 100644 --- a/src/colorwheel-hip/main.cu +++ b/src/colorwheel-hip/main.cu @@ -142,6 +142,7 @@ int main(int argc, char **argv) if (e > max_error) max_error = e; } printf("Maximum error between host and device results: %d\n", max_error); + exit(1); } else { printf("%s\n", "PASS"); diff --git a/src/colorwheel-omp/main.cpp b/src/colorwheel-omp/main.cpp index cf865d1c6..67db39ec9 100644 --- a/src/colorwheel-omp/main.cpp +++ b/src/colorwheel-omp/main.cpp @@ -130,6 +130,7 @@ int main(int argc, char **argv) if (e > max_error) max_error = e; } printf("Maximum error between host and device results: %d\n", max_error); + exit(1); } else { printf("%s\n", "PASS"); diff --git a/src/colorwheel-sycl/main.cpp b/src/colorwheel-sycl/main.cpp index 241c0283a..b2607198a 100644 --- a/src/colorwheel-sycl/main.cpp +++ b/src/colorwheel-sycl/main.cpp @@ -150,11 +150,12 @@ int main(int argc, char **argv) if (e > max_error) max_error = e; } printf("Maximum error between host and device results: %d\n", max_error); + exit(1); } else { printf("%s\n", "PASS"); } - + sycl::free(d_pix, q); free(pix); free(res); diff --git a/src/columnarSolver-cuda/main.cu b/src/columnarSolver-cuda/main.cu index 78154e0ac..63466bf8b 100644 --- a/src/columnarSolver-cuda/main.cu +++ b/src/columnarSolver-cuda/main.cu @@ -140,5 +140,5 @@ int main(int argc, char* argv[]) { cudaFree(devStates); delete[] decrypted; delete[] scoreHistory; - return 0; + return pass ? 0 : 1; } diff --git a/src/columnarSolver-hip/main.cu b/src/columnarSolver-hip/main.cu index 58c7c89a9..c0dffc94b 100644 --- a/src/columnarSolver-hip/main.cu +++ b/src/columnarSolver-hip/main.cu @@ -140,5 +140,5 @@ int main(int argc, char* argv[]) { hipFree(devStates); delete[] decrypted; delete[] scoreHistory; - return 0; + return pass ? 0 : 1; } diff --git a/src/columnarSolver-omp/main.cpp b/src/columnarSolver-omp/main.cpp index e7b829afb..ca0e70673 100644 --- a/src/columnarSolver-omp/main.cpp +++ b/src/columnarSolver-omp/main.cpp @@ -140,5 +140,5 @@ int main(int argc, char* argv[]) { delete[] decrypted; delete[] scoreHistory; - return 0; + return pass ? 0 : 1; } diff --git a/src/columnarSolver-sycl/main.cpp b/src/columnarSolver-sycl/main.cpp index bf8eaf05e..5d8165717 100644 --- a/src/columnarSolver-sycl/main.cpp +++ b/src/columnarSolver-sycl/main.cpp @@ -163,5 +163,5 @@ int main(int argc, char* argv[]) { sycl::free(d_states, q); delete[] decrypted; delete[] scoreHistory; - return 0; + return pass ? 0 : 1; } diff --git a/src/compute-score-cuda/main.cu b/src/compute-score-cuda/main.cu index 6c2bc071e..dbde3ceab 100644 --- a/src/compute-score-cuda/main.cu +++ b/src/compute-score-cuda/main.cu @@ -246,7 +246,7 @@ void runOnCPU() if (cpu_profileScore[doci] != h_profileScore[doci]) { printf("FAILED\n : doc[%d] score: CPU = %lu, Device = %lu\n", \ doci, cpu_profileScore[doci], h_profileScore[doci]); - return; + exit(1); } } printf( "Verification: PASS\n" ); diff --git a/src/compute-score-hip/main.cu b/src/compute-score-hip/main.cu index 110e7134b..2304cf742 100644 --- a/src/compute-score-hip/main.cu +++ b/src/compute-score-hip/main.cu @@ -246,7 +246,7 @@ void runOnCPU() if (cpu_profileScore[doci] != h_profileScore[doci]) { printf("FAILED\n : doc[%d] score: CPU = %lu, Device = %lu\n", \ doci, cpu_profileScore[doci], h_profileScore[doci]); - return; + exit(1); } } printf( "Verification: PASS\n" ); diff --git a/src/compute-score-omp/main.cpp b/src/compute-score-omp/main.cpp index 732fe4fe2..71297c71e 100644 --- a/src/compute-score-omp/main.cpp +++ b/src/compute-score-omp/main.cpp @@ -246,7 +246,7 @@ void runOnCPU() if (cpu_profileScore[doci] != h_profileScore[doci]) { printf("FAILED\n : doc[%d] score: CPU = %lu, Device = %lu\n", \ doci, cpu_profileScore[doci], h_profileScore[doci]); - return; + exit(1); } } printf( "Verification: PASS\n" ); diff --git a/src/compute-score-sycl/main.cpp b/src/compute-score-sycl/main.cpp index ac9160b03..526db0a71 100644 --- a/src/compute-score-sycl/main.cpp +++ b/src/compute-score-sycl/main.cpp @@ -246,7 +246,7 @@ void runOnCPU() if (cpu_profileScore[doci] != h_profileScore[doci]) { printf("FAILED\n : doc[%d] score: CPU = %lu, Device = %lu\n", \ doci, cpu_profileScore[doci], h_profileScore[doci]); - return; + exit(1); } } printf( "Verification: PASS\n" ); diff --git a/src/cooling-cuda/main.cu b/src/cooling-cuda/main.cu index 11934e95c..5d2865e5f 100644 --- a/src/cooling-cuda/main.cu +++ b/src/cooling-cuda/main.cu @@ -189,5 +189,5 @@ int main(int argc, char* argv[]) free(T); free(r); free(h_r); - return 0; + return error ? 1 : 0; } diff --git a/src/cooling-hip/main.cu b/src/cooling-hip/main.cu index 9a54d6fc1..cd835b288 100644 --- a/src/cooling-hip/main.cu +++ b/src/cooling-hip/main.cu @@ -189,5 +189,5 @@ int main(int argc, char* argv[]) free(T); free(r); free(h_r); - return 0; + return error ? 1 : 0; } diff --git a/src/cooling-omp/main.cpp b/src/cooling-omp/main.cpp index 636f52431..a1dd043f6 100644 --- a/src/cooling-omp/main.cpp +++ b/src/cooling-omp/main.cpp @@ -179,5 +179,5 @@ int main(int argc, char* argv[]) free(T); free(h_r); free(d_r); - return 0; + return error ? 1 : 0; } diff --git a/src/cooling-sycl/main.cpp b/src/cooling-sycl/main.cpp index 7e70797a8..30f33660a 100644 --- a/src/cooling-sycl/main.cpp +++ b/src/cooling-sycl/main.cpp @@ -226,5 +226,5 @@ int main(int argc, char* argv[]) free(T); free(r); free(h_r); - return 0; + return error ? 1 : 0; } diff --git a/src/crossEntropy-cuda/main.cu b/src/crossEntropy-cuda/main.cu index 15921e406..6af8e3be8 100644 --- a/src/crossEntropy-cuda/main.cu +++ b/src/crossEntropy-cuda/main.cu @@ -305,6 +305,8 @@ int main(int argc, char** argv) { LossNLL_BWD<__half, __half>(repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); printf("=========== Data type is FP32 ==========\n"); @@ -312,6 +314,8 @@ int main(int argc, char** argv) { LossNLL_BWD(repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); printf("=========== Data type is FP64 ==========\n"); @@ -319,6 +323,8 @@ int main(int argc, char** argv) { LossNLL_BWD(repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); return 0; } diff --git a/src/crossEntropy-hip/main.cu b/src/crossEntropy-hip/main.cu index c51c839c8..141826dd4 100644 --- a/src/crossEntropy-hip/main.cu +++ b/src/crossEntropy-hip/main.cu @@ -305,6 +305,8 @@ int main(int argc, char** argv) { LossNLL_BWD<__half, __half>(repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); printf("=========== Data type is FP32 ==========\n"); @@ -312,6 +314,8 @@ int main(int argc, char** argv) { LossNLL_BWD(repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); printf("=========== Data type is FP64 ==========\n"); @@ -319,6 +323,8 @@ int main(int argc, char** argv) { LossNLL_BWD(repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); return 0; } diff --git a/src/crossEntropy-sycl/main.cpp b/src/crossEntropy-sycl/main.cpp index 1fc5c1989..a2ba52066 100644 --- a/src/crossEntropy-sycl/main.cpp +++ b/src/crossEntropy-sycl/main.cpp @@ -281,6 +281,8 @@ int main(int argc, char** argv) { LossNLL_BWD(q, repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); printf("=========== Data type is FP32 ==========\n"); @@ -288,6 +290,8 @@ int main(int argc, char** argv) { LossNLL_BWD(q, repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); printf("=========== Data type is FP64 ==========\n"); @@ -295,6 +299,8 @@ int main(int argc, char** argv) { LossNLL_BWD(q, repeat); printf("%s\n", (errors == 0) ? "PASS" : "FAIL"); + if (errors) + exit(1); return 0; } diff --git a/src/dct8x8-cuda/main.cu b/src/dct8x8-cuda/main.cu index f3686f55a..589882850 100644 --- a/src/dct8x8-cuda/main.cu +++ b/src/dct8x8-cuda/main.cu @@ -45,10 +45,12 @@ void Verify(const float* h_OutputGPU, } L2norm = sqrt(delta / sum); printf("Relative L2 norm: %.3e\n\n", L2norm); - if (L2norm < 1E-6) - printf("PASS\n"); - else + if (L2norm < 1E-6) + printf("PASS\n"); + else { printf("FAIL\n"); + exit(1); + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/dct8x8-hip/main.cu b/src/dct8x8-hip/main.cu index 3bb863d1f..029e12a40 100644 --- a/src/dct8x8-hip/main.cu +++ b/src/dct8x8-hip/main.cu @@ -25,7 +25,7 @@ void DCT8x8( int dir ); -void Verify(const float* h_OutputGPU, +int Verify(const float* h_OutputGPU, float* h_OutputCPU, const float* h_Input, const unsigned int stride, @@ -45,10 +45,13 @@ void Verify(const float* h_OutputGPU, } L2norm = sqrt(delta / sum); printf("Relative L2 norm: %.3e\n\n", L2norm); - if (L2norm < 1E-6) + if (L2norm < 1E-6) { printf("PASS\n"); - else + return 0; + } else { printf("FAIL\n"); + return 1; + } } //////////////////////////////////////////////////////////////////////////////// @@ -107,7 +110,8 @@ int main(int argc, char **argv) hipMemcpy(h_OutputGPU, d_Output, sizeof(float) * imageH * stride, hipMemcpyDeviceToHost); - Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir); + if (Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir) != 0) + exit(1); printf("Performing Inverse DCT8x8 of %u x %u image on the device\n\n", imageH, imageW); @@ -131,7 +135,8 @@ int main(int argc, char **argv) hipMemcpy(h_OutputGPU, d_Output, sizeof(float) * imageH * stride, hipMemcpyDeviceToHost); - Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir); + if (Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir) != 0) + exit(1); hipFree(d_Input); hipFree(d_Output); diff --git a/src/dct8x8-omp/main.cpp b/src/dct8x8-omp/main.cpp index 7b1035924..1e8cf95c5 100644 --- a/src/dct8x8-omp/main.cpp +++ b/src/dct8x8-omp/main.cpp @@ -47,8 +47,10 @@ void Verify(const float* h_OutputGPU, printf("Relative L2 norm: %.3e\n\n", L2norm); if (L2norm < 1E-6) printf("PASS\n"); - else + else { printf("FAIL\n"); + exit(1); + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/dct8x8-sycl/main.cpp b/src/dct8x8-sycl/main.cpp index ea1e6da40..5ce11d0fb 100644 --- a/src/dct8x8-sycl/main.cpp +++ b/src/dct8x8-sycl/main.cpp @@ -26,7 +26,7 @@ void DCT8x8( int dir ); -void Verify(const float* h_OutputGPU, +int Verify(const float* h_OutputGPU, float* h_OutputCPU, const float* h_Input, const unsigned int stride, @@ -46,10 +46,13 @@ void Verify(const float* h_OutputGPU, } L2norm = std::sqrt(delta / sum); printf("Relative L2 norm: %.3e\n\n", L2norm); - if (L2norm < 1E-6) - printf("PASS\n"); - else + if (L2norm < 1E-6) { + printf("PASS\n"); + return 0; + } else { printf("FAIL\n"); + return 1; + } } //////////////////////////////////////////////////////////////////////////////// @@ -111,7 +114,8 @@ int main(int argc, char **argv) q.memcpy(h_OutputGPU, d_Output, sizeof(float) * imageH * stride).wait(); - Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir); + if (Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir) != 0) + exit(1); printf("Performing Inverse DCT8x8 of %u x %u image on the device\n\n", imageH, imageW); @@ -136,7 +140,8 @@ int main(int argc, char **argv) q.memcpy(h_OutputGPU, d_Output, sizeof(float) * imageH * stride).wait(); - Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir); + if (Verify(h_OutputGPU, h_OutputCPU, h_Input, stride, imageH, imageW, dir) != 0) + exit(1); free(h_OutputGPU); free(h_OutputCPU); diff --git a/src/diamond-hip/masking.cu b/src/diamond-hip/masking.cu index 1b3ee8cd4..8be6df980 100644 --- a/src/diamond-hip/masking.cu +++ b/src/diamond-hip/masking.cu @@ -430,5 +430,8 @@ void mask_seqs(Sequence_set &seqs, const Masking &masking, bool hard_mask) } p += seqs.length(i); } - if (error == 0) printf("Success\n"); + if (error == 0) + printf("Success\n"); + else + printf("Failure\n"); } diff --git a/src/eigenvalue-cuda/main.cu b/src/eigenvalue-cuda/main.cu index aaf02b829..a64fd747d 100644 --- a/src/eigenvalue-cuda/main.cu +++ b/src/eigenvalue-cuda/main.cu @@ -263,6 +263,7 @@ int main(int argc, char * argv[]) else { std::cout<<"FAIL\n" << std::endl; + exit(1); } // release program resources diff --git a/src/eigenvalue-hip/main.cu b/src/eigenvalue-hip/main.cu index fe242ea08..f2d5602c5 100644 --- a/src/eigenvalue-hip/main.cu +++ b/src/eigenvalue-hip/main.cu @@ -263,6 +263,7 @@ int main(int argc, char * argv[]) else { std::cout<<"FAIL\n" << std::endl; + exit(1); } // release program resources diff --git a/src/eigenvalue-omp/main.cpp b/src/eigenvalue-omp/main.cpp index 586f6c866..1ee720360 100644 --- a/src/eigenvalue-omp/main.cpp +++ b/src/eigenvalue-omp/main.cpp @@ -264,6 +264,7 @@ int main(int argc, char * argv[]) else { std::cout<<"FAIL\n" << std::endl; + exit(1); } // release program resources diff --git a/src/eigenvalue-sycl/main.cpp b/src/eigenvalue-sycl/main.cpp index eea67ce2d..2b62f999d 100644 --- a/src/eigenvalue-sycl/main.cpp +++ b/src/eigenvalue-sycl/main.cpp @@ -285,6 +285,7 @@ int main(int argc, char * argv[]) else { std::cout<<"FAIL\n" << std::endl; + exit(1); } // release program resources diff --git a/src/entropy-cuda/main.cu b/src/entropy-cuda/main.cu index 3d54ed880..cf73783ea 100644 --- a/src/entropy-cuda/main.cu +++ b/src/entropy-cuda/main.cu @@ -163,9 +163,9 @@ int main(int argc, char* argv[]) { if (!ok) break; } printf("%s\n", ok ? "PASS" : "FAIL"); - + free(input); free(output); free(output_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/entropy-hip/main.cu b/src/entropy-hip/main.cu index 0d9845d6e..01d72ba24 100644 --- a/src/entropy-hip/main.cu +++ b/src/entropy-hip/main.cu @@ -167,5 +167,5 @@ int main(int argc, char* argv[]) { free(input); free(output); free(output_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/entropy-omp/main.cpp b/src/entropy-omp/main.cpp index 273fb27df..e3968ac44 100644 --- a/src/entropy-omp/main.cpp +++ b/src/entropy-omp/main.cpp @@ -160,5 +160,5 @@ int main(int argc, char* argv[]) { free(input); free(output); free(output_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/entropy-sycl/main.cpp b/src/entropy-sycl/main.cpp index ddcdb09d7..0679f16ee 100644 --- a/src/entropy-sycl/main.cpp +++ b/src/entropy-sycl/main.cpp @@ -160,5 +160,5 @@ int main(int argc, char* argv[]) { free(input); free(output); free(output_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/f16max-cuda/main.cu b/src/f16max-cuda/main.cu index 758b25137..ebe56de00 100644 --- a/src/f16max-cuda/main.cu +++ b/src/f16max-cuda/main.cu @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) cudaMemcpy(r, d_r, size_bytes, cudaMemcpyDeviceToHost); // verify - ok = true; + bool ok2 = true; for (size_t i = 0; i < size; ++i) { float2 fa = __half22float2(a[i]); @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) float x = fmaxf(fa.x, fb.x); float y = fmaxf(fa.y, fb.y); if (fabsf(fr.x - x) > 1e-3 || fabsf(fr.y - y) > 1e-3) { - ok = false; + ok2 = false; break; } } @@ -162,5 +162,5 @@ int main(int argc, char *argv[]) free(b); free(r); - return EXIT_SUCCESS; + return (ok && ok2) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/src/f16max-hip/main.cu b/src/f16max-hip/main.cu index 036b281bd..57aeb36ca 100644 --- a/src/f16max-hip/main.cu +++ b/src/f16max-hip/main.cu @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) hipMemcpy(r, d_r, size_bytes, hipMemcpyDeviceToHost); // verify - ok = true; + bool ok2 = true; for (size_t i = 0; i < size; ++i) { float2 fa = __half22float2(a[i]); @@ -148,12 +148,12 @@ int main(int argc, char *argv[]) float x = fmaxf(fa.x, fb.x); float y = fmaxf(fa.y, fb.y); if (fabsf(fr.x - x) > 1e-3 || fabsf(fr.y - y) > 1e-3) { - ok = false; + ok2 = false; break; } } - printf("fp16_hmax %s\n", ok ? "PASS" : "FAIL"); + printf("fp16_hmax %s\n", ok2 ? "PASS" : "FAIL"); hipFree(d_a); hipFree(d_b); @@ -162,5 +162,5 @@ int main(int argc, char *argv[]) free(b); free(r); - return EXIT_SUCCESS; + return (ok && ok2) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/src/f16max-sycl/main.cpp b/src/f16max-sycl/main.cpp index 00ab8e8d8..d916fafbd 100644 --- a/src/f16max-sycl/main.cpp +++ b/src/f16max-sycl/main.cpp @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) // verify q.memcpy(r, d_r, size_bytes).wait(); - ok = true; + bool ok2 = true; for (size_t i = 0; i < size; ++i) { sycl::float2 fa = a[i].convert(); @@ -191,12 +191,12 @@ int main(int argc, char *argv[]) float x = fmaxf(fa.x(), fb.x()); float y = fmaxf(fa.y(), fb.y()); if (fabsf(fr.x() - x) > 1e-3 || fabsf(fr.y() - y) > 1e-3) { - ok = false; + ok2 = false; break; } } - printf("fp16_hmax %s\n", ok ? "PASS" : "FAIL"); + printf("fp16_hmax %s\n", ok2 ? "PASS" : "FAIL"); sycl::free(d_a, q); sycl::free(d_b, q); @@ -205,5 +205,5 @@ int main(int argc, char *argv[]) free(b); free(r); - return EXIT_SUCCESS; + return (ok && ok2) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/src/fft-cuda/main.cu b/src/fft-cuda/main.cu index fca2babe0..549da985c 100644 --- a/src/fft-cuda/main.cu +++ b/src/fft-cuda/main.cu @@ -188,4 +188,5 @@ int main(int argc, char** argv) std::cout << (error ? "FAIL" : "PASS") << std::endl; free(reference); free(source); + return error ? 1 : 0; } diff --git a/src/fft-hip/main.cu b/src/fft-hip/main.cu index 6337b3134..c0d006c7a 100644 --- a/src/fft-hip/main.cu +++ b/src/fft-hip/main.cu @@ -193,5 +193,6 @@ int main(int argc, char** argv) free(reference); free(source); + return error ? 1 : 0; } diff --git a/src/fft-omp/main.cpp b/src/fft-omp/main.cpp index 52e3d5176..5398efabd 100644 --- a/src/fft-omp/main.cpp +++ b/src/fft-omp/main.cpp @@ -347,4 +347,5 @@ int main(int argc, char** argv) std::cout << (error ? "FAIL" : "PASS") << std::endl; free(reference); free(source); + return error ? 1 : 0; } diff --git a/src/fft-sycl/main.cpp b/src/fft-sycl/main.cpp index 275596f89..617eefd9c 100644 --- a/src/fft-sycl/main.cpp +++ b/src/fft-sycl/main.cpp @@ -203,4 +203,5 @@ int main(int argc, char** argv) std::cout << (error ? "FAIL" : "PASS") << std::endl; free(reference); free(source); + return error ? 1 : 0; } diff --git a/src/floydwarshall-cuda/main.cu b/src/floydwarshall-cuda/main.cu index ad7e5c24b..8bc5d8b57 100644 --- a/src/floydwarshall-cuda/main.cu +++ b/src/floydwarshall-cuda/main.cu @@ -265,7 +265,8 @@ int main(int argc, char** argv) { // verify floydWarshallCPUReference(verificationPathDistanceMatrix, verificationPathMatrix, numNodes); - if(memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, matrixSizeBytes) == 0) + int verify = memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, matrixSizeBytes); + if (verify == 0) { printf("PASS\n"); } @@ -291,5 +292,5 @@ int main(int argc, char** argv) { free(pathMatrix); free(verificationPathDistanceMatrix); free(verificationPathMatrix); - return 0; + return (verify == 0) ? 0 : 1; } diff --git a/src/floydwarshall-hip/main.cu b/src/floydwarshall-hip/main.cu index 7c79c5bd0..2958844d5 100644 --- a/src/floydwarshall-hip/main.cu +++ b/src/floydwarshall-hip/main.cu @@ -265,7 +265,8 @@ int main(int argc, char** argv) { // verify floydWarshallCPUReference(verificationPathDistanceMatrix, verificationPathMatrix, numNodes); - if(memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, matrixSizeBytes) == 0) + int verify = memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, matrixSizeBytes); + if (verify == 0) { printf("PASS\n"); } @@ -291,5 +292,5 @@ int main(int argc, char** argv) { free(pathMatrix); free(verificationPathDistanceMatrix); free(verificationPathMatrix); - return 0; + return (verify == 0) ? 0 : 1; } diff --git a/src/floydwarshall-omp/main.cpp b/src/floydwarshall-omp/main.cpp index 4ece2303a..86bc76cf7 100644 --- a/src/floydwarshall-omp/main.cpp +++ b/src/floydwarshall-omp/main.cpp @@ -246,8 +246,9 @@ int main(int argc, char** argv) { // verify floydWarshallCPUReference(verificationPathDistanceMatrix, verificationPathMatrix, numNodes); - if(memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, - numNodes*numNodes*sizeof(unsigned int)) == 0) + int verify = memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, + numNodes * numNodes * sizeof(unsigned int)); + if(verify == 0) { printf("PASS\n"); } @@ -273,5 +274,5 @@ int main(int argc, char** argv) { free(pathMatrix); free(verificationPathDistanceMatrix); free(verificationPathMatrix); - return 0; + return (verify == 0) ? 0 : 1; } diff --git a/src/floydwarshall-sycl/main.cpp b/src/floydwarshall-sycl/main.cpp index cd4655219..91966d32c 100644 --- a/src/floydwarshall-sycl/main.cpp +++ b/src/floydwarshall-sycl/main.cpp @@ -267,8 +267,9 @@ int main(int argc, char** argv) { // verify floydWarshallCPUReference(verificationPathDistanceMatrix, verificationPathMatrix, numNodes); - if(memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, - numNodes*numNodes*sizeof(unsigned int)) == 0) + int verify = memcmp(pathDistanceMatrix, verificationPathDistanceMatrix, + numNodes*numNodes*sizeof(unsigned int)); + if (verify == 0) { printf("PASS\n"); } @@ -294,5 +295,5 @@ int main(int argc, char** argv) { free(pathMatrix); free(verificationPathDistanceMatrix); free(verificationPathMatrix); - return 0; + return (verify==0) ? 0 : 1; } diff --git a/src/fresnel-cuda/main.cu b/src/fresnel-cuda/main.cu index eba9b63a8..385b4c00b 100644 --- a/src/fresnel-cuda/main.cu +++ b/src/fresnel-cuda/main.cu @@ -80,5 +80,5 @@ int main(int argc, char *argv[]) free(x); free(output); free(h_output); - return 0; + return ok ? 0 : 1; } diff --git a/src/fresnel-hip/main.cu b/src/fresnel-hip/main.cu index 2c3b3a34b..20ce8b262 100644 --- a/src/fresnel-hip/main.cu +++ b/src/fresnel-hip/main.cu @@ -80,5 +80,5 @@ int main(int argc, char *argv[]) free(x); free(output); free(h_output); - return 0; + return ok ? 0 : 1; } diff --git a/src/fresnel-omp/main.cpp b/src/fresnel-omp/main.cpp index e667e294c..1974b8608 100644 --- a/src/fresnel-omp/main.cpp +++ b/src/fresnel-omp/main.cpp @@ -61,5 +61,5 @@ int main(int argc, char *argv[]) free(x); free(output); free(h_output); - return 0; + return ok ? 0 : 1; } diff --git a/src/fresnel-sycl/main.cpp b/src/fresnel-sycl/main.cpp index da0666d9f..3d57074c6 100644 --- a/src/fresnel-sycl/main.cpp +++ b/src/fresnel-sycl/main.cpp @@ -81,5 +81,5 @@ int main(int argc, char *argv[]) free(x); free(output); free(h_output); - return 0; + return ok ? 0 : 1; } diff --git a/src/fsm-cuda/main.cu b/src/fsm-cuda/main.cu index a2b8cc3c2..dcfb570ee 100644 --- a/src/fsm-cuda/main.cu +++ b/src/fsm-cuda/main.cu @@ -180,5 +180,5 @@ int main(int argc, char *argv[]) cudaFree(d_smax); cudaFree(d_sbest); cudaFree(d_oldmax); - return 0; + return ok ? 0 : 1; } diff --git a/src/fsm-hip/main.cu b/src/fsm-hip/main.cu index 5b6d61d7f..781f47ed3 100644 --- a/src/fsm-hip/main.cu +++ b/src/fsm-hip/main.cu @@ -180,5 +180,5 @@ int main(int argc, char *argv[]) hipFree(d_smax); hipFree(d_sbest); hipFree(d_oldmax); - return 0; + return ok ? 0 : 1; } diff --git a/src/fsm-omp/main.cpp b/src/fsm-omp/main.cpp index 7afda4b0b..964e13b42 100644 --- a/src/fsm-omp/main.cpp +++ b/src/fsm-omp/main.cpp @@ -178,5 +178,5 @@ int main(int argc, char *argv[]) free(smax); free(sbest); free(oldmax); - return 0; + return ok ? 0 : 1; } diff --git a/src/fsm-sycl/main.cpp b/src/fsm-sycl/main.cpp index d9f45dcd7..faab66158 100644 --- a/src/fsm-sycl/main.cpp +++ b/src/fsm-sycl/main.cpp @@ -207,5 +207,5 @@ int main(int argc, char *argv[]) sycl::free(d_smax, q); sycl::free(d_sbest, q); sycl::free(d_oldmax, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/gaussian-cuda/gaussianElim.cu b/src/gaussian-cuda/gaussianElim.cu index 0dd4e4743..fea271de9 100644 --- a/src/gaussian-cuda/gaussianElim.cu +++ b/src/gaussian-cuda/gaussianElim.cu @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) { free(m_host); free(b_host); free(finalVec_host); - return 0; + return ok ? 0 : 1; } __global__ void diff --git a/src/gaussian-hip/gaussianElim.cu b/src/gaussian-hip/gaussianElim.cu index 81e73b92c..6943b138c 100644 --- a/src/gaussian-hip/gaussianElim.cu +++ b/src/gaussian-hip/gaussianElim.cu @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) { free(m_host); free(b_host); free(finalVec_host); - return 0; + return ok ? 0 : 1; } __global__ void diff --git a/src/gaussian-omp/gaussianElim.cpp b/src/gaussian-omp/gaussianElim.cpp index 515d57b08..b48c93971 100644 --- a/src/gaussian-omp/gaussianElim.cpp +++ b/src/gaussian-omp/gaussianElim.cpp @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) { free(m_host); free(b_host); free(finalVec_host); - return 0; + return ok ? 0 : 1; } /*------------------------------------------------------ diff --git a/src/gaussian-sycl/gaussianElim.cpp b/src/gaussian-sycl/gaussianElim.cpp index bad34dfb0..00cadf052 100644 --- a/src/gaussian-sycl/gaussianElim.cpp +++ b/src/gaussian-sycl/gaussianElim.cpp @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) { free(m_host); free(b_host); free(finalVec_host); - return 0; + return ok ? 0 : 1; } /*------------------------------------------------------ diff --git a/src/goulash-cuda/main.cu b/src/goulash-cuda/main.cu index ed8e88cfb..bd0f533da 100644 --- a/src/goulash-cuda/main.cu +++ b/src/goulash-cuda/main.cu @@ -120,5 +120,5 @@ int main(int argc, char* argv[]) if (m_gate != NULL) free(m_gate); if (m_gate_h != NULL) free(m_gate_h); if (Vm != NULL) free(Vm); - return 0; + return ok ? 0 : 1; } diff --git a/src/goulash-hip/main.cu b/src/goulash-hip/main.cu index 4abb892e6..1933c32ed 100644 --- a/src/goulash-hip/main.cu +++ b/src/goulash-hip/main.cu @@ -120,5 +120,5 @@ int main(int argc, char* argv[]) if (m_gate != NULL) free(m_gate); if (m_gate_h != NULL) free(m_gate_h); if (Vm != NULL) free(Vm); - return 0; + return ok ? 0 : 1; } diff --git a/src/goulash-omp/main.cpp b/src/goulash-omp/main.cpp index 584a536ad..133d51603 100644 --- a/src/goulash-omp/main.cpp +++ b/src/goulash-omp/main.cpp @@ -103,5 +103,5 @@ int main(int argc, char* argv[]) if (m_gate != NULL) free(m_gate); if (m_gate_h != NULL) free(m_gate_h); if (Vm != NULL) free(Vm); - return 0; + return ok ? 0 : 1; } diff --git a/src/goulash-sycl/main.cpp b/src/goulash-sycl/main.cpp index 53986cdc0..c3c43c89e 100644 --- a/src/goulash-sycl/main.cpp +++ b/src/goulash-sycl/main.cpp @@ -126,5 +126,5 @@ int main(int argc, char* argv[]) if (m_gate != NULL) free(m_gate); if (m_gate_h != NULL) free(m_gate_h); if (Vm != NULL) free(Vm); - return 0; + return ok ? 0 : 1; } diff --git a/src/haccmk-cuda/haccmk.cu b/src/haccmk-cuda/haccmk.cu index e37a60411..6b4e31d08 100644 --- a/src/haccmk-cuda/haccmk.cu +++ b/src/haccmk-cuda/haccmk.cu @@ -276,5 +276,5 @@ int main( int argc, char *argv[] ) printf("%s\n", error ? "FAIL" : "PASS"); - return 0; + return error ? 1 : 0; } diff --git a/src/haccmk-hip/haccmk.cu b/src/haccmk-hip/haccmk.cu index 35ae985bb..784447d3b 100644 --- a/src/haccmk-hip/haccmk.cu +++ b/src/haccmk-hip/haccmk.cu @@ -276,5 +276,5 @@ int main( int argc, char *argv[] ) printf("%s\n", error ? "FAIL" : "PASS"); - return 0; + return error ? 1 : 0; } diff --git a/src/haccmk-omp/haccmk.cpp b/src/haccmk-omp/haccmk.cpp index 16f9a45b9..25714ca35 100644 --- a/src/haccmk-omp/haccmk.cpp +++ b/src/haccmk-omp/haccmk.cpp @@ -233,5 +233,5 @@ int main( int argc, char *argv[] ) printf("%s\n", error ? "FAIL" : "PASS"); - return 0; + return error ? 1 : 0; } diff --git a/src/haccmk-sycl/haccmk.cpp b/src/haccmk-sycl/haccmk.cpp index c6d444097..e7567f50a 100644 --- a/src/haccmk-sycl/haccmk.cpp +++ b/src/haccmk-sycl/haccmk.cpp @@ -277,7 +277,7 @@ int main( int argc, char *argv[] ) printf("%s\n", error ? "FAIL" : "PASS"); - return 0; + return error ? 1 : 0; } diff --git a/src/hausdorff-cuda/main.cu b/src/hausdorff-cuda/main.cu index 97027367b..45efec2f2 100644 --- a/src/hausdorff-cuda/main.cu +++ b/src/hausdorff-cuda/main.cu @@ -121,5 +121,5 @@ int main(int argc, char* argv[]) { cudaFree(d_distance); cudaFree(d_Apoints); cudaFree(d_Bpoints); - return 0; + return error ? 1 : 0; } diff --git a/src/hausdorff-hip/main.cu b/src/hausdorff-hip/main.cu index 1ae01be04..eeb2b3264 100644 --- a/src/hausdorff-hip/main.cu +++ b/src/hausdorff-hip/main.cu @@ -109,5 +109,5 @@ int main(int argc, char* argv[]) { hipFree(d_distance); hipFree(d_Apoints); hipFree(d_Bpoints); - return 0; + return error ? 1 : 0; } diff --git a/src/hausdorff-omp/main.cpp b/src/hausdorff-omp/main.cpp index 00fba3c5a..acff866a3 100644 --- a/src/hausdorff-omp/main.cpp +++ b/src/hausdorff-omp/main.cpp @@ -95,5 +95,5 @@ int main(int argc, char* argv[]) { free(h_Apoints); free(h_Bpoints); - return 0; + return error ? 1 : 0; } diff --git a/src/hausdorff-sycl/main.cpp b/src/hausdorff-sycl/main.cpp index 5f2d1d8b8..403730fbc 100644 --- a/src/hausdorff-sycl/main.cpp +++ b/src/hausdorff-sycl/main.cpp @@ -136,5 +136,5 @@ int main(int argc, char* argv[]) { sycl::free(d_distance, q); sycl::free(d_Apoints, q); sycl::free(d_Bpoints, q); - return 0; + return error ? 1 : 0; } diff --git a/src/heat2d-hip/main.cu b/src/heat2d-hip/main.cu index f59ef002d..b3024c95c 100644 --- a/src/heat2d-hip/main.cu +++ b/src/heat2d-hip/main.cu @@ -168,5 +168,5 @@ main(int argc, char *argv[]) { free(cpu_arr); free(gpu_arr); - return 0; + return ok ? 0 : 1; } diff --git a/src/heat2d-sycl/main.cpp b/src/heat2d-sycl/main.cpp index f424a81c7..588bc80e5 100644 --- a/src/heat2d-sycl/main.cpp +++ b/src/heat2d-sycl/main.cpp @@ -167,5 +167,5 @@ int main(int argc, char *argv[]) { free(cpu_arr); free(gpu_arr); - return 0; + return ok ? 0 : 1; } diff --git a/src/hellinger-cuda/main.cu b/src/hellinger-cuda/main.cu index 5c3fe9853..286ba5bd6 100644 --- a/src/hellinger-cuda/main.cu +++ b/src/hellinger-cuda/main.cu @@ -119,8 +119,9 @@ int main(int argc, char** argv) std::cout << "Problem size: c(" << M << "," << P << ") = a(" << M << "," << N << ") * b(" << N << "," << P << ")\n"; + bool ok = true; #ifdef VERIFY - VerifyResult(a_host, b_host, c_host, c_back); + ok = VerifyResult(a_host, b_host, c_host, c_back); #endif delete[] a_host; @@ -130,5 +131,5 @@ int main(int argc, char** argv) cudaFree(a_device); cudaFree(b_device); cudaFree(c_device); - return 0; + return ok ? 0 : 1; } diff --git a/src/hellinger-cuda/verify.h b/src/hellinger-cuda/verify.h index 337b4375b..0bc3f66e3 100644 --- a/src/hellinger-cuda/verify.h +++ b/src/hellinger-cuda/verify.h @@ -8,7 +8,7 @@ bool ValueSame(FP a, FP b) { return FABS(a - b) < std::numeric_limits::epsilon(); } -void VerifyResult(FP (*a_host)[N], FP (*b_host)[P], +bool VerifyResult(FP (*a_host)[N], FP (*b_host)[P], FP (*c_host)[P], FP (*c_back)[P]) { // Check that the results are correct by comparing with host computing. int i, j, k; @@ -55,8 +55,10 @@ void VerifyResult(FP (*a_host)[N], FP (*b_host)[P], if (!mismatch_found) { std::cout << "PASS\n"; + return true; } else { std::cout << "FAIL\n"; + return false; } } #endif diff --git a/src/hellinger-hip/main.cu b/src/hellinger-hip/main.cu index 9ef80d58f..5795dc973 100644 --- a/src/hellinger-hip/main.cu +++ b/src/hellinger-hip/main.cu @@ -119,8 +119,9 @@ int main(int argc, char** argv) std::cout << "Problem size: c(" << M << "," << P << ") = a(" << M << "," << N << ") * b(" << N << "," << P << ")\n"; + bool ok = true; #ifdef VERIFY - VerifyResult(a_host, b_host, c_host, c_back); + ok = VerifyResult(a_host, b_host, c_host, c_back); #endif delete[] a_host; @@ -130,5 +131,5 @@ int main(int argc, char** argv) hipFree(a_device); hipFree(b_device); hipFree(c_device); - return 0; + return ok ? 0 : 1; } diff --git a/src/hellinger-omp/main.cpp b/src/hellinger-omp/main.cpp index c4548c3a3..335982684 100644 --- a/src/hellinger-omp/main.cpp +++ b/src/hellinger-omp/main.cpp @@ -95,13 +95,14 @@ int main(int argc, char** argv) std::cout << "Average kernel execution time " << (time * 1e-9f) / repeat << " (s)\n"; } + bool ok = true; #ifdef VERIFY - VerifyResult(a_host, b_host, c_host, c_back); + ok = VerifyResult(a_host, b_host, c_host, c_back); #endif delete[] a_host; delete[] b_host; delete[] c_host; delete[] c_back; - return 0; + return ok ? 0 : 1; } diff --git a/src/hellinger-sycl/main.cpp b/src/hellinger-sycl/main.cpp index 3c73e8aeb..e9ea504e1 100644 --- a/src/hellinger-sycl/main.cpp +++ b/src/hellinger-sycl/main.cpp @@ -120,8 +120,9 @@ int main(int argc, char** argv) q.memcpy(c_back, d_c, sizeof(int)*M*P).wait(); + bool ok = true; #ifdef VERIFY - VerifyResult(h_a, h_b, h_c, c_back); + ok = VerifyResult(h_a, h_b, h_c, c_back); #endif delete[] h_a; @@ -131,5 +132,5 @@ int main(int argc, char** argv) sycl::free(d_a, q); sycl::free(d_b, q); sycl::free(d_c, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/hogbom-cuda/main.cpp b/src/hogbom-cuda/main.cpp index a7cf20644..f481474fc 100644 --- a/src/hogbom-cuda/main.cpp +++ b/src/hogbom-cuda/main.cpp @@ -80,11 +80,14 @@ int main(int argc, char* argv[]) device.deconvolve(dirty, dim, psf, psfDim, deviceModel, deviceResidual); } + bool ok = true; + #ifdef VERIFY std::cout << "Verifying model..."; const bool modelDiff = compare(goldenModel, deviceModel); if (!modelDiff) { std::cout << "FAIL" << std::endl; + ok = false; } else { std::cout << "PASS" << std::endl; } @@ -93,10 +96,11 @@ int main(int argc, char* argv[]) const bool residualDiff = compare(goldenResidual, deviceResidual); if (!residualDiff) { std::cout << "FAIL" << std::endl; + ok = false; } else { std::cout << "PASS" << std::endl; } #endif - return 0; + return ok ? 0 : 1; } diff --git a/src/hwt1d-cuda/main.cu b/src/hwt1d-cuda/main.cu index 46c132888..781439a0d 100644 --- a/src/hwt1d-cuda/main.cu +++ b/src/hwt1d-cuda/main.cu @@ -120,5 +120,5 @@ int main(int argc, char * argv[]) else std::cout << "FAIL" << std::endl; - return 0; + return ok ? 0 : 1; } diff --git a/src/hwt1d-hip/main.cu b/src/hwt1d-hip/main.cu index b7a6d2a85..98190c7f5 100644 --- a/src/hwt1d-hip/main.cu +++ b/src/hwt1d-hip/main.cu @@ -120,5 +120,5 @@ int main(int argc, char * argv[]) else std::cout << "FAIL" << std::endl; - return 0; + return ok ? 0 : 1; } diff --git a/src/hwt1d-omp/main.cpp b/src/hwt1d-omp/main.cpp index 128bdf021..a411ae17f 100644 --- a/src/hwt1d-omp/main.cpp +++ b/src/hwt1d-omp/main.cpp @@ -240,5 +240,5 @@ int main(int argc, char * argv[]) else std::cout << "FAIL" << std::endl; - return 0; + return ok ? 0 : 1; } diff --git a/src/hwt1d-sycl/main.cpp b/src/hwt1d-sycl/main.cpp index 2cfacb525..4bf9c8ee1 100644 --- a/src/hwt1d-sycl/main.cpp +++ b/src/hwt1d-sycl/main.cpp @@ -120,6 +120,6 @@ int main(int argc, char * argv[]) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; - - return 0; + + return ok ? 0 : 1; } diff --git a/src/hybridsort-cuda/hybridsort.cu b/src/hybridsort-cuda/hybridsort.cu index 42852e1d3..b223285a3 100644 --- a/src/hybridsort-cuda/hybridsort.cu +++ b/src/hybridsort-cuda/hybridsort.cu @@ -179,7 +179,7 @@ int main(int argc, char** argv) free(nullElements); free(origOffsets); - return 0; + return (count == 0) ? 0 : 1; } diff --git a/src/hybridsort-hip/hybridsort.cu b/src/hybridsort-hip/hybridsort.cu index 42852e1d3..b223285a3 100644 --- a/src/hybridsort-hip/hybridsort.cu +++ b/src/hybridsort-hip/hybridsort.cu @@ -179,7 +179,7 @@ int main(int argc, char** argv) free(nullElements); free(origOffsets); - return 0; + return (count == 0) ? 0 : 1; } diff --git a/src/hybridsort-omp/hybridsort.c b/src/hybridsort-omp/hybridsort.c index edd3ea6fd..d5d32482f 100644 --- a/src/hybridsort-omp/hybridsort.c +++ b/src/hybridsort-omp/hybridsort.c @@ -178,7 +178,7 @@ int main(int argc, char** argv) free(nullElements); free(origOffsets); - return 0; + return (count == 0) ? 0 : 1; } diff --git a/src/hybridsort-sycl/hybridsort.c b/src/hybridsort-sycl/hybridsort.c index c6513ac90..ba2f93e90 100644 --- a/src/hybridsort-sycl/hybridsort.c +++ b/src/hybridsort-sycl/hybridsort.c @@ -186,5 +186,5 @@ int main(int argc, char** argv) free(nullElements); free(origOffsets); - return 0; + return (count == 0) ? 0 : 1; } diff --git a/src/is-cuda/main.cu b/src/is-cuda/main.cu index b715203b4..cd3bda29e 100644 --- a/src/is-cuda/main.cu +++ b/src/is-cuda/main.cu @@ -356,5 +356,5 @@ int main(int argc, char** argv){ cudaFree(passed_verification_device); cudaFree(sum_device); - return 0; + return passed_verification ? 0 : 1; } diff --git a/src/is-hip/main.cu b/src/is-hip/main.cu index 348fef1df..f463278f2 100644 --- a/src/is-hip/main.cu +++ b/src/is-hip/main.cu @@ -342,5 +342,5 @@ int main(int argc, char** argv){ hipFree(passed_verification_device); hipFree(sum_device); - return 0; + return passed_verification ? 0 : 1; } diff --git a/src/is-sycl/main.cpp b/src/is-sycl/main.cpp index de8beac8a..66f0f84ea 100644 --- a/src/is-sycl/main.cpp +++ b/src/is-sycl/main.cpp @@ -434,5 +434,5 @@ int main(int argc, char** argv){ sycl::free(passed_verification_device, q); sycl::free(sum_device, q); - return 0; + return passed_verification ? 0 : 1; } diff --git a/src/jenkins-hash-cuda/main.cu b/src/jenkins-hash-cuda/main.cu index ddb05c646..90e779568 100644 --- a/src/jenkins-hash-cuda/main.cu +++ b/src/jenkins-hash-cuda/main.cu @@ -315,5 +315,5 @@ int main(int argc, char** argv) { free(initvals); free(out); - return 0; + return error ? 1 : 0; } diff --git a/src/jenkins-hash-hip/main.cu b/src/jenkins-hash-hip/main.cu index 63553c424..fdbfb2d01 100644 --- a/src/jenkins-hash-hip/main.cu +++ b/src/jenkins-hash-hip/main.cu @@ -315,5 +315,5 @@ int main(int argc, char** argv) { free(initvals); free(out); - return 0; + return error ? 1 : 0; } diff --git a/src/jenkins-hash-omp/main.cpp b/src/jenkins-hash-omp/main.cpp index 83ad03104..6910604aa 100644 --- a/src/jenkins-hash-omp/main.cpp +++ b/src/jenkins-hash-omp/main.cpp @@ -284,5 +284,5 @@ int main(int argc, char** argv) { free(initvals); free(out); - return 0; + return error ? 1 : 0; } diff --git a/src/jenkins-hash-sycl/main.cpp b/src/jenkins-hash-sycl/main.cpp index 4e2811f5e..df91f0d48 100644 --- a/src/jenkins-hash-sycl/main.cpp +++ b/src/jenkins-hash-sycl/main.cpp @@ -312,5 +312,5 @@ int main(int argc, char** argv) { free(initvals); free(out); - return 0; + return error ? 1 : 0; } diff --git a/src/keogh-cuda/main.cu b/src/keogh-cuda/main.cu index 36b6395b5..8bdf801ab 100644 --- a/src/keogh-cuda/main.cu +++ b/src/keogh-cuda/main.cu @@ -139,5 +139,5 @@ int main(int argc, char* argv[]) { free(subject); free(lower); free(upper); - return 0; + return ok ? 0 : 1; } diff --git a/src/keogh-hip/main.cu b/src/keogh-hip/main.cu index 0b1c54d0c..b4d7b6678 100644 --- a/src/keogh-hip/main.cu +++ b/src/keogh-hip/main.cu @@ -138,5 +138,5 @@ int main(int argc, char* argv[]) { free(subject); free(lower); free(upper); - return 0; + return ok ? 0 : 1; } diff --git a/src/keogh-omp/main.cpp b/src/keogh-omp/main.cpp index f556a340f..0ce180140 100644 --- a/src/keogh-omp/main.cpp +++ b/src/keogh-omp/main.cpp @@ -94,5 +94,5 @@ int main(int argc, char* argv[]) { free(subject); free(lower_bound); free(upper_bound); - return 0; + return ok ? 0 : 1; } diff --git a/src/keogh-sycl/main.cpp b/src/keogh-sycl/main.cpp index ba7a7a0e2..045dbb43f 100644 --- a/src/keogh-sycl/main.cpp +++ b/src/keogh-sycl/main.cpp @@ -139,7 +139,7 @@ int main(int argc, char* argv[]) { free(subject); free(lower); free(upper); - return 0; + return ok ? 0 : 1; } diff --git a/src/layout-cuda/main.cu b/src/layout-cuda/main.cu index 5c6241720..efce49f41 100644 --- a/src/layout-cuda/main.cu +++ b/src/layout-cuda/main.cu @@ -148,9 +148,10 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; //initialize soa data @@ -183,9 +184,10 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; cudaFree(inputBuffer); diff --git a/src/layout-hip/main.cu b/src/layout-hip/main.cu index 1adb1344f..f444992e2 100644 --- a/src/layout-hip/main.cu +++ b/src/layout-hip/main.cu @@ -148,9 +148,10 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; //initialize soa data @@ -183,9 +184,10 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; hipFree(inputBuffer); diff --git a/src/layout-omp/main.cpp b/src/layout-omp/main.cpp index b0d64f290..1b97fe2f1 100644 --- a/src/layout-omp/main.cpp +++ b/src/layout-omp/main.cpp @@ -123,9 +123,10 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; //initialize soa data @@ -168,12 +169,12 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; - -} + } free(output); free(reference); diff --git a/src/layout-sycl/main.cpp b/src/layout-sycl/main.cpp index cfec85df9..3499432b7 100644 --- a/src/layout-sycl/main.cpp +++ b/src/layout-sycl/main.cpp @@ -155,9 +155,10 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; //initialize soa data @@ -195,9 +196,10 @@ int main(int argc, char * argv[]) } } - if (fail) + if (fail) { std::cout << "FAIL\n"; - else + exit(1); + } else std::cout << "PASS\n"; sycl::free(inputBuffer, q); diff --git a/src/lfib4-cuda/main.cu b/src/lfib4-cuda/main.cu index 60bbb5e0d..aa23a4f7b 100644 --- a/src/lfib4-cuda/main.cu +++ b/src/lfib4-cuda/main.cu @@ -210,6 +210,7 @@ int main(int argc, char**argv) { } uint32_t n = atoi(argv[1]); + bool ok = true; srand(1234); uint32_t *x = (uint32_t*) malloc(n * sizeof(uint32_t)); @@ -250,7 +251,6 @@ int main(int argc, char**argv) { // Verify cudaMemcpy(z, x_d, sizeof(uint32_t) * n, cudaMemcpyDeviceToHost); - bool ok = true; for (uint32_t i = 0; i < n; i++) { if (x[i] != z[i]) { ok = false; @@ -258,6 +258,7 @@ int main(int argc, char**argv) { } } printf("check = %s\n", ok ? "PASS" : "FAIL"); + if (!ok) break; free(z); cudaFree(x_d); diff --git a/src/lfib4-hip/main.cu b/src/lfib4-hip/main.cu index 21e13bbd8..e0a285527 100644 --- a/src/lfib4-hip/main.cu +++ b/src/lfib4-hip/main.cu @@ -210,6 +210,7 @@ int main(int argc, char**argv) { } uint32_t n = atoi(argv[1]); + bool ok = true; srand(1234); uint32_t *x = (uint32_t*) malloc(n * sizeof(uint32_t)); @@ -250,7 +251,7 @@ int main(int argc, char**argv) { // Verify hipMemcpy(z, x_d, sizeof(uint32_t) * n, hipMemcpyDeviceToHost); - bool ok = true; + ok = true; for (uint32_t i = 0; i < n; i++) { if (x[i] != z[i]) { ok = false; @@ -258,11 +259,12 @@ int main(int argc, char**argv) { } } printf("check = %s\n", ok ? "PASS" : "FAIL"); + if (!ok) break; free(z); hipFree(x_d); } free(x); - return 0; + return ok ? 0 : 1; } diff --git a/src/lfib4-sycl/main.cpp b/src/lfib4-sycl/main.cpp index 14a6e5021..f00a43b0b 100644 --- a/src/lfib4-sycl/main.cpp +++ b/src/lfib4-sycl/main.cpp @@ -238,6 +238,7 @@ int main(int argc, char **argv) { } uint32_t n = atoi(argv[1]); + bool ok = true; srand(1234); uint32_t *x = (uint32_t*) malloc(n * sizeof(uint32_t)); @@ -283,7 +284,7 @@ int main(int argc, char **argv) { // verify q.memcpy(z, x_d, sizeof(uint32_t) * n).wait(); - bool ok = true; + ok = true; for (uint32_t i = 0; i < n; i++) { if (x[i] != z[i]) { ok = false; @@ -291,11 +292,12 @@ int main(int argc, char **argv) { } } printf("check = %s\n", ok ? "PASS" : "FAIL"); + if (!ok) break; free(z); sycl::free(x_d, q); } free(x); - return 0; + return ok ? 0 : 1; } diff --git a/src/linearprobing-cuda/test.cu b/src/linearprobing-cuda/test.cu index 5469345e7..1074e0a97 100644 --- a/src/linearprobing-cuda/test.cu +++ b/src/linearprobing-cuda/test.cu @@ -19,7 +19,7 @@ void test_correctness(std::vector insert_kvs, std::vector de KeyValue* node = &kvs[i]; if (unique_keys.find(node->key) != unique_keys.end()) { - printf("Duplicate key found in GPU hash table at slot %d\n", i); + printf("FAIL: Duplicate key found in GPU hash table at slot %d\n", i); exit(-1); } unique_keys.insert(node->key); diff --git a/src/linearprobing-hip/test.cu b/src/linearprobing-hip/test.cu index 5469345e7..1074e0a97 100644 --- a/src/linearprobing-hip/test.cu +++ b/src/linearprobing-hip/test.cu @@ -19,7 +19,7 @@ void test_correctness(std::vector insert_kvs, std::vector de KeyValue* node = &kvs[i]; if (unique_keys.find(node->key) != unique_keys.end()) { - printf("Duplicate key found in GPU hash table at slot %d\n", i); + printf("FAIL: Duplicate key found in GPU hash table at slot %d\n", i); exit(-1); } unique_keys.insert(node->key); diff --git a/src/linearprobing-omp/test.cpp b/src/linearprobing-omp/test.cpp index 5469345e7..1074e0a97 100644 --- a/src/linearprobing-omp/test.cpp +++ b/src/linearprobing-omp/test.cpp @@ -19,7 +19,7 @@ void test_correctness(std::vector insert_kvs, std::vector de KeyValue* node = &kvs[i]; if (unique_keys.find(node->key) != unique_keys.end()) { - printf("Duplicate key found in GPU hash table at slot %d\n", i); + printf("FAIL: Duplicate key found in GPU hash table at slot %d\n", i); exit(-1); } unique_keys.insert(node->key); diff --git a/src/lombscargle-cuda/main.cu b/src/lombscargle-cuda/main.cu index 870013e1f..7e799e302 100644 --- a/src/lombscargle-cuda/main.cu +++ b/src/lombscargle-cuda/main.cu @@ -211,5 +211,5 @@ int main(int argc, char* argv[]) { free(f); free(p); free(p2); - return 0; + return error ? 1 : 0; } diff --git a/src/lombscargle-hip/main.cu b/src/lombscargle-hip/main.cu index 40098a199..50da1ccaa 100644 --- a/src/lombscargle-hip/main.cu +++ b/src/lombscargle-hip/main.cu @@ -211,5 +211,5 @@ int main(int argc, char* argv[]) { free(f); free(p); free(p2); - return 0; + return error ? 1 : 0; } diff --git a/src/lombscargle-omp/main.cpp b/src/lombscargle-omp/main.cpp index cd16f2d2f..0f75912a0 100644 --- a/src/lombscargle-omp/main.cpp +++ b/src/lombscargle-omp/main.cpp @@ -179,5 +179,5 @@ int main(int argc, char* argv[]) { free(f); free(p); free(p2); - return 0; + return error ? 1 : 0; } diff --git a/src/lombscargle-sycl/main.cpp b/src/lombscargle-sycl/main.cpp index c22eb95f5..089cad3af 100644 --- a/src/lombscargle-sycl/main.cpp +++ b/src/lombscargle-sycl/main.cpp @@ -206,5 +206,5 @@ int main(int argc, char* argv[]) { free(f); free(p); free(p2); - return 0; + return error ? 1 : 0; } diff --git a/src/lud-cuda/common/common.cu b/src/lud-cuda/common/common.cu index ed9230c9c..89e092c8c 100644 --- a/src/lud-cuda/common/common.cu +++ b/src/lud-cuda/common/common.cu @@ -123,12 +123,17 @@ lud_verify(float *m, float *lu, int matrix_dim){ /* printf("\n"); */ /* } */ + unsigned errs = 0; for (i=0; i 0.0001) - printf("dismatch at (%d, %d): (o)%f (n)%f\n", i, j, m[i*matrix_dim+j], tmp[i*matrix_dim+j]); + if (fabs(m[i*matrix_dim+j]-tmp[i*matrix_dim+j]) > 0.0001) { + if (errs < 32) + printf("dismatch at (%d, %d): (o)%f (n)%f\n", i, j, m[i*matrix_dim+j], tmp[i*matrix_dim+j]); + ++errs; + } } } + if (errs > 0) exit(1); free(tmp); } diff --git a/src/lud-cuda/lud.cu b/src/lud-cuda/lud.cu index 593a150ad..8def3f26c 100644 --- a/src/lud-cuda/lud.cu +++ b/src/lud-cuda/lud.cu @@ -19,8 +19,6 @@ double gettime() { return t.tv_sec+t.tv_usec*1e-6; } -static int do_verify = 0; - static struct option long_options[] = { /* name, has_arg, flag, val */ {"input", 1, NULL, 'i'}, @@ -38,6 +36,7 @@ int main ( int argc, char *argv[] ) const char *input_file = NULL; float *m, *mm; stopwatch sw; + int do_verify = 1; while ((opt = getopt_long(argc, argv, "::vs:i:", long_options, &option_index)) != -1 ) { diff --git a/src/lud-sycl/lud.cpp b/src/lud-sycl/lud.cpp index 086df8dcf..6c5ca340d 100644 --- a/src/lud-sycl/lud.cpp +++ b/src/lud-sycl/lud.cpp @@ -17,7 +17,6 @@ double gettime() { return t.tv_sec+t.tv_usec*1e-6; } -static int do_verify = 0; static struct option long_options[] = { /* name, has_arg, flag, val */ @@ -32,6 +31,7 @@ int main ( int argc, char *argv[] ) printf("WG size of kernel = %d X %d\n", BLOCK_SIZE, BLOCK_SIZE); int matrix_dim = 32; /* default matrix_dim */ int opt, option_index=0; + int do_verify = 1; func_ret_t ret; const char *input_file = NULL; float *m, *mm; diff --git a/src/lud-sycl/utils.cpp b/src/lud-sycl/utils.cpp index ac3712254..c4fca3408 100644 --- a/src/lud-sycl/utils.cpp +++ b/src/lud-sycl/utils.cpp @@ -113,12 +113,17 @@ void lud_verify(float *m, float *lu, int matrix_dim){ /* printf("\n"); */ /* } */ + unsigned errs = 0; for (i=0; i 0.0001) - printf("dismatch at (%d, %d): (o)%f (n)%f\n", i, j, m[i*matrix_dim+j], tmp[i*matrix_dim+j]); + if (fabs(m[i*matrix_dim+j]-tmp[i*matrix_dim+j]) > 0.0001) { + if (errs < 32) + printf("dismatch at (%d, %d): (o)%f (n)%f\n", i, j, m[i*matrix_dim+j], tmp[i*matrix_dim+j]); + ++errs; + } } } + if (errs > 0) exit(1); free(tmp); } diff --git a/src/mandelbrot-hip/mandel.hpp b/src/mandelbrot-hip/mandel.hpp index 51d7f4382..f95f9e09c 100644 --- a/src/mandelbrot-hip/mandel.hpp +++ b/src/mandelbrot-hip/mandel.hpp @@ -138,9 +138,7 @@ class Mandel { std::cout << "Fail verification - diff larger than tolerance"<< std::endl; throw std::runtime_error("Verification failure"); } -#if _DEBUG std::cout << "Pass verification" << std::endl; -#endif } }; diff --git a/src/mandelbrot-sycl/mandel.hpp b/src/mandelbrot-sycl/mandel.hpp index 8a568ffc0..7f3caa39a 100644 --- a/src/mandelbrot-sycl/mandel.hpp +++ b/src/mandelbrot-sycl/mandel.hpp @@ -132,9 +132,7 @@ class Mandel { std::cout << "Fail verification - diff larger than tolerance"<< std::endl; throw std::runtime_error("Verification failure"); } -#if _DEBUG std::cout << "Pass verification" << std::endl; -#endif } }; diff --git a/src/matern-cuda/main.cu b/src/matern-cuda/main.cu index 01eb05fab..363f0c48e 100644 --- a/src/matern-cuda/main.cu +++ b/src/matern-cuda/main.cu @@ -131,11 +131,11 @@ int main(int argc, char* argv[]) printf("Verifying the kernel results with the problem size (16 cube)\n"); printf("------------------------------------------------------------\n"); + bool ok = true; while (l <= 1e5f) { matern_kernel<<>>(ntargets_small, l, d_sources, d_targets, d_weights, d_result); matern_kernel_reference(nsources, ntargets_small, l, sources, targets, weights, result_ref); cudaMemcpy(result, d_result, ntargets_small * sizeof(float), cudaMemcpyDeviceToHost); - bool ok = true; for (int i = 0; i < ntargets_small; i++) { if (fabsf(result[i] - result_ref[i]) > 1e-3f) { printf("@%d actual=%f expected=%f\n", i, result[i] , result_ref[i]); @@ -184,5 +184,5 @@ int main(int argc, char* argv[]) free(targets); free(result); free(result_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/matern-hip/main.cu b/src/matern-hip/main.cu index 92c36c561..629fc69eb 100644 --- a/src/matern-hip/main.cu +++ b/src/matern-hip/main.cu @@ -132,11 +132,11 @@ int main(int argc, char* argv[]) printf("Verifying the kernel results with the problem size (16 cube)\n"); printf("------------------------------------------------------------\n"); + bool ok = true; while (l <= 1e5f) { hipLaunchKernelGGL(matern_kernel, grids, blocks, 0, 0, ntargets_small, l, d_sources, d_targets, d_weights, d_result); matern_kernel_reference(nsources, ntargets_small, l, sources, targets, weights, result_ref); hipMemcpy(result, d_result, ntargets_small * sizeof(float), hipMemcpyDeviceToHost); - bool ok = true; for (int i = 0; i < ntargets_small; i++) { if (fabsf(result[i] - result_ref[i]) > 1e-3f) { printf("@%d actual=%f expected=%f\n", i, result[i] , result_ref[i]); @@ -185,5 +185,6 @@ int main(int argc, char* argv[]) free(targets); free(result); free(result_ref); - return 0; + + return ok ? 0 : 1; } diff --git a/src/matern-omp/main.cpp b/src/matern-omp/main.cpp index 2f1a28475..b860604d9 100644 --- a/src/matern-omp/main.cpp +++ b/src/matern-omp/main.cpp @@ -145,6 +145,7 @@ int main(int argc, char* argv[]) for (int i = 0; i < target_size; i++) targets[i] = rand() / (float)RAND_MAX; + bool ok = true; #pragma omp target data map(to: sources[0:source_size],\ weights[0:weight_size],\ targets[0:target_size]) \ @@ -163,7 +164,6 @@ int main(int argc, char* argv[]) matern_kernel2(ntargets_small, l, sources, targets, weights, result); - bool ok = true; for (int i = 0; i < ntargets_small; i++) { if (fabsf(result[i] - result_ref[i]) > 1e-3f) { printf("@%d actual=%f expected=%f\n", i, result[i] , result_ref[i]); @@ -206,5 +206,5 @@ int main(int argc, char* argv[]) free(targets); free(result); free(result_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/matern-sycl/main.cpp b/src/matern-sycl/main.cpp index cc0384d7a..979767b32 100644 --- a/src/matern-sycl/main.cpp +++ b/src/matern-sycl/main.cpp @@ -133,6 +133,7 @@ int main(int argc, char* argv[]) printf("Verifying the kernel results with the problem size (16 cube)\n"); printf("------------------------------------------------------------\n"); + bool ok = true; while (l <= 1e5f) { auto e = q.submit([&] (sycl::handler &cgh) { sycl::local_accessor l_result (sycl::range<1>(SX*SY), cgh); @@ -151,7 +152,6 @@ int main(int argc, char* argv[]) q.memcpy(result, d_result, ntargets_small * sizeof(float), e).wait(); - bool ok = true; for (int i = 0; i < ntargets_small; i++) { if (fabsf(result[i] - result_ref[i]) > 1e-3f) { printf("@%d actual=%f expected=%f\n", i, result[i] , result_ref[i]); @@ -222,5 +222,5 @@ int main(int argc, char* argv[]) free(targets); free(result); free(result_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/minisweep-cuda/main.cu b/src/minisweep-cuda/main.cu index 5d562ecd3..c25bf49b1 100644 --- a/src/minisweep-cuda/main.cu +++ b/src/minisweep-cuda/main.cu @@ -423,5 +423,5 @@ int main( int argc, char** argv ) free(faceyz); free(vslocal); - return 0; + return normsqdiff == (P)0 ? 0 : 1; } /*---main---*/ diff --git a/src/minisweep-hip/main.cu b/src/minisweep-hip/main.cu index 2ed8f3565..d972ffef4 100644 --- a/src/minisweep-hip/main.cu +++ b/src/minisweep-hip/main.cu @@ -423,5 +423,5 @@ int main( int argc, char** argv ) free(faceyz); free(vslocal); - return 0; + return (normsqdiff == (P)0) ? 0 : 1; } /*---main---*/ diff --git a/src/minisweep-omp/main.cpp b/src/minisweep-omp/main.cpp index 8a2281972..bc84f6d68 100644 --- a/src/minisweep-omp/main.cpp +++ b/src/minisweep-omp/main.cpp @@ -481,5 +481,5 @@ int main( int argc, char** argv ) free(faceyz); free(vslocal); - return 0; + return normsqdiff == (P)0 ? 0 : 1; } /*---main---*/ diff --git a/src/minisweep-sycl/main.cpp b/src/minisweep-sycl/main.cpp index ff0c0b3a4..57382b4e6 100644 --- a/src/minisweep-sycl/main.cpp +++ b/src/minisweep-sycl/main.cpp @@ -434,6 +434,6 @@ int main( int argc, char** argv ) free(faceyz); free(vslocal); - return 0; + return (normsqdiff == (P)0) ? 0 : 1; } /*---main---*/ diff --git a/src/minkowski-cuda/verify.cpp b/src/minkowski-cuda/verify.cpp index ba90a80dc..cdef530a8 100644 --- a/src/minkowski-cuda/verify.cpp +++ b/src/minkowski-cuda/verify.cpp @@ -55,6 +55,7 @@ void VerifyResult(float (*a_host)[N], float (*b_host)[K], cout << "PASS\n"; } else { cout << "FAIL\n"; + exit(1); } } #endif diff --git a/src/minmax-cuda/main.cu b/src/minmax-cuda/main.cu index d80ef629a..71dd636bc 100644 --- a/src/minmax-cuda/main.cu +++ b/src/minmax-cuda/main.cu @@ -88,6 +88,7 @@ void eval (const T bounding_box_size, const int repeat) { bool ok = (min_point[0] == r_min_point) && (max_point[0] == r_max_point); ok &= (min_point[1] == r_min_point) && (max_point[1] == r_max_point); printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); } int main(int argc, char* argv[]) diff --git a/src/minmax-sycl/main.cpp b/src/minmax-sycl/main.cpp index 34d98fce2..cf134ba42 100644 --- a/src/minmax-sycl/main.cpp +++ b/src/minmax-sycl/main.cpp @@ -97,6 +97,7 @@ template void eval(const T bounding_box_size, const int repeat) { bool ok = (min_point[0] == r_min_point) && (max_point[0] == r_max_point); ok &= (min_point[1] == r_min_point) && (max_point[1] == r_max_point); printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); } int main(int argc, char* argv[]) diff --git a/src/mis-cuda/main.cu b/src/mis-cuda/main.cu index d97de74db..465e3006b 100644 --- a/src/mis-cuda/main.cu +++ b/src/mis-cuda/main.cu @@ -201,10 +201,11 @@ int main(int argc, char* argv[]) stattype* nstatus = (stattype*)malloc(g.nodes * sizeof(nstatus[0])); + bool err = false; if (nstatus == NULL) { fprintf(stderr, "ERROR: could not allocate nstatus\n\n"); - } - else { + err = true; + } else { const int repeat = atoi(argv[2]); computeMIS(repeat, g.nodes, g.edges, g.nindex, g.nlist, nstatus); @@ -214,12 +215,14 @@ int main(int argc, char* argv[]) for (int v = 0; v < g.nodes; v++) { if ((nstatus[v] != in) && (nstatus[v] != out)) { fprintf(stderr, "ERROR: found unprocessed node in graph\n\n"); + err = true; break; } if (nstatus[v] == in) { for (int i = g.nindex[v]; i < g.nindex[v + 1]; i++) { if (nstatus[g.nlist[i]] == in) { fprintf(stderr, "ERROR: found adjacent nodes in MIS\n\n"); + err = true; break; } } @@ -232,6 +235,7 @@ int main(int argc, char* argv[]) } if (flag == 0) { fprintf(stderr, "ERROR: set is not maximal\n\n"); + err = true; break; } } @@ -240,5 +244,5 @@ int main(int argc, char* argv[]) freeECLgraph(g); if (nstatus != NULL) free(nstatus); - return 0; + return err ? 1 : 0; } diff --git a/src/mis-hip/main.cu b/src/mis-hip/main.cu index d7b5cbedf..ac18181a0 100644 --- a/src/mis-hip/main.cu +++ b/src/mis-hip/main.cu @@ -200,11 +200,11 @@ int main(int argc, char* argv[]) printf("average degree: %.2f edges per node\n", 1.0 * g.edges / g.nodes); stattype* nstatus = (stattype*)malloc(g.nodes * sizeof(nstatus[0])); - + bool err = false; if (nstatus == NULL) { fprintf(stderr, "ERROR: could not allocate nstatus\n\n"); - } - else { + err = true; + } else { const int repeat = atoi(argv[2]); computeMIS(repeat, g.nodes, g.edges, g.nindex, g.nlist, nstatus); @@ -214,12 +214,14 @@ int main(int argc, char* argv[]) for (int v = 0; v < g.nodes; v++) { if ((nstatus[v] != in) && (nstatus[v] != out)) { fprintf(stderr, "ERROR: found unprocessed node in graph\n\n"); + err = true; break; } if (nstatus[v] == in) { for (int i = g.nindex[v]; i < g.nindex[v + 1]; i++) { if (nstatus[g.nlist[i]] == in) { fprintf(stderr, "ERROR: found adjacent nodes in MIS\n\n"); + err = true; break; } } @@ -232,6 +234,7 @@ int main(int argc, char* argv[]) } if (flag == 0) { fprintf(stderr, "ERROR: set is not maximal\n\n"); + err = true; break; } } @@ -240,5 +243,5 @@ int main(int argc, char* argv[]) freeECLgraph(g); if (nstatus != NULL) free(nstatus); - return 0; + return err ? 1 : 0; } diff --git a/src/mis-omp/main.cpp b/src/mis-omp/main.cpp index 21d55d9c3..8aecc4a19 100644 --- a/src/mis-omp/main.cpp +++ b/src/mis-omp/main.cpp @@ -158,10 +158,11 @@ int main(int argc, char* argv[]) stattype* nstatus = (stattype*)malloc(g.nodes * sizeof(nstatus[0])); + bool err = false; if (nstatus == NULL) { fprintf(stderr, "ERROR: could not allocate nstatus\n\n"); - } - else { + err = true; + } else { const int repeat = atoi(argv[2]); computeMIS(repeat, g.nodes, g.edges, g.nindex, g.nlist, nstatus); @@ -171,12 +172,14 @@ int main(int argc, char* argv[]) for (int v = 0; v < g.nodes; v++) { if ((nstatus[v] != in) && (nstatus[v] != out)) { fprintf(stderr, "ERROR: found unprocessed node in graph\n\n"); + err = true; break; } if (nstatus[v] == in) { for (int i = g.nindex[v]; i < g.nindex[v + 1]; i++) { if (nstatus[g.nlist[i]] == in) { fprintf(stderr, "ERROR: found adjacent nodes in MIS\n\n"); + err = true; break; } } @@ -189,6 +192,7 @@ int main(int argc, char* argv[]) } if (flag == 0) { fprintf(stderr, "ERROR: set is not maximal\n\n"); + err = true; break; } } @@ -197,5 +201,5 @@ int main(int argc, char* argv[]) freeECLgraph(g); if (nstatus != NULL) free(nstatus); - return 0; + return err ? 1 : 0; } diff --git a/src/mis-sycl/main.cpp b/src/mis-sycl/main.cpp index b2c1b95c1..68b31470d 100644 --- a/src/mis-sycl/main.cpp +++ b/src/mis-sycl/main.cpp @@ -202,12 +202,12 @@ int main(int argc, char* argv[]) printf("configuration: %d nodes and %d edges (%s)\n", g.nodes, g.edges, argv[1]); printf("average degree: %.2f edges per node\n", 1.0 * g.edges / g.nodes); + bool err = false; stattype* nstatus = (stattype*)malloc(g.nodes * sizeof(nstatus[0])); - if (nstatus == NULL) { fprintf(stderr, "ERROR: could not allocate nstatus\n\n"); - } - else { + err = true; + } else { const int repeat = atoi(argv[2]); computeMIS(repeat, g.nodes, g.edges, g.nindex, g.nlist, nstatus); @@ -217,12 +217,14 @@ int main(int argc, char* argv[]) for (int v = 0; v < g.nodes; v++) { if ((nstatus[v] != in) && (nstatus[v] != out)) { fprintf(stderr, "ERROR: found unprocessed node in graph\n\n"); + err = true; break; } if (nstatus[v] == in) { for (int i = g.nindex[v]; i < g.nindex[v + 1]; i++) { if (nstatus[g.nlist[i]] == in) { fprintf(stderr, "ERROR: found adjacent nodes in MIS\n\n"); + err = true; break; } } @@ -235,6 +237,7 @@ int main(int argc, char* argv[]) } if (flag == 0) { fprintf(stderr, "ERROR: set is not maximal\n\n"); + err = true; break; } } @@ -243,5 +246,5 @@ int main(int argc, char* argv[]) freeECLgraph(g); if (nstatus != NULL) free(nstatus); - return 0; + return err ? 1 : 0; } diff --git a/src/mixbench-cuda/main.cu b/src/mixbench-cuda/main.cu index 7bbc50aee..44cd94375 100644 --- a/src/mixbench-cuda/main.cu +++ b/src/mixbench-cuda/main.cu @@ -92,6 +92,7 @@ void mixbenchGPU(long size, int repeat) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if(!ok) exit(1); free(cd); cudaFree(d_cd); diff --git a/src/mixbench-hip/main.cu b/src/mixbench-hip/main.cu index 414ae7fb6..d2dc83f37 100644 --- a/src/mixbench-hip/main.cu +++ b/src/mixbench-hip/main.cu @@ -92,6 +92,7 @@ void mixbenchGPU(long size, int repeat) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); free(cd); hipFree(d_cd); diff --git a/src/mixbench-omp/main.cpp b/src/mixbench-omp/main.cpp index 8f7f4c927..50a5c8698 100644 --- a/src/mixbench-omp/main.cpp +++ b/src/mixbench-omp/main.cpp @@ -91,6 +91,7 @@ void mixbenchGPU(long size, int repeat) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); free(cd); } diff --git a/src/mixbench-sycl/main.cpp b/src/mixbench-sycl/main.cpp index eb95fd3e1..f65ade15f 100644 --- a/src/mixbench-sycl/main.cpp +++ b/src/mixbench-sycl/main.cpp @@ -109,6 +109,7 @@ void mixbenchGPU(long size, int repeat) { free(cd); printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); } diff --git a/src/mr-cuda/main.cu b/src/mr-cuda/main.cu index fe505d487..546ae8547 100644 --- a/src/mr-cuda/main.cu +++ b/src/mr-cuda/main.cu @@ -99,6 +99,7 @@ void run_benchmark() printf("Total kernel execution time (mr32_simple ): %f (ms)\n", mr32_sf_time * 1e-6); printf("Total kernel execution time (mr32_efficent): %f (ms)\n", mr32_eff_time * 1e-6); printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); // device results are not included print_results(bits32, SIZES_CNT32, BASES_CNT32, time_vals); diff --git a/src/mr-hip/main.cu b/src/mr-hip/main.cu index 8bddfcd44..5e394767d 100644 --- a/src/mr-hip/main.cu +++ b/src/mr-hip/main.cu @@ -99,6 +99,7 @@ void run_benchmark() printf("Total kernel execution time (mr32_simple ): %f (ms)\n", mr32_sf_time * 1e-6); printf("Total kernel execution time (mr32_efficent): %f (ms)\n", mr32_eff_time * 1e-6); printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); // device results are not included print_results(bits32, SIZES_CNT32, BASES_CNT32, time_vals); diff --git a/src/mr-sycl/main.cpp b/src/mr-sycl/main.cpp index d36652d8e..68207ec8b 100644 --- a/src/mr-sycl/main.cpp +++ b/src/mr-sycl/main.cpp @@ -110,6 +110,7 @@ void run_benchmark(sycl::queue &q) printf("Total kernel execution time (mr32_simple ): %f (ms)\n", mr32_sf_time * 1e-6); printf("Total kernel execution time (mr32_efficent): %f (ms)\n", mr32_eff_time * 1e-6); printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); // device results are not included print_results(bits32, SIZES_CNT32, BASES_CNT32, time_vals); diff --git a/src/mrc-cuda/main.cu b/src/mrc-cuda/main.cu index 2ac85143d..dce673967 100644 --- a/src/mrc-cuda/main.cu +++ b/src/mrc-cuda/main.cu @@ -130,6 +130,7 @@ int main(int argc, char* argv[]) } } printf("%s\n", ok ? "PASS" : "FAIL"); + if(!ok) exit(1); cudaFree(d_X1); cudaFree(d_X2); diff --git a/src/mrc-hip/main.cu b/src/mrc-hip/main.cu index 16892395b..934ecd9c2 100644 --- a/src/mrc-hip/main.cu +++ b/src/mrc-hip/main.cu @@ -130,6 +130,7 @@ int main(int argc, char* argv[]) } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); hipFree(d_X1); hipFree(d_X2); diff --git a/src/mrc-omp/main.cpp b/src/mrc-omp/main.cpp index f264430da..f65243315 100644 --- a/src/mrc-omp/main.cpp +++ b/src/mrc-omp/main.cpp @@ -107,6 +107,7 @@ int main(int argc, char* argv[]) } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); free(h_X1); free(h_X2); diff --git a/src/mrc-sycl/main.cpp b/src/mrc-sycl/main.cpp index c32500fb1..47a69a379 100644 --- a/src/mrc-sycl/main.cpp +++ b/src/mrc-sycl/main.cpp @@ -152,6 +152,7 @@ int main(int argc, char* argv[]) } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); sycl::free(d_X1, q); sycl::free(d_X2, q); diff --git a/src/murmurhash3-cuda/murmurhash3.cu b/src/murmurhash3-cuda/murmurhash3.cu index da996751e..c2b4b17e3 100644 --- a/src/murmurhash3-cuda/murmurhash3.cu +++ b/src/murmurhash3-cuda/murmurhash3.cu @@ -241,5 +241,5 @@ int main(int argc, char** argv) cudaFree(dev_out); cudaFree(dev_length); cudaFree(key_length); - return 0; + return error ? 1 : 0; } diff --git a/src/murmurhash3-hip/murmurhash3.cu b/src/murmurhash3-hip/murmurhash3.cu index b6f43dd1f..9a4cfcced 100644 --- a/src/murmurhash3-hip/murmurhash3.cu +++ b/src/murmurhash3-hip/murmurhash3.cu @@ -241,5 +241,5 @@ int main(int argc, char** argv) hipFree(dev_out); hipFree(dev_length); hipFree(key_length); - return 0; + return error ? 1 : 0; } diff --git a/src/murmurhash3-omp/murmurhash3.cpp b/src/murmurhash3-omp/murmurhash3.cpp index 6f7c0d0e4..ddda10cd1 100644 --- a/src/murmurhash3-omp/murmurhash3.cpp +++ b/src/murmurhash3-omp/murmurhash3.cpp @@ -214,5 +214,5 @@ int main(int argc, char** argv) free(d_keys); free(d_out); free(d_length); - return 0; + return error ? 1 : 0; } diff --git a/src/murmurhash3-sycl/murmurhash3.cpp b/src/murmurhash3-sycl/murmurhash3.cpp index 8a79be4a1..38c31aa34 100644 --- a/src/murmurhash3-sycl/murmurhash3.cpp +++ b/src/murmurhash3-sycl/murmurhash3.cpp @@ -234,5 +234,5 @@ int main(int argc, char** argv) sycl::free(dev_out, q); sycl::free(dev_length, q); sycl::free(key_length, q); - return 0; + return error ? 1 : 0; } diff --git a/src/nlll-cuda/main.cu b/src/nlll-cuda/main.cu index b79512f38..04069b3eb 100644 --- a/src/nlll-cuda/main.cu +++ b/src/nlll-cuda/main.cu @@ -138,6 +138,7 @@ void eval(const int64_t nframe, ok = false; } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); cudaFree(d_output); cudaFree(d_total_weight); diff --git a/src/nlll-hip/main.cu b/src/nlll-hip/main.cu index ee90ea080..12ecd19dd 100644 --- a/src/nlll-hip/main.cu +++ b/src/nlll-hip/main.cu @@ -138,6 +138,7 @@ void eval(const int64_t nframe, ok = false; } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); hipFree(d_output); hipFree(d_total_weight); diff --git a/src/nlll-omp/main.cpp b/src/nlll-omp/main.cpp index c2709381b..7b8a8f542 100644 --- a/src/nlll-omp/main.cpp +++ b/src/nlll-omp/main.cpp @@ -120,6 +120,7 @@ void eval(const int64_t nframe, ok = false; } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); } template diff --git a/src/nlll-sycl/main.cpp b/src/nlll-sycl/main.cpp index 5ec2f0ab5..6e9a6d6f6 100644 --- a/src/nlll-sycl/main.cpp +++ b/src/nlll-sycl/main.cpp @@ -150,6 +150,7 @@ void eval(const int64_t nframe, ok = false; } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); sycl::free(d_output, q); sycl::free(d_total_weight, q); diff --git a/src/nonzero-cuda/main.cu b/src/nonzero-cuda/main.cu index 4c79e6a7d..373998a12 100644 --- a/src/nonzero-cuda/main.cu +++ b/src/nonzero-cuda/main.cu @@ -190,13 +190,14 @@ void nonzero (int nrows, int ncols, int repeat) { free(h_in); + printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); + printf("Average time for sum reduction: %lf (us)\n", sum_time * 1e-3 / repeat); printf("Average time for write index operations: %lf (us)\n", idx_time * 1e-3 / repeat); - - printf("%s\n", ok ? "PASS" : "FAIL"); } int main(int argc, char* argv[]) diff --git a/src/nonzero-hip/main.cu b/src/nonzero-hip/main.cu index 03c1bab52..82cb94afe 100644 --- a/src/nonzero-hip/main.cu +++ b/src/nonzero-hip/main.cu @@ -191,13 +191,14 @@ void nonzero (int nrows, int ncols, int repeat) { free(h_in); + printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); + printf("Average time for sum reduction: %lf (us)\n", sum_time * 1e-3 / repeat); printf("Average time for write index operations: %lf (us)\n", idx_time * 1e-3 / repeat); - - printf("%s\n", ok ? "PASS" : "FAIL"); } int main(int argc, char* argv[]) diff --git a/src/nonzero-sycl/main.cpp b/src/nonzero-sycl/main.cpp index 10aca2977..e8e9a413e 100644 --- a/src/nonzero-sycl/main.cpp +++ b/src/nonzero-sycl/main.cpp @@ -211,13 +211,14 @@ template void nonzero(int nrows, int ncols, int repeat) { free(h_in); + printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); + printf("Average time for sum reduction: %lf (us)\n", sum_time * 1e-3 / repeat); printf("Average time for write index operations: %lf (us)\n", idx_time * 1e-3 / repeat); - - printf("%s\n", ok ? "PASS" : "FAIL"); } int main(int argc, char* argv[]) diff --git a/src/nw-cuda/nw.cu b/src/nw-cuda/nw.cu index 5858ce4d5..9a211aaf3 100644 --- a/src/nw-cuda/nw.cu +++ b/src/nw-cuda/nw.cu @@ -214,7 +214,7 @@ kernel2 (int*__restrict__ d_input_itemsets, } int main(int argc, char **argv){ - + int err = 0; printf("WG size of kernel = %d \n", BLOCK_SIZE); int max_rows_t, max_cols_t, penalty_t; @@ -343,7 +343,7 @@ int main(int argc, char **argv){ // verify nw_host(input_itemsets, reference, max_cols, penalty); - int err = memcmp(input_itemsets, output_itemsets, max_cols * max_rows * sizeof(int)); + err = memcmp(input_itemsets, output_itemsets, max_cols * max_rows * sizeof(int)); printf("%s\n", err ? "FAIL" : "PASS"); #ifdef TRACEBACK @@ -412,6 +412,6 @@ int main(int argc, char **argv){ free(output_itemsets); cudaFree(d_input_itemsets); cudaFree(d_reference); - return 0; + return err ? 1 : 0; } diff --git a/src/nw-hip/nw.cu b/src/nw-hip/nw.cu index 751c830a1..304c5ba25 100644 --- a/src/nw-hip/nw.cu +++ b/src/nw-hip/nw.cu @@ -211,7 +211,7 @@ kernel2 (int*__restrict__ d_input_itemsets, } int main(int argc, char **argv){ - + int err = 0; printf("WG size of kernel = %d \n", BLOCK_SIZE); int max_rows_t, max_cols_t, penalty_t; @@ -343,7 +343,7 @@ int main(int argc, char **argv){ // verify nw_host(input_itemsets, reference, max_cols, penalty); - int err = memcmp(input_itemsets, output_itemsets, max_cols * max_rows * sizeof(int)); + err = memcmp(input_itemsets, output_itemsets, max_cols * max_rows * sizeof(int)); printf("%s\n", err ? "FAIL" : "PASS"); #ifdef TRACEBACK @@ -412,6 +412,6 @@ int main(int argc, char **argv){ free(output_itemsets); hipFree(d_input_itemsets); hipFree(d_reference); - return 0; + return err ? 1 : 0; } diff --git a/src/nw-omp/nw.cpp b/src/nw-omp/nw.cpp index 4aa5808bb..c23937bd2 100644 --- a/src/nw-omp/nw.cpp +++ b/src/nw-omp/nw.cpp @@ -75,7 +75,7 @@ void usage(int argc, char **argv) } int main(int argc, char **argv){ - + int err = 0; printf("WG size of kernel = %d \n", BLOCK_SIZE); int max_rows_t, max_cols_t, penalty_t; @@ -306,7 +306,7 @@ int main(int argc, char **argv){ // verify nw_host(h_input_itemsets, reference, max_cols, penalty); - int err = memcmp(input_itemsets, h_input_itemsets, max_cols * max_rows * sizeof(int)); + err = memcmp(input_itemsets, h_input_itemsets, max_cols * max_rows * sizeof(int)); printf("%s\n", err ? "FAIL" : "PASS"); #ifdef TRACEBACK @@ -375,6 +375,6 @@ int main(int argc, char **argv){ free(reference); free(input_itemsets); free(h_input_itemsets); - return 0; + return err ? 1 : 0; } diff --git a/src/nw-sycl/nw.cpp b/src/nw-sycl/nw.cpp index c88bfb719..0a0728490 100644 --- a/src/nw-sycl/nw.cpp +++ b/src/nw-sycl/nw.cpp @@ -76,7 +76,7 @@ void usage(int argc, char **argv) } int main(int argc, char **argv){ - + int err = 0; printf("WG size of kernel = %d \n", BLOCK_SIZE); int max_rows_t, max_cols_t, penalty_t; @@ -234,7 +234,7 @@ int main(int argc, char **argv){ // verify nw_host(input_itemsets, reference, max_cols, penalty); - int err = memcmp(input_itemsets, output_itemsets, max_cols * max_rows * sizeof(int)); + err = memcmp(input_itemsets, output_itemsets, max_cols * max_rows * sizeof(int)); printf("%s\n", err ? "FAIL" : "PASS"); #ifdef TRACEBACK @@ -308,5 +308,5 @@ int main(int argc, char **argv){ free(output_itemsets); sycl::free(d_input_itemsets_acc, q); sycl::free(d_reference_acc, q); - return 0; + return err ? 1 : 0; } diff --git a/src/overlay-cuda/main.cu b/src/overlay-cuda/main.cu index e35906084..3532d0117 100644 --- a/src/overlay-cuda/main.cu +++ b/src/overlay-cuda/main.cu @@ -153,5 +153,5 @@ int main(int argc, char* argv[]) { free(output); free(ref_output); free(detections); - return 0; + return ok ? 0 : 1; } diff --git a/src/overlay-hip/main.cu b/src/overlay-hip/main.cu index c85917bf5..0cc823545 100644 --- a/src/overlay-hip/main.cu +++ b/src/overlay-hip/main.cu @@ -153,5 +153,5 @@ int main(int argc, char* argv[]) { free(output); free(ref_output); free(detections); - return 0; + return ok ? 0 : 1; } diff --git a/src/overlay-omp/main.cpp b/src/overlay-omp/main.cpp index d3ead13c9..101b0d3a2 100644 --- a/src/overlay-omp/main.cpp +++ b/src/overlay-omp/main.cpp @@ -145,5 +145,5 @@ int main(int argc, char* argv[]) { free(output); free(ref_output); free(detections); - return 0; + return ok ? 0 : 1; } diff --git a/src/overlay-sycl/main.cpp b/src/overlay-sycl/main.cpp index d7aedb04f..0a978b7e9 100644 --- a/src/overlay-sycl/main.cpp +++ b/src/overlay-sycl/main.cpp @@ -169,5 +169,5 @@ int main(int argc, char* argv[]) { free(output); free(ref_output); free(detections); - return 0; + return ok ? 0 : 1; } diff --git a/src/pad-cuda/support/verify.h b/src/pad-cuda/support/verify.h index 87acb11c6..c09031824 100644 --- a/src/pad-cuda/support/verify.h +++ b/src/pad-cuda/support/verify.h @@ -48,6 +48,7 @@ inline void compare_output(T *outp, T *outpCPU, int size) { L1norm2 = (double)(sum_delta2 / sum_ref2); if(L1norm2 >= 1e-6){ printf("Test failed\n"); + exit(1); } else { printf("Test Passed\n"); } diff --git a/src/pad-sycl/support/verify.h b/src/pad-sycl/support/verify.h index 5b8d04b13..162abea8b 100644 --- a/src/pad-sycl/support/verify.h +++ b/src/pad-sycl/support/verify.h @@ -48,6 +48,7 @@ inline void compare_output(DATA_TYPE *outp, DATA_TYPE *outpCPU, int size) { L1norm2 = (double)(sum_delta2 / sum_ref2); if(L1norm2 >= 1e-6){ printf("Test failed\n"); + exit(1); } else { printf("Test Passed\n"); } diff --git a/src/perplexity-cuda/main.cu b/src/perplexity-cuda/main.cu index 1b116492e..0c70fc4b5 100644 --- a/src/perplexity-cuda/main.cu +++ b/src/perplexity-cuda/main.cu @@ -163,5 +163,5 @@ int main(int argc, char* argv[]) { cudaFree(d_distance); cudaFree(d_data); - return 0; + return ok ? 0 : 1; } diff --git a/src/perplexity-hip/main.cu b/src/perplexity-hip/main.cu index 699d71f00..81004c7c1 100644 --- a/src/perplexity-hip/main.cu +++ b/src/perplexity-hip/main.cu @@ -163,5 +163,5 @@ int main(int argc, char* argv[]) { hipFree(d_distance); hipFree(d_data); - return 0; + return ok ? 0 : 1; } diff --git a/src/perplexity-omp/main.cpp b/src/perplexity-omp/main.cpp index 89c2f0a2a..f6fa3e487 100644 --- a/src/perplexity-omp/main.cpp +++ b/src/perplexity-omp/main.cpp @@ -135,6 +135,6 @@ int main(int argc, char* argv[]) { } } printf("%s\n", ok ? "PASS" : "FAIL"); - - return 0; + + return ok ? 0 : 1; } diff --git a/src/perplexity-sycl/main.cpp b/src/perplexity-sycl/main.cpp index 19e64d415..89e0c367f 100644 --- a/src/perplexity-sycl/main.cpp +++ b/src/perplexity-sycl/main.cpp @@ -160,6 +160,6 @@ int main(int argc, char* argv[]) { sycl::free(d_distance, q); sycl::free(d_data, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/pnpoly-cuda/main.cu b/src/pnpoly-cuda/main.cu index 4dcd715df..3e80225c6 100644 --- a/src/pnpoly-cuda/main.cu +++ b/src/pnpoly-cuda/main.cu @@ -163,5 +163,5 @@ int main(int argc, char* argv[]) { free(point); free(bitmap_ref); free(bitmap_opt); - return 0; + return error ? 1 : 0; } diff --git a/src/pnpoly-hip/main.cu b/src/pnpoly-hip/main.cu index af81d01e5..beb8b201f 100644 --- a/src/pnpoly-hip/main.cu +++ b/src/pnpoly-hip/main.cu @@ -163,5 +163,5 @@ int main(int argc, char* argv[]) { free(point); free(bitmap_ref); free(bitmap_opt); - return 0; + return error ? 1 : 0; } diff --git a/src/pnpoly-omp/main.cpp b/src/pnpoly-omp/main.cpp index 8336307f6..31c9a6fa4 100644 --- a/src/pnpoly-omp/main.cpp +++ b/src/pnpoly-omp/main.cpp @@ -139,5 +139,5 @@ int main(int argc, char* argv[]) { free(point); free(bitmap_ref); free(bitmap_opt); - return 0; + return error ? 1 : 0; } diff --git a/src/pnpoly-sycl/main.cpp b/src/pnpoly-sycl/main.cpp index 6f8599976..a6976e794 100644 --- a/src/pnpoly-sycl/main.cpp +++ b/src/pnpoly-sycl/main.cpp @@ -204,5 +204,5 @@ int main(int argc, char* argv[]) { free(point); free(bitmap_ref); free(bitmap_opt); - return 0; + return error ? 1 : 0; } diff --git a/src/pool-cuda/main.cu b/src/pool-cuda/main.cu index 1a90982b1..ff4891f7e 100644 --- a/src/pool-cuda/main.cu +++ b/src/pool-cuda/main.cu @@ -225,5 +225,5 @@ int main(int argc, char* argv[]) cudaFree(input_grad_data); cudaFree(output_data); cudaFree(output_grad_data); - return 0; + return ok ? 0 : 1; } diff --git a/src/pool-hip/main.cu b/src/pool-hip/main.cu index b1a024f34..67e030e3a 100644 --- a/src/pool-hip/main.cu +++ b/src/pool-hip/main.cu @@ -225,5 +225,5 @@ int main(int argc, char* argv[]) hipFree(input_grad_data); hipFree(output_data); hipFree(output_grad_data); - return 0; + return ok ? 0 : 1; } diff --git a/src/pool-omp/main.cpp b/src/pool-omp/main.cpp index 68b8c6169..f9cb9ea28 100644 --- a/src/pool-omp/main.cpp +++ b/src/pool-omp/main.cpp @@ -208,5 +208,5 @@ int main(int argc, char* argv[]) delete[] input_grad; delete[] input_grad_ref; delete[] output_grad; - return 0; + return ok ? 0 : 1; } diff --git a/src/pool-sycl/main.cpp b/src/pool-sycl/main.cpp index e1e003cf2..789eaee65 100644 --- a/src/pool-sycl/main.cpp +++ b/src/pool-sycl/main.cpp @@ -242,5 +242,5 @@ int main(int argc, char* argv[]) sycl::free(d_input_grad, q); sycl::free(d_output, q); sycl::free(d_output_grad, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/present-cuda/main.cu b/src/present-cuda/main.cu index b1a43d5cd..b1e57f968 100644 --- a/src/present-cuda/main.cu +++ b/src/present-cuda/main.cu @@ -586,4 +586,6 @@ int main(int argc, char** argv) { cudaFree(d_sbox_pmt_2); cudaFree(d_sbox_pmt_1); cudaFree(d_sbox_pmt_0); + + return h_checksum != d_checksum; } diff --git a/src/present-hip/main.cu b/src/present-hip/main.cu index d15fe0ad5..2a6204109 100644 --- a/src/present-hip/main.cu +++ b/src/present-hip/main.cu @@ -570,11 +570,6 @@ int main(int argc, char** argv) { } printf("Average kernel execution time: %f (us)\n", (time * 1e-3f) / repeat); - if (h_checksum != d_checksum) - printf("FAIL\n"); - else - printf("PASS\n"); - free(h_plain); free(h_key); free(h_cipher); @@ -586,4 +581,11 @@ int main(int argc, char** argv) { hipFree(d_sbox_pmt_2); hipFree(d_sbox_pmt_1); hipFree(d_sbox_pmt_0); + + if (h_checksum != d_checksum) { + printf("FAIL\n"); + exit(1); + } else + printf("PASS\n"); + } diff --git a/src/present-omp/main.cpp b/src/present-omp/main.cpp index ff83a672b..050736c2d 100644 --- a/src/present-omp/main.cpp +++ b/src/present-omp/main.cpp @@ -546,5 +546,7 @@ int main(int argc, char** argv) { free(h_key); free(h_cipher); free(ciphers); + + return h_checksum != d_checksum; } diff --git a/src/present-sycl/main.cpp b/src/present-sycl/main.cpp index 58360285f..61466fbc4 100644 --- a/src/present-sycl/main.cpp +++ b/src/present-sycl/main.cpp @@ -587,11 +587,6 @@ int main(int argc, char **argv) { } printf("Average kernel execution time: %f (us)\n", (time * 1e-3f) / repeat); - if (h_checksum != d_checksum) - printf("FAIL\n"); - else - printf("PASS\n"); - free(h_plain); free(h_key); free(h_cipher); @@ -603,4 +598,10 @@ int main(int argc, char **argv) { sycl::free(d_sbox_pmt_2, q); sycl::free(d_sbox_pmt_1, q); sycl::free(d_sbox_pmt_0, q); + + if (h_checksum != d_checksum) { + printf("FAIL\n"); + exit(1); + } else + printf("PASS\n"); } diff --git a/src/quicksort-cuda/main.cu b/src/quicksort-cuda/main.cu index bf77539cd..d9c2e83b7 100644 --- a/src/quicksort-cuda/main.cu +++ b/src/quicksort-cuda/main.cu @@ -324,6 +324,7 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, { double totalTime, quickSortTime, stdSortTime; double beginClock, endClock; + uint num_failures = 0; printf("\n\n\n--------------------------------------------------------------------\n"); printf("Allocating array size of %d (data type: %s)\n", arraySize, type_name.c_str()); @@ -371,9 +372,8 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, } std::cout << std::boolalpha << correct << std::endl; if (!correct) { - char y; std::cout << "num_discrepancies: " << num_discrepancies << std::endl; - std::cin >> y; + num_failures++; } } #endif @@ -386,7 +386,6 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, std::vector times; times.resize(NUM_ITERATIONS); double AverageTime = 0.0; - uint num_failures = 0; for(uint k = 0; k < NUM_ITERATIONS; k++) { std::copy(original.begin(), original.end(), pArray); std::vector seqs; @@ -421,6 +420,7 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, #endif } std::cout << " Number of failures: " << num_failures << " out of " << NUM_ITERATIONS << std::endl; + if (num_failures) exit(1); AverageTime = AverageTime/NUM_ITERATIONS; std::cout << "Average Time: " << AverageTime * 1000 << " ms" << std::endl; double stdDev = 0.0, minTime = 1000000.0, maxTime = 0.0; diff --git a/src/quicksort-hip/main.cu b/src/quicksort-hip/main.cu index a53963613..4a6a02d84 100644 --- a/src/quicksort-hip/main.cu +++ b/src/quicksort-hip/main.cu @@ -323,6 +323,7 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, { double totalTime, quickSortTime, stdSortTime; double beginClock, endClock; + uint num_failures = 0; printf("\n\n\n--------------------------------------------------------------------\n"); printf("Allocating array size of %d (data type: %s)\n", arraySize, type_name.c_str()); @@ -370,9 +371,8 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, } std::cout << std::boolalpha << correct << std::endl; if (!correct) { - char y; std::cout << "num_discrepancies: " << num_discrepancies << std::endl; - std::cin >> y; + ++num_failures; } } #endif @@ -385,7 +385,6 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, std::vector times; times.resize(NUM_ITERATIONS); double AverageTime = 0.0; - uint num_failures = 0; for(uint k = 0; k < NUM_ITERATIONS; k++) { std::copy(original.begin(), original.end(), pArray); std::vector seqs; @@ -420,6 +419,7 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, #endif } std::cout << " Number of failures: " << num_failures << " out of " << NUM_ITERATIONS << std::endl; + if (num_failures > 0) exit(1); AverageTime = AverageTime/NUM_ITERATIONS; std::cout << "Average Time: " << AverageTime * 1000 << " ms" << std::endl; double stdDev = 0.0, minTime = 1000000.0, maxTime = 0.0; diff --git a/src/quicksort-omp/main.cpp b/src/quicksort-omp/main.cpp index 1fb08c253..5f5ea6741 100644 --- a/src/quicksort-omp/main.cpp +++ b/src/quicksort-omp/main.cpp @@ -301,6 +301,7 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, { double totalTime, quickSortTime, stdSortTime; double beginClock, endClock; + uint num_failures = 0; printf("\n\n\n--------------------------------------------------------------------\n"); printf("Allocating array size of %d (data type: %s)\n", arraySize, type_name.c_str()); @@ -350,9 +351,8 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, } std::cout << std::boolalpha << correct << std::endl; if (!correct) { - char y; std::cout << "num_discrepancies: " << num_discrepancies << std::endl; - std::cin >> y; + num_failures++; } } #endif @@ -365,7 +365,6 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, std::vector times; times.resize(NUM_ITERATIONS); double AverageTime = 0.0; - uint num_failures = 0; for(uint k = 0; k < NUM_ITERATIONS; k++) { std::copy(original.begin(), original.end(), pArray); std::vector verify(arraySize); @@ -399,6 +398,7 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, #endif } std::cout << " Number of failures: " << num_failures << " out of " << NUM_ITERATIONS << std::endl; + if (num_failures) exit(1); AverageTime = AverageTime/NUM_ITERATIONS; std::cout << "Average Time: " << AverageTime * 1000 << " ms" << std::endl; double stdDev = 0.0, minTime = 1000000.0, maxTime = 0.0; diff --git a/src/quicksort-sycl/main.cpp b/src/quicksort-sycl/main.cpp index b1dcd12c7..666521db5 100644 --- a/src/quicksort-sycl/main.cpp +++ b/src/quicksort-sycl/main.cpp @@ -357,6 +357,7 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, { double totalTime, quickSortTime, stdSortTime; double beginClock, endClock; + uint num_failures = 0; printf("\n\n\n--------------------------------------------------------------------\n"); printf("Allocating array size of %d (data type: %s)\n", arraySize, type_name.c_str()); @@ -404,9 +405,8 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, } std::cout << std::boolalpha << correct << std::endl; if (!correct) { - char y; std::cout << "num_discrepancies: " << num_discrepancies << std::endl; - std::cin >> y; + ++num_failures; } } #endif @@ -425,7 +425,6 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, std::vector times; times.resize(NUM_ITERATIONS); double AverageTime = 0.0; - uint num_failures = 0; for(uint k = 0; k < NUM_ITERATIONS; k++) { std::copy(original.begin(), original.end(), pArray); std::vector seqs; @@ -460,6 +459,8 @@ int test(uint arraySize, unsigned int NUM_ITERATIONS, #endif } std::cout << " Number of failures: " << num_failures << " out of " << NUM_ITERATIONS << std::endl; + if (num_failures > 0) exit(1); + AverageTime = AverageTime/NUM_ITERATIONS; std::cout << "Average Time: " << AverageTime * 1000 << " ms" << std::endl; double stdDev = 0.0, minTime = 1000000.0, maxTime = 0.0; diff --git a/src/radixsort-cuda/main.cu b/src/radixsort-cuda/main.cu index 770c83b48..92a5928d5 100644 --- a/src/radixsort-cuda/main.cu +++ b/src/radixsort-cuda/main.cu @@ -116,7 +116,7 @@ int main(int argc, const char **argv) else printf("FAIL\n"); - return 0; + return passed ? 0 : 1; } void makeRandomUintVector(unsigned int *a, unsigned int numElements, unsigned int keybits) diff --git a/src/radixsort-hip/main.cu b/src/radixsort-hip/main.cu index e5fbb0ccb..9f5731a43 100644 --- a/src/radixsort-hip/main.cu +++ b/src/radixsort-hip/main.cu @@ -116,7 +116,7 @@ int main(int argc, const char **argv) else printf("FAIL\n"); - return 0; + return passed ? 0 : 1; } void makeRandomUintVector(unsigned int *a, unsigned int numElements, unsigned int keybits) diff --git a/src/radixsort-omp/main.cpp b/src/radixsort-omp/main.cpp index 79cc6e8c1..88161eda0 100644 --- a/src/radixsort-omp/main.cpp +++ b/src/radixsort-omp/main.cpp @@ -106,7 +106,7 @@ int main(int argc, const char **argv) else printf("FAIL\n"); - return 0; + return passed ? 0 : 1; } void makeRandomUintVector(unsigned int *a, unsigned int numElements, unsigned int keybits) diff --git a/src/radixsort-sycl/main.cpp b/src/radixsort-sycl/main.cpp index 2d0d84042..23e0f8143 100644 --- a/src/radixsort-sycl/main.cpp +++ b/src/radixsort-sycl/main.cpp @@ -106,7 +106,7 @@ int main(int argc, const char **argv) else printf("FAIL\n"); - return 0; + return passed ? 0 : 1; } void makeRandomUintVector(uint *a, uint numElements, uint keybits) diff --git a/src/rtm8-cuda/rtm8.cu b/src/rtm8-cuda/rtm8.cu index 275e99b5a..fec19f9b1 100644 --- a/src/rtm8-cuda/rtm8.cu +++ b/src/rtm8-cuda/rtm8.cu @@ -259,5 +259,5 @@ int main(int argc, char *argv[]) { cudaFree(image_d); cudaFree(a_d); - return 0; + return ok ? 0 : 1; } diff --git a/src/rtm8-hip/rtm8.cu b/src/rtm8-hip/rtm8.cu index 10997239a..e745443b2 100644 --- a/src/rtm8-hip/rtm8.cu +++ b/src/rtm8-hip/rtm8.cu @@ -259,5 +259,5 @@ int main(int argc, char *argv[]) { hipFree(image_d); hipFree(a_d); - return 0; + return ok ? 0 : 1; } diff --git a/src/rtm8-omp/rtm8.cpp b/src/rtm8-omp/rtm8.cpp index f1f338fff..d46813d60 100644 --- a/src/rtm8-omp/rtm8.cpp +++ b/src/rtm8-omp/rtm8.cpp @@ -205,5 +205,5 @@ int main(int argc, char *argv[]) { free(image_cpu); free(image_gpu); - return 0; + return ok ? 0 : 1; } diff --git a/src/rtm8-sycl/rtm8.cpp b/src/rtm8-sycl/rtm8.cpp index ba854048c..a05e1bff9 100644 --- a/src/rtm8-sycl/rtm8.cpp +++ b/src/rtm8-sycl/rtm8.cpp @@ -241,5 +241,5 @@ int main(int argc, char *argv[]) { sycl::free(image_d, q); sycl::free(a_d, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/sc-cuda/support/verify.h b/src/sc-cuda/support/verify.h index 8125aa696..c35608adb 100644 --- a/src/sc-cuda/support/verify.h +++ b/src/sc-cuda/support/verify.h @@ -49,6 +49,7 @@ inline void compare_output(T *outp, T *outpCPU, int size) { L1norm2 = (double)(sum_delta2 / sum_ref2); if(L1norm2 >= 1e-6){ printf("Test failed\n"); + exit(1); } else { printf("Test Passed\n"); } diff --git a/src/sc-sycl/support/verify.h b/src/sc-sycl/support/verify.h index 7236396c4..ecbab13ec 100644 --- a/src/sc-sycl/support/verify.h +++ b/src/sc-sycl/support/verify.h @@ -49,6 +49,7 @@ inline void compare_output(DATA_TYPE *outp, DATA_TYPE *outpCPU, int size) { L1norm2 = (double)(sum_delta2 / sum_ref2); if(L1norm2 >= 1e-6){ printf("Test failed\n"); + exit(1); } else { printf("Test Passed\n"); } diff --git a/src/scan-cuda/main.cu b/src/scan-cuda/main.cu index 2050e2c61..9a60fb956 100644 --- a/src/scan-cuda/main.cu +++ b/src/scan-cuda/main.cu @@ -9,6 +9,7 @@ void verify(const T* cpu_out, const T* gpu_out, int n) { int error = memcmp(cpu_out, gpu_out, n * sizeof(T)); printf("%s\n", error ? "FAIL" : "PASS"); + if (error) exit(1); } // bank conflict aware optimization @@ -170,7 +171,7 @@ void runTest (const size_t n, const int repeat, bool timing = false) sizeof(T), (time * 1e-3f) / repeat); } cudaMemcpy(gpu_out, d_out, bytes, cudaMemcpyDeviceToHost); - if (!timing) verify(cpu_out, gpu_out, nelems); + verify(cpu_out, gpu_out, nelems); // bcao start = std::chrono::steady_clock::now(); @@ -188,7 +189,7 @@ void runTest (const size_t n, const int repeat, bool timing = false) printf("Reduce the time by %.1f%%\n", (time - bcao_time) * 1.0 / time * 100); } cudaMemcpy(gpu_out, d_out, bytes, cudaMemcpyDeviceToHost); - if (!timing) verify(cpu_out, gpu_out, nelems); + verify(cpu_out, gpu_out, nelems); cudaFree(d_in); cudaFree(d_out); diff --git a/src/scan-hip/main.cu b/src/scan-hip/main.cu index fb709c29e..60b216c3d 100644 --- a/src/scan-hip/main.cu +++ b/src/scan-hip/main.cu @@ -9,6 +9,7 @@ void verify(const T* cpu_out, const T* gpu_out, int n) { int error = memcmp(cpu_out, gpu_out, n * sizeof(T)); printf("%s\n", error ? "FAIL" : "PASS"); + if (error) exit(1); } // bank conflict aware optimization @@ -170,7 +171,7 @@ void runTest (const size_t n, const int repeat, bool timing = false) sizeof(T), (time * 1e-3f) / repeat); } hipMemcpy(gpu_out, d_out, bytes, hipMemcpyDeviceToHost); - if (!timing) verify(cpu_out, gpu_out, nelems); + verify(cpu_out, gpu_out, nelems); // bcao start = std::chrono::steady_clock::now(); @@ -188,7 +189,7 @@ void runTest (const size_t n, const int repeat, bool timing = false) printf("Reduce the time by %.1f%%\n", (time - bcao_time) * 1.0 / time * 100); } hipMemcpy(gpu_out, d_out, bytes, hipMemcpyDeviceToHost); - if (!timing) verify(cpu_out, gpu_out, nelems); + verify(cpu_out, gpu_out, nelems); hipFree(d_in); hipFree(d_out); diff --git a/src/scan-omp/main.cpp b/src/scan-omp/main.cpp index 95bd8529a..453eb691f 100644 --- a/src/scan-omp/main.cpp +++ b/src/scan-omp/main.cpp @@ -9,6 +9,7 @@ void verify(const T* ref_out, const T* out, size_t n) { int error = memcmp(ref_out, out, n * sizeof(T)); printf("%s\n", error ? "FAIL" : "PASS"); + if (error) exit(1); } // bank conflict aware optimization @@ -100,7 +101,7 @@ void runTest (const size_t n, const int repeat, bool timing = false) sizeof(T), (time * 1e-3f) / repeat); } #pragma omp target update from (out[0:nelems]) - if (!timing) verify(ref_out, out, nelems); + verify(ref_out, out, nelems); // bcao start = std::chrono::steady_clock::now(); @@ -171,7 +172,7 @@ void runTest (const size_t n, const int repeat, bool timing = false) } #pragma omp target update from (out[0:nelems]) - if (!timing) verify(ref_out, out, nelems); + verify(ref_out, out, nelems); } } diff --git a/src/scan-sycl/main.cpp b/src/scan-sycl/main.cpp index dcc2c0820..e8ee4e91f 100644 --- a/src/scan-sycl/main.cpp +++ b/src/scan-sycl/main.cpp @@ -9,6 +9,7 @@ void verify(const T* cpu_out, const T* gpu_out, size_t n) { int error = memcmp(cpu_out, gpu_out, n * sizeof(T)); printf("%s\n", error ? "FAIL" : "PASS"); + if (error) exit(1); } #define LOG_MEM_BANKS 5 @@ -179,7 +180,7 @@ void runTest (sycl::queue &q, const size_t n, const int repeat, bool timing = fa sizeof(T), (time * 1e-3f) / repeat); } q.memcpy(gpu_out, d_out, bytes).wait(); - if (!timing) verify(cpu_out, gpu_out, nelems); + verify(cpu_out, gpu_out, nelems); // bcao start = std::chrono::steady_clock::now(); @@ -202,7 +203,7 @@ void runTest (sycl::queue &q, const size_t n, const int repeat, bool timing = fa printf("Reduce the time by %.1f%%\n", (time - bcao_time) * 1.0 / time * 100); } q.memcpy(gpu_out, d_out, bytes).wait(); - if (!timing) verify(cpu_out, gpu_out, nelems); + verify(cpu_out, gpu_out, nelems); sycl::free(d_in, q); sycl::free(d_out, q); diff --git a/src/scan2-cuda/main.cu b/src/scan2-cuda/main.cu index 10d6c935e..b967404ba 100644 --- a/src/scan2-cuda/main.cu +++ b/src/scan2-cuda/main.cu @@ -344,7 +344,8 @@ int main(int argc, char * argv[]) scanLargeArraysCPUReference(verificationOutput, input, length); // compare the results and see if they match - if (compare(output, verificationOutput, length, (float)0.001)) + bool ok = compare(output, verificationOutput, length, (float)0.001); + if (ok) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; @@ -352,5 +353,5 @@ int main(int argc, char * argv[]) free(input); free(output); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/scan2-hip/main.cu b/src/scan2-hip/main.cu index 0f7789783..1fabc1e1e 100644 --- a/src/scan2-hip/main.cu +++ b/src/scan2-hip/main.cu @@ -344,7 +344,8 @@ int main(int argc, char * argv[]) scanLargeArraysCPUReference(verificationOutput, input, length); // compare the results and see if they match - if (compare(output, verificationOutput, length, (float)0.001)) + bool ok = compare(output, verificationOutput, length, (float)0.001); + if (ok) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; @@ -352,5 +353,5 @@ int main(int argc, char * argv[]) free(input); free(output); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/scan2-omp/main.cpp b/src/scan2-omp/main.cpp index 103f1407c..fd872c6ed 100644 --- a/src/scan2-omp/main.cpp +++ b/src/scan2-omp/main.cpp @@ -290,7 +290,9 @@ int main(int argc, char * argv[]) scanLargeArraysCPUReference(verificationOutput, inputBuffer, length); // compare the results and see if they match - if (compare(outputBuffer, verificationOutput, length, (float)0.001)) + bool ok = + compare(outputBuffer, verificationOutput, length, (float)0.001); + if (ok) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; @@ -302,5 +304,5 @@ int main(int argc, char * argv[]) free(blockSumBufferSizeOffset); free(outputBuffer); free(outputBufferSizeOffset); - return 0; + return ok ? 0 : 1; } diff --git a/src/scan2-sycl/main.cpp b/src/scan2-sycl/main.cpp index 936c075c5..9f486e961 100644 --- a/src/scan2-sycl/main.cpp +++ b/src/scan2-sycl/main.cpp @@ -311,7 +311,8 @@ int main(int argc, char * argv[]) scanLargeArraysCPUReference(verificationOutput, input, length); // compare the results and see if they match - if (compare(output, verificationOutput, length, (float)0.001)) + bool ok = compare(output, verificationOutput, length, (float)0.001); + if (ok) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; @@ -319,5 +320,5 @@ int main(int argc, char * argv[]) free(input); free(output); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/scan3-cuda/main.cu b/src/scan3-cuda/main.cu index babf904b6..b782546f3 100644 --- a/src/scan3-cuda/main.cu +++ b/src/scan3-cuda/main.cu @@ -94,7 +94,8 @@ int main(int argc, char * argv[]) scanLargeArraysCPUReference(verificationOutput, input, length); // compare the results and see if they match - if (compare(output, verificationOutput, length, (float)0.001)) + bool ok = compare(output, verificationOutput, length, (float)0.001); + if (ok) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; @@ -102,5 +103,5 @@ int main(int argc, char * argv[]) free(input); free(output); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/scan3-hip/main.cu b/src/scan3-hip/main.cu index e09965acc..b27b48132 100644 --- a/src/scan3-hip/main.cu +++ b/src/scan3-hip/main.cu @@ -94,7 +94,8 @@ int main(int argc, char * argv[]) scanLargeArraysCPUReference(verificationOutput, input, length); // compare the results and see if they match - if (compare(output, verificationOutput, length, (float)0.001)) + bool ok = compare(output, verificationOutput, length, (float)0.001); + if (ok) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; @@ -102,5 +103,5 @@ int main(int argc, char * argv[]) free(input); free(output); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/scan3-sycl/main.cpp b/src/scan3-sycl/main.cpp index f3a0a619a..2c8dc43ab 100644 --- a/src/scan3-sycl/main.cpp +++ b/src/scan3-sycl/main.cpp @@ -99,7 +99,8 @@ int main(int argc, char * argv[]) scanLargeArraysCPUReference(verificationOutput, input, length); // compare the results and see if they match - if (compare(output, verificationOutput, length, (float)0.001)) + bool ok = compare(output, verificationOutput, length, (float)0.001); + if (ok) std::cout << "PASS" << std::endl; else std::cout << "FAIL" << std::endl; @@ -107,5 +108,5 @@ int main(int argc, char * argv[]) free(input); free(output); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/scripts/autohecbench.py b/src/scripts/autohecbench.py index 7ea400e09..62ebe8edc 100755 --- a/src/scripts/autohecbench.py +++ b/src/scripts/autohecbench.py @@ -70,6 +70,13 @@ def run(self): if self.verbose: print(" ".join(cmd)) print(out) + + try: + proc.check_returncode() + except subprocess.CalledProcessError as e: + print(f'{self.path}: Benchmark returned error code {e.returncode}.') + raise(e) + res = re.findall(self.res_regex, out) if not res: raise Exception(self.path + ":\nno regex match for " + self.res_regex + " in\n" + out) diff --git a/src/shuffle-cuda/main.cu b/src/shuffle-cuda/main.cu index a9dbe7757..73732c14d 100644 --- a/src/shuffle-cuda/main.cu +++ b/src/shuffle-cuda/main.cu @@ -54,8 +54,10 @@ void verifyBroadcast(const int *out, const int subGroupSize, int pattern = 0) } if (errors == 0) std::cout << "PASS\n"; - else + else { std::cout << "FAIL\n"; + exit(1); + } } void verifyTransposeMatrix(const float *TransposeMatrix, diff --git a/src/shuffle-hip/main.cu b/src/shuffle-hip/main.cu index c2d8e5506..160259617 100644 --- a/src/shuffle-hip/main.cu +++ b/src/shuffle-hip/main.cu @@ -54,8 +54,10 @@ void verifyBroadcast(const int *out, const int subGroupSize, int pattern = 0) } if (errors == 0) std::cout << "PASS\n"; - else + else { std::cout << "FAIL\n"; + exit(1); + } } void verifyTransposeMatrix(const float *TransposeMatrix, @@ -76,8 +78,10 @@ void verifyTransposeMatrix(const float *TransposeMatrix, } if (errors == 0) std::cout << "PASS\n"; - else + else { std::cout << "FAIL\n"; + exit(1); + } } diff --git a/src/shuffle-sycl/main.cpp b/src/shuffle-sycl/main.cpp index 1753c8634..5045bbc18 100644 --- a/src/shuffle-sycl/main.cpp +++ b/src/shuffle-sycl/main.cpp @@ -54,8 +54,10 @@ void verifyBroadcast(const int *out, const int subGroupSize, int pattern = 0) } if (errors == 0) std::cout << "PASS\n"; - else + else { std::cout << "FAIL\n"; + exit(1); + } } void verifyTransposeMatrix(const float *TransposeMatrix, const float* cpuTransposeMatrix, @@ -75,8 +77,10 @@ void verifyTransposeMatrix(const float *TransposeMatrix, const float* cpuTranspo } if (errors == 0) std::cout << "PASS\n"; - else + else { std::cout << "FAIL\n"; + exit(1); + } } int main(int argc, char* argv[]) { diff --git a/src/snake-cuda/main.cu b/src/snake-cuda/main.cu index 03493e7c3..b6333096f 100644 --- a/src/snake-cuda/main.cu +++ b/src/snake-cuda/main.cu @@ -208,5 +208,5 @@ int main(int argc, const char * const argv[]) cudaFree(Dev_ReadSeq); cudaFree(Dev_RefSeq); cudaFree(Dev_Results); - return 0; + return error ? 1 : 0; } diff --git a/src/snake-hip/main.cu b/src/snake-hip/main.cu index 52a150653..e095686c0 100644 --- a/src/snake-hip/main.cu +++ b/src/snake-hip/main.cu @@ -208,5 +208,5 @@ int main(int argc, const char * const argv[]) hipFree(Dev_ReadSeq); hipFree(Dev_RefSeq); hipFree(Dev_Results); - return 0; + return error ? 1 : 0; } diff --git a/src/snake-omp/main.cpp b/src/snake-omp/main.cpp index 0f8b31d3b..fef841eaa 100644 --- a/src/snake-omp/main.cpp +++ b/src/snake-omp/main.cpp @@ -176,11 +176,11 @@ int main(int argc, const char * const argv[]) } fclose(fp); + bool error = false; #pragma omp target data map(to: ReadSeq[0:NumReads*8], RefSeq[0:NumReads*8]) \ map(alloc: DFinal_Results[0:NumReads]) { - bool error = false; for (int loopPar = 0; loopPar <= 25; loopPar++) { F_ErrorThreshold = (loopPar*ReadLength)/100; @@ -217,5 +217,5 @@ int main(int argc, const char * const argv[]) free(RefSeq); free(DFinal_Results); free(HFinal_Results); - return 0; + return error ? 1 : 0; } diff --git a/src/snake-sycl/main.cpp b/src/snake-sycl/main.cpp index b848eb642..aaae31faf 100644 --- a/src/snake-sycl/main.cpp +++ b/src/snake-sycl/main.cpp @@ -217,5 +217,5 @@ int main(int argc, const char * const argv[]) sycl::free(d_ReadSeq, q); sycl::free(d_RefSeq, q); sycl::free(d_Results, q); - return 0; + return error ? 1 : 0; } diff --git a/src/sobel-cuda/main.cu b/src/sobel-cuda/main.cu index 5eb477e6f..6a696b9c0 100644 --- a/src/sobel-cuda/main.cu +++ b/src/sobel-cuda/main.cu @@ -160,7 +160,8 @@ int main(int argc, char * argv[]) } // compare the results and see if they match - if(compare(outputReference, outputDevice, imageSize)) + bool ok = compare(outputReference, outputDevice, imageSize); + if(ok) printf("PASS\n"); else printf("FAIL\n"); @@ -170,5 +171,5 @@ int main(int argc, char * argv[]) free(verificationOutput); free(inputImageData); free(outputImageData); - return SDK_SUCCESS; + return ok ? 0 : 1; } diff --git a/src/sobel-hip/main.cu b/src/sobel-hip/main.cu index 5561d9c74..20115ec12 100644 --- a/src/sobel-hip/main.cu +++ b/src/sobel-hip/main.cu @@ -160,7 +160,8 @@ int main(int argc, char * argv[]) } // compare the results and see if they match - if(compare(outputReference, outputDevice, imageSize)) + bool ok = compare(outputReference, outputDevice, imageSize); + if (ok) printf("PASS\n"); else printf("FAIL\n"); @@ -170,5 +171,5 @@ int main(int argc, char * argv[]) free(verificationOutput); free(inputImageData); free(outputImageData); - return SDK_SUCCESS; + return ok ? 0 : 1; } diff --git a/src/sobel-omp/main.cpp b/src/sobel-omp/main.cpp index b55ede5f8..0ed380b4c 100644 --- a/src/sobel-omp/main.cpp +++ b/src/sobel-omp/main.cpp @@ -171,7 +171,8 @@ int main(int argc, char * argv[]) } // compare the results and see if they match - if(compare(outputReference, outputDevice, imageSize)) + bool ok = compare(outputReference, outputDevice, imageSize); + if(ok) printf("PASS\n"); else printf("FAIL\n"); @@ -181,5 +182,5 @@ int main(int argc, char * argv[]) free(verificationOutput); free(inputImageData); free(outputImageData); - return SDK_SUCCESS; + return ok ? 0 : 1; } diff --git a/src/sobel-sycl/main.cpp b/src/sobel-sycl/main.cpp index a9bbcae53..f9e8b3b23 100644 --- a/src/sobel-sycl/main.cpp +++ b/src/sobel-sycl/main.cpp @@ -181,7 +181,8 @@ int main(int argc, char * argv[]) } // compare the results and see if they match for the given input image - if(compare(outputReference, outputDevice, imageSize)) + bool ok = compare(outputReference, outputDevice, imageSize); + if (ok) printf("PASS\n"); else printf("FAIL\n"); @@ -191,5 +192,5 @@ int main(int argc, char * argv[]) free(verificationOutput); free(inputImageData); free(outputImageData); - return SDK_SUCCESS; + return ok ? 0 : 1; } diff --git a/src/softmax-cuda/main.cu b/src/softmax-cuda/main.cu index 0b1acd12c..7af34e3a6 100644 --- a/src/softmax-cuda/main.cu +++ b/src/softmax-cuda/main.cu @@ -102,5 +102,5 @@ int main(int argc, char* argv[]) { free(output_gpu); cudaFree(d_input); cudaFree(d_output); - return 0; + return ok ? 0 : 1; } diff --git a/src/softmax-hip/main.cu b/src/softmax-hip/main.cu index 470531993..fbe2e6ffd 100644 --- a/src/softmax-hip/main.cu +++ b/src/softmax-hip/main.cu @@ -103,5 +103,5 @@ int main(int argc, char* argv[]) { free(output_gpu); hipFree(d_input); hipFree(d_output); - return 0; + return ok ? 0 : 1; } diff --git a/src/softmax-omp/main.cpp b/src/softmax-omp/main.cpp index c742e12a5..9ad27c15a 100644 --- a/src/softmax-omp/main.cpp +++ b/src/softmax-omp/main.cpp @@ -85,5 +85,5 @@ int main(int argc, char* argv[]) { free(input); free(output_cpu); free(output_gpu); - return 0; + return ok ? 0 : 1; } diff --git a/src/softmax-sycl/main.cpp b/src/softmax-sycl/main.cpp index cefc19bfe..1fff3e3e5 100644 --- a/src/softmax-sycl/main.cpp +++ b/src/softmax-sycl/main.cpp @@ -106,5 +106,5 @@ int main(int argc, char* argv[]) { free(output_gpu); sycl::free(d_input, q); sycl::free(d_output, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/sort-cuda/main.cu b/src/sort-cuda/main.cu index 2e5904c85..46af3a037 100644 --- a/src/sort-cuda/main.cu +++ b/src/sort-cuda/main.cu @@ -32,8 +32,10 @@ void verifySort(const T *keys, const size_t size) } if (passed) std::cout << "PASS" << std::endl; - else + else { std::cout << "FAIL" << std::endl; + exit(1); + } } int main(int argc, char** argv) diff --git a/src/sort-hip/main.cu b/src/sort-hip/main.cu index 231c4ccda..0b9542a1f 100644 --- a/src/sort-hip/main.cu +++ b/src/sort-hip/main.cu @@ -32,8 +32,10 @@ void verifySort(const T *keys, const size_t size) } if (passed) std::cout << "PASS" << std::endl; - else + else { std::cout << "FAIL" << std::endl; + exit(1); + } } int main(int argc, char** argv) diff --git a/src/sort-omp/main.cpp b/src/sort-omp/main.cpp index 9a6a0bec3..45f5fd130 100644 --- a/src/sort-omp/main.cpp +++ b/src/sort-omp/main.cpp @@ -34,8 +34,10 @@ void verifySort(const T *keys, const size_t size) } if (passed) std::cout << "PASS" << std::endl; - else + else { std::cout << "FAIL" << std::endl; + exit(1); + } } int main(int argc, char** argv) diff --git a/src/sort-sycl/main.cpp b/src/sort-sycl/main.cpp index 32349447e..950923f2b 100644 --- a/src/sort-sycl/main.cpp +++ b/src/sort-sycl/main.cpp @@ -27,8 +27,10 @@ void verifySort(const T *keys, const size_t size) } if (passed) std::cout << "PASS" << std::endl; - else + else { std::cout << "FAIL" << std::endl; + exit(1); + } } int main(int argc, char** argv) diff --git a/src/sortKV-cuda/main.cu b/src/sortKV-cuda/main.cu index 91e4a5b07..f2d1370c9 100644 --- a/src/sortKV-cuda/main.cu +++ b/src/sortKV-cuda/main.cu @@ -55,6 +55,7 @@ void sort_key_value (int n, int repeat, bool verify) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); } } diff --git a/src/sortKV-hip/main.cu b/src/sortKV-hip/main.cu index 91e4a5b07..f2d1370c9 100644 --- a/src/sortKV-hip/main.cu +++ b/src/sortKV-hip/main.cu @@ -55,6 +55,7 @@ void sort_key_value (int n, int repeat, bool verify) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); } } diff --git a/src/sortKV-sycl/main.cpp b/src/sortKV-sycl/main.cpp index cdbd9deb6..1337a1131 100644 --- a/src/sortKV-sycl/main.cpp +++ b/src/sortKV-sycl/main.cpp @@ -50,6 +50,7 @@ void sort_key_value (sycl::queue &q, int n, int repeat, bool verify) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); } } diff --git a/src/split-cuda/main.cu b/src/split-cuda/main.cu index bca2617a8..8c3b91dc9 100644 --- a/src/split-cuda/main.cu +++ b/src/split-cuda/main.cu @@ -208,5 +208,5 @@ int main(int argc, char* argv[]) free(keys); free(out); - return 0; + return check ? 0 : 1; } diff --git a/src/split-hip/main.cu b/src/split-hip/main.cu index b7dfcd039..df4fca628 100644 --- a/src/split-hip/main.cu +++ b/src/split-hip/main.cu @@ -208,5 +208,5 @@ int main(int argc, char* argv[]) free(keys); free(out); - return 0; + return check ? 0 : 1; } diff --git a/src/split-omp/main.cpp b/src/split-omp/main.cpp index 6de51e7a4..b3ceb7c47 100644 --- a/src/split-omp/main.cpp +++ b/src/split-omp/main.cpp @@ -194,5 +194,5 @@ int main(int argc, char** argv) { free(keys); free(out); - return 0; + return check ? 0 : 1; } diff --git a/src/split-sycl/main.cpp b/src/split-sycl/main.cpp index 783d5c04b..a05d394c7 100644 --- a/src/split-sycl/main.cpp +++ b/src/split-sycl/main.cpp @@ -217,5 +217,5 @@ int main(int argc, char** argv) { free(keys); free(out); - return 0; + return check ? 0 : 1; } diff --git a/src/ss-cuda/main.cu b/src/ss-cuda/main.cu index f49295f1a..993a21d39 100644 --- a/src/ss-cuda/main.cu +++ b/src/ss-cuda/main.cu @@ -223,7 +223,8 @@ int main(int argc, char* argv[]) cudaMemcpy(resultCount, resultCountBuf, workGroupCount * sizeof(uint), cudaMemcpyDeviceToHost); cudaMemcpy(result, resultBuf, (textLength - subStrLength + 1) * sizeof(uint), cudaMemcpyDeviceToHost); - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if (verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + return 1; } if(subStrLength > 1) @@ -251,7 +252,8 @@ int main(int argc, char* argv[]) cudaMemcpy(resultCount, resultCountBuf, workGroupCount * sizeof(uint), cudaMemcpyDeviceToHost); cudaMemcpy(result, resultBuf, (textLength - subStrLength + 1) * sizeof(uint), cudaMemcpyDeviceToHost); - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if (verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + return 1; } printf("Average kernel execution time: %f (us)\n", (time * 1e-3f) / iterations); diff --git a/src/ss-hip/main.cu b/src/ss-hip/main.cu index a0f721a61..bbba500b9 100644 --- a/src/ss-hip/main.cu +++ b/src/ss-hip/main.cu @@ -49,7 +49,7 @@ int verify(uint* resultCount, uint workGroupCount, // compare the results and see if they match bool pass = (count == cpuResults.size()); pass = pass && std::equal (result, result+count, cpuResults.begin()); - if(pass) + if (pass) { std::cout << "Passed!\n" << std::endl; return 0; @@ -223,7 +223,8 @@ int main(int argc, char* argv[]) hipMemcpy(resultCount, resultCountBuf, workGroupCount * sizeof(uint), hipMemcpyDeviceToHost); hipMemcpy(result, resultBuf, (textLength - subStrLength + 1) * sizeof(uint), hipMemcpyDeviceToHost); - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if (verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + return 1; } if(subStrLength > 1) @@ -251,7 +252,8 @@ int main(int argc, char* argv[]) hipMemcpy(resultCount, resultCountBuf, workGroupCount * sizeof(uint), hipMemcpyDeviceToHost); hipMemcpy(result, resultBuf, (textLength - subStrLength + 1) * sizeof(uint), hipMemcpyDeviceToHost); - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if (verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + return -1; } printf("Average kernel execution time: %f (us)\n", (time * 1e-3f) / iterations); diff --git a/src/ss-omp/main.cpp b/src/ss-omp/main.cpp index 344379b1e..a0e090d5b 100644 --- a/src/ss-omp/main.cpp +++ b/src/ss-omp/main.cpp @@ -196,6 +196,7 @@ int main(int argc, char* argv[]) const uint maxSearchLength = searchLenPerWG; double time = 0.0; + unsigned errors = 0; #pragma omp target data map(to: pattern[0:subStrLength], \ text[0:textLength]) \ @@ -281,7 +282,8 @@ int main(int argc, char* argv[]) #pragma omp target update from (resultCount[0:workGroupCount]) #pragma omp target update from (result[0:textLength - subStrLength + 1]) - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if(verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + errors++; } /* @@ -453,7 +455,8 @@ int main(int argc, char* argv[]) #pragma omp target update from (resultCount[0:workGroupCount]) #pragma omp target update from (result[0:textLength - subStrLength + 1]) - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if (verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + errors++; } printf("Average kernel execution time: %f (us)\n", (time * 1e-3f) / iterations); @@ -462,5 +465,5 @@ int main(int argc, char* argv[]) free(text); free(result); free(resultCount); - return 0; + return errors ? 1 : 0; } diff --git a/src/ss-sycl/main.cpp b/src/ss-sycl/main.cpp index 4b833a916..735739137 100644 --- a/src/ss-sycl/main.cpp +++ b/src/ss-sycl/main.cpp @@ -295,7 +295,8 @@ int main(int argc, char* argv[]) q.memcpy(result, resultBuf, (textLength - subStrLength + 1) * sizeof(uint)); q.wait(); - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if (verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + return 1; } /* @@ -468,7 +469,8 @@ int main(int argc, char* argv[]) q.memcpy(result, resultBuf, (textLength - subStrLength + 1) * sizeof(uint)); q.wait(); - verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults); + if (verify(resultCount, workGroupCount, result, searchLenPerWG, cpuResults)) + return 1; } printf("Average kernel execution time: %f (us)\n", (time * 1e-3f) / iterations); diff --git a/src/sssp-cuda/main.cu b/src/sssp-cuda/main.cu index 1820b7dd8..3843e2d70 100644 --- a/src/sssp-cuda/main.cu +++ b/src/sssp-cuda/main.cu @@ -621,5 +621,5 @@ int main(int argc, char **argv) { timer.print("Host/Device Deallocation", 1); printf("%s\n", ok ? "PASS" : "FAIL"); - return 0; + return ok ? 0 : 1; } diff --git a/src/sssp-hip/main.cu b/src/sssp-hip/main.cu index 3a6b3a50e..16b665f32 100644 --- a/src/sssp-hip/main.cu +++ b/src/sssp-hip/main.cu @@ -622,5 +622,5 @@ int main(int argc, char **argv) { timer.print("Host/Device Deallocation", 1); printf("%s\n", ok ? "PASS" : "FAIL"); - return 0; + return ok ? 0 : 1; } diff --git a/src/sssp-sycl/main.cpp b/src/sssp-sycl/main.cpp index 569eeb32d..4abbc3a52 100644 --- a/src/sssp-sycl/main.cpp +++ b/src/sssp-sycl/main.cpp @@ -624,5 +624,5 @@ int main(int argc, char **argv) { timer.print("Host/Device Deallocation", 1); printf("%s\n", ok ? "PASS" : "FAIL"); - return 0; + return ok ? 0 : 1; } diff --git a/src/stddev-cuda/main.cu b/src/stddev-cuda/main.cu index 5ae919100..bc19f5037 100644 --- a/src/stddev-cuda/main.cu +++ b/src/stddev-cuda/main.cu @@ -158,5 +158,5 @@ int main(int argc, char* argv[]) { free(data); cudaFree(d_std); cudaFree(d_data); - return 0; + return ok ? 0 : 1; } diff --git a/src/stddev-hip/main.cu b/src/stddev-hip/main.cu index 99f50d178..bcbf77922 100644 --- a/src/stddev-hip/main.cu +++ b/src/stddev-hip/main.cu @@ -158,5 +158,5 @@ int main(int argc, char* argv[]) { free(data); hipFree(d_std); hipFree(d_data); - return 0; + return ok ? 0 : 1; } diff --git a/src/stddev-omp/main.cpp b/src/stddev-omp/main.cpp index 73939f029..386dcead4 100644 --- a/src/stddev-omp/main.cpp +++ b/src/stddev-omp/main.cpp @@ -152,5 +152,5 @@ int main(int argc, char* argv[]) { free(std_ref); free(std); free(data); - return 0; + return ok ? 0 : 1; } diff --git a/src/stddev-sycl/main.cpp b/src/stddev-sycl/main.cpp index 0be2cfb32..894ad89f0 100644 --- a/src/stddev-sycl/main.cpp +++ b/src/stddev-sycl/main.cpp @@ -190,6 +190,6 @@ int main(int argc, char* argv[]) { free(data); sycl::free(d_std, q); sycl::free(d_data, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/stencil1d-cuda/stencil_1d.cu b/src/stencil1d-cuda/stencil_1d.cu index 06a00dbd6..74bb2d54f 100644 --- a/src/stencil1d-cuda/stencil_1d.cu +++ b/src/stencil1d-cuda/stencil_1d.cu @@ -116,6 +116,6 @@ int main(int argc, char* argv[]) { free(a); free(b); cudaFree(d_a); - cudaFree(d_b); - return 0; + cudaFree(d_b); + return ok ? 0 : 1; } diff --git a/src/stencil1d-hip/stencil_1d.cu b/src/stencil1d-hip/stencil_1d.cu index 2dd4f10de..c7ad11f00 100644 --- a/src/stencil1d-hip/stencil_1d.cu +++ b/src/stencil1d-hip/stencil_1d.cu @@ -117,5 +117,5 @@ int main(int argc, char* argv[]) { free(b); hipFree(d_a); hipFree(d_b); - return 0; + return ok ? 0 : 1; } diff --git a/src/stencil1d-omp/stencil_1d.cpp b/src/stencil1d-omp/stencil_1d.cpp index 46affbf33..5f1a48d0f 100644 --- a/src/stencil1d-omp/stencil_1d.cpp +++ b/src/stencil1d-omp/stencil_1d.cpp @@ -88,6 +88,6 @@ int main(int argc, char* argv[]) { // Cleanup free(a); - free(b); - return 0; + free(b); + return ok ? 0 : 1; } diff --git a/src/stencil1d-sycl/stencil_1d.cpp b/src/stencil1d-sycl/stencil_1d.cpp index 7ca0f3b0c..147effbaa 100644 --- a/src/stencil1d-sycl/stencil_1d.cpp +++ b/src/stencil1d-sycl/stencil_1d.cpp @@ -120,5 +120,5 @@ int main(int argc, char* argv[]) { free(b); sycl::free(d_in, q); sycl::free(d_out, q); - return 0; + return ok ? 0 : 1; } diff --git a/src/svd3x3-cuda/main.cu b/src/svd3x3-cuda/main.cu index 310740507..d1ff49d39 100644 --- a/src/svd3x3-cuda/main.cu +++ b/src/svd3x3-cuda/main.cu @@ -113,5 +113,5 @@ int main(int argc, char* argv[]) free(input); free(result); free(result_h); - return 0; + return ok ? 0 : 1; } diff --git a/src/svd3x3-hip/main.cu b/src/svd3x3-hip/main.cu index b1989a63e..7e8b093a8 100644 --- a/src/svd3x3-hip/main.cu +++ b/src/svd3x3-hip/main.cu @@ -113,5 +113,5 @@ int main(int argc, char* argv[]) free(input); free(result); free(result_h); - return 0; + return ok ? 0 : 1; } diff --git a/src/svd3x3-omp/main.cpp b/src/svd3x3-omp/main.cpp index 2770406f6..f6156e1b9 100644 --- a/src/svd3x3-omp/main.cpp +++ b/src/svd3x3-omp/main.cpp @@ -112,5 +112,5 @@ int main(int argc, char* argv[]) free(input); free(result); free(result_h); - return 0; + return ok ? 0 : 1; } diff --git a/src/svd3x3-sycl/main.cpp b/src/svd3x3-sycl/main.cpp index c65cc8661..9b0850b81 100644 --- a/src/svd3x3-sycl/main.cpp +++ b/src/svd3x3-sycl/main.cpp @@ -121,5 +121,5 @@ int main(int argc, char* argv[]) free(input); free(result); free(result_h); - return 0; + return ok ? 0 : 1; } diff --git a/src/swish-cuda/main.cu b/src/swish-cuda/main.cu index aaaf7b918..b72631032 100644 --- a/src/swish-cuda/main.cu +++ b/src/swish-cuda/main.cu @@ -116,6 +116,7 @@ void eval_swish (const int N, const int repeat) { free(h_dY); free(r_dX); free(r_Y); + if (!ok) exit(1); } int main(int argc, char* argv[]) diff --git a/src/swish-hip/main.cu b/src/swish-hip/main.cu index 265c2ed7f..bd31c59c6 100644 --- a/src/swish-hip/main.cu +++ b/src/swish-hip/main.cu @@ -116,6 +116,7 @@ void eval_swish (const int N, const int repeat) { free(h_dY); free(r_dX); free(r_Y); + if (!ok) exit(1); } int main(int argc, char* argv[]) diff --git a/src/swish-omp/main.cpp b/src/swish-omp/main.cpp index 6b8a9f2f1..6543fb6ad 100644 --- a/src/swish-omp/main.cpp +++ b/src/swish-omp/main.cpp @@ -90,6 +90,7 @@ void eval_swish (const int N, const int repeat) { free(h_dY); free(r_dX); free(r_Y); + if (!ok) exit(1); } int main(int argc, char* argv[]) diff --git a/src/swish-sycl/main.cpp b/src/swish-sycl/main.cpp index 775d2bda9..cc0b7b116 100644 --- a/src/swish-sycl/main.cpp +++ b/src/swish-sycl/main.cpp @@ -130,6 +130,7 @@ void eval_swish (const int N, const int repeat) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); sycl::free(d_X, q); sycl::free(d_Y, q); diff --git a/src/tensorAccessor-cuda/main.cu b/src/tensorAccessor-cuda/main.cu index 63cf2dcc9..9ab3dbbb8 100644 --- a/src/tensorAccessor-cuda/main.cu +++ b/src/tensorAccessor-cuda/main.cu @@ -154,6 +154,6 @@ int main(int argc, char* argv[]) free(v); free(r); free(r_ref); - - return 0; + + return ok ? 0 : 1; } diff --git a/src/tensorAccessor-hip/main.cu b/src/tensorAccessor-hip/main.cu index a6d701cce..15dd0b1b7 100644 --- a/src/tensorAccessor-hip/main.cu +++ b/src/tensorAccessor-hip/main.cu @@ -155,5 +155,5 @@ int main(int argc, char* argv[]) free(r); free(r_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/tensorAccessor-sycl/main.cpp b/src/tensorAccessor-sycl/main.cpp index 7031f0b98..3762ea76f 100644 --- a/src/tensorAccessor-sycl/main.cpp +++ b/src/tensorAccessor-sycl/main.cpp @@ -182,5 +182,5 @@ int main(int argc, char* argv[]) free(r); free(r_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/tensorT-cuda/main.cu b/src/tensorT-cuda/main.cu index 723044654..94f789216 100644 --- a/src/tensorT-cuda/main.cu +++ b/src/tensorT-cuda/main.cu @@ -31,7 +31,12 @@ void verify(double *input, double *output) { break; } } - if (!error) printf("PASS\n"); + if (!error) + printf("PASS\n"); + else { + printf("FAIL\n"); + exit(1); + } } __global__ void tensor_transpose( diff --git a/src/tensorT-hip/main.cu b/src/tensorT-hip/main.cu index 2215f83cb..5dac77394 100644 --- a/src/tensorT-hip/main.cu +++ b/src/tensorT-hip/main.cu @@ -31,7 +31,12 @@ void verify(double *input, double *output) { break; } } - if (!error) printf("PASS\n"); + if (!error) + printf("PASS\n"); + else { + printf("FAIL\n"); + exit(1); + } } __global__ void tensor_transpose( diff --git a/src/tensorT-omp/main.cpp b/src/tensorT-omp/main.cpp index 8e2bc16b2..c5f2a5aac 100644 --- a/src/tensorT-omp/main.cpp +++ b/src/tensorT-omp/main.cpp @@ -31,10 +31,15 @@ void verify(double *input, double *output) { break; } } - if (!error) printf("PASS\n"); + if (!error) + printf("PASS\n"); + else { + printf("FAIL\n"); + exit(1); + } } -int main(int argv, char **argc) { +int main(int argc, char **argv) { if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; diff --git a/src/tensorT-sycl/main.cpp b/src/tensorT-sycl/main.cpp index 5e7edcfd2..5f1a163f2 100644 --- a/src/tensorT-sycl/main.cpp +++ b/src/tensorT-sycl/main.cpp @@ -32,6 +32,7 @@ void verify(double *input, double *output) { } } if (!error) printf("PASS\n"); + else exit(1); } int main(int argv, char **argc) { diff --git a/src/tissue-cuda/main.cu b/src/tissue-cuda/main.cu index e3e2bcc0c..0af1b5b45 100644 --- a/src/tissue-cuda/main.cu +++ b/src/tissue-cuda/main.cu @@ -169,6 +169,7 @@ int main(int argc, char** argv) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); // timing kernel execution auto start = std::chrono::steady_clock::now(); diff --git a/src/tissue-hip/main.cu b/src/tissue-hip/main.cu index 48c140f4c..379e7ab35 100644 --- a/src/tissue-hip/main.cu +++ b/src/tissue-hip/main.cu @@ -169,6 +169,7 @@ int main(int argc, char** argv) { } } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); // timing kernel execution auto start = std::chrono::steady_clock::now(); diff --git a/src/tissue-omp/main.cpp b/src/tissue-omp/main.cpp index 3e400d741..56e825b5f 100644 --- a/src/tissue-omp/main.cpp +++ b/src/tissue-omp/main.cpp @@ -154,6 +154,7 @@ int main(int argc, char** argv) { } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); // timing kernel execution auto start = std::chrono::steady_clock::now(); diff --git a/src/tissue-sycl/main.cpp b/src/tissue-sycl/main.cpp index b9403e09d..8c743e92e 100644 --- a/src/tissue-sycl/main.cpp +++ b/src/tissue-sycl/main.cpp @@ -181,6 +181,7 @@ int main(int argc, char** argv) { } printf("%s\n", ok ? "PASS" : "FAIL"); + if (!ok) exit(1); // timing kernel execution auto start = std::chrono::steady_clock::now(); diff --git a/src/tsa-cuda/main.cu b/src/tsa-cuda/main.cu index 631e99ef9..d5389115f 100644 --- a/src/tsa-cuda/main.cu +++ b/src/tsa-cuda/main.cu @@ -113,6 +113,7 @@ void tsa(int width, int height, int repeat) { cudaFree(d_real[1]); cudaFree(d_imag[0]); cudaFree(d_imag[1]); + if (!ok) exit(1); } int main(int argc, char** argv) { diff --git a/src/tsa-hip/main.cu b/src/tsa-hip/main.cu index 487fe0623..981bd2564 100644 --- a/src/tsa-hip/main.cu +++ b/src/tsa-hip/main.cu @@ -112,6 +112,7 @@ void tsa(int width, int height, int repeat) { hipFree(d_real[1]); hipFree(d_imag[0]); hipFree(d_imag[1]); + if (!ok) exit(1); } int main(int argc, char** argv) { diff --git a/src/tsa-omp/main.cpp b/src/tsa-omp/main.cpp index 2f6b2cd26..f12416707 100644 --- a/src/tsa-omp/main.cpp +++ b/src/tsa-omp/main.cpp @@ -112,6 +112,7 @@ void tsa(int width, int height, int repeat) { delete[] d_imag[1]; delete[] h_real; delete[] h_imag; + if (!ok) exit(1); } int main(int argc, char** argv) { diff --git a/src/tsa-sycl/main.cpp b/src/tsa-sycl/main.cpp index bbdc96b46..7a0a64d3c 100644 --- a/src/tsa-sycl/main.cpp +++ b/src/tsa-sycl/main.cpp @@ -129,6 +129,7 @@ void tsa(sycl::queue &q, int width, int height, int repeat) { sycl::free(d_real[1], q); sycl::free(d_imag[0], q); sycl::free(d_imag[1], q); + if (!ok) exit(1); } int main(int argc, char** argv) { diff --git a/src/urng-cuda/main.cu b/src/urng-cuda/main.cu index cc8bc7491..686430c63 100644 --- a/src/urng-cuda/main.cu +++ b/src/urng-cuda/main.cu @@ -123,7 +123,8 @@ int main(int argc, char** argv) mean /= (imageSize * factor); std::cout << "The averaged mean of the image: " << mean << std::endl; - if(fabs(mean) < 1.0) + bool ok = fabs(mean) < 1.0; + if(ok) { std::cout << "PASS\n" << std::endl; } @@ -147,5 +148,5 @@ int main(int argc, char** argv) free(inputImageData); free(outputImageData); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/urng-hip/main.cu b/src/urng-hip/main.cu index 1f41266fb..403e84c92 100644 --- a/src/urng-hip/main.cu +++ b/src/urng-hip/main.cu @@ -123,7 +123,8 @@ int main(int argc, char** argv) mean /= (imageSize * factor); std::cout << "The averaged mean of the image: " << mean << std::endl; - if(fabs(mean) < 1.0) + bool ok = fabs(mean) < 1.0; + if(ok) { std::cout << "PASS" << std::endl; } @@ -147,5 +148,5 @@ int main(int argc, char** argv) free(inputImageData); free(outputImageData); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/urng-omp/main.cpp b/src/urng-omp/main.cpp index 662f86d19..43176c6ac 100644 --- a/src/urng-omp/main.cpp +++ b/src/urng-omp/main.cpp @@ -133,7 +133,8 @@ int main(int argc, char** argv) mean /= (imageSize * factor); std::cout << "The averaged mean of the image: " << mean << std::endl; - if(fabs(mean) < 1.0) + bool ok = fabs(mean) < 1.0; + if(ok) { std::cout << "PASS" << std::endl; } @@ -157,7 +158,7 @@ int main(int argc, char** argv) free(inputImageData); free(outputImageData); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/urng-sycl/main.cpp b/src/urng-sycl/main.cpp index 00ef07242..58dcea6a7 100644 --- a/src/urng-sycl/main.cpp +++ b/src/urng-sycl/main.cpp @@ -137,7 +137,8 @@ int main(int argc, char** argv) mean /= (4 * width * height * factor); std::cout << "The averaged mean: " << mean << std::endl; - if(fabs(mean) < 1.0) + bool ok = fabs(mean) < 1.0; + if (ok) { std::cout << "PASS" << std::endl; } @@ -161,5 +162,5 @@ int main(int argc, char** argv) free(inputImageData); free(outputImageData); free(verificationOutput); - return 0; + return ok ? 0 : 1; } diff --git a/src/vanGenuchten-cuda/main.cu b/src/vanGenuchten-cuda/main.cu index a319ede1b..f12f19989 100644 --- a/src/vanGenuchten-cuda/main.cu +++ b/src/vanGenuchten-cuda/main.cu @@ -140,5 +140,5 @@ int main(int argc, char* argv[]) delete(theta_ref); delete(K_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/vanGenuchten-hip/main.cu b/src/vanGenuchten-hip/main.cu index 541dd6e6f..3059aea30 100644 --- a/src/vanGenuchten-hip/main.cu +++ b/src/vanGenuchten-hip/main.cu @@ -140,5 +140,5 @@ int main(int argc, char* argv[]) delete(theta_ref); delete(K_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/vanGenuchten-omp/main.cpp b/src/vanGenuchten-omp/main.cpp index 129efddbe..a44815e84 100644 --- a/src/vanGenuchten-omp/main.cpp +++ b/src/vanGenuchten-omp/main.cpp @@ -116,5 +116,5 @@ int main(int argc, char* argv[]) delete(theta_ref); delete(K_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/vanGenuchten-sycl/main.cpp b/src/vanGenuchten-sycl/main.cpp index 024ede3b3..1ab177156 100644 --- a/src/vanGenuchten-sycl/main.cpp +++ b/src/vanGenuchten-sycl/main.cpp @@ -156,5 +156,5 @@ int main(int argc, char* argv[]) delete(theta_ref); delete(K_ref); - return 0; + return ok ? 0 : 1; } diff --git a/src/wordcount-sycl/main.cpp b/src/wordcount-sycl/main.cpp index d61885964..304d994fb 100644 --- a/src/wordcount-sycl/main.cpp +++ b/src/wordcount-sycl/main.cpp @@ -66,5 +66,5 @@ int main(int argc, char* argv[]) auto time = std::chrono::duration_cast(end - start).count(); std::cout << "Average time of word count: " << time * 1e-9f / repeat << " (s)\n"; - return 0; + return ok ? 0 : 1; } diff --git a/src/wyllie-cuda/main.cu b/src/wyllie-cuda/main.cu index 4c9de5dee..1232a4dc6 100644 --- a/src/wyllie-cuda/main.cu +++ b/src/wyllie-cuda/main.cu @@ -102,6 +102,6 @@ int main(int argc, char* argv[]) { #endif printf("%s\n", (h_res == d_res) ? "PASS" : "FAIL"); - - return 0; + + return (h_res == d_res) ? 0 : 1; } diff --git a/src/wyllie-hip/main.cu b/src/wyllie-hip/main.cu index 1a65af680..0a1a011f9 100644 --- a/src/wyllie-hip/main.cu +++ b/src/wyllie-hip/main.cu @@ -103,5 +103,5 @@ int main(int argc, char* argv[]) { printf("%s\n", (h_res == d_res) ? "PASS" : "FAIL"); - return 0; + return (h_res == d_res) ? 0 : 1; } diff --git a/src/wyllie-omp/main.cpp b/src/wyllie-omp/main.cpp index e78f47e2b..f25cdbbd4 100644 --- a/src/wyllie-omp/main.cpp +++ b/src/wyllie-omp/main.cpp @@ -96,6 +96,6 @@ int main(int argc, char* argv[]) { #endif printf("%s\n", (h_res == d_res) ? "PASS" : "FAIL"); - - return 0; + + return (h_res == d_res) ? 0 : 1; } diff --git a/src/wyllie-sycl/main.cpp b/src/wyllie-sycl/main.cpp index 47afa1f81..c8d8c768e 100644 --- a/src/wyllie-sycl/main.cpp +++ b/src/wyllie-sycl/main.cpp @@ -105,5 +105,5 @@ int main(int argc, char* argv[]) { printf("%s\n", (h_res == d_res) ? "PASS" : "FAIL"); - return 0; + return (h_res == d_res) ? 0 : 1; }