summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>2020-06-17 17:32:08 +0200
committerGitHub <noreply@github.com>2020-06-17 10:32:08 -0500
commiteca08c77e383692d0c00c964f1c129b0996f5bc1 (patch)
tree17d3926706e802c4d7979db3f6dc8e2ed2db5c7f
parente90c229dab42760f9fcf6f72267b35d054dbf606 (diff)
downloadspack-eca08c77e383692d0c00c964f1c129b0996f5bc1.tar.gz
spack-eca08c77e383692d0c00c964f1c129b0996f5bc1.tar.bz2
spack-eca08c77e383692d0c00c964f1c129b0996f5bc1.tar.xz
spack-eca08c77e383692d0c00c964f1c129b0996f5bc1.zip
openmpi: fixes for NAG compiler (#17073)
* openmpi: fixes for NAG compiler * openmpi: more fixes
-rw-r--r--var/spack/repos/builtin/packages/openmpi/nag_pthread/1.10.4_1.10.999.patch (renamed from var/spack/repos/builtin/packages/openmpi/nag_ltmain_4.patch)0
-rw-r--r--var/spack/repos/builtin/packages/openmpi/nag_pthread/2.0.0_2.1.1.patch (renamed from var/spack/repos/builtin/packages/openmpi/nag_ltmain_3.patch)0
-rw-r--r--var/spack/repos/builtin/packages/openmpi/nag_pthread/2.1.2_2.1.3_3.0.0.patch (renamed from var/spack/repos/builtin/packages/openmpi/nag_ltmain_2.patch)0
-rw-r--r--var/spack/repos/builtin/packages/openmpi/nag_pthread/2.1.4_2.1.999_3.0.1_4.patch (renamed from var/spack/repos/builtin/packages/openmpi/nag_ltmain_1.patch)0
-rw-r--r--var/spack/repos/builtin/packages/openmpi/package.py115
-rw-r--r--var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_1.patch584
-rw-r--r--var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_2.patch22
7 files changed, 700 insertions, 21 deletions
diff --git a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_4.patch b/var/spack/repos/builtin/packages/openmpi/nag_pthread/1.10.4_1.10.999.patch
index 82bdb9f752..82bdb9f752 100644
--- a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_4.patch
+++ b/var/spack/repos/builtin/packages/openmpi/nag_pthread/1.10.4_1.10.999.patch
diff --git a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_3.patch b/var/spack/repos/builtin/packages/openmpi/nag_pthread/2.0.0_2.1.1.patch
index 0d4250001a..0d4250001a 100644
--- a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_3.patch
+++ b/var/spack/repos/builtin/packages/openmpi/nag_pthread/2.0.0_2.1.1.patch
diff --git a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_2.patch b/var/spack/repos/builtin/packages/openmpi/nag_pthread/2.1.2_2.1.3_3.0.0.patch
index af1b600039..af1b600039 100644
--- a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_2.patch
+++ b/var/spack/repos/builtin/packages/openmpi/nag_pthread/2.1.2_2.1.3_3.0.0.patch
diff --git a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_1.patch b/var/spack/repos/builtin/packages/openmpi/nag_pthread/2.1.4_2.1.999_3.0.1_4.patch
index 3d20169718..3d20169718 100644
--- a/var/spack/repos/builtin/packages/openmpi/nag_ltmain_1.patch
+++ b/var/spack/repos/builtin/packages/openmpi/nag_pthread/2.1.4_2.1.999_3.0.1_4.patch
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py
index b3dcac253e..ee2f76ea19 100644
--- a/var/spack/repos/builtin/packages/openmpi/package.py
+++ b/var/spack/repos/builtin/packages/openmpi/package.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import itertools
import os
import sys
import llnl.util.tty as tty
@@ -157,12 +158,26 @@ class Openmpi(AutotoolsPackage):
patch('btl_vader.patch', when='@3.0.1:3.0.2')
patch('btl_vader.patch', when='@3.1.0:3.1.2')
- # Reported upstream: https://github.com/open-mpi/ompi/pull/6378
+ # Make NAG compiler pass the -pthread option to the linker:
+ # https://github.com/open-mpi/ompi/pull/6378
# We support only versions based on Libtool 2.4.6.
- patch('nag_ltmain_1.patch', when='@2.1.4:2.1.999,3.0.1:4%nag')
- patch('nag_ltmain_2.patch', when='@2.1.2:2.1.3,3.0.0%nag')
- patch('nag_ltmain_3.patch', when='@2.0.0:2.1.1%nag')
- patch('nag_ltmain_4.patch', when='@1.10.4:1.10.999%nag')
+ patch('nag_pthread/2.1.4_2.1.999_3.0.1_4.patch', when='@2.1.4:2.1.999,3.0.1:4%nag')
+ patch('nag_pthread/2.1.2_2.1.3_3.0.0.patch', when='@2.1.2:2.1.3,3.0.0%nag')
+ patch('nag_pthread/2.0.0_2.1.1.patch', when='@2.0.0:2.1.1%nag')
+ patch('nag_pthread/1.10.4_1.10.999.patch', when='@1.10.4:1.10.999%nag')
+
+ # Fix MPI_Sizeof() in the "mpi" Fortran module for compilers that do not
+ # support "IGNORE TKR" functionality (e.g. NAG).
+ # The issue has been resolved upstream in two steps:
+ # 1) https://github.com/open-mpi/ompi/pull/2294
+ # 2) https://github.com/open-mpi/ompi/pull/5099
+ # The first one was applied starting version v3.0.0 and backported to
+ # v1.10. A subset with relevant modifications is applicable starting
+ # version 1.8.4.
+ patch('use_mpi_tkr_sizeof/step_1.patch', when='@1.8.4:1.10.6,2:2.999')
+ # The second patch was applied starting version v4.0.0 and backported to
+ # v2.x, v3.0.x, and v3.1.x.
+ patch('use_mpi_tkr_sizeof/step_2.patch', when='@1.8.4:2.1.3,3:3.0.1')
variant(
'fabrics',
@@ -192,7 +207,8 @@ class Openmpi(AutotoolsPackage):
description='Enable MPI_THREAD_MULTIPLE support')
variant('cuda', default=False, description='Enable CUDA support')
variant('pmi', default=False, description='Enable PMI support')
- variant('runpath', default=True, description='Enable wrapper runpath')
+ variant('wrapper-rpath', default=True,
+ description='Enable rpath support in the wrappers')
variant('cxx', default=False, description='Enable C++ MPI bindings')
variant('cxx_exceptions', default=False, description='Enable C++ Exception support')
variant('gpfs', default=True, description='Enable GPFS support (if present)')
@@ -274,6 +290,9 @@ class Openmpi(AutotoolsPackage):
conflicts('fabrics=libfabric', when='@:1.8') # libfabric support was added in 1.10.0
# It may be worth considering making libfabric an exclusive fabrics choice
+ # RPATH support in the wrappers was added in 1.7.4
+ conflicts('+wrapper-rpath', when='@:1.7.3')
+
def url_for_version(self, version):
url = "http://www.open-mpi.org/software/ompi/v{0}/downloads/openmpi-{1}.tar.bz2"
return url.format(version.up_to(2), version)
@@ -369,12 +388,10 @@ class Openmpi(AutotoolsPackage):
'--disable-silent-rules'
]
- # Add extra_rpaths dirs from compilers.yaml into link wrapper
- rpaths = [self.compiler.cc_rpath_arg + path
- for path in self.compiler.extra_rpaths]
- config_args.extend([
- '--with-wrapper-ldflags={0}'.format(' '.join(rpaths))
- ])
+ # All rpath flags should be appended with self.compiler.cc_rpath_arg.
+ # Later, we might need to update share/openmpi/mpic++-wrapper-data.txt
+ # and mpifort-wrapper-data.txt (see filter_rpaths()).
+ wrapper_ldflags = []
if '+atomics' in spec:
config_args.append('--enable-builtin-atomics')
@@ -418,12 +435,6 @@ class Openmpi(AutotoolsPackage):
if 'fabrics=auto' not in spec:
config_args.extend(self.with_or_without('fabrics',
activation_value='prefix'))
- # The wrappers fail to automatically link libfabric. This will cause
- # undefined references unless we add the appropriate flags.
- if 'fabrics=libfabric' in spec:
- config_args.append('--with-wrapper-ldflags=-L{0} -Wl,-rpath={0}'
- .format(spec['libfabric'].prefix.lib))
- config_args.append('--with-wrapper-libs=-lfabric')
# Schedulers
if 'schedulers=auto' not in spec:
@@ -499,12 +510,24 @@ class Openmpi(AutotoolsPackage):
else:
config_args.append('--without-cuda')
- if '+runpath' in spec:
+ if '+wrapper-rpath' in spec:
config_args.append('--enable-wrapper-rpath')
- config_args.append('--enable-wrapper-runpath')
+
+ # Disable new dynamic tags in the wrapper (--disable-new-dtags)
+ # In the newer versions this can be done with a configure option
+ # (for older versions, we rely on filter_compiler_wrappers() and
+ # filter_pc_files()):
+ if spec.satisfies('@3.0.5:'):
+ config_args.append('--disable-wrapper-runpath')
+
+ # Add extra_rpaths and implicit_rpaths into the wrappers.
+ wrapper_ldflags.extend([
+ self.compiler.cc_rpath_arg + path
+ for path in itertools.chain(
+ self.compiler.extra_rpaths,
+ self.compiler.implicit_rpaths())])
else:
config_args.append('--disable-wrapper-rpath')
- config_args.append('--disable-wrapper-runpath')
if spec.satisfies('@:4'):
if '+cxx' in spec:
@@ -517,8 +540,58 @@ class Openmpi(AutotoolsPackage):
else:
config_args.append('--disable-cxx-exceptions')
+ if wrapper_ldflags:
+ config_args.append(
+ '--with-wrapper-ldflags={0}'.format(' '.join(wrapper_ldflags)))
+
return config_args
+ @when('+wrapper-rpath')
+ @run_after('install')
+ def filter_rpaths(self):
+
+ def filter_lang_rpaths(lang_tokens, rpath_arg):
+ if self.compiler.cc_rpath_arg == rpath_arg:
+ return
+
+ files = find(self.spec.prefix.share.openmpi,
+ ['*{0}-wrapper-data*'.format(t) for t in lang_tokens])
+ files.extend(find(self.spec.prefix.lib.pkgconfig,
+ ['ompi-{0}.pc'.format(t) for t in lang_tokens]))
+
+ x = FileFilter(*[f for f in files if not os.path.islink(f)])
+
+ # Replace self.compiler.cc_rpath_arg, which have been added as
+ # '--with-wrapper-ldflags', with rpath_arg in the respective
+ # language-specific wrappers and pkg-config files.
+ x.filter(self.compiler.cc_rpath_arg, rpath_arg,
+ string=True, backup=False)
+
+ if self.spec.satisfies('@:1.10.3,2:2.1.1'):
+ # Replace Libtool-style RPATH prefixes '-Wl,-rpath -Wl,' with
+ # rpath_arg for old version of OpenMPI, which assumed that CXX
+ # and FC had the same prefixes as CC.
+ x.filter('-Wl,-rpath -Wl,', rpath_arg,
+ string=True, backup=False)
+
+ filter_lang_rpaths(['c++', 'CC', 'cxx'], self.compiler.cxx_rpath_arg)
+ filter_lang_rpaths(['fort', 'f77', 'f90'], self.compiler.fc_rpath_arg)
+
+ @when('@:3.0.4+wrapper-rpath')
+ @run_after('install')
+ def filter_pc_files(self):
+ files = find(self.spec.prefix.lib.pkgconfig, '*.pc')
+ x = FileFilter(*[f for f in files if not os.path.islink(f)])
+
+ # Remove this linking flag if present (it turns RPATH into RUNPATH)
+ x.filter('{0}--enable-new-dtags'.format(self.compiler.linker_arg), '',
+ string=True, backup=False)
+
+ # NAG compiler is usually mixed with GCC, which has a different
+ # prefix for linker arguments.
+ if self.compiler.name == 'nag':
+ x.filter('-Wl,--enable-new-dtags', '', string=True, backup=False)
+
@run_after('install')
def delete_mpirun_mpiexec(self):
# The preferred way to run an application when Slurm is the
diff --git a/var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_1.patch b/var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_1.patch
new file mode 100644
index 0000000000..53d9e0018d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_1.patch
@@ -0,0 +1,584 @@
+--- a/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-interfaces.h
++++ b/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-interfaces.h
+@@ -1650,570 +1650,6 @@ end subroutine MPI_Request_get_status
+ end interface
+
+
+-interface MPI_Sizeof
+-
+-subroutine MPI_Sizeof0DCH(x, size, ierror)
+- character, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DCH
+-
+-
+-subroutine MPI_Sizeof0DL(x, size, ierror)
+- logical, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DL
+-
+-
+-subroutine MPI_Sizeof0DI1(x, size, ierror)
+- integer*1, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DI1
+-
+-
+-subroutine MPI_Sizeof0DI2(x, size, ierror)
+- integer*2, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DI2
+-
+-
+-subroutine MPI_Sizeof0DI4(x, size, ierror)
+- integer*4, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DI4
+-
+-
+-subroutine MPI_Sizeof0DI8(x, size, ierror)
+- integer*8, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DI8
+-
+-
+-subroutine MPI_Sizeof0DR4(x, size, ierror)
+- real*4, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DR4
+-
+-
+-subroutine MPI_Sizeof0DR8(x, size, ierror)
+- real*8, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DR8
+-
+-
+-subroutine MPI_Sizeof0DC8(x, size, ierror)
+- complex*8, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DC8
+-
+-
+-subroutine MPI_Sizeof0DC16(x, size, ierror)
+- complex*16, intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof0DC16
+-
+-
+-subroutine MPI_Sizeof1DCH(x, size, ierror)
+- character, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DCH
+-
+-
+-subroutine MPI_Sizeof1DL(x, size, ierror)
+- logical, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DL
+-
+-
+-subroutine MPI_Sizeof1DI1(x, size, ierror)
+- integer*1, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DI1
+-
+-
+-subroutine MPI_Sizeof1DI2(x, size, ierror)
+- integer*2, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DI2
+-
+-
+-subroutine MPI_Sizeof1DI4(x, size, ierror)
+- integer*4, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DI4
+-
+-
+-subroutine MPI_Sizeof1DI8(x, size, ierror)
+- integer*8, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DI8
+-
+-
+-subroutine MPI_Sizeof1DR4(x, size, ierror)
+- real*4, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DR4
+-
+-
+-subroutine MPI_Sizeof1DR8(x, size, ierror)
+- real*8, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DR8
+-
+-
+-subroutine MPI_Sizeof1DC8(x, size, ierror)
+- complex*8, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DC8
+-
+-
+-subroutine MPI_Sizeof1DC16(x, size, ierror)
+- complex*16, dimension(*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof1DC16
+-
+-
+-subroutine MPI_Sizeof2DCH(x, size, ierror)
+- character, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DCH
+-
+-
+-subroutine MPI_Sizeof2DL(x, size, ierror)
+- logical, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DL
+-
+-
+-subroutine MPI_Sizeof2DI1(x, size, ierror)
+- integer*1, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DI1
+-
+-
+-subroutine MPI_Sizeof2DI2(x, size, ierror)
+- integer*2, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DI2
+-
+-
+-subroutine MPI_Sizeof2DI4(x, size, ierror)
+- integer*4, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DI4
+-
+-
+-subroutine MPI_Sizeof2DI8(x, size, ierror)
+- integer*8, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DI8
+-
+-
+-subroutine MPI_Sizeof2DR4(x, size, ierror)
+- real*4, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DR4
+-
+-
+-subroutine MPI_Sizeof2DR8(x, size, ierror)
+- real*8, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DR8
+-
+-
+-subroutine MPI_Sizeof2DC8(x, size, ierror)
+- complex*8, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DC8
+-
+-
+-subroutine MPI_Sizeof2DC16(x, size, ierror)
+- complex*16, dimension(1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof2DC16
+-
+-
+-subroutine MPI_Sizeof3DCH(x, size, ierror)
+- character, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DCH
+-
+-
+-subroutine MPI_Sizeof3DL(x, size, ierror)
+- logical, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DL
+-
+-
+-subroutine MPI_Sizeof3DI1(x, size, ierror)
+- integer*1, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DI1
+-
+-
+-subroutine MPI_Sizeof3DI2(x, size, ierror)
+- integer*2, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DI2
+-
+-
+-subroutine MPI_Sizeof3DI4(x, size, ierror)
+- integer*4, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DI4
+-
+-
+-subroutine MPI_Sizeof3DI8(x, size, ierror)
+- integer*8, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DI8
+-
+-
+-subroutine MPI_Sizeof3DR4(x, size, ierror)
+- real*4, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DR4
+-
+-
+-subroutine MPI_Sizeof3DR8(x, size, ierror)
+- real*8, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DR8
+-
+-
+-subroutine MPI_Sizeof3DC8(x, size, ierror)
+- complex*8, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DC8
+-
+-
+-subroutine MPI_Sizeof3DC16(x, size, ierror)
+- complex*16, dimension(1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof3DC16
+-
+-
+-subroutine MPI_Sizeof4DCH(x, size, ierror)
+- character, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DCH
+-
+-
+-subroutine MPI_Sizeof4DL(x, size, ierror)
+- logical, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DL
+-
+-
+-subroutine MPI_Sizeof4DI1(x, size, ierror)
+- integer*1, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DI1
+-
+-
+-subroutine MPI_Sizeof4DI2(x, size, ierror)
+- integer*2, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DI2
+-
+-
+-subroutine MPI_Sizeof4DI4(x, size, ierror)
+- integer*4, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DI4
+-
+-
+-subroutine MPI_Sizeof4DI8(x, size, ierror)
+- integer*8, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DI8
+-
+-
+-subroutine MPI_Sizeof4DR4(x, size, ierror)
+- real*4, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DR4
+-
+-
+-subroutine MPI_Sizeof4DR8(x, size, ierror)
+- real*8, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DR8
+-
+-
+-subroutine MPI_Sizeof4DC8(x, size, ierror)
+- complex*8, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DC8
+-
+-
+-subroutine MPI_Sizeof4DC16(x, size, ierror)
+- complex*16, dimension(1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof4DC16
+-
+-
+-subroutine MPI_Sizeof5DCH(x, size, ierror)
+- character, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DCH
+-
+-
+-subroutine MPI_Sizeof5DL(x, size, ierror)
+- logical, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DL
+-
+-
+-subroutine MPI_Sizeof5DI1(x, size, ierror)
+- integer*1, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DI1
+-
+-
+-subroutine MPI_Sizeof5DI2(x, size, ierror)
+- integer*2, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DI2
+-
+-
+-subroutine MPI_Sizeof5DI4(x, size, ierror)
+- integer*4, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DI4
+-
+-
+-subroutine MPI_Sizeof5DI8(x, size, ierror)
+- integer*8, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DI8
+-
+-
+-subroutine MPI_Sizeof5DR4(x, size, ierror)
+- real*4, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DR4
+-
+-
+-subroutine MPI_Sizeof5DR8(x, size, ierror)
+- real*8, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DR8
+-
+-
+-subroutine MPI_Sizeof5DC8(x, size, ierror)
+- complex*8, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DC8
+-
+-
+-subroutine MPI_Sizeof5DC16(x, size, ierror)
+- complex*16, dimension(1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof5DC16
+-
+-
+-subroutine MPI_Sizeof6DCH(x, size, ierror)
+- character, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DCH
+-
+-
+-subroutine MPI_Sizeof6DL(x, size, ierror)
+- logical, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DL
+-
+-
+-subroutine MPI_Sizeof6DI1(x, size, ierror)
+- integer*1, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DI1
+-
+-
+-subroutine MPI_Sizeof6DI2(x, size, ierror)
+- integer*2, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DI2
+-
+-
+-subroutine MPI_Sizeof6DI4(x, size, ierror)
+- integer*4, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DI4
+-
+-
+-subroutine MPI_Sizeof6DI8(x, size, ierror)
+- integer*8, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DI8
+-
+-
+-subroutine MPI_Sizeof6DR4(x, size, ierror)
+- real*4, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DR4
+-
+-
+-subroutine MPI_Sizeof6DR8(x, size, ierror)
+- real*8, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DR8
+-
+-
+-subroutine MPI_Sizeof6DC8(x, size, ierror)
+- complex*8, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DC8
+-
+-
+-subroutine MPI_Sizeof6DC16(x, size, ierror)
+- complex*16, dimension(1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof6DC16
+-
+-
+-subroutine MPI_Sizeof7DCH(x, size, ierror)
+- character, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DCH
+-
+-
+-subroutine MPI_Sizeof7DL(x, size, ierror)
+- logical, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DL
+-
+-
+-subroutine MPI_Sizeof7DI1(x, size, ierror)
+- integer*1, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DI1
+-
+-
+-subroutine MPI_Sizeof7DI2(x, size, ierror)
+- integer*2, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DI2
+-
+-
+-subroutine MPI_Sizeof7DI4(x, size, ierror)
+- integer*4, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DI4
+-
+-
+-subroutine MPI_Sizeof7DI8(x, size, ierror)
+- integer*8, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DI8
+-
+-
+-subroutine MPI_Sizeof7DR4(x, size, ierror)
+- real*4, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DR4
+-
+-
+-subroutine MPI_Sizeof7DR8(x, size, ierror)
+- real*8, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DR8
+-
+-
+-subroutine MPI_Sizeof7DC8(x, size, ierror)
+- complex*8, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DC8
+-
+-
+-subroutine MPI_Sizeof7DC16(x, size, ierror)
+- complex*16, dimension(1,1,1,1,1,1,*), intent(in) :: x
+- integer, intent(out) :: size
+- integer, intent(out) :: ierror
+-end subroutine MPI_Sizeof7DC16
+-
+-end interface
+-
+-
+ interface MPI_Start
+
+ subroutine MPI_Start(request, ierror)
+--- a/ompi/mpi/fortran/use-mpi-tkr/mpi.F90
++++ b/ompi/mpi/fortran/use-mpi-tkr/mpi.F90
+@@ -50,4 +50,8 @@ module mpi
+
+ include "mpi-f90-interfaces.h"
+
++#if OMPI_FORTRAN_BUILD_SIZEOF
++ include "mpi-tkr-sizeof.h"
++#endif
++
+ end module mpi
diff --git a/var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_2.patch b/var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_2.patch
new file mode 100644
index 0000000000..6ca5051a59
--- /dev/null
+++ b/var/spack/repos/builtin/packages/openmpi/use_mpi_tkr_sizeof/step_2.patch
@@ -0,0 +1,22 @@
+--- a/ompi/mpi/fortran/configure-fortran-output.h.in
++++ b/ompi/mpi/fortran/configure-fortran-output.h.in
+@@ -47,6 +47,8 @@
+ ! Line 2 of the ignore TKR syntax
+ #define OMPI_FORTRAN_IGNORE_TKR_TYPE @OMPI_FORTRAN_IGNORE_TKR_TYPE@
+
++
++#define OMPI_FORTRAN_BUILD_SIZEOF @OMPI_FORTRAN_BUILD_SIZEOF@
+ ! Integers
+
+ #define OMPI_HAVE_FORTRAN_INTEGER1 @OMPI_HAVE_FORTRAN_INTEGER1@
+--- a/ompi/mpi/fortran/use-mpi-tkr/Makefile.in
++++ b/ompi/mpi/fortran/use-mpi-tkr/Makefile.in
+@@ -2023,6 +2023,8 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-local
+ @OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS_TRUE@mpi.lo: $(top_builddir)/ompi/mpi/fortran/configure-fortran-output.h
+ @OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS_TRUE@mpi.lo: mpi-f90-cptr-interfaces.F90
+
++@BUILD_FORTRAN_SIZEOF_TRUE@@OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS_TRUE@mpi.lo: mpi-tkr-sizeof.h
++
+ @OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS_TRUE@mpi-tkr-sizeof.h: $(top_builddir)/config.status
+ @OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS_TRUE@mpi-tkr-sizeof.h: $(sizeof_pl)
+ @OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS_TRUE@mpi-tkr-sizeof.h: