shmemcxx(1)
π shmemcxx β the Open SHMEM C++ wrapper compiler, bestie edition π
okay so real quick, the manual name situation: this page lives in section 1 of the Open MPI manual, and it's all about shmemcxx, the Open SHMEM C++ wrapper compiler. that's the vibe. let's go β¨
β¨ SYNTAX β¨
the whole entire mood, in one line:
shmemcxx [-showme|-showme:compile|-showme:link] ...
yeah that's it. she's simple. she's iconic. π
π OPTIONS π
--showmeβ okay so this one comes in a bunch of different variants (scroll down, bestie, they're all right here). none of the variants actually invoke the underlying compiler β they just tell you how the underlying compiler would have been invoked if you hadn't used--showme. the plain--showmespits out the command line that would be executed to compile your program. β οΈ NOTE: if you pass a non-filename argument on the command line, the-showmeoption will not display any additional flags. for example, bothshmemcxx --showmeandshmemcxx --showme my_source.cwill show all the wrapper-supplied flags. butshmemcxx --showme -vwill only show the underlying compiler name and-v. it's giving "selective" π--showme:compileβ outputs the compiler flags that would have been supplied to the C++ compiler. just the compile-y ones. π§--showme:linkβ outputs the linker flags that would have been supplied to the C++ compiler. the linking era. π--showme:commandβ outputs the underlying C++ compiler command (which may be one or more tokens, so don't be shocked if it's not just one word). π--showme:incdirsβ outputs a space-delimited (but otherwise undecorated, so like, raw, no frills) list of directories that the wrapper compiler would have provided to the underlying C++ compiler to indicate where relevant header files are located. π--showme:libdirsβ outputs a space-delimited (but otherwise undecorated) list of directories that the wrapper compiler would have provided to the underlying linker to indicate where relevant libraries are located. π--showme:libsβ outputs a space-delimited (but otherwise undecorated) list of library names that the wrapper compiler would have used to link an application. for example:mpi open-rte open-pal util. no cap, that's literally the example. β¨--showme:versionβ outputs the version number of Open MPI. simple. clean. π--showme:helpβ outputs a brief usage help message. the little "here's how u use me" moment. π«Ά
also, fr fr: go check the man page for your underlying C++ compiler for all the other options that can be passed straight through shmemcxx. she's a pass-through queen. π
πΈ DESCRIPTION πΈ
conceptually, the role of these commands is genuinely so simple: transparently add the relevant compiler and linker flags to the user's command line that are necessary to compile / link Open SHMEM programs, and then invoke the underlying compiler to actually do the thing. that's the whole job. π
so like, that's why these commands are frequently called "wrapper" compilers β because they don't actually compile or link applications themselves. they only add in command line flags and invoke the back-end compiler. she's a middlewoman. she's a connector. β¨
π¦ Background π¦
Open MPI is comprised of three software layers: OPAL (Open Portable Access Layer), ORTE (Open Run-Time Environment), and OMPI (Open MPI). there are wrapper compilers for each layer; each layer's wrapper only links in the libraries relevant for that layer. specifically, each layer provides the following wrapper compilers:
- OPAL β
opalccandopalc++ - ORTE β
orteccandortec++ - OMPI β
mpicc,mpic++,mpicxx,mpiCC(only on systems with case-senstive file systems), andmpifort(and its legacy/deprecated namesmpif77andmpif90). note thatmpic++,mpicxx, andmpiCCall invoke the same underlying C++ compiler with the same options. all are provided as compatibility with other MPI implementations. (yes, the original spells it "case-senstive", we're keeping it exactly as-is, no editing bestie π)
π₯ Fortran Notes π₯
the Fortran wrapper compiler for MPI (mpifort, and its legacy/deprecated names mpif77 and mpif90) can compile and link MPI applications that use any/all of the MPI Fortran bindings: mpif.h, the mpi module, and the mpi_f08 module (assuming Open MPI was installed with support for each of these Fortran bindings). specifically: it is no longer necessary to use different wrapper compilers for applications that use mpif.h vs. applications that use the mpi module β just use mpifort for all Fortran MPI applications. one wrapper, all the bindings, we love a multitasker. π
note, however, that the Fortran compiler may require additional command-line options to enforce a specific Fortran dialect. for example, in some versions of the IBM XLF compiler, if xlf90 is the underlying Fortran compiler, -qfixed may be necessary to compile fixed-format Fortran source files. β οΈ
finally, note that mpifort will be inoperative and will return an error on use if Fortran support was not built into the MPI layer. like, she will simply not show up. π
π Overview π
shmemcxx is a convenience wrapper for the underlying C++ compiler. translation of an Open SHMEM program requires the linkage of the Open SHMEM-specific libraries which may not reside in one of the standard search directories of ld(1). it also often requires the inclusion of header files what may also not be found in a standard location. (again, "header files what may also" β that's the original wording, keeping it, iykyk π«Ά)
shmemcxx passes its arguments to the underlying C++ compiler along with the -I, -L and -l options required by Open SHMEM programs. π
the Open SHMEM Team strongly encourages using the wrapper compilers instead of attempting to link to the Open SHMEM libraries manually. this allows the specific implementation of Open SHMEM to change without forcing changes to linker directives in users' Makefiles. indeed, the specific set of flags and libraries used by the wrapper compilers depends on how Open SHMEM was configured and built; the values can change between different installations of the same version of Open SHMEM. so like, don't hardcode. periodt.
and honestly? since the wrappers are simply thin shells on top of an underlying compiler, there are very, very few compelling reasons not to use shmemcxx. like, almost none. when it is not possible to use the wrappers directly, the -showme:compile and -showme:link options should be used to determine what flags the wrappers would have used. for example:
shell$ cc -c file1.c `mpicc -showme:compile`
shell$ cc -c file2.c `mpicc -showme:compile`
shell$ cc file1.o file2.o `mpicc -showme:link` -o my_mpi_program
see? chef's kiss. π¨βπ³π
π NOTES π
it is possible to make the wrapper compilers multi-lib aware. that is, the libraries and includes specified may differ based on the compiler flags specified (for example, with the GNU compilers on Linux, a different library path may be used if -m32 is seen versus -m64 being seen). this is not the default behavior in a standard build, but can be activated (for example, in a binary package providing both 32 and 64 bit support). more information can be found at:
https://github.com/open-mpi/ompi/wiki/compilerwrapper3264
π FILES π
the string that the wrapper compilers insert into the command line before invoking the underlying compiler are stored in a text file created by Open SHMEM and installed to $pkgdata/shmemcxx-wrapper-data.txt, where $pkgdata is typically $prefix/share/openmpi, and $prefix is the top installation directory of Open SHMEM. π
it is rarely necessary to edit this file, but it can be examined to gain insight into what flags the wrappers are placing on the command line. peek but don't touch, bestie. π
π ENVIRONMENT VARIABLES π
by default, the wrappers use the compilers that were selected when Open SHMEM was configured. these compilers were either found automatically by Open MPI's "configure" script, or were selected by the user in the CC, CXX, F77, and/or FC environment variables before "configure" was invoked. additionally, other arguments specific to the compiler may have been selected by configure. π οΈ
these values can be selectively overridden by either editing the text files containing this configuration information (see the FILES section), or by setting selected environment variables of the form "OSHMEM_value". β¨
valid value names are:
CPPFLAGSβ flags added when invoking the preprocessor (C or C++)LDFLAGSβ flags added when invoking the linker (C, C++, or Fortran)LIBSβ libraries added when invoking the linker (C, C++, or Fortran)CCβ C compilerCFLAGSβ C compiler flagsCXXβ C++ compilerCXXFLAGSβ C++ compiler flagsFCβ Fortran compilerFCFLAGSβ Fortran compiler flags
and that's the whole page, bestie!! π¦β¨π
this was Open MPI version 4.1.6, dated Sep 30, 2023 β shoutout to the Open MPI era that blessed us with this page. mwah. π
π go compile something cute. π«Ά
π¦ where this page comes from
- ubuntu noble: openmpi-bin 4.1.6-7ubuntu2
- Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved
- Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms