Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treematch: use rename.h to properly prefix treematch symbols #8388

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "ompi_tm_rename.h"

#include <stdlib.h>
#include <stdio.h>
#include "IntConstantInitializedVector.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 2 additions & 0 deletions ompi/mca/topo/treematch/treematch/PriorityQueue.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "ompi_tm_rename.h"

#include <stdlib.h>
#include "PriorityQueue.h"

Expand Down
2 changes: 2 additions & 0 deletions ompi/mca/topo/treematch/treematch/fibo.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "ompi_tm_rename.h"

/* Copyright 2010 IPB, INRIA & CNRS
**
** This file originally comes from the Scotch software package for
Expand Down
33 changes: 17 additions & 16 deletions ompi/mca/topo/treematch/treematch/fibo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 +*/
Expand Down Expand Up @@ -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
Expand All @@ -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
24 changes: 13 additions & 11 deletions ompi/mca/topo/treematch/treematch/k-partitioning.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#include "ompi_tm_rename.h"

#include <stdlib.h>
#include <stdio.h>
#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)
{
Expand Down
2 changes: 2 additions & 0 deletions ompi/mca/topo/treematch/treematch/k-partitioning.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef K_PARTITIONING
#define K_PARTITIONING

#include "ompi_tm_rename.h"

#include "PriorityQueue.h"

/*
Expand Down
176 changes: 176 additions & 0 deletions ompi/mca/topo/treematch/treematch/ompi_tm_rename.h
Original file line number Diff line number Diff line change
@@ -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
41 changes: 21 additions & 20 deletions ompi/mca/topo/treematch/treematch/tm_bucket.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "ompi_tm_rename.h"

#include <stdio.h>
#include <float.h>
#include <math.h>
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions ompi/mca/topo/treematch/treematch/tm_bucket.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef __BUCKET_H__
#define __BUCKET_H__

#include "ompi_tm_rename.h"

typedef struct{
int i;
int j;
Expand Down
Loading