Skip to content

Unused locals in m_riemann_solver_lf.fpp, one occupying a GPU private() slot #1715

Description

@sbryngelson

Summary

src/simulation/m_riemann_solver_lf.fpp declares two locals that are never read. One of them also occupies a slot in a GPU private() clause, so every device thread carries storage for a value nothing uses.

Detail

variable occurrences in the file what they are
H_avg 1 the declaration only
c_sum_Yi_Phi 2 the declaration, plus one private() clause entry
real(wp) :: Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi          ! line 62
real(wp) :: H_avg                                             ! line 76
...
$:GPU_PARALLEL_LOOP(collapse=3, private='[..., eps, c_sum_Yi_Phi, Cp_L, Cp_R, ...]')

Neither is ever assigned or read.

Not a regression

Occurrence counts are identical on master, so both predate the current work. Found while reviewing #1714 (the eos_state refactor), which touches this file but did not introduce them — likely leftovers from when the Lax-Friedrichs solver was factored out of a solver that did compute a Roe-averaged enthalpy and a chemistry sound-speed term, both of which the LF path does not need.

For comparison, the sibling solvers do use these: m_riemann_solver_hll.fpp and m_riemann_solver_hllc.fpp both read H_avg and c_sum_Yi_Phi in their Roe-average paths.

Impact

Minor. No functional effect — an unused local is free on CPU. The private() entry is the part with any cost: it reserves per-thread storage on device for a value that is never touched.

Suggested fix

Delete both declarations and remove c_sum_Yi_Phi from the private() clause. Confirm nothing else in the file references them first (a whole-file grep is sufficient given the counts above), and check that no #:if variant reintroduces a use.

Worth checking the other Riemann solvers for the same pattern while in there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions