Skip to content

Conversation

@allegroLeiden
Copy link
Contributor

@allegroLeiden allegroLeiden commented Jan 18, 2017

I should make the caveat that the valgrind tool DRD still reports problems; however since these all occur outside the parallel section of raytrace.c, I don't understand what is going on. I attach the log file. Any ideas @tlunttil, or anybody else?

dlog.txt

To generate this I did

  cd example
  ../lime -n -t -p 4 model_lte.c
  ^c
  valgrind --tool=drd --log-file=dlog.txt lime_<whatever>.x

BTW I was not able to squash the 'Minor' commit message via rebasing. Git seems to get confused after a merge.

The function extractFace() was written to return a pointer to a faceType struct. The return value was copied from a local variable which I had made static to avoid compiler warnings. However of course static variables are shared over threads, so this was causing a data race condition. I fixed this by having the function return a faceType struct directly rather than a pointer to one. That allows me to avoid the static declaration inside the function.
In raytrace, a recent change clamped all the rays on the circle of the projected model boundary to zero. This had been done within the parallel block however which gave rise to a data race. The clamp has now been moved outside the parallel block.
@tlunttil
Copy link
Contributor

tlunttil commented Jan 18, 2017

Maybe there are some dangling pointers from earlier parts which then confuse valgrind? Does memcheck complain about anything? On the other hand spurious error messages are not unheard of.

If you run with -DTEST a few times, are the results identical on bit-level? If so, there's probably no error.

BTW, it could be worth looking at parallelising the (unparallelised) regions that drd complained about. At least that interpolation part sometimes takes a non-negligible amount of time. (There's also a cosmetic issue that the progress bar/percentage doesn't take into account time spent there, so it may get stuck at near 100% for a while.)

@allegroLeiden
Copy link
Contributor Author

Does memcheck complain about anything?

No.

If you run with -DTEST a few times, are the results identical on bit-level?

Yes.

BTW, it could be worth looking at parallelising the (unparallelised) regions that drd complained about.

Maybe later - for now I just want to fix #203 and issue a patch.

@allegroLeiden
Copy link
Contributor Author

Does memcheck complain about anything?

Oops - I looked too quick. There are zero errors, but there are some leaks. Probably unrelated to the drd problem, but I'll fix them anyway.

@tlunttil
Copy link
Contributor

Not related to drd warnings, but something I noticed when I was looking at the code: what is xySquared (starting from line 999 of raytrace.c) used for? Nothing, it seems...

@allegroLeiden
Copy link
Contributor Author

Hmm yeah, seems like fossilized code. I'll nix it.

@tlunttil
Copy link
Contributor

If the drd problems still remain, they could maybe be related to some dangling pointers confusing valgrind (it seems generally pointers are not NULLed in LIME after freeing). I might have a look at this later, but in my opinion you could merge this PR.

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.

3 participants