-
-
Notifications
You must be signed in to change notification settings - Fork 165
Render fieldcompare diff visualizations #883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
b1bea82
88d6653
e4ae847
4efd8dd
551e35f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| - Archive fieldcompare diff VTK files into a `diff-results/` folder in each systemtest run directory on failure so they are easy to find in CI artifacts when investigating comparison failures (fixes [#441](https://github.com/precice/tutorials/issues/441)). Nested paths under `precice-exports/` are preserved under `diff-results/`. | ||
| - Archive fieldcompare diff VTK files into a `diff-results/` folder in each systemtest run directory on failure so they are easy to find in CI artifacts when investigating comparison failures (fixes [#441](https://github.com/precice/tutorials/issues/441), [#740](https://github.com/precice/tutorials/pull/740), [#883](https://github.com/precice/tutorials/pull/883)). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,7 @@ When the tests fail at the results comparison step, this typically means that th | |
|
|
||
| - `precice-exports/`: The coupling meshes of the test run. | ||
| - `reference-results/`: The coupling meshes of the reference run, as stored on Git LFS, expanded into `reference-results-unpacked`. For test cases using implicit coupling, the reference `.tar.gz` also contains the reference `precice-*-iterations.log` files. | ||
| - `diff-results/`: Numerical difference of the results in the two directories (computed with `fieldcompare dir --diff precice-exports/ reference/`). These are only present on failed comparisons. | ||
| - `diff-results/`: Numerical difference of the results in the two directories (computed with `fieldcompare dir --diff precice-exports/ reference/`). These are only present on failed comparisons and accompanied by visualization in `diff-results/visualizations/`. | ||
| - `iterations-logs/`: The `precice-*-iterations.log` files of the test run. Only present in test cases using implicit coupling. The comparisons to references only take into account the file SHA-256 checksums. | ||
|
|
||
| To reproduce the comparison locally, use the [same fieldcompare command](https://github.com/precice/tutorials/blob/develop/tools/tests/docker-compose.field_compare.template.yaml): | ||
|
|
@@ -118,13 +118,23 @@ The differences are only shown per file, and there is no global metric or other | |
|
|
||
| Alternatively, [visualize the `precice-exports/diff_*.vtu` in ParaView](https://precice.org/configuration-export.html#visualization-with-paraview). | ||
|
|
||
| To regenerate the PNG visualizations locally from an archived `diff-results/` folder (for example after downloading a CI artifact): | ||
|
|
||
| ```bash | ||
| python3 visualize_fieldcompare_diffs.py /path/to/diff-results | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am running locally: but this seems to be stuck without any output for a while. Some output in the script would be good. I assume something is wrong; it cannot be that slow.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, it is very slow. It took at least 30min on my system. I guess the GHA runners are faster. There, the job timed out, I didn't notice before:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notice also that only So, overall, the logging could be improved. |
||
| ``` | ||
|
|
||
| The default image size is set by `WINDOW_SIZE` in `visualize_fieldcompare_diffs.py` (currently `1024 x 768`). Increase it for higher-resolution PNGs, e.g. `WINDOW_SIZE = (1920, 1080)`. | ||
|
|
||
| For PDF output instead of PNG, replace the `plotter.show(screenshot=...)` call in `render_field()` with `plotter.render()` followed by `plotter.save_graphic(str(output_file.with_suffix(".pdf")))`. | ||
|
|
||
| ### Re-running from CI artifacts | ||
|
|
||
| When a system test fails in CI, download the **full** artifact: | ||
|
|
||
| `system_tests_run_<run_id>_<run_attempt>_full` | ||
|
|
||
| (a smaller `_logs` archive contains only log files). The archive contains a shared `runs/` directory: | ||
| (a smaller `_logs` archive contains the stage log files; on comparison failures, difference visualizations are in a separate `_diffs` archive. The archives contain a shared `runs/` directory: | ||
|
|
||
| ```text | ||
| runs/ | ||
|
|
@@ -288,6 +298,7 @@ Metadata and workflow/script files: | |
| - Multi-stage build Dockerfiles that define how to build each component, in a layered approach | ||
| - `docker-compose.template.yaml`: Describes how to prepare each test (Docker Compose service template) | ||
| - `docker-compose.field_compare.template.yaml`: Describes how to compare results with fieldcompare (Docker Compose service template) | ||
| - `docker-compose.diff_visualizer.template.yaml`: Describes how to render fieldcompare diff VTK files to PNG images on failure | ||
| - `components.yaml`: Declares the available components and their parameters/options | ||
| - `reference-results-metadata.txt.template`: Template for reporting the versions and machine used to generate each reference results archive | ||
| - `reference_versions.yaml`: List of arguments to use for generating the reference results | ||
|
|
@@ -308,7 +319,8 @@ Implementation scripts: | |
|
|
||
| - `tools/tests/` | ||
| - `systemtests.py`: Main entry point | ||
| - `requirements.txt`: Dependencies (jinja2, pyyaml) | ||
| - `requirements.txt`: Dependencies (jinja2, pyyaml, pyvista for optional local use of the visualizer script) | ||
| - `visualize_fieldcompare_diffs.py`: Renders archived fieldcompare diff VTK files to PNG images (normally run via the `diff_visualizer` Docker stage) | ||
| - `metadata_parser/`: Reads the YAML files into Python objects (defines the schema) | ||
| - `systemtests/`: Main implementation classes | ||
| - `Systemtest.py` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| services: | ||
| diff-visualizer: | ||
| build: | ||
| context: {{ dockerfile_context }} | ||
| dockerfile: Dockerfile | ||
| target: diff_visualizer | ||
| args: | ||
| {% for key, value in build_arguments.items() %} | ||
| - {{ key }}={{ value }} | ||
| {% endfor %} | ||
| volumes: | ||
| - ./{{ diff_results_folder }}:/diff-results | ||
| - ../tools/tests/visualize_fieldcompare_diffs.py:/home/precice/visualize_fieldcompare_diffs.py:ro | ||
| environment: | ||
| VTK_DEFAULT_OPENGL_WINDOW: vtkOSOpenGLRenderWindow | ||
| PYVISTA_OFF_SCREEN: "true" | ||
| command: | ||
| - /home/precice/venv/bin/python | ||
| - /home/precice/visualize_fieldcompare_diffs.py | ||
| - /diff-results |
|
MakisH marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| jinja2 | ||
| pyvista | ||
| pyyaml |
Uh oh!
There was an error while loading. Please reload this page.