+ /* if bUseGPU == NULL we don't want a GPU (e.g. hybrid mode kernel selection) */
+ bGPU = ((bUseGPU != NULL) && hwinfo->bCanUseGPU);
+
+ /* Run GPU emulation mode if GMX_EMULATE_GPU is defined. We will
+ * automatically switch to emulation if non-bonded calculations are
+ * turned off via GMX_NO_NONBONDED - this is the simple and elegant
+ * way to turn off GPU initialization, data movement, and cleanup. */
+ bEmulateGPU = (bEmulateGPUEnvVarSet || (getenv("GMX_NO_NONBONDED") != NULL && bGPU));
+
+ /* Enable GPU mode when GPUs are available or GPU emulation is requested.
+ * The latter is useful to assess the performance one can expect by adding
+ * GPU(s) to the machine. The conditional below allows this even if mdrun
+ * is compiled without GPU acceleration support.
+ * Note that such a GPU acceleration performance assessment should be
+ * carried out by setting the GMX_EMULATE_GPU and GMX_NO_NONBONDED env. vars
+ * (and freezing the system as otherwise it would explode). */
+ if (bGPU || bEmulateGPUEnvVarSet)