16 |
|
#ifdef IS_MPI |
17 |
|
#include <mpi.h> |
18 |
|
#include "mpiSimulation.hpp" |
19 |
< |
#define TAKE_THIS_TAG_CHAR 0 |
20 |
< |
#define TAKE_THIS_TAG_INT 1 |
19 |
> |
#define TAKE_THIS_TAG_CHAR 3134 |
20 |
> |
#define TAKE_THIS_TAG_INT 3135 |
21 |
|
|
22 |
|
namespace initFile{ |
23 |
|
void nodeZeroError( void ); |
175 |
|
int *MolToProcMap = mpiSim->getMolToProcMap(); |
176 |
|
int localIndex; |
177 |
|
int nCurObj; |
178 |
+ |
int nItems; |
179 |
|
|
180 |
+ |
nTotObjs = simnfo->getTotIntegrableObjects(); |
181 |
|
haveError = 0; |
182 |
|
if (worldRank == 0) { |
183 |
|
|
189 |
|
simError(); |
190 |
|
} |
191 |
|
|
192 |
< |
nTotObjs = atoi( read_buffer ); |
192 |
> |
nItems = atoi( read_buffer ); |
193 |
|
|
194 |
|
// Check to see that the number of integrable objects in the intial configuration file is the |
195 |
|
// same as declared in simBass. |
196 |
|
|
197 |
< |
if( nTotObjs != simnfo->getTotIntegrableObjects()){ |
197 |
> |
if( nTotObjs != nItems){ |
198 |
|
sprintf( painCave.errMsg, |
199 |
|
"Initialize from File error. %s n_atoms, %d, " |
200 |
|
"does not match the BASS file's n_atoms, %d.\n", |
219 |
|
//parseCommentLine |
220 |
|
|
221 |
|
MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD); |
222 |
+ |
|
223 |
+ |
cerr << "node " << worldRank << " finished MPI_Bcast" << endl; |
224 |
|
|
225 |
|
parseErr = parseCommentLine( read_buffer, simnfo); |
226 |
|
|
259 |
|
|
260 |
|
if(haveError) nodeZeroError(); |
261 |
|
|
262 |
< |
parseDumpLine(read_buffer, integrableObjects[i]); |
262 |
> |
parseDumpLine(read_buffer, integrableObjects[j]); |
263 |
|
|
264 |
|
} |
265 |
|
|
268 |
|
else{ |
269 |
|
//molecule belongs to slave nodes |
270 |
|
|
271 |
< |
MPI_Recv(&nCurObj, 1, MPI_INT, 0, |
271 |
> |
MPI_Recv(&nCurObj, 1, MPI_INT, which_node, |
272 |
|
TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); |
273 |
< |
|
274 |
< |
for(j=0; j < integrableObjects.size(); j++){ |
273 |
> |
cerr << "node " << worldRank << " finished MPI_Send" << endl; |
274 |
> |
for(j=0; j < nCurObj; j++){ |
275 |
|
|
276 |
|
eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file); |
277 |
|
if(eof_test == NULL){ |
288 |
|
|
289 |
|
MPI_Send(read_buffer, BUFFERSIZE, MPI_CHAR, which_node, |
290 |
|
TAKE_THIS_TAG_CHAR, MPI_COMM_WORLD); |
291 |
< |
|
291 |
> |
cerr << "node " << worldRank << " finished MPI_Send" << endl; |
292 |
|
} |
293 |
|
|
294 |
|
} |
298 |
|
} |
299 |
|
else{ |
300 |
|
//actions taken at slave nodes |
301 |
+ |
|
302 |
+ |
MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD); |
303 |
+ |
|
304 |
+ |
cerr << "node " << worldRank << " finished MPI_Bcast" << endl; |
305 |
+ |
parseErr = parseCommentLine( read_buffer, simnfo); |
306 |
+ |
|
307 |
+ |
if( parseErr != NULL ){ |
308 |
+ |
strcpy( painCave.errMsg, parseErr ); |
309 |
+ |
haveError = 1; |
310 |
+ |
simError(); |
311 |
+ |
} |
312 |
+ |
|
313 |
|
for (i=0 ; i < mpiSim->getTotNmol(); i++) { |
314 |
|
which_node = MolToProcMap[i]; |
315 |
|
|
328 |
|
|
329 |
|
nCurObj = integrableObjects.size(); |
330 |
|
|
331 |
< |
MPI_Recv(&nCurObj, 1, MPI_INT, 0, |
332 |
< |
TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); |
331 |
> |
MPI_Send(&nCurObj, 1, MPI_INT, 0, |
332 |
> |
TAKE_THIS_TAG_INT, MPI_COMM_WORLD); |
333 |
|
|
334 |
+ |
cerr << "node " << worldRank << " finished MPI_Send" << endl; |
335 |
|
for(j = 0; j < integrableObjects.size(); j++){ |
336 |
|
|
337 |
|
MPI_Recv(read_buffer, BUFFERSIZE, MPI_CHAR, 0, |
338 |
|
TAKE_THIS_TAG_CHAR, MPI_COMM_WORLD, &istatus); |
339 |
|
|
340 |
+ |
cerr << "node " << worldRank << " finished MPI_Recv" << endl; |
341 |
|
parseErr = parseDumpLine(read_buffer, integrableObjects[j]); |
342 |
|
|
343 |
|
if( parseErr != NULL ){ |
635 |
|
|
636 |
|
//push eta into SimInfo::properties which can be |
637 |
|
//retrieved by integrator later |
638 |
< |
//entry_plug->setBoxM( theBoxMat3 ); |
638 |
> |
|
639 |
|
DoubleArrayData* etaValue = new DoubleArrayData(); |
640 |
|
etaValue->setID(ETAVALUE_ID); |
641 |
|
etaValue->setData(eta, 9); |