Open
Conversation
The nvhpc compiler does not correctly handle `x = transpose(x)` on allocatable arrays when the transpose changes shape. Use a separate working array for the (wavelength, height) layout, then assign the transpose to the result variable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…diator polymorphism - Grid from_config: explicitly allocate mid_/delta_ before assignment from array slices to prevent nvhpc from preserving wrong lower bounds - Profiles (7 files): same fix for mid_val_/delta_val_/layer_dens_ arrays - Quantum yields (17 files): use separate working arrays for transpose to avoid self-referential transpose that nvhpc mishandles - Radiator: change class(radiator_ptr) to type(radiator_ptr) in accumulate to fix polymorphic array descriptor corruption on nvhpc; add explicit allocation guard for layer_OD_ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- radiator test: change stack-allocated radiator_ptr arrays to allocatable to work around nvhpc bug with stack arrays of derived types containing polymorphic pointer components (resulted in corrupted array bounds) - la_sr_bands effxs: change allocatable function result to fixed-size array to avoid nvhpc issues with allocatable function results assigned to array sections Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nvhpc In calc_params, replace this%AC(1,I) and this%BC(1,I) (Fortran 77 sequence association) with this%AC(:,I) and this%BC(:,I) (proper array sections). nvhpc miscalculates memory offsets when using sequence association on components of polymorphic (class) objects, causing the Chebyshev polynomial to evaluate with wrong coefficients (~3% error in O2 optical depth at certain heights/wavelengths). Also remove temporary diagnostic output from test_la_srb.F90. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
In schum_OD and schum_xs, the code clamps O2 column to colmin=exp(38) then checks if log(clamped_value) < 38. With nvhpc's math library, log(exp(38._dk)) returns a value slightly less than 38.0_dk, causing all heights at the top of the atmosphere (where O2 column is clamped) to be misclassified as out-of-range. This resulted in cross sections being filled with repeated edge values instead of computed values, producing ~3-67% errors across 5525 height/wavelength/SZA combinations. Fix: check the unclamped column directly against colmin instead of comparing log(clamped_column) against 38. This avoids the roundoff issue entirely and matches the mathematical intent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Apply the same ktop boundary fix to the F77 test reference code that was applied to the TUV-x la_sr_bands.F90. Compare unclamped o2col against EXP(38.) directly instead of checking ALOG(clamped) < 38.0, which fails on nvhpc where log(exp(38)) rounds to slightly less than 38.0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace Fortran array concatenation `[ handles_, key ]` with explicit temporary + reallocation for both handles_ and spectral_weights_ arrays. nvhpc 25.7 doesn't deep-copy allocatable character components in string_t during array concatenation, causing garbled variable names when writing dose_rates.nc. This matches the pattern already used in photolysis_rates.F90. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7950c58 to
55683c8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses comprehensive compiler compatibility issues with the NVIDIA nvhpc 25.7 compiler. The changes systematically fix multiple categories of Fortran language features that nvhpc handles differently than other compilers, while maintaining correctness and functionality.
Changes:
- Added nvhpc 25.7 Docker build environment and CI workflow integration
- Fixed self-referential transpose operations on allocatable arrays across 37 quantum yield and cross section calculation files
- Fixed array auto-reallocation issues in profile and grid constructors by adding explicit allocations
- Resolved polymorphic array descriptor corruption, stack corruption, sequence association violations, and string concatenation issues
- Fixed numerical precision bug in Schumann-Runge band calculations affecting both TUV-x and F77 reference code
Reviewed changes
Copilot reviewed 67 out of 67 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docker/Dockerfile.nvhpc | New nvhpc 25.7 Docker build environment with netcdf dependencies |
| docker/Dockerfile.intel | Minor comment correction |
| .github/workflows/docker.yml | Added nvhpc to CI matrix and disk space cleanup |
| test/unit/util/io/netcdf.F90 | Wrapped string literals with string_t() constructor for nvhpc compatibility |
| test/unit/tuv_doug/schum.f | Fixed log(exp(38)) roundoff error causing ktop boundary misclassification |
| test/unit/test_utils.F90 | Added debug print statements for array size checking |
| test/unit/radiator/radiator_test.F90 | Changed stack arrays to allocatable to prevent stack corruption |
| src/util/config.F90 | Extracted complex logical conditions to temporary variables for nvhpc compatibility |
| src/radiative_transfer/radiator.F90 | Changed class(radiator_ptr) to type(radiator_ptr) to fix descriptor corruption; added allocation check for layer_OD_ |
| src/quantum_yields/*.F90 (17 files) | Fixed self-referential transpose using intermediate wrkQuantumYield arrays |
| src/cross_sections/*.F90 (20 files) | Fixed self-referential transpose using intermediate wrkCrossSection arrays |
| src/profiles/*.F90 (7 files) | Added explicit allocation before assignment; renamed finalizers to unique names |
| src/grids/from_config.F90 | Added explicit allocation before assignment for mid_ and delta_ |
| src/grid_warehouse.F90 | Renamed finalizer to finalize_grid_warehouse |
| src/profile_warehouse.F90 | Renamed finalizer to finalize_profile_warehouse |
| src/output.F90 | Renamed finalizer to finalize_output_t |
| src/netcdf.F90 | Renamed finalizer to finalize_netcdf |
| src/heating_rates.F90 | Fixed zero-size array allocation; modified labels() function to use explicit loop |
| src/dose_rates.F90 | Replaced array concatenation with explicit reallocation to fix string corruption |
| src/photolysis_rates.F90 | Added allocation check before transpose |
| src/la_sr_bands.F90 | Fixed log(exp(38)) roundoff; changed allocatable to fixed-size array result; fixed sequence association with array sections |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
boulderdaze
approved these changes
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix all test and build failures with the nvhpc 25.7 compiler.