Skip to content

Commit 2972c27

Browse files
author
Francesco Rizzi
authored
Merge pull request #49 from Pressio/version0140
update
2 parents 72da1ec + dcc6a13 commit 2972c27

File tree

2,213 files changed

+1030838
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,213 files changed

+1030838
-256
lines changed

.github/workflows/test-all.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ jobs:
4141
BUILD_DIR: /home/runner/work/build/pressio-tutorials
4242

4343
steps:
44-
- uses: actions/checkout@v2 # check out the repository with submodules
45-
with: { submodules: recursive }
44+
- uses: actions/checkout@v2
4645

4746
- name: Install packages
4847
run: |

.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,55 @@
22
cmake_minimum_required(VERSION 3.18.0)
33
project(pressio-tutorials CXX)
44

5+
function(get_version_number PATH_TO_FILE OUT)
6+
file(READ ${PATH_TO_FILE} tmpver)
7+
8+
string(FIND ${OUT} MAJOR wantMajor)
9+
string(FIND ${OUT} MINOR wantMinor)
10+
string(FIND ${OUT} PATCH wantPatch)
11+
if (wantMajor GREATER -1)
12+
string(REGEX MATCH "VERSION_MAJOR ([0-9]*)" _ ${tmpver})
13+
endif()
14+
if (wantMinor GREATER -1)
15+
string(REGEX MATCH "VERSION_MINOR ([0-9]*)" _ ${tmpver})
16+
endif()
17+
if (wantPatch GREATER -1)
18+
string(REGEX MATCH "VERSION_PATCH ([0-9]*)" _ ${tmpver})
19+
endif()
20+
set(${OUT} ${CMAKE_MATCH_1} PARENT_SCOPE)
21+
endfunction()
22+
23+
24+
#===================================================
25+
# versioning info
26+
#===================================================
27+
28+
get_version_number("version.txt" PressioTutorials_VERSION_MAJOR)
29+
get_version_number("version.txt" PressioTutorials_VERSION_MINOR)
30+
get_version_number("version.txt" PressioTutorials_VERSION_PATCH)
31+
set(PressioTutorials_VERSION "${PressioTutorials_VERSION_MAJOR}.${PressioTutorials_VERSION_MINOR}.${PressioTutorials_VERSION_PATCH}")
32+
message("pressio-tutorials version = ${PressioTutorials_VERSION}")
33+
34+
set(pressio_version ${CMAKE_CURRENT_SOURCE_DIR}/tpls/pressio/version.txt)
35+
get_version_number(${pressio_version} MyPressio_VERSION_MAJOR)
36+
get_version_number(${pressio_version} MyPressio_VERSION_MINOR)
37+
get_version_number(${pressio_version} MyPressio_VERSION_PATCH)
38+
message("pressio version = ${MyPressio_VERSION_MAJOR}.${MyPressio_VERSION_MINOR}.${MyPressio_VERSION_PATCH}")
39+
540
#===================================================
641
# c++ standard
742
#===================================================
843
# commands to test if compiler supports standard
944
include(CheckCXXCompilerFlag)
10-
check_cxx_compiler_flag("-std=c++14" COMPILER_SUPPORT_CPP14)
11-
if(NOT COMPILER_SUPPORT_CPP14)
12-
message(FATAL_ERROR "Compiler does not support -std=c++14. This is required.")
45+
check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORT_CPP17)
46+
if(NOT COMPILER_SUPPORT_CPP17)
47+
message(FATAL_ERROR "Compiler does not support -std=c++17. This is required.")
1348
endif()
14-
set(CMAKE_CXX_STANDARD 14)
49+
set(CMAKE_CXX_STANDARD 17)
1550
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1651
set(CMAKE_CXX_EXTENSIONS OFF)
1752

1853
enable_testing()
19-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/end-to-end-roms)
20-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ode-using-eigen-types)
2154
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/nonlinearsolvers-using-eigen-types)
55+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ode-using-eigen-types)
56+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/end-to-end-roms)

docs/source/build.rst

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,40 @@ What you need
99

1010
- **CMake > 3.18.0**
1111

12-
- **C++14 compiler**: `our CI <https://github.com/Pressio/pressio-tutorials/blob/develop/.github/workflows/test-all.yml>`__ is currently testing both GCC and Clang
12+
- **C++17 compiler**: GCC or Clang are tested in our CI
1313

14-
- Python 3.x with specific packages listed `here <../../py_requirements.txt>`__
14+
- Python 3.x
1515

1616
Steps
1717
-----
1818

1919
.. code-block:: bash
2020
21-
git clone --recursive [email protected]:Pressio/pressio-tutorials.git
21+
git clone [email protected]:Pressio/pressio-tutorials.git
2222
2323
export CXX=<fullpath-to-your-CXX-compiler>
2424
export BUILDDIR=$HOME/tutorialBuild
2525
mkdir $BUILDDIR
26-
cmake -DCMAKE_BUILD_TYPE=Release -S <path-to-your-cloned-repo> -B $BUILDDIR
26+
cmake -DPRESSIOTUTORIALS_ENABLE_TESTS=ON \
27+
-DCMAKE_BUILD_TYPE=Release -S <path-to-your-cloned-repo> -B $BUILDDIR
2728
cd $BUILDDIR && make -j4
2829
29-
# if needed, the Python packages can be installed as
30+
# ensure you have all required Python packages installed
3031
pip3 install <path-to-your-cloned-repo>/py_requirements.txt
3132
3233
33-
Then what?
34-
----------
35-
36-
Individual executables and the end-to-end demos can be found inside the build directory.
34+
Verify the build
35+
----------------
3736

38-
.. tip::
37+
.. code-block:: cpp
3938
40-
If you want to verify the build, you can enable tests via ``-DPRESSIOTUTORIALS_ENABLE_TESTS=ON``,
41-
and then do:
39+
cd $BUIlDDIR
40+
ctest
4241
43-
.. code-block:: cpp
42+
Then what?
43+
----------
4444

45-
cd $BUIlDDIR
46-
ctest
45+
Individual executables and the end-to-end demos can be found inside the build directory.
4746

4847

4948
More details on dependencies

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
project = "pressio-tutorials"
4646
copyright = u"2021, National Technology & Engineering Solutions of Sandia, LLC (NTESS)"
4747

48-
version = "0.13.0"
48+
version = "0.14.0"
4949

5050
# The full version, including alpha/beta/rc tags.
5151
release = version

docs/source/endtoend/readthisfirst.rst

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
Start reading here
22
==================
33

4-
This section offers a suite of end-to-end tutorials/demos covering
5-
some of the key ROM methods implemented in pressio.
6-
7-
Why doing this?
8-
---------------
9-
104
Describing how to use pressio for ROMs cannot be simply
115
boiled down to presenting the API, because setting up, running
126
and processing a ROM involves several steps.
@@ -20,17 +14,13 @@ automating (to some extent) the execution.
2014
Key features
2115
------------
2216

23-
- each demo is fully documented in a step by step manner (see `here for example <swe_galerkin_default.html>`__) to show how to run each step
24-
25-
- each demo has an associated yaml workflow file,
26-
organized into several section each with a specific scope
17+
- each demo is documented in a step-by-step manner (see `example <swe_galerkin_default.html>`__)
2718

28-
- all `driver scripts <https://github.com/Pressio/pressio-tutorials/tree/develop/end-to-end-roms>`__
29-
are written in Python and are designed to be easy to run
19+
- each demo is defined via a yaml workflow file (`example <swe_galerkin_default.html#workflow-file>`__),
20+
which is used by the `driver scripts <https://github.com/Pressio/pressio-tutorials/tree/develop/end-to-end-roms>`__ we provide to execute that demo
3021

31-
- one can easily extend the framework by adding new ROM methods
32-
in pressio or account for variations
33-
in how each step is run
22+
- one can easily extend the framework by adding new ROM methods in pressio or account
23+
for variations in how each step is run
3424

3525
- pressio-demoapps: for the end-to-end demos we rely on pressio-demoapps,
3626
which have built-in support for the sample mesh.

docs/source/endtoend/swe_galerkin_default.rst

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,29 @@
33
2D SWE: default Galerkin
44
========================
55

6-
- ROM technique: default Galerkin
6+
- ROM technique: default Galerkin
77

8-
- problem: `2D shallow water equations (SWE) <https://pressio.github.io/pressio-demoapps/swe_2d.html>`_
8+
- problem: `2D shallow water equations (SWE) <https://pressio.github.io/pressio-demoapps/swe_2d.html>`_
99

1010

1111
Prerequisites
1212
-------------
1313

14-
- A valid build of the tutorials, see `here <../build.html>`__, and the following env variables set:
14+
- A valid build of the tutorials, see `here <../build.html>`__
15+
16+
- The following env variables MUST be set:
1517

1618
.. code-block:: bash
1719
1820
export REPOSRC=<full-path-to-the-pressio-tutorials-source-repo>/end-to-end-roms
1921
export BUILDDIR=<full-path-to-where-you-built-the-tutorials>
2022
21-
- To run all scripts below, you MUST be in the correct end-to-end directory:
23+
.. admonition:: To run the demo scripts below, you MUST be inside the correct directory:
24+
:class: important
2225

23-
.. code-block:: bash
26+
.. code-block:: bash
2427
25-
cd $BUILDDIR/end-to-end-roms/2d_swe_galerkin_default
28+
cd $BUILDDIR/end-to-end-roms/2d_swe_galerkin_default
2629
2730
2831
Workflow File
@@ -35,7 +38,7 @@ copied to the build directory, so you don't need to do anything:
3538
.. literalinclude:: ../../../end-to-end-roms/2d_swe_galerkin_default/wf.yaml
3639
:language: yaml
3740
:lines: 1-35
38-
41+
:linenos:
3942

4043
Step 1: execute FOMs
4144
--------------------
@@ -48,12 +51,15 @@ Step 1: execute FOMs
4851
This driver script automates this first stage by creating input files,
4952
generating run directories and running the C++ executable
5053
to generate all the FOM train and test data at the points specified
51-
in the yaml file. For exposition purposes, we show below the actual
52-
C++ code executed during this stage to run a single FOM:
54+
in the yaml file.
5355

54-
.. literalinclude:: ../../../end-to-end-roms/cpp/run_fom_explicit.hpp
55-
:language: cpp
56-
:lines: 56-76
56+
..
57+
For exposition purposes, we show below the actual
58+
C++ code executed during this stage to run a single FOM:
59+
60+
.. literalinclude:: ../../../end-to-end-roms/cpp/run_fom_explicit.hpp
61+
:language: cpp
62+
:lines: 56-76
5763

5864
At the end, doing ``tree -L 1 .`` should produce:
5965

@@ -107,12 +113,14 @@ Step 3: galerkin rom
107113
This driver script automates all the Galerkin runs.
108114
Specifically, it creates all the run directories, writes all input files,
109115
prepares initial conditions and runs the actual Galerkin run at every test point.
110-
For exposition purposes, we show below the actual
111-
C++ code executed during this stage to run a single Galerkin run:
112116

113-
.. literalinclude:: ../../../end-to-end-roms/cpp/run_default_galerkin.hpp
114-
:language: cpp
115-
:lines: 57-79, 82-87, 92
117+
..
118+
For exposition purposes, we show below the actual
119+
C++ code executed during this stage to run a single Galerkin run:
120+
121+
.. literalinclude:: ../../../end-to-end-roms/cpp/run_default_galerkin.hpp
122+
:language: cpp
123+
:lines: 57-79, 82-87, 92
116124

117125
More specifically, what happens here is the following:
118126

docs/source/endtoend/swe_galerkin_hypred_1.rst

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,29 @@
33
2D SWE: hyper-reduced Galerkin (example 1)
44
==========================================
55

6-
- ROM technique: Hyper-reduced Galerkin with gappy POD
6+
- ROM technique: Hyper-reduced Galerkin with gappy POD
77

8-
- problem: `2D shallow water equations (SWE) <https://pressio.github.io/pressio-demoapps/swe_2d.html>`_
8+
- problem: `2D shallow water equations (SWE) <https://pressio.github.io/pressio-demoapps/swe_2d.html>`_
99

1010

1111
Prerequisites
1212
-------------
1313

14-
- A valid build of the tutorials, see `here <../build.html>`__, and the following env variables set:
14+
- A valid build of the tutorials, see `here <../build.html>`__
15+
16+
- The following env variables MUST be set:
1517

1618
.. code-block:: bash
1719
1820
export REPOSRC=<full-path-to-the-pressio-tutorials-source-repo>/end-to-end-roms
1921
export BUILDDIR=<full-path-to-where-you-built-the-tutorials>
2022
21-
- To run all scripts below, you MUST be in the correct end-to-end directory:
23+
.. admonition:: To run the demo scripts below, you MUST be inside the correct directory:
24+
:class: important
2225

23-
.. code-block:: bash
26+
.. code-block:: bash
2427
25-
cd $BUILDDIR/end-to-end-roms/2d_swe_galerkin_hypred_1
28+
cd $BUILDDIR/end-to-end-roms/2d_swe_galerkin_hypred_1
2629
2730
2831
Workflow File
@@ -100,11 +103,12 @@ Step 3: galerkin rom
100103
101104
python3 $REPOSRC/wf_galerkin.py --wf wf.yaml
102105
103-
Running the Galerkin driver means the following C++ code is being executed:
106+
..
107+
Running the Galerkin driver means the following C++ code is being executed:
104108
105-
.. literalinclude:: ../../../end-to-end-roms/cpp/run_hyperreduced_galerkin.hpp
106-
:language: cpp
107-
:lines: 57-109, 112-121, 126
109+
.. literalinclude:: ../../../end-to-end-roms/cpp/run_hyperreduced_galerkin.hpp
110+
:language: cpp
111+
:lines: 57-109, 112-121, 126
108112

109113
At the end, you should have the following directory structure:
110114

0 commit comments

Comments
 (0)