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

Move create runpath and sample parameter logic from C to Python #3467

Merged
merged 5 commits into from
Jun 8, 2022

Conversation

oyvindeide
Copy link
Collaborator

@oyvindeide oyvindeide commented Jun 1, 2022

Issue
Resolves #3389

Approach
Short description of the approach

Pre review checklist

  • Added appropriate release note label
  • PR title captures the intent of the changes, and is fitting for release notes.
  • Commit history is consistent and clean, in line with the contribution guidelines.

Adding labels helps the maintainers when writing release notes. This is the list of release note labels.

@codecov-commenter
Copy link

codecov-commenter commented Jun 2, 2022

Codecov Report

Merging #3467 (f0e870f) into main (919cfd9) will decrease coverage by 0.90%.
The diff coverage is 43.58%.

❗ Current head f0e870f differs from pull request most recent head 3a9af13. Consider uploading reports for the commit 3a9af13 to get more accurate results

@@            Coverage Diff             @@
##             main    #3467      +/-   ##
==========================================
- Coverage   65.40%   64.50%   -0.91%     
==========================================
  Files         601      601              
  Lines       47788    47727      -61     
  Branches     4215     4213       -2     
==========================================
- Hits        31257    30786     -471     
- Misses      15170    15628     +458     
+ Partials     1361     1313      -48     
Impacted Files Coverage Δ
libres/lib/enkf/enkf_main_manage_fs.cpp 61.45% <ø> (-1.42%) ⬇️
libres/lib/enkf/ensemble_config.cpp 47.05% <0.00%> (-6.44%) ⬇️
libres/lib/python/enkf_fs_manager.cpp 10.00% <ø> (+4.73%) ⬆️
libres/lib/enkf/enkf_state.cpp 29.81% <10.00%> (-23.04%) ⬇️
libres/lib/enkf/enkf_main.cpp 38.58% <12.50%> (-2.93%) ⬇️
res/enkf/enkf_fs_manager.py 91.89% <100.00%> (+0.16%) ⬆️
res/enkf/enkf_main.py 86.91% <100.00%> (+0.31%) ⬆️
res/enkf/enkf_simulation_runner.py 94.91% <100.00%> (+0.08%) ⬆️
res/enkf/ert_run_context.py 97.72% <100.00%> (+2.17%) ⬆️
libres/lib/enkf/enkf_plot_gen_kw.cpp 24.35% <0.00%> (-55.65%) ⬇️
... and 20 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@oyvindeide oyvindeide force-pushed the move_logic branch 3 times, most recently from 394ba9d to 99a67e7 Compare June 7, 2022 09:26
@oyvindeide oyvindeide marked this pull request as ready for review June 7, 2022 09:52
@oyvindeide oyvindeide force-pushed the move_logic branch 4 times, most recently from 9e5506c to f0e870f Compare June 7, 2022 10:08
This moves more logic into python and since C no longer has
responsibility to sample parameters a few tests are moved into
python as well.
@oyvindeide oyvindeide changed the title Move logic Move create runpath and sample parameter logic from C to Python Jun 7, 2022
@oyvindeide oyvindeide added the release-notes:maintenance Automatically categorise as maintenance change in release notes label Jun 7, 2022
Copy link
Contributor

@eivindjahren eivindjahren left a comment

Choose a reason for hiding this comment

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

Generally a good idea to move as much as possible into python. I had one small suggestion about adding some more tests in c, but other than that it looks good. Perhaps @pinkwah could have a quick look at the pybind magic to make sure its optimal :)


namespace fs = std::filesystem;

void create_runpath(enkf_main_type *enkf_main, int iter) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that these c tests in general are replaced with python tests because enkf_main_create_run_path and enkf_main_initialize_from_scratch no longer exists. The tests are a bit messy in terms of purpose and are in the "old" style so I think that is ok.

However, this is leaving libres/lib/enkf/gen_data.cpp, libres/lib/enkf/enkf_state.cpp and libres/lib/enkf/enkf_plot_gen_kw.cpp without tests in c. Perhaps some very basic isolated unit-tests in the new c style could be added to make up for the lost c tests? When it comes to memory-debugging etc. its often a lot easier to work with c tests for c code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are some tests for them (in the old style, for example: test_enkf_gen_data_config.cpp, test_enkf_gen_data_config_parse.cpp), adding some new ones is possible but not sure that the effort is worth it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you are right. Lets not dwell too much on tests for these cases.

@oyvindeide oyvindeide merged commit 511dca3 into equinor:main Jun 8, 2022
@oyvindeide oyvindeide deleted the move_logic branch June 8, 2022 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:maintenance Automatically categorise as maintenance change in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor the way parameters are sampled and the runpath is created
3 participants