PSCF v1.1
Functions

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...
 

Detailed Description

Management of GPU resources and setting of execution configurations.

Function Documentation

◆ init()

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().

◆ setThreadsPerBlock() [1/2]

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().

◆ setThreadsPerBlock() [2/2]

void Pscf::Pspg::ThreadGrid::setThreadsPerBlock ( int  nThreadsPerBlock)

Set the number of threads per block to a specified value.

Parameters
nThreadsPerBlockthe number of threads per block (input)

Definition at line 72 of file ThreadGrid.cu.

References Pscf::Pspg::ThreadGrid::checkExecutionConfig().

◆ setThreadsLogical() [1/3]

void Pscf::Pspg::ThreadGrid::setThreadsLogical ( int  nThreadsLogical)

◆ setThreadsLogical() [2/3]

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.

Parameters
nThreadsLogicaltotal number of required threads (input)
nBlocksupdated 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().

◆ setThreadsLogical() [3/3]

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.

Parameters
nThreadsLogicaltotal number of required threads (input)
nBlocksupdated number of blocks (output)
nThreadsupdated 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().

◆ checkExecutionConfig()

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().

◆ nBlocks()

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().

◆ nThreads()

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().

◆ nThreadsLogical()

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().

◆ hasUnusedThreads()

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.