コード例 #1
0
ファイル: main.c プロジェクト: yhalcyon/Gromacs
t_commrec *init_par(int *argc, char ***argv_ptr)
{
    t_commrec    *cr;
    char        **argv;
    int           i;
    gmx_bool      pe = FALSE;

    snew(cr, 1);

    argv = argv_ptr ? *argv_ptr : NULL;

#if defined GMX_MPI && !defined GMX_THREAD_MPI
    cr->sim_nodeid = gmx_setup(argc, argv, &cr->nnodes);

    if (!PAR(cr) && (cr->sim_nodeid != 0))
    {
        gmx_comm("(!PAR(cr) && (cr->sim_nodeid != 0))");
    }

    cr->mpi_comm_mysim   = MPI_COMM_WORLD;
    cr->mpi_comm_mygroup = cr->mpi_comm_mysim;
#else
    /* These should never be accessed */
    cr->mpi_comm_mysim   = NULL;
    cr->mpi_comm_mygroup = NULL;
    cr->nnodes           = 1;
    cr->sim_nodeid       = 0;
#endif

    cr->nodeid = cr->sim_nodeid;

    cr->duty = (DUTY_PP | DUTY_PME);

    /* Communicate arguments if parallel */
#ifndef GMX_THREAD_MPI
    if (PAR(cr))
    {
        comm_args(cr, argc, argv_ptr);
    }
#endif /* GMX_THREAD_MPI */

#ifdef GMX_MPI
#if !defined(GMX_THREAD_MPI) && !defined(MPI_IN_PLACE_EXISTS)
    /* initialize the MPI_IN_PLACE replacement buffers */
    snew(cr->mpb, 1);
    cr->mpb->ibuf        = NULL;
    cr->mpb->libuf       = NULL;
    cr->mpb->fbuf        = NULL;
    cr->mpb->dbuf        = NULL;
    cr->mpb->ibuf_alloc  = 0;
    cr->mpb->libuf_alloc = 0;
    cr->mpb->fbuf_alloc  = 0;
    cr->mpb->dbuf_alloc  = 0;
#endif
#endif

    return cr;
}
コード例 #2
0
ファイル: main.c プロジェクト: aar2163/GROMACS
t_commrec *init_par(int *argc,char ***argv_ptr)
{
  t_commrec *cr;
  char      **argv;
  int       i;
  
  snew(cr,1);

  argv = *argv_ptr;
  
#ifdef GMX_MPI
#ifdef GMX_THREAD_MPI
  if (tMPI_Get_N(argc, argv_ptr)>1)
    gmx_parallel_env=1;
  else
    gmx_parallel_env=0;
#else
  gmx_parallel_env = 1;
#endif
#ifdef GMX_CHECK_MPI_ENV
  /* Do not use MPI calls when env.var. GMX_CHECK_MPI_ENV is not set */
  if (getenv(GMX_CHECK_MPI_ENV) == NULL)
    gmx_parallel_env = 0;
#endif
  if (gmx_parallel_env) {
    cr->sim_nodeid = gmx_setup(argc,argv,&cr->nnodes);
  } else {
    cr->nnodes     = 1;
    cr->sim_nodeid = 0;
  }
#else
  gmx_parallel_env = 0; 
  cr->sim_nodeid   = 0;
  cr->nnodes       = 1;
#endif

  if (!PAR(cr) && (cr->sim_nodeid != 0))
    gmx_comm("(!PAR(cr) && (cr->sim_nodeid != 0))");
  
  if (gmx_parallel_env) {
#ifdef GMX_MPI
    cr->mpi_comm_mysim = MPI_COMM_WORLD;
    cr->mpi_comm_mygroup = cr->mpi_comm_mysim;
#endif
  }
  cr->nodeid = cr->sim_nodeid;

  cr->duty = (DUTY_PP | DUTY_PME);

  /* Communicate arguments if parallel */
  if (PAR(cr))
    comm_args(cr,argc,argv_ptr);

  return cr;
}