seisfwi / SWIT

Seismic Waveform Inversion Toolbox
GNU General Public License v3.0
193 stars 45 forks source link

Problem make installing the package #4

Open RunningXinLiu opened 2 years ago

RunningXinLiu commented 2 years ago

Hi Haipeng,

I am installing this package on my macbook pro M1. I have openmpi installed:

 mpif90 --version
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However, when I run make in the fd2dmpi folder I got the following error indicating grammar error. Could this be a problem with my mpi library?

❯ make
/opt/homebrew/bin/mpif90 -o .obj/global.o global.f90 -O3 -w  -c -funroll-loops -J.mod
/opt/homebrew/bin/mpif90 -o .obj/parser.o parser.f90 -O3 -w  -c -funroll-loops -J.mod
/opt/homebrew/bin/mpif90 -o .obj/datatype.o datatype.f90 -O3 -w  -c -funroll-loops -J.mod
/opt/homebrew/bin/mpif90 -o .obj/mmi_mpi.o mmi_mpi.f90 -O3 -w  -c -funroll-loops -J.mod
/opt/homebrew/bin/mpif90 -o .obj/string.o string.f90 -O3 -w  -c -funroll-loops -J.mod
/opt/homebrew/bin/mpif90 -o .obj/su.o su.f90 -O3 -w  -c -funroll-loops -J.mod
/opt/homebrew/bin/mpif90 -o .obj/io.o io.f90 -O3 -w  -c -funroll-loops -J.mod
io.f90:296:17:

  296 |   call MPI_BCAST(den(:,ix),nz_pml,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
      |                 1
......
  798 | call MPI_BCAST(fs,nx_pml,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
      |               2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
io.f90:261:17:

Best, Xin

RunningXinLiu commented 2 years ago

BTW, I dont have any problem make install this package on my remote sever, which uses the same mpi distribution as indicated in your tutorial.

mpif90 --version
GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
Haipeng-ustc commented 2 years ago

Thank you for your interest. This code has complied successfully on the Intel and AMD CPUs. On the Macbook pro with the M1, I have also encountered your problem. It seems that OpenMPI or other MPI does not work very well with the M1 chip so far (just a guess, and I'm not so sure).

Please be careful with the MPI problems and the M1 chip. I have burned out an M1 chip and get my motherboard repaired...

RunningXinLiu commented 2 years ago

Thank you for your interest. This code has complied successfully on the Intel and AMD CPUs. On the Macbook pro with the M1, I have also encountered your problem. It seems that OpenMPI or other MPI does not work very well with the M1 chip so far (just a guess, and I'm not so sure).

Please be careful with the MPI problems and the M1 chip. I have burned out an M1 chip and get my motherboard repaired...

Thank you Haipeng. This M1 chip has caused me a lot of headaches. I haven't managed to run specfem package with it probably due to the same cause. Also I the fortran language server fortls are not supported by M1... I should have just sticked to ubuntu...

Best, Xin

Haipeng-ustc commented 2 years ago

You're definitely welcome. The M1 chip also troubles me a lot. I now use it only as a code editing tool and run the code on remote servers or HPC platforms.

Best,

RunningXinLiu commented 2 years ago

I am trying to work remotely with vs code. But the server I am using does not have an internet connection. It was painstaking to download modules, packages locally and scp to the server and manually install them.

Haipeng-ustc commented 2 years ago

I'm basically in the same working mode using VS code, but our computational server can access the internal internet, which makes it easier to download some packages.

Whitt1985 commented 1 year ago

Hi, I'm experiencing the same issues as above but on a ubuntu machine with a intel CPU. What am I doing wrong here?

Haipeng-ustc commented 1 year ago

Hi, could you please provide more details about your problem? I would like to help to resolve this issue if I can.

Whitt1985 commented 1 year ago

So I've followed the instructions on the front page of GitHub and I get the exact same errors as the user above when the make file gets to the io file.

How can I validate my openmpi build is correct?

Haipeng-ustc commented 1 year ago

Hi, sorry for the late response. I was busy with my finals these days. I noticed that there are some possible solutions to this problem from https://stackoverflow.com/questions/69686755/fortran-error-type-mismatch-between-actual-argument-at-1-and-actual-argument. I excerpt two approaches here that seem good to me.

  1. Tells FORTRAN to ignore these concerns with option -fallow-argument-mismatch.
  2. Use modern FORTRAN interface (use mpi instead of include mpif.h).

The author explains that "the cause is a decision from gcc developpers on what should be «good interfaces» see here. "

Hope one of these methods works for you.

Best,

Haipeng

OUCyf commented 1 year ago

RunningXinLiu

Specfem is running fine in my M1-max chip. BTW last night, specfem-2d release a new version.