ompi icon indicating copy to clipboard operation
ompi copied to clipboard

static libraries, F90 module, and alignment warnings

Open MJRutter opened this issue 10 months ago • 3 comments

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.

MJRutter avatar Jan 16 '25 14:01 MJRutter

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

BarrySmith avatar Apr 19 '25 17:04 BarrySmith

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

ggouaillardet avatar May 04 '25 14:05 ggouaillardet

@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.

jsquyres avatar May 08 '25 14:05 jsquyres