Skip to content

Conversation

@pbehne
Copy link
Contributor

@pbehne pbehne commented Jan 19, 2026

Ref #32194.

zachmprince and others added 3 commits January 13, 2026 10:21
… stateless shuffle

- Replace stateful RNG usage in stochastic_tools samplers with stateless indexing, including PMCMC-based and active learning samplers
- Add stateless generator advance helper and LHS stateless shuffle with execute-time advance to preserve repeatable sampling

Ref idaholab#32194
@moosebuild
Copy link
Contributor

moosebuild commented Jan 19, 2026

Job Documentation, step Docs: sync website on 5e8e17c wanted to post the following:

View the site here

This comment will be updated on new commits.

@pbehne pbehne marked this pull request as ready for review January 20, 2026 20:27
@moosebuild
Copy link
Contributor

moosebuild commented Jan 26, 2026

Job Coverage, step Generate coverage on 3c64d5f wanted to post the following:

Framework coverage

3bd3e8 #32248 3c64d5
Total Total +/- New
Rate 85.86% 85.85% -0.00% 100.00%
Hits 127681 127689 +8 18
Misses 21036 21045 +9 0

Diff coverage report

Full coverage report

Modules coverage

Stochastic tools

3bd3e8 #32248 3c64d5
Total Total +/- New
Rate 90.65% 90.70% +0.05% 100.00%
Hits 8631 8689 +58 141
Misses 890 891 +1 0

Diff coverage report

Full coverage report

Full coverage reports

Reports

This comment will be updated on new commits.

@moosebuild
Copy link
Contributor

Job Coverage, step Verify coverage on 8693da3 wanted to post the following:

The following coverage requirement(s) failed:

  • Failed to generate chemical_reactions coverage rate (required: 92.0%)
  • Failed to generate contact coverage rate (required: 87.0%)
  • Failed to generate electromagnetics coverage rate (required: 94.0%)
  • Failed to generate external_petsc_solver coverage rate (required: 84.0%)
  • Failed to generate fluid_properties coverage rate (required: 84.0%)
  • Failed to generate fsi coverage rate (required: 85.0%)
  • Failed to generate functional_expansion_tools coverage rate (required: 81.0%)
  • Failed to generate geochemistry coverage rate (required: 96.0%)
  • Failed to generate heat_transfer coverage rate (required: 87.0%)
  • Failed to generate level_set coverage rate (required: 85.0%)
  • Failed to generate misc coverage rate (required: 32.0%)
  • Failed to generate navier_stokes coverage rate (required: 77.0%)
  • Failed to generate optimization coverage rate (required: 86.0%)
  • Failed to generate peridynamics coverage rate (required: 77.0%)
  • Failed to generate phase_field coverage rate (required: 85.0%)
  • Failed to generate porous_flow coverage rate (required: 95.0%)
  • Failed to generate ray_tracing coverage rate (required: 93.0%)
  • Failed to generate rdg coverage rate (required: 63.0%)
  • Failed to generate reactor coverage rate (required: 90.0%)
  • Failed to generate scalar_transport coverage rate (required: 81.0%)
  • Failed to generate solid_mechanics coverage rate (required: 84.0%)
  • Failed to generate solid_properties coverage rate (required: 83.0%)
  • Failed to generate stochastic_tools coverage rate (required: 88.0%)
  • Failed to generate subchannel coverage rate (required: 87.0%)
  • Failed to generate thermal_hydraulics coverage rate (required: 88.0%)
  • Failed to generate xfem coverage rate (required: 80.0%)

1 similar comment
@moosebuild
Copy link
Contributor

Job Coverage, step Verify coverage on 8693da3 wanted to post the following:

The following coverage requirement(s) failed:

  • Failed to generate chemical_reactions coverage rate (required: 92.0%)
  • Failed to generate contact coverage rate (required: 87.0%)
  • Failed to generate electromagnetics coverage rate (required: 94.0%)
  • Failed to generate external_petsc_solver coverage rate (required: 84.0%)
  • Failed to generate fluid_properties coverage rate (required: 84.0%)
  • Failed to generate fsi coverage rate (required: 85.0%)
  • Failed to generate functional_expansion_tools coverage rate (required: 81.0%)
  • Failed to generate geochemistry coverage rate (required: 96.0%)
  • Failed to generate heat_transfer coverage rate (required: 87.0%)
  • Failed to generate level_set coverage rate (required: 85.0%)
  • Failed to generate misc coverage rate (required: 32.0%)
  • Failed to generate navier_stokes coverage rate (required: 77.0%)
  • Failed to generate optimization coverage rate (required: 86.0%)
  • Failed to generate peridynamics coverage rate (required: 77.0%)
  • Failed to generate phase_field coverage rate (required: 85.0%)
  • Failed to generate porous_flow coverage rate (required: 95.0%)
  • Failed to generate ray_tracing coverage rate (required: 93.0%)
  • Failed to generate rdg coverage rate (required: 63.0%)
  • Failed to generate reactor coverage rate (required: 90.0%)
  • Failed to generate scalar_transport coverage rate (required: 81.0%)
  • Failed to generate solid_mechanics coverage rate (required: 84.0%)
  • Failed to generate solid_properties coverage rate (required: 83.0%)
  • Failed to generate stochastic_tools coverage rate (required: 88.0%)
  • Failed to generate subchannel coverage rate (required: 87.0%)
  • Failed to generate thermal_hydraulics coverage rate (required: 88.0%)
  • Failed to generate xfem coverage rate (required: 80.0%)

Copy link
Contributor

@zachmprince zachmprince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great first start! This definitely doesn't close the issue yet, but I doubt it would in a single PR.

The biggest thing I'd like to see from this PR is the removal of sampleSetUp and sampleTearDown methods. This will pave the way to replacing getNextLocalRow logic throughout the module.

std::size_t rn_ind = 0;
for (std::size_t i = n_global - 1; i > 0; --i)
{
const auto j = getRandlStateless(rn_ind++, 0, i, seed_index);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the implementation on how the stateless RNG draws ranged integers, the memory footprint will blow up with this call. Basically, it will eventually create n_global - 1 objects. As such, I would recommend adding a new method in MooseRandomStateless specifically for grabbing indices for shuffling. I'm thinking the signature would look like this:

std::size_t randlShuffle(std::size_t n, std::size_t size)

Which will effectively be the same as calling:

randl(n, 0, size - n - 1)

but it will create a new generator object based on size instead of size - n - 1.

@@ -12,6 +12,7 @@
#include "Sampler.h"
#include "TransientInterface.h"
#include "Distribution.h"
#include <cstddef>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these includes necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, my editor inserted them. Will remove.

Comment on lines 124 to 130
const auto shuffle_count = n_rows > 0 ? n_rows - 1 : 0;
for (const auto col : make_range(n_cols))
{
advanceStatelessGenerator(col, n_rows);
if (shuffle_count > 0)
advanceStatelessGenerator(col + n_cols, shuffle_count);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way we can rely on the advancement step in Sampler::execute instead of having a specialized one here? Perhaps we could add a virtual protected member in Sampler to get the advance count for a particular seed index. I'd like to see as little customization of these execute* routines as possible.

- Drop sampleSetUp/sampleTearDown from the Sampler base and its call sites.
- Move sampler preparation into explicit update/build helpers called from compute paths.
- Add mode-aware computeSampleMatrix/Local/Row overrides for LHS and PSS.
- Keep stateless RNG usage consistent and add small inline/doc updates.

Ref. idaholab#32194
- Add MooseRandomStateless::randlShuffle and Sampler helper to avoid per-range generator growth during shuffles.
- Update LatinHypercubeSampler to use the shuffle RNG path.
- Remove sampleSetUp/sampleTearDown hooks; move sampler preparation into explicit update/build paths.
- Update latin_hypercube gold CSVs because the new shuffle RNG changes the deterministic sequence.
- add stateless advance hooks in Sampler and wire execution to use per-seed advance counts
- advance shuffle generators in MooseRandomStateless::advance to keep stateless shuffles aligned
- adjust LatinHypercubeSampler to use stateless shuffle advances and integrate with execute flow
- regold latin_hypercube_out_data_0001.csv for the new deterministic sequence

Ref. idaholab#32194
@moosebuild
Copy link
Contributor

Job Precheck, step Clang format on 7cc471e wanted to post the following:

Your code requires style changes.

A patch was auto generated and copied here
You can directly apply the patch by running, in the top level of your repository:

curl -s https://mooseframework.inl.gov/docs/PRs/32248/clang_format/style.patch | git apply -v

Alternatively, with your repository up to date and in the top level of your repository:

git clang-format e4407b31a57ef5bd7bcb870595bbe7897b813978

@moosebuild
Copy link
Contributor

Job Test, step Results summary on 5e8e17c wanted to post the following:

Framework test summary

Compared against e4407b3 in job civet.inl.gov/job/3542080.

No change

Modules test summary

Compared against e4407b3 in job civet.inl.gov/job/3542080.

No added tests

Run time changes

Test Base (s) Head (s) +/- Base (MB) Head (MB)
stochastic_tools/test:reporters/ActiveLearningGP.sampling/MultipleProc_MultipleRow_Ufunction 5.12 8.12 +58.57% 0.00 0.00
stochastic_tools/test:samplers/ParallelActiveLearning.active_learning/al_4proc 2.39 3.65 +52.70% 0.00 0.00
stochastic_tools/test:samplers/mcmc.mcmc_sampling/pmcmc_base_bounds 2.96 4.46 +50.38% 0.00 0.00

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.

3 participants