summaryrefslogtreecommitdiffstats
path: root/tools/cuda-ab/streams2.cu
diff options
context:
space:
mode:
Diffstat (limited to 'tools/cuda-ab/streams2.cu')
-rw-r--r--tools/cuda-ab/streams2.cu27
1 files changed, 22 insertions, 5 deletions
diff --git a/tools/cuda-ab/streams2.cu b/tools/cuda-ab/streams2.cu
index a5dc5c2..cd6d1b8 100644
--- a/tools/cuda-ab/streams2.cu
+++ b/tools/cuda-ab/streams2.cu
@@ -137,11 +137,28 @@ int main(void)
CHECK(cudaStreamSynchronize(s2s));
CHECK(cudaEventElapsedTime(&ms, t0, t1));
- for (i = 0; i < n; i++) {
- if (h_c1[i] != h_a1[i] + h_b1[i])
- bad++;
- if (h_c2[i] != (h_a2[i] + h_b2[i]) * s2)
- bad++;
+ {
+ int b1 = 0, b2 = 0, f1 = -1, f2 = -1;
+
+ for (i = 0; i < n; i++) {
+ if (h_c1[i] != h_a1[i] + h_b1[i]) {
+ b1++;
+ if (f1 < 0)
+ f1 = i;
+ }
+ if (h_c2[i] != (h_a2[i] + h_b2[i]) * s2) {
+ b2++;
+ if (f2 < 0)
+ f2 = i;
+ }
+ }
+ printf("C1 bad=%d first=%d a=%.3f %.3f %.3f b=%.3f %.3f %.3f c=%.3f %.3f %.3f\n",
+ b1, f1, h_a1[0], h_a1[1], h_a1[2], h_b1[0], h_b1[1],
+ h_b1[2], h_c1[0], h_c1[1], h_c1[2]);
+ printf("C2 bad=%d first=%d a=%.3f %.3f b=%.3f %.3f c=%.3f %.3f\n",
+ b2, f2, h_a2[0], h_a2[1], h_b2[0], h_b2[1], h_c2[0],
+ h_c2[1]);
+ bad = b1 + b2;
}
printf("STREAMS n=%d bad=%d\n", n, bad);