ComputeCUDAMgr Class Reference

#include <ComputeCUDAMgr.h>

List of all members.

Public Member Functions

 ComputeCUDAMgr ()
 ComputeCUDAMgr (CkMigrateMessage *)
 ~ComputeCUDAMgr ()
void initialize (CkQdMsg *msg)
void initialize_devices (CkQdMsg *msg)
void update ()
CudaComputeNonbondedcreateCudaComputeNonbonded (ComputeID c)
CudaComputeNonbondedgetCudaComputeNonbonded ()

Static Public Member Functions

static ComputeCUDAMgrgetComputeCUDAMgr ()

Detailed Description

Definition at line 13 of file ComputeCUDAMgr.h.


Constructor & Destructor Documentation

ComputeCUDAMgr::ComputeCUDAMgr (  ) 

Definition at line 16 of file ComputeCUDAMgr.C.

00016                                {
00017         // __sdag_init();
00018   numDevices = 0;
00019   // numNodesContributed = 0;
00020   // numDevicesMax = 0;
00021 }

ComputeCUDAMgr::ComputeCUDAMgr ( CkMigrateMessage *   ) 

Definition at line 26 of file ComputeCUDAMgr.C.

References NAMD_bug().

00026                                                  {
00027         // __sdag_init();
00028   NAMD_bug("ComputeCUDAMgr cannot be migrated");
00029   numDevices = 0;
00030   // numNodesContributed = 0;
00031   // numDevicesMax = 0;
00032 }

ComputeCUDAMgr::~ComputeCUDAMgr (  ) 

Definition at line 37 of file ComputeCUDAMgr.C.

00037                                 {
00038   for (int i=0;i < numDevices;i++) {
00039     if (cudaNonbondedTablesList[i] != NULL) delete cudaNonbondedTablesList[i];
00040     if (cudaComputeNonbondedList[i] != NULL) delete cudaComputeNonbondedList[i];
00041 #ifdef BONDED_CUDA
00042     if (computeBondedCUDAList[i] != NULL) delete computeBondedCUDAList[i];
00043 #endif
00044   }
00045 }


Member Function Documentation

CudaComputeNonbonded * ComputeCUDAMgr::createCudaComputeNonbonded ( ComputeID  c  ) 

Definition at line 95 of file ComputeCUDAMgr.C.

References deviceCUDA, SimParameters::GBISOn, DeviceCUDA::getDeviceID(), DeviceCUDA::getNoStreaming(), NAMD_bug(), Node::Object(), and Node::simParameters.

Referenced by createCudaComputeNonbonded().

00095                                                                             {
00096   int deviceID = deviceCUDA->getDeviceID();
00097   if (cudaComputeNonbondedList.at(deviceID) != NULL)
00098     NAMD_bug("ComputeCUDAMgr::createCudaComputeNonbonded called twice");
00099   if (cudaNonbondedTablesList.at(deviceID) == NULL)
00100     NAMD_bug("ComputeCUDAMgr::createCudaComputeNonbonded, non-bonded CUDA tables not created");
00101   bool doStreaming = !deviceCUDA->getNoStreaming() && !Node::Object()->simParameters->GBISOn;
00102   cudaComputeNonbondedList[deviceID] = new CudaComputeNonbonded(c, deviceID, *cudaNonbondedTablesList[deviceID], doStreaming);
00103   return cudaComputeNonbondedList[deviceID];
00104 }

ComputeCUDAMgr * ComputeCUDAMgr::getComputeCUDAMgr (  )  [static]

Definition at line 83 of file ComputeCUDAMgr.C.

References NAMD_bug().

Referenced by createCudaComputeNonbonded(), getCudaComputeNonbonded(), and SimParameters::scriptSet().

00083                                                   {
00084   // Get pointer to ComputeCUDAMgr on this node
00085   CProxy_ComputeCUDAMgr computeCUDAMgrProxy = CkpvAccess(BOCclass_group).computeCUDAMgr;
00086   ComputeCUDAMgr* computeCUDAMgr = computeCUDAMgrProxy.ckLocalBranch();
00087   if (computeCUDAMgr == NULL)
00088     NAMD_bug("getComputeCUDAMgr, unable to locate local branch of BOC entry ComputeCUDAMgr");
00089   return computeCUDAMgr;
00090 }

CudaComputeNonbonded * ComputeCUDAMgr::getCudaComputeNonbonded (  ) 

Definition at line 109 of file ComputeCUDAMgr.C.

References deviceCUDA, DeviceCUDA::getDeviceID(), and NAMD_bug().

Referenced by getCudaComputeNonbonded().

00109                                                               {
00110   // Get device ID for this Pe
00111   int deviceID = deviceCUDA->getDeviceID();
00112   CudaComputeNonbonded* p = cudaComputeNonbondedList[deviceID];
00113   if (p == NULL)
00114     NAMD_bug("ComputeCUDAMgr::getCudaComputeNonbonded(), device not created yet");
00115   return p;
00116 }

void ComputeCUDAMgr::initialize ( CkQdMsg *  msg  ) 

Definition at line 51 of file ComputeCUDAMgr.C.

References deviceCUDA, DeviceCUDA::getDeviceCount(), DeviceCUDA::getDeviceIDbyRank(), and DeviceCUDA::getNumDevice().

00051                                             {
00052         if (msg != NULL) delete msg;
00053 
00054         numDevices = deviceCUDA->getDeviceCount();
00055 
00056   // Create pointers to devices
00057   cudaNonbondedTablesList.resize(numDevices, NULL);
00058   cudaComputeNonbondedList.resize(numDevices, NULL);
00059 #ifdef BONDED_CUDA
00060   computeBondedCUDAList.resize(numDevices, NULL);
00061 #endif
00062 
00063   // Create CUDA non-bonded tables for all devices that are used for computation
00064   for (int i=0;i < deviceCUDA->getNumDevice();i++) {
00065     int deviceID = deviceCUDA->getDeviceIDbyRank(i);
00066     cudaNonbondedTablesList[deviceID] = new CudaNonbondedTables(deviceID);
00067   }
00068 }

void ComputeCUDAMgr::initialize_devices ( CkQdMsg *  msg  ) 
void ComputeCUDAMgr::update (  ) 

Definition at line 74 of file ComputeCUDAMgr.C.

References deviceCUDA, DeviceCUDA::getDeviceIDbyRank(), DeviceCUDA::getNumDevice(), and NAMD_bug().

Referenced by SimParameters::scriptSet().

00074                             {
00075   if ( CkMyRank() ) NAMD_bug("ComputeCUDAMgr::update() should be called only by rank 0");
00076   for (int i=0;  i < deviceCUDA->getNumDevice();  i++) {
00077     int deviceID = deviceCUDA->getDeviceIDbyRank(i);
00078     // calls update function from CudaNonbondedTables
00079     cudaNonbondedTablesList[deviceID]->updateTables();
00080   }
00081 }


The documentation for this class was generated from the following files:

Generated on 11 Nov 2019 for NAMD by  doxygen 1.6.1