Skip to content

Commit

Permalink
Rename misleading variable name in occupancy calc
Browse files Browse the repository at this point in the history
  • Loading branch information
denisalevi committed Feb 13, 2022
1 parent dba8942 commit 9f13ea2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions brian2cuda/templates/common_group.cu
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,16 @@ void _run_{{codeobj_name}}()
{% block prepare_kernel_inner %}
// get number of blocks and threads
{% if calc_occupancy %}
int min_num_threads; // The minimum grid size needed to achieve the
int min_num_blocks; // The minimum grid size needed to achieve the
// maximum occupancy for a full device launch
CUDA_SAFE_CALL(
cudaOccupancyMaxPotentialBlockSize(&min_num_threads, &num_threads,
cudaOccupancyMaxPotentialBlockSize(&min_num_blocks, &num_threads,
_run_kernel_{{codeobj_name}}, 0, 0) // last args: dynamicSMemSize, blockSizeLimit
);
// Round up according to array size
num_blocks = (_N + num_threads - 1) / num_threads;
{% else %}
Expand Down
4 changes: 2 additions & 2 deletions brian2cuda/templates/spatialstateupdate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,11 @@ __global__ void _currents_kernel_{{codeobj_name}}(
// calculate number of threads that maximize occupancy
// and also the corresponding number of blocks
// the code below is adapted from common_group.cu
int min_num_threads_currents; // The minimum grid size needed to achieve the
int min_num_blocks_currents; // The minimum grid size needed to achieve the
// maximum occupancy for a full device launch

CUDA_SAFE_CALL(
cudaOccupancyMaxPotentialBlockSize(&min_num_threads_currents, &num_threads_currents,
cudaOccupancyMaxPotentialBlockSize(&min_num_blocks_currents, &num_threads_currents,
_currents_kernel_{{codeobj_name}}, 0, 0) // last args: dynamicSMemSize, blockSizeLimit
);

Expand Down

0 comments on commit 9f13ea2

Please sign in to comment.