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

gfortran - type mismatch / rank mismatch while compiling #1181

Open
HakunanMatatat opened this issue Mar 23, 2023 · 3 comments
Open

gfortran - type mismatch / rank mismatch while compiling #1181

HakunanMatatat opened this issue Mar 23, 2023 · 3 comments

Comments

@HakunanMatatat
Copy link

The following errors occur as gcc-11 gfortran-11.

gfortran -g -O2 -std=f2008 -fimplicit-none -fmax-errors=10 -pedantic -pedantic-errors -Waliasing -Wampersand -Wcharacter-truncation -Wline-truncation -Wsurprising -Wno-tabs -Wunderflow -ffpe-trap=invalid,zero,overflow -Wunused -O3 -finline-functions -DWITH_MPI -J./obj -I./obj -I. -I./setup -c -o obj/define_external_model_from_tomo_file.spec.o src/specfem2D/define_external_model_from_tomo_file.f90
src/shared/parallel.F90:340:17:

340 | call MPI_BCAST(buffer,1,MPI_INTEGER,0,my_local_mpi_comm_world,ier)
| 1
......
395 | call MPI_BCAST(buffer,1,MPI_LOGICAL,0,my_local_mpi_comm_world,ier)
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/LOGICAL(4)).
src/shared/parallel.F90:368:17:

368 | call MPI_BCAST(buffer,countval,MPI_LOGICAL,0,my_local_mpi_comm_world,ier)
| 1
......
395 | call MPI_BCAST(buffer,1,MPI_LOGICAL,0,my_local_mpi_comm_world,ier)
| 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)

export FCFLAGS="-w -fallow-argument-mismatch -O2"
export FFLAGS="-w -fallow-argument-mismatch -O2"
This Flag adding didn't work.

Errors still as gcc-9 gfortran-9

gfortran: error: unrecognized command line option ‘-fallow-invalid-boz’
gfortran: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
make: *** [src/shared/rules.mk:102: obj/parallel.sharedmpi.o] Error 1

Hoping your help. Thanks very much.

@danielpeter
Copy link
Contributor

this is an annoying GCC "feature" introduced in newer versions with stricter argument checking in single files.

please see the comment here:
SPECFEM/specfem3d#1584 (comment)

add either the -std=legacy or the -fallow-argument-mismatch to the compilation flags for GCC compiler versions >= 10 in a line like:

./configure FC=gfortran CC=gcc MPIFC=mpif90 --with-mpi FLAGS_CHECK="-O3 -fallow-argument-mismatch -Wall -Wno-conversion -Wno-maybe-uninitialized"

on older GCC versions <= 9, you won't need the -fallow-argument-mismatch flag, simply:

./configure FC=gfortran CC=gcc MPIFC=mpif90 --with-mpi FLAGS_CHECK="-O3 -Wall -Wno-conversion -Wno-maybe-uninitialized"

give it a try and let me know if this works on your system.

@HakunanMatatat
Copy link
Author

hi, @daniel, thanks! It is too many warnings. ./run_this_example works fine.

specfem3D - https://ctxt.io/2/AACQ_JETFA
specfem2d - https://ctxt.io/2/AACQ0ul1FA

I don't know the limination using CUDA with spcefem2d.

@danielpeter
Copy link
Contributor

the compilation of the 2D version with CUDA support is the same as in the 3D version, thus in your case something like:

./configure .. --with-cuda=cuda11  CUDA_LIB=/usr/local/cuda-11.7/lib64 ..

you can follow the settings as described here:
https://specfem3d.readthedocs.io/en/latest/02_getting_started/#using-the-gpu-version-of-the-code

note that the 2D version only has CUDA support, whereas the 3D version also supports HIP now.

also, the setting --with-cuda=cuda11 refers to your target architecture, i.e., a Nvidida A100 card in this case. it doesn't refer to your CUDA toolkit version that you have installed on your system. for example, you can have a toolkit version 11 installed, but want to run the simulation on an older card, say a Pascal P100. in this case, you would use

./configure .. --with-cuda=cuda8  CUDA_LIB=/usr/local/cuda-11.7/lib64 ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants