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

vectorised a lot of operations, liberal use of numba kernels #73

Open
wants to merge 1 commit into
base: IC
Choose a base branch
from

Conversation

JBorrow
Copy link
Member

@JBorrow JBorrow commented Aug 25, 2020

Hi @mladenivkovic - this includes significant speed improvements (over 10x) on your IC code. It still needs work but we're getting there!

dist = dist[mask]
neighs = neighs[mask]
# do neighbour loops
block_size = 65536
Copy link
Collaborator

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.")
Copy link
Collaborator

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)
Copy link
Collaborator

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.")
Copy link
Collaborator

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):
Copy link
Collaborator

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

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.

2 participants