Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 54 additions & 5 deletions .CI/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pipeline {
booleanParam(name: 'wasm_web', defaultValue: false, description: 'master branch, with --simCodeTarget=wasm-jit (ryzen-9950x), simulated the way the web omc does: the driver and the linear and nonlinear solvers in wasm, the in-wasm libm, and external "C" only from prebuilt wasm libraries. Fills wasm-web. This is an experimental job that does not run on a fixed schedule.')
booleanParam(name: 'wasm_fmu', defaultValue: false, description: 'master branch, with --simCodeTarget=wasm-jit (ryzen-9950x). Every model is exported once as an unzipped wasm FMU and simulated through both of its FMI 3.0 interfaces, filling wasm-jit-me (Model Exchange) and wasm-jit-cs (Co-Simulation). This is an experimental job that does not run on a fixed schedule.')
booleanParam(name: 'c_plus_rust', defaultValue: false, description: 'master branch, with --simCodeTarget=C+Rust, filling c-plus-rust (ryzen-9950x). The C code generator emits what it does for --simCodeTarget=C; the executable links libSimulationRuntimeRust instead of libSimulationRuntimeC, so the difference against master is the simulation runtime alone. This is an experimental job that does not run on a fixed schedule.')
booleanParam(name: 'omjulia', defaultValue: false, description: 'master branch, translated and simulated with OMBackend.jl, filling omjulia (ryzen-9950x). omc is built with -DOM_OMC_ENABLE_RUST=ON; its frontend runs inside Julia and OMBackend.jl reads the flat model through OMCompiler.jl. This is an experimental job that does not run on a fixed schedule.')
string(name: 'omjulia_ombackend', defaultValue: '', description: 'The branch, tag or commit of OMBackend.jl the omjulia job simulates with. Left empty, the commit JKRT/OM.jl pins as its submodule; the sibling packages (OMFrontend.jl, ...) are always the commits it pins.')
booleanParam(name: 'heavy_tests', defaultValue: false, description: 'master branch, runs one test at a time. That is, no parallel launching of tests. omc will use multiple threads for each test (-n=1 is not set unlike the other regression tests.), (r7945). This is an experimental job that does not run on a fixed schedule.')
booleanParam(name: 'heavy_tests_wasm', defaultValue: false, description: 'heavy_tests with --simCodeTarget=wasm-jit, filling heavy_tests_wasm (r7945). Its results are in the heavy_tests report. This is an experimental job that does not run on a fixed schedule.')

Expand Down Expand Up @@ -379,6 +381,28 @@ pipeline {
runRegressiontest('master', 'c-plus-rust', 'setCommandLineOptions("--simCodeTarget=C+Rust")', '', false, '', '', false, false)
}
}
stage('omjulia') {
agent {
node {
label 'ryzen-9950x'
customWorkspace 'ws/OpenModelicaLibraryTestingWork'
}
}
options { skipDefaultCheckout() }
when {
beforeAgent true
expression { params.omjulia }
}
steps {
script {
if (omjuliaOMBackend().contains("'")) {
error "omjulia_ombackend cannot contain a single quote; got '${omjuliaOMBackend()}'"
}
}
runRegressiontest('master', 'omjulia', '', '', false, '', '', false, false, 0, 'configs/conf.json',
wasmCmakeFlags(), '.CI/testing', null, null, omjuliaOMBackend())
}
}
stage('generateSymbolicJacobian') {
agent {
node {
Expand Down Expand Up @@ -506,7 +530,7 @@ pipeline {
}
when {
beforeAgent true
expression { params.v1_25 || params.v1_26 || params.v1_27 || params.master || params.conversion_script || params.report_ryzen_5950x_1 || params.report_ryzen_5950x_2 || params.newInst_newBackend || params.generateSymbolicJacobian || params.dataReconciliation || params.heavy_tests || params.heavy_tests_wasm || params.fmi_v1_25 || params.fmi_v1_26 || params.fmi_v1_27 || params.fmi_master || params.newInst_daeMode || params.newBackend_daeMode || params.oldInst || params.cpp || params.solvers || params.wasm_jit || params.wasm_fmu || params.wasm_web || params.c_plus_rust}
expression { params.v1_25 || params.v1_26 || params.v1_27 || params.master || params.conversion_script || params.report_ryzen_5950x_1 || params.report_ryzen_5950x_2 || params.newInst_newBackend || params.generateSymbolicJacobian || params.dataReconciliation || params.heavy_tests || params.heavy_tests_wasm || params.fmi_v1_25 || params.fmi_v1_26 || params.fmi_v1_27 || params.fmi_master || params.newInst_daeMode || params.newBackend_daeMode || params.oldInst || params.cpp || params.solvers || params.wasm_jit || params.wasm_fmu || params.wasm_web || params.c_plus_rust || params.omjulia}
}
environment {
GITBRANCHES = 'maintenance/v1.20 maintenance/v1.21 maintenance/v1.22 maintenance/v1.23 maintenance/v1.24 maintenance/v1.25 maintenance/v1.26 maintenance/v1.27 master newInst-newBackend'
Expand All @@ -517,6 +541,7 @@ pipeline {
GITBRANCHES_CPP = 'v1.19-cpp v1.20-cpp v1.21-cpp v1.22-cpp v1.23-cpp v1.24-cpp v1.25-cpp cpp v1.26-cpp v1.27-cpp'
GITBRANCHES_WASM_JIT = 'wasm-jit-me wasm-jit-cs wasm-jit wasm-web'
GITBRANCHES_C_PLUS_RUST = 'c-plus-rust'
GITBRANCHES_OMJULIA = 'omjulia'
GITBRANCHES_SPECIAL = 'master newInst-newBackend'
PYTHONIOENCODING = 'utf-8'
IDA_EMAIL = credentials('IDA email')
Expand All @@ -539,8 +564,8 @@ pipeline {

// The shell takes extraEmails from the environment, so its value is never
// part of the command.
sh "./all-reports.py --email --extra-emails=\"\$extraEmails\" --omcgitdir=OpenModelica ${env.GITBRANCHES} ${env.GITBRANCHES_FMI} ${env.GITBRANCHES_NEWINST} ${env.GITBRANCHES_DAE} ${env.GITBRANCHES_NEWBACKEND_DAE} ${env.GITBRANCHES_CPP} ${env.GITBRANCHES_WASM_JIT} ${env.GITBRANCHES_C_PLUS_RUST} conversion heavy_tests heavy_tests_wasm generateSymbolicJacobian dataReconciliation gbode cvode ida"
sh "./all-plots.py ${env.GITBRANCHES} ${env.GITBRANCHES_FMI} ${env.GITBRANCHES_NEWINST} ${env.GITBRANCHES_DAE} ${env.GITBRANCHES_NEWBACKEND_DAE} ${env.GITBRANCHES_CPP} ${env.GITBRANCHES_WASM_JIT} ${env.GITBRANCHES_C_PLUS_RUST} conversion heavy_tests heavy_tests_wasm generateSymbolicJacobian dataReconciliation gbode cvode ida"
sh "./all-reports.py --email --extra-emails=\"\$extraEmails\" --omcgitdir=OpenModelica ${env.GITBRANCHES} ${env.GITBRANCHES_FMI} ${env.GITBRANCHES_NEWINST} ${env.GITBRANCHES_DAE} ${env.GITBRANCHES_NEWBACKEND_DAE} ${env.GITBRANCHES_CPP} ${env.GITBRANCHES_WASM_JIT} ${env.GITBRANCHES_C_PLUS_RUST} ${env.GITBRANCHES_OMJULIA} conversion heavy_tests heavy_tests_wasm generateSymbolicJacobian dataReconciliation gbode cvode ida"
sh "./all-plots.py ${env.GITBRANCHES} ${env.GITBRANCHES_FMI} ${env.GITBRANCHES_NEWINST} ${env.GITBRANCHES_DAE} ${env.GITBRANCHES_NEWBACKEND_DAE} ${env.GITBRANCHES_CPP} ${env.GITBRANCHES_WASM_JIT} ${env.GITBRANCHES_C_PLUS_RUST} ${env.GITBRANCHES_OMJULIA} conversion heavy_tests heavy_tests_wasm generateSymbolicJacobian dataReconciliation gbode cvode ida"

// Recorded and announced only once they are up: a report the database
// knows about is never generated again, so one that a later failure in
Expand Down Expand Up @@ -612,6 +637,9 @@ pipeline {
sh "./report.py --branches='master ${env.GITBRANCHES_WASM_JIT}' configs/conf.json"
sh "mv overview.html overview-wasm-jit.html"

sh "./report.py --branches='master ${env.GITBRANCHES_OMJULIA}' configs/conf.json"
sh "mv overview.html overview-omjulia.html"

sh "./report.py --branches='${env.GITBRANCHES_CPP}' configs/conf.json"
sh "mv overview.html overview-c++.html"

Expand Down Expand Up @@ -706,6 +734,10 @@ def pullRequest() {
return (params.pull_request ?: '').trim()
}

def omjuliaOMBackend() {
return (params.omjulia_ombackend ?: '').trim()
}

def pullRequestTarget() {
return params.pull_request_target ?: 'wasm-jit'
}
Expand Down Expand Up @@ -881,6 +913,9 @@ def buildsWithCMake(branch) {
* `.CI/testing`, the image every job runs in: the omc build, the OMSimulator
* build and test.py happen inside it, and only the steps using the node's own
* omc stay outside. Passing `''` runs the job on the node itself.
* @param omjuliaRef: Translate and simulate with OMBackend.jl instead of omc's backend: the
* OMBackend.jl ref, '' for the one OM.jl pins; null for omc's backend. omc
* has to be the Rust port (cmakeFlags).
*/
/* The FMI simulators of an FMI job, which builds every FMU once and simulates it with all of them,
* filling <branch>-fmi, <branch>-fmi-cs-cvode, <branch>-fmi-cs-euler and <branch>-fmi-fmpy.
Expand All @@ -906,7 +941,7 @@ def wasmWebEnv() {
'OMC_WASM_NATIVE_EXTERNALS=0']
}

def runRegressiontest(branch, name, extraFlags, omsHash, omcompiler, extrasimflags, testFlags, boolean removePackageOrder, boolean conversionScript, int jobs=0, libs_config_file = 'configs/conf.json', cmakeFlags = '', dockerfile = '.CI/testing', fmiSimulators = null, solvers = null) {
def runRegressiontest(branch, name, extraFlags, omsHash, omcompiler, extrasimflags, testFlags, boolean removePackageOrder, boolean conversionScript, int jobs=0, libs_config_file = 'configs/conf.json', cmakeFlags = '', dockerfile = '.CI/testing', fmiSimulators = null, solvers = null, omjuliaRef = null) {
sh '''
find /tmp -name "*openmodelica.hudson*" -exec rm {} ";" || true

Expand Down Expand Up @@ -958,7 +993,8 @@ def runRegressiontest(branch, name, extraFlags, omsHash, omcompiler, extrasimfla
def dockerEnv = ['PATH+VENV=/opt/libtest-venv/bin',
'PATH+CARGO=/opt/rust/cargo/bin',
'CARGO_HOME=/opt/rust/cargo',
'RUSTUP_HOME=/opt/rust/rustup']
'RUSTUP_HOME=/opt/rust/rustup',
'PATH+JULIA=/opt/julia/bin']
// Runs a script in the image if the target uses one, on the node otherwise.
def runSh = { args ->
if (image) {
Expand Down Expand Up @@ -1244,6 +1280,19 @@ def runRegressiontest(branch, name, extraFlags, omsHash, omcompiler, extrasimfla

sh "test -d '${libraryPath}/.openmodelica/libraries/Modelica trunk'"

if (omjuliaRef != null) {
// Kept between runs like the omc build: precompiling OMBackend.jl and its dependencies, and
// the sysimage compiled from MSL examples, take much longer than updating them. OMCompiler.jl
// comes from the checkout omc was built from.
def omjuliaDir = "${env.HOME}/saved_omc/omjulia-env"
runSh("""
JULIA_DEPOT_PATH='${omjuliaDir}/depot:' julia OpenModelicaLibraryTesting/omjulia/setup.jl ${omjuliaRef ? "--ombackend='${omjuliaRef}'" : ''} \
--omhome="${WORKSPACE}/OpenModelica/${OMCPATH}/build" --libraries='${libraryPath}/.openmodelica/libraries' \
'${omjuliaDir}' "${WORKSPACE}/OpenModelica/OMCompiler/Compiler/OpenModelica.rs/OMCompiler.jl"
""")
testFlags += " --omjulia='${omjuliaDir}'"
}

sh 'date'

// The password of the results database comes from a secret file, bound here
Expand Down
15 changes: 14 additions & 1 deletion .CI/testing/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -qy software-properties-common \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& apt-get install -qy --no-install-recommends openssh-client psmisc rsync time \
&& apt-get install -qy --no-install-recommends curl openssh-client psmisc rsync time \
&& apt-get install -qy --no-install-recommends libcomedi-dev libx11-dev libnetcdf-dev mosquitto \
&& apt-get install -qy --no-install-recommends autoconf automake libtool omniidl libomniorb4-dev \
&& apt-get install -qy --no-install-recommends libboost-dev libboost-chrono-dev libboost-filesystem-dev \
Expand All @@ -37,6 +37,19 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Julia for the omjulia job, which simulates with OMBackend.jl. Its packages are not in the image:
# omjulia/setup.jl puts them in a depot under ~/saved_omc, next to the omc they are built against.
ARG JULIA_VERSION=1.13.3
ARG JULIA_SHA256=5c61cb4b40332cb5a3504e7779e2f5dac093caa4a1116ded19f01413f85c63e4
RUN curl -fsSL -o /tmp/julia.tar.gz \
"https://julialang-s3.julialang.org/bin/linux/x64/${JULIA_VERSION%.*}/julia-${JULIA_VERSION}-linux-x86_64.tar.gz" \
&& echo "${JULIA_SHA256} /tmp/julia.tar.gz" | sha256sum -c - \
&& mkdir -p /opt/julia \
&& tar -xzf /tmp/julia.tar.gz -C /opt/julia --strip-components=1 \
&& rm /tmp/julia.tar.gz \
&& /opt/julia/bin/julia --version
ENV PATH=/opt/julia/bin:$PATH

# On PATH rather than named explicitly: test.py starts testmodel.py through its
# `#!/usr/bin/env python3` shebang.
COPY requirements.txt /tmp/requirements.txt
Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,45 @@ master differs in the simulation runtime and nothing else.

The Jenkins job lists it as a column of the default overview.html.

### OMBackend.jl

`--omjulia` translates and simulates every model with
[OMBackend.jl](https://github.com/OpenModelica/OMBackend.jl) instead of omc's
backend. omc's frontend still instantiates the model: OMBackend.jl reads the
flat model through OMCompiler.jl, which loads `libOpenModelicaCompiler` into
Julia. That library is only built by the Rust port of omc, so the omc that
`test.py` runs (`OPENMODELICAHOME`) must be built with `-DOM_OMC_ENABLE_RUST=ON`.

[omjulia/setup.jl](omjulia/setup.jl) prepares a directory with the OMJL
packages, a Julia environment and a depot; it needs Julia 1.13 and the
OMCompiler.jl of the OpenModelica checkout omc was built from. The packages are
the commits [OM.jl](https://github.com/JKRT/OM.jl) pins as submodules, which
are known to work together; `--ombackend` takes another OMBackend.jl branch,
tag or commit. With `--omhome`
and `--libraries` (a directory holding Modelica 4.1.0) it also compiles a
sysimage from the MSL examples of [omjulia/workload.jl](omjulia/workload.jl),
which `test.py` then starts Julia with: without it, every model spends about a
minute loading OMBackend.jl and compiling its code.

```bash
JULIA_DEPOT_PATH=$HOME/omjulia/depot: julia omjulia/setup.jl \
--omhome=$OPENMODELICAHOME --libraries=$HOME/.openmodelica/libraries \
$HOME/omjulia /path/to/OpenModelica/OMCompiler/Compiler/OpenModelica.rs/OMCompiler.jl
./test.py --branch=omjulia --omjulia=$HOME/omjulia configs/myConf.json
./report.py --branches="master omjulia"
```

Every model runs in a Julia process of its own,
[omjulia/simulate.jl](omjulia/simulate.jl), which loads the files again,
instantiates, lowers, translates and simulates the model, and writes the
variables of the reference to a CSV result file. The report columns are the
phases of that process: frontend is omc's instantiation, backend the lowering
to OMJLIR and its passes, simcode OMBackend.jl's translation including the
generated code, and the simulation includes Julia compiling that code. Loading
Julia and OMBackend.jl is in no column; the `.sim` file has it. The version of
OMBackend.jl is part of the library version, so a new commit tests the
libraries again.

### One build, several solvers

Which solver integrates a model is a simulation flag, so testing another one
Expand Down
Loading
Loading