issp-center-dev / HPhi

Quantum Lattice Model Simulator Package
https://www.pasums.issp.u-tokyo.ac.jp/hphi/en/
GNU General Public License v3.0
82 stars 25 forks source link

Compile using gcc10 #107

Open k-yoshimi opened 3 years ago

k-yoshimi commented 3 years ago

When you use gcc10 with MPI for compiling HPhi and receive the following error

  165 |   &  call MPI_allREDUCE(MPI_IN_PLACE, prod, 1, &
      |                                      1
......
  194 |   &  call MPI_allREDUCE(MPI_IN_PLACE, maxarray, 1, &
      |                                      2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(8)/REAL(8)).

please add the following option for cmake. -DCMAKE_Fortran_FLAGS_RELEASE=-fallow-argument-mismatch

ref. https://gcc.gnu.org/gcc-10/changes.html

Mismatches between actual and dummy argument lists in a single file are now rejected with an error. Use the new option -fallow-argument-mismatch to turn these errors into warnings; this option is implied with -std=legacy. -Wargument-mismatch has been removed.

Schlufi commented 3 years ago

Also starting with version 10, GCC defaults to using -fno-common. This results in a large amount of multiple definition errors during linking. Adding -fcommon to the C flags should fix this.

wistaria commented 3 years ago

https://github.com/wistaria/MateriAppsInstaller/blob/master/apps/hphi/patch/hphi-3.4.0.patch solves the problem with GCC 10.

wistaria commented 3 years ago

The above patch works also for GCC 11.