Skip to content
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

OpenMPI 5.0.7 does not compile with flang when real128 is not supported #13136

Open
hakostra opened this issue Mar 12, 2025 · 3 comments
Open

Comments

@hakostra
Copy link

Background information

What version of Open MPI are you using?

5.0.7

Describe how Open MPI was installed

Tarball/source

Please describe the system on which you are running

I'm trying to build Open MPI with MPI_f08 bindings on a Linux system, using clang and flang build from recent llvm-project Git repository:

$ flang --version
flang version 21.0.0git (https://github.com/llvm/llvm-project.git 5d50af3f0368847ab9ce1d86cb6e46ffaf317b59)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm/llvm-project/install/bin

By default, quad precision is disabled when building flang except when explicitly enabled. I did not enable that when building flang.


Details of the problem

I configure Open MPI with few options: ./configure --with-pic --prefix=/opt/llvm/openmpi/openmpi-5.0.5/install, I am on this system not interested in any fancy interconnects or anything special.

Relevant output of the configure-script is:

checking size of Fortran REAL... 4
checking for C type corresponding to REAL... float
checking alignment of Fortran REAL... 4
checking for corresponding KIND value of REAL... C_FLOAT
checking KIND value of Fortran C_FLOAT... 4
checking if Fortran compiler supports REAL*2... yes
checking size of Fortran REAL*2... 2
checking for C type corresponding to REAL*2... opal_short_float_t
checking alignment of Fortran REAL*2... 2
checking for corresponding KIND value of REAL*2... C_SHORT_FLOAT
checking KIND value of Fortran C_SHORT_FLOAT... no ISO_C_BINDING -- fallback
checking Fortran value of selected_int_kind(4)... 2
2
checking if Fortran compiler supports REAL*4... yes
checking size of Fortran REAL*4... 4
checking for C type corresponding to REAL*4... float
checking alignment of Fortran REAL*4... 4
checking for corresponding KIND value of REAL*4... C_FLOAT
checking KIND value of Fortran C_FLOAT... (cached) 4
checking if Fortran compiler supports REAL*8... yes
checking size of Fortran REAL*8... 8
checking for C type corresponding to REAL*8... double
checking alignment of Fortran REAL*8... 8
checking for corresponding KIND value of REAL*8... C_DOUBLE
checking KIND value of Fortran C_DOUBLE... 8
checking if Fortran compiler supports REAL*16... no
checking for C type matching bit representation of REAL*16... skipped (no REAL*16)
configure: WARNING: MPI_REAL16 and MPI_COMPLEX32 support have been disabled
checking if Fortran compiler supports DOUBLE PRECISION... yes
checking size of Fortran DOUBLE PRECISION... 8
checking for C type corresponding to DOUBLE PRECISION... double
checking alignment of Fortran DOUBLE PRECISION... 8
checking for corresponding KIND value of DOUBLE PRECISION... C_DOUBLE
checking KIND value of Fortran C_DOUBLE... (cached) 8
checking if Fortran compiler supports COMPLEX... yes
checking size of Fortran COMPLEX... 8
checking for C type corresponding to COMPLEX... float _Complex
checking alignment of Fortran COMPLEX... 4
checking for corresponding KIND value of COMPLEX... C_FLOAT_COMPLEX
checking KIND value of Fortran C_FLOAT_COMPLEX... 4
checking if Fortran compiler supports COMPLEX*4... yes
checking size of Fortran COMPLEX*4... 4
checking for C type corresponding to COMPLEX*4... opal_short_float_complex_t
checking alignment of Fortran COMPLEX*4... 2
checking for corresponding KIND value of COMPLEX*4... C_SHORT_FLOAT_COMPLEX
checking KIND value of Fortran C_SHORT_FLOAT_COMPLEX... no ISO_C_BINDING -- fallback
checking Fortran value of selected_int_kind(4)... (cached) 2
2
checking if Fortran compiler supports COMPLEX*8... yes
checking size of Fortran COMPLEX*8... 8
checking for C type corresponding to COMPLEX*8... float _Complex
checking alignment of Fortran COMPLEX*8... 4
checking for corresponding KIND value of COMPLEX*8... C_FLOAT_COMPLEX
checking KIND value of Fortran C_FLOAT_COMPLEX... (cached) 4
checking if Fortran compiler supports COMPLEX*16... yes
checking size of Fortran COMPLEX*16... 16
checking for C type corresponding to COMPLEX*16... double _Complex
checking alignment of Fortran COMPLEX*16... 8
checking for corresponding KIND value of COMPLEX*16... C_DOUBLE_COMPLEX
checking KIND value of Fortran C_DOUBLE_COMPLEX... 8
checking if Fortran compiler supports COMPLEX*32... yes
checking size of Fortran COMPLEX*32... 32
checking for C type corresponding to COMPLEX*32... long double _Complex
checking alignment of Fortran COMPLEX*32... 16
checking for corresponding KIND value of COMPLEX*32... C_LONG_DOUBLE_COMPLEX
checking KIND value of Fortran C_LONG_DOUBLE_COMPLEX... 10
checking if Fortran compiler supports DOUBLE COMPLEX... yes
checking size of Fortran DOUBLE COMPLEX... 16
checking for C type corresponding to DOUBLE COMPLEX... double _Complex
checking alignment of Fortran DOUBLE COMPLEX... 8
checking for corresponding KIND value of DOUBLE COMPLEX... C_DOUBLE_COMPLEX
checking KIND value of Fortran C_DOUBLE_COMPLEX... (cached) 8

So Open MPI configure correctly detect that quad precision/real128 support is not present in the compiler.

When compiling Open MPI I get the following error:

  FC       psizeof_f.lo
error: Semantic errors in psizeof_f.f90
./psizeof_f.f90:161:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128)::x
        ^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:171:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:181:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:191:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:201:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:211:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:221:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:231:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:241:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:251:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:261:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:271:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:281:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:291:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:301:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./psizeof_f.f90:311:7: error: COMPLEX(KIND=-1) is not a supported type
        COMPLEX(REAL128), DIMENSION(1,1,1,1,1,1,1,1,1,1,1,1,1,1,*)::x
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
make[3]: *** [Makefile:2591: psizeof_f.lo] Error 1
make[3]: Leaving directory '/opt/llvm/openmpi/openmpi-5.0.7/ompi/mpi/fortran/mpif-h/profile'
make[2]: *** [Makefile:3440: all-recursive] Error 1
make[2]: Leaving directory '/opt/llvm/openmpi/openmpi-5.0.7/ompi/mpi/fortran/mpif-h'
make[1]: *** [Makefile:2710: all-recursive] Error 1
make[1]: Leaving directory '/opt/llvm/openmpi/openmpi-5.0.7/ompi'
make: *** [Makefile:1539: all-recursive] Error 1

So it seems that Open MPI is trying to work with COMPLEX(real128), which I certainly not expect the compiler to support when ordinary quad real128 is not supported.

A workaround is to recompile the compiler with quad precision support.

@ggouaillardet
Copy link
Contributor

I tried to reproduce the issue but it seems quad support is built by default in my environment.

Is there any way not to build it?

@hakostra
Copy link
Author

I looked a bit more into what goes on. Building flang is complicated, and I cannot say exactly why real128 is not present in my build, maybe it is because I attempted to build with OpenMP offloading support - but that is just speculation.

In short, the reason Open MPI build fails, is that it checks for the support of COMPLEX*32 with some simple test (the output in my 1st post clearly shows this is present), then, if this is support is present, it goes ahead and use COMPLEX(real128) as if these two declarations are equivalent. The latter does not work and the build fails, since COMPLEX*32 works and COMPLEX(real128) does not work in my flang build.

I think this is a weird behavior of flang, so I wrote up these findings here: llvm/llvm-project#131088

@hakostra hakostra changed the title OpenMPI 5.0.7 does not compile with most recent flang OpenMPI 5.0.7 does not compile with flang when real128 is not supported Mar 13, 2025
@ggouaillardet
Copy link
Contributor

Thanks, let's see how it goes.

REAL128 = -1 does ring a bell and I fixed something similar a while ago in #8116

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

3 participants