We allocate some tables at first use that we never released.
XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table);
XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t * table, char *name, const char *desc);
+XBT_PUBLIC_DATA(void) (*smpi_coll_cleanup_callback)(void);
+XBT_PUBLIC(void) smpi_coll_cleanup_mvapich2(void);
extern XBT_PRIVATE double smpi_wtime_sleep;
extern XBT_PRIVATE double smpi_iprobe_sleep;
extern XBT_PRIVATE double smpi_test_sleep;
return (mpi_errno);
}
+
+void smpi_coll_cleanup_mvapich2(){
+int i=0;
+if(mv2_alltoall_thresholds_table)
+ xbt_free(mv2_alltoall_thresholds_table[i]);
+xbt_free(mv2_alltoall_thresholds_table);
+xbt_free(mv2_size_alltoall_tuning_table);
+xbt_free(mv2_alltoall_table_ppn_conf);
+
+xbt_free(mv2_gather_thresholds_table);
+ if(mv2_allgather_thresholds_table)
+xbt_free(mv2_allgather_thresholds_table[0]);
+xbt_free(mv2_size_allgather_tuning_table);
+xbt_free(mv2_allgather_table_ppn_conf);
+xbt_free(mv2_allgather_thresholds_table);
+
+
+xbt_free(mv2_allgatherv_thresholds_table);
+xbt_free(mv2_reduce_thresholds_table);
+xbt_free(mv2_red_scat_thresholds_table);
+xbt_free(mv2_allreduce_thresholds_table);
+xbt_free(mv2_bcast_thresholds_table);
+if(mv2_scatter_thresholds_table)
+ xbt_free(mv2_scatter_thresholds_table[0]);
+xbt_free(mv2_scatter_thresholds_table);
+xbt_free(mv2_size_scatter_tuning_table);
+xbt_free(mv2_scatter_table_ppn_conf);
+}
+
int agg_table_sum = 0;
mv2_alltoall_tuning_table **table_ptrs = NULL;
mv2_alltoall_num_ppn_conf = 3;
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
mv2_alltoall_thresholds_table = xbt_malloc(sizeof(mv2_alltoall_tuning_table *)
* mv2_alltoall_num_ppn_conf);
table_ptrs = xbt_malloc(sizeof(mv2_alltoall_tuning_table *)
static void init_mv2_gather_tables_stampede(){
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
mv2_size_gather_tuning_table=7;
mv2_gather_thresholds_table = xbt_malloc(mv2_size_gather_tuning_table*
sizeof (mv2_gather_tuning_table));
static void init_mv2_allgatherv_tables_stampede(){
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
mv2_size_allgatherv_tuning_table = 6;
mv2_allgatherv_thresholds_table = xbt_malloc(mv2_size_allgatherv_tuning_table *
sizeof (mv2_allgatherv_tuning_table));
static void init_mv2_allreduce_tables_stampede(){
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
mv2_size_allreduce_tuning_table = 8;
mv2_allreduce_thresholds_table = xbt_malloc(mv2_size_allreduce_tuning_table *
sizeof (mv2_allreduce_tuning_table));
static void init_mv2_bcast_tables_stampede(){
//Stampede,
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
mv2_size_bcast_tuning_table=8;
mv2_bcast_thresholds_table = xbt_malloc(mv2_size_bcast_tuning_table *
sizeof (mv2_bcast_tuning_table));
static void init_mv2_reduce_tables_stampede(){
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
/*Stampede*/
mv2_size_reduce_tuning_table = 8;
mv2_reduce_thresholds_table = xbt_malloc(mv2_size_reduce_tuning_table *
static void init_mv2_reduce_scatter_tables_stampede(){
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
mv2_size_red_scat_tuning_table = 6;
mv2_red_scat_thresholds_table = xbt_malloc(mv2_size_red_scat_tuning_table *
sizeof (mv2_red_scat_tuning_table));
static void init_mv2_scatter_tables_stampede(){
- {
+ if(smpi_coll_cleanup_callback==NULL)
+ smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
+
int agg_table_sum = 0;
int i;
mv2_scatter_tuning_table **table_ptrs = NULL;
* mv2_size_scatter_tuning_table[i]));
}
xbt_free(table_ptrs);
- }
+
}
int (*mpi_coll_reduce_scatter_fun)(void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype,MPI_Op op,MPI_Comm comm);
int (*mpi_coll_scatter_fun)(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,int root, MPI_Comm comm);
int (*mpi_coll_barrier_fun)(MPI_Comm comm);
+void (*smpi_coll_cleanup_callback)(void);
int smpi_coll_tuned_alltoall_ompi2(void *sendbuf, int sendcount,
extern double smpi_total_benched_time;
xbt_os_timer_t global_timer;
MPI_Comm MPI_COMM_WORLD = MPI_COMM_UNINITIALIZED;
-
MPI_Errhandler *MPI_ERRORS_RETURN = NULL;
MPI_Errhandler *MPI_ERRORS_ARE_FATAL = NULL;
MPI_Errhandler *MPI_ERRHANDLER_NULL = NULL;
if (MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED){
smpi_comm_cleanup_smp(MPI_COMM_WORLD);
smpi_comm_cleanup_attributes(MPI_COMM_WORLD);
+ if(smpi_coll_cleanup_callback!=NULL)
+ smpi_coll_cleanup_callback();
xbt_free(MPI_COMM_WORLD);
}
int barrier_id = find_coll_description(mpi_coll_barrier_description, xbt_cfg_get_string("smpi/barrier"),"barrier");
mpi_coll_barrier_fun = (int (*)(MPI_Comm comm)) mpi_coll_barrier_description[barrier_id].coll;
+ smpi_coll_cleanup_callback=NULL;
smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold");
smpi_running_power = xbt_cfg_get_double("smpi/running-power");
smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize-global-variables");