1 |
< |
i#include <cstdlib> |
1 |
> |
#include <cstdlib> |
2 |
|
#include <cstring> |
3 |
|
#include <mpi.h> |
4 |
|
|
11 |
|
int*))); |
12 |
|
} |
13 |
|
|
14 |
< |
void wrapSimParallel((void (*fSub)(mpiSimData*, int*, int*, int*))); |
14 |
> |
void wrapSimParallel(void (*fSub)(mpiSimData*, int*, int*, int*)); |
15 |
|
|
16 |
|
|
17 |
|
mpiSimulation* mpiSim; |
19 |
|
mpiSimulation::mpiSimulation(SimInfo* the_entryPlug) |
20 |
|
{ |
21 |
|
entryPlug = the_entryPlug; |
22 |
< |
mpiPlug = new MpiSimData; |
22 |
> |
mpiPlug = new mpiSimData; |
23 |
|
|
24 |
|
mpiPlug->numberProcessors = MPI::COMM_WORLD.Get_size(); |
25 |
|
mpiPlug->myNode = worldRank; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
< |
void mpiSimulation::divideLabor( void ){ |
47 |
> |
int* mpiSimulation::divideLabor( void ){ |
48 |
|
|
49 |
+ |
int* globalIndex; |
50 |
+ |
|
51 |
|
int nComponents; |
52 |
|
MoleculeStamp** compStamps; |
53 |
|
int* componentsNmol; |
60 |
|
int molIndex, atomIndex, compIndex, compStart; |
61 |
|
int done; |
62 |
|
int nLocal, molLocal; |
63 |
< |
int i; |
63 |
> |
int i, index; |
64 |
|
int smallDiff, bigDiff; |
65 |
|
|
66 |
|
int testSum; |
74 |
|
mpiPlug->nBendsGlobal = entryPlug->n_bends; |
75 |
|
mpiPlug->nTorsionsGlobal = entryPlug->n_torsions; |
76 |
|
mpiPlug->nSRIGlobal = entryPlug->n_SRI; |
77 |
< |
mpiPlug->nMolGlobal = entryPlug->n_nmol; |
77 |
> |
mpiPlug->nMolGlobal = entryPlug->n_mol; |
78 |
|
|
79 |
|
numerator = (double) entryPlug->n_atoms; |
80 |
|
denominator = (double) mpiPlug->numberProcessors; |
185 |
|
MPIcheckPoint(); |
186 |
|
|
187 |
|
// lets create the identity array |
188 |
+ |
|
189 |
+ |
globalIndex = new int[mpiPlug->myNlocal]; |
190 |
+ |
index = mpiPlug->myAtomStart; |
191 |
+ |
for( i=0; i<mpiPlug->myNlocal; i++){ |
192 |
+ |
globalIndex[i] = index; |
193 |
+ |
index++; |
194 |
+ |
} |
195 |
+ |
|
196 |
+ |
return globalIndex; |
197 |
|
} |
198 |
|
|
199 |
|
|
200 |
< |
void wrapSimParallel((void (*fSub)(mpiSimData*, int*, int*, int*))){ |
200 |
> |
void wrapSimParallel(void (*fSub)(mpiSimData*, int*, int*, int*)){ |
201 |
|
|
202 |
|
mpiSim->setInternal( fSub ); |
203 |
|
} |
204 |
+ |
|
205 |
+ |
|
206 |
+ |
void mpiSimulation::mpiRefresh( void ){ |
207 |
+ |
|
208 |
+ |
int isError, i; |
209 |
+ |
int *globalIndex = new int[mpiPlug->myNlocal]; |
210 |
+ |
|
211 |
+ |
for(i=0; i<mpiPlug->myNlocal; i++) globalIndex[i] = entryPlug->atoms[i]->getGlobalIndex(); |
212 |
+ |
|
213 |
+ |
|
214 |
+ |
isError = 0; |
215 |
+ |
setFsimParallel( mpiPlug, &(entryPlug->n_atoms), globalIndex, &isError ); |
216 |
+ |
if( isError ){ |
217 |
+ |
|
218 |
+ |
sprintf( painCave.errMsg, |
219 |
+ |
"mpiRefresh errror: fortran didn't like something we gave it.\n" ); |
220 |
+ |
painCave.isFatal = 1; |
221 |
+ |
simError(); |
222 |
+ |
} |
223 |
+ |
|
224 |
+ |
delete[] globalIndex; |
225 |
+ |
|
226 |
+ |
sprintf( checkPointMsg, |
227 |
+ |
" mpiRefresh successful.\n" ); |
228 |
+ |
MPIcheckPoint(); |
229 |
+ |
} |
230 |
+ |
|