Skip to content

fix: use DBADDIAOPT for array SILO options (lo_offset, hi_offset) - #1344

Merged
sbryngelson merged 1 commit into
masterfrom
fix-silo-optlist
Apr 1, 2026
Merged

fix: use DBADDIAOPT for array SILO options (lo_offset, hi_offset)#1344
sbryngelson merged 1 commit into
masterfrom
fix-silo-optlist

Conversation

@sbryngelson

Copy link
Copy Markdown
Member

Summary

lo_offset and hi_offset are integer arrays (size 1-3 depending on dimensionality), but they were being passed to DBADDIOPT which expects a scalar integer. SILO's Fortran wrapper for DBADDIOPT stores a pointer to a single int, so only the first element was read — meaning 2D and 3D ghost zone offsets beyond the first dimension were silently lost in SILO output files.

Fix: use DBADDIAOPT(optlist, option, nval, array) which is the correct SILO function for integer array options.

Verified by reading the SILO Fortran wrapper source (silo_f.c):

  • DBADDIOPT_FC(optlist_id, option, ivalue) — scalar, stores pointer to single int
  • DBADDIAOPT_FC(optlist_id, option, nval, ivalues) — array, stores pointer to int array with length

Test plan

  • ./mfc.sh precheck -j 8
  • ./mfc.sh build -j 4 (all targets)
  • Tested 3D 64^3 case with format = 2 (SILO output), 4 MPI ranks — post_process completes successfully and produces correct SILO files

DBADDIOPT expects a scalar integer, but lo_offset and hi_offset are
arrays (size 1-3 depending on dimensionality). This passes an array
where SILO expects a scalar pointer, so only the first element is read.

Use DBADDIAOPT (integer array option) instead, which takes the array
length and pointer. This fixes gfortran rank mismatch warnings and
ensures all dimension offsets are correctly written to SILO files.
@qodo-code-review

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Fix SILO ghost zone offset array handling with DBADDIAOPT

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Replace DBADDIOPT with DBADDIAOPT for array SILO options
• Fix silent data loss of ghost zone offsets in 2D/3D cases
• Pass array length and pointer to SILO's integer array function
• Resolve gfortran rank mismatch warnings in SILO output
Diagram
flowchart LR
  A["DBADDIOPT<br/>scalar int"] -->|incorrect| B["Only first element<br/>read from array"]
  C["DBADDIAOPT<br/>array int"] -->|correct| D["All dimensions<br/>written to SILO"]
  B --> E["Data loss in 2D/3D"]
  D --> F["Complete ghost zone info"]
Loading

Grey Divider

File Changes

1. src/post_process/m_data_output.fpp 🐞 Bug fix +6/-6

Replace scalar SILO option calls with array variants

• Replaced 6 instances of DBADDIOPT with DBADDIAOPT for lo_offset and hi_offset options
• Added size(lo_offset) and size(hi_offset) parameters to specify array lengths
• Changes applied across three conditional branches handling 3D, 2D, and 1D mesh cases
• Ensures all ghost zone offsets are correctly passed to SILO database functions

src/post_process/m_data_output.fpp


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Proxy missing DBADDIAOPT 🐞 Bug ⚙ Maintainability
Description
m_data_output now calls DBADDIAOPT, but the repo’s Silo proxy module (which explicitly documents
swapping it in when Silo isn’t available) does not provide a DBADDIAOPT symbol, so that documented
fallback compile path will fail. This blocks post-process builds on platforms relying on the proxy
approach.
Code

src/post_process/m_data_output.fpp[R492-493]

+                err = DBADDIAOPT(optlist, DBOPT_LO_OFFSET, size(lo_offset), lo_offset)
+                err = DBADDIAOPT(optlist, DBOPT_HI_OFFSET, size(hi_offset), hi_offset)
Evidence
The updated post-process writer now invokes DBADDIAOPT for DBOPT_LO_OFFSET/DBOPT_HI_OFFSET. The
repository includes a Silo proxy module with instructions to modify m_data_output to use the proxy
when the Silo library is unavailable; however, that proxy module defines DBADDIOPT/DBADDDOPT but
contains no DBADDIAOPT before end-of-module, so substituting the proxy as instructed would yield an
unresolved reference/compile failure for DBADDIAOPT.

src/post_process/m_data_output.fpp[490-506]
misc/m_silo_proxy.f90[5-19]
misc/m_silo_proxy.f90[94-138]
misc/m_silo_proxy.f90[284-298]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`src/post_process/m_data_output.fpp` now uses `DBADDIAOPT(...)`. The repo’s Silo proxy module (`misc/m_silo_proxy.f90`) is documented as a fallback for builds without Silo, but it does not define `DBADDIAOPT`, so the documented proxy substitution will fail to compile/link.

### Issue Context
The proxy module currently provides stubs for `DBMKOPTLIST`, `DBADDIOPT`, `DBADDDOPT`, etc., and instructs users to edit `m_data_output` to use the proxy when Silo is unavailable.

### Fix Focus Areas
- misc/m_silo_proxy.f90[94-138]
- misc/m_silo_proxy.f90[284-298]

### Proposed fix
Add an `impure function DBADDIAOPT(optlist_id, option, nval, ivalues)` stub to `m_silo_proxy` matching the calling convention used by `m_data_output` (likely `integer, intent(in) :: optlist_id, option, nval` and `integer, dimension(:), intent(in) :: ivalues`), implemented similarly to `DBADDIOPT` (print message + stop). Optionally update the proxy instructions/comments to mention this newer API usage.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 28b1293c-e528-429d-b15f-7a0e16640638

📥 Commits

Reviewing files that changed from the base of the PR and between 336487c and 8eebb8e.

📒 Files selected for processing (1)
  • src/post_process/m_data_output.fpp

📝 Walkthrough

Walkthrough

The changes update how low and high offset arrays are passed to the Silo-HDF5 mesh writing function. Specifically, two function calls were replaced: DBADDIOPT calls were changed to DBADDIAOPT calls for the DBOPT_LO_OFFSET and DBOPT_HI_OFFSET options. The new function signature requires explicitly providing the element count of the offset arrays alongside the arrays themselves, rather than implicitly handling the array metadata. The surrounding control flow, option list creation, and option list freeing operations remain unchanged.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing DBADDIOPT with DBADDIAOPT for array SILO options, which directly addresses the bug fix.
Description check ✅ Passed The description provides comprehensive context including the bug explanation, the fix, verification against source code, and a detailed test plan, covering all essential information needed to understand the change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Apr 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.67%. Comparing base (336487c) to head (8eebb8e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1344   +/-   ##
=======================================
  Coverage   64.67%   64.67%           
=======================================
  Files          70       70           
  Lines       18249    18249           
  Branches     1504     1504           
=======================================
  Hits        11803    11803           
  Misses       5491     5491           
  Partials      955      955           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbryngelson
sbryngelson merged commit fbecfc3 into master Apr 1, 2026
58 checks passed
@sbryngelson
sbryngelson deleted the fix-silo-optlist branch April 1, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant