XBT_PRIVATE void* smpi_get_tmp_sendbuffer(int size);
XBT_PRIVATE void* smpi_get_tmp_recvbuffer(int size);
XBT_PRIVATE void smpi_free_tmp_buffer(void* buf);
+XBT_PRIVATE void smpi_free_replay_tmp_buffers();
// f77 wrappers
void mpi_init_(int* ierr);
#endif
}
+static int sendbuffer_size = 0;
+static char* sendbuffer = nullptr;
+static int recvbuffer_size = 0;
+static char* recvbuffer = nullptr;
+
+//allocate a single buffer for all sends, growing it if needed
+void* smpi_get_tmp_sendbuffer(int size)
+{
+ if (not smpi_process()->replaying())
+ return xbt_malloc(size);
+ if (sendbuffer_size<size){
+ sendbuffer=static_cast<char*>(xbt_realloc(sendbuffer,size));
+ sendbuffer_size=size;
+ }
+ return sendbuffer;
+}
+
+//allocate a single buffer for all recv
+void* smpi_get_tmp_recvbuffer(int size){
+ if (not smpi_process()->replaying())
+ return xbt_malloc(size);
+ if (recvbuffer_size<size){
+ recvbuffer=static_cast<char*>(xbt_realloc(recvbuffer,size));
+ recvbuffer_size=size;
+ }
+ return recvbuffer;
+}
+
+void smpi_free_tmp_buffer(void* buf){
+ if (not smpi_process()->replaying())
+ xbt_free(buf);
+}
+
+void smpi_free_replay_tmp_buffers(){
+ xbt_free(sendbuffer);
+ xbt_free(recvbuffer);
+}
static MPI_Datatype MPI_DEFAULT_TYPE;
-static int sendbuffer_size = 0;
-static char* sendbuffer = nullptr;
-static int recvbuffer_size = 0;
-static char* recvbuffer = nullptr;
class ReplayActionArg {
ReplayActionArg() {}
reqq.insert({Actor::self()->getPid(), mpi_request});
}
-//allocate a single buffer for all sends, growing it if needed
-void* smpi_get_tmp_sendbuffer(int size)
-{
- if (not smpi_process()->replaying())
- return xbt_malloc(size);
- if (sendbuffer_size<size){
- sendbuffer=static_cast<char*>(xbt_realloc(sendbuffer,size));
- sendbuffer_size=size;
- }
- return sendbuffer;
-}
-
-//allocate a single buffer for all recv
-void* smpi_get_tmp_recvbuffer(int size){
- if (not smpi_process()->replaying())
- return xbt_malloc(size);
- if (recvbuffer_size<size){
- recvbuffer=static_cast<char*>(xbt_realloc(recvbuffer,size));
- recvbuffer_size=size;
- }
- return recvbuffer;
-}
-
-void smpi_free_tmp_buffer(void* buf){
- if (not smpi_process()->replaying())
- xbt_free(buf);
-}
-
/* Helper function */
static double parse_double(const char *string)
{
if(active_processes==0){
/* Last process alive speaking: end the simulated timer */
XBT_INFO("Simulation time %f", smpi_process()->simulated_elapsed());
- xbt_free(sendbuffer);
- xbt_free(recvbuffer);
+ smpi_free_replay_tmp_buffers();
}
TRACE_smpi_comm_in(Actor::self()->getPid(), "smpi_replay_run_finalize", new simgrid::instr::NoOpTIData("finalize"));