How to compare two result files.
- Author
- N. Ohana
- Date
- 12/2017
The purpose of the tool is to easily detect differences between two ORB5 result files expected to be identical, for instance to check regression tests.
Installation
Here is the procedure to install h5diff dependencies in a python virtual environment:
~/orb5> python3 -m venv tools/python/h5diff/venv/
~/orb5> source tools/python/h5diff/venv/bin/activate
(venv) ~/orb5> pip install -r tools/python/h5diff/requirements.txt
[...]
Successfully installed h5py-2.7.1 numpy-1.13.3 six-1.11.0 yattag-1.9.2
If you want to deactivate the environment, use:
(venv) ~/orb5> deactivate
~/orb5>
Usage
First activate the virtual environment:
~/orb5> source tools/python/h5diff/venv/bin/activate
(venv) ~/orb5>
Then use the following syntax to compare <file1.h5> and <file2.h5>:
(venv) ~/orb5> tools/python/h5diff/h5diff.py <file1.h5> <file2.h5> [<report.html>]
If the optional argument <report.html> is present and differences are detected, they will be reported in this file (along with h5diff_report.css file).
If you want to deactivate the environment, use:
(venv) ~/orb5> deactivate
~/orb5>
Example
Here is an example of comparison of the same simulation using 1 or 4 MPI clones:
(venv) ~/orb5> tools/python/h5diff/h5diff.py <work_dir>/nclones={1,4}/orb5_res.h5 1vs4clones.html
Comparing `<work_dir>/nclones=1/orb5_res.h5' and '<work_dir>/nclones=4/orb5_res.h5'...
Detected 1 different strings:
- '/run_info/input/run_01' (1 out of 166 lines)
Detected 11 different datasets:
- '/data/var0d/deuterium/
wmax' (9 out of 11 elements)
- '/data/var1d/deuterium/f_theta_f/data' (317 out of 704 elements)
- '/data/var1d/deuterium/f_theta_w/data' (317 out of 704 elements)
- '/data/var1d/deuterium/v_par2_theta_f/data' (317 out of 704 elements)
- '/data/var1d/deuterium/v_par2_theta_w/data' (317 out of 704 elements)
- '/data/var1d/deuterium/v_par_theta_f/data' (317 out of 704 elements)
- '/data/var1d/deuterium/v_par_theta_w/data' (317 out of 704 elements)
- '/data/var1d/deuterium/v_perp2_theta_f/data' (317 out of 704 elements)
- '/data/var1d/deuterium/v_perp2_theta_w/data' (317 out of 704 elements)
- '/parameters/
parallel/nclones
' (1 out of 1 elements)
- '/parameters/
parallel/nvp_world
' (1 out of 1 elements)
Generated 1vs4clones.html and h5diff_report.css.
type(diag0d), dimension(:), allocatable wmax
Definition: globals_diag.F90:122
type(parallel_variables) parallel
Definition: globals.F90:365
And the corresponding detailed report 1vs4clones.html:
- Note
- The elements are expandable.
-
The dataset dimensions after the first one are agregated. Only the mean and standard deviation over those dimensions are displayed.
-
The lines containing differences are highlighted in red color.