Repository navigation
Let users set L/U storage estimates via superlumt_options_t (#27) - #37
Merged
Merged
Conversation
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
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.
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/andTESTING/each ship their ownsp_ienv.cthat overrides the library's, so an edit toSRC/sp_ienv.ccan appear to have no effect.Two changes:
New option fields.
superlumt_options_tgainsfill_lusup,fill_ucolandfill_lsubwith the same semantics assp_ienv(6),sp_ienv(7)andsp_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 thesp_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 thep?gssvxheader comments.Visible fallback. When the requested arrays do not fit in memory,
p?gstrf_MemInit()halvesnzlmax/nzumaxand 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 theunused variable 'retries'warning.Adding fields to
superlumt_options_tchanges the struct layout, and the new fields must be initialized by callers ofp?gssvx/p?gstrfthat fill the struct themselves (as the examples do). User code that declares the struct on the stack without zeroing it will see garbage infill_*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
-Wall -Wextra -Wpedantic; ctest 48/48 pass.pdlinsolxreading the fields from the environment (matrixg10, 2 threads):fill_lsubunset /-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 = 2000000000underulimit -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