llvm-new-flang / workload-by-flang

The guide to build workloads using LLVM Flang
Apache License 2.0
0 stars 0 forks source link

Build workload FDS using LLVM Flang #2

Open MinchaoLiang opened 2 years ago

MinchaoLiang commented 2 years ago

Since llvm flang has not been successfully built before, I guess it is the installation failure. I am reinstalling llvm flang now. I have encountered an error. I don't know how to solve it. I have reinstalled it many times. I followed the steps on https://github.com/llvm/llvm-project/issues/56348 Everything was normal but ninja install, it failed like this:

CMake Error at projects/openmp/libompd/src/cmake_install.cmake:47 (file):
  file INSTALL cannot find
  "/home/lmc/Desktop/llvm-project/build-f18/lib/libompd.so": No such file or
  directory.
Call Stack (most recent call first):
  projects/openmp/libompd/cmake_install.cmake:42 (include)
  projects/openmp/cmake_install.cmake:43 (include)
  projects/cmake_install.cmake:42 (include)
  cmake_install.cmake:74 (include)
PeixinQiao commented 2 years ago

Can you try the following:

$ cd llvm-project
$ git reset --hard 109f9a291850a8e82f5026f68a382222a235c4f3
$ cd ../build-f18 && rm -rf *
$ cmake -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$installLLVMFlangPath -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang;flang;mlir;openmp" ../llvm-project/llvm
$ ninja -j
$ ninja install
MinchaoLiang commented 2 years ago

I built the llvm flang and openmpi as https://github.com/llvm/llvm-project/issues/56348 said. As the steps in https://github.com/firemodels/fds/wiki/Compiling-FDS-with-GNU-Fortran-in-Ubuntu-Linux

$ git clone https://github.com/firemodels/fds.git
$ cd fds/Build/ompi_gnu_linux
$ ./make_fds.sh

I got the result as following:

Building ompi_gnu_linux
mpifort -c -m64 -O2 -std=f2018 -frecursive -ffpe-summary=none -fall-intrinsics -cpp -DGITHASH_PP=\"FDS6.7.9-464-g480dada2a-master\" -DGITDATE_PP=\""Fri Sep 9 16:23:18 2022 -0400\"" -DBUILDDATE_PP=\""Sep 14, 2022  16:06:50\"" -DCOMPVER_PP=\""Gnu gfortran 9.4.0-1ubuntu1~20.04.1)"\"   ../../Source/prec.f90
mpifort -c -m64 -O2 -std=f2018 -frecursive -ffpe-summary=none -fall-intrinsics -cpp -DGITHASH_PP=\"FDS6.7.9-464-g480dada2a-master\" -DGITDATE_PP=\""Fri Sep 9 16:23:18 2022 -0400\"" -DBUILDDATE_PP=\""Sep 14, 2022  16:06:50\"" -DCOMPVER_PP=\""Gnu gfortran 9.4.0-1ubuntu1~20.04.1)"\"   ../../Source/imkl.f90
flang-newflang-new: : errorerror: : unknown argument: '-ffpe-summary=none'unknown argument: '-ffpe-summary=none'

make: *** [../makefile:135:prec.o] 错误 1
make: *** 正在等待未完成的任务....
make: *** [../makefile:135:imkl.o] 错误 1

Then I modify the makefile removed -ffpe-summary=none $ sed -i "/-ffpe-summary=none/d" ../makefile It erred again

Building ompi_gnu_linux
mpifort -c -mabi=lp64 -march=armv8.2-a -mtune=tsv110 -O3 -flto -std=f2018 -frecursive -fall-intrinsics -cpp -DGITHASH_PP=\"FDS6.7.9-464-g480dada2a-master\" -DGITDATE_PP=\""Fri Sep 9 16:23:18 2022 -0400\"" -DBUILDDATE_PP=\""Sep 15, 2022  21:39:31\"" -DCOMPVER_PP=\""Gnu gfortran 9.4.0-1ubuntu1~20.04.1)"\"   ../../Source/cons.f90
flang-new: warning: argument unused during compilation: '-flang-experimental-exec'
flang-new: warning: argument unused during compilation: '-mtune=tsv110'
flang-new: warning: argument unused during compilation: '-frecursive'
flang-new: warning: argument unused during compilation: '-fall-intrinsics'
flang-new: warning: argument unused during compilation: '-pthread'
error: Semantic errors in ../../Source/cons.f90
./../../Source/cons.f90:9:5: error: Cannot read module file for module 'mpi_f08': Source file 'mpi_f08.mod' was not found
  USE MPI_F08
      ^^^^^^^
./../../Source/cons.f90:359:7: error: Derived type 'mpi_comm' not found
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_NEIGHBORS       !< MPI communicator for the a given mesh and its neighbors
        ^^^^^^^^
./../../Source/cons.f90:359:47: error: No explicit type declared for 'mpi_comm_neighbors'
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_NEIGHBORS       !< MPI communicator for the a given mesh and its neighbors
                                                ^^^^^^^^^^^^^^^^^^
./../../Source/cons.f90:360:7: error: Derived type 'mpi_comm' not found
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_CLOSE_NEIGHBORS !< MPI communicator for the a given mesh and its neighbors
        ^^^^^^^^
./../../Source/cons.f90:360:47: error: No explicit type declared for 'mpi_comm_close_neighbors'
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_CLOSE_NEIGHBORS !< MPI communicator for the a given mesh and its neighbors
                                                ^^^^^^^^^^^^^^^^^^^^^^^^
make: *** [../makefile:135:cons.o] 错误 1

The mpifort is exported now,but the problem still exists.

MinchaoLiang commented 2 years ago

About the last problem,I found the similar one in https://stackoverflow.com/questions/65750862/mpi-fortran-support-through-the-mpi-f08-module-with-gfortran# .It seems I have to update the gfortran version to gfortran-10,but I should use flang rather than gfortran. According to https://github.com/firemodels/fds/wiki/FDS-Compilation .There are only methods compiled with Gnu Fortran and Intel oneAPI. This project also does not provide compilation scripts for other compilers.Maybe I have to modify the makefile to compile with flang,but I don't know how to modify it, because the file is too complex.

PeixinQiao commented 2 years ago

@MinchaoLiang No need to modify Makefile for now. What errors or outputs did you get when you build this workload after you export the environments of Flang and OpenMPI?

MinchaoLiang commented 2 years ago

The error is still as following:

Building ompi_gnu_linux
mpifort -c -mabi=lp64 -march=armv8.2-a -mtune=tsv110 -O3 -flto -std=f2018 -frecursive -fall-intrinsics -cpp -DGITHASH_PP=\"FDS6.7.9-464-g480dada2a-master\" -DGITDATE_PP=\""Fri Sep 9 16:23:18 2022 -0400\"" -DBUILDDATE_PP=\""Sep 15, 2022  21:39:31\"" -DCOMPVER_PP=\""Gnu gfortran 9.4.0-1ubuntu1~20.04.1)"\"   ../../Source/cons.f90
flang-new: warning: argument unused during compilation: '-flang-experimental-exec'
flang-new: warning: argument unused during compilation: '-mtune=tsv110'
flang-new: warning: argument unused during compilation: '-frecursive'
flang-new: warning: argument unused during compilation: '-fall-intrinsics'
flang-new: warning: argument unused during compilation: '-pthread'
error: Semantic errors in ../../Source/cons.f90
./../../Source/cons.f90:9:5: error: Cannot read module file for module 'mpi_f08': Source file 'mpi_f08.mod' was not found
  USE MPI_F08
      ^^^^^^^
./../../Source/cons.f90:359:7: error: Derived type 'mpi_comm' not found
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_NEIGHBORS       !< MPI communicator for the a given mesh and its neighbors
        ^^^^^^^^
./../../Source/cons.f90:359:47: error: No explicit type declared for 'mpi_comm_neighbors'
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_NEIGHBORS       !< MPI communicator for the a given mesh and its neighbors
                                                ^^^^^^^^^^^^^^^^^^
./../../Source/cons.f90:360:7: error: Derived type 'mpi_comm' not found
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_CLOSE_NEIGHBORS !< MPI communicator for the a given mesh and its neighbors
        ^^^^^^^^
./../../Source/cons.f90:360:47: error: No explicit type declared for 'mpi_comm_close_neighbors'
  TYPE (MPI_COMM), ALLOCATABLE, DIMENSION(:) :: MPI_COMM_CLOSE_NEIGHBORS !< MPI communicator for the a given mesh and its neighbors
                                                ^^^^^^^^^^^^^^^^^^^^^^^^
make: *** [../makefile:135:cons.o] 错误 1
PeixinQiao commented 2 years ago

@Wang-Zhewei