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 
55  reduction = new NodeReduction();
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 }
66 
68 #ifdef NODEGROUP_FORCE_REGISTER
69  updateCounter.store(devData.size());
70 #endif
71 }
72 
74  delete reduction;
75  delete nodeReductionSave;
76 #ifdef NODEGROUP_FORCE_REGISTER
77  free(h_soa_fb_x);
78  free(h_soa_fb_y);
79  free(h_soa_fb_z);
80  free(h_soa_fn_x);
81  free(h_soa_fn_y);
82  free(h_soa_fn_z);
83  free(h_soa_fs_x);
84  free(h_soa_fs_y);
85  free(h_soa_fs_z);
86  free(h_soa_pos_x);
87  free(h_soa_pos_y);
88  free(h_soa_pos_z);
89  free(h_soa_vel_x);
90  free(h_soa_vel_y);
91  free(h_soa_vel_z);
92 
93  free(h_soa_charge);
94 
95  // Device Migration
96  free(h_soa_id);
97  free(h_soa_vdwType);
98  free(h_soa_sortOrder);
99  free(h_soa_unsortOrder);
100  free(h_soa_patchCenter);
101  free(h_soa_migrationDestination);
102  free(h_soa_sortSoluteIndex);
103 
104  free(h_atomdata_AoS);
105  free(h_peer_record);
106 
107  free(h_soa_partition);
108 
109  free(h_tupleCount.bond);
110  free(h_tupleCount.angle);
111  free(h_tupleCount.dihedral);
112  free(h_tupleCount.improper);
113  free(h_tupleCount.modifiedExclusion);
114  free(h_tupleCount.exclusion);
115  free(h_tupleCount.crossterm);
116  free(h_tupleOffset.bond);
117  free(h_tupleOffset.angle);
118  free(h_tupleOffset.dihedral);
119  free(h_tupleOffset.improper);
120  free(h_tupleOffset.modifiedExclusion);
121  free(h_tupleOffset.exclusion);
122  free(h_tupleOffset.crossterm);
123  free(h_tupleDataStage.bond);
124  free(h_tupleDataStage.angle);
125  free(h_tupleDataStage.dihedral);
126  free(h_tupleDataStage.improper);
127  free(h_tupleDataStage.modifiedExclusion);
128  free(h_tupleDataStage.exclusion);
129  free(h_tupleDataStage.crossterm);
130  CmiDestroyLock(nodeLock);
131 
132 #endif
133 }
134 
135 #include "PatchData.def.h"
CmiNodeLock printlock
Definition: PatchData.h:157
IMDOutput * imd
Definition: PatchData.h:150
NodeReduction * reduction
Definition: PatchData.h:133
PatchData()
Definition: PatchData.C:49
CollectionMaster * ptrCollectionMaster
Definition: PatchData.h:148
PDB * pdb
Definition: PatchData.h:151
Output * ptrOutput
Definition: PatchData.h:149
NodeReduction * nodeReductionSave
Definition: PatchData.h:135
void setDeviceKernelUpdateCounter()
Definition: PatchData.C:67
#define cudaCheck(stmt)
Definition: CudaUtils.h:233
~PatchData()
Definition: PatchData.C:73