Merge branch 'release-2018' into master
authorAleksei Iupinov <a.yupinov@gmail.com>
Wed, 17 Jan 2018 12:29:47 +0000 (13:29 +0100)
committerAleksei Iupinov <a.yupinov@gmail.com>
Wed, 17 Jan 2018 12:29:47 +0000 (13:29 +0100)
Change-Id: I101621e6fca6729cc42cd7eb6678c1471ccf6ef2

1  2 
src/programs/mdrun/runner.cpp

index 5decaf5499962f48e5c7fafd5b35a832924dac56,a4d390e2039f1321e54c900f875480e5582cb587..b84e5e4df795607744998c2a28caa3f94c0f157d
@@@ -325,7 -325,7 +325,7 @@@ static bool gpuAccelerationOfNonbondedI
                                                 const t_inputrec *ir,
                                                 bool              issueWarning)
  {
-     if (ir->opts.ngener > 1)
+     if (ir->opts.ngener - ir->nwall > 1)
      {
          /* The GPU code does not support more than one energy group.
           * If the user requested GPUs explicitly, a fatal error is given later.
@@@ -444,9 -444,9 +444,9 @@@ int Mdrunner::mdrunner(
  
      /* CAUTION: threads may be started later on in this function, so
         cr doesn't reflect the final parallel state right now */
 -    gmx::MDModules mdModules;
 -    t_inputrec     inputrecInstance;
 -    t_inputrec    *inputrec = &inputrecInstance;
 +    std::unique_ptr<gmx::MDModules> mdModules(new gmx::MDModules);
 +    t_inputrec                      inputrecInstance;
 +    t_inputrec                     *inputrec = &inputrecInstance;
      snew(mtop, 1);
  
      if (mdrunOptions.continuationOptions.appendFiles)
      GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
  
      // TODO: Error handling
 -    mdModules.assignOptionsToModules(*inputrec->params, nullptr);
 +    mdModules->assignOptionsToModules(*inputrec->params, nullptr);
  
      if (fplog != nullptr)
      {
  
      /* Initialize per-physical-node MPI process/thread ID and counters. */
      gmx_init_intranode_counters(cr);
-     if (opt2bSet("-multi", nfile, fnm))
+     if (cr->ms && cr->ms->nsim > 1 && !opt2bSet("-multidir", nfile, fnm))
      {
          GMX_LOG(mdlog.info).asParagraph().
              appendText("The -multi flag is deprecated, and may be removed in a future version. Please "
      {
          /* Initiate forcerecord */
          fr                 = mk_forcerec();
 -        fr->forceProviders = mdModules.initForceProviders();
 +        fr->forceProviders = mdModules->initForceProviders();
          init_forcerec(fplog, mdlog, fr, fcd,
                        inputrec, mtop, cr, box,
                        opt2fn("-table", nfile, fnm),
                                       oenv,
                                       mdrunOptions,
                                       vsite, constr,
 -                                     mdModules.outputProvider(),
 +                                     mdModules->outputProvider(),
                                       inputrec, mtop,
                                       fcd,
                                       globalState.get(),
      // As soon as we destroy GPU contexts after mdrunner() exits, these lines should go.
      mdAtoms.reset(nullptr);
      globalState.reset(nullptr);
 +    mdModules.reset(nullptr);   // destruct force providers here as they might also use the GPU
  
      /* Free GPU memory and set a physical node tMPI barrier (which should eventually go away) */
      free_gpu_resources(fr, cr);