Skip to content

Commit 59b9602

Browse files
Merge pull request #2102 from ggouaillardet/topic/oshCC
oshmem: add C++ wrapper compilers
2 parents fb34a21 + 77f30a4 commit 59b9602

File tree

7 files changed

+173
-206
lines changed

7 files changed

+173
-206
lines changed

config/oshmem_config_files.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
#
33
# Copyright (c) 2013 Mellanox Technologies, Inc.
44
# All rights reserved.
5-
# Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
5+
# Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
6+
# Copyright (c) 2017 Research Organization for Information Science
7+
# and Technology (RIST). All rights reserved.
68
# $COPYRIGHT$
79
#
810
# Additional copyrights may follow
@@ -23,6 +25,7 @@ AC_DEFUN([OSHMEM_CONFIG_FILES],[
2325
oshmem/tools/oshmem_info/Makefile
2426
oshmem/tools/wrappers/Makefile
2527
oshmem/tools/wrappers/shmemcc-wrapper-data.txt
28+
oshmem/tools/wrappers/shmemc++-wrapper-data.txt
2629
oshmem/tools/wrappers/shmemfort-wrapper-data.txt
2730
])
2831
])

examples/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# Copyright (c) 2011-2016 Cisco Systems, Inc. All rights reserved.
1414
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
1515
# Copyright (c) 2013 Mellanox Technologies, Inc. All rights reserved.
16+
# Copyright (c) 2017 Research Organization for Information Science
17+
# and Technology (RIST). All rights reserved.
1618
# $COPYRIGHT$
1719
#
1820
# Additional copyrights may follow
@@ -30,6 +32,7 @@ CCC = mpic++
3032
FC = mpifort
3133
JAVAC = mpijavac
3234
SHMEMCC = shmemcc
35+
SHMEMCXX = shmemc++
3336
SHMEMFC = shmemfort
3437

3538
# Using -g is not necessary, but it is helpful for example programs,
@@ -51,6 +54,7 @@ EXAMPLES = \
5154
hello_usempi \
5255
hello_usempif08 \
5356
hello_oshmem \
57+
hello_oshmemcxx \
5458
hello_oshmemfh \
5559
Hello.class \
5660
ring_c \
@@ -105,6 +109,7 @@ mpi:
105109
oshmem:
106110
@ if oshmem_info --parsable | grep oshmem:bindings:c:yes >/dev/null; then \
107111
$(MAKE) hello_oshmem; \
112+
$(MAKE) hello_oshmemcxx; \
108113
$(MAKE) ring_oshmem; \
109114
$(MAKE) oshmem_shmalloc; \
110115
$(MAKE) oshmem_circular_shift; \
@@ -146,6 +151,8 @@ Ring.class: Ring.java
146151

147152
hello_oshmem: hello_oshmem_c.c
148153
$(SHMEMCC) $(CFLAGS) $? -o $@
154+
hello_oshmemcxx: hello_oshmem_cxx.cc
155+
$(SHMEMCXX) $(CXXFLAGS) $? -o $@
149156
hello_oshmemfh: hello_oshmemfh.f90
150157
$(SHMEMFC) $(FCFLAGS) $? -o $@
151158

examples/Makefile.include

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
1515
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
1616
# Copyright (c) 2013 Mellanox Technologies, Inc. All rights reserved.
17+
# Copyright (c) 2017 Research Organization for Information Science
18+
# and Technology (RIST). All rights reserved.
1719
# $COPYRIGHT$
1820
#
1921
# Additional copyrights may follow
@@ -39,6 +41,7 @@ EXTRA_DIST += \
3941
examples/hello_usempi.f90 \
4042
examples/hello_usempif08.f90 \
4143
examples/hello_oshmem_c.c \
44+
examples/hello_oshmem_cxx.cc \
4245
examples/hello_oshmemfh.f90 \
4346
examples/ring_c.c \
4447
examples/ring_cxx.cc \

examples/hello_oshmem_cxx.cc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2014 Mellanox Technologies, Inc.
3+
* All rights reserved.
4+
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
5+
* Copyright (c) 2017 Research Organization for Information Science
6+
* and Technology (RIST). All rights reserved.
7+
* $COPYRIGHT$
8+
*
9+
* Additional copyrights may follow
10+
*
11+
* $HEADER$
12+
*/
13+
14+
#include <iostream>
15+
#include "shmem.h"
16+
17+
#if !defined(OSHMEM_SPEC_VERSION) || OSHMEM_SPEC_VERSION < 10200
18+
#error This application uses API 1.2 and up
19+
#endif
20+
21+
int main(int argc, char* argv[])
22+
{
23+
int proc, nproc;
24+
char name[SHMEM_MAX_NAME_LEN];
25+
int major, minor;
26+
27+
shmem_init();
28+
nproc = shmem_n_pes();
29+
proc = shmem_my_pe();
30+
shmem_info_get_name(name);
31+
shmem_info_get_version(&major, &minor);
32+
33+
std::cout << "Hello, world, I am " << proc << " of " << nproc << ": " << name
34+
<< " (version: " << major << "." << minor << ")" << std::endl;
35+
36+
shmem_finalize();
37+
38+
return 0;
39+
}

oshmem/tools/oshmem_info/param.c

Lines changed: 10 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* All rights reserved.
44
*
55
* Copyright (c) 2014-2017 Cisco Systems, Inc. All rights reserved
6-
* Copyright (c) 2014-2016 Research Organization for Information Science
6+
* Copyright (c) 2014-2017 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
88
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
99
* $COPYRIGHT$
@@ -49,24 +49,6 @@
4949

5050
const char *opal_info_deprecated_value = "deprecated-ompi-info-value";
5151

52-
static void append(char *dest, size_t max, int *first, char *src)
53-
{
54-
size_t len;
55-
56-
if (NULL == src) {
57-
return;
58-
}
59-
60-
len = max - strlen(dest);
61-
if (!(*first)) {
62-
strncat(dest, ", ", len);
63-
len = max - strlen(dest);
64-
}
65-
strncat(dest, src, len);
66-
*first = 0;
67-
}
68-
69-
7052
/*
7153
* do_config
7254
* Accepts:
@@ -81,33 +63,15 @@ static void append(char *dest, size_t max, int *first, char *src)
8163
*/
8264
void oshmem_info_do_config(bool want_all)
8365
{
84-
char *cxx;
85-
char *fortran_mpifh;
86-
char *fortran_usempi;
87-
char *fortran_usempif08;
88-
char *fortran_usempif08_compliance;
89-
char *fortran_have_ignore_tkr;
90-
char *fortran_have_f08_assumed_rank;
91-
char *fortran_build_f08_subarrays;
92-
char *fortran_have_optional_args;
93-
char *fortran_have_bind_c;
94-
char *fortran_have_private;
95-
char *fortran_have_abstract;
96-
char *fortran_have_asynchronous;
97-
char *fortran_have_procedure;
98-
char *fortran_have_c_funloc;
99-
char *fortran_08_using_wrappers_for_choice_buffer_functions;
100-
char *java;
66+
char *fortran;
10167
char *heterogeneous;
10268
char *memprofile;
10369
char *memdebug;
10470
char *debug;
10571
char *mpi_interface_warning;
10672
char *cprofiling;
10773
char *cxxprofiling;
108-
char *fortran_mpifh_profiling;
109-
char *fortran_usempi_profiling;
110-
char *fortran_usempif08_profiling;
74+
char *fortran_profiling;
11175
char *cxxexceptions;
11276
char *threads;
11377
char *have_dl;
@@ -146,94 +110,6 @@ void oshmem_info_do_config(bool want_all)
146110
paramcheck = "runtime";
147111
#endif
148112

149-
/* The current mpi_f08 implementation does not support Fortran
150-
subarrays. However, someday it may/will. Hence, I'm leaving
151-
in all the logic that checks to see whether subarrays are
152-
supported, but I'm just hard-coding
153-
OMPI_BUILD_FORTRAN_F08_SUBARRAYS to 0 (we used to have a
154-
prototype mpi_f08 module that implemented a handful of
155-
descriptor-based interfaces and supported subarrays, but that
156-
has been removed). */
157-
const int OMPI_BUILD_FORTRAN_F08_SUBARRAYS = 0;
158-
159-
/* setup the strings that don't require allocations*/
160-
cxx = OMPI_BUILD_CXX_BINDINGS ? "yes" : "no";
161-
if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_USEMPI_BINDINGS) {
162-
if (OMPI_FORTRAN_HAVE_IGNORE_TKR) {
163-
fortran_usempi = "yes (full: ignore TKR)";
164-
} else {
165-
fortran_usempi = "yes (limited: overloading)";
166-
}
167-
} else {
168-
fortran_usempi = "no";
169-
}
170-
fortran_usempif08 = OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_USEMPIF08_BINDINGS ? "yes" : "no";
171-
fortran_have_f08_assumed_rank = OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK ?
172-
"yes" : "no";
173-
fortran_build_f08_subarrays = OMPI_BUILD_FORTRAN_F08_SUBARRAYS ?
174-
"yes" : "no";
175-
fortran_have_optional_args = OMPI_FORTRAN_HAVE_OPTIONAL_ARGS ?
176-
"yes" : "no";
177-
fortran_have_bind_c = OMPI_FORTRAN_HAVE_BIND_C ? "yes" : "no";
178-
fortran_have_private = OMPI_FORTRAN_HAVE_PRIVATE ? "yes" : "no";
179-
fortran_have_abstract = OMPI_FORTRAN_HAVE_ABSTRACT ? "yes" : "no";
180-
fortran_have_asynchronous = OMPI_FORTRAN_HAVE_ASYNCHRONOUS ? "yes" : "no";
181-
fortran_have_procedure = OMPI_FORTRAN_HAVE_PROCEDURE ? "yes" : "no";
182-
fortran_have_c_funloc = OMPI_FORTRAN_HAVE_C_FUNLOC ? "yes" : "no";
183-
fortran_08_using_wrappers_for_choice_buffer_functions =
184-
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES ? "yes" : "no";
185-
186-
/* Build a string describing what level of compliance the mpi_f08
187-
module has */
188-
char f08_msg[1024];
189-
if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_USEMPIF08_BINDINGS) {
190-
191-
/* Do we have everything? */
192-
if (OMPI_BUILD_FORTRAN_F08_SUBARRAYS &&
193-
OMPI_FORTRAN_HAVE_PRIVATE &&
194-
OMPI_FORTRAN_HAVE_ABSTRACT &&
195-
OMPI_FORTRAN_HAVE_ASYNCHRONOUS &&
196-
OMPI_FORTRAN_HAVE_PROCEDURE &&
197-
OMPI_FORTRAN_HAVE_C_FUNLOC &&
198-
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES) {
199-
fortran_usempif08_compliance = "The mpi_f08 module is available, and is fully compliant. w00t!";
200-
} else {
201-
int first = 1;
202-
snprintf(f08_msg, sizeof(f08_msg),
203-
"The mpi_f08 module is available, but due to limitations in the %s compiler and/or Open MPI, does not support the following: ",
204-
OMPI_FC);
205-
if (!OMPI_BUILD_FORTRAN_F08_SUBARRAYS) {
206-
append(f08_msg, sizeof(f08_msg), &first, "array subsections");
207-
}
208-
if (!OMPI_FORTRAN_HAVE_PRIVATE) {
209-
append(f08_msg, sizeof(f08_msg), &first,
210-
"private MPI_Status members");
211-
}
212-
if (!OMPI_FORTRAN_HAVE_ABSTRACT) {
213-
append(f08_msg, sizeof(f08_msg), &first,
214-
"ABSTRACT INTERFACE function pointers");
215-
}
216-
if (!OMPI_FORTRAN_HAVE_ASYNCHRONOUS) {
217-
append(f08_msg, sizeof(f08_msg), &first,
218-
"Fortran '08-specified ASYNCHRONOUS behavior");
219-
}
220-
if (!OMPI_FORTRAN_HAVE_PROCEDURE) {
221-
append(f08_msg, sizeof(f08_msg), &first, "PROCEDUREs");
222-
}
223-
if (!OMPI_FORTRAN_HAVE_C_FUNLOC) {
224-
append(f08_msg, sizeof(f08_msg), &first, "C_FUNLOCs");
225-
}
226-
if (OMPI_FORTRAN_NEED_WRAPPER_ROUTINES) {
227-
append(f08_msg, sizeof(f08_msg), &first,
228-
"direct passthru (where possible) to underlying Open MPI's C functionality");
229-
}
230-
fortran_usempif08_compliance = f08_msg;
231-
}
232-
} else {
233-
fortran_usempif08_compliance = "The mpi_f08 module was not built";
234-
}
235-
236-
java = OMPI_WANT_JAVA_BINDINGS ? "yes" : "no";
237113
heterogeneous = OPAL_ENABLE_HETEROGENEOUS_SUPPORT ? "yes" : "no";
238114
memprofile = OPAL_ENABLE_MEM_PROFILE ? "yes" : "no";
239115
memdebug = OPAL_ENABLE_MEM_DEBUG ? "yes" : "no";
@@ -242,9 +118,7 @@ void oshmem_info_do_config(bool want_all)
242118
cprofiling = "yes";
243119
cxxprofiling = OMPI_BUILD_CXX_BINDINGS ? "yes" : "no";
244120
cxxexceptions = (OMPI_BUILD_CXX_BINDINGS && OMPI_HAVE_CXX_EXCEPTION_SUPPORT) ? "yes" : "no";
245-
fortran_mpifh_profiling = (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) ? "yes" : "no";
246-
fortran_usempi_profiling = (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_USEMPI_BINDINGS) ? "yes" : "no";
247-
fortran_usempif08_profiling = (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_USEMPIF08_BINDINGS) ? "yes" : "no";
121+
fortran_profiling = (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) ? "yes" : "no";
248122
have_dl = OPAL_HAVE_DL_SUPPORT ? "yes" : "no";
249123
#if OMPI_RTE_ORTE
250124
mpirun_prefix_by_default = ORTE_WANT_ORTERUN_PREFIX_BY_DEFAULT ? "yes" : "no";
@@ -257,24 +131,13 @@ void oshmem_info_do_config(bool want_all)
257131

258132
/* setup strings that require allocation */
259133
if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) {
260-
(void)asprintf(&fortran_mpifh, "yes (%s)",
134+
(void)asprintf(&fortran, "yes (%s)",
261135
(OPAL_HAVE_WEAK_SYMBOLS ? "all" :
262136
(OMPI_FORTRAN_CAPS ? "caps" :
263137
(OMPI_FORTRAN_PLAIN ? "lower case" :
264138
(OMPI_FORTRAN_SINGLE_UNDERSCORE ? "single underscore" : "double underscore")))));
265139
} else {
266-
fortran_mpifh = strdup("no");
267-
}
268-
269-
if (OMPI_FORTRAN_HAVE_IGNORE_TKR) {
270-
/* OMPI_FORTRAN_IGNORE_TKR_PREDECL is already in quotes; it
271-
didn't work consistently to put it in _STRINGIFY because
272-
sometimes the compiler would actually interpret the pragma
273-
in there before stringify-ing it. */
274-
(void)asprintf(&fortran_have_ignore_tkr, "yes (%s)",
275-
OMPI_FORTRAN_IGNORE_TKR_PREDECL);
276-
} else {
277-
fortran_have_ignore_tkr = strdup("no");
140+
fortran = strdup("no");
278141
}
279142

280143
#if OMPI_RTE_ORTE
@@ -302,20 +165,8 @@ void oshmem_info_do_config(bool want_all)
302165
opal_info_out("Built host", "build:host", OMPI_BUILD_HOST);
303166

304167
opal_info_out("C bindings", "bindings:c", "yes");
305-
opal_info_out("C++ bindings", "bindings:cxx", cxx);
306-
opal_info_out("Fort mpif.h", "bindings:mpif.h", fortran_mpifh);
307-
free(fortran_mpifh);
308-
opal_info_out("Fort use mpi", "bindings:use_mpi",
309-
fortran_usempi);
310-
opal_info_out("Fort use mpi size", "bindings:use_mpi:size",
311-
opal_info_deprecated_value);
312-
opal_info_out("Fort use mpi_f08", "bindings:use_mpi_f08",
313-
fortran_usempif08);
314-
opal_info_out("Fort mpi_f08 compliance", "bindings:use_mpi_f08:compliance",
315-
fortran_usempif08_compliance);
316-
opal_info_out("Fort mpi_f08 subarrays", "bindings:use_mpi_f08:subarrays-supported",
317-
fortran_build_f08_subarrays);
318-
opal_info_out("Java bindings", "bindings:java", java);
168+
opal_info_out("Fort shmem.fh", "bindings:fortran", fortran);
169+
free(fortran);
319170

320171
opal_info_out("Wrapper compiler rpath", "compiler:all:rpath",
321172
WRAPPER_RPATH_SUPPORT);
@@ -362,36 +213,6 @@ void oshmem_info_do_config(bool want_all)
362213
opal_info_out("Fort compiler", "compiler:fortran:command", OMPI_FC);
363214
opal_info_out("Fort compiler abs", "compiler:fortran:absolute",
364215
OMPI_FC_ABSOLUTE);
365-
opal_info_out("Fort ignore TKR", "compiler:fortran:ignore_tkr",
366-
fortran_have_ignore_tkr);
367-
free(fortran_have_ignore_tkr);
368-
opal_info_out("Fort 08 assumed shape",
369-
"compiler:fortran:f08_assumed_rank",
370-
fortran_have_f08_assumed_rank);
371-
opal_info_out("Fort optional args",
372-
"compiler:fortran:optional_arguments",
373-
fortran_have_optional_args);
374-
opal_info_out("Fort BIND(C)",
375-
"compiler:fortran:bind_c",
376-
fortran_have_bind_c);
377-
opal_info_out("Fort PRIVATE",
378-
"compiler:fortran:private",
379-
fortran_have_private);
380-
opal_info_out("Fort ABSTRACT",
381-
"compiler:fortran:abstract",
382-
fortran_have_abstract);
383-
opal_info_out("Fort ASYNCHRONOUS",
384-
"compiler:fortran:asynchronous",
385-
fortran_have_asynchronous);
386-
opal_info_out("Fort PROCEDURE",
387-
"compiler:fortran:procedure",
388-
fortran_have_procedure);
389-
opal_info_out("Fort C_FUNLOC",
390-
"compiler:fortran:c_funloc",
391-
fortran_have_c_funloc);
392-
opal_info_out("Fort f08 using wrappers",
393-
"compiler:fortran:08_wrappers",
394-
fortran_08_using_wrappers_for_choice_buffer_functions);
395216

396217
if (want_all) {
397218

@@ -528,13 +349,8 @@ void oshmem_info_do_config(bool want_all)
528349

529350
opal_info_out("C profiling", "option:profiling:c", cprofiling);
530351
opal_info_out("C++ profiling", "option:profiling:cxx", cxxprofiling);
531-
opal_info_out("Fort mpif.h profiling", "option:profiling:mpif.h",
532-
fortran_mpifh_profiling);
533-
opal_info_out("Fort use mpi profiling", "option:profiling:use_mpi",
534-
fortran_usempi_profiling);
535-
opal_info_out("Fort use mpi_f08 prof",
536-
"option:profiling:use_mpi_f08",
537-
fortran_usempif08_profiling);
352+
opal_info_out("Fort shmem.fh profiling", "option:profiling:shmem.fh",
353+
fortran_profiling);
538354

539355
opal_info_out("C++ exceptions", "option:cxx_exceptions", cxxexceptions);
540356
opal_info_out("Thread support", "option:threads", threads);

0 commit comments

Comments
 (0)