(distribute-jobs) ( job-count per-job-shared max-shared-size max-block-size -- grid-size block-size per-block-shared )


Vocabulary
cuda.devices

Inputs
job-countan object
per-job-sharedan object
max-shared-sizean object
max-block-sizean object


Outputs
grid-sizean object
block-sizean object
per-block-sharedan object


Definition


:: (distribute-jobs)
( job-count per-job-shared max-shared-size max-block-size -- grid-size block-size per-block-shared )
per-job-shared
[ max-block-size ]
[ max-shared-size swap /i max-block-size min ] if-zero
job-count min
:> job-max-block-size job-count job-max-block-size up/i
:> grid-size job-count grid-size up/i
:> block-size block-size per-job-shared *
:> per-block-shared grid-size block-size per-block-shared ;
inline