Skip to content
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

ML keras #4172

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.cpp
opm/material/fluidsystems/blackoilpvt/WetGasPvt.cpp
opm/material/fluidsystems/blackoilpvt/WetHumidGasPvt.cpp
opm/ml/ml_model.cpp
)
if(ENABLE_ECL_INPUT)
list(APPEND MAIN_SOURCE_FILES
Expand Down Expand Up @@ -474,6 +475,7 @@ list (APPEND TEST_SOURCE_FILES
tests/material/test_spline.cpp
tests/material/test_tabulation.cpp
tests/test_Visitor.cpp
tests/ml/ml_model_test.cpp
)

# tests that need to be linked to dune-common
Expand Down Expand Up @@ -646,6 +648,15 @@ list (APPEND TEST_DATA_FILES
tests/material/co2_unittest_below_sat.json
tests/material/h2o_unittest.json
tests/material/h2_unittest.json
tests/ml/ml_tools/models/test_dense_1x1.model
tests/ml/ml_tools/models/test_dense_2x2.model
tests/ml/ml_tools/models/test_dense_10x1.model
tests/ml/ml_tools/models/test_dense_10x10.model
tests/ml/ml_tools/models/test_dense_10x10x10.model
tests/ml/ml_tools/models/test_dense_relu_10.model
tests/ml/ml_tools/models/test_dense_tanh_10.model
tests/ml/ml_tools/models/test_relu_10.model
tests/ml/ml_tools/models/test_scalingdense_10x1.model
)
if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_DATA_FILES
Expand Down Expand Up @@ -1054,6 +1065,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/thermal/SomertonThermalConductionLaw.hpp
opm/material/thermal/EclSpecrockLaw.hpp
opm/material/thermal/NullSolidEnergyLaw.hpp
opm/ml/ml_model.hpp
)

if(ENABLE_ECL_INPUT)
Expand Down
22 changes: 22 additions & 0 deletions opm/ml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
These ML modules are heavily modifiying and extending the previous work done in Kerasify by Maevskikh and Rose. Kerasify is a library for running trained Keras models from a C++ platform. Our implementation is also compliant with the automatic differentiation approach used in OPM. The implementation works with Python v.3.9.0 and above (up to <=3.12.0).


-Unit tests are generated by:

$ python3 generateunittests.py


-To compile run the unit tests:

$ make ml_model_test
$ ./bin/ml_model_test
TEST tensor_test
TEST dense_1x1
TEST dense_10x1
TEST dense_2x2
TEST dense_10x10
TEST dense_10x10x10
TEST relu_10
TEST dense_relu_10
TEST dense_tanh_10
TEST scalingdense_10x1
Loading