akuhara / MC3deconv

Bayeisan inversion to recover Green's functions of receiver-side structures from teleseismic waveforms
GNU General Public License v3.0
18 stars 7 forks source link

cannot run in 4 cores #1

Closed JouSF-1409 closed 1 year ago

JouSF-1409 commented 1 year ago

Hello there, I'm interesting in your method calculating deconvolution, and planning to apply it to S wave receiver function caculations.

But I cannot compile and run your code in a full success. I only have few experience in compiling fortran codes, a little experience developing openmp application on C/C++ and writing Makefiles.

platform: manjaro(archlinux), gfortran version 13.1.1, openmpi 4.1.5-1

I will list my problems down bellow

  1. Compiling stage:

    src/output.f90 -o src/output.o 
    src/output.f90:49:18:
    
    46 |   call mpi_reduce(nmod, nmod_sum, 1, MPI_INTEGER4, &
      |                  2
    ......
    49 |   call mpi_reduce(nprop, nprop_sum, ntype, MPI_INTEGER4, &
      |                  1
    Warning: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)
    src/output.f90:49:25:
    
    46 |   call mpi_reduce(nmod, nmod_sum, 1, MPI_INTEGER4, &
      |                        2 
    ......
    49 |   call mpi_reduce(nprop, nprop_sum, ntype, MPI_INTEGER4, &
      |                         1
    Warning: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)
    src/output.f90:52:18:
    
    46 |   call mpi_reduce(nmod, nmod_sum, 1, MPI_INTEGER4, &
      |                  2
    ......
    52 |   call mpi_reduce(naccept, naccept_sum, ntype, MPI_INTEGER4, &
      |                  1
    Warning: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)
    src/output.f90:52:27:
    
    46 |   call mpi_reduce(nmod, nmod_sum, 1, MPI_INTEGER4, &
      |                        2   
    ......
    52 |   call mpi_reduce(naccept, naccept_sum, ntype, MPI_INTEGER4, &
      |                           1
    Warning: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)

after searching for solution, I add -fallow-argument-mismatch at FFLAGS in Makefile.

But in sample1, I can't run code in 4 core like

mpirun -np 4 ../bin/mc3deconv

for it run slower than using 2 cores, and stuck in writing file stage(wiered. but it works well in using just 2 cores

  1. FFLAGS for debug

since my gfortran version is way newer than my colleagues in office(they are using Ubuntu 16.04 or even lower), I tried to add restriction for compiling, like switching mpifort to gfortran and add -fopenmp -I/usr/include -std=f95 -Wall to FFLAGS

the output warning is even more confusing and I quote a few part bellow:

mpif-sizeof.h:66:42:                                                                                        

Error: Fortran 2008: Array specification at (1) with more than 7 dimensions
mpif-sizeof.h:115:14:

Error: Parameter ‘real128’ at (1) has not been declared or is a variable, which does not reduce to a constant
mpif-sizeof.h:128:26:

Error: Fortran 2003: module nature in USE statement at (1)

confused,

JouSF-1409 commented 1 year ago

I run it in docker. problem solved.