Skip to content

Commit 90f2d78

Browse files
committed
MPI C++ Datatypes: don't declare/define if no C++ support
Per MPI-3.1 A.1.1 p674, only define the C++ datatypes if we're actually building C++ support. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 7b73c86 commit 90f2d78

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

ompi/datatype/ompi_datatype_module.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2006 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
1616
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
@@ -106,7 +106,11 @@ ompi_predefined_datatype_t ompi_mpi_packed = OMPI_DATATYPE_INIT_PREDEFIN
106106
* C++ / C99 datatypes
107107
*/
108108
ompi_predefined_datatype_t ompi_mpi_c_bool = OMPI_DATATYPE_INIT_PREDEFINED (BOOL, OMPI_DATATYPE_FLAG_DATA_C);
109+
/* Per MPI-3.1 A.1.1 p674, only define the C++ datatypes if we're
110+
actually building C++ support */
111+
#if OMPI_BUILD_CXX_BINDINGS
109112
ompi_predefined_datatype_t ompi_mpi_cxx_bool = OMPI_DATATYPE_INIT_PREDEFINED (BOOL, OMPI_DATATYPE_FLAG_DATA_CPP);
113+
#endif
110114

111115
/*
112116
* Complex datatypes for C (base types), C++, and fortran
@@ -120,10 +124,14 @@ ompi_predefined_datatype_t ompi_mpi_c_long_double_complex = OMPI_DATATYPE_INIT_P
120124
ompi_predefined_datatype_t ompi_mpi_c_long_double_complex = OMPI_DATATYPE_INIT_UNAVAILABLE (C_LONG_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_COMPLEX );
121125
#endif /* HAVE_LONG_DOUBLE */
122126

127+
/* Per MPI-3.1 A.1.1 p674, only define the C++ datatypes if we're
128+
actually building C++ support */
129+
#if OMPI_BUILD_CXX_BINDINGS
123130
/* The C++ complex datatypes are the same as the C datatypes */
124131
ompi_predefined_datatype_t ompi_mpi_cxx_cplex = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE (C_FLOAT_COMPLEX, C_FLOAT_COMPLEX, OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX );
125132
ompi_predefined_datatype_t ompi_mpi_cxx_dblcplex = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE (C_DOUBLE_COMPLEX, C_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX );
126133
ompi_predefined_datatype_t ompi_mpi_cxx_ldblcplex = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE (C_LONG_DOUBLE_COMPLEX, C_LONG_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX );
134+
#endif
127135

128136
#if OMPI_HAVE_FORTRAN_COMPLEX
129137
ompi_predefined_datatype_t ompi_mpi_cplex = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE (OMPI_KIND_FORTRAN_COMPLEX, COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX );
@@ -325,7 +333,9 @@ const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX_PREDEF
325333
[OMPI_DATATYPE_MPI_PACKED] = &ompi_mpi_packed.dt,
326334

327335
/* C++ / C99 datatypes */
336+
#if OMPI_BUILD_CXX_BINDINGS
328337
[OMPI_DATATYPE_MPI_BOOL] = &ompi_mpi_cxx_bool.dt,
338+
#endif
329339

330340
/* Fortran datatypes */
331341
[OMPI_DATATYPE_MPI_LOGICAL] = &ompi_mpi_logical.dt,
@@ -600,10 +610,12 @@ int32_t ompi_datatype_init( void )
600610

601611
/* C++ types */
602612

613+
#if OMPI_BUILD_CXX_BINDINGS
603614
MOOG(cxx_bool, 54);
604615
MOOG(cxx_cplex, 55);
605616
MOOG(cxx_dblcplex, 56);
606617
MOOG(cxx_ldblcplex, 57);
618+
#endif
607619

608620
/* MPI 2.2 types */
609621
MOOG(int8_t, 58);

ompi/include/mpi.h.in

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
12+
* Copyright (c) 2007-2016 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.
1515
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
@@ -941,13 +941,17 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_long_double;
941941
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_wchar;
942942
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_packed;
943943

944+
/* Per MPI-3.1 A.1.1 p674, only define the C++ datatypes if we're
945+
actually building C++ support */
946+
#if defined(OMPI_BUILD_CXX_BINDINGS) && OMPI_BUILD_CXX_BINDINGS
944947
/*
945948
* Following are the C++/C99 datatypes
946949
*/
947950
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_cxx_bool;
948951
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_cxx_cplex;
949952
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_cxx_dblcplex;
950953
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_cxx_ldblcplex;
954+
#endif
951955

952956
/*
953957
* Following are the Fortran datatypes
@@ -1162,10 +1166,15 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;
11621166
#if HAVE_LONG_DOUBLE__COMPLEX
11631167
#define MPI_C_LONG_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_c_long_double_complex)
11641168
#endif
1169+
1170+
/* Per MPI-3.1 A.1.1 p674, only define the C++ datatypes if we're
1171+
actually building C++ support */
1172+
#if defined(OMPI_BUILD_CXX_BINDINGS) && OMPI_BUILD_CXX_BINDINGS
11651173
#define MPI_CXX_BOOL OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_bool)
11661174
#define MPI_CXX_FLOAT_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_cplex)
11671175
#define MPI_CXX_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_dblcplex)
11681176
#define MPI_CXX_LONG_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_ldblcplex)
1177+
#endif
11691178

11701179
/* New datatypes from the 3.0 standard */
11711180
#define MPI_COUNT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_count)

0 commit comments

Comments
 (0)