From: Bo P. <be...@gm...> - 2014-04-29 19:21:58
|
Hi, Jeffrey, I have never seen a copyChromosome crash. If the crash is caused by growth rate, could you do something like def demofun(pop): print pop.subPopSizes() sz = numpy.array(pop.subPopSizes()) + gr * numpy.array(pop.subPopSizes()) * (1-(float(1)/numpy.array(totK) )*pop.subPopSizes()) print sz return sz and let me know sz before crash? Note that simuPOP expects an array of integers with the same size as pop.subPopSizes(). Bo On Tue, Apr 29, 2014 at 11:56 AM, Jeff Row <jef...@me...> wrote: > Hello, > > I am trying to run a simulation where the population sizes of my 10 > populations vary independently according to a logistic population growth > equation. To do this I use the following equation: > > def demofun(pop): > return numpy.array(pop.subPopSizes()) + gr * > numpy.array(pop.subPopSizes()) * > (1-(float(1)/numpy.array(totK))*pop.subPopSizes()) > > > In the equation, gr is a list with a population growth rate for each > population and totK is the carrying capacity for each population. I call > this function through the matingScheme to set populations for the > subsequent generation: > > matingScheme=sim.RandomMating(subPopSize=demofun) > > > Everything works fine and runs as expected for lower growth rates > (gr). However, if I set my growth rate above ~2.7 then python crashes due > to a segmentation fault. I do not have enough experience to make sense of > the report and was hoping to get some insight into a possible cause of the > crash? It seems to be some sort of memory issue, but I don't think it has > anything to do with running out of memory because it doesn't seem to matter > on the size of the carrying capacity, which determines overall population > sizes. There is obviously many other things going on in the simulation > including migration between the populations, but the growth rate parameter > seems to be what is causing the crash. I haven't pasted the whole error > report, because most of it seems like nonsense, but can do so if it will > help? I can also post more or explain the rest of my simulation if needed. > Any help would be appreciated. > > Thanks, > > Jeff > > > > > Error Report: > > Crashed Thread: 0 Dispatch queue: com.apple.main-thread > > Exception Type: EXC_BAD_ACCESS (SIGSEGV) > Exception Codes: KERN_INVALID_ADDRESS at 0x00000000401c0000 > > VM Regions Near 0x401c0000: > MALLOC_LARGE 00000000079e1000-0000000007bc5000 [ 1936K] > rw-/rwx SM=PRV > --> > __TEXT 000000008febd000-000000008fef0000 [ 204K] > r-x/rwx SM=COW /usr/lib/dyld > > Thread 0 Crashed:: Dispatch queue: com.apple.main-thread > 0 libsystem_platform.dylib 0x934ae347 > _platform_memmove$VARIANT$sse42 + 55 > 1 _simuPOP_std.so 0x05390ebb > simuPOP::GenoTransmitter::copyChromosome(simuPOP::Individual const&, int, > simuPOP::Individual&, int, unsigned long) const + 689 > 2 _simuPOP_std.so 0x053912bc > simuPOP::MendelianGenoTransmitter::transmitGenotype(simuPOP::Individual > const&, simuPOP::Individual&, int) const + 218 > 3 _simuPOP_std.so 0x0538c370 > simuPOP::MendelianGenoTransmitter::applyDuringMating(simuPOP::Population&, > simuPOP::Population&, __gnu_cxx::__normal_iterator<simuPOP::Individual*, > std::vector<simuPOP::Individual, std::allocator<simuPOP::Individual> > >, > simuPOP::Individual*, simuPOP::Individual*) const + 1296 > 4 _simuPOP_std.so 0x052e51c4 > simuPOP::OffspringGenerator::generateOffspring(simuPOP::Population&, > simuPOP::Population&, simuPOP::Individual*, simuPOP::Individual*, > __gnu_cxx::__normal_iterator<simuPOP::Individual*, > std::vector<simuPOP::Individual, std::allocator<simuPOP::Individual> > >&, > __gnu_cxx::__normal_iterator<simuPOP::Individual*, > std::vector<simuPOP::Individual, std::allocator<simuPOP::Individual> > >&) > + 688 > 5 _simuPOP_std.so 0x052ddbba > simuPOP::HomoMating::mateSubPop(simuPOP::Population&, simuPOP::Population&, > unsigned long, __gnu_cxx::__normal_iterator<simuPOP::Individual*, > std::vector<simuPOP::Individual, std::allocator<simuPOP::Individual> > >, > __gnu_cxx::__normal_iterator<simuPOP::Individual*, > std::vector<simuPOP::Individual, std::allocator<simuPOP::Individual> > >) + > 482 > 6 _simuPOP_std.so 0x052dd775 > simuPOP::MatingScheme::mate(simuPOP::Population&, simuPOP::Population&) + > 115 > 7 _simuPOP_std.so 0x052d2eea > simuPOP::Simulator::evolve(simuPOP::opList const&, simuPOP::opList const&, > simuPOP::MatingScheme const&, simuPOP::opList const&, simuPOP::opList > const&, int, bool) + 4910 > 8 _simuPOP_std.so 0x051ccb07 _wrap_Simulator_evolve > + 3511 > 9 org.python.python 0x000cb332 PyEval_EvalFrameEx + > 21746 > 10 org.python.python 0x000cd02a PyEval_EvalCodeEx + 2042 > 11 org.python.python 0x000cb253 PyEval_EvalFrameEx + > 21523 > 12 org.python.python 0x000cd02a PyEval_EvalCodeEx + 2042 > 13 org.python.python 0x000cb253 PyEval_EvalFrameEx + > 21523 > 14 org.python.python 0x000cd02a PyEval_EvalCodeEx + 2042 > 15 org.python.python 0x000cd1b7 PyEval_EvalCode + 87 > 16 org.python.python 0x000f1898 PyRun_FileExFlags + 168 > 17 org.python.python 0x000f27c3 PyRun_SimpleFileExFlags > + 867 > 18 org.python.python 0x0010ba58 Py_Main + 3560 > 19 org.python.python 0x00001fb6 0x1000 + 4022 > > > > -- > Jeffrey R. Row, Ph. D > Postdoctoral Research Fellow > Environment and Resource Studies, > University of Waterloo > Waterloo, ON > > > > > > > ------------------------------------------------------------------------------ > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE > Instantly run your Selenium tests across 300+ browser/OS combos. Get > unparalleled scalability from the best Selenium testing platform available. > Simple to use. Nothing to install. Get started now for free." > http://p.sf.net/sfu/SauceLabs > _______________________________________________ > simuPOP-list mailing list > sim...@li... > https://lists.sourceforge.net/lists/listinfo/simupop-list > |