ROSS icon indicating copy to clipboard operation
ROSS copied to clipboard

Can't call ROSS multiple times

Open mdorier opened this issue 7 years ago • 2 comments

I'm trying to integrate ROSS simulations into a workflow, so a set of processes should be able to call a ROSS-based simulation (CODES model-net-mpi-replay) multiple time. This means calling tw_init/tw_end multiple times in a row. I ran into problems and realized ROSS uses many global/static variables (most globals in ross-global.c, but there are also static variables in other files that have a default value at the beginning of a run). While the first run of ROSS works fine, the following don't because some of the variables need to be reinitialized.

Would it be possible to add some kind of tw_reset() function that puts ROSS in the same state it was before the first tw_init call?

mdorier avatar Mar 20 '17 16:03 mdorier

Sure, I'll take a look at adding in that functionality.

caitlinross avatar Mar 22 '17 17:03 caitlinross

I've added in a tw_reset() function. Everything seems to be working with phold, but I still want to do some more testing before I merge it into master because I may have missed some things. In the meantime, do you mind checking out the tw-reset branch and trying it out with what you're working on? Let me know if there's any issues.

I've made the assumption any model using this functionality will be initializing MPI itself and calling the tw_comm_set() fuction. Then the only thing you need to do is call tw_reset() after tw_end() of the previous simulation and before tw_init() of the next. tw_reset() will (hopefully) take care of everything.

caitlinross avatar Apr 13 '17 20:04 caitlinross