diff --git a/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.c b/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.c index 25a6708b2c9..156f235a217 100644 --- a/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.c +++ b/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include #include "IntConstantInitializedVector.h" diff --git a/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.h b/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.h index 25e5a1d759f..93b15cd3d5d 100644 --- a/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.h +++ b/ompi/mca/topo/treematch/treematch/IntConstantInitializedVector.h @@ -1,6 +1,8 @@ #ifndef INTEGER_CONSTANT_INITIALIZED_VECTOR #define INTEGER_CONSTANT_INITIALIZED_VECTOR +#include "ompi_tm_rename.h" + typedef struct int_CIVector_ { int init_value, size, top, *to, *from, *vec; diff --git a/ompi/mca/topo/treematch/treematch/PriorityQueue.c b/ompi/mca/topo/treematch/treematch/PriorityQueue.c index 83e08ad2f2d..25637d5c086 100644 --- a/ompi/mca/topo/treematch/treematch/PriorityQueue.c +++ b/ompi/mca/topo/treematch/treematch/PriorityQueue.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include "PriorityQueue.h" diff --git a/ompi/mca/topo/treematch/treematch/fibo.c b/ompi/mca/topo/treematch/treematch/fibo.c index 97070e7273a..28aff460b5e 100644 --- a/ompi/mca/topo/treematch/treematch/fibo.c +++ b/ompi/mca/topo/treematch/treematch/fibo.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + /* Copyright 2010 IPB, INRIA & CNRS ** ** This file originally comes from the Scotch software package for diff --git a/ompi/mca/topo/treematch/treematch/fibo.h b/ompi/mca/topo/treematch/treematch/fibo.h index 32e0a7c0824..81bd4b51f32 100644 --- a/ompi/mca/topo/treematch/treematch/fibo.h +++ b/ompi/mca/topo/treematch/treematch/fibo.h @@ -62,6 +62,8 @@ /* The doubly linked list structure. */ +#include "ompi_tm_rename.h" + typedef struct FiboLink_ { struct FiboNode_ * prevptr; /*+ Pointer to previous sibling element +*/ struct FiboNode_ * nextptr; /*+ Pointer to next sibling element +*/ @@ -170,16 +172,6 @@ typedef struct FiboTree_ { ** The function prototypes. */ -/* This set of definitions allows the user - to specify whether he prefers to use - the fibonacci routines as macros or as - regular functions, for instance for - debugging. */ - -#define fiboTreeAdd fiboTreeAddMacro -/* #define fiboTreeDel fiboTreeDelMacro */ -/* #define fiboTreeMin fiboTreeMinMacro */ - #ifndef FIBO #define static #endif @@ -188,18 +180,27 @@ int fiboTreeInit (FiboTree * const, int (*) (cons void fiboTreeExit (FiboTree * const); void fiboTreeFree (FiboTree * const); FiboNode * fiboTreeConsolidate (FiboTree * const); -#ifndef fiboTreeAdd void fiboTreeAdd (FiboTree * const, FiboNode * const); -#endif /* fiboTreeAdd */ -#ifndef fiboTreeDel void fiboTreeDel (FiboTree * const, FiboNode * const); -#endif /* fiboTreeDel */ -#ifndef fiboTreeMin FiboNode * fiboTreeMin (FiboTree * const); -#endif /* fiboTreeMin */ #ifdef FIBO_DEBUG int fiboTreeCheck (const FiboTree * const); static int fiboTreeCheck2 (const FiboNode * const); #endif /* FIBO_DEBUG */ +/* This set of definitions allows the user + to specify whether he prefers to use + the fibonacci routines as macros or as + regular functions, for instance for + debugging. */ + +#if 0 +#undef fiboTreeAdd +#define fiboTreeAdd fiboTreeAddMacro +#undef fiboTreeDel +#define fiboTreeDel fiboTreeDelMacro +#undef fiboTreeMin +#define fiboTreeMin fiboTreeMinMacro +#endif + #undef static diff --git a/ompi/mca/topo/treematch/treematch/k-partitioning.c b/ompi/mca/topo/treematch/treematch/k-partitioning.c index f035ffa24a1..31d51c84a2a 100644 --- a/ompi/mca/topo/treematch/treematch/k-partitioning.c +++ b/ompi/mca/topo/treematch/treematch/k-partitioning.c @@ -1,20 +1,22 @@ +#include "ompi_tm_rename.h" + #include #include #include "k-partitioning.h" #include "tm_mt.h" #include "tm_verbose.h" -void memory_allocation(PriorityQueue ** Q, PriorityQueue ** Qinst, double *** D, int n, int k); -void initialization(int * const part, double ** const matrice, PriorityQueue * const Qpart, PriorityQueue * const Q, PriorityQueue * const Qinst, double ** const D, int n, int k, int * const deficit, int * const surplus); -void algo(int * const part, double ** const matrice, PriorityQueue * const Qpart, PriorityQueue * const Q, PriorityQueue * const Qinst, double ** const D, int n, int * const deficit, int * const surplus); -double nextGain(PriorityQueue * const Qpart, PriorityQueue * const Q, int * const deficit, int * const surplus); -void balancing(int n, int deficit, int surplus, double ** const D, int * const part); -void destruction(PriorityQueue * Qpart, PriorityQueue * Q, PriorityQueue * Qinst, double ** D, int n, int k); - -void allocate_vertex2(int u, int *res, double **comm, int n, int *size, int max_size); -double eval_cost2(int *,int,double **); -int *kpartition_greedy2(int k, double **comm, int n, int nb_try_max, int *constraints, int nb_constraints); -int* build_p_vector(double **comm, int n, int k, int greedy_trials, int * constraints, int nb_constraints); +static void memory_allocation(PriorityQueue ** Q, PriorityQueue ** Qinst, double *** D, int n, int k); +static void initialization(int * const part, double ** const matrice, PriorityQueue * const Qpart, PriorityQueue * const Q, PriorityQueue * const Qinst, double ** const D, int n, int k, int * const deficit, int * const surplus); +static void algo(int * const part, double ** const matrice, PriorityQueue * const Qpart, PriorityQueue * const Q, PriorityQueue * const Qinst, double ** const D, int n, int * const deficit, int * const surplus); +static double nextGain(PriorityQueue * const Qpart, PriorityQueue * const Q, int * const deficit, int * const surplus); +static void balancing(int n, int deficit, int surplus, double ** const D, int * const part); +static void destruction(PriorityQueue * Qpart, PriorityQueue * Q, PriorityQueue * Qinst, double ** D, int n, int k); + +static void allocate_vertex2(int u, int *res, double **comm, int n, int *size, int max_size); +static double eval_cost2(int *,int,double **); +static int *kpartition_greedy2(int k, double **comm, int n, int nb_try_max, int *constraints, int nb_constraints); +static int* build_p_vector(double **comm, int n, int k, int greedy_trials, int * constraints, int nb_constraints); int* kPartitioning(double ** comm, int n, int k, int * constraints, int nb_constraints, int greedy_trials) { diff --git a/ompi/mca/topo/treematch/treematch/k-partitioning.h b/ompi/mca/topo/treematch/treematch/k-partitioning.h index 8db2392e1a5..9bc4e8d6713 100644 --- a/ompi/mca/topo/treematch/treematch/k-partitioning.h +++ b/ompi/mca/topo/treematch/treematch/k-partitioning.h @@ -1,6 +1,8 @@ #ifndef K_PARTITIONING #define K_PARTITIONING +#include "ompi_tm_rename.h" + #include "PriorityQueue.h" /* diff --git a/ompi/mca/topo/treematch/treematch/ompi_tm_rename.h b/ompi/mca/topo/treematch/treematch/ompi_tm_rename.h new file mode 100644 index 00000000000..a759becfb41 --- /dev/null +++ b/ompi/mca/topo/treematch/treematch/ompi_tm_rename.h @@ -0,0 +1,176 @@ +#ifndef TREEMATCH_RENAME +#define TREEMATCH_RENAME + +#define FiboLink_ ompi_topo_treematch_FiboLink_ +#define FiboLink ompi_topo_treematch_FiboLink + +#define FiboNode_ ompi_topo_treematch_FiboNode_ +#define FiboNode ompi_topo_treematch_FiboNode + +#define FiboTree_ ompi_topo_treematch_FiboTree_ +#define FiboTree ompi_topo_treematch_FiboTree + +#define fiboTreeInit ompi_topo_treematch_fiboTreeInit +#define fiboTreeExit ompi_topo_treematch_fiboTreeExit +#define fiboTreeFree ompi_topo_treematch_fiboTreeFree +#define fiboTreeConsolidate ompi_topo_treematch_fiboTreeConsolidate +#define fiboTreeAdd ompi_topo_treematch_fiboTreeAdd +#define fiboTreeDel ompi_topo_treematch_fiboTreeDel +#define fiboTreeMin ompi_topo_treematch_fiboTreeMin +#define fiboTreeCheck ompi_topo_treematch_fiboTreeCheck +#define fiboTreeCheck2 ompi_topo_treematch_fiboTreeCheck2 + +#define int_CIVector_ ompi_topo_treematch_int_CIVector_ +#define int_CIVector ompi_topo_treematch_int_CIVector + +#define intCIV_isInitialized ompi_topo_treematch_intCIV_isInitialized +#define intCIV_init ompi_topo_treematch_intCIV_init +#define intCIV_exit ompi_topo_treematch_intCIV_exit +#define intCIV_set ompi_topo_treematch_intCIV_set +#define intCIV_get ompi_topo_treematch_intCIV_get + +#define kPartitioning ompi_topo_treematch_kPartitioning + +#define QueueElement_ ompi_topo_treematch_QueueElement_ +#define QueueElement ompi_topo_treematch_QueueElement + +#define PriorityQueue_ ompi_topo_treematch_PriorityQueue_ +#define PriorityQueue ompi_topo_treematch_PriorityQueue + +#define PQ_init ompi_topo_treematch_PQ_init +#define PQ_free ompi_topo_treematch_PQ_free +#define PQ_exit ompi_topo_treematch_PQ_exit +#define PQ_isEmpty ompi_topo_treematch_PQ_isEmpty +#define PQ_insertElement ompi_topo_treematch_PQ_insertElement +#define PQ_deleteElement ompi_topo_treematch_PQ_deleteElement +#define PQ_insert ompi_topo_treematch_PQ_insert +#define PQ_delete ompi_topo_treematch_PQ_delete +#define PQ_findMaxElement ompi_topo_treematch_PQ_findMaxElement +#define PQ_deleteMaxElement ompi_topo_treematch_PQ_deleteMaxElement +#define PQ_findMaxKey ompi_topo_treematch_PQ_findMaxKey +#define PQ_deleteMax ompi_topo_treematch_PQ_deleteMax +#define PQ_increaseElementKey ompi_topo_treematch_PQ_increaseElementKey +#define PQ_decreaseElementKey ompi_topo_treematch_PQ_decreaseElementKey +#define PQ_adjustElementKey ompi_topo_treematch_PQ_adjustElementKey +#define PQ_increaseKey ompi_topo_treematch_PQ_increaseKey +#define PQ_decreaseKey ompi_topo_treematch_PQ_decreaseKey +#define PQ_adjustKey ompi_topo_treematch_PQ_adjustKey + +#define coord ompi_topo_treematch_coord +#define bucket_t ompi_topo_treematch_bucket_t +#define _bucket_list_t ompi_topo_treematch__bucket_list_t +#define bucket_grouping ompi_topo_treematch_bucket_grouping +#define try_add_edge ompi_topo_treematch_try_add_edge + +#define _com_mat_t ompi_topo_treematch__com_mat_t +#define com_mat_t ompi_topo_treematch_com_mat_t +#define kpartition ompi_topo_treematch_kpartition +#define kpartition_build_tree_from_topology ompi_topo_treematch_kpartition_build_tree_from_topology + +#define tm_malloc ompi_topo_treematch_tm_malloc +#define tm_calloc ompi_topo_treematch_tm_calloc +#define tm_realloc ompi_topo_treematch_tm_realloc +#define tm_free ompi_topo_treematch_tm_free +#define tm_mem_check ompi_topo_treematch_tm_mem_check + +#define new_affinity_mat ompi_topo_treematch_new_affinity_mat +#define build_synthetic_proc_id ompi_topo_treematch_build_synthetic_proc_id +#define build_synthetic_topology ompi_topo_treematch_build_synthetic_topology +#define compute_nb_leaves_from_level ompi_topo_treematch_compute_nb_leaves_from_level +#define depth_first ompi_topo_treematch_depth_first +#define fill_tab ompi_topo_treematch_fill_tab +#define init_mat ompi_topo_treematch_init_mat +#define map_topology ompi_topo_treematch_map_topology +#define nb_leaves ompi_topo_treematch_nb_leaves +#define nb_lines ompi_topo_treematch_nb_lines +#define nb_processing_units ompi_topo_treematch_nb_processing_units +#define print_1D_tab ompi_topo_treematch_print_1D_tab +#define tm_compute_mapping ompi_topo_treematch_tm_compute_mapping +#define tm_free_affinity_mat ompi_topo_treematch_tm_free_affinity_mat +#define tm_load_aff_mat ompi_topo_treematch_tm_load_aff_mat +#define update_comm_speed ompi_topo_treematch_update_comm_speed +#define constraint_t ompi_topo_treematch_constraint_t + +#define init_genrand ompi_topo_treematch_init_genrand +#define init_by_array ompi_topo_treematch_init_by_array +#define genrand_int32 ompi_topo_treematch_genrand_int32 +#define genrand_int31 ompi_topo_treematch_genrand_int31 +#define genrand_real1 ompi_topo_treematch_genrand_real1 +#define genrand_real2 ompi_topo_treematch_genrand_real2 +#define genrand_real3 ompi_topo_treematch_genrand_real3 +#define genrand_res53 ompi_topo_treematch_genrand_res53 + +#define tm_free_solution ompi_topo_treematch_tm_free_solution +#define distance ompi_topo_treematch_distance +#define display_sol_sum_com ompi_topo_treematch_display_sol_sum_com +#define display_sol ompi_topo_treematch_display_sol +#define tm_display_solution ompi_topo_treematch_tm_display_solution +#define tm_display_other_heuristics ompi_topo_treematch_tm_display_other_heuristics +#define in_tab ompi_topo_treematch_in_tab +#define map_Packed ompi_topo_treematch_map_Packed +#define map_RR ompi_topo_treematch_map_RR +#define hash_asc ompi_topo_treematch_hash_asc +#define generate_random_sol ompi_topo_treematch_generate_random_sol +#define eval_sol ompi_topo_treematch_eval_sol +#define exchange ompi_topo_treematch_exchange +#define gain_exchange ompi_topo_treematch_gain_exchange +#define select_max ompi_topo_treematch_select_max +#define compute_gain ompi_topo_treematch_compute_gain +#define map_MPIPP ompi_topo_treematch_map_MPIPP + +#define _work_t ompi_topo_treematch__work_t +#define work_t ompi_topo_treematch_work_t + +#define local_thread_t ompi_topo_treematch_local_thread_t + +#define _thread_pool_t ompi_topo_treematch__thread_pool_t +#define thread_pool_t ompi_topo_treematch_thread_pool_t + +#define get_nb_threads ompi_topo_treematch_get_nb_threads +#define submit_work ompi_topo_treematch_submit_work +#define wait_work_completion ompi_topo_treematch_wait_work_completion +#define terminate_thread_pool ompi_topo_treematch_terminate_thread_pool +#define create_work ompi_topo_treematch_create_work +#define test_main ompi_topo_treematch_test_main +#define destroy_work ompi_topo_treematch_destroy_work + +#define CLOCK_T ompi_topo_treematch_CLOCK_T + +#define time_diff ompi_topo_treematch_time_diff +#define get_time ompi_topo_treematch_get_time + +#define get_local_topo_with_hwloc ompi_topo_treematch_get_local_topo_with_hwloc +#define hwloc_to_tm ompi_topo_treematch_hwloc_to_tm +#define int_cmp_inc ompi_topo_treematch_int_cmp_inc +#define optimize_arity ompi_topo_treematch_optimize_arity +#define symetric ompi_topo_treematch_symetric +#define tgt_to_tm ompi_topo_treematch_tgt_to_tm +#define tm_display_arity ompi_topo_treematch_tm_display_arity +#define tm_display_topology ompi_topo_treematch_tm_display_topology +#define tm_free_topology ompi_topo_treematch_tm_free_topology +#define tm_load_topology ompi_topo_treematch_tm_load_topology +#define tm_optimize_topology ompi_topo_treematch_tm_optimize_topology +#define tm_topology_add_binding_constraints ompi_topo_treematch_tm_topology_add_binding_constraints +#define topo_nb_proc ompi_topo_treematch_topo_nb_proc +#define topology_arity ompi_topo_treematch_topology_arity +#define topology_constraints ompi_topo_treematch_topology_constraints +#define topology_cost ompi_topo_treematch_topology_cost +#define topology_numbering ompi_topo_treematch_topology_numbering +#define topology_to_arch ompi_topo_treematch_topology_to_arch +#define nb_processing_units ompi_topo_treematch_nb_processing_units + +#define update_val ompi_topo_treematch_update_val +#define display_tab ompi_topo_treematch_display_tab +#define set_node ompi_topo_treematch_set_node + +#define _group_list_t ompi_topo_treematch__group_list_t +#define group_list_t ompi_topo_treematch_group_list_t + +#define adjacency_t ompi_topo_treematch_adjacency_t + +#define _work_unit_t ompi_topo_treematch__work_unit_t +#define work_unit_t ompi_topo_treematch_work_unit_t + +#define complete_obj_weight ompi_topo_treematch_complete_obj_weight + +#endif // TREEMATCH_RENAME diff --git a/ompi/mca/topo/treematch/treematch/tm_bucket.c b/ompi/mca/topo/treematch/treematch/tm_bucket.c index 2389aa4fc4e..dfa5b8cdc65 100644 --- a/ompi/mca/topo/treematch/treematch/tm_bucket.c +++ b/ompi/mca/topo/treematch/treematch/tm_bucket.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include #include @@ -33,26 +35,25 @@ static int verbose_level = ERROR; static bucket_list_t global_bl = {0}; -int tab_cmp(const void*,const void*); -int old_bucket_id(int,int,bucket_list_t); -int bucket_id(int,int,bucket_list_t); -void display_bucket(bucket_t *); -void check_bucket(bucket_t *,double **,double, double); -void display_pivots(bucket_list_t); -void display_bucket_list(bucket_list_t); -void add_to_bucket(int,int,int,bucket_list_t); -void dfs(int,int,int,double *,double *,int,int); -void built_pivot_tree(bucket_list_t); -void fill_buckets(bucket_list_t); -int is_power_of_2(int); -void partial_sort(bucket_list_t *,double **,int); -void next_bucket_elem(bucket_list_t,int *,int *); -int add_edge_3(tm_tree_t *,tm_tree_t *,int,int,int *); -void free_bucket(bucket_t *); -void free_tab_bucket(bucket_t **,int); -void free_bucket_list(bucket_list_t); -void partial_update_val (int nb_args, void **args, int thread_id); -double bucket_grouping(tm_affinity_mat_t *,tm_tree_t *, tm_tree_t *, int ,int); +static int tab_cmp(const void*,const void*); +static int old_bucket_id(int,int,bucket_list_t); +static int bucket_id(int,int,bucket_list_t); +static void display_bucket(bucket_t *); +static void check_bucket(bucket_t *,double **,double, double); +static void display_pivots(bucket_list_t); +static void display_bucket_list(bucket_list_t); +static void add_to_bucket(int,int,int,bucket_list_t); +static void dfs(int,int,int,double *,double *,int,int); +static void built_pivot_tree(bucket_list_t); +static void fill_buckets(bucket_list_t); +static int is_power_of_2(int); +static void partial_sort(bucket_list_t *,double **,int); +static void next_bucket_elem(bucket_list_t,int *,int *); +static int add_edge_3(tm_tree_t *,tm_tree_t *,int,int,int *); +static void free_bucket(bucket_t *); +static void free_tab_bucket(bucket_t **,int); +static void free_bucket_list(bucket_list_t); +static void partial_update_val (int nb_args, void **args, int thread_id); int tab_cmp(const void* x1,const void* x2) { int *e1 = NULL,*e2 = NULL,i1,i2,j1,j2; diff --git a/ompi/mca/topo/treematch/treematch/tm_bucket.h b/ompi/mca/topo/treematch/treematch/tm_bucket.h index 433d4816466..402c8224ebd 100644 --- a/ompi/mca/topo/treematch/treematch/tm_bucket.h +++ b/ompi/mca/topo/treematch/treematch/tm_bucket.h @@ -1,6 +1,8 @@ #ifndef __BUCKET_H__ #define __BUCKET_H__ +#include "ompi_tm_rename.h" + typedef struct{ int i; int j; diff --git a/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c b/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c index 09cb35add50..b7c725aee01 100644 --- a/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c +++ b/ompi/mca/topo/treematch/treematch/tm_kpartitioning.c @@ -1,7 +1,10 @@ +#include "ompi_tm_rename.h" + #include "tm_mapping.h" #include "tm_mt.h" #include "tm_kpartitioning.h" #include "k-partitioning.h" +#include "tm_tree.h" #include #include #include "config.h" @@ -23,19 +26,16 @@ static int verbose_level = ERROR; #define MIN(a,b) ((a)<(b)?(a):(b)) -int fill_tab(int **,int *,int,int,int,int); -void complete_obj_weight(double **,int,int); - -void allocate_vertex(int,int *,com_mat_t *,int,int *,int); -double eval_cost(int *, com_mat_t *); -int *kpartition_greedy(int, com_mat_t *,int,int *,int); -constraint_t *split_constraints (int *,int,int,tm_topology_t *,int, int); -com_mat_t **split_com_mat(com_mat_t *,int,int,int *); -int **split_vertices(int *,int,int,int *); -void free_tab_com_mat(com_mat_t **,int); -void free_tab_local_vertices(int **,int); -void free_const_tab(constraint_t *,int); -void kpartition_build_level_topology(tm_tree_t *,com_mat_t *,int,int,tm_topology_t *, +static void allocate_vertex(int,int *,com_mat_t *,int,int *,int); +static double eval_cost(int *, com_mat_t *); +static int *kpartition_greedy(int, com_mat_t *,int,int *,int); +static constraint_t *split_constraints (int *,int,int,tm_topology_t *,int, int); +static com_mat_t **split_com_mat(com_mat_t *,int,int,int *); +static int **split_vertices(int *,int,int,int *); +static void free_tab_com_mat(com_mat_t **,int); +static void free_tab_local_vertices(int **,int); +static void free_const_tab(constraint_t *,int); +static void kpartition_build_level_topology(tm_tree_t *,com_mat_t *,int,int,tm_topology_t *, int *,int *,int,double *,double *); static int greedy_flag = 0; diff --git a/ompi/mca/topo/treematch/treematch/tm_kpartitioning.h b/ompi/mca/topo/treematch/treematch/tm_kpartitioning.h index 09c2227c066..b2d25b3079e 100644 --- a/ompi/mca/topo/treematch/treematch/tm_kpartitioning.h +++ b/ompi/mca/topo/treematch/treematch/tm_kpartitioning.h @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + typedef struct _com_mat_t{ double **comm; int n; /*comm is of size n by n the other element are zeroes*/ diff --git a/ompi/mca/topo/treematch/treematch/tm_malloc.c b/ompi/mca/topo/treematch/treematch/tm_malloc.c index b0eaa9e7030..9d5169af549 100644 --- a/ompi/mca/topo/treematch/treematch/tm_malloc.c +++ b/ompi/mca/topo/treematch/treematch/tm_malloc.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include #include diff --git a/ompi/mca/topo/treematch/treematch/tm_malloc.h b/ompi/mca/topo/treematch/treematch/tm_malloc.h index f74cd3db6af..136d847607d 100644 --- a/ompi/mca/topo/treematch/treematch/tm_malloc.h +++ b/ompi/mca/topo/treematch/treematch/tm_malloc.h @@ -1,6 +1,8 @@ #ifndef _TM_MALLOC_H_ #define _TM_MALLOC_H_ +#include "ompi_tm_rename.h" + #include void *tm_malloc(size_t size, char *, int); void *tm_calloc(size_t count, size_t size, char *, int); diff --git a/ompi/mca/topo/treematch/treematch/tm_mapping.c b/ompi/mca/topo/treematch/treematch/tm_mapping.c index b30846c0ccd..6e034349ba2 100644 --- a/ompi/mca/topo/treematch/treematch/tm_mapping.c +++ b/ompi/mca/topo/treematch/treematch/tm_mapping.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include #include diff --git a/ompi/mca/topo/treematch/treematch/tm_mapping.h b/ompi/mca/topo/treematch/treematch/tm_mapping.h index 8e8c1985535..52245825bb6 100644 --- a/ompi/mca/topo/treematch/treematch/tm_mapping.h +++ b/ompi/mca/topo/treematch/treematch/tm_mapping.h @@ -1,5 +1,8 @@ #ifndef __TM_MAPPING_H__ #define __TM_MAPPING_H__ + +#include "ompi_tm_rename.h" + #include "tm_tree.h" #include "tm_topology.h" #include "tm_timings.h" diff --git a/ompi/mca/topo/treematch/treematch/tm_mt.c b/ompi/mca/topo/treematch/treematch/tm_mt.c index 55c8f7bd905..40ba45599a0 100644 --- a/ompi/mca/topo/treematch/treematch/tm_mt.c +++ b/ompi/mca/topo/treematch/treematch/tm_mt.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + /* A C-program for MT19937, with improved initialization 2002/1/26. diff --git a/ompi/mca/topo/treematch/treematch/tm_mt.h b/ompi/mca/topo/treematch/treematch/tm_mt.h index 58f50d8f509..086eb833140 100644 --- a/ompi/mca/topo/treematch/treematch/tm_mt.h +++ b/ompi/mca/topo/treematch/treematch/tm_mt.h @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + void init_genrand(unsigned long s); void init_by_array(unsigned long init_key[], int key_length); diff --git a/ompi/mca/topo/treematch/treematch/tm_solution.c b/ompi/mca/topo/treematch/treematch/tm_solution.c index 4205c0d9d9a..294529fe8d7 100644 --- a/ompi/mca/topo/treematch/treematch/tm_solution.c +++ b/ompi/mca/topo/treematch/treematch/tm_solution.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include #include "tm_solution.h" diff --git a/ompi/mca/topo/treematch/treematch/tm_solution.h b/ompi/mca/topo/treematch/treematch/tm_solution.h index 8cc38a87558..dd039c54a9c 100644 --- a/ompi/mca/topo/treematch/treematch/tm_solution.h +++ b/ompi/mca/topo/treematch/treematch/tm_solution.h @@ -1,6 +1,8 @@ #ifndef TM_SOLUION_H #define TM_SOLUION_H +#include "ompi_tm_rename.h" + #include "treematch.h" void tm_free_solution(tm_solution_t *sol); diff --git a/ompi/mca/topo/treematch/treematch/tm_thread_pool.c b/ompi/mca/topo/treematch/treematch/tm_thread_pool.c index 6617d2c6d55..843a881082c 100644 --- a/ompi/mca/topo/treematch/treematch/tm_thread_pool.c +++ b/ompi/mca/topo/treematch/treematch/tm_thread_pool.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include "tm_thread_pool.h" #include "tm_verbose.h" diff --git a/ompi/mca/topo/treematch/treematch/tm_thread_pool.h b/ompi/mca/topo/treematch/treematch/tm_thread_pool.h index 3499d261c0b..276a9054d45 100644 --- a/ompi/mca/topo/treematch/treematch/tm_thread_pool.h +++ b/ompi/mca/topo/treematch/treematch/tm_thread_pool.h @@ -1,6 +1,8 @@ #ifndef THREAD_POOL_H #define THREAD_POOL_H +#include "ompi_tm_rename.h" + #include #include diff --git a/ompi/mca/topo/treematch/treematch/tm_timings.c b/ompi/mca/topo/treematch/treematch/tm_timings.c index b20747370e5..75f6162c636 100644 --- a/ompi/mca/topo/treematch/treematch/tm_timings.c +++ b/ompi/mca/topo/treematch/treematch/tm_timings.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include "tm_timings.h" static CLOCK_T time_tab[MAX_CLOCK]; diff --git a/ompi/mca/topo/treematch/treematch/tm_timings.h b/ompi/mca/topo/treematch/treematch/tm_timings.h index 377a1cd46ef..813f7ca8de1 100644 --- a/ompi/mca/topo/treematch/treematch/tm_timings.h +++ b/ompi/mca/topo/treematch/treematch/tm_timings.h @@ -1,5 +1,8 @@ #ifndef TIMINGS_H #define TIMINGS_H + +#include "ompi_tm_rename.h" + #include #ifndef _WIN32 diff --git a/ompi/mca/topo/treematch/treematch/tm_topology.c b/ompi/mca/topo/treematch/treematch/tm_topology.c index 2c05c91dccb..3a9d4ee59f3 100644 --- a/ompi/mca/topo/treematch/treematch/tm_topology.c +++ b/ompi/mca/topo/treematch/treematch/tm_topology.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include #include "tm_tree.h" @@ -8,24 +10,16 @@ tm_topology_t* tm_get_local_topo_with_hwloc(void); -tm_topology_t* hwloc_to_tm(char *filename); -int int_cmp_inc(const void* x1,const void* x2); -void optimize_arity(int **arity, double **cost, int *nb_levels,int n); -int symetric(hwloc_topology_t topology); -tm_topology_t * tgt_to_tm(char *filename); void tm_display_arity(tm_topology_t *topology); void tm_display_topology(tm_topology_t *topology); void tm_free_topology(tm_topology_t *topology); tm_topology_t *tm_load_topology(char *arch_filename, tm_file_type_t arch_file_type); void tm_optimize_topology(tm_topology_t **topology); int tm_topology_add_binding_constraints(char *constraints_filename, tm_topology_t *topology); -int topo_nb_proc(hwloc_topology_t topology,int N); -void topology_arity_cpy(tm_topology_t *topology,int **arity,int *nb_levels); -void topology_constraints_cpy(tm_topology_t *topology,int **constraints,int *nb_constraints); -void topology_cost_cpy(tm_topology_t *topology,double **cost); -void topology_numbering_cpy(tm_topology_t *topology,int **numbering,int *nb_nodes); -double ** topology_to_arch(hwloc_topology_t topology); -void build_synthetic_proc_id(tm_topology_t *topology); +static void topology_arity_cpy(tm_topology_t *topology,int **arity,int *nb_levels); +static void topology_constraints_cpy(tm_topology_t *topology,int **constraints,int *nb_constraints); +static void topology_cost_cpy(tm_topology_t *topology,double **cost); +static void topology_numbering_cpy(tm_topology_t *topology,int **numbering,int *nb_nodes); tm_topology_t *tm_build_synthetic_topology(int *arity, double *cost, int nb_levels, int *core_numbering, int nb_core_per_nodes); void tm_set_numbering(tm_numbering_t new_val); /* TM_NUMBERING_LOGICAL or TM_NUMBERING_PHYSICAL */ diff --git a/ompi/mca/topo/treematch/treematch/tm_topology.h b/ompi/mca/topo/treematch/treematch/tm_topology.h index a7b04dee745..a7f41ae52b0 100644 --- a/ompi/mca/topo/treematch/treematch/tm_topology.h +++ b/ompi/mca/topo/treematch/treematch/tm_topology.h @@ -1,4 +1,7 @@ #include + +#include "ompi_tm_rename.h" + #include "tm_tree.h" tm_topology_t* get_local_topo_with_hwloc(void); diff --git a/ompi/mca/topo/treematch/treematch/tm_tree.c b/ompi/mca/topo/treematch/treematch/tm_tree.c index 11d3e46a2db..8086e245d90 100644 --- a/ompi/mca/topo/treematch/treematch/tm_tree.c +++ b/ompi/mca/topo/treematch/treematch/tm_tree.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include #include #include @@ -32,57 +34,58 @@ static int verbose_level = ERROR; static int exhaustive_search_flag = 0; -void free_list_child(tm_tree_t *);void free_tab_child(tm_tree_t *); -double choose (long, long);void display_node(tm_tree_t *); -void clone_tree(tm_tree_t *, tm_tree_t *); -double *aggregate_obj_weight(tm_tree_t *, double *, int); -tm_affinity_mat_t *aggregate_com_mat(tm_tree_t *, tm_affinity_mat_t *, int); -double eval_grouping(tm_affinity_mat_t *, tm_tree_t **, int); -group_list_t *new_group_list(tm_tree_t **, double, group_list_t *); -void add_to_list(group_list_t *, tm_tree_t **, int, double); -void list_all_possible_groups(tm_affinity_mat_t *, tm_tree_t *, int, int, int, tm_tree_t **, group_list_t *); -int independent_groups(group_list_t **, int, group_list_t *, int); -void display_selection (group_list_t**, int, int, double); -void display_grouping (tm_tree_t *, int, int, double); -int recurs_select_independent_groups(group_list_t **, int, int, int, int, +static void free_list_child(tm_tree_t *); +static void free_tab_child(tm_tree_t *); +static double choose (long, long); +static void display_node(tm_tree_t *); +static void clone_tree(tm_tree_t *, tm_tree_t *); +static double *aggregate_obj_weight(tm_tree_t *, double *, int); +static tm_affinity_mat_t *aggregate_com_mat(tm_tree_t *, tm_affinity_mat_t *, int); +static double eval_grouping(tm_affinity_mat_t *, tm_tree_t **, int); +static group_list_t *new_group_list(tm_tree_t **, double, group_list_t *); +static void add_to_list(group_list_t *, tm_tree_t **, int, double); +static void list_all_possible_groups(tm_affinity_mat_t *, tm_tree_t *, int, int, int, tm_tree_t **, group_list_t *); +static int independent_groups(group_list_t **, int, group_list_t *, int); +static void display_selection (group_list_t**, int, int, double); +static void display_grouping (tm_tree_t *, int, int, double); +static int recurs_select_independent_groups(group_list_t **, int, int, int, int, int, double, double *, group_list_t **, group_list_t **); -int test_independent_groups(group_list_t **, int, int, int, int, int, double, double *, +static int test_independent_groups(group_list_t **, int, int, int, int, int, double, double *, group_list_t **, group_list_t **); -void delete_group_list(group_list_t *); -int group_list_id(const void*, const void*); -int group_list_asc(const void*, const void*); -int group_list_dsc(const void*, const void*); -int weighted_degree_asc(const void*, const void*); -int weighted_degree_dsc(const void*, const void*); -int select_independent_groups(group_list_t **, int, int, int, double *, group_list_t **, int, double); -int select_independent_groups_by_largest_index(group_list_t **, int, int, int, double *, +static void delete_group_list(group_list_t *); +static int group_list_id(const void*, const void*); +static int group_list_asc(const void*, const void*); +static int group_list_dsc(const void*, const void*); +static int weighted_degree_asc(const void*, const void*); +static int weighted_degree_dsc(const void*, const void*); +static int select_independent_groups(group_list_t **, int, int, int, double *, group_list_t **, int, double); +static int select_independent_groups_by_largest_index(group_list_t **, int, int, int, double *, group_list_t **, int, double); -void list_to_tab(group_list_t *, group_list_t **, int); -void display_tab_group(group_list_t **, int, int); -int independent_tab(tm_tree_t **, tm_tree_t **, int); -void compute_weighted_degree(group_list_t **, int, int); -void group(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int, int, double *, tm_tree_t **); -void fast_group(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int, int, double *, tm_tree_t **, int *, int); -int adjacency_asc(const void*, const void*); -int adjacency_dsc(const void*, const void*); - void super_fast_grouping(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int); -tm_affinity_mat_t *build_cost_matrix(tm_affinity_mat_t *, double *, double); -void group_nodes(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int , int, double*, double); -double fast_grouping(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int, double); -void complete_aff_mat(tm_affinity_mat_t **, int, int); -void complete_obj_weight(double **, int, int); -void create_dumb_tree(tm_tree_t *, int, tm_topology_t *); -void complete_tab_node(tm_tree_t **, int, int, int, tm_topology_t *); -void set_deb_tab_child(tm_tree_t *, tm_tree_t *, int); -tm_tree_t *build_level_topology(tm_tree_t *, tm_affinity_mat_t *, int, int, tm_topology_t *, double *, double *); -int check_constraints(tm_topology_t *, int **); -tm_tree_t *bottom_up_build_tree_from_topology(tm_topology_t *, tm_affinity_mat_t *, double *, double *); -void free_non_constraint_tree(tm_tree_t *); -void free_constraint_tree(tm_tree_t *); -void free_tab_double(double**, int); -void free_tab_int(int**, int ); +static void list_to_tab(group_list_t *, group_list_t **, int); +static void display_tab_group(group_list_t **, int, int); +static int independent_tab(tm_tree_t **, tm_tree_t **, int); +static void compute_weighted_degree(group_list_t **, int, int); +static void group(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int, int, double *, tm_tree_t **); +static void fast_group(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int, int, double *, tm_tree_t **, int *, int); +static int adjacency_asc(const void*, const void*); +static int adjacency_dsc(const void*, const void*); +static void super_fast_grouping(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int); +static tm_affinity_mat_t *build_cost_matrix(tm_affinity_mat_t *, double *, double); +static void group_nodes(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int , int, double*, double); +static double fast_grouping(tm_affinity_mat_t *, tm_tree_t *, tm_tree_t *, int, int, double); +static void complete_aff_mat(tm_affinity_mat_t **, int, int); +static void create_dumb_tree(tm_tree_t *, int, tm_topology_t *); +static void complete_tab_node(tm_tree_t **, int, int, int, tm_topology_t *); +static void set_deb_tab_child(tm_tree_t *, tm_tree_t *, int); +static tm_tree_t *build_level_topology(tm_tree_t *, tm_affinity_mat_t *, int, int, tm_topology_t *, double *, double *); +static int check_constraints(tm_topology_t *, int **); +static tm_tree_t *bottom_up_build_tree_from_topology(tm_topology_t *, tm_affinity_mat_t *, double *, double *); +static void free_non_constraint_tree(tm_tree_t *); +static void free_constraint_tree(tm_tree_t *); +static void free_tab_double(double**, int); +static void free_tab_int(int**, int ); static void partial_aggregate_aff_mat (int, void **, int); -void free_affinity_mat(tm_affinity_mat_t *aff_mat); +static void free_affinity_mat(tm_affinity_mat_t *aff_mat); int int_cmp_inc(const void* x1, const void* x2); diff --git a/ompi/mca/topo/treematch/treematch/tm_tree.h b/ompi/mca/topo/treematch/treematch/tm_tree.h index 6168f501618..b4a0c40812a 100644 --- a/ompi/mca/topo/treematch/treematch/tm_tree.h +++ b/ompi/mca/topo/treematch/treematch/tm_tree.h @@ -1,5 +1,8 @@ #ifndef __TM_TREE_H__ #define __TM_TREE_H__ + +#include "ompi_tm_rename.h" + #include #include "treematch.h" @@ -8,6 +11,7 @@ void display_tab(double **tab,int N); void set_node(tm_tree_t *node,tm_tree_t ** child, int arity,tm_tree_t *parent, int id,double val,tm_tree_t *tab_child,int depth); +void complete_obj_weight(double **tab, int mat_order, int K); typedef struct _group_list_t{ struct _group_list_t *next; diff --git a/ompi/mca/topo/treematch/treematch/tm_verbose.c b/ompi/mca/topo/treematch/treematch/tm_verbose.c index e360d7122b9..6a8105c9d77 100644 --- a/ompi/mca/topo/treematch/treematch/tm_verbose.c +++ b/ompi/mca/topo/treematch/treematch/tm_verbose.c @@ -1,3 +1,5 @@ +#include "ompi_tm_rename.h" + #include "tm_verbose.h" #include static unsigned int verbose_level = ERROR; diff --git a/ompi/mca/topo/treematch/treematch/tm_verbose.h b/ompi/mca/topo/treematch/treematch/tm_verbose.h index e16cbbc6c00..229cf0794a4 100644 --- a/ompi/mca/topo/treematch/treematch/tm_verbose.h +++ b/ompi/mca/topo/treematch/treematch/tm_verbose.h @@ -1,5 +1,7 @@ #include +#include "ompi_tm_rename.h" + #define NONE 0 /* output in stderr*/ #define CRITICAL 1 diff --git a/ompi/mca/topo/treematch/treematch/treematch.h b/ompi/mca/topo/treematch/treematch/treematch.h index e15e9ab5a4a..b4f50f754c0 100644 --- a/ompi/mca/topo/treematch/treematch/treematch.h +++ b/ompi/mca/topo/treematch/treematch/treematch.h @@ -1,6 +1,8 @@ #ifndef __TREEMATCH_H__ #define __TREEMATCH_H__ +#include "ompi_tm_rename.h" + /* size_t definition */ #include #include "tm_verbose.h"