-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interface raven running raven #341
Merged
Merged
Changes from 23 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
8855ecc
first interface
alfoa 39ace9d
moving ahead
alfoa 682ab78
RAVENparser
alfoa 8486cf9
removed trailing spaces
alfoa 2b4ed9e
merge
alfoa b90ec87
finished parser
alfoa cd547ef
parser with addition and half interface ready
alfoa 27455a5
added test
alfoa 0dd1638
moving ahead
alfoa ae2fe4f
input changing finalized
alfoa ba4ac98
added initial support for external module
alfoa f655bf0
added support for external function + collect names of Outstreams
alfoa bf4eaf2
finalzed interface
alfoa 0337f85
Merge branch 'devel' of https://github.com/idaholab/raven into alfoa/…
alfoa d1ee2e9
finalized + doc
alfoa be71d8f
added test
alfoa 08fb72f
addedDefaultExt
alfoa 57e4a81
removed absolute path
alfoa 08a56dc
addressed Josh's and Paul's comments so far
alfoa 63435da
Merge branch 'alfoa/ravenRunningRaven' of https://github.com/idaholab…
alfoa 71d2e9a
modified read mode
alfoa 56276a0
addressed Paul comments
alfoa 56c6c32
fixed noscalar
alfoa 5bffbb5
fixed attribute stuff
alfoa 53c135a
removed absolute path
alfoa 9d54e33
addressed Aaron's comment
alfoa 376fcda
put error message for Variable Groups
alfoa c075eb8
typo
alfoa 7693759
o
alfoa 0e767f7
fixed nodefile node in case of MPI
alfoa b446c44
ok
alfoa 00e9421
hope to be done
alfoa 9743df1
fix
alfoa 41c804c
finalizeCodeOut
alfoa 71f6c84
fixed typo
alfoa 7767ea3
removed unuseful runInfo that I added in previous commit
alfoa 107de73
removed if statement
alfoa 84b1138
debug printing for a sec (windwos )
aalfonsi 815910e
parser local env to conver everythin as string
aalfonsi e7aa9cf
cast localenv to string for windwos
aalfonsi 2395efd
removed trailing spaces
aalfonsi 88a968a
merged
aalfonsi 1600321
Update Code.py
aalfonsi bc221d9
Check for /usr/bin/bash if /bin/bash not found in windows
joshua-cogliati-inl 96ee40b
fix failed runs
alfoa 3b919a5
Update Code.py
alfoa bf2e128
fixed faulty checkForOutputFailure
alfoa b0c595f
Don't use -q, because sometimes it causes conda to crash.
joshua-cogliati-inl 2c0f1a5
Fixed failed
alfoa 93fbcfd
Merge branch 'alfoa/ravenRunningRaven' of https://github.com/idaholab…
alfoa cfa6e32
added test to check the correct collection of failed runs from Ensemb…
alfoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,174 @@ \subsection{Generic Interface} | |
\item \texttt{|}, the value that is going to be replaced by the Generic Interface, will be left- justified with a string length of ``10''; | ||
\end{itemize} | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
%%%%%% RAVEN INTERFACE (RAVEN running RAVEN) %%%%%% | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\subsection{RAVEN Interface} | ||
\label{subsec:RAVENInterface} | ||
The RAVEN interface is meant to provide the possibility to execute a RAVEN input file | ||
driving a set of SLAVE RAVEN calculations. For example, if the user wants to optimize the parameters | ||
of a surrogate model (e.g. minimizing the distance between the surrogate predictions and the real data), he | ||
can achieve this task by setting up a RAVEN input file (master) that performs an optimization on the feature | ||
space characterized by the surrogate model parameters, whose training and validation assessment is performed in the SLAVE | ||
RAVEN runs. | ||
\\ There are some limitations for this interface: | ||
\begin{itemize} | ||
\item only one sub-level of RAVEN can be executed (i.e. if the SLAVE RAVEN input file contains the run of another RAVEN SLAVE, the MASTER RAVEN will error out) | ||
\item only data from Outstreams of type Print can be collected by the MASTER RAVEN | ||
\item only a maximum of two Outstreams can be collected (1 PointSet and 1 HistorySet) | ||
\end{itemize} | ||
|
||
|
||
Like for every other interface, most of the RAVEN workflow stays the same independently of which type of Model (i.e. Code) is used. | ||
\\ Similarly to any other code interface, the user provides paths to executables and aliases for sampled variables within the | ||
\xmlNode{Models} block. The \xmlNode{Code} block will contain attributes \xmlAttr{name} and | ||
\xmlAttr{subType}. \xmlAttr{name} identifies that particular \xmlNode{Code} model within RAVEN, and | ||
\xmlAttr{subType} specifies which code interface the model will use (In this case \xmlAttr{subType}=``RAVEN''). | ||
The \xmlNode{executable} | ||
block should contain the absolute or relative (with respect to the current working | ||
directory) path to the RAVEN framework script (\textbf{raven\_framework}). | ||
\\ In addition to the attributes and xml nodes reported above, the RAVEN accepts the following XML nodes (required and optional): | ||
\begin{itemize} | ||
\item \xmlNode{outputExportOutStreams}, \xmlDesc{comma separated list, | ||
required parameter} will specify the \xmlNode{OutStreams} that will be loaded as outputs of the SLAVE RAVEN. | ||
Maximum two \xmlNode{OutStreams} can be listed here (1 for PointSet and/or 1 for HistorySet). | ||
\item \xmlNode{conversionModule}, \xmlDesc{string, | ||
optional parameter} will specify the path to a \textit{Python} module that can contain two methods: | ||
\begin{itemize} | ||
\item \textbf{\textit{manipulateScalarSampledVariables}}, a method that is aimed to manipulate sampled variables and to create more in case needed. | ||
Example: | ||
\begin{lstlisting}[language=python] | ||
def manipulateScalarSampledVariables(sampledVariables): | ||
""" | ||
This method is aimed to manipulate scalar variables. | ||
The user can create new variables based on the | ||
variables sampled by RAVEN | ||
@ In, sampledVariables, dict, dictionary of | ||
sampled variables ({"var1":value1,"var2":value2}) | ||
@ Out, None, the new variables should be | ||
added in the "sampledVariables" dictionary | ||
""" | ||
newVariableValue = | ||
sampledVariables['Distributions|Uniform@name:a_dist|lowerBound'] | ||
+ 1.0 | ||
sampledVariables['Distributions|Uniform@name:a_dist|upperBound'] = | ||
newVariableValue | ||
return | ||
\end{lstlisting} | ||
|
||
\item \textbf{\textit{convertNotScalarSampledVariables}}, a method that is aimed to convert not scalar variables (e.g. 1D arrays) into multiple scalar variables | ||
(e.g. \xmlNode{constant}(s) in a sampling strategy). | ||
This method is going to be required in case not scalar variables are detected by the interface. | ||
Example: | ||
\begin{lstlisting}[language=python] | ||
def convertNotScalarSampledVariables(noScalarVariables): | ||
""" | ||
This method is aimed to convert not scalar | ||
variables into multiple scalar variables. The user MUST | ||
create new variables based on the not Scalar Variables | ||
sampled (and passed in) by RAVEN | ||
@ In, noScalarVariables, dict, dictionary of sampled | ||
variables that are not scalar ({"var1":1Darray1,"var2":1Darray2}) | ||
@ Out, newVars, dict, the new variables that have | ||
been created based on the not scalar variables | ||
contained in "noScalarVariables" dictionary | ||
""" | ||
oneDimensionalArray = | ||
sampledVariables['temperatureHistory'] | ||
newVars = {} | ||
for cnt, value in enumerate(oneDimensionalArray): | ||
newVars['Samplers|MonteCarlo@name:myMC|constant'+ | ||
'@name=temperatureHistory'+str(cnt)] = | ||
oneDimensionalArray[cnt] | ||
return newVars | ||
\end{lstlisting} | ||
\end{itemize} | ||
\end{itemize} | ||
|
||
Code input example: | ||
\begin{lstlisting}[style=XML] | ||
<Code name="RAVENrunningRAVEN" subType="RAVEN"> | ||
<executable>../../../raven_framework</executable> | ||
<outputExportOutStreams> | ||
HistorySetOutStream,PointSetOutStream | ||
</outputExportOutStreams> | ||
<conversionModule> | ||
~/Users/username/whateverConversionModule.py | ||
</conversionModule> | ||
</Code> | ||
\end{lstlisting} | ||
|
||
Like for every other interface, the syntax of the variable names is important to make the parser understand how to perturb an input file. | ||
\\ For the RAVEN interface, a syntax inspired by the XPath nomenclature is used. | ||
\begin{lstlisting}[style=XML] | ||
<Samplers> | ||
<MonteCarlo name="MC_external"> | ||
... | ||
<variable name="Models|ROM@subType:SciKitLearn@name:ROM1|C"> | ||
<distribution>C_distrib</distribution> | ||
</variable> | ||
<variable name="Models|ROM@subType:SciKitLearn@name:ROM1|tol"> | ||
<distribution>toll_distrib</distribution> | ||
</variable> | ||
<variable name="Samplers|Grid@name:'+ | ||
'GridName|variable@name:var1|grid@construction:equal@type:value@steps"> | ||
<distribution>categorical_step_distrib</distribution> | ||
</variable> | ||
... | ||
</MonteCarlo> | ||
</Samplers> | ||
\end{lstlisting} | ||
In the above example, it can be inferred that each XML node (subnode) needs to be separated by a ``|'' separator. In addition, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, in XPath, / is used as a separator. Since XPath is not being followed exactly, the full syntax supported should probably be documented. |
||
every time an XML node has attributes, the user can specify them using the ``@'' separator to specify a value for them. | ||
The first variable above will be pointing to the following XML sub-node ( \xmlNode{C}): | ||
\begin{lstlisting}[style=XML] | ||
<Models> | ||
<ROM name="ROM1" subType="SciKitLearn"> | ||
... | ||
<C>10.0</C> | ||
... | ||
</ROM> | ||
</Models> | ||
\end{lstlisting} | ||
The second variable above will be pointing to the following XML sub-node ( \xmlNode{tol}): | ||
\begin{lstlisting}[style=XML] | ||
<Models> | ||
<ROM name="ROM1" subType="SciKitLearn"> | ||
... | ||
<tol>0.0001</tol> | ||
... | ||
</ROM> | ||
</Models> | ||
\end{lstlisting} | ||
The third variable above will be pointing to the following XML attribute ( \xmlAttr{steps}): | ||
\begin{lstlisting}[style=XML] | ||
<Samplers> | ||
<Grid name="GridName"> | ||
... | ||
<variable name="var1"> | ||
... | ||
<grid construction="equal" type="value" steps="1">0 1</grid> | ||
... | ||
</variable> | ||
|
||
... | ||
</MonteCarlo> | ||
</Samplers> | ||
\end{lstlisting} | ||
|
||
The above nomenclature must be used for all the variables to be sampled and for the variables generated by the two methods contained, in case, in | ||
the module that gets specified by the \xmlNode{conversionModule} in the \xmlNode{Code} section. | ||
\\ Finally the SLAVE RAVEN input file (s) must be ``tagged'' with the attribute \xmlAttr{type="raven"} in the Files section. For example, | ||
|
||
\begin{lstlisting}[style=XML] | ||
<Files> | ||
<Input name="slaveRavenInputFile" type="raven" > | ||
test_rom_trainer.xml | ||
</Input> | ||
</Files> | ||
\end{lstlisting} | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
%%%%%% RELAP5 INTERFACE %%%%%% | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not sampledVariables be noScalarVariables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed