Skip to content

Commit 68fb951

Browse files
committed
add exception code to histogram sample, fix #2292
1 parent b817a0d commit 68fb951

File tree

1 file changed

+10
-2
lines changed
  • DirectProgramming/C++SYCL/ParallelPatterns/histogram/src

1 file changed

+10
-2
lines changed

DirectProgramming/C++SYCL/ParallelPatterns/histogram/src/main.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,15 @@ int main(void) {
118118
// which shows the difference between sparse and dense algorithm output
119119
for (int i = 0; i < N; i++)
120120
if (input[i] == 4) input[i] = rand() % 3;
121-
dense_histogram(input);
122-
sparse_histogram(input);
121+
try
122+
{
123+
dense_histogram(input);
124+
sparse_histogram(input);
125+
}
126+
catch(const std::exception& e)
127+
{
128+
std::cerr << e.what() << '\n';
129+
return -1;
130+
}
123131
return 0;
124132
}

0 commit comments

Comments
 (0)