equinor / xtgeo

XTGeo Python class library for subsurface Surfaces, Cubes, Wells, Grids, Points, etc
https://xtgeo.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
110 stars 56 forks source link

Add pybind11 and convert bulkvol to it #1110

Closed mferrera closed 8 months ago

mferrera commented 8 months ago

This PR is just to show what iteratively moving from SWIG C to pybind11 C++ could look like. For completeness, benchmarks (they perform approximately the same). Some stuff in CMakeLists could probably be improved.

pybind11 C++:

tests/test_grid3d/test_grid.py::test_benchmark_bulkvol PASSED                                                                                                                                                                                [100%]

------------------------------------------------- benchmark 'bulkvol': 1 tests ------------------------------------------------
Name (time in us)               Min       Max      Mean   StdDev    Median      IQR  Outliers  OPS (Kops/s)  Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------
test_benchmark_bulkvol     677.3341  886.7092  715.4420  28.0855  705.0000  30.4795    177;40        1.3977     772           1
-------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

SWIG C

tests/test_grid3d/test_grid.py::test_benchmark_bulkvol PASSED                                                                                                                                                                                [100%]

------------------------------------------------- benchmark 'bulkvol': 1 tests ------------------------------------------------
Name (time in us)               Min       Max      Mean   StdDev    Median      IQR  Outliers  OPS (Kops/s)  Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------
test_benchmark_bulkvol     680.9579  989.2499  738.4240  50.0718  720.6250  52.3020    132;60        1.3542     797           1
-------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean
codecov-commenter commented 8 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (0e1ffd4) 80.16% compared to head (4126509) 80.16%.

Files Patch % Lines
src/xtgeo/grid3d/_grid_etc1.py 50.00% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1110 +/- ## ======================================= Coverage 80.16% 80.16% ======================================= Files 96 96 Lines 13533 13534 +1 Branches 2195 2195 ======================================= + Hits 10849 10850 +1 Misses 1952 1952 Partials 732 732 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.