Skip to content

Commit e239de5

Browse files
committed
Create a new topology framework using the TreeMatch library developped
at Inria Bordeaux. This allows us to take advantage of the remap capability of MPI to rearrange the ranks beased on the weights povided by the application. Fix the indentation and protect with __DEBUG__ one fprintf. Add the Cecill-B license to the imported library. Fix a compiler warning. Restrict the TreeMatch dependencies. The TreeMatch software is released under BSD3 (as indicated by their copyright information @ https://gforge.inria.fr/scm/viewvc.php/COPYING?view=markup&root=treematch). Update the README.
1 parent 5b9f59b commit e239de5

34 files changed

+8400
-1
lines changed

README

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
22
University Research and Technology
33
Corporation. All rights reserved.
4-
Copyright (c) 2004-2007 The University of Tennessee and The University
4+
Copyright (c) 2004-2015 The University of Tennessee and The University
55
of Tennessee Research Foundation. All rights
66
reserved.
77
Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -436,6 +436,9 @@ General Run-Time Support Notes
436436
MPI Functionality and Features
437437
------------------------------
438438

439+
- Rank reordering support is available using the TreeMatch library. It is activated
440+
for the graph and dist_graph topologies.
441+
439442
- All MPI-3 functionality is supported.
440443

441444
- When using MPI deprecated functions, some compilers will emit
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#
2+
# Copyright (c) 2011-2015 The University of Tennessee and The University
3+
# of Tennessee Research Foundation. All rights
4+
# reserved.
5+
# Copyright (c) 2011-2015 INRIA. All rights reserved.
6+
# Copyright (c) 2011-2015 Université Bordeaux 1
7+
# $COPYRIGHT$
8+
#
9+
# Additional copyrights may follow
10+
#
11+
# $HEADER$
12+
#
13+
14+
if topo_treematch_local
15+
extra_treematch_files = treematch/tm_bucket.h \
16+
treematch/tm_hwloc.h treematch/tm_mapping.h \
17+
treematch/tm_timings.h treematch/tm_tree.h \
18+
treematch/tm_kpartitioning.h treematch/uthash.h\
19+
treematch/IntConstantInitializedVector.h \
20+
treematch/tm_mt.h \
21+
treematch/tm_thread_pool.h treematch/tm_verbose.h \
22+
treematch/tm_malloc.h \
23+
treematch/IntConstantInitializedVector.c \
24+
treematch/tm_mt.c \
25+
treematch/tm_thread_pool.c treematch/tm_verbose.c \
26+
treematch/tm_malloc.c \
27+
treematch/tm_mapping.c treematch/tm_timings.c \
28+
treematch/tm_bucket.c treematch/tm_tree.c \
29+
treematch/tm_hwloc.c treematch/tm_kpartitioning.c
30+
endif
31+
32+
sources = \
33+
topo_treematch.h \
34+
topo_treematch_module.c \
35+
topo_treematch_component.c \
36+
topo_treematch_dist_graph_create.c $(extra_treematch_files)
37+
38+
# Make the output library in this directory, and name it either
39+
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
40+
# (for static builds).
41+
42+
if MCA_BUILD_ompi_topo_treematch_DSO
43+
lib =
44+
lib_sources =
45+
component = mca_topo_treematch.la
46+
component_sources = $(sources)
47+
else
48+
lib = libmca_topo_treematch.la
49+
lib_sources = $(sources)
50+
component =
51+
component_sources =
52+
endif
53+
54+
mcacomponentdir = $(pkglibdir)
55+
mcacomponent_LTLIBRARIES = $(component)
56+
mca_topo_treematch_la_SOURCES = $(component_sources)
57+
mca_topo_treematch_la_LDFLAGS = -module -avoid-version
58+
59+
noinst_LTLIBRARIES = $(lib)
60+
libmca_topo_treematch_la_SOURCES = $(lib_sources)
61+
libmca_topo_treematch_la_LDFLAGS = -module -avoid-version
62+
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2011-2015 The University of Tennessee and The University
4+
# of Tennessee Research Foundation. All rights
5+
# reserved.
6+
# Copyright (c) 2011-2015 INRIA. All rights reserved.
7+
# Copyright (c) 2011-2015 Universite Bordeaux 1
8+
# $COPYRIGHT$
9+
#
10+
# Additional copyrights may follow
11+
#
12+
# $HEADER$
13+
#
14+
15+
# MCA_ompi_topo_treematch_CONFIG([action-if-can-compile],
16+
# [action-if-cant-compile])
17+
# -------------------------------------------
18+
AC_DEFUN([MCA_ompi_topo_treematch_CONFIG], [
19+
AC_REQUIRE([MCA_opal_hwloc_CONFIG_REQUIRE])
20+
21+
AC_ARG_WITH([treematch],
22+
[AC_HELP_STRING([--with-treematch(=DIR)],
23+
[Build TreeMatch topology support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])],
24+
[],
25+
[with_treematch=yes])
26+
AC_ARG_WITH([treematch-include],
27+
[AC_HELP_STRING([--with-treematch-include(=DIR)],
28+
["Search for TreeMatch headers in DIR"])])
29+
AC_ARG_WITH([treematch-libdir],
30+
[AC_HELP_STRING([--with-treematch-libdir(=DIR)],
31+
["Search for TreeMatch libraries in DIR"])])
32+
33+
treematch_files_local="no"
34+
ompi_check_treematch_dir=$srcdir
35+
ompi_check_treematch_libdir=""
36+
ompi_check_treematch_happy="no"
37+
38+
AS_IF([test "x$with_treematch" != xno],
39+
[AC_MSG_CHECKING([TreeMatch headers])
40+
AS_IF([test "x$with_treematch_include" = x],
41+
[AS_IF([test "x$with_treematch" = xyes],
42+
[treematch_files_local="yes"
43+
with_treematch_include=$OMPI_TOP_SRCDIR/ompi/mca/topo/treematch/treematch],
44+
[with_treematch_include=$with_treematch/include])])
45+
AS_IF([test -f $with_treematch_include/tm_tree.h],
46+
[AS_IF([test "x$with_treematch" = xyes],
47+
[AC_MSG_RESULT([in the source])],
48+
[AC_MSG_RESULT([user provided])])
49+
opal_check_treematch_dir=$with_treematch_include
50+
ompi_check_treematch_happy="yes"],
51+
[AC_MSG_ERROR([missing tm_tree.h (${with_treematch}:${with_treematch_include})])])])
52+
53+
AS_IF([test "$ompi_check_treematch_happy" = "yes"],
54+
[AC_MSG_CHECKING([TreeMatch library])
55+
OPAL_CHECK_WITHDIR([treematch], [$with_treematch_include], [tm_tree.h])
56+
AS_IF([test "x$with_treematch_libdir" = x],
57+
[AS_IF([test "x$with_treematch" != xyes],
58+
[with_treematch_libdir=$with_treematch/lib]
59+
[with_treematch_libdir=$OMPI_TOP_SRCDIR/ompi/mca/topo/treematch/treematch])])
60+
AS_IF([test "x$treematch_files_local" = xno],
61+
[OPAL_CHECK_WITHDIR([treematch-libdir], [$with_treematch_libdir], [libtreematch.*])
62+
AS_IF([test "x$with_treematch" != xno -a "x$with_treematch" != xyes],
63+
[AS_IF([test ! -z "$with_treematch" -a "$with_treematch" != "yes"],
64+
[ompi_check_treematch_dir="$with_treematch"])
65+
AS_IF([test ! -z "$with_treematch_libdir" -a "$with_treematch_libdir" != "yes"],
66+
[ompi_check_treematch_libdir="$with_treematch_libdir"])
67+
OPAL_CHECK_PACKAGE([topo_treematch],
68+
[tm_tree.h],
69+
[treematch],
70+
[build_tree],
71+
[],
72+
[$with_treematch_include],
73+
[$with_treematch_libdir],
74+
[ompi_check_treematch_happy="yes"],
75+
[ompi_check_treematch_happy="no"])],
76+
[ompi_check_treematch_happy="no"])])])
77+
78+
AS_IF([test "$ompi_check_treematch_happy" = "yes"],
79+
[$1],
80+
[AS_IF([test ! -z "$with_treematch" -a "$with_treematch" != "no"],
81+
[AC_MSG_ERROR([TreeMatch support requested but not found. Aborting])])
82+
$2])
83+
84+
AC_CONFIG_FILES([ompi/mca/topo/treematch/Makefile])
85+
AM_CONDITIONAL(topo_treematch_local,
86+
[test "x$treematch_files_local" = "xyes"])
87+
])
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (c) 2011-2015 The University of Tennessee and The University
3+
* of Tennessee Research Foundation. All rights
4+
* reserved.
5+
* Copyright (c) 2011-2015 INRIA. All rights reserved.
6+
* Copyright (c) 2011-2015 Bordeaux Polytechnic Institute
7+
* $COPYRIGHT$
8+
*
9+
* Additional copyrights may follow
10+
*
11+
* $HEADER$
12+
*/
13+
14+
#ifndef MCA_TOPO_UNTIY_H
15+
#define MCA_TOPO_UNTIY_H
16+
17+
#include "ompi_config.h"
18+
#include "ompi/mca/topo/topo.h"
19+
20+
/*
21+
* ******************************************************************
22+
* ******** functions which provide MCA interface comppliance *******
23+
* ******************************************************************
24+
* These functions are:
25+
* - mca_topo_treematch_module_open
26+
* - mca_topo_treematch_module_close
27+
* - mca_topo_treematch_module_query
28+
* - mca_topo_treematch_module_finalize
29+
* These functions are always found on the mca_topo_treematch_module
30+
* structure. They are the "meta" functions to ensure smooth op.
31+
* ******************************************************************
32+
*/
33+
BEGIN_C_DECLS
34+
35+
/*
36+
* Public component instance
37+
*/
38+
typedef struct mca_topo_treematch_component_2_2_0_t {
39+
mca_topo_base_component_2_2_0_t super;
40+
41+
int reorder_mode;
42+
} mca_topo_treematch_component_2_2_0_t;
43+
44+
OMPI_MODULE_DECLSPEC extern mca_topo_treematch_component_2_2_0_t
45+
mca_topo_treematch_component;
46+
47+
/*
48+
* A unique module class for the module so that we can both cache
49+
* module-specific information on the module and have a
50+
* module-specific constructor and destructor.
51+
*/
52+
typedef struct {
53+
mca_topo_base_module_t super;
54+
55+
/* Modules can add their own information here */
56+
} mca_topo_treematch_module_t;
57+
58+
OBJ_CLASS_DECLARATION(mca_topo_treematch_module_t);
59+
60+
61+
/*
62+
* Module functions
63+
*/
64+
65+
int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* module,
66+
ompi_communicator_t *comm_old,
67+
int n, int nodes[],
68+
int degrees[], int targets[],
69+
int weights[],
70+
struct ompi_info_t *info, int reorder,
71+
ompi_communicator_t **newcomm);
72+
/*
73+
* ******************************************************************
74+
* ************ functions implemented in this module end ************
75+
* ******************************************************************
76+
*/
77+
78+
END_C_DECLS
79+
80+
#endif /* MCA_TOPO_EXAMPLE_H */
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/*
2+
* Copyright (c) 2011-2015 The University of Tennessee and The University
3+
* of Tennessee Research Foundation. All rights
4+
* reserved.
5+
* Copyright (c) 2011-2015 INRIA. All rights reserved.
6+
* Copyright (c) 2011-2015 Université Bordeaux 1
7+
* $COPYRIGHT$
8+
*
9+
* Additional copyrights may follow
10+
*
11+
* $HEADER$
12+
*/
13+
14+
#include "ompi_config.h"
15+
#include "ompi/mca/topo/treematch/topo_treematch.h"
16+
17+
/*
18+
* Public string showing the topo treematch module version number
19+
*/
20+
const char *mca_topo_treematch_component_version_string =
21+
"Open MPI treematch topology MCA component version" OMPI_VERSION;
22+
23+
/*
24+
* Local funtions
25+
*/
26+
static int init_query(bool enable_progress_threads, bool enable_mpi_threads);
27+
static struct mca_topo_base_module_t *
28+
comm_query(const ompi_communicator_t *comm, int *priority, uint32_t type);
29+
static int mca_topo_treematch_component_register(void);
30+
31+
/*
32+
* Public component structure
33+
*/
34+
mca_topo_treematch_component_2_2_0_t mca_topo_treematch_component =
35+
{
36+
{
37+
{
38+
MCA_TOPO_BASE_VERSION_2_2_0,
39+
40+
"treematch",
41+
OMPI_MAJOR_VERSION,
42+
OMPI_MINOR_VERSION,
43+
OMPI_RELEASE_VERSION,
44+
NULL, /* component open */
45+
NULL, /* component close */
46+
NULL, /* component query */
47+
mca_topo_treematch_component_register, /* component register */
48+
},
49+
50+
{
51+
/* The component is checkpoint ready */
52+
MCA_BASE_METADATA_PARAM_CHECKPOINT
53+
},
54+
55+
init_query,
56+
comm_query
57+
},
58+
0 /* reorder: by default centralized */
59+
};
60+
61+
62+
static int init_query(bool enable_progress_threads, bool enable_mpi_threads)
63+
{
64+
if(NULL == opal_hwloc_topology) {
65+
return OPAL_ERR_NOT_SUPPORTED;
66+
}
67+
return OMPI_SUCCESS;
68+
}
69+
70+
71+
static struct mca_topo_base_module_t *
72+
comm_query(const ompi_communicator_t *comm, int *priority, uint32_t type)
73+
{
74+
mca_topo_treematch_module_t *treematch;
75+
76+
if( OMPI_COMM_DIST_GRAPH != type ) {
77+
return NULL;
78+
}
79+
treematch = OBJ_NEW(mca_topo_treematch_module_t);
80+
if (NULL == treematch) {
81+
return NULL;
82+
}
83+
treematch->super.topo.dist_graph.dist_graph_create = mca_topo_treematch_dist_graph_create;
84+
85+
/* This component has very low priority -- it's an treematch, after
86+
all! */
87+
*priority = 42;
88+
treematch->super.type = OMPI_COMM_DIST_GRAPH;
89+
return &(treematch->super);
90+
}
91+
92+
static int mca_topo_treematch_component_register(void)
93+
{
94+
(void)mca_base_component_var_register(&mca_topo_treematch_component.super.topoc_version,
95+
"reorder_mode", "If set the reordering will be done in a partially distributed way (default=0). If partially-distributed only local knowledge will be used, possibly leading to less accurate reordering.", MCA_BASE_VAR_TYPE_INT,
96+
NULL, 0, 0, OPAL_INFO_LVL_2,
97+
MCA_BASE_VAR_SCOPE_READONLY, &mca_topo_treematch_component.reorder_mode);
98+
return OMPI_SUCCESS;
99+
}
100+

0 commit comments

Comments
 (0)