Closed molpopgen closed 4 years ago
i've been dragging my heels on this PR as it changes a lot of code. Have you been using this successfully? no issues?
My inclination would be to not merge this until a formal code review is conducted and/or unit tests are put in place.
I did use this for the case of running a single replicate, and results were identical to the current release. A good test would be to run a lot of replicates with both versions and compare output, but that wouldn't make a good integrated test.
The other oddity is that the VIRT allocations are still massive. Not sure why. When I get time, I'll throw some stronger profilers at the code, like a full-blown valgrind session, etc.
Closing due to inactivity.
Skips the really big allocation of
currentTrajectory
in favor ofrealloc
.Changes:
currentTrajectory
is no longer global. This was not required, but it makes it more obvious that the variable is owned by main.proposeTrajectory
now takes a pointer tocurrentTrajectory
, e.g.float **
. This change is required so thatrealloc
events are propagated back to the caller. The more idiomatic approach would be to have this function return the new pointer, but it already has a return value.MAXTRAJSIZE
is a globalsize_t
, defined asextern
indiscoal.h
and initialized indiscoal_multipop.c
. This variable is used to track the allocation size.exit
rather thanassert
, which would normally be disabled.Note that
MAXTRAJSIZE
is set too small. This was intentional, in order to stress test the realloc code.I also thing I added -g to the Makefile as I was tracking down a double free issue for a bit there...