epfl-theos / koopmans-kcp

Implementation of Koopmans functionals with full orbital optimization in Quantum ESPRESSO v4.1
https://koopmans-functionals.org/en/latest/
GNU General Public License v2.0
0 stars 0 forks source link

compilation with Scalapack does not work #19

Open nscolonna opened 1 year ago

nscolonna commented 1 year ago

when linking scalapack library the compilation fails:

/usr/bin/ld: libcp.a(ortho_base.o): in function `__orthogonalize_base_MOD_diagonalize_parallel_cmplx':
/home/nicola/CODES/koopmans/quantum_espresso/kcp/CPV/ortho_base.f90:241: undefined reference to `pzheevd_drv_'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:211: kcp.x] Error 1
make[1]: Leaving directory '/home/nicola/CODES/koopmans/quantum_espresso/kcp/CPV'
make: *** [Makefile:14: kcp] Error 2

never really tested scalapack implementation.

nscolonna commented 1 year ago

including the missing subroutine:

diff --git a/CPV/ortho_base.f90 b/CPV/ortho_base.f90
index 720a030..f3007a6 100644
--- a/CPV/ortho_base.f90
+++ b/CPV/ortho_base.f90
@@ -12,7 +12,7 @@ MODULE orthogonalize_base

       USE kinds
       USE dspev_module, ONLY: pdspev_drv, dspev_drv
-      USE zhpev_module, ONLY: pzhpev_drv, zhpev_drv
+      USE zhpev_module, ONLY: pzhpev_drv, zhpev_drv, pzheevd_drv

       IMPLICIT NONE

leads to the following error:

mpif90 -O3 -g -cpp -D__GFORTRAN -D__FFTW3 -D__MPI -D__PARA -D__SCALAPACK -I../include  -I./  -I../Modules  -I../iotk/src -c ortho_base.f90
ortho_base.f90:241:86:

  241 |          CALL pzheevd_drv( .true. , n, desc( nlax_ ), s, SIZE(s,1), rhod, ortho_cntx )
      |                                                                                      1
Error: Type mismatch in argument ‘w’ at (1); passed INTEGER(4) to REAL(8)
nscolonna commented 1 year ago

This solve the compilation issue, but need to check that the code still runs and works properly

diff --git a/CPV/ortho_base.f90 b/CPV/ortho_base.f90
index 720a030..6ec95cb 100644
--- a/CPV/ortho_base.f90
+++ b/CPV/ortho_base.f90
@@ -12,7 +12,7 @@ MODULE orthogonalize_base

       USE kinds
       USE dspev_module, ONLY: pdspev_drv, dspev_drv
-      USE zhpev_module, ONLY: pzhpev_drv, zhpev_drv
+      USE zhpev_module, ONLY: pzhpev_drv, zhpev_drv, pzheevd_drv

       IMPLICIT NONE

@@ -238,7 +238,8 @@ SUBROUTINE diagonalize_parallel_cmplx( n, rhos, rhod, s, desc )
          s = rhos
          !
 #ifdef __SCALAPACK
-         CALL pzheevd_drv( .true. , n, desc( nlax_ ), s, SIZE(s,1), rhod, ortho_cntx )
+         !CALL pzheevd_drv( .true. , n, desc( nlax_ ), s, SIZE(s,1), rhod, ortho_cntx )
+         CALL pzheevd_drv( .true. , n, desc( nlax_ ), s, rhod, ortho_cntx )
 #else
          CALL qe_pzheevd( .true., n, desc, s, SIZE(s,1), rhod )
 #endif
`