-
Notifications
You must be signed in to change notification settings - Fork 12
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
vectorised a lot of operations, liberal use of numba kernels #73
base: IC
Are you sure you want to change the base?
Conversation
dist = dist[mask] | ||
neighs = neighs[mask] | ||
# do neighbour loops | ||
block_size = 65536 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this particular block size?
|
||
if neighs.shape[0] == 0: | ||
raise RuntimeError("Found no neighbour for a particle.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was up here for a reason. dist = dist[correct][1:]
below will crash the code otherwise.
|
||
h[p] = dist[-1] / kernel_gamma | ||
W = kernel_func(dist, [dist[-1]] * len(dist)) | ||
rho[p] += np.sum(self.m[neighs] * W) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first version was vectorised like this ... :/
neighs = neighs[correct][1:] | ||
|
||
if neighs.shape[0] == 0: | ||
raise RuntimeError("Found no neighbour for a particle.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again this might crash in 1276 when calling dist = dist[correct][1:]
from swiftsimio.accelerated import jit | ||
|
||
@jit(nopython=True, fastmath=True) | ||
def correct_for_periodic(dx, ndim, boxsize): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some documentation would be great here that this is for distances, not particle positions
Hi @mladenivkovic - this includes significant speed improvements (over 10x) on your IC code. It still needs work but we're getting there!