Skip to content

Commit e443621

Browse files
committed
Added an initial implementation of partitioned communication.
Signed-off-by: Matthew G. F. Dosanjh <[email protected]>
1 parent 43e3add commit e443621

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4379
-3
lines changed

ompi/include/mpi.h.in

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved
1313
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
1414
* Copyright (c) 2009-2012 Oak Rigde National Laboratory. All rights reserved.
15-
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
15+
* Copyright (c) 2011-2020 Sandia National Laboratories. All rights reserved.
1616
* Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* Copyright (c) 2011-2013 INRIA. All rights reserved.
@@ -1618,6 +1618,17 @@ OMPI_DECLSPEC int MPI_Isend(const void *buf, int count, MPI_Datatype datatype,
16181618
int tag, MPI_Comm comm, MPI_Request *request);
16191619
OMPI_DECLSPEC int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest,
16201620
int tag, MPI_Comm comm, MPI_Request *request);
1621+
OMPI_DECLSPEC int MPI_Precv_init(const void* buf, int partitions, MPI_Count count,
1622+
MPI_Datatype datatype, int source, int tag, MPI_Comm comm,
1623+
MPI_Request *request);
1624+
OMPI_DECLSPEC int MPI_Psend_init(const void* buf, int partitions, MPI_Count count,
1625+
MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
1626+
MPI_Request *request);
1627+
OMPI_DECLSPEC int MPI_Pready(int partitions, MPI_Request request);
1628+
OMPI_DECLSPEC int MPI_Pready_range(int partition_low, int partition_high,
1629+
MPI_Request request);
1630+
OMPI_DECLSPEC int MPI_Pready_list(int length, int partition_list[], MPI_Request request);
1631+
OMPI_DECLSPEC int MPI_Parrived(MPI_Request request, MPI_Count partition, int *flag);
16211632
OMPI_DECLSPEC int MPI_Is_thread_main(int *flag);
16221633
OMPI_DECLSPEC int MPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name);
16231634
OMPI_DECLSPEC MPI_Fint MPI_Message_c2f(MPI_Message message);
@@ -2279,6 +2290,17 @@ OMPI_DECLSPEC int PMPI_Isend(const void *buf, int count, MPI_Datatype datatype,
22792290
int tag, MPI_Comm comm, MPI_Request *request);
22802291
OMPI_DECLSPEC int PMPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest,
22812292
int tag, MPI_Comm comm, MPI_Request *request);
2293+
OMPI_DECLSPEC int PMPI_Precv_init(const void* buf, int partitions, MPI_Count count,
2294+
MPI_Datatype datatype, int source, int tag, MPI_Comm comm,
2295+
MPI_Request *request);
2296+
OMPI_DECLSPEC int PMPI_Psend_init(const void* buf, int partitions, MPI_Count count,
2297+
MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
2298+
MPI_Request *request);
2299+
OMPI_DECLSPEC int PMPI_Pready(int partitions, MPI_Request request);
2300+
OMPI_DECLSPEC int PMPI_Pready_range(int partition_low, int partition_high,
2301+
MPI_Request request);
2302+
OMPI_DECLSPEC int PMPI_Pready_list(int length, int partition_list[], MPI_Request request);
2303+
OMPI_DECLSPEC int PMPI_Parrived(MPI_Request request, MPI_Count partition, int *flag);
22822304
OMPI_DECLSPEC int PMPI_Is_thread_main(int *flag);
22832305
OMPI_DECLSPEC int PMPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name);
22842306
OMPI_DECLSPEC MPI_Fint PMPI_Message_c2f(MPI_Message message);

ompi/mca/part/Makefile.am

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
# University Research and Technology
4+
# Corporation. All rights reserved.
5+
# Copyright (c) 2004-2005 The University of Tennessee and The University
6+
# of Tennessee Research Foundation. All rights
7+
# reserved.
8+
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
# University of Stuttgart. All rights reserved.
10+
# Copyright (c) 2004-2005 The Regents of the University of California.
11+
# All rights reserved.
12+
# Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
13+
# Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
14+
# $COPYRIGHT$
15+
#
16+
# Additional copyrights may follow
17+
#
18+
# $HEADER$
19+
#
20+
21+
# main library setup
22+
noinst_LTLIBRARIES = libmca_part.la
23+
libmca_part_la_SOURCES =
24+
25+
# local files
26+
headers = part.h
27+
libmca_part_la_SOURCES += $(headers) $(nodist_headers)
28+
29+
# Conditionally install the header files
30+
if WANT_INSTALL_HEADERS
31+
ompidir = $(ompiincludedir)/$(subdir)
32+
nobase_ompi_HEADERS = $(headers)
33+
nobase_nodist_ompi_HEADERS = $(nodist_headers)
34+
endif
35+
36+
include base/Makefile.am
37+
38+
distclean-local:
39+
rm -f base/static-components.h

ompi/mca/part/base/Makefile.am

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
3+
# $COPYRIGHT$
4+
#
5+
# Additional copyrights may follow
6+
#
7+
# $HEADER$
8+
#
9+
10+
headers += \
11+
base/base.h \
12+
base/part_base_prequest.h \
13+
base/part_base_precvreq.h \
14+
base/part_base_psendreq.h
15+
16+
libmca_part_la_SOURCES += \
17+
base/part_base_frame.c \
18+
base/part_base_precvreq.c \
19+
base/part_base_prequest.c \
20+
base/part_base_select.c \
21+
base/part_base_psendreq.c

ompi/mca/part/base/base.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; -*- */
2+
/*
3+
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
4+
* University Research and Technology
5+
* Corporation. All rights reserved.
6+
* Copyright (c) 2004-2007 The University of Tennessee and The University
7+
* of Tennessee Research Foundation. All rights
8+
* reserved.
9+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
* University of Stuttgart. All rights reserved.
11+
* Copyright (c) 2004-2005 The Regents of the University of California.
12+
* All rights reserved.
13+
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
14+
* Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#ifndef MCA_PART_BASE_H
23+
#define MCA_PART_BASE_H
24+
25+
#include "ompi_config.h"
26+
27+
#include "ompi/mca/mca.h"
28+
#include "opal/mca/base/mca_base_framework.h"
29+
#include "opal/class/opal_list.h"
30+
#include "opal/class/opal_pointer_array.h"
31+
32+
#include "ompi/mca/part/part.h"
33+
34+
/*
35+
* Global functions for PART
36+
*/
37+
38+
BEGIN_C_DECLS
39+
40+
/*
41+
* This is the base priority for a PART wrapper component
42+
* If there exists more than one then it is undefined
43+
* which one is picked.
44+
*/
45+
#define PART_SELECT_WRAPPER_PRIORITY -128
46+
47+
/*
48+
* MCA framework
49+
*/
50+
OMPI_DECLSPEC extern mca_base_framework_t ompi_part_base_framework;
51+
52+
/*
53+
* Select an available component.
54+
*/
55+
OMPI_DECLSPEC int mca_part_base_select(bool enable_progress_threads,
56+
bool enable_mpi_threads);
57+
58+
OMPI_DECLSPEC int mca_part_base_progress(void);
59+
60+
OMPI_DECLSPEC int mca_part_base_finalize(void);
61+
62+
/*
63+
* Globals
64+
*/
65+
OMPI_DECLSPEC extern mca_part_base_component_t mca_part_base_selected_component;
66+
OMPI_DECLSPEC extern mca_part_base_module_t mca_part;
67+
OMPI_DECLSPEC extern opal_pointer_array_t mca_part_base_part;
68+
69+
END_C_DECLS
70+
71+
#endif /* MCA_PART_BASE_H */

ompi/mca/part/base/part_base_frame.c

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
4+
* University Research and Technology
5+
* Corporation. All rights reserved.
6+
* Copyright (c) 2004-2007 The University of Tennessee and The University
7+
* of Tennessee Research Foundation. All rights
8+
* reserved.
9+
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
10+
* University of Stuttgart. All rights reserved.
11+
* Copyright (c) 2004-2005 The Regents of the University of California.
12+
* All rights reserved.
13+
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
15+
* reserved.
16+
* Copyright (c) 2015 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
18+
* Copyright (c) 2018 IBM Corporation. All rights reserved.
19+
* Copyright (c) 2020 Intel, Inc. All rights reserved.
20+
* Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
21+
* $COPYRIGHT$
22+
*
23+
* Additional copyrights may follow
24+
*
25+
* $HEADER$
26+
*/
27+
28+
29+
#include "ompi_config.h"
30+
#include <stdio.h>
31+
32+
#include <string.h>
33+
#ifdef HAVE_UNISTD_H
34+
#include <unistd.h>
35+
#endif /* HAVE_UNIST_H */
36+
#include "ompi/mca/mca.h"
37+
#include "opal/util/output.h"
38+
#include "opal/mca/base/base.h"
39+
40+
41+
#include "ompi/constants.h"
42+
#include "ompi/mca/part/part.h"
43+
#include "ompi/mca/part/base/base.h"
44+
#include "ompi/mca/part/base/part_base_prequest.h"
45+
46+
/*
47+
* The following file was created by configure. It contains extern
48+
* statements and the definition of an array of pointers to each
49+
* component's public mca_base_component_t struct.
50+
*/
51+
52+
#include "ompi/mca/part/base/static-components.h"
53+
54+
/*
55+
* This function allows modules to not declare a progress function,
56+
* by defaulting to doing nothing.
57+
*/
58+
int mca_part_base_progress(void)
59+
{
60+
return OMPI_SUCCESS;
61+
}
62+
63+
#define xstringify(part) #part
64+
#define stringify(part) xstringify(part)
65+
66+
/*
67+
* Global variables
68+
*/
69+
mca_part_base_module_t mca_part = {
70+
mca_part_base_progress, /* part_progress */
71+
NULL, /* part_precv_init */
72+
NULL, /* part_psend_init */
73+
NULL, /* part_start */
74+
NULL, /* part_pready */
75+
NULL /* part_parrived */
76+
};
77+
78+
mca_part_base_component_t mca_part_base_selected_component = {{0}};
79+
opal_pointer_array_t mca_part_base_part = {{0}};
80+
81+
static int mca_part_base_register(mca_base_register_flag_t flags)
82+
{
83+
return OMPI_SUCCESS;
84+
}
85+
86+
int mca_part_base_finalize(void) {
87+
if (NULL != mca_part_base_selected_component.partm_finalize) {
88+
return mca_part_base_selected_component.partm_finalize();
89+
}
90+
return OMPI_SUCCESS;
91+
}
92+
93+
94+
static int mca_part_base_close(void)
95+
{
96+
int i, j;
97+
98+
/* unregister the progress function */
99+
if( NULL != mca_part.part_progress ) {
100+
opal_progress_unregister(mca_part.part_progress);
101+
}
102+
103+
/* reset the progress function to do nothing */
104+
mca_part.part_progress = mca_part_base_progress;
105+
106+
/* Free all the strings in the array of components */
107+
j = opal_pointer_array_get_size(&mca_part_base_part);
108+
for (i = 0; i < j; ++i) {
109+
char *str;
110+
str = (char*) opal_pointer_array_get_item(&mca_part_base_part, i);
111+
free(str);
112+
}
113+
OBJ_DESTRUCT(&mca_part_base_part);
114+
115+
OBJ_DESTRUCT(&mca_part_base_psend_requests);
116+
OBJ_DESTRUCT(&mca_part_base_precv_requests);
117+
118+
/* Close all remaining available components */
119+
return mca_base_framework_components_close(&ompi_part_base_framework, NULL);
120+
}
121+
122+
/**
123+
* Function for finding and opening either all MCA components, or the one
124+
* that was specifically requested via a MCA parameter.
125+
*/
126+
static int mca_part_base_open(mca_base_open_flag_t flags)
127+
{
128+
OBJ_CONSTRUCT(&mca_part_base_part, opal_pointer_array_t);
129+
130+
131+
OBJ_CONSTRUCT(&mca_part_base_psend_requests, opal_free_list_t);
132+
OBJ_CONSTRUCT(&mca_part_base_precv_requests, opal_free_list_t);
133+
/* Open up all available components */
134+
135+
if (OPAL_SUCCESS !=
136+
mca_base_framework_components_open(&ompi_part_base_framework, flags)) {
137+
return OMPI_ERROR;
138+
}
139+
140+
/* Set a sentinel in case we don't select any components (e.g.,
141+
ompi_info) */
142+
143+
mca_part_base_selected_component.partm_finalize = NULL;
144+
145+
/* Currently this uses a default with no selection criteria as there is only 1 module. */
146+
opal_pointer_array_add(&mca_part_base_part, strdup("rma"));
147+
148+
return OMPI_SUCCESS;
149+
}
150+
151+
MCA_BASE_FRAMEWORK_DECLARE(ompi, part, "OMPI PART", mca_part_base_register,
152+
mca_part_base_open, mca_part_base_close,
153+
mca_part_base_static_components, 0);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2007 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
13+
* $COPYRIGHT$
14+
*
15+
* Additional copyrights may follow
16+
*
17+
* $HEADER$
18+
*/
19+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
20+
21+
#include "ompi_config.h"
22+
#include "ompi/types.h"
23+
#include "ompi/mca/part/part.h"
24+
#include "ompi/mca/part/base/part_base_precvreq.h"
25+
26+
27+
static void mca_part_base_precv_request_construct(mca_part_base_precv_request_t*);
28+
static void mca_part_base_precv_request_destruct(mca_part_base_precv_request_t*);
29+
30+
31+
OBJ_CLASS_INSTANCE(
32+
mca_part_base_precv_request_t,
33+
mca_part_base_prequest_t,
34+
mca_part_base_precv_request_construct,
35+
mca_part_base_precv_request_destruct
36+
);
37+
38+
39+
static void mca_part_base_precv_request_construct(mca_part_base_precv_request_t* request)
40+
{
41+
OBJ_CONSTRUCT(&request->req_base.req_convertor, opal_convertor_t);
42+
}
43+
44+
45+
static void mca_part_base_precv_request_destruct(mca_part_base_precv_request_t* request)
46+
{
47+
/* For each request the convertor get cleaned after each message
48+
* (in the base _FINI macro). Therefore, as the convertor is a static object
49+
* we don't have to call OBJ_DESTRUCT here.
50+
*/
51+
}
52+

0 commit comments

Comments
 (0)