File: README

package info (click to toggle)
lammps 20250204%2Bdfsg.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 474,368 kB
  • sloc: cpp: 1,060,070; python: 27,785; ansic: 8,956; f90: 7,254; sh: 6,044; perl: 4,171; fortran: 2,442; xml: 1,714; makefile: 1,352; objc: 238; lisp: 188; yacc: 58; csh: 16; awk: 14; tcl: 6; javascript: 2
file content (173 lines) | stat: -rw-r--r-- 8,399 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
The script `run_tests.py` in this folder is used to perform regression tests
using in-place example scripts and provided log files as reference.

What this single script does is to launch the selected LAMMPS binary
using a testing configuration defined in a `.yaml` file (e.g., `config.yaml`)
for the set of input scripts inside the given `examples/` subfolders,
and compare the output thermo with that in the existing log file with the same number of procs.
If there are multiple log files with the same input script (e.g., `log.melt.*.g++.1` and `log.melt.*.g++.4`),
the one with the highest number of procs is chosen.

The output includes the number of passed and failed tests and
an `output.xml` file in the JUnit XML format for downstream reporting.
The output and error of any crashed runs are logged.

A test with an input script is considered passed when the given LAMMPS binary produces
thermo output quantities consistent with those in the reference log file
within the specified tolerances in the test configuration `config.yaml` file.

With the current features, users can:

    + specify which LAMMPS binary version to test (e.g., the version from a commit, or those from `lammps-testing`)
    + specify the examples subfolders (thus the reference log files) seperately (e.g. from other LAMMPS versions or commits), or
    + specify a file that lists of the examples input scripts to test
    + specify tolerances for individual quantities for any input script to override the global values in the config file
    + launch tests with `mpirun` with all supported command line features (multiple procs, multiple paritions, and suffixes)
    + skip certain input files (whose names match specified patterns) if not interested, or packaged not installed, or no reference log file exists
    + set a timeout for every input script run if they may take too long
    + skip numerical checks if the goal is just to check if the runs do not fail

Some benefits include:

    + separating regression testing from building LAMMPS
    + performing quick and full regression tests
    + keeping track of the testing progress to resume the testing from the last checkpoint (skipping completed runs)
    + distributing the input list across multiple processes by
      splitting the list of input scripts into separate runs (there are ~800 input scripts under the top-level examples)

Input arguments:

    + the path to a LAMMPS binary (can be relative to the working directory)
    + a test configuration file (see tools/regression-tests/config.yaml for an example)
    + a text file that lists of folders where the input scripts reside and how many of them line by line, or
      a text file that list of input scripts, or
      the path to the top-level examples

Output:

    + failure.yaml : a dictionary of the failed runs and reasons
    + progress.yaml: full testing results of the tested input scripts with the status (completed, failed or skipped)
                     with error messages (for failed runs), and walltime (in seconds)
    + output.xml   :    testing results in the JUnit XML format
    + run.log      :       screen output and error of individual runs

Limitations:

    + input scripts use thermo style multi (e.g., examples/peptide) do not work with the expected thermo output format
    + input scripts that require partition runs (e.g. examples/neb) need a separate config file, e.g., args: "--partition 3x1"
    + testing with accelerator packages (GPU, INTEL, KOKKOS, OPENMP) need separate config files, e.g., args: "-sf omp -pk omp 4"

The following Python packages need to be installed into an activated environment:

    python3 -m venv testing-env
    source testing-env/bin/activate
    pip install numpy pyyaml junit_xml

For all the supported arguments, run:

    python3 tools/regression-tests/run_tests.py -h

Example uses (aka, tests for this script):

    1) Simple use (using the provided tools/regression-tests/config.yaml and the examples/ folder at the top level)
           python3 run_tests.py --lmp-bin=build/lmp --config-file=tools/regression-tests/config.yaml

    2) Use a custom testing configuration
           python3 run_tests.py --lmp-bin=/path/to/lmp_binary --config-file=/path/to/config/file/config.yaml

    3) Specify a list of example folders
           python3 run_tests.py --lmp-bin=/path/to/lmp_binary --config-file=/path/to/config/file/config.yaml \
                --example-folders="/path/to/examples/melt;/path/to/examples/rigid"

       The example subfolders can also be loaded from a text file list_subfolders1.txt:
           python3 run_tests.py --lmp-bin=/path/to/lmp_binary --config-file=/path/to/config/file/config.yaml \
                --list-subfolders=list_subfolders1.txt --output-file=output1.txt --progress-file=progress1.yaml \
                --log-file=run1.log

    4) Specify a list of example input scripts (e.g. obtained from running tools/regression-tests/get-quick-list.py)
            python3 run_tests.py --lmp-bin=/path/to/lmp_binary --config-file=/path/to/config/file/config.yaml \
                --list-input=input_list.txt

    5) Test a LAMMPS binary with the whole top-level /examples folder in a LAMMPS source tree
           python3 run_tests.py --lmp-bin=/path/to/lmp_binary --examples-top-level=/path/to/lammps/examples
                --config-file=tools/regression-tests/config.yaml

    6) Analyze the LAMMPS binary and whole top-level /examples folder in a LAMMPS source tree
       and generate separate input lists for 8 workers:
           python3 run_tests.py --lmp-bin=/path/to/lmp_binary --examples-top-level=/path/to/lammps/examples \
                --analyze --num-workers=8

       The output of this run is 8 files folder-list-[0-7].txt that lists the subfolders
       and 8 files input-list-[0-7].txt that lists the input scripts under the top-level example folders.
       With these lists, one can launch multiple instances of run_tests.py simultaneously
       each with a list of example subfolders (Case 3), or with a list of input scripts (Case 4).

An example of the test configuration `config.yaml` is given as below.

  ---
    lmp_binary: ""
    nprocs: ""
    args: "-cite none"
    mpiexec: "mpirun"
    mpiexec_numproc_flag: "-np"
    tolerance:
      PotEng:
        abs: 1e-4
        rel: 1e-7
      TotEng:
        abs: 1e-4
        rel: 1e-7
      Press:
        abs: 1e-4
        rel: 1e-7
      Temp:
        abs: 1e-4
        rel: 1e-7
      E_vdwl:
        abs: 1e-3
        rel: 1e-7
    overrides:
      in.rigid.tnr:
        Temp:
          abs: 1e-3
          rel: 1e-5
        Press:
          abs: 1e-2
          rel: 1e-4
    skip:
      [ 
        in.displ,
        in.displ2,
        in.*_imd*,
      ]

    nugget: 1.0
    epsilon: 1e-16
    timeout: 180

Note that if nprocs is left empty "", as in the above example, the test for a given input script will use the maximum number of procs among the log files.
For instance, for the input script examples/melt/in.melt, there are 2 log files with 1 and 4 procs. The test for in.melt will then run with 4 procs and the output is compare against the 4-proc log file.  This is the typical configuration.

If nprocs is specified explicitly, for example, nprocs: "2", this value of nprocs will be used for ALL the input scripts (except for the valgrind test).
In this case, the reference log file is again the one with the maximum number of procs, that is, 4. One example of this configuration is for KOKKOS tests where
the runs are often `mpirun -np 2 lmp -in in.melt -k on g 2` (with the CUDA backend) or  `mpirun -np 2 lmp -in in.melt -k on t 2` (with the OpenMP backend).

An example of the list of example subfolders in a text file `list_subfolders1.txt`

    /home/codes/lammps/examples/melt 1
    /home/codes/lammps/examples/body 5
    /home/codes/lammps/examples/PACKAGES/dielectric 2
    /home/codes/lammps/examples/PACKAGES/tally 3

where the numbers are the number of input scripts (in.*) in the folders.


An example of the list of input scripts in a text file `input_list.txt`

    /home/codes/lammps/examples/melt/in.melt
    /home/codes/lammps/examples/body/in.body
    /home/codes/lammps/examples/body/in.cubes
    /home/codes/lammps/examples/PACKAGES/dielectric/in.confined
    /home/codes/lammps/examples/PACKAGES/tally/in.pe
    /home/codes/lammps/examples/PACKAGES/tally/in.force