You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Finite differencing should have better performance
MMSP.grid.cpp
in functionslaplacian(GRID,...)
, etc.laplacian()
andoperator()(GRID, vector<int>)
.Proposed fix
operator()(GRID, vector<int>)
, which passes coords throughcheck_boundary
before computing the index location.neighbor_coords
which would store a grid of n-dimensional coordinates for high- and low-side neighboring cells, and applyingcheck_boundaries
to each stored position vector.GRID[x][y]
instead ofGRID(x)
to efficiently access stored values, reducing overhead and improving performance.The text was updated successfully, but these errors were encountered: