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 fails to build with F18 #7586

Closed
eugeneswalker opened this issue Apr 1, 2020 · 8 comments
Closed

OpenMPI fails to build with F18 #7586

eugeneswalker opened this issue Apr 1, 2020 · 8 comments
Labels

Comments

@eugeneswalker
Copy link

I'm trying to build OpenMPI 4.0.3 using Clang 9.0.1 and F18, with gfortran 7.3.0 as the backend for F18. The system is Ubuntu 18.04 x86_64. OpenMPI source fetched from http://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-4.0.3.tar.bz2

The build is failing during configure phase:

    '/tmp/root/spack-stage/spack-stage-openmpi-4.0.3-32tvapmntgmsoawg2eowyvtc6szvpgfu/spack-src/configure' '--prefix=/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-9.0.1/openmpi-4.0.3-32tvapmntgmsoawg2eowyvtc6szvpgfu' '--enable-shared' '--disable-silent-rules' '--with-wrapper-ldflags=' '--enable-static' '--without-pmi' '--enable-mpi-cxx' '--with-zlib=/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-9.0.1/zlib-1.2.11-y64uypcj7qpkhqxac7y2gjnymy3em6fx' '--enable-mpi1-compatibility' '--without-psm2' '--without-mxm' '--without-libfabric' '--without-psm' '--without-verbs' '--without-ucx' '--without-tm' '--without-sge' '--without-lsf' '--without-loadleveler' '--without-alps' '--without-slurm' '--disable-memchecker' '--with-hwloc=/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-9.0.1/hwloc-1.11.11-rmr6go23gjfdzgiyft4y5bkg6zrklwp4' '--disable-java' '--disable-mpi-java' '--without-cuda' '--enable-cxx-exceptions'
1 error found in build log:
     570    checking if building Fortran mpif.h bindings... yes
     571    checking if Fortran compiler supports INTERFACE... yes
     572    checking if Fortran compiler supports ISO_FORTRAN_ENV... no
     573    checking if Fortran compiler supports STORAGE_SIZE for relevant types... no
     574    checking for Fortran compiler module include flag...
     575    configure: WARNING: *** Could not determine the fortran compiler flag to indicate where modules reside
  >> 576    configure: error: *** Cannot continue

Here is config.log : config.log.txt

@jsquyres
Copy link
Member

jsquyres commented Apr 1, 2020

I'm not 100% sure, but I'm guessing we're not explicitly testing the F18 compiler.

What's the F18 flag to specify the path where modules can be found?

@zbeekman
Copy link

zbeekman commented Apr 1, 2020

It looks like the problem is that the compiler is returning a non-zero exit status when it is using the correct module include flag. When the wrong include flag is used, f18/flang print:

/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/f18-master-j7tbqlr3llsvoe4hbej7lvcazup4qehk/bin/f18: semantic errors in conftest.f90
configure:68682: $? = 1
configure:68696: /opt/spack/lib/spack/env/clang/flang  -fexceptions  conftest.f90 subdir/conftest-module.o                                           -psubdir   -L/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-9.0.1/zlib-1.2.11-y64uypcj7qpkhqxac7y2gjnymy3em6fx/lib -fexceptions  -lz
conftest.f90:2:7: error: Error reading module file for module 'ompi_mod_flag'
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
conftest.f90:2:7: Could not open 'ompi_mod_flag.mod': No such file or directory

When -I is passed you get a different error:

configure:68607: checking for Fortran compiler module include flag
configure:68631: /opt/spack/lib/spack/env/clang/flang  -fexceptions  -c conftest-module.f90   -L/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-9.0.1/zlib-1.2.11-y64uypcj7qpkhqxac7y2gjnymy3em6fx/lib -fexceptions  -lz
configure:68638: $? = 0
configure:68675: /opt/spack/lib/spack/env/clang/flang  -fexceptions  conftest.f90 -Isubdir   -L/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-9.0.1/zlib-1.2.11-y64uypcj7qpkhqxac7y2gjnymy3em6fx/lib -fexceptions  -lz
conftest.f90:2:7: error: Error reading module file for module 'ompi_mod_flag'
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
conftest.f90:2:7: Incomplete character literal
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
conftest.f90:2:7: error: Error reading module file for module 'ompi_mod_flag'
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
conftest.f90:2:7: Incomplete character literal
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/f18-master-j7tbqlr3llsvoe4hbej7lvcazup4qehk/bin/f18: semantic errors in conftest.f90
configure:68682: $? = 1
configure:68696: /opt/spack/lib/spack/env/clang/flang  -fexceptions  conftest.f90 subdir/conftest-module.o                                           -Isubdir   -L/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-9.0.1/zlib-1.2.11-y64uypcj7qpkhqxac7y2gjnymy3em6fx/lib -fexceptions  -lz
conftest.f90:2:7: error: Error reading module file for module 'ompi_mod_flag'
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
conftest.f90:2:7: Incomplete character literal
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
conftest.f90:2:7: error: Error reading module file for module 'ompi_mod_flag'
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
conftest.f90:2:7: Incomplete character literal
    use OMPI_MOD_FLAG
        ^^^^^^^^^^^^^
/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/f18-master-j7tbqlr3llsvoe4hbej7lvcazup4qehk/bin/f18: semantic errors in conftest.f90
/usr/lib/x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
configure:68705: $? = 1

Is there a way to see the entire contents of conftest.f90? (And also the source file that generated OMPI_MOD_FLAG in subdir?)

In addition, it seems like the intrinsic modules ISO_Fortran_ENV and ISO_C_BINDING are not being located. It looks like maybe -intrinsic-module-directory also needs to be added and point to the correct location. (I guess the GFortran 7.5 intrinsic module directory?)

@zbeekman
Copy link

zbeekman commented Apr 1, 2020

This looks to me like the ompi_mod_flag.mod file may have been generated with a different Fortran compiler? If it was generated with GFortran you can gunzip it and examine the contents of the .mod file as plain text.

@zbeekman
Copy link

zbeekman commented Apr 1, 2020

@jsquyres FYI, after testing some more (manually) this appears (to me at least) to be either an F18 bug, or a configuration/toolchain issue. -I should be the correct include flag, but running the simple code by hand from https://github.com/open-mpi/ompi/blob/master/config/ompi_fortran_find_module_include_flag.m4 will reproduce the problem.

@coti
Copy link

coti commented Apr 1, 2020

Hi,

I have the problem too. We have contacted the f18 team on Slack and we got an answer. It is related to what is described in flang-compiler/f18#1011.

Short version: binary modules compiled with f18 are actually compiled by the backend compiler, which can be gfortran. Therefore, they cannot be used by f18. We need to get a text module. For this, the module and the resulting file need to be compiled with -module-suffix .f18.mod.

When we compile the module with:

$ f18 -module-suffix .f18.mod -c conftest-module.f90

It generates two files:

ompi_mod_flag.f18.mod
ompi_mod_flag.mod

The first one is a text module that can be used by f18.

$ cat ompi_mod_flag.f18.mod
!mod$ v1 sum:cc0b4f1869785c46
module ompi_mod_flag
type::ompi_mod_flag_type
integer(4)::i
end type
end

Then we can compile the second one:

$ f18 -module-suffix .f18.mod -c conftest.f90

Edit: I can compile OpenMPI 4.0.3 using FCFLAGS="-module-suffix .f18.mod" almost

@coti
Copy link

coti commented Apr 6, 2020

Hi,
I have made some significant progress in compiling OpenMPI. I had to modify the libtool script: in the FC tag section, there was:
wl=""
which I have replaced by
wl="-Wl,"

Then I get a new error:

gfortran: warning: ../../../../ompi/mpi/fortran/mpif-h/.libs/libmpi_mpifh.so: linker input file unused because linking not done
gfortran: warning: /home/users/coti/x86/openmpi-4.0.3/ompi/.libs/libmpi.so: linker input file unused because linking not done
gfortran: warning: /home/users/coti/x86/openmpi-4.0.3/orte/.libs/libopen-rte.so: linker input file unused because linking not done
gfortran: warning: /home/users/coti/x86/openmpi-4.0.3/opal/.libs/libopen-pal.so: linker input file unused because linking not done
gfortran: warning: /packages/gcc/8.1/lib/../lib64/libgfortran.so: linker input file unused because linking not done
gfortran: warning: /packages/gcc/8.1/lib/../lib64/libquadmath.so: linker input file unused because linking not done
gfortran: error: libmpi_mpifh.o: No such file or directory
gfortran: error: libmpi.o: No such file or directory
gfortran: error: libopen-rte.o: No such file or directory
gfortran: error: libopen-pal.o: No such file or directory
gfortran: error: libgfortran.o: No such file or directory
gfortran: error: libquadmath.o: No such file or directory

I suspect that there might be another option to fix in libtool, but this is beyond what I know about it...

I have also tried adding pic_flag=" -fPIC" , unsuccessfully.

Thanks

@jsquyres
Copy link
Member

Forgive my ignorance, but F18 is not yet a production-quality compiler, right?

If that's correct, I'd prefer to have them fix their issue rather than put in a gnarly workaround in our m4 code (and/or patch Libtool).

@jsquyres
Copy link
Member

jsquyres commented May 2, 2020

Given the length of time between responses on this issue, I'm going to close it due to inactivity.

If it turns out that F18 is a production-quality compiler and/or there is a bug we should be fixing here in Open MPI, we can re-open this.

@jsquyres jsquyres closed this as completed May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants