Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b984f8f
Adding modification for equilibrium cycle optimzation samplers and ch…
Jun 12, 2025
0613cad
update and add PRLO module
wangcj05 Jul 17, 2025
83067a3
Minor bug fixes and formatting improvements. Fixed the bug previously…
Jul 24, 2025
0f5b01e
Fixed plot name printed in error messages.
Jul 30, 2025
8307e5f
Added logic to allow 'Inputs', 'Outputs', and 'Index' to be None. Thi…
Jul 30, 2025
05b2414
Applied hotfix from Khang Nguyen that corrects a synchronization issu…
Jul 31, 2025
54b6af7
Further improvements from Khang and Mohammad Abdo to improve the sync…
Aug 4, 2025
afcf1fa
The outdated behavior of having randomUtils initialize the RNG with a…
Aug 6, 2025
f10a52a
Merge pull request #1 from W0lfShAd0w/EquilibriumCycleWork_June25
W0lfShAd0w Aug 6, 2025
3b4706f
fixed a bug frontUtils.py that was causing nonfitness pareto fronts t…
W0lfShAd0w Aug 6, 2025
7baf9fc
globalSeed parameter of RunInfo now supports 'None' as a valid input.
Aug 12, 2025
6baef0d
Added functionality in the GA optimizer to perform zscore normalizati…
Aug 12, 2025
5a9b834
Temporary fix made to correct desyncing issues in the Optimizer betwe…
Aug 26, 2025
7c7db7b
Fixed a bug in NSGA-II causing the fitness values to be desynced from…
Aug 26, 2025
144c65d
Changed the utility of the scaling factors in fitness.py so that they…
Aug 27, 2025
ba2943f
Fixed the way default scaling factors were being applied to accomodat…
Aug 28, 2025
e427807
Overhauled the method by which NSGA-II was storing data/tracking for …
Aug 28, 2025
0471b64
Adopted some lines from Josh Cogliati to ensure that the most fit ind…
Aug 29, 2025
bdd5ed6
Added a print statement for when no GlobalSeed is provided.
Sep 8, 2025
4500020
Improved the data storing used in the sampler._solutionExport to redu…
Sep 9, 2025
c270783
The outdated behavior of having randomUtils initialize the RNG with a…
Aug 6, 2025
4c64114
globalSeed parameter of RunInfo now supports 'None' as a valid input.
Aug 12, 2025
020ac52
Added a print statement for when no GlobalSeed is provided.
Sep 8, 2025
d12f00a
Minor changes made to address comments in PR #2534. Several tests wer…
Sep 15, 2025
26fc55f
global seed added to more tests to ensure consistency with golds.
Sep 16, 2025
661b0f2
Minor change to clarify output messages from globalSeed check.
Sep 17, 2025
dc2c069
Added globalSeed parameter to test input file for backwards compatabi…
Sep 22, 2025
a30e2d3
resolve merge conflicts with idaholab/devel
Sep 23, 2025
e98f7bc
Modified the tolerance on the multiYearDWT test to account for uncert…
Sep 23, 2025
392a784
Increased tolerances further for multiYearDWT test to get around fitt…
Sep 24, 2025
a5fbc8e
Attempt at addressing the possible intermittent test error on Fedora …
Oct 28, 2025
ac6132f
Merge branch 'devel' into RNG_improvements
W0lfShAd0w Oct 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ tests/framework/ROM/TimeSeries/ARMA/InterpolatedMaxCycles/
tests/framework/ROM/TimeSeries/SyntheticHistory/LogARMA/
tests/framework/ROM/TimeSeries/SyntheticHistory/VARMA/
tests/framework/ROM/TimeSeries/SyntheticHistory/ZeroFilterDiscontinuous/
*.xml.bak
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure you don't commit any *.xml.bak files, but we shouldn't need to have this in the .gitignore file.


# hpc
node_*[0-9]
Expand Down
1 change: 1 addition & 0 deletions plugins/ExamplePlugin/tests/test_example_plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<RunInfo>
<WorkingDir>simpleTest</WorkingDir>
<Sequence>MCrun, trainROM, sampleROM, printTOfile</Sequence>
<globalSeed>5489</globalSeed>
</RunInfo>

<Steps>
Expand Down
1 change: 1 addition & 0 deletions plugins/ExamplePlugin/tests/test_interfacedPP.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<Sequence>FirstMRun,PP</Sequence>
<batchSize>1</batchSize>
<internalParallel>True</internalParallel>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
1 change: 1 addition & 0 deletions plugins/ExamplePlugin/tests/test_interfacedPP_parallel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<Sequence>FirstMRun,PP</Sequence>
<batchSize>1</batchSize>
<internalParallel>True</internalParallel>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
1 change: 1 addition & 0 deletions plugins/ExamplePlugin/tests/test_interfacedPP_pointset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<WorkingDir>interfacedPostProcessor_PointSet</WorkingDir>
<Sequence>FirstMRun,PP</Sequence>
<batchSize>1</batchSize>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<WorkingDir>ProjectileCodePlugin</WorkingDir>
<Sequence>runGrid</Sequence>
<batchSize>1</batchSize>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<batchSize>1</batchSize>
<NumMPI>1</NumMPI>
<parallelMethod>dask</parallelMethod>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
9 changes: 9 additions & 0 deletions ravenframework/Simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from .JobHandler import JobHandler
from .utils import utils, TreeStructure, xmlUtils, mathUtils
from .utils.utils import ParallelLibEnum
from .utils.randomUtils import randomSeed
from . import Decorators
from .Application import __QtAvailable
from .Interaction import Interaction
Expand Down Expand Up @@ -582,6 +583,7 @@ def __readRunInfo(self, xmlNode, runInfoSkip, xmlFilename):
runInfoSkipIter = set()
else:
runInfoSkipIter = runInfoSkip
parsedSeed = False #log if globalSeed parameter if parsed and print to log accordingly
for element in xmlNode:
if element.tag in runInfoSkipIter:
self.raiseAWarning(f"Skipped element {element.tag}")
Expand Down Expand Up @@ -736,8 +738,15 @@ def __readRunInfo(self, xmlNode, runInfoSkip, xmlFilename):
if modeName in self.__modeHandlerDict:
self.raiseAWarning(f"duplicate mode definition {modeName}")
self.__modeHandlerDict[modeName] = module.__dict__[modeClass]
elif element.tag == 'globalSeed': #this is needed for reproducibility in case the RNG is called before a standard seeding step.
parsedSeed = True
globalSeed = int(element.text) if element.text.lower() != 'none' else None
self.raiseADebug('Setting RAVEN RNG seed to',globalSeed)
randomSeed(globalSeed) #Reinstance the global generator with the requested seed.
else:
self.raiseAnError(IOError, f'RunInfo element "{element.tag}" unknown!')
if not parsedSeed:
self.raiseADebug('No globalSeed specified in RunInfo, defaulting to a high entropy RNG state.')

def printDicts(self):
"""
Expand Down
9 changes: 6 additions & 3 deletions ravenframework/utils/randomUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,18 @@ def __init__(self):
"""
self._engine = None
self._seed = None
self.seed(5489) # default seed of boost::random::mt19937
self.seed(None) # default seed of boost::random::mt19937 was 5489. If this is desired, set <globalSeed>5489</globalSeed> under node <RunInfo> in the '.xml'.

def seed(self, value):
"""
Reseeds the RNG
@ In, value, int, RNG seed
@ In, value, int or NoneType, RNG seed
@ Out, None
"""
self._seed = abs(int(value))
if value is not None:
self._seed = abs(int(value))
else:
self._seed = value #'None' prompts the bitGenerator to grab a "high entropy seed from the OS", which defines the inital state.
# According to the numpy docs, best practice is to create a new Generator rather than reseed an
# existing one.
bitGenerator = np.random.MT19937()
Expand Down
45 changes: 45 additions & 0 deletions scripts/conversionScripts/convert_globalseed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import xml.etree.ElementTree as ET

def convert(tree,fileName=None):
"""
Converts input files to include the <globalSeed> argument under <RunInfo>. This enables
backwards compatibility following updates made to randomUtils.py.
@ In, tree, xml.etree.ElementTree.ElementTree object, the contents of a RAVEN input file
@ In, fileName, the name for the raven input file
@Out, tree, xml.etree.ElementTree.ElementTree object, the modified RAVEN input file
"""
newTag = 'globalSeed'
newValue = 5489

simulation = tree.getroot()
runInfo = simulation.find('RunInfo')
if runInfo is not None:
elemExists = False
for child in runInfo:
if child.tag == newTag:
elemExists = True
if not elemExists:
newElem = ET.Element(newTag)
newElem.text = str(newValue)
runInfo.append(newElem)
return tree

if __name__=='__main__':
import convert_utils
import sys
convert_utils.standardMain(sys.argv,convert)
## the following is provided as an example format for the expected content of the system arguments (sys.argv):
#sys.argv = ['/home/rollnk/LWRS-PRLO/raven_latest/scripts/conversionScripts/convert_globalseed.py','--tests','--no-rewrite']
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
pbs
<runQSUB/>
</mode>
<globalSeed>5489</globalSeed>
</RunInfo>

<Steps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Distributions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Distributions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<batchSize>3</batchSize>
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<batchSize>3</batchSize>
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<globalSeed>5489</globalSeed>
</RunInfo>

<Distributions>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/InternalParallel/test_internal_MSR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Models>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Steps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<internalParallel>True</internalParallel>
<expectedTime>00:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<!-- STEPS -->
Expand Down
3 changes: 2 additions & 1 deletion tests/cluster_tests/RavenRunsRaven/code_dask.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</description>
<revisions>
<revision author="alfoa" date="2021-04-21">Modified test to add test the internalParallel with outer initialization (RAY) and inner usage (using the new
nodes headNode and remoteNodes
nodes headNode and remoteNodes
</revision>
<revision author="cogljj" date="2023-04-11">Added a dask version of this test</revision>
</revisions>
Expand All @@ -27,6 +27,7 @@
<NodeParameter>--hostfile</NodeParameter>
<RemoteRunCommand>raven_ec_qsub_command.sh</RemoteRunCommand>
<parallelMethod>dask</parallelMethod>
<globalSeed>5489</globalSeed>
</RunInfo>

<Steps>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/RavenRunsRaven/code_ray.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<NodeParameter>--hostfile</NodeParameter>
<RemoteRunCommand>raven_ec_qsub_command.sh</RemoteRunCommand>
<parallelMethod>ray</parallelMethod>
<globalSeed>5489</globalSeed>
</RunInfo>

<Steps>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/RavenRunsRaven/rom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Sequence>FirstMRun</Sequence>
<batchSize>5</batchSize>
<expectedTime>0:10:0</expectedTime>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/test_mpiqsub_1_proc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<NumMPI>2</NumMPI>
<expectedTime>0:10:00</expectedTime>
<JobName>test_mpiqsu</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/test_mpiqsub_flex.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<NumMPI>2</NumMPI>
<expectedTime>0:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/test_mpiqsub_forced.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<coresneeded>2</coresneeded>
<runQSUB/>
</mode>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/test_mpiqsub_local.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<NumMPI>2</NumMPI>
<expectedTime>0:10:00</expectedTime>
<JobName>test_mpiqsu</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
5 changes: 3 additions & 2 deletions tests/cluster_tests/test_mpiqsub_long.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<Simulation verbosity='debug'>
<Simulation verbosity="debug">
<TestInfo>
<name>cluster_tests/test_mpiqsub</name>
<author>cogljj</author>
Expand All @@ -22,6 +22,7 @@
<NumMPI>1</NumMPI>
<expectedTime>0:10:00</expectedTime>
<JobName>test_mpilong</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down Expand Up @@ -92,7 +93,7 @@
</DataObjects>

<OutStreams>
<Print name='samples'>
<Print name="samples">
<type>csv</type>
<source>stories</source>
<what>input,output</what>
Expand Down
7 changes: 4 additions & 3 deletions tests/cluster_tests/test_mpiqsub_noprecommand.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<Simulation verbosity='debug'>
<Simulation verbosity="debug">
<TestInfo>
<name>cluster_tests/test_mpiqsub_noprecommand</name>
<author>cogljj</author>
Expand All @@ -25,7 +25,8 @@
<MPIParam>--bind-to none</MPIParam>
<noPrecommand/>
</mode>
</RunInfo>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
<Input name="simple_gp_test.i" type="">simple_gp_test.i</Input>
Expand Down Expand Up @@ -96,7 +97,7 @@
</DataObjects>

<OutStreams>
<Print name='samples'>
<Print name="samples">
<type>csv</type>
<source>stories</source>
<what>input,output</what>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/test_mpiqsub_nosplit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<NumMPI>2</NumMPI>
<expectedTime>0:10:00</expectedTime>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
1 change: 1 addition & 0 deletions tests/cluster_tests/test_pbs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<RemoteRunCommand>raven_qsub_command.sh</RemoteRunCommand>
<mode>pbsdsh</mode>
<JobName>test_qsub</JobName>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<WorkingDir>AcceleratedCFDTest1</WorkingDir>
<Sequence>testAcceleratedCFD,dumpResults</Sequence>
<batchSize>1</batchSize>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<WorkingDir>CobraTFinterfaceTest1</WorkingDir>
<Sequence>testDummyStep_MC</Sequence>
<batchSize>1</batchSize>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<WorkingDir>CobraTFinterfaceTest2</WorkingDir>
<Sequence>testDummyStep_Grid</Sequence>
<batchSize>1</batchSize>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<WorkingDir>CobraTFinterfaceTest3</WorkingDir>
<Sequence>testDummyStep_MC</Sequence>
<batchSize>1</batchSize>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<WorkingDir>CobraTFinterfaceTest4</WorkingDir>
<Sequence>testDummyStep_MC</Sequence>
<batchSize>1</batchSize>
<globalSeed>5489</globalSeed>
</RunInfo>

<Files>
Expand Down
Loading