PSCF v1.1
|
Management of GPU resources and setting of execution configurations. More...
Functions | |
void | Pscf::Pspg::ThreadGrid::init () |
Initialize static variables in Pspg::ThreadGrid namespace. More... | |
void | Pscf::Pspg::ThreadGrid::setThreadsPerBlock () |
Set the number of threads per block to a default value. More... | |
void | Pscf::Pspg::ThreadGrid::setThreadsPerBlock (int nThreadsPerBlock) |
Set the number of threads per block to a specified value. More... | |
void | Pscf::Pspg::ThreadGrid::setThreadsLogical (int nThreadsLogical) |
Set the total number of threads required for execution. More... | |
void | Pscf::Pspg::ThreadGrid::setThreadsLogical (int nThreadsLogical, int &nBlocks) |
Set the total number of threads required for execution. More... | |
void | Pscf::Pspg::ThreadGrid::setThreadsLogical (int nThreadsLogical, int &nBlocks, int &nThreads) |
Set the total number of threads required for execution. More... | |
void | Pscf::Pspg::ThreadGrid::checkExecutionConfig () |
Check the execution configuration (threads and block counts). More... | |
int | Pscf::Pspg::ThreadGrid::nBlocks () |
Get the current number of blocks for execution. More... | |
int | Pscf::Pspg::ThreadGrid::nThreads () |
Get the number of threads per block for execution. More... | |
int | Pscf::Pspg::ThreadGrid::nThreadsLogical () |
Return previously requested total number of threads. More... | |
bool | Pscf::Pspg::ThreadGrid::hasUnusedThreads () |
Indicates whether there will be unused threads. More... | |
Management of GPU resources and setting of execution configurations.
void Pscf::Pspg::ThreadGrid::init | ( | ) |
Initialize static variables in Pspg::ThreadGrid namespace.
Definition at line 35 of file ThreadGrid.cu.
References Pscf::Pspg::ThreadGrid::setThreadsPerBlock(), and UTIL_THROW.
Referenced by Pscf::Pspg::ThreadGrid::setThreadsLogical(), and Pscf::Pspg::System< D >::System().
void Pscf::Pspg::ThreadGrid::setThreadsPerBlock | ( | ) |
Set the number of threads per block to a default value.
Query the hardware to determine a reasonable number.
Definition at line 48 of file ThreadGrid.cu.
References Pscf::Pspg::ThreadGrid::setThreadsPerBlock().
Referenced by Pscf::Pspg::ThreadGrid::init(), Pscf::Pspg::System< D >::setOptions(), and Pscf::Pspg::ThreadGrid::setThreadsPerBlock().
void Pscf::Pspg::ThreadGrid::setThreadsPerBlock | ( | int | nThreadsPerBlock | ) |
Set the number of threads per block to a specified value.
nThreadsPerBlock | the number of threads per block (input) |
Definition at line 72 of file ThreadGrid.cu.
References Pscf::Pspg::ThreadGrid::checkExecutionConfig().
void Pscf::Pspg::ThreadGrid::setThreadsLogical | ( | int | nThreadsLogical | ) |
Set the total number of threads required for execution.
Calculate the number of blocks, and calculate threads per block if necessary. Updates static variables.
nThreadsLogical | total number of required threads (input) |
Definition at line 80 of file ThreadGrid.cu.
References Pscf::Pspg::ThreadGrid::init(), Pscf::Pspg::ThreadGrid::nThreadsLogical(), and UTIL_ASSERT.
Referenced by Pscf::Pspg::Propagator< D >::allocate(), Pscf::Pspg::Mixture< D >::compute(), Pscf::Pspg::Solvent< D >::compute(), Pscf::Pspg::WaveList< D >::computedKSq(), Pscf::Pspg::System< D >::computeFreeEnergy(), Pscf::Pspg::Propagator< D >::computeHead(), Pscf::Pspg::Mixture< D >::createBlockCRGrid(), Pscf::Pspg::FFTBatched< D >::forwardTransform(), Pscf::Pspg::FFT< D >::forwardTransform(), Pscf::Pspg::Block< D >::setDiscretization(), Pscf::Pspg::WFieldContainer< D >::setRGrid(), Pscf::Pspg::ThreadGrid::setThreadsLogical(), and Pscf::Pspg::Propagator< D >::solve().
void Pscf::Pspg::ThreadGrid::setThreadsLogical | ( | int | nThreadsLogical, |
int & | nBlocks | ||
) |
Set the total number of threads required for execution.
Recalculate the number of blocks, and calculate threads per block if necessary. Also updates the nBlocks output parameter.
nThreadsLogical | total number of required threads (input) |
nBlocks | updated number of blocks (output) |
Definition at line 108 of file ThreadGrid.cu.
References Pscf::Pspg::ThreadGrid::nBlocks(), Pscf::Pspg::ThreadGrid::nThreadsLogical(), and Pscf::Pspg::ThreadGrid::setThreadsLogical().
void Pscf::Pspg::ThreadGrid::setThreadsLogical | ( | int | nThreadsLogical, |
int & | nBlocks, | ||
int & | nThreads | ||
) |
Set the total number of threads required for execution.
Computes and sets the number of blocks, and sets threads per block if necessary. Updates values of nBlocks and nThreads parameters in output parameters that are passed by value.
nThreadsLogical | total number of required threads (input) |
nBlocks | updated number of blocks (output) |
nThreads | updated number threads per block (output) |
Definition at line 116 of file ThreadGrid.cu.
References Pscf::Pspg::ThreadGrid::nBlocks(), Pscf::Pspg::ThreadGrid::nThreads(), Pscf::Pspg::ThreadGrid::nThreadsLogical(), and Pscf::Pspg::ThreadGrid::setThreadsLogical().
void Pscf::Pspg::ThreadGrid::checkExecutionConfig | ( | ) |
Check the execution configuration (threads and block counts).
Check for validity and optimality, based on hardware warp size and streaming multiprocessor constraints.
Definition at line 124 of file ThreadGrid.cu.
References UTIL_THROW.
Referenced by Pscf::Pspg::ThreadGrid::setThreadsPerBlock().
int Pscf::Pspg::ThreadGrid::nBlocks | ( | ) |
Get the current number of blocks for execution.
Definition at line 170 of file ThreadGrid.cu.
Referenced by Pscf::Pspg::Propagator< D >::allocate(), and Pscf::Pspg::ThreadGrid::setThreadsLogical().
int Pscf::Pspg::ThreadGrid::nThreads | ( | ) |
Get the number of threads per block for execution.
Definition at line 173 of file ThreadGrid.cu.
Referenced by Pscf::Pspg::ThreadGrid::setThreadsLogical().
int Pscf::Pspg::ThreadGrid::nThreadsLogical | ( | ) |
Return previously requested total number of threads.
Definition at line 176 of file ThreadGrid.cu.
Referenced by Pscf::Pspg::ThreadGrid::setThreadsLogical().
bool Pscf::Pspg::ThreadGrid::hasUnusedThreads | ( | ) |
Indicates whether there will be unused threads.
Returns true iff nThreads*nBlocks != nThreadsLogical.
Definition at line 179 of file ThreadGrid.cu.