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

ENH: optimize speed for surface_from_grid method #1261

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

jcrivenaes
Copy link
Collaborator

@jcrivenaes jcrivenaes commented Oct 31, 2024

Closes #1262

Main elements

  • Refactor some C++ vectors with known length to be of type std::array instead of std::vector. In particular the function that receives the corner coordinates, which has fixed length 24. In a future change, we should consider structs in stead
  • Alllow top and base and indexes to be returned in the same call
  • Avoid recomputing corner coordinates
  • Add OMP pragma for parallel processing (in the first implemention for Linux only)

In a concrete case I have, these changes will in effect change the execution for HC thickness maps fram 4-5 minutes to 10 seconds

@jcrivenaes jcrivenaes marked this pull request as draft October 31, 2024 19:10
@jcrivenaes jcrivenaes force-pushed the speedup-surface-from-grid branch 2 times, most recently from 301775d to 674080e Compare October 31, 2024 19:37
@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 82.05128% with 7 lines in your changes missing coverage. Please review.

Project coverage is 81.14%. Comparing base (0375fed) to head (bf2744a).
Report is 44 commits behind head on main.

Files with missing lines Patch % Lines
src/xtgeo/surface/_regsurf_grid3d.py 79.41% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1261      +/-   ##
==========================================
+ Coverage   80.02%   81.14%   +1.11%     
==========================================
  Files          98       94       -4     
  Lines       13680    12433    -1247     
  Branches     2203     1874     -329     
==========================================
- Hits        10948    10089     -859     
+ Misses       1999     1685     -314     
+ Partials      733      659      -74     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jcrivenaes jcrivenaes force-pushed the speedup-surface-from-grid branch 3 times, most recently from ecabde7 to e186c8a Compare November 1, 2024 11:59
@jcrivenaes jcrivenaes force-pushed the speedup-surface-from-grid branch from e186c8a to 01d8c15 Compare November 5, 2024 12:12
@jcrivenaes jcrivenaes marked this pull request as ready for review November 5, 2024 12:14
@jcrivenaes jcrivenaes requested a review from mferrera November 5, 2024 12:14
@jcrivenaes jcrivenaes force-pushed the speedup-surface-from-grid branch from 01d8c15 to a702b79 Compare November 5, 2024 12:28
Copy link
Collaborator

@mferrera mferrera left a comment

Choose a reason for hiding this comment

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

Really impressive performance gains. OpenMP is magic

@jcrivenaes jcrivenaes force-pushed the speedup-surface-from-grid branch from a702b79 to 0194990 Compare November 6, 2024 13:38
Why we need to set OMP_NUM_THREADS to 1 to make "big" work is
currently unknown.
@jcrivenaes jcrivenaes merged commit a609c2e into equinor:main Nov 6, 2024
39 checks passed
@jcrivenaes jcrivenaes deleted the speedup-surface-from-grid branch November 6, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance speed of surface_from_grid3d (for use in grid3d_maps)
3 participants