Add test for writing and reading Legendre polynomials from disk#413
Add test for writing and reading Legendre polynomials from disk#413samhatfield wants to merge 14 commits into
Conversation
|
The history of this read/write was for the serial postprocessing of operational (high) resolution using following stack hierarchy: |
|
It was just a simple precision bug -> the writer and reader assumed 8-byte reals, always, so the single-precision tests failed. I've fixed this by adjusting the type of the polynomials based on |
There was a problem hiding this comment.
Pull request overview
This PR adds an API test intended to validate that SETUP_TRANS can (1) write Legendre polynomials to disk and (2) re-initialize in the same process reading those polynomials back from the same file. To support this, it also extends the Legendre polynomial on-disk header with the real-element byte size (IRBYTES) in both CPU and GPU implementations.
Changes:
- Add a new
setup_transAPI test that writes Legendre polynomials to disk and then reads them back in a secondSETUP_TRANScall. - Extend Legendre polynomial file headers (CPU/GPU) to include
IRBYTESand use it when sizing binary reads/writes. - Update CMake test list/excludes to register the new test and skip it for MPI>0 configurations.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/trans/api/setup_trans/setup_trans_test_suite.F90 | Adds the new write/read Legendre polynomial test case. |
| tests/trans/api/setup_trans/CMakeLists.txt | Registers the new test and excludes it for MPI configurations. |
| src/trans/gpu/internal/write_legpol_mod.F90 | Writes extended Legendre header including IRBYTES (GPU path). |
| src/trans/gpu/internal/read_legpol_mod.F90 | Reads extended Legendre header including IRBYTES (GPU path). |
| src/trans/cpu/internal/write_legpol_mod.F90 | Writes extended Legendre header including IRBYTES (CPU path). |
| src/trans/cpu/internal/read_legpol_mod.F90 | Reads extended Legendre header including IRBYTES (CPU path). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Due to the extra entry in HEADER, would you say that generated files from before this PR are no longer compatible to be read in? |
Before merging #409 I want to add a test for doing a direct transform with Legendre polynomials read from disk. Firstly I want to check whether we can call
SETUP_TRANSwith disk-read polynomials. This PR adds a test which callsSETUP_TRANSonce to write the polynomials to disk and then again in the same instance to read the polynomials from the same file. However, the test currently segfaults which either indicates a bug in the code or improper use. @wdeconinck can you see anything wrong with how I'm callingSETUP_TRANS?Contributor Declaration
By opening this pull request, I affirm the following: