-
Notifications
You must be signed in to change notification settings - Fork 222
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
Simplify ParticleContainer #966
Conversation
I'm really glad to see some of this stuff updated. The particle stuff has always been a little rickety. Anyone know why tests aren't running for this PR? |
I think there is a problem with tests on all our PRs. |
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.
The PR looks correct to me. It might be helpful to run some tests on the PR before merging, say after the Zygote related dependency mess is settled.
@devmotion The CI is now fixed on the master branch. Can you try to rebase |
I rebased on master, but as observed above tests aren't running. Skimming through other PRs it seems that tests don't run for PRs from forks? |
Yep; seems that's true. I don't know how to activate CI on forks. Since you're a repo developer now, do you want to create a new branch inside this repo? |
Sure, I can do that. I just noticed that apparently the actions are run on my fork but not on the main repo: https://github.com/devmotion/Turing.jl/actions |
That is equivalent - happy to merge once the actions based CI passes. |
It's not completely clear to me from the documentation, but maybe the issue for PRs could be solved by replacing lines such as
with |
Thanks, Travis CI is now turned on. I’m not sure about the actions based CI though, cause turning both push and pull request on causes duplicate builds in the past. |
I guess we'll face the same issue with Travis CI and end up with duplicate tests for forks from the main repo. However, I think that can be avoided by adding branches:
only:
- master to |
Apparently, in a similar way Github Actions can be filtered: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#filtering-for-specific-branches-tags-and-paths |
That looks quite promising. Would you like to give it a try in this PR? It seems I can't push to this PR easily. |
This PR simplifies the type parameters of
ParticleContainer
, and removes theconditional
field which by definition was alwaysnothing
.Moreover, instead of appending newly allocated arrays,
push!
now resizes the existing arrays and sets the new values, which is faster:The
empty!
function now defines an array of particles whose element type is based on the previously used array instead of always using the abstract element typeParticle
.The
copy!
function ofParticleContainer
creates a set of copied particles by list comprehension instead of pushing them individually to an initially empty array.Moreover, the definition of
Trace
is simplified by removing the completely uninitialized inner constructor and reordering the fields (making it easier to create new instances without specifying atask
).