NAMD
PatchData.C
Go to the documentation of this file.
1 #include "PatchData.h"
2 #include "PatchMap.h"
3 
4 #ifdef NODEGROUP_FORCE_REGISTER
5 
6 // initialize all pointers to NULL and all scalars to zero
7 DeviceData::DeviceData(){
8  // bonded scalars
9  bond_pi_size = 0;
10  bond_pr_size = 0;
11  forceStride = 0;
12  f_bond_size = 0;
13 
14  // bonded pointers
15  bond_pi = NULL;
16  bond_pr = NULL;
17  f_bond = NULL;
18  f_bond_nbond = NULL;
19 
20  // slow scalars
21  f_slow_size = 0;
22  slow_patchPositionsSize = 0;
23  slow_pencilPatchIndexSize = 0;
24  slow_patchIDSize = 0;
25 
26  // slow vectors
27  f_slow = NULL;
28  slow_patchPositions = NULL;
29  slow_pencilPatchIndex = NULL;
30  slow_patchID = NULL;
31 
32  // nonbonded scalars
33  f_nbond_size = 0;
34 
35  // nonbonded vectors
36  f_nbond = NULL;
37  f_nbond_slow = NULL;
38 
39  numAtomsHome = 0;
40 }
41 
42 DeviceData::~DeviceData(){
43  free(h_hasPatches);
44  cudaCheck(cudaFree(d_hasPatches));
45 }
46 #endif
47 
48 
50  ptrCollectionMaster = NULL;
51  ptrOutput = NULL;
52  imd = NULL;
53  pdb = NULL;
54 
57 #ifdef NODEGROUP_FORCE_REGISTER
58  cudaBondedList = new ComputeBondedCUDA*[CkNumPes()];
59  cudaNonbondedList = new CudaComputeNonbonded*[CkNumPes()];
60  printlock = CmiCreateLock();
61  nodeLock = CmiCreateLock();
62  suspendCounter.store(CmiMyNodeSize());
63  updateCounter.store(0);
64 #endif
65 
67  nodeBroadcast->lock = CmiCreateLock();
68 }
69 
71 #ifdef NODEGROUP_FORCE_REGISTER
72  updateCounter.store(devData.size());
73 #endif
74 }
75 
77  delete reductionBackend;
78  delete reductionBackendSave;
79  delete nodeBroadcast;
80 #ifdef NODEGROUP_FORCE_REGISTER
81 
82  // Device Migration
83  free(h_soa_sortOrder);
84  free(h_soa_vdwType);
85  free(h_soa_id);
86  free(h_soa_migrationDestination);
87 
88  free(h_peer_record);
89 
90  free(h_soa_partition);
91 
92  free(h_tupleCount.bond);
93  free(h_tupleCount.angle);
94  free(h_tupleCount.dihedral);
95  free(h_tupleCount.improper);
96  free(h_tupleCount.modifiedExclusion);
97  free(h_tupleCount.exclusion);
98  free(h_tupleCount.crossterm);
99  free(h_tupleOffset.bond);
100  free(h_tupleOffset.angle);
101  free(h_tupleOffset.dihedral);
102  free(h_tupleOffset.improper);
103  free(h_tupleOffset.modifiedExclusion);
104  free(h_tupleOffset.exclusion);
105  free(h_tupleOffset.crossterm);
106  free(h_tupleDataStage.bond);
107  free(h_tupleDataStage.angle);
108  free(h_tupleDataStage.dihedral);
109  free(h_tupleDataStage.improper);
110  free(h_tupleDataStage.modifiedExclusion);
111  free(h_tupleDataStage.exclusion);
112  free(h_tupleDataStage.crossterm);
113  CmiDestroyLock(nodeLock);
114 
115 #endif
116 }
117 
118 #include "PatchData.def.h"
Broadcast object for intra-node GPU-resident broadcasts.
CmiNodeLock printlock
Definition: PatchData.h:163
IMDOutput * imd
Definition: PatchData.h:156
NodeReduction * reductionBackend
Definition: PatchData.h:134
PatchData()
Definition: PatchData.C:49
NodeReduction * reductionBackendSave
Definition: PatchData.h:136
CollectionMaster * ptrCollectionMaster
Definition: PatchData.h:154
PDB * pdb
Definition: PatchData.h:157
Output * ptrOutput
Definition: PatchData.h:155
NodeBroadcast * nodeBroadcast
Definition: PatchData.h:141
void setDeviceKernelUpdateCounter()
Definition: PatchData.C:70
#define cudaCheck(stmt)
Definition: CudaUtils.h:242
~PatchData()
Definition: PatchData.C:76
CmiNodeLock lock