Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
TissueForge::cuda Namespace Reference

Tissue Forge GPU acceleration on CUDA-supporting devices. More...

Classes

struct  Angle
 
struct  AngleConfig
 CUDA runtime control interface for Tissue Forge angles. More...
 
struct  Bond
 
struct  BondConfig
 CUDA runtime control interface for Tissue Forge bonds. More...
 
struct  BoundaryCondition
 
struct  BoundaryConditions
 
struct  CUDAContext
 A convenience wrap of the CUDA context for JIT-compiled Tissue Forge programs. More...
 
struct  CUDADevice
 A simple interface with a CUDA device. More...
 
struct  CUDAFunction
 A CUDA kernel from a JIT-compiled Tissue Forge program. More...
 
struct  CUDARTProgram
 A JIT-compiled CUDA Tissue Forge program. More...
 
struct  CUDARTSource
 Convenience class for loading source from file and storing, here intended for CUDA. More...
 
struct  DPDPotentialData
 
struct  EngineConfig
 CUDA runtime control interface for Tissue Forge engine. More...
 
struct  Flux
 
struct  Fluxes
 
struct  FluxTypeIdPair
 
struct  Particle
 
struct  Potential
 
struct  PotentialData
 
struct  queue_cuda
 
struct  SimulatorConfig
 CUDA runtime control interface for Simulator. More...
 
struct  task_cuda
 

Enumerations

enum  ErrorCode : int {
  TFCUDAERR_ok = 0 , TFCUDAERR_setdevice , TFCUDAERR_setblocks , TFCUDAERR_setthreads ,
  TFCUDAERR_ondevice , TFCUDAERR_notondevice , TFCUDAERR_cleardevices , TFCUDAERR_refresh ,
  TFCUDAERR_send , TFCUDAERR_pull , TFCUDAERR_LAST
}
 

Functions

int Angle_setThreads (const unsigned int &nr_threads)
 
int Angle_setBlocks (const unsigned int &nr_blocks)
 
int Angle_getDevice ()
 
int Angle_toDevice (engine *e)
 
int Angle_fromDevice (engine *e)
 
int Angle_refresh (engine *e)
 
int Angle_refreshAngle (engine *e, AngleHandle *a)
 
int Angle_refreshAngles (engine *e, AngleHandle **angles, int nr_angles)
 
int engine_cuda_add_angle (AngleHandle *ah)
 
int engine_cuda_finalize_angle (int aind)
 
int engine_cuda_finalize_angles (engine *e, int *ainds, int nr_angles)
 
int engine_cuda_finalize_angles_all (engine *e)
 
int engine_angle_eval_cuda (struct TissueForge::Angle *angles, int N, struct engine *e, float *epot_out)
 
int Bond_setThreads (const unsigned int &nr_threads)
 
int Bond_setBlocks (const unsigned int &nr_blocks)
 
int Bond_getDevice ()
 
int Bond_setDevice (engine *e, const int &deviceId)
 
int Bond_toDevice (engine *e)
 
int Bond_fromDevice (engine *e)
 
int Bond_refresh (engine *e)
 
int Bond_refreshBond (engine *e, BondHandle *b)
 
int Bond_refreshBonds (engine *e, BondHandle **bonds, int nr_bonds)
 
int engine_cuda_add_bond (TissueForge::Bond *b)
 
int engine_cuda_add_bonds (TissueForge::Bond *bonds, int nr_bonds)
 
int engine_cuda_finalize_bond (int bind)
 
int engine_cuda_finalize_bonds (engine *e, int *binds, int nr_bonds)
 
int engine_cuda_finalize_bonds_all (engine *e)
 
int engine_bond_eval_cuda (struct TissueForge::Bond *bonds, int N, struct engine *e, float *epot_out)
 
__device__ void Flux_getFluxes (int **fxind_cuda, Fluxes **fluxes_cuda)
 
__device__ void Flux_getNrFluxes (unsigned int *nr_fluxes)
 
__device__ void Flux_getNrStates (unsigned int *nr_states)
 
TissueForge::Potential toCUDADevice (const TissueForge::Potential &p)
 Loads a potential onto a CUDA device.
 
__host__ __device__ void cudaFree (TissueForge::Potential *p)
 
__device__ void potential_eval_r_cuda (struct TissueForge::Potential *p, FPTYPE r, FPTYPE *e, FPTYPE *f)
 Evaluates the given potential at the given point (interpolated).
 
__device__ void potential_eval_cuda (struct TissueForge::Potential *p, float r2, float *e, float *f)
 Evaluates the given potential at the given point (interpolated).
 
CUresult cuda_errorchk (CUresult retCode, const char *file, int line)
 
nvrtcResult nvrtc_errorchk (nvrtcResult retCode, const char *file, int line)
 
cudaError_t cudart_errorchk (cudaError_t retCode, const char *file, int line)
 
void init ()
 Initialize CUDA.
 
void setGLDevice (const int &deviceId)
 
std::string getDeviceName (const int &deviceId)
 Get the name of a device.
 
size_t getDeviceTotalMem (const int &deviceId)
 Get the total memory of device.
 
int getDeviceAttribute (const int &deviceId, const int &attrib)
 Get the attribute value of a device.
 
int getNumDevices ()
 Get number of available compute-capable devices.
 
std::string getDevicePCIBusId (const int &deviceId)
 Get the PCI bus id of a device.
 
int getCurrentDevice ()
 Get the device id of the current context of the calling CPU thread.
 
int maxThreadsPerBlock (const int &deviceId)
 Maximum number of threads per block.
 
int maxBlockDimX (const int &deviceId)
 Maximum x-dimension of a block.
 
int maxBlockDimY (const int &deviceId)
 Maximum y-dimension of a block.
 
int maxBlockDimZ (const int &deviceId)
 Maximum z-dimension of a block.
 
int maxGridDimX (const int &deviceId)
 Maximum x-dimension of a grid.
 
int maxGridDimY (const int &deviceId)
 Maximum y-dimension of a grid.
 
int maxGridDimZ (const int &deviceId)
 Maximum z-dimension of a grid.
 
int maxSharedMemPerBlock (const int &deviceId)
 Maximum amount of shared memory available to a thread block in bytes.
 
int maxTotalMemConst (const int &deviceId)
 Memory available on device for constant variables in a CUDA C kernel in bytes.
 
int warpSize (const int &deviceId)
 Warp size in threads.
 
int maxRegsPerBlock (const int &deviceId)
 Maximum number of 32-bit registers available to a thread block.
 
int clockRate (const int &deviceId)
 The typical clock frequency in kilohertz.
 
bool gpuOverlap (const int &deviceId)
 Test if the device can concurrently copy memory between host and device while executing a kernel.
 
int numMultiprocessors (const int &deviceId)
 Number of multiprocessors on the device.
 
bool kernelExecTimeout (const int &deviceId)
 Test if there is a run time limit for kernels executed on the device.
 
bool computeModeDefault (const int &deviceId)
 Test if device is not restricted and can have multiple CUDA contexts present at a single time.
 
bool computeModeProhibited (const int &deviceId)
 Test if device is prohibited from creating new CUDA contexts.
 
bool computeModeExclusive (const int &deviceId)
 Test if device can have only one context used by a single process at a time.
 
int PCIDeviceId (const int &deviceId)
 PCI device (also known as slot) identifier of the device.
 
int PCIDomainId (const int &deviceId)
 PCI domain identifier of the device.
 
int clockRateMem (const int &deviceId)
 Peak memory clock frequency in kilohertz.
 
int globalMemBusWidth (const int &deviceId)
 Global memory bus width in bits.
 
int L2CacheSize (const int &deviceId)
 Size of L2 cache in bytes. 0 if the device doesn't have L2 cache.
 
int maxThreadsPerMultiprocessor (const int &deviceId)
 Maximum resident threads per multiprocessor.
 
int computeCapabilityMajor (const int &deviceId)
 Major compute capability version number.
 
int computeCapabilityMinor (const int &deviceId)
 Minor compute capability version number.
 
bool L1CacheSupportGlobal (const int &deviceId)
 Test if device supports caching globals in L1 cache.
 
bool L1CacheSupportLocal (const int &deviceId)
 Test if device supports caching locals in L1 cache.
 
int maxSharedMemPerMultiprocessor (const int &deviceId)
 Maximum amount of shared memory available to a multiprocessor in bytes.
 
int maxRegsPerMultiprocessor (const int &deviceId)
 Maximum number of 32-bit registers available to a multiprocessor.
 
bool managedMem (const int &deviceId)
 Test if device supports allocating managed memory on this system.
 
bool multiGPUBoard (const int &deviceId)
 Test if device is on a multi-GPU board.
 
int multiGPUBoardGroupId (const int &deviceId)
 Unique identifier for a group of devices associated with the same board.
 
void test (const int &numBlocks, const int &numThreads, const int &numEls, const int &deviceId=0)
 Tests JIT-compiled program execution and deployment.
 
std::string tfIncludePath ()
 Returns the current path to the installed Tissue Forge include directory.
 
HRESULT setTfIncludePath (const std::string &_path)
 Set the current path to the installed Tissue Forge include directory.
 
std::string tfPrivateIncludePath ()
 Returns the path to the installed Tissue Forge private include directory.
 
std::string tfResourcePath ()
 Returns the current path to the installed Tissue Forge resource directory.
 
HRESULT setTfResourcePath (const std::string &_path)
 Set the current path to the installed Tissue Forge resource directory.
 
std::string CUDAPath ()
 Returns the path to the installed Tissue Forge CUDA resources directory.
 
std::string CUDAIncludePath ()
 Returns the current path to the installed CUDA include directory.
 
HRESULT setCUDAIncludePath (const std::string &_path)
 Set the current path to the installed CUDA include directory.
 
std::string CUDAResourcePath (const std::string &relativePath)
 Returns an absolute path to a subdirectory of the install Tissue Forge CUDA resources directory.
 
std::string CUDAPTXObjectRelPath ()
 Returns the relative path to the installed Tissue Forge CUDA PTX object directory.
 
std::vector< std::string > CUDAArchs ()
 Returns the supported CUDA architectures of the installation.
 

Detailed Description

Tissue Forge GPU acceleration on CUDA-supporting devices.

Function Documentation

◆ clockRate()

int TissueForge::cuda::clockRate ( const int & deviceId)

The typical clock frequency in kilohertz.

Returns
int

◆ clockRateMem()

int TissueForge::cuda::clockRateMem ( const int & deviceId)

Peak memory clock frequency in kilohertz.

Returns
int

◆ computeCapabilityMajor()

int TissueForge::cuda::computeCapabilityMajor ( const int & deviceId)

Major compute capability version number.

Returns
int

◆ computeCapabilityMinor()

int TissueForge::cuda::computeCapabilityMinor ( const int & deviceId)

Minor compute capability version number.

Returns
int

◆ computeModeDefault()

bool TissueForge::cuda::computeModeDefault ( const int & deviceId)

Test if device is not restricted and can have multiple CUDA contexts present at a single time.

Returns
true
false

◆ computeModeExclusive()

bool TissueForge::cuda::computeModeExclusive ( const int & deviceId)

Test if device can have only one context used by a single process at a time.

Returns
true
false

◆ computeModeProhibited()

bool TissueForge::cuda::computeModeProhibited ( const int & deviceId)

Test if device is prohibited from creating new CUDA contexts.

Returns
true
false

◆ CUDAArchs()

std::vector< std::string > TissueForge::cuda::CUDAArchs ( )

Returns the supported CUDA architectures of the installation.

Returns
std::vector<std::string>

◆ CUDAIncludePath()

std::string TissueForge::cuda::CUDAIncludePath ( )

Returns the current path to the installed CUDA include directory.

Returns
std::string

◆ CUDAPath()

std::string TissueForge::cuda::CUDAPath ( )

Returns the path to the installed Tissue Forge CUDA resources directory.

Returns
std::string

◆ CUDAPTXObjectRelPath()

std::string TissueForge::cuda::CUDAPTXObjectRelPath ( )

Returns the relative path to the installed Tissue Forge CUDA PTX object directory.

The path is relative to the Tissue Forge CUDA resources directory, and depends on the build type of the installation.

Returns
std::string

◆ CUDAResourcePath()

std::string TissueForge::cuda::CUDAResourcePath ( const std::string & relativePath)

Returns an absolute path to a subdirectory of the install Tissue Forge CUDA resources directory.

Parameters
relativePath
Returns
std::string

◆ getCurrentDevice()

int TissueForge::cuda::getCurrentDevice ( )

Get the device id of the current context of the calling CPU thread.

Returns
int

◆ getDeviceAttribute()

int TissueForge::cuda::getDeviceAttribute ( const int & deviceId,
const int & attrib )

Get the attribute value of a device.

Parameters
deviceId
attrib
Returns
int

◆ getDeviceName()

std::string TissueForge::cuda::getDeviceName ( const int & deviceId)

Get the name of a device.

Parameters
deviceId
Returns
std::string

◆ getDevicePCIBusId()

std::string TissueForge::cuda::getDevicePCIBusId ( const int & deviceId)

Get the PCI bus id of a device.

Parameters
deviceId
Returns
std::string

◆ getDeviceTotalMem()

size_t TissueForge::cuda::getDeviceTotalMem ( const int & deviceId)

Get the total memory of device.

Parameters
deviceId
Returns
size_t

◆ getNumDevices()

int TissueForge::cuda::getNumDevices ( )

Get number of available compute-capable devices.

Returns
int

◆ globalMemBusWidth()

int TissueForge::cuda::globalMemBusWidth ( const int & deviceId)

Global memory bus width in bits.

Returns
int

◆ gpuOverlap()

bool TissueForge::cuda::gpuOverlap ( const int & deviceId)

Test if the device can concurrently copy memory between host and device while executing a kernel.

Returns
true
false

◆ kernelExecTimeout()

bool TissueForge::cuda::kernelExecTimeout ( const int & deviceId)

Test if there is a run time limit for kernels executed on the device.

Returns
true
false

◆ L1CacheSupportGlobal()

bool TissueForge::cuda::L1CacheSupportGlobal ( const int & deviceId)

Test if device supports caching globals in L1 cache.

Returns
true
false

◆ L1CacheSupportLocal()

bool TissueForge::cuda::L1CacheSupportLocal ( const int & deviceId)

Test if device supports caching locals in L1 cache.

Returns
true
false

◆ L2CacheSize()

int TissueForge::cuda::L2CacheSize ( const int & deviceId)

Size of L2 cache in bytes. 0 if the device doesn't have L2 cache.

Returns
int

◆ managedMem()

bool TissueForge::cuda::managedMem ( const int & deviceId)

Test if device supports allocating managed memory on this system.

Returns
true
false

◆ maxBlockDimX()

int TissueForge::cuda::maxBlockDimX ( const int & deviceId)

Maximum x-dimension of a block.

Returns
int

◆ maxBlockDimY()

int TissueForge::cuda::maxBlockDimY ( const int & deviceId)

Maximum y-dimension of a block.

Returns
int

◆ maxBlockDimZ()

int TissueForge::cuda::maxBlockDimZ ( const int & deviceId)

Maximum z-dimension of a block.

Returns
int

◆ maxGridDimX()

int TissueForge::cuda::maxGridDimX ( const int & deviceId)

Maximum x-dimension of a grid.

Returns
int

◆ maxGridDimY()

int TissueForge::cuda::maxGridDimY ( const int & deviceId)

Maximum y-dimension of a grid.

Returns
int

◆ maxGridDimZ()

int TissueForge::cuda::maxGridDimZ ( const int & deviceId)

Maximum z-dimension of a grid.

Returns
int

◆ maxRegsPerBlock()

int TissueForge::cuda::maxRegsPerBlock ( const int & deviceId)

Maximum number of 32-bit registers available to a thread block.

Returns
int

◆ maxRegsPerMultiprocessor()

int TissueForge::cuda::maxRegsPerMultiprocessor ( const int & deviceId)

Maximum number of 32-bit registers available to a multiprocessor.

Returns
int

◆ maxSharedMemPerBlock()

int TissueForge::cuda::maxSharedMemPerBlock ( const int & deviceId)

Maximum amount of shared memory available to a thread block in bytes.

Returns
int

◆ maxSharedMemPerMultiprocessor()

int TissueForge::cuda::maxSharedMemPerMultiprocessor ( const int & deviceId)

Maximum amount of shared memory available to a multiprocessor in bytes.

Returns
int

◆ maxThreadsPerBlock()

int TissueForge::cuda::maxThreadsPerBlock ( const int & deviceId)

Maximum number of threads per block.

Returns
int

◆ maxThreadsPerMultiprocessor()

int TissueForge::cuda::maxThreadsPerMultiprocessor ( const int & deviceId)

Maximum resident threads per multiprocessor.

Returns
int

◆ maxTotalMemConst()

int TissueForge::cuda::maxTotalMemConst ( const int & deviceId)

Memory available on device for constant variables in a CUDA C kernel in bytes.

Returns
int

◆ multiGPUBoard()

bool TissueForge::cuda::multiGPUBoard ( const int & deviceId)

Test if device is on a multi-GPU board.

Returns
true
false

◆ multiGPUBoardGroupId()

int TissueForge::cuda::multiGPUBoardGroupId ( const int & deviceId)

Unique identifier for a group of devices associated with the same board.

Returns
int

◆ numMultiprocessors()

int TissueForge::cuda::numMultiprocessors ( const int & deviceId)

Number of multiprocessors on the device.

Returns
int

◆ PCIDeviceId()

int TissueForge::cuda::PCIDeviceId ( const int & deviceId)

PCI device (also known as slot) identifier of the device.

Returns
int

◆ PCIDomainId()

int TissueForge::cuda::PCIDomainId ( const int & deviceId)

PCI domain identifier of the device.

Returns
int

◆ potential_eval_cuda()

__device__ void TissueForge::cuda::potential_eval_cuda ( struct TissueForge::Potential * p,
float r2,
float * e,
float * f )

Evaluates the given potential at the given point (interpolated).

Parameters
pThe #potential to be evaluated.
r2The radius at which it is to be evaluated, squared.
ePointer to a floating-point value in which to store the interaction energy.
fPointer to a floating-point value in which to store the magnitude of the interaction force divided by r.

Note that for efficiency reasons, this function does not check if any of the parameters are NULL or if sqrt(r2) is within the interval of the #potential p.

◆ potential_eval_r_cuda()

__device__ void TissueForge::cuda::potential_eval_r_cuda ( struct TissueForge::Potential * p,
FPTYPE r,
FPTYPE * e,
FPTYPE * f )

Evaluates the given potential at the given point (interpolated).

Parameters
pThe #potential to be evaluated.
rThe radius at which it is to be evaluated.
ePointer to a floating-point value in which to store the interaction energy.
fPointer to a floating-point value in which to store the magnitude of the interaction force.

Note that for efficiency reasons, this function does not check if any of the parameters are NULL or if sqrt(r2) is within the interval of the #potential p.

◆ setCUDAIncludePath()

HRESULT TissueForge::cuda::setCUDAIncludePath ( const std::string & _path)

Set the current path to the installed CUDA include directory.

Parameters
_pathabsolute path
Returns
HRESULT

◆ setTfIncludePath()

HRESULT TissueForge::cuda::setTfIncludePath ( const std::string & _path)

Set the current path to the installed Tissue Forge include directory.

Parameters
_pathabsolute path
Returns
HRESULT

◆ setTfResourcePath()

HRESULT TissueForge::cuda::setTfResourcePath ( const std::string & _path)

Set the current path to the installed Tissue Forge resource directory.

Parameters
_pathabsolute path
Returns
HRESULT

◆ test()

void TissueForge::cuda::test ( const int & numBlocks,
const int & numThreads,
const int & numEls,
const int & deviceId = 0 )

Tests JIT-compiled program execution and deployment.

Enable logger at debug level to see step-by-step report.

Parameters
numBlocksnumber of blocks
numThreadsnumber of threads
numElsnumber of elements in calculations
deviceIdID of CUDA device

◆ tfIncludePath()

std::string TissueForge::cuda::tfIncludePath ( )

Returns the current path to the installed Tissue Forge include directory.

Returns
std::string

◆ tfPrivateIncludePath()

std::string TissueForge::cuda::tfPrivateIncludePath ( )

Returns the path to the installed Tissue Forge private include directory.

Returns
std::string

◆ tfResourcePath()

std::string TissueForge::cuda::tfResourcePath ( )

Returns the current path to the installed Tissue Forge resource directory.

Returns
std::string

◆ toCUDADevice()

TissueForge::Potential TissueForge::cuda::toCUDADevice ( const TissueForge::Potential & p)

Loads a potential onto a CUDA device.

Parameters
pThe potential
Returns
The loaded potential, or NULL if failed

◆ warpSize()

int TissueForge::cuda::warpSize ( const int & deviceId)

Warp size in threads.

Returns
int