opalcc(1)

๐Ÿ“ฆ
version 4.1.6 ยท 4 versions
, in ubuntu noble

๐ŸŒธ opalcc(1) โ€” the Open PAL C wrapper compiler, bestie edition ๐ŸŒธ

okay so real talk: you opened the manual page for opalcc from Open MPI, and honestly? iconic choice. let's get into it ๐Ÿ’…


โœจ NAME โœจ

opalcc โ€” the Open PAL C wrapper compiler ๐ŸŽ€


โœจ SYNTAX โœจ

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

that's it. that's the whole vibe check. ๐Ÿฆ‹


โœจ OPTIONS โœจ

  • --showme โ€” bestie this one comes in several different variants (keep scrolling, they're all right below ๐Ÿ‘‡). none of the variants actually invoke the underlying compiler, they just spill the tea on how the underlying compiler would have been invoked if you hadn't used --showme. the plain --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 opalcc --showme and opalcc --showme my_source.c will show all the wrapper-supplied flags. but opalcc --showme -v will only show the underlying compiler name and -v. not me getting humbled by argument parsing ๐Ÿ˜ญ
  • --showme:compile โ€” outputs the compiler flags that would have been handed to the C compiler โœจ
  • --showme:link โ€” outputs the linker flags that would have been handed to the C compiler ๐Ÿ”—
  • --showme:command โ€” outputs the underlying C compiler command (which may be one or more tokens) ๐Ÿ‘‘
  • --showme:incdirs โ€” outputs a space-delimited (but otherwise undecorated, no frills, no glitter) list of directories that the wrapper compiler would have given to the underlying C compiler to say "hey, relevant header files live here" ๐Ÿ“
  • --showme:libdirs โ€” outputs a space-delimited (again, otherwise undecorated) list of directories that the wrapper compiler would have given to the underlying linker to say "hey, relevant libraries live here" ๐Ÿ“š
  • --showme:libs โ€” outputs a space-delimited (yep, 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" ๐Ÿงš
  • --showme:version โ€” outputs the version number of Open MPI ๐Ÿ”ข
  • --showme:help โ€” outputs a brief usage help message ๐Ÿซถ

also, lowkey important: go see the man page for your underlying C compiler for other options that can be passed through opalcc ๐Ÿ’œ


โœจ DESCRIPTION โœจ

conceptually, the role of these commands is honestly so simple: transparently add the relevant compiler and linker flags to your command line โ€” the ones you need to compile / link Open PAL programs โ€” and then invoke the underlying compiler to actually do the thing. ๐ŸŽ€

so yeah, these commands get called "wrapper" compilers a lot, because they don't actually compile or link applications themselves. they just add in command line flags and invoke the back-end compiler. main character behavior, but make it delegating. ๐Ÿ’…

๐ŸŒˆ Background

Open MPI is made 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, and each layer's wrapper only links in the libraries relevant to that layer. specifically, each layer provides these wrapper compilers:

  • OPAL
    • opalcc and opalc++
  • ORTE
    • ortecc and ortec++
  • OMPI
    • mpicc, mpic++, mpicxx, mpiCC (only on systems with case-senstive file systems), and mpifort (plus 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 of them 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. slay, one wrapper to rule them all ๐Ÿ‘‘

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. so like, check before you commit, bestie ๐Ÿ’€

๐ŸŒˆ Overview

opalcc is a convenience wrappers for the underlying C compiler. translating an Open PAL program requires linking the Open PAL-specific libraries, which may not live in one of the standard search directories of ld(1). it also often requires including header files that may also not be found in a standard location. ๐Ÿ™ˆ

opalcc passes its arguments to the underlying C compiler along with the -I, -L and -l options required by Open PAL programs.

the Open PAL Team strongly encourages using the wrapper compilers instead of trying to link to the Open PAL libraries manually. this lets the specific implementation of Open PAL change without forcing changes to linker directives in your Makefiles. and fr fr โ€” the specific set of flags and libraries used by the wrapper compilers depends on how Open PAL was configured and built; the values can change between different installations of the same version of Open PAL. ๐Ÿ˜ณ

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 opalcc. when it's 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

โœจ NOTES โœจ

it is possible to make the wrapper compilers multi-lib aware. that means 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 it can be activated (for example, in a binary package providing both 32 and 64 bit support). more info lives 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 is stored in a text file created by Open PAL and installed to $pkgdata/opalcc-wrapper-data.txt, where $pkgdata is typically $prefix/share/openmpi, and $prefix is the top installation directory of Open PAL. ๐Ÿ“‚

it's rarely necessary to edit this file, but you can examine it to gain insight into what flags the wrappers are placing on the command line. peek behind the curtain, bestie ๐Ÿ‘€


โœจ ENVIRONMENT VARIABLES โœจ

by default, the wrappers use the compilers that were selected when Open PAL 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 "OPAL_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

okay that's the whole page, and you absolutely ate by reading all of it. this was Open MPI 4.1.6, dated Sep 30, 2023 โ€” so if you're reading this way later, hi, time traveler, go check for a newer version ๐Ÿฆ‹๐Ÿ’œ. go compile something cute. periodt. ๐Ÿ’…โœจ

๐Ÿ“ฆ 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