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

streamline vector calc #52

Open
tkphd opened this issue Dec 18, 2017 · 0 comments
Open

streamline vector calc #52

tkphd opened this issue Dec 18, 2017 · 0 comments

Comments

@tkphd
Copy link
Contributor

tkphd commented Dec 18, 2017

Finite differencing should have better performance

  • Bug appears in MMSP.grid.cpp in functions laplacian(GRID,...), etc.
  • The expected behavior is fast computation of gradients, Laplacians, and divergence using built-in functions.
  • The observed behavior in profiling is unusually high residence time in laplacian() and operator()(GRID, vector<int>).

Proposed fix

  • Our stock implementation of discrete Laplacian and gradient operators computes the addresses of neighboring cells every time the function is called, despite neighboring coords being static entities.
  • Operators then call operator()(GRID, vector<int>), which passes coords through check_boundary before computing the index location.
  • Entire process would be much faster by creating a function neighbor_coords which would store a grid of n-dimensional coordinates for high- and low-side neighboring cells, and applying check_boundaries to each stored position vector.
  • Discrete vector operators could then call GRID[x][y] instead of GRID(x) to efficiently access stored values, reducing overhead and improving performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant