#ifndef GMX_MPI
gmx_call("gmx_fill_commrec_from_mpi");
#else
+ if (!gmx_mpi_initialized())
+ {
+ gmx_comm("MPI has not been initialized properly");
+ }
+
cr->nnodes = gmx_node_num();
cr->nodeid = gmx_node_rank();
cr->sim_nodeid = cr->nodeid;
snew(cr, 1);
#ifdef GMX_LIB_MPI
- if (!gmx_mpi_initialized())
- {
- gmx_comm("MPI has not been initialized properly");
- }
-
gmx_fill_commrec_from_mpi(cr);
#else
- /* These should never be accessed */
cr->mpi_comm_mysim = NULL;
cr->mpi_comm_mygroup = NULL;
cr->nnodes = 1;
cr->nodeid = cr->sim_nodeid;
#endif
- // TODO this should be initialized elsewhere
+ // TODO cr->duty should not be initialized here
cr->duty = (DUTY_PP | DUTY_PME);
#if defined GMX_LIB_MPI && !defined MPI_IN_PLACE_EXISTS
return cr;
}
-t_commrec *init_par_threads(const t_commrec *cro)
+t_commrec *reinitialize_commrec_for_this_thread(const t_commrec *cro)
{
#ifdef GMX_THREAD_MPI
- int initialized;
t_commrec *cr;
/* make a thread-specific commrec */
*cr = *cro;
/* and we start setting our own thread-specific values for things */
- MPI_Initialized(&initialized);
- if (!initialized)
- {
- gmx_comm("Initializing threads without comm");
- }
-
- /* No need to do MPI_Init() for thread-MPI. */
gmx_fill_commrec_from_mpi(cr);
// TODO cr->duty should not be initialized here
t_commrec *init_commrec(void);
/* Allocate, initialize and return the commrec. */
-t_commrec *init_par_threads(const t_commrec *cro);
+t_commrec *reinitialize_commrec_for_this_thread(const t_commrec *cro);
/* Initialize communication records for thread-parallel simulations.
Must be called on all threads before any communication takes place by
the individual threads. Copies the original commrec to
fnm = dup_tfn(mc.nfile, mc.fnm);
- cr = init_par_threads(mc.cr);
+ cr = reinitialize_commrec_for_this_thread(mc.cr);
if (MASTER(cr))
{
return NULL;
}
- /* make a new comm_rec to reflect the new situation */
- crn = init_par_threads(cr);
+ crn = reinitialize_commrec_for_this_thread(cr);
return crn;
}