Skip to content

static libraries, F90 module, and alignment warnings #13043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MJRutter opened this issue Jan 16, 2025 · 3 comments
Open

static libraries, F90 module, and alignment warnings #13043

MJRutter opened this issue Jan 16, 2025 · 3 comments

Comments

@MJRutter
Copy link

If I try to use static libraries with the F90 module, lots of warning messages about alignment result whenever code is compiled. These disappear with the F08 module. Is the use of static libraries and F90 fully supported?

OpenMPI 5.0.6 source download (and several earlier versions), Ubuntu 24.04, GCC 13.3, x86_64

$ FC=gfortran CC=gcc CXX=g++ ./configure --enable-static --prefix=/scratch/OMPI
$ make -j 4
$ make install
$ /scratch/OMPI/bin/mpif90 -static hello.mpi.f90 

gives many warnings from ld starting

/bin/ld: warning: alignment 8 of normal symbol `mpi_fortran_weights_empty_' in /scratch/OMPI/lib/libmpi.a(ompi_mpi_init.o) is smaller than 16 used by the common definition in /tmp/cc4e0CUZ.o
/bin/ld: warning: NOTE: alignment discrepancies can cause real problems.  Investigation is advised.

The example code was

program hello
  use mpi
  integer npe,mype,ierr
  call mpi_init(ierr)
  call mpi_comm_rank(mpi_comm_world, mype, ierr)
  call mpi_comm_size(mpi_comm_world, npe, ierr)
  write(*,101) mype,npe
101   format(' Hello F90 parallel world, I am process ',I3,' out of ',I3)
  call mpi_finalize(ierr)
end program hello

Switching to "use mpi_f08" seems to resolve the issue.

@BarrySmith
Copy link

We are getting similar reports from our PETSc users. Any idea on how to resolve this?

@ggouaillardet
Copy link
Contributor

Ubuntu linker is picky, I should be able to come up with a fix sometimes this week.

ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 4, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 4, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 4, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 4, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 4, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 4, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 4, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
jsquyres pushed a commit to jsquyres/ompi that referenced this issue May 5, 2025
Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 5, 2025
with mpif-h and usempi, MPI constants (e.g. MPI_COMM_WORLD)
are all parts of a unique common block. Fortran compilers
generally have alignment requirements for these (16 with gfortran,
32 with ifort or 64 with nvfortran to name a few), so pass
these requirements to the actual symbols that are defined in
the C code to make pick linkers (e.g. ubuntu) happy pandas.
Such linkers also complain about the size of MPI_STATUS, so define
these are arrays intead of pointer.

Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
jsquyres pushed a commit to jsquyres/ompi that referenced this issue May 6, 2025
with mpif-h and usempi, MPI constants (e.g. MPI_COMM_WORLD)
are all parts of a unique common block. Fortran compilers
generally have alignment requirements for these (16 with gfortran,
32 with ifort or 64 with nvfortran to name a few), so pass
these requirements to the actual symbols that are defined in
the C code to make pick linkers (e.g. ubuntu) happy pandas.
Such linkers also complain about the size of MPI_STATUS, so define
these are arrays intead of pointer.

Refs open-mpi#13043

Thanks MJ Rutter for the report

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
ggouaillardet added a commit to ggouaillardet/ompi that referenced this issue May 8, 2025
with mpif-h and usempi, MPI constants (e.g. MPI_COMM_WORLD)
are all parts of a unique common block. Fortran compilers
generally have alignment requirements for these (16 with gfortran,
32 with ifort or 64 with nvfortran to name a few), so pass
these requirements to the actual symbols that are defined in
the C code to make pick linkers (e.g. ubuntu) happy pandas.
Such linkers also complain about the size of MPI_STATUS, so define
these are arrays intead of pointer.

Refs open-mpi#13043

Thanks MJ Rutter for the report

back-ported from ec2b164

:bot:notacherrypick

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
@jsquyres
Copy link
Member

jsquyres commented May 8, 2025

@MJRutter @BarrySmith Sorry for the huge delay; looks like we have a fix for this now. It's merged on main; the PR for v5.0.x is #13240.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants