nbia-astro / skeletor

Parallel PIC code written in Python and based on the skeleton codes provided by PICKSC
GNU General Public License v3.0
1 stars 0 forks source link

Get the code running under Valgrind #100

Open tobson opened 7 years ago

tobson commented 7 years ago

When running the full test suite, we sometimes encounter the following error.

> assert all(self["y"][:self.np] >= self.manifold.edges[0])
E AssertionError

It's not entirely clear what's causing this error, but it probably has something to do with uninitialized memory. In order to catch errors like this, it would be extremely helpful to get the code running under Valgrind. For a Python code this is non-trivial but possible, see http://scikit-learn.org/stable/developers/debugging.html

tobson commented 7 years ago

I just had this happen again. Both times the failing test was the two=stream instability test.

tobson commented 7 years ago

Currently running the two-stream instability test over and over again, I get this error almost every other time. The good news is that it's evidently fairly easy to reproduce. That should make it a lot easier to track down. Let's try to squash this bug as soon as we can.

tobson commented 7 years ago

I have not seen any assertion errors since this commit: ecca866

tobson commented 7 years ago

I would find it a little bizarre if the change in ecca866 were really the cure, though. Why does the error happen half way through the run as opposed to, say, immediately?

tobson commented 7 years ago

However bizarre I may find this, the change in ecca866 really does seem to be the cure. I ran the the two-stream test 20 times without error. By comparison, repeating the excercise with the previous version 24d0116, the test failed 4 out of 20 times.

Before we stop worrying about this, though, let's make sure we really understand what was going on.

tobson commented 7 years ago

Here's some more info on debugging Python code with Valgrind: