NAMD
Functions | Variables
ComputeLonepairsCUDA.C File Reference
#include "ComputeLonepairsCUDA.h"
#include "CudaUtils.h"
#include "ProcessorPrivate.h"
#include "AtomMap.h"
#include "HomePatch.h"
#include "Node.h"
#include "Molecule.h"
#include "DeviceCUDA.h"
#include "ComputeLonepairsCUDAKernel.h"
#include <string>
#include <cmath>

Go to the source code of this file.

Functions

int globalAtomIDToSOAID (std::vector< AtomMap *> &atomMapsList, const std::vector< CudaLocalRecord > &localRecords, const int *globalToLocalID, AtomID aid, bool errorOnNotFound)
 

Variables

__thread DeviceCUDAdeviceCUDA
 

Function Documentation

◆ globalAtomIDToSOAID()

int globalAtomIDToSOAID ( std::vector< AtomMap *> &  atomMapsList,
const std::vector< CudaLocalRecord > &  localRecords,
const int *  globalToLocalID,
AtomID  aid,
bool  errorOnNotFound 
)

Definition at line 37 of file ComputeLonepairsCUDA.C.

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

Referenced by ComputeLonepairsCUDA::updateAtoms().

40  {
41  LocalID lid{-1, -1};
42  for (int j = 0; j < atomMapsList.size(); ++j) {
43  if (atomMapsList[j] == NULL) continue;
44  lid = atomMapsList[j]->localID(aid);
45  if (lid.pid != -1) break;
46  }
47  if (errorOnNotFound && (lid.pid == -1)) {
48  const std::string error = "Atom " + std::to_string(aid) + " not found in master PE " + std::to_string(deviceCUDA->getMasterPe());
49  NAMD_bug(error.c_str());
50  return -1;
51  }
52  const int soaPid = globalToLocalID[lid.pid];
53  const int soaIndex = localRecords[soaPid].bufferOffset + lid.index;
54  return soaIndex;
55 }
__thread DeviceCUDA * deviceCUDA
Definition: DeviceCUDA.C:23
int getMasterPe()
Definition: DeviceCUDA.h:137
void NAMD_bug(const char *err_msg)
Definition: common.C:195

Variable Documentation

◆ deviceCUDA

__thread DeviceCUDA* deviceCUDA

Definition at line 23 of file DeviceCUDA.C.

Referenced by globalAtomIDToSOAID().