Merge branch release-2021 into merge-2021-into-master
[alexxy/gromacs.git] / docs / user-guide / environment-variables.rst
1 .. NOTE: Below is a useful bash one-liner to verify whether there are variables in this file
2 ..        no longer present in the code.
3 .. ( export INPUT_FILE='docs/user-guide/environment-variables.rst' GIT_PAGER="cat "; for s in $(grep '^`'  $INPUT_FILE | sed 's/`//g' | sed 's/,/ /g'); do count=$(git grep $s | grep -v $INPUT_FILE | wc -l); [ $count -eq 0 ] && printf "%-30s%s\n" $s $count; done ; )
4 .. Another useful one-liner to find undocumentedvariables:
5 ..  ( export INPUT_FILE=docs/user-guide/environment-variables.rst; GIT_PAGER="cat ";   for ss in `for s in $(git grep getenv |  sed 's/.*getenv("\(.*\)".*/\1/' | sort -u  | grep '^[A-Z]'); do [ $(grep $s $INPUT_FILE -c) -eq 0 ] && echo $s; done `; do git grep $ss ; done )
6
7 Environment Variables
8 =====================
9
10 |Gromacs| programs may be influenced by the use of
11 environment variables.  First of all, the variables set in
12 the ``GMXRC`` file are essential for running and
13 compiling |Gromacs|. Some other useful environment variables are
14 listed in the following sections. Most environment variables function
15 by being set in your shell to any non-NULL value. Specific
16 requirements are described below if other values need to be set. You
17 should consult the documentation for your shell for instructions on
18 how to set environment variables in the current shell, or in configuration
19 files for future shells. Note that requirements for exporting
20 environment variables to jobs run under batch control systems vary and
21 you should consult your local documentation for details.
22
23 Output Control
24 --------------
25 ``GMX_CONSTRAINTVIR``
26         Print constraint virial and force virial energy terms.
27
28 ``GMX_DUMP_NL``
29         Neighbour list dump level; default 0.
30
31 ``GMX_MAXBACKUP``
32         |Gromacs| automatically backs up old
33         copies of files when trying to write a new file of the same
34         name, and this variable controls the maximum number of
35         backups that will be made, default 99. If set to 0 it fails to
36         run if any output file already exists. And if set to -1 it
37         overwrites any output file without making a backup.
38
39 ``GMX_NO_QUOTES``
40         if this is explicitly set, no cool quotes
41         will be printed at the end of a program.
42
43 ``GMX_SUPPRESS_DUMP``
44         prevent dumping of step files during
45         (for example) blowing up during failure of constraint
46         algorithms.
47
48 ``GMX_TPI_DUMP``
49         dump all configurations to a :ref:`pdb`
50         file that have an interaction energy less than the value set
51         in this environment variable.
52
53 ``GMX_VIEW_XPM``
54         ``GMX_VIEW_XVG``, ``GMX_VIEW_EPS`` and ``GMX_VIEW_PDB``, commands used to
55         automatically view :ref:`xvg`, :ref:`xpm`, :ref:`eps`
56         and :ref:`pdb` file types, respectively; they default to ``xv``, ``xmgrace``,
57         ``ghostview`` and ``rasmol``. Set to empty to disable
58         automatic viewing of a particular file type. The command will
59         be forked off and run in the background at the same priority
60         as the |Gromacs| tool (which might not be what you want).
61         Be careful not to use a command which blocks the terminal
62         (e.g. ``vi``), since multiple instances might be run.
63
64 ``GMX_LOG_BUFFER``
65         the size of the buffer for file I/O. When set
66         to 0, all file I/O will be unbuffered and therefore very slow.
67         This can be handy for debugging purposes, because it ensures
68         that all files are always totally up-to-date.
69
70 ``GMX_LOGO_COLOR``
71         set display color for logo in :ref:`gmx view`.
72
73 ``GMX_PRINT_LONGFORMAT``
74         use long float format when printing
75         decimal values.
76
77 ``GMX_COMPELDUMP``
78         Applies for computational electrophysiology setups
79         only (see reference manual). The initial structure gets dumped to
80         :ref:`pdb` file, which allows to check whether multimeric channels have
81         the correct PBC representation.
82
83 ``GMX_TRAJECTORY_IO_VERBOSITY``
84         Defaults to 1, which prints frame count e.g. when reading trajectory
85         files. Set to 0 for quiet operation.
86
87 ``GMX_ENABLE_GPU_TIMING``
88         Enables GPU timings in the log file for CUDA. Note that CUDA timings
89         are incorrect with multiple streams, as happens with domain
90         decomposition or with both non-bondeds and PME on the GPU (this is
91         also the main reason why they are not turned on by default).
92
93 ``GMX_DISABLE_GPU_TIMING``
94         Disables GPU timings in the log file for OpenCL.
95
96 Debugging
97 ---------
98 ``GMX_PRINT_DEBUG_LINES``
99         when set, print debugging info on line numbers.
100
101 ``GMX_DD_NST_DUMP``
102         number of steps that elapse between dumping
103         the current DD to a PDB file (default 0). This only takes effect
104         during domain decomposition, so it should typically be
105         0 (never), 1 (every DD phase) or a multiple of :mdp:`nstlist`.
106
107 ``GMX_DD_NST_DUMP_GRID``
108         number of steps that elapse between dumping
109         the current DD grid to a PDB file (default 0). This only takes effect
110         during domain decomposition, so it should typically be
111         0 (never), 1 (every DD phase) or a multiple of :mdp:`nstlist`.
112
113 ``GMX_DD_DEBUG``
114         general debugging trigger for every domain
115         decomposition (default 0, meaning off). Currently only checks
116         global-local atom index mapping for consistency.
117
118 ``GMX_DD_NPULSE``
119         over-ride the number of DD pulses used
120         (default 0, meaning no over-ride). Normally 1 or 2.
121
122 ``GMX_DISABLE_ALTERNATING_GPU_WAIT``
123         disables the specialized polling wait path used to wait for the PME and nonbonded
124         GPU tasks completion to overlap to do the reduction of the resulting forces that
125         arrive first. Setting this variable switches to the generic path with fixed waiting
126         order.
127
128 ``GMX_TEST_REQUIRED_NUMBER_OF_DEVICES``
129         sets the number of GPUs required by the test suite. By default, the test suite would
130         fall-back to using CPU if GPUs could not be detected. Set it to a positive integer value
131         to ensure that at least this at least this number of usable GPUs are detected. Default:
132         0 (not testing GPU availability).
133
134 There are a number of extra environment variables like these
135 that are used in debugging - check the code!
136
137 Performance and Run Control
138 ---------------------------
139 ``GMX_DO_GALACTIC_DYNAMICS``
140         planetary simulations are made possible (just for fun) by setting
141         this environment variable, which allows setting :mdp:`epsilon-r` to -1 in the :ref:`mdp`
142         file. Normally, :mdp:`epsilon-r` must be greater than zero to prevent a fatal error.
143         See webpage_ for example input files for a planetary simulation.
144
145 ``GMX_BONDED_NTHREAD_UNIFORM``
146         Value of the number of threads per rank from which to switch from uniform
147         to localized bonded interaction distribution; optimal value dependent on
148         system and hardware, default value is 4.
149
150 ``GMX_GPU_NB_EWALD_TWINCUT``
151         force the use of twin-range cutoff kernel even if :mdp:`rvdw` equals
152         :mdp:`rcoulomb` after PP-PME load balancing. The switch to twin-range kernels is automated,
153         so this variable should be used only for benchmarking.
154
155 ``GMX_GPU_NB_ANA_EWALD``
156         force the use of analytical Ewald kernels. Should be used only for benchmarking.
157
158 ``GMX_GPU_NB_TAB_EWALD``
159         force the use of tabulated Ewald kernels. Should be used only for benchmarking.
160
161 ``GMX_DISABLE_CUDA_TIMING``
162         Deprecated. Use ``GMX_DISABLE_GPU_TIMING`` instead.
163
164 ``GMX_GPU_DD_COMMS``
165         perform domain decomposition halo exchange communication operations (on coordinate and force buffers)
166         directly on GPU memory spaces, without the staging of data through CPU memory, where possible.
167
168 ``GMX_GPU_PME_PP_COMMS``
169         when the simulation uses a separate PME rank, perform communication operations between PP and PME rank
170         (for coordinate and force buffers) directly on GPU memory spaces, without the staging of data through CPU
171         memory, where possible. 
172
173 ``GMX_GPU_SYCL_NO_SYNCHRONIZE``
174         disable synchronizations between different GPU streams in SYCL build, instead relying on SYCL runtime to
175         do scheduling based on data dependencies. Experimental.
176
177 ``GMX_CYCLE_ALL``
178         times all code during runs.  Incompatible with threads.
179
180 ``GMX_CYCLE_BARRIER``
181         calls MPI_Barrier before each cycle start/stop call.
182
183 ``GMX_DD_ORDER_ZYX``
184         build domain decomposition cells in the order
185         (z, y, x) rather than the default (x, y, z).
186
187 ``GMX_DD_USE_SENDRECV2``
188         during constraint and vsite communication, use a pair
189         of ``MPI_Sendrecv`` calls instead of two simultaneous non-blocking calls
190         (default 0, meaning off). Might be faster on some MPI implementations.
191
192 ``GMX_DLB_BASED_ON_FLOPS``
193         do domain-decomposition dynamic load balancing based on flop count rather than
194         measured time elapsed (default 0, meaning off).
195         This makes the load balancing reproducible, which can be useful for debugging purposes.
196         A value of 1 uses the flops; a value > 1 adds (value - 1)*5% of noise to the flops to increase the imbalance and the scaling.
197
198 ``GMX_DLB_MAX_BOX_SCALING``
199         maximum percentage box scaling permitted per domain-decomposition
200         load-balancing step (default 10)
201
202 ``GMX_DD_RECORD_LOAD``
203         record DD load statistics for reporting at end of the run (default 1, meaning on)
204
205 ``GMX_DETAILED_PERF_STATS``
206         when set, print slightly more detailed performance information
207         to the :ref:`log` file. The resulting output is the way performance summary is reported in versions
208         4.5.x and thus may be useful for anyone using scripts to parse :ref:`log` files or standard output.
209
210 ``GMX_DISABLE_SIMD_KERNELS``
211         disables architecture-specific SIMD-optimized (SSE2, SSE4.1, AVX, etc.)
212         non-bonded kernels thus forcing the use of plain C kernels.
213
214 ``GMX_DISABLE_GPU_TIMING``
215         timing of asynchronously executed GPU operations can have a
216         non-negligible overhead with short step times. Disabling timing can improve performance in these cases.
217
218 ``GMX_DISABLE_GPU_DETECTION``
219         when set, disables GPU detection even if :ref:`gmx mdrun` was compiled
220         with GPU support.
221
222 ``GMX_GPU_APPLICATION_CLOCKS``
223         setting this variable to a value of "0", "ON", or "DISABLE" (case insensitive)
224         allows disabling the CUDA GPU allication clock support.
225
226 ``GMX_DISRE_ENSEMBLE_SIZE``
227         the number of systems for distance restraint ensemble
228         averaging. Takes an integer value.
229
230 ``GMX_EMULATE_GPU``
231         emulate GPU runs by using algorithmically equivalent CPU reference code instead of
232         GPU-accelerated functions. As the CPU code is slow, it is intended to be used only for debugging purposes.
233
234 ``GMX_ENX_NO_FATAL``
235         disable exiting upon encountering a corrupted frame in an :ref:`edr`
236         file, allowing the use of all frames up until the corruption.
237
238 ``GMX_FORCE_UPDATE``
239         update forces when invoking ``mdrun -rerun``.
240
241 ``GMX_FORCE_UPDATE_DEFAULT_GPU``
242         Force update to run on the GPU by default, overriding the ``mdrun -update auto`` option. Works similar to setting
243         ``mdrun -update gpu``, but (1) falls back to the CPU code-path, if set with input that is not supported and
244         (2) can be used to run update on GPUs in multi-rank cases. The latter case should be
245         considered experimental since it lacks substantial testing. Also, GPU update is only supported with the GPU direct
246         communications and ``GMX_FORCE_UPDATE_DEFAULT_GPU`` variable should be set simultaneously with ``GMX_GPU_DD_COMMS``
247         and ``GMX_GPU_PME_PP_COMMS`` environment variables in multi-rank case. Does not override ``mdrun -update cpu``.
248
249 ``GMX_GPU_ID``
250         set in the same way as ``mdrun -gpu_id``, ``GMX_GPU_ID``
251         allows the user to specify different GPU IDs for different ranks, which can be useful for selecting different
252         devices on different compute nodes in a cluster.  Cannot be used in conjunction with ``mdrun -gpu_id``.
253
254 ``GMX_GPUTASKS``
255         set in the same way as ``mdrun -gputasks``, ``GMX_GPUTASKS`` allows the mapping
256         of GPU tasks to GPU device IDs to be different on different ranks, if e.g. the MPI
257         runtime permits this variable to be different for different ranks. Cannot be used
258         in conjunction with ``mdrun -gputasks``. Has all the same requirements as ``mdrun -gputasks``.
259
260 ``GMX_GPU_DISABLE_COMPATIBILITY_CHECK``
261         Disables the hardware compatibility check in OpenCL and SYCL. Useful for developers
262         and allows testing the OpenCL/SYCL kernels on non-supported platforms without source code modification.
263
264 ``GMX_IGNORE_FSYNC_FAILURE_ENV``
265         allow :ref:`gmx mdrun` to continue even if
266         a file is missing.
267
268 ``GMX_LJCOMB_TOL``
269         when set to a floating-point value, overrides the default tolerance of
270         1e-5 for force-field floating-point parameters.
271
272 ``GMX_MAXCONSTRWARN``
273         if set to -1, :ref:`gmx mdrun` will
274         not exit if it produces too many LINCS warnings.
275
276 ``GMX_NB_MIN_CI``
277         neighbor list balancing parameter used when running on GPU. Sets the
278         target minimum number pair-lists in order to improve multi-processor load-balance for better
279         performance with small simulation systems. Must be set to a non-negative integer,
280         the 0 value disables list splitting.
281         The default value is optimized for supported GPUs
282         therefore changing it is not necessary for normal usage, but it can be useful on future architectures.
283
284 ``GMX_NBLISTCG``
285         use neighbor list and kernels based on charge groups.
286
287 ``GMX_NBNXN_CYCLE``
288         when set, print detailed neighbor search cycle counting.
289
290 ``GMX_NBNXN_EWALD_ANALYTICAL``
291         force the use of analytical Ewald non-bonded kernels,
292         mutually exclusive of ``GMX_NBNXN_EWALD_TABLE``.
293
294 ``GMX_NBNXN_EWALD_TABLE``
295         force the use of tabulated Ewald non-bonded kernels,
296         mutually exclusive of ``GMX_NBNXN_EWALD_ANALYTICAL``.
297
298 ``GMX_NBNXN_SIMD_2XNN``
299         force the use of 2x(N+N) SIMD CPU non-bonded kernels,
300         mutually exclusive of ``GMX_NBNXN_SIMD_4XN``.
301
302 ``GMX_NBNXN_SIMD_4XN``
303         force the use of 4xN SIMD CPU non-bonded kernels,
304         mutually exclusive of ``GMX_NBNXN_SIMD_2XNN``.
305
306 ``GMX_NOOPTIMIZEDKERNELS``
307         deprecated, use ``GMX_DISABLE_SIMD_KERNELS`` instead.
308
309 ``GMX_NO_CART_REORDER``
310         used in initializing domain decomposition communicators. Rank reordering
311         is default, but can be switched off with this environment variable.
312
313 ``GMX_NO_LJ_COMB_RULE``
314         force the use of LJ paremeter lookup instead of using combination rules
315         in the non-bonded kernels.
316
317 ``GMX_NO_INT``, ``GMX_NO_TERM``, ``GMX_NO_USR1``
318         disable signal handlers for SIGINT,
319         SIGTERM, and SIGUSR1, respectively.
320
321 ``GMX_NO_NODECOMM``
322         do not use separate inter- and intra-node communicators.
323
324 ``GMX_NO_NONBONDED``
325         skip non-bonded calculations; can be used to estimate the possible
326         performance gain from adding a GPU accelerator to the current hardware setup -- assuming that this is
327         fast enough to complete the non-bonded calculations while the CPU does bonded force and PME computation.
328         Freezing the particles will be required to stop the system blowing up.
329
330 ``GMX_PULL_PARTICIPATE_ALL``
331         disable the default heuristic for when to use a separate pull MPI communicator (at >=32 ranks).
332
333 ``GMX_NOPREDICT``
334         shell positions are not predicted.
335
336 ``GMX_NO_UPDATEGROUPS``
337         turns off update groups. May allow for a decomposition of more
338         domains for small systems at the cost of communication during update.
339
340 ``GMX_NSCELL_NCG``
341         the ideal number of charge groups per neighbor searching grid cell is hard-coded
342         to a value of 10. Setting this environment variable to any other integer value overrides this hard-coded
343         value.
344
345 ``GMX_PME_NUM_THREADS``
346         set the number of OpenMP or PME threads; overrides the default set by
347         :ref:`gmx mdrun`; can be used instead of the ``-npme`` command line option,
348         also useful to set heterogeneous per-process/-node thread count.
349
350 ``GMX_PME_P3M``
351         use P3M-optimized influence function instead of smooth PME B-spline interpolation.
352
353 ``GMX_PME_THREAD_DIVISION``
354         PME thread division in the format "x y z" for all three dimensions. The
355         sum of the threads in each dimension must equal the total number of PME threads (set in
356         :envvar:`GMX_PME_NTHREADS`).
357
358 ``GMX_PMEONEDD``
359         if the number of domain decomposition cells is set to 1 for both x and y,
360         decompose PME in one dimension.
361
362 ``GMX_REQUIRE_SHELL_INIT``
363         require that shell positions are initiated.
364
365 ``GMX_REQUIRE_TABLES``
366         require the use of tabulated Coulombic
367         and van der Waals interactions.
368
369 ``GMX_TPIC_MASSES``
370         should contain multiple masses used for test particle insertion into a cavity.
371         The center of mass of the last atoms is used for insertion into the cavity.
372
373 ``GMX_USE_GRAPH``
374         use graph for bonded interactions.
375
376 ``GMX_VERLET_BUFFER_RES``
377         resolution of buffer size in Verlet cutoff scheme.  The default value is
378         0.001, but can be overridden with this environment variable.
379
380 ``HWLOC_XMLFILE``
381         Not strictly a |Gromacs| environment variable, but on large machines
382         the hwloc detection can take a few seconds if you have lots of MPI processes.
383         If you run the hwloc command :command:`lstopo out.xml` and set this environment
384         variable to point to the location of this file, the hwloc library will use
385         the cached information instead, which can be faster.
386
387 ``MPIRUN``
388         the ``mpirun`` command used by :ref:`gmx tune_pme`.
389
390 ``MDRUN``
391         the :ref:`gmx mdrun` command used by :ref:`gmx tune_pme`.
392
393 ``GMX_DISABLE_DYNAMICPRUNING``
394         disables dynamic pair-list pruning. Note that :ref:`gmx mdrun` will
395         still tune nstlist to the optimal value picked assuming dynamic pruning. Thus
396         for good performance the -nstlist option should be used.
397
398 ``GMX_NSTLIST_DYNAMICPRUNING``
399         overrides the dynamic pair-list pruning interval chosen heuristically
400         by mdrun. Values should be between the pruning frequency value
401         (1 for CPU and 2 for GPU) and :mdp:`nstlist` ``- 1``.
402
403 .. _opencl-management:
404
405 OpenCL management
406 -----------------
407 Currently, several environment variables exist that help customize some aspects
408 of the OpenCL_ version of |Gromacs|. They are mostly related to the runtime
409 compilation of OpenCL kernels, but they are also used in device selection.
410
411 ``GMX_OCL_NOGENCACHE``
412         If set, disable caching for OpenCL kernel builds. Caching is
413         normally useful so that future runs can re-use the compiled
414         kernels from previous runs. Currently, caching is always
415         disabled, until we solve concurrency issues.
416
417 ``GMX_OCL_GENCACHE``
418         Enable OpenCL binary caching. Only intended to be used for
419         development and (expert) testing as neither concurrency
420         nor cache invalidation is implemented safely!
421
422 ``GMX_OCL_NOFASTGEN``
423         If set, generate and compile all algorithm flavors, otherwise
424         only the flavor required for the simulation is generated and
425         compiled.
426
427 ``GMX_OCL_DISABLE_FASTMATH``
428         Prevents the use of ``-cl-fast-relaxed-math`` compiler option.
429
430 ``GMX_OCL_DUMP_LOG``
431         If defined, the OpenCL build log is always written to the
432         mdrun log file. Otherwise, the build log is written to the
433         log file only when an error occurs.
434
435 ``GMX_OCL_VERBOSE``
436         If defined, it enables verbose mode for OpenCL kernel build.
437         Currently available only for NVIDIA GPUs. See ``GMX_OCL_DUMP_LOG``
438         for details about how to obtain the OpenCL build log.
439
440 ``GMX_OCL_DUMP_INTERM_FILES``
441
442         If defined, intermediate language code corresponding to the
443         OpenCL build process is saved to file. Caching has to be
444         turned off in order for this option to take effect (see
445         ``GMX_OCL_NOGENCACHE``).
446
447             - NVIDIA GPUs: PTX code is saved in the current directory
448               with the name ``device_name.ptx``
449             - AMD GPUs: ``.IL/.ISA`` files will be created for each OpenCL
450               kernel built.  For details about where these files are
451               created check AMD documentation for ``-save-temps`` compiler
452               option.
453
454 ``GMX_OCL_DEBUG``
455         Use in conjunction with ``OCL_FORCE_CPU`` or with an AMD device.
456         It adds the debug flag to the compiler options (-g).
457
458 ``GMX_OCL_NOOPT``
459         Disable optimisations. Adds the option ``cl-opt-disable`` to the
460         compiler options.
461
462 ``GMX_OCL_FORCE_CPU``
463         Force the selection of a CPU device instead of a GPU.  This
464         exists only for debugging purposes. Do not expect |Gromacs| to
465         function properly with this option on, it is solely for the
466         simplicity of stepping in a kernel and see what is happening.
467
468 ``GMX_OCL_DISABLE_I_PREFETCH``
469         Disables i-atom data (type or LJ parameter) prefetch allowing
470         testing.
471
472 ``GMX_OCL_ENABLE_I_PREFETCH``
473         Enables i-atom data (type or LJ parameter) prefetch allowing
474         testing on platforms where this behavior is not default.
475
476 ``GMX_OCL_FILE_PATH``
477         Use this parameter to force |Gromacs| to load the OpenCL
478         kernels from a custom location. Use it only if you want to
479         override |Gromacs| default behavior, or if you want to test
480         your own kernels.
481
482 ``GMX_OCL_SHOW_DIAGNOSTICS``
483         Use Intel OpenCL extension to show additional runtime performance
484         diagnostics.
485
486 Analysis and Core Functions
487 ---------------------------
488
489 ``DSSP``
490         used by :ref:`gmx do_dssp` to point to the ``dssp``
491         executable (not just its path).
492
493 ``GMX_DIPOLE_SPACING``
494         spacing used by :ref:`gmx dipoles`.
495
496 ``GMX_MAXRESRENUM``
497         sets the maximum number of residues to be renumbered by
498         :ref:`gmx grompp`. A value of -1 indicates all residues should be renumbered.
499
500 ``GMX_NO_FFRTP_TER_RENAME``
501         Some force fields (like AMBER) use specific names for N- and C-
502         terminal residues (NXXX and CXXX) as :ref:`rtp` entries that are normally renamed. Setting
503         this environment variable disables this renaming.
504
505 ``GMX_FONT``
506         name of X11 font used by :ref:`gmx view`.
507
508 ``GMXTIMEUNIT``
509         the time unit used in output files, can be
510         anything in fs, ps, ns, us, ms, s, m or h.
511
512 ``MULTIPROT``
513         name of the ``multiprot`` executable, used by the
514         contributed program ``do_multiprot``.
515
516 ``NCPUS``
517         number of CPUs to be used for Gaussian QM calculation
518
519 ``GMX_TOTAL``
520         name of the ``total`` executable used by the contributed
521         ``do_shift`` program.
522
523 ``GMX_ENER_VERBOSE``
524         make :ref:`gmx energy` and :ref:`gmx eneconv`
525         loud and noisy.
526
527 ``VMD_PLUGIN_PATH``
528         where to find VMD plug-ins. Needed to be
529         able to read file formats recognized only by a VMD plug-in.
530
531 ``VMDDIR``
532         base path of VMD installation.
533
534 ``GMX_USE_XMGR``
535         sets viewer to ``xmgr`` (deprecated) instead of ``xmgrace``.