Skip to content

Let users set L/U storage estimates via superlumt_options_t (#27) - #37

Merged
xiaoyeli merged 1 commit into
masterfrom
claude/nifty-noether-m4f0vh
Oct 10, 2026
Merged

xiaoyeli merged 1 commit into
masterfrom
claude/nifty-noether-m4f0vh

Conversation

@xiaoyeli

Copy link
Copy Markdown
Owner

Summary

Addresses the request in #27: the initial storage for the L and U factors was fixed by sp_ienv(6..8), which users could only change by editing and rebuilding the library. Worse, EXAMPLE/ and TESTING/ each ship their own sp_ienv.c that overrides the library's, so an edit to SRC/sp_ienv.c can appear to have no effect.

Two changes:

  1. New option fields. superlumt_options_t gains fill_lusup, fill_ucol and fill_lsub with the same semantics as sp_ienv(6), sp_ienv(7) and sp_ienv(8): a negative value is a growth factor applied to nnz(A), a positive value is an absolute number of entries, and 0 (the default) keeps the sp_ienv() value. p?gstrf_MemInit() reads them; p?gstrf_init() and every in-tree driver (EXAMPLE/p?linsolx*.c, TESTING/p?drive.c) set them to 0. Documented in the p?gssvx header comments.

  2. Visible fallback. When the requested arrays do not fit in memory, p?gstrf_MemInit() halves nzlmax/nzumax and retries. That message was only printed with -DPRNTlevel=1, so a user who raised the fill factor could get the same "Storage for L subscripts exceeded" abort with no hint that the request had been silently cut back (very likely what the reporter in Hard-coded fil-in estimation causes errors #27 hit). The message is now printed unconditionally to stderr. This also removes the unused variable 'retries' warning.

⚠️ Compatibility note for reviewers

Adding fields to superlumt_options_t changes the struct layout, and the new fields must be initialized by callers of p?gssvx/p?gstrf that fill the struct themselves (as the examples do). User code that declares the struct on the stack without zeroing it will see garbage in fill_* after recompiling against this header. All in-tree users are updated. If this is a concern, the alternative is a runtime setter (superlumt_set_fill_estimates(...) writing to static variables) that leaves the struct untouched; I can switch to that instead.

Testing

  • Builds with -Wall -Wextra -Wpedantic; ctest 48/48 pass.
  • Functional check with a copy of pdlinsolx reading the fields from the environment (matrix g10, 2 threads):
    • fill_lsub unset / -30 / 100000 → factors normally.
    • fill_lsub = 1 → Storage for L subscripts exceeded; Current column 0; Need at least 10 (the option takes effect).
    • fill_ucol = 2000000000 under ulimit -v 3000000 → the new message appears three times (... halving the request, retry 1/2/3) and the factorization then succeeds; before this change that fallback was silent.

Companion PR for the macro base files: xiaoyeli/superlu_mt_base (opened alongside this one).

🤖 Generated with Claude Code

https://claude.ai/code/session_017GsYX7J15S6uvtUoRMWYwi


Generated by Claude Code

The initial storage for the L and U factors was fixed by sp_ienv(6..8),
which users could only change by editing and rebuilding the library (and
EXAMPLE/ and TESTING/ each ship their own sp_ienv.c that overrides it).
Add fill_lusup, fill_ucol and fill_lsub to superlumt_options_t with the
same semantics as the sp_ienv() parameters: a negative value is a
growth factor applied to nnz(A), a positive value is an absolute number
of entries, and 0 (the default) keeps the sp_ienv() value.
p?gstrf_MemInit() reads them; p?gstrf_init() and the in-tree drivers
set them to 0.

Also print the retry message in p?gstrf_MemInit() unconditionally (to
stderr) instead of only with -DPRNTlevel=1. When the requested arrays do
not fit in memory the routine silently halved nzlmax/nzumax and carried
on, so a user who raised the fill factor could get the same "Storage for
L subscripts exceeded" abort with no hint that the request was cut back.
This also removes the unused-variable warning for 'retries'.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GsYX7J15S6uvtUoRMWYwi
@xiaoyeli
xiaoyeli merged commit f2e50bf into master Oct 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants