shmemfort(1)

πŸ’… shmemfort β€” the Open SHMEM Fortran wrapper compiler, bestie ✨

Okay so real quick, before anything else: this whole page is about shmemfort, a section 1 (that's user commands, iykyk) manual page from the Open MPI fam. Buckle up, it's giving "thin shell on top of a compiler" and honestly? Iconic.


🌸 NAME 🌸

shmemfort β€” the Open SHMEM Fortran wrapper compiler. That's it, that's the whole name. Short, sweet, slays. 🫢


✨ SYNTAX ✨

shmemfort [-showme|-showme:compile|-showme:link] ...

Yeah so it's literally just shmemfort plus whatever flags you wanna throw at it. The ... is doing a lot of heavy lifting there and we respect it. πŸ’…


πŸŽ€ OPTIONS πŸŽ€

  • --showme β€” okay so this one comes in several different variants (peep below, bestie). Here's the tea: none of the variants actually invoke the underlying compiler. They just spill the info on how the underlying compiler would have been invoked if you hadn't used --showme. The basic --showme outputs the command line that would be executed to compile the program. ⚠️ NOTE: if a non-filename argument gets passed on the command line, the -showme option will not display any additional flags. Like, for example, both shmemfort --showme and shmemfort --showme my_source.c will show all the wrapper-supplied flags. But shmemfort --showme -v will only show the underlying compiler name and -v. Not me explaining it three times but that's literally what the page says so πŸ’€
  • --showme:compile β€” outputs the compiler flags that would have been supplied to the Fortran compiler. Just the compile-y ones. 🌸
  • --showme:link β€” outputs the linker flags that would have been supplied to the Fortran compiler. The link-y ones. πŸ”—
  • --showme:command β€” outputs the underlying Fortran compiler command (which may be one or more tokens). Plural tokens, bestie, don't @ me.
  • --showme:incdirs β€” outputs a space-delimited (but otherwise undecorated β€” no frills, no garnish) list of directories that the wrapper compiler would have provided to the underlying Fortran compiler to indicate where relevant header files are located. πŸ“
  • --showme:libdirs β€” outputs a space-delimited (again, 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 (undecorated, you know the vibe by now) list of library names that the wrapper compiler would have used to link an application. For example: "mpi open-rte open-pal util". πŸ“
  • --showme:version β€” outputs the version number of Open MPI. That's it. That's the whole thing.
  • --showme:help β€” outputs a brief usage help message. When in doubt, ask for help. Main character energy. πŸ‘‘

Also: go read the man page for your underlying Fortran compiler for other options that can be passed through shmemfort. We're not the boss of your compiler.


πŸ’– DESCRIPTION πŸ’–

Conceptually, the role of these commands is quite simple (conceptually!!): transparently add 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 perform the command. That's the whole job. It's a middleman and it's thriving. ✨

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. Lowkey a delegation queen.

πŸ¦‹ 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
    • opalcc and opalc++
  • ORTE
    • ortecc and ortec++
  • OMPI
    • mpicc, mpic++, mpicxx, mpiCC (only on systems with case-senstive file systems β€” yes, that spelling is straight from the source, no cap), and mpifort (and its legacy/deprecated names mpif77 and mpif90). Note that mpic++, mpicxx, and mpiCC all invoke the same underlying C++ compiler with the same options. All are provided as compatibility with other MPI implementations. 🌈

🧚 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 compiler to rule them all, periodt. πŸ‘‘

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. So like... know your compiler, bestie.

Finally, note that mpifort will be inoperative and will return an error on use if Fortran support was not built into the MPI layer. Yeah. It just won't work. πŸ™ˆ

πŸ’œ Overview πŸ’œ

shmemfort is a convenience wrappers for the underlying Fortran compiler (plural "wrappers", singular command, we don't make the rules). 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: exactly what the page says. Copying is not the vibe but accuracy absolutely is.)

shmemfort passes its arguments to the underlying Fortran 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 your flags are not universal, they're situational. πŸ’…

Indeed, since the wrappers are simply thin shells on top of an underlying compiler, there are very, very few compelling reasons not to use shmemfort. 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? Backticks doing the lord's work. 🫢


🌈 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

Go read it, it's giving lore. πŸ“š


πŸ“ 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/shmemfort-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. Peeking is allowed. Editing is... rarely necessary. πŸ™ˆ


πŸ’€ 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 compiler
  • CFLAGS β€” C compiler flags
  • CXX β€” C++ compiler
  • CXXFLAGS β€” C++ compiler flags
  • FC β€” Fortran compiler
  • FCFLAGS β€” Fortran compiler flags

That's all nine, counted them, don't come for me. ✨


And that's the whole page, bestie!! πŸŽ€ This was version 4.1.6, dated Sep 30, 2023, from the Open MPI squad. Go forth and let the wrapper do the work for you. Mwah. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from
  • ubuntu noble: openmpi-bin 4.1.6-7ubuntu2
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms