Skip to content

Commit

Permalink
add std::max to avoid div by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
greole committed May 14, 2024
1 parent f876396 commit 351012c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions DevicePersistent/ExecutorHandler/ExecutorHandler.H
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,16 @@ struct ExecutorInitFunctor {
"with SYCL backend enabled."
<< abort(FatalError);
};
return gko::share(gko::DpcppExecutor::create(
device_id_ % gko::DpcppExecutor::get_num_devices("gpu"),
host_exec));
auto devices = gko::DpcppExecutor::get_num_devices("gpu");
if (devices == 0){
return gko::share(gko::DpcppExecutor::create(
0,
host_exec));
} else {
return gko::share(gko::DpcppExecutor::create(
device_id_ % devices,
host_exec));
}
}
if (executor_name_ == "hip") {
if (version.hip_version.tag == not_compiled_tag) {
Expand Down

0 comments on commit 351012c

Please sign in to comment.