Skip to content

Commit

Permalink
[feat] Now the number of thread is read from environment variable "NU…
Browse files Browse the repository at this point in the history
…M_THREAD"
  • Loading branch information
yangzexia authored Jan 22, 2024
1 parent 5c8a288 commit 0cf5615
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/CL/devices/ventus/pocl_ventus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,15 @@ pocl_ventus_run (void *data, _cl_command_node *cmd)
else
knl_name_list[meta->name] = 0;

uint64_t num_thread=32;
uint64_t num_thread=[]{
char* numVar = std::getenv("NUM_THREAD");
if (numVar) {
return std::stoull(numVar);
} else {
std::cerr << "Warning: environment variable NUM_THREAD is not found" << std::endl;
return 32;
}
}();
uint64_t num_warp=(pc->local_size[0]*pc->local_size[1]*pc->local_size[2] + num_thread-1)/ num_thread;
uint64_t num_workgroups[3];
num_workgroups[0]=pc->num_groups[0];num_workgroups[1]=pc->num_groups[1];num_workgroups[2]=pc->num_groups[2];
Expand Down

0 comments on commit 0cf5615

Please sign in to comment.