19.1.1. OpenSHMEM Wrapper Compilers
oshcc, oshcxx, oshc++, oshfort, shmemcc, shmemcxx, shmemc++, shmemfort – OpenSHMEM wrapper compilers
oshcc [--showme | --showme:compile | --showme:link] ...
oshcxx [--showme | --showme:compile | --showme:link] ...
oshc++ [--showme | --showme:compile | --showme:link] ...
oshfort [--showme | --showme:compile | --showme:link] ...
shmemcc [--showme | --showme:compile | --showme:link] ...
shmemcxx [--showme | --showme:compile | --showme:link] ...
shmemc++ [--showme | --showme:compile | --showme:link] ...
shmemfort [--showme | --showme:compile | --showme:link] ...
The options below apply to all of the wrapper compilers:
--showme: This option comes in several different variants (see below). None of the variants invokes the underlying compiler; they all provide information on how the underlying compiler would have been invoked had
--showmenot been used. The basic
--showmeoption outputs the command line that would be executed to compile the program.
If a non-filename argument is passed on the command line, the
--showmeoption will not display any additional flags. For example, both
oshcc --showme my_source.cwill show all the wrapper-supplied flags. But
oshcc --showme -vwill only show the underlying compiler name and
--showme:compile: Output the compiler flags that would have been supplied to the underlying compiler.
--showme:link: Output the linker flags that would have been supplied to the underlying compiler.
--showme:command: Outputs the underlying compiler command (which may be one or more tokens).
--showme:incdirs: Outputs a space-delimited (but otherwise undecorated) list of directories that the wrapper compiler would have provided to the underlying 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:libsOutputs 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-pal util.
--showme:version: Outputs the version number of Open MPI.
--showme:help: Output a brief usage help message.
See the man page for your underlying compiler for other options that can be passed through oshcc.
Conceptually, the role of these commands is quite simple: transparently add relevant compiler and linker flags to the user’s command line that are necessary to compile / link OpenSHMEM programs, and then invoke the underlying compiler to actually perform the command.
As such, these commands are frequently referred to as “wrapper” compilers because they do not actually compile or link applications themselves; they only add in command line flags and invoke the back-end compiler.
Open MPI provides wrapper compilers for several languages:
shmemc++, shmemcxx`:: C++
The wrapper compilers for each of the languages are identical; they can be use interchangeably. The different names are provided solely for backwards compatibility.
188.8.131.52. Fortran Notes
The Fortran wrapper compiler for OpenSHMEM (
shmemfort) can compile and link OpenSHMEM applications that use
any/all of the OpenSHMEM Fortran bindings.
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
oshfort will be inoperative and will return an
error on use if Fortran support was not built into the OpenSHMEM
shmemcc are convenience wrappers for the underlying
C compiler. Translation of an OpenSHMEM program requires the linkage
of the OpenSHMEM-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
shmemcc pass their arguments to the underlying C
compiler along with the
-l options required by
The same is true for all the other language wrapper compilers.
The OpenSHMEM Team strongly encourages using the wrapper compilers instead of attempting to link to the OpenSHMEM libraries manually. This allows the specific implementation of OpenSHMEM 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 OpenSHMEM was configured and built; the values can change between different installations of the same version of OpenSHMEM.
Indeed, since the wrappers are simply thin shells on top of an
underlying compiler, there are very, very few compelling reasons not
oshcc. When it is not possible to use the wrappers
--showme:link options should be
used to determine what flags the wrappers would have used. For example:
shell$ cc -c file1.c `shmemcc --showme:compile` shell$ cc -c file2.c `shmemcc --showme:compile` shell$ cc file1.o file2.o `shmemcc --showme:link` -o my_oshmem_program
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
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 here.
The strings that the wrapper compilers insert into the command line
before invoking the underlying compiler are stored in a text file
created by OpenSHMEM and installed to
$prefixis the top installation directory of OpenSHMEM
NAMEis the name of the wrapper compiler (e.g.,
It is rarely necessary to edit these files, but they can be examined to gain insight into what flags the wrappers are placing on the command line.
184.108.40.206. ENVIRONMENT VARIABLES
By default, the wrappers use the compilers that were selected when
OpenSHMEM was configured. These compilers were either found
automatically by Open MPI’s “configure” script, or were selected by
the user in the
FC environment variables
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
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 compiler
CFLAGS: C compiler flags
CXX: C++ compiler
CXXFLAGS: C++ compiler flags
FC: Fortran compiler
FCFLAGS: Fortran compiler flags