Merge remote-tracking branch 'gitlab/develop' into develop

This commit is contained in:
Samuel Ponce 2020-07-07 16:32:08 +02:00
commit 1e8ad579ef
29 changed files with 247 additions and 214 deletions

View File

@ -301,21 +301,23 @@
! !
IF (nbndsub /= nbndep) WRITE(stdout, '(/,5x,a,i4)' ) 'Band disentanglement is used: nbndsub = ', nbndsub IF (nbndsub /= nbndep) WRITE(stdout, '(/,5x,a,i4)' ) 'Band disentanglement is used: nbndsub = ', nbndsub
! !
ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr) IF (.NOT. (epwread .AND. .NOT. epbread)) THEN
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cu', 1) ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr)
ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cu', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cuq', 1) ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr)
ALLOCATE(lwin(nbndep, nks), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cuq', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwin', 1) ALLOCATE(lwin(nbndep, nks), STAT = ierr)
ALLOCATE(lwinq(nbndep, nks), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwin', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwinq', 1) ALLOCATE(lwinq(nbndep, nks), STAT = ierr)
ALLOCATE(exband(nbnd), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwinq', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating exband', 1) ALLOCATE(exband(nbnd), STAT = ierr)
cu(:, :, :) = czero IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating exband', 1)
cuq(:, :, :) = czero cu(:, :, :) = czero
lwin(:, :) = .FALSE. cuq(:, :, :) = czero
lwinq(:, :) = .FALSE. lwin(:, :) = .FALSE.
exband(:) = .FALSE. lwinq(:, :) = .FALSE.
exband(:) = .FALSE.
ENDIF
! !
ALLOCATE(w2(3 * nat), STAT = ierr) ALLOCATE(w2(3 * nat), STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating w2', 1) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating w2', 1)
@ -519,19 +521,18 @@
DEALLOCATE(epmatwe_mem, STAT = ierr) DEALLOCATE(epmatwe_mem, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating epmatwe_mem', 1) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating epmatwe_mem', 1)
ENDIF ENDIF
DEALLOCATE(cu, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating cu', 1)
DEALLOCATE(cuq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating cuq', 1)
DEALLOCATE(lwin, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating lwin', 1)
DEALLOCATE(lwinq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating lwinq', 1)
DEALLOCATE(exband, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating exband', 1)
ENDIF ! (epwread .AND. .NOT. epbread) ENDIF ! (epwread .AND. .NOT. epbread)
! !
DEALLOCATE(cu, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating cu', 1)
DEALLOCATE(cuq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating cuq', 1)
DEALLOCATE(lwin, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating lwin', 1)
DEALLOCATE(lwinq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating lwinq', 1)
DEALLOCATE(exband, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating exband', 1)
!
! Check Memory usage ! Check Memory usage
CALL system_mem_usage(valueRSS) CALL system_mem_usage(valueRSS)
! !

View File

@ -287,21 +287,23 @@
! !
IF (nbndsub /= nbndep) WRITE(stdout, '(/,5x,a,i4)' ) 'Band disentanglement is used: nbndsub = ', nbndsub IF (nbndsub /= nbndep) WRITE(stdout, '(/,5x,a,i4)' ) 'Band disentanglement is used: nbndsub = ', nbndsub
! !
ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr) IF (.NOT. (epwread .AND. .NOT. epbread)) THEN
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cu', 1) ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr)
ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cu', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cuq', 1) ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr)
ALLOCATE(lwin(nbndep, nks), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cuq', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwin', 1) ALLOCATE(lwin(nbndep, nks), STAT = ierr)
ALLOCATE(lwinq(nbndep, nks), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwin', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwinq', 1) ALLOCATE(lwinq(nbndep, nks), STAT = ierr)
ALLOCATE(exband(nbnd), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwinq', 1)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating exband', 1) ALLOCATE(exband(nbnd), STAT = ierr)
cu(:, :, :) = czero IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating exband', 1)
cuq(:, :, :) = czero cu(:, :, :) = czero
lwin(:, :) = .FALSE. cuq(:, :, :) = czero
lwinq(:, :) = .FALSE. lwin(:, :) = .FALSE.
exband(:) = .FALSE. lwinq(:, :) = .FALSE.
exband(:) = .FALSE.
ENDIF
! !
ALLOCATE(w2(3 * nat), STAT = ierr) ALLOCATE(w2(3 * nat), STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating w2', 1) IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating w2', 1)
@ -475,19 +477,18 @@
IF (.NOT. vme) DEALLOCATE(dmec) IF (.NOT. vme) DEALLOCATE(dmec)
DEALLOCATE(epmatwe_mem, STAT = ierr) DEALLOCATE(epmatwe_mem, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating epmatwe_mem', 1) IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating epmatwe_mem', 1)
DEALLOCATE(cu, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating cu', 1)
DEALLOCATE(cuq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating cuq', 1)
DEALLOCATE(lwin, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating lwin', 1)
DEALLOCATE(lwinq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating lwinq', 1)
DEALLOCATE(exband, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating exband', 1)
ENDIF ! (epwread .AND. .NOT. epbread) ENDIF ! (epwread .AND. .NOT. epbread)
! !
DEALLOCATE(cu, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating cu', 1)
DEALLOCATE(cuq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating cuq', 1)
DEALLOCATE(lwin, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating lwin', 1)
DEALLOCATE(lwinq, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating lwinq', 1)
DEALLOCATE(exband, STAT = ierr)
IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error deallocating exband', 1)
!
! Check Memory usage ! Check Memory usage
CALL system_mem_usage(valueRSS) CALL system_mem_usage(valueRSS)
! !

View File

@ -1228,7 +1228,7 @@
#if defined(__MPI) #if defined(__MPI)
filephmat = TRIM(dirname) // '/' // 'ephmat' // filelab filephmat = TRIM(dirname) // '/' // 'ephmat' // filelab
#else #else
filephmat = TRIM(tmp_dir) // '/' // 'ephmat' filephmat = TRIM(dirname) // '/' // 'ephmat'
#endif #endif
!OPEN(UNIT = iufileph, FILE = filephmat, STATUS = 'unknown', FORM = 'formatted', IOSTAT = ios) !OPEN(UNIT = iufileph, FILE = filephmat, STATUS = 'unknown', FORM = 'formatted', IOSTAT = ios)
OPEN(UNIT = iufileph, FILE = filephmat, STATUS = 'unknown', FORM = 'unformatted', IOSTAT = ios) OPEN(UNIT = iufileph, FILE = filephmat, STATUS = 'unknown', FORM = 'unformatted', IOSTAT = ios)

View File

@ -257,6 +257,10 @@ CONTAINS
! !
INTEGER :: comm2s INTEGER :: comm2s
! !
#if defined(_OPENMP) && !defined(__FFT_SCALAR_THREAD_SAFE)
CALL errore('many_cft3s::execute_using_tasks','needs thread-safe fft_scalar backend selected at compile time.',1)
#endif
!
IF ( isgn > 0 ) THEN ! G -> R IF ( isgn > 0 ) THEN ! G -> R
!$omp parallel default(none) & !$omp parallel default(none) &
!$omp private(i, j, comm2s) & !$omp private(i, j, comm2s) &
@ -350,6 +354,11 @@ CONTAINS
! This implementation requires thread-safe cft_1z ! This implementation requires thread-safe cft_1z
! !
IMPLICIT NONE IMPLICIT NONE
!
#if defined(_OPENMP) && !defined(__FFT_SCALAR_THREAD_SAFE)
CALL errore('many_cft3s::execute_using_threads','needs thread-safe fft_scalar backend selected at compile time.',1)
#endif
!
IF ( isgn > 0 ) THEN ! G -> R IF ( isgn > 0 ) THEN ! G -> R
!$omp parallel default(none) & !$omp parallel default(none) &
!$omp private(i, j) & !$omp private(i, j) &

View File

@ -6,6 +6,13 @@
! in the root directory of the present distribution, ! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt . ! or http://www.gnu.org/copyleft/gpl.txt .
#if defined(__ARM_LIB)
#if defined(_OPENMP) && defined(__FFT_SCALAR_THREAD_SAFE)
! thread safety guard
#error ARM_LIB is not compatiable with __FFT_SCALAR_THREAD_SAFE
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
MODULE fft_scalar_arm MODULE fft_scalar_arm
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
@ -16,8 +23,6 @@
IMPLICIT NONE IMPLICIT NONE
SAVE SAVE
#if defined(__ARM_LIB)
PRIVATE PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
@ -633,7 +638,7 @@ SUBROUTINE cfft3ds (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign, &
END SUBROUTINE init_plan END SUBROUTINE init_plan
END SUBROUTINE cfft3ds END SUBROUTINE cfft3ds
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
END MODULE fft_scalar_arm END MODULE fft_scalar_arm
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
#endif

View File

@ -7,6 +7,13 @@
! or http://www.gnu.org/copyleft/gpl.txt . ! or http://www.gnu.org/copyleft/gpl.txt .
! !
#if defined(__LINUX_ESSL)
#if defined(_OPENMP) && defined(__FFT_SCALAR_THREAD_SAFE)
! thread safety guard
#error ESSL is not compatiable with __FFT_SCALAR_THREAD_SAFE
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
MODULE fft_scalar_essl MODULE fft_scalar_essl
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
@ -15,10 +22,8 @@
IMPLICIT NONE IMPLICIT NONE
SAVE SAVE
#if defined(__LINUX_ESSL) PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
! ... Local Parameter ! ... Local Parameter
@ -639,8 +644,7 @@ SUBROUTINE cfft3ds (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign, &
END IF END IF
RETURN RETURN
END SUBROUTINE cfft3ds END SUBROUTINE cfft3ds
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
END MODULE fft_scalar_essl END MODULE fft_scalar_essl
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
#endif

View File

@ -6,10 +6,16 @@
! in the root directory of the present distribution, ! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt . ! or http://www.gnu.org/copyleft/gpl.txt .
#if defined(__FFTW)
#if defined(_OPENMP) && defined(__FFT_SCALAR_THREAD_SAFE)
! thread safety guard
#error FFTW is not compatiable with __FFT_SCALAR_THREAD_SAFE
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
MODULE fft_scalar_FFTW MODULE fft_scalar_FFTW
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
USE fft_param USE fft_param
!! iso_c_binding provides C_PTR, C_NULL_PTR, C_ASSOCIATED !! iso_c_binding provides C_PTR, C_NULL_PTR, C_ASSOCIATED
USE iso_c_binding USE iso_c_binding
@ -718,8 +724,7 @@ SUBROUTINE cfft3ds (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign, &
END SUBROUTINE init_plan END SUBROUTINE init_plan
END SUBROUTINE cfft3ds END SUBROUTINE cfft3ds
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
END MODULE fft_scalar_FFTW END MODULE fft_scalar_FFTW
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
#endif

View File

@ -16,6 +16,13 @@
! stick and plane revision - Stefano de Gironcoli - September 2016 ! stick and plane revision - Stefano de Gironcoli - September 2016
!--------------------------------------------------------------------------! !--------------------------------------------------------------------------!
#if defined(__FFTW3)
#if defined(_OPENMP) && defined(__FFT_SCALAR_THREAD_SAFE)
! thread safety guard
#error FFTW3 is not compatiable with __FFT_SCALAR_THREAD_SAFE
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
MODULE fft_scalar_fftw3 MODULE fft_scalar_fftw3
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
@ -24,7 +31,6 @@
USE fft_param USE fft_param
IMPLICIT NONE IMPLICIT NONE
SAVE SAVE
#if defined(__FFTW3)
PRIVATE PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
@ -665,7 +671,7 @@ SUBROUTINE cfft3ds (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign, &
END SUBROUTINE init_plan END SUBROUTINE init_plan
END SUBROUTINE cfft3ds END SUBROUTINE cfft3ds
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
END MODULE fft_scalar_fftw3 END MODULE fft_scalar_fftw3
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
#endif

View File

@ -6,6 +6,13 @@
! in the root directory of the present distribution, ! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt . ! or http://www.gnu.org/copyleft/gpl.txt .
#if defined(__SX6)
#if defined(_OPENMP) && defined(__FFT_SCALAR_THREAD_SAFE)
! thread safety guard
#error SX6 is not compatiable with __FFT_SCALAR_THREAD_SAFE
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
MODULE fft_scalar_sx6 MODULE fft_scalar_sx6
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
@ -14,9 +21,8 @@
IMPLICIT NONE IMPLICIT NONE
SAVE SAVE
#if defined(__SX6) PRIVATE
PRIVATE PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
CONTAINS CONTAINS
@ -504,7 +510,7 @@ SUBROUTINE cfft3ds (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign, &
CALL cfft3d (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign) CALL cfft3d (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign)
RETURN RETURN
END SUBROUTINE cfft3ds END SUBROUTINE cfft3ds
#endif
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
END MODULE fft_scalar_sx6 END MODULE fft_scalar_sx6
!=----------------------------------------------------------------------=! !=----------------------------------------------------------------------=!
#endif

View File

@ -32,8 +32,10 @@
USE fft_scalar_sx6 USE fft_scalar_sx6
#elif defined(__ARM_LIB) #elif defined(__ARM_LIB)
USE fft_scalar_arm USE fft_scalar_arm
#else #elif defined(__FFTW)
USE fft_scalar_fftw USE fft_scalar_fftw
#else
#error No fft_scalar backend selected!
#endif #endif
IMPLICIT NONE IMPLICIT NONE

View File

@ -675,7 +675,7 @@ MODULE io_base
#if defined (__HDF5) #if defined (__HDF5)
CALL qeh5_openfile(h5file, TRIM(filename)//'.hdf5', ACTION = 'read', & CALL qeh5_openfile(h5file, TRIM(filename)//'.hdf5', ACTION = 'read', &
error = ierr) error = ierr)
IF ( ierr /= 0 . AND. PRESENT(ier_) ) THEN IF ( ierr /= 0 .AND. PRESENT(ier_) ) THEN
ier_ = ierr ier_ = ierr
RETURN RETURN
END IF END IF

View File

@ -380,6 +380,7 @@ CONTAINS
U_projection = TRIM ( dft_obj%dftU%U_projection_type ) U_projection = TRIM ( dft_obj%dftU%U_projection_type )
Hubbard_l =-1 Hubbard_l =-1
Hubbard_l_back =-1 Hubbard_l_back =-1
backall = .false.
! !
IF ( dft_obj%dftU%Hubbard_U_ispresent) THEN IF ( dft_obj%dftU%Hubbard_U_ispresent) THEN
loop_on_hubbardU:DO ihub =1, dft_obj%dftU%ndim_Hubbard_U loop_on_hubbardU:DO ihub =1, dft_obj%dftU%ndim_Hubbard_U

View File

@ -1485,7 +1485,7 @@ SUBROUTINE electrons_scf ( printout, exxen )
/' -> PAW hartree energy PS =',F17.8,' Ry' & /' -> PAW hartree energy PS =',F17.8,' Ry' &
/' -> PAW xc energy AE =',F17.8,' Ry' & /' -> PAW xc energy AE =',F17.8,' Ry' &
/' -> PAW xc energy PS =',F17.8,' Ry' & /' -> PAW xc energy PS =',F17.8,' Ry' &
/' -> total E_H with PAW =',F17.8,' Ry'& /' -> total E_H with PAW =',F17.8,' Ry' &
/' -> total E_XC with PAW =',F17.8,' Ry' ) /' -> total E_XC with PAW =',F17.8,' Ry' )
9069 FORMAT( ' scf correction =',F17.8,' Ry' ) 9069 FORMAT( ' scf correction =',F17.8,' Ry' )
9070 FORMAT( ' smearing contrib. (-TS) =',F17.8,' Ry' ) 9070 FORMAT( ' smearing contrib. (-TS) =',F17.8,' Ry' )

View File

@ -1100,6 +1100,10 @@ SUBROUTINE dprojdtau_k( spsi, alpha, na, ijkb0, ipol, ik, nb_s, nb_e, mykey, dpr
! NOTE: overlap_inv is already transposed (it is O^{-1/2}_JI), ! NOTE: overlap_inv is already transposed (it is O^{-1/2}_JI),
! hence we obtain \sum_J O^{-1/2}_JI \dphi_J/d\tau(alpha,ipol) ! hence we obtain \sum_J O^{-1/2}_JI \dphi_J/d\tau(alpha,ipol)
! !
#if defined(__XLF)
! IBM XL 16.1.1 gives INTERNAL COMPILER ERROR
CALL errore('dprojdtau_k','disabled when it is compiled by xlf.',1)
#else
offpm = oatwfc(na) ! offset offpm = oatwfc(na) ! offset
DO ig = 1, npw DO ig = 1, npw
gvec = (g(ipol,igk_k(ig,ik)) + xk(ipol,ik)) * tpiba gvec = (g(ipol,igk_k(ig,ik)) + xk(ipol,ik)) * tpiba
@ -1110,6 +1114,7 @@ SUBROUTINE dprojdtau_k( spsi, alpha, na, ijkb0, ipol, ik, nb_s, nb_e, mykey, dpr
ENDDO ENDDO
ENDDO ENDDO
ENDDO ENDDO
#endif
! !
! 2. Contribution due to the derivative of (O^{-1/2})_JI which ! 2. Contribution due to the derivative of (O^{-1/2})_JI which
! is multiplied by atomic wavefunctions ! is multiplied by atomic wavefunctions

View File

@ -6,7 +6,7 @@ include ../../make.inc
MODFLAGS= $(BASEMOD_FLAGS) \ MODFLAGS= $(BASEMOD_FLAGS) \
$(MOD_FLAG)../src $(MOD_FLAG)../src
QEMODS = ../../Modules/libqemod.a ../../FFTXlib/libqefft.a \ QEMODS = ../../Modules/libqemod.a ../../FFTXlib/libqefft.a \
../../KS_Solvers/libks_solvers.a \ ../../KS_Solvers/libks_solvers.a ../../upflib/libupf.a \
../../UtilXlib/libutil.a ../../LAXlib/libqela.a ../../UtilXlib/libutil.a ../../LAXlib/libqela.a
# libqela required by xlf for obscure reasons # libqela required by xlf for obscure reasons
PWOBJS = ../src/libpw.a PWOBJS = ../src/libpw.a

View File

@ -17,7 +17,7 @@ SUBROUTINE lr_compute_intq
USE kinds, ONLY : DP USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ityp, ntyp => nsp USE ions_base, ONLY : nat, ityp, ntyp => nsp
USE noncollin_module, ONLY : noncolin USE noncollin_module, ONLY : noncolin
USE cell_base, ONLY : omega USE cell_base, ONLY : omega, tpiba
USE uspp, ONLY : okvan USE uspp, ONLY : okvan
USE uspp_param, ONLY : upf, lmaxq, nh, nhm USE uspp_param, ONLY : upf, lmaxq, nh, nhm
USE lr_variables, ONLY : intq USE lr_variables, ONLY : intq
@ -48,7 +48,7 @@ SUBROUTINE lr_compute_intq
zero=0.0_DP zero=0.0_DP
CALL setqmod (1, xq, zero, qmod, qg) CALL setqmod (1, xq, zero, qmod, qg)
CALL ylmr2 (lmaxq * lmaxq, 1, qg, qmod, ylmk0) CALL ylmr2 (lmaxq * lmaxq, 1, qg, qmod, ylmk0)
qmod(1) = SQRT (qmod(1)) qmod(1) = SQRT (qmod(1))*tpiba
DO nt = 1, ntyp DO nt = 1, ntyp
IF (upf(nt)%tvanp ) THEN IF (upf(nt)%tvanp ) THEN

34
install/configure vendored
View File

@ -2920,12 +2920,11 @@ necsx )
ppc64 ) ppc64 )
try_mpif90="mpxlf90_r mpf90_r mpif90" try_mpif90="mpxlf90_r mpf90_r mpif90"
try_f90="xlf90_r $try_f90" try_f90="xlf90_r $try_f90"
try_dflags="-D__XLF"
;; ;;
# PowerPC MareNostrum # PowerPC little endian
ppc64-mn ) ppc64le )
try_mpif90="$try_mpif90 mpixlf"
try_f90="xlf90_r" try_f90="xlf90_r"
try_dflags="-D__XLF"
;; ;;
# IBM BlueGene - obsolete # IBM BlueGene - obsolete
ppc64-bg | ppc64-bgq ) ppc64-bg | ppc64-bgq )
@ -2940,7 +2939,6 @@ ppc64-bg | ppc64-bgq )
try_f90="bgxlf90_r" try_f90="bgxlf90_r"
fi fi
try_arflags="ruv" try_arflags="ruv"
try_dflags="-D__XLF"
;; ;;
* ) * )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $arch : unsupported architecture?" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $arch : unsupported architecture?" >&5
@ -3230,7 +3228,7 @@ case "$arch" in
elif test "$xlf_version" != "" elif test "$xlf_version" != ""
then then
echo "${ECHO_T}xlf (version unknonw)" echo "${ECHO_T}xlf (version unknonw)"
f90_in_mpif90="xlf" f90_in_mpif90="xlf90_r"
try_dflags="-D__XLF" try_dflags="-D__XLF"
elif test "$armflang_version" != "" elif test "$armflang_version" != ""
then then
@ -3391,7 +3389,7 @@ ppc64-bg*:*xlf90_r )
ppc64-bg*:*xlf90 ) ppc64-bg*:*xlf90 )
try_cc="bgxlc" try_cc="bgxlc"
;; ;;
ppc64:*xlf* | ppc64-mn:*xlf* ) ppc64:*xlf* | ppc64le:*xlf* )
try_cc="xlc_r $try_cc" try_cc="xlc_r $try_cc"
;; ;;
esac esac
@ -3770,8 +3768,8 @@ necsx:* )
#try_cflags="-D__SX6 \$(IFLAGS) \$(MODFLAGS)" #try_cflags="-D__SX6 \$(IFLAGS) \$(MODFLAGS)"
try_cflags="" try_cflags=""
;; ;;
ppc64-mn:* ) ppc64le:* )
try_cflags="-O3 -q64" try_cflags="-O3"
;; ;;
ppc64-bg:* ) ppc64-bg:* )
try_cflags="-O3 -q32" try_cflags="-O3 -q32"
@ -3810,7 +3808,7 @@ ppc64-bg*:*xlf90_r )
ppc64-bg*:*xlf90 ) ppc64-bg*:*xlf90 )
try_f77="bgxlf" try_f77="bgxlf"
;; ;;
ppc64:*xlf* | ppc64-mn:*xlf* ) ppc64:*xlf* | ppc64le:*xlf* )
try_f77="xlf_r $f90" try_f77="xlf_r $f90"
;; ;;
esac esac
@ -4187,18 +4185,22 @@ ppc64:*xlf* )
try_f90flags="\$(FFLAGS) -qfree=f90" try_f90flags="\$(FFLAGS) -qfree=f90"
try_fflags_noopt="-q64 -qthreaded -O0" try_fflags_noopt="-q64 -qthreaded -O0"
try_ldflags="-q64 -qthreaded" try_ldflags="-q64 -qthreaded"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;
ppc64-mn:*xlf* ) ppc64le:*xlf* )
if test "$use_debug" -eq 1; then if test "$use_debug" -eq 1; then
try_fflags="-g -C -q64 -qstrict -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q -qtune=ppc970 -qarch=ppc970 -qcache=auto -qhot=vector,simd -qenablevmx" try_fflags="-g -C -qstrict -qdpc -qalias=nointptr -qarch=auto"
else else
try_fflags="-O3 -q64 -qstrict -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q -qtune=ppc970 -qarch=ppc970 -qcache=auto -qhot=vector,simd -qenablevmx" try_fflags="-O3 -qstrict -qdpc -qalias=nointptr -qarch=auto"
fi fi
try_f90flags="\$(FFLAGS) -qfree=f90" try_fflags_openmp="-qsmp=noauto:omp"
try_fflags_noopt="-O0 -q64" try_f90flags="\$(FFLAGS) -qsuffix=cpp=f90"
try_fflags_noopt="-O0"
try_ldflags="" try_ldflags=""
try_ldflags_openmp="-qsmp=noauto:omp"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;
@ -4213,6 +4215,7 @@ ppc64-bg:*xlf* )
try_fflags_noopt="-q32 -O0" try_fflags_noopt="-q32 -O0"
try_ldflags="-q32" try_ldflags="-q32"
try_ldflags_openmp="-qsmp=omp -qthreaded" try_ldflags_openmp="-qsmp=omp -qthreaded"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;
@ -4227,6 +4230,7 @@ ppc64-bgq:*xlf* )
try_fflags_noopt="-O0" try_fflags_noopt="-O0"
try_ldflags="" try_ldflags=""
try_ldflags_openmp="-qstatic -qsmp=noauto:omp -qtm -qthreaded" try_ldflags_openmp="-qstatic -qsmp=noauto:omp -qtm -qthreaded"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;

View File

@ -24,7 +24,7 @@ ppc64-bg*:*xlf90_r )
ppc64-bg*:*xlf90 ) ppc64-bg*:*xlf90 )
try_cc="bgxlc" try_cc="bgxlc"
;; ;;
ppc64:*xlf* | ppc64-mn:*xlf* ) ppc64:*xlf* | ppc64le:*xlf* )
try_cc="xlc_r $try_cc" try_cc="xlc_r $try_cc"
;; ;;
esac esac
@ -57,8 +57,8 @@ necsx:* )
#try_cflags="-D__SX6 \$(IFLAGS) \$(MODFLAGS)" #try_cflags="-D__SX6 \$(IFLAGS) \$(MODFLAGS)"
try_cflags="" try_cflags=""
;; ;;
ppc64-mn:* ) ppc64le:* )
try_cflags="-O3 -q64" try_cflags="-O3"
;; ;;
ppc64-bg:* ) ppc64-bg:* )
try_cflags="-O3 -q32" try_cflags="-O3 -q32"

View File

@ -15,7 +15,7 @@ ppc64-bg*:*xlf90_r )
ppc64-bg*:*xlf90 ) ppc64-bg*:*xlf90 )
try_f77="bgxlf" try_f77="bgxlf"
;; ;;
ppc64:*xlf* | ppc64-mn:*xlf* ) ppc64:*xlf* | ppc64le:*xlf* )
try_f77="xlf_r $f90" try_f77="xlf_r $f90"
;; ;;
esac esac

View File

@ -144,18 +144,22 @@ ppc64:*xlf* )
try_f90flags="\$(FFLAGS) -qfree=f90" try_f90flags="\$(FFLAGS) -qfree=f90"
try_fflags_noopt="-q64 -qthreaded -O0" try_fflags_noopt="-q64 -qthreaded -O0"
try_ldflags="-q64 -qthreaded" try_ldflags="-q64 -qthreaded"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;
ppc64-mn:*xlf* ) ppc64le:*xlf* )
if test "$use_debug" -eq 1; then if test "$use_debug" -eq 1; then
try_fflags="-g -C -q64 -qstrict -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q -qtune=ppc970 -qarch=ppc970 -qcache=auto -qhot=vector,simd -qenablevmx" try_fflags="-g -C -qstrict -qdpc -qalias=nointptr -qarch=auto"
else else
try_fflags="-O3 -q64 -qstrict -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q -qtune=ppc970 -qarch=ppc970 -qcache=auto -qhot=vector,simd -qenablevmx" try_fflags="-O3 -qstrict -qdpc -qalias=nointptr -qarch=auto"
fi fi
try_f90flags="\$(FFLAGS) -qfree=f90" try_fflags_openmp="-qsmp=noauto:omp"
try_fflags_noopt="-O0 -q64" try_f90flags="\$(FFLAGS) -qsuffix=cpp=f90"
try_fflags_noopt="-O0"
try_ldflags="" try_ldflags=""
try_ldflags_openmp="-qsmp=noauto:omp"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;
@ -170,6 +174,7 @@ ppc64-bg:*xlf* )
try_fflags_noopt="-q32 -O0" try_fflags_noopt="-q32 -O0"
try_ldflags="-q32" try_ldflags="-q32"
try_ldflags_openmp="-qsmp=omp -qthreaded" try_ldflags_openmp="-qsmp=omp -qthreaded"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;
@ -184,6 +189,7 @@ ppc64-bgq:*xlf* )
try_fflags_noopt="-O0" try_fflags_noopt="-O0"
try_ldflags="" try_ldflags=""
try_ldflags_openmp="-qstatic -qsmp=noauto:omp -qtm -qthreaded" try_ldflags_openmp="-qstatic -qsmp=noauto:omp -qtm -qthreaded"
try_dflags="-D__XLF"
pre_fdflags="-WF," pre_fdflags="-WF,"
xlf_flags=1 xlf_flags=1
;; ;;

View File

@ -58,12 +58,11 @@ necsx )
ppc64 ) ppc64 )
try_mpif90="mpxlf90_r mpf90_r mpif90" try_mpif90="mpxlf90_r mpf90_r mpif90"
try_f90="xlf90_r $try_f90" try_f90="xlf90_r $try_f90"
try_dflags="-D__XLF"
;; ;;
# PowerPC MareNostrum # PowerPC little endian
ppc64-mn ) ppc64le )
try_mpif90="$try_mpif90 mpixlf"
try_f90="xlf90_r" try_f90="xlf90_r"
try_dflags="-D__XLF"
;; ;;
# IBM BlueGene - obsolete # IBM BlueGene - obsolete
ppc64-bg | ppc64-bgq ) ppc64-bg | ppc64-bgq )
@ -78,7 +77,6 @@ ppc64-bg | ppc64-bgq )
try_f90="bgxlf90_r" try_f90="bgxlf90_r"
fi fi
try_arflags="ruv" try_arflags="ruv"
try_dflags="-D__XLF"
;; ;;
* ) * )
AC_MSG_WARN($arch : unsupported architecture?) AC_MSG_WARN($arch : unsupported architecture?)
@ -155,7 +153,7 @@ case "$arch" in
elif test "$xlf_version" != "" elif test "$xlf_version" != ""
then then
echo "${ECHO_T}xlf (version unknonw)" echo "${ECHO_T}xlf (version unknonw)"
f90_in_mpif90="xlf" f90_in_mpif90="xlf90_r"
try_dflags="-D__XLF" try_dflags="-D__XLF"
elif test "$armflang_version" != "" elif test "$armflang_version" != ""
then then

View File

@ -37,7 +37,7 @@ then
cat $3 cat $3
fi fi
echo "Gather results in save" echo "Gather results in save"
python ../../EPW/bin/pp.py < pp.in python3 ../../EPW/bin/pp.py < pp.in
elif [[ "$1" == "3" ]] elif [[ "$1" == "3" ]]
then then
echo "Running EPW ..." echo "Running EPW ..."
@ -57,7 +57,7 @@ then
cat $3 cat $3
fi fi
echo "Gather results in save" echo "Gather results in save"
python ../../EPW/bin/pp.py < pp.in python3 ../../EPW/bin/pp.py < pp.in
elif [[ "$1" == "5" ]] elif [[ "$1" == "5" ]]
then then
echo "Removing restart files ..." echo "Removing restart files ..."

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
'''testcode [options] [action1 [action2...]] '''testcode [options] [action1 [action2...]]
testcode is a simple framework for comparing output from (principally numeric) testcode is a simple framework for comparing output from (principally numeric)
@ -228,7 +228,7 @@ actions: list of testcode2 actions to run.
test_args = (arg not in allowed_actions for arg in args) test_args = (arg not in allowed_actions for arg in args)
if testcode2.compatibility.compat_any(test_args): if testcode2.compatibility.compat_any(test_args):
print('At least one action is not understood: %s.' % (' '.join(args))) print(('At least one action is not understood: %s.' % (' '.join(args))))
parser.print_usage() parser.print_usage()
sys.exit(1) sys.exit(1)
@ -358,10 +358,10 @@ run_test_args: arguments to pass to test.run_test method.
test_store[test.path] = [test] test_store[test.path] = [test]
else: else:
serialized_tests.append([test]) serialized_tests.append([test])
for (key, stests) in test_store.items(): for (key, stests) in list(test_store.items()):
if (len(stests) > 1) and verbose > 2: if (len(stests) > 1) and verbose > 2:
print('Warning: cannot run tests in %s concurrently.' % stests[0].path) print(('Warning: cannot run tests in %s concurrently.' % stests[0].path))
serialized_tests += test_store.values() serialized_tests += list(test_store.values())
semaphore = threading.BoundedSemaphore(tot_nprocs) semaphore = threading.BoundedSemaphore(tot_nprocs)
slock = threading.Lock() slock = threading.Lock()
@ -413,10 +413,10 @@ number of tests not checked due to test output file not existing.
else: else:
if verbose > 0 and verbose <= 2: if verbose > 0 and verbose <= 2:
info_line = testcode2.util.info_line(test.path, inp, args, os.getcwd()) info_line = testcode2.util.info_line(test.path, inp, args, os.getcwd())
print('%sNot checked.' % info_line) print(('%sNot checked.' % info_line))
if verbose > 1: if verbose > 1:
print('Skipping comparison. ' print(('Skipping comparison. '
'Test file does not exist: %s.\n' % test_file) 'Test file does not exist: %s.\n' % test_file))
not_checked += 1 not_checked += 1
return not_checked return not_checked
@ -495,15 +495,15 @@ verbose: level of verbosity in output.
) )
if not os.path.exists(test_file): if not os.path.exists(test_file):
if verbose > 0: if verbose > 0:
print('Skipping diff with %s in %s: %s does not exist.' print(('Skipping diff with %s in %s: %s does not exist.'
% (benchmark, test.path, test_file)) % (benchmark, test.path, test_file)))
elif not have_benchmark: elif not have_benchmark:
if verbose > 0: if verbose > 0:
print('Skipping diff with %s. %s' % (test.path, err)) print(('Skipping diff with %s. %s' % (test.path, err)))
else: else:
if verbose > 0: if verbose > 0:
print('Diffing %s and %s in %s.' % print(('Diffing %s and %s in %s.' %
(benchmark, test_file, test.path)) (benchmark, test_file, test.path)))
diff_cmd = '%s %s %s' % (diff_program, benchmark, test_file) diff_cmd = '%s %s %s' % (diff_program, benchmark, test_file)
diff_popen = subprocess.Popen(diff_cmd, shell=True) diff_popen = subprocess.Popen(diff_cmd, shell=True)
diff_popen.wait() diff_popen.wait()
@ -520,10 +520,10 @@ ndays: test files older than ndays are deleted.
test_globs = ['test.out*','test.err*'] test_globs = ['test.out*','test.err*']
print( print((
'Delete all %s files older than %s days from each job directory?' 'Delete all %s files older than %s days from each job directory?'
% (' '.join(test_globs), ndays) % (' '.join(test_globs), ndays)
) ))
ans = '' ans = ''
while ans != 'y' and ans != 'n': while ans != 'y' and ans != 'n':
ans = testcode2.compatibility.compat_input('Confirm [y/n]: ') ans = testcode2.compatibility.compat_input('Confirm [y/n]: ')
@ -613,11 +613,11 @@ insert_id: insert the new benchmark id into the existing list of benchmark ids i
ids.insert(0, benchmark) ids.insert(0, benchmark)
benchmark = ' '.join(ids) benchmark = ' '.join(ids)
if len(benchmark.split()) > 1: if len(benchmark.split()) > 1:
print('Setting new benchmarks in userconfig to be: %s.' % print(('Setting new benchmarks in userconfig to be: %s.' %
(benchmark)) (benchmark)))
else: else:
print('Setting new benchmark in userconfig to be: %s.' % print(('Setting new benchmark in userconfig to be: %s.' %
(benchmark)) (benchmark)))
config.set('user', 'benchmark', benchmark) config.set('user', 'benchmark', benchmark)
userconfig = open(userconfig, 'w') userconfig = open(userconfig, 'w')
config.write(userconfig) config.write(userconfig)
@ -638,14 +638,14 @@ verbose: level of verbosity in output (no output if <1).
exes = testcode2.compatibility.compat_set(exes) exes = testcode2.compatibility.compat_set(exes)
if running: if running:
for exe in exes: for exe in exes:
print('Using executable: %s.' % (exe)) print(('Using executable: %s.' % (exe)))
# All tests use the same test_id and benchmark. # All tests use the same test_id and benchmark.
print('Test id: %s.' % (tests[0].test_program.test_id)) print(('Test id: %s.' % (tests[0].test_program.test_id)))
if len(tests[0].test_program.benchmark) > 1: if len(tests[0].test_program.benchmark) > 1:
benchmark_ids = ', '.join(tests[0].test_program.benchmark) benchmark_ids = ', '.join(tests[0].test_program.benchmark)
print('Benchmarks: %s.' % (benchmark_ids)) print(('Benchmarks: %s.' % (benchmark_ids)))
else: else:
print('Benchmark: %s.' % (tests[0].test_program.benchmark[0])) print(('Benchmark: %s.' % (tests[0].test_program.benchmark[0])))
print('') print('')
def end_status(tests, not_checked=0, verbose=1, final=True): def end_status(tests, not_checked=0, verbose=1, final=True):
@ -728,17 +728,17 @@ final: final call (so print a goodbye messge).
if final: if final:
msg = 'All done. %s' % (msg,) msg = 'All done. %s' % (msg,)
if npassed == nran: if npassed == nran:
print(msg % ('', npassed, nran, ran_test, add_info_msg)) print((msg % ('', npassed, nran, ran_test, add_info_msg)))
else: else:
print(msg % ('ERROR: only ', npassed, nran, ran_test, add_info_msg)) print((msg % ('ERROR: only ', npassed, nran, ran_test, add_info_msg)))
if failures: if failures:
print('Failed %s in:\n\t%s' % (failed_test, '\n\t'.join(failures))) print(('Failed %s in:\n\t%s' % (failed_test, '\n\t'.join(failures))))
if warnings: if warnings:
print('%s in:\n\t%s' % (warning.title(), '\n\t'.join(warnings))) print(('%s in:\n\t%s' % (warning.title(), '\n\t'.join(warnings))))
if skipped: if skipped:
print('Skipped %s in:\n\t%s' % (skipped_test, '\n\t'.join(skipped))) print(('Skipped %s in:\n\t%s' % (skipped_test, '\n\t'.join(skipped))))
else: else:
print(' [%s/%s%s]'% (npassed, nran, add_info_msg)) print((' [%s/%s%s]'% (npassed, nran, add_info_msg)))
# ternary operator not in python 2.4. :-( # ternary operator not in python 2.4. :-(
ret_val = 0 ret_val = 0

View File

@ -79,7 +79,7 @@ class TestProgram:
self.vcs = None self.vcs = None
# Set values passed in as keyword options. # Set values passed in as keyword options.
for (attr, val) in kwargs.items(): for (attr, val) in list(kwargs.items()):
setattr(self, attr, val) setattr(self, attr, val)
# If using an external verification program, then set the default # If using an external verification program, then set the default
@ -196,7 +196,7 @@ class Test:
self.tolerances = {} self.tolerances = {}
# Set values passed in as keyword options. # Set values passed in as keyword options.
for (attr, val) in kwargs.items(): for (attr, val) in list(kwargs.items()):
setattr(self, attr, val) setattr(self, attr, val)
if not self.inputs_args: if not self.inputs_args:
@ -318,13 +318,13 @@ class Test:
# weren't run. # weren't run.
err = 'Previous test in %s caused a system failure.' % (self.path) err = 'Previous test in %s caused a system failure.' % (self.path)
status = validation.Status(name='skipped') status = validation.Status(name='skipped')
for ((test_input, test_arg), stat) in self.status.items(): for ((test_input, test_arg), stat) in list(self.status.items()):
if not self.status[(test_input,test_arg)]: if not self.status[(test_input,test_arg)]:
self._update_status(status, (test_input, test_arg)) self._update_status(status, (test_input, test_arg))
if verbose > 2: if verbose > 2:
cmd = self.test_program.run_cmd(test_input, test_arg, cmd = self.test_program.run_cmd(test_input, test_arg,
self.nprocs) self.nprocs)
print('Test using %s in %s' % (cmd, self.path)) print(('Test using %s in %s' % (cmd, self.path)))
elif verbose > 0: elif verbose > 0:
info_line = util.info_line(self.path, test_input, info_line = util.info_line(self.path, test_input,
test_arg, rundir) test_arg, rundir)
@ -348,13 +348,13 @@ first, during initialisation.'''
job.create_submit_file(tp_ptr.submit_pattern, cmd, job.create_submit_file(tp_ptr.submit_pattern, cmd,
self.submit_template) self.submit_template)
if verbose > 2: if verbose > 2:
print('Submitting tests using %s (template submit file) in %s' print(('Submitting tests using %s (template submit file) in %s'
% (self.submit_template, self.path)) % (self.submit_template, self.path)))
job.start_job() job.start_job()
else: else:
# Run locally via subprocess. # Run locally via subprocess.
if verbose > 2: if verbose > 2:
print('Running test using %s in %s\n' % (cmd, self.path)) print(('Running test using %s in %s\n' % (cmd, self.path)))
try: try:
job = subprocess.Popen(cmd, shell=True) job = subprocess.Popen(cmd, shell=True)
except OSError: except OSError:
@ -407,10 +407,10 @@ enters self.path.
if old_out_files: if old_out_files:
out_dir = 'test.prev.output.%s' % (self.test_program.test_id) out_dir = 'test.prev.output.%s' % (self.test_program.test_id)
if verbose > 2: if verbose > 2:
print('WARNING: found existing files matching output ' print(('WARNING: found existing files matching output '
'pattern: %s.' % self.output) 'pattern: %s.' % self.output))
print('WARNING: moving existing output files (%s) to %s.\n' print(('WARNING: moving existing output files (%s) to %s.\n'
% (', '.join(old_out_files), out_dir)) % (', '.join(old_out_files), out_dir)))
if not os.path.exists(out_dir): if not os.path.exists(out_dir):
os.mkdir(out_dir) os.mkdir(out_dir)
for out_file in old_out_files: for out_file in old_out_files:
@ -485,8 +485,8 @@ first, during initialisation.'''
cmd = self.test_program.skip_cmd(input_file, args) cmd = self.test_program.skip_cmd(input_file, args)
try: try:
if verbose > 2: if verbose > 2:
print('Testing whether to skip test using %s in %s.' % print(('Testing whether to skip test using %s in %s.' %
(cmd, self.path)) (cmd, self.path)))
skip_popen = subprocess.Popen(cmd, shell=True, skip_popen = subprocess.Popen(cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
skip_popen.wait() skip_popen.wait()
@ -497,7 +497,7 @@ first, during initialisation.'''
# slightly odd syntax in order to be compatible with python # slightly odd syntax in order to be compatible with python
# 2.5 and python 2.6/3 # 2.5 and python 2.6/3
if verbose > 2: if verbose > 2:
print('Test to skip test: %s' % (sys.exc_info()[1],)) print(('Test to skip test: %s' % (sys.exc_info()[1],)))
return (status, '') return (status, '')
def verify_job_external(self, input_file, args, verbose=1): def verify_job_external(self, input_file, args, verbose=1):
@ -507,8 +507,8 @@ Assume function is executed in self.path.'''
verify_cmd, = self.test_program.extract_cmd(self.path, input_file, args) verify_cmd, = self.test_program.extract_cmd(self.path, input_file, args)
try: try:
if verbose > 2: if verbose > 2:
print('Analysing test using %s in %s.' % print(('Analysing test using %s in %s.' %
(verify_cmd, self.path)) (verify_cmd, self.path)))
verify_popen = subprocess.Popen(verify_cmd, shell=True, verify_popen = subprocess.Popen(verify_cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
verify_popen.wait() verify_popen.wait()
@ -539,8 +539,8 @@ Assume function is executed in self.path.'''
tp_ptr.test_id, input_file, args), tp_ptr.test_id, input_file, args),
] ]
if verbose > 2: if verbose > 2:
print('Analysing output using data_tag %s in %s on files %s.' % print(('Analysing output using data_tag %s in %s on files %s.' %
(tp_ptr.data_tag, self.path, ' and '.join(data_files))) (tp_ptr.data_tag, self.path, ' and '.join(data_files))))
outputs = [util.extract_tagged_data(tp_ptr.data_tag, dfile) outputs = [util.extract_tagged_data(tp_ptr.data_tag, dfile)
for dfile in data_files] for dfile in data_files]
else: else:
@ -553,41 +553,21 @@ Assume function is executed in self.path.'''
for cmd in extract_cmds: for cmd in extract_cmds:
try: try:
if verbose > 2: if verbose > 2:
print('Analysing output using %s in %s.' % print(('Analysing output using %s in %s.' %
(cmd, self.path)) (cmd, self.path)))
# Samuel Ponce: Popen.wait() creates deadlock if the data is too large extract_popen = subprocess.run(cmd, shell=True,
# See documented issue for example in: stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# https://docs.python.org/2/library/subprocess.html#subprocess.Popen.returncode
#
# Previous code that create deadlock:
#extract_popen = subprocess.Popen(cmd, shell=True,
# stdout=subprocess.PIPE, stderr=subprocess.PIPE)
#extract_popen.wait()
#
# New code (this might not be the best but work for me):
extract_popen = subprocess.Popen(cmd, bufsize=1, shell=True,
stdin=open(os.devnull), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
lines = []
for line in iter(extract_popen.stdout.readline, ''):
#print line,
lines.append(line)
except OSError: except OSError:
# slightly odd syntax in order to be compatible with python # slightly odd syntax in order to be compatible with python
# 2.5 and python 2.6/3 # 2.5 and python 2.6/3
err = 'Analysing output failed: %s' % (sys.exc_info()[1],) err = 'Analysing output failed: %s' % (sys.exc_info()[1],)
raise exceptions.AnalysisError(err) raise exceptions.AnalysisError(err)
# Convert data string from extract command to dictionary format. # Convert data string from extract command to dictionary format.
if extract_popen.returncode != 0:
# SP: Because of the above change, the test below cannot be done: err = extract_popen.communicate()[1].decode('utf-8')
#if extract_popen.returncode != 0: err = 'Analysing output failed: %s' % (err)
# err = extract_popen.communicate()[1].decode('utf-8') raise exceptions.AnalysisError(err)
# err = 'Analysing output failed: %s' % (err) data_string = extract_popen.stdout.decode('utf-8')
# raise exceptions.AnalysisError(err)
#data_string = extract_popen.communicate()[0].decode('utf-8')
data_string = ''.join(lines)
if self.test_program.extract_fmt == 'table': if self.test_program.extract_fmt == 'table':
outputs.append(util.dict_table_string(data_string)) outputs.append(util.dict_table_string(data_string))
elif self.test_program.extract_fmt == 'yaml': elif self.test_program.extract_fmt == 'yaml':
@ -596,7 +576,7 @@ Assume function is executed in self.path.'''
# that from dict_table_string. # that from dict_table_string.
# ensure all keys are strings so they can be sorted # ensure all keys are strings so they can be sorted
# (different data types cause problems!) # (different data types cause problems!)
for (key, val) in yaml.safe_load(data_string).items(): for (key, val) in list(yaml.safe_load(data_string).items()):
if isinstance(val, list): if isinstance(val, list):
outputs[-1][str(key)] = tuple(val) outputs[-1][str(key)] = tuple(val)
else: else:
@ -654,15 +634,15 @@ Assume function is executed in self.path.'''
# dict entry in self.status, then that test must have ran (albeit not # dict entry in self.status, then that test must have ran (albeit not
# necessarily successfuly!). # necessarily successfuly!).
status = {} status = {}
status['passed'] = sum(True for stat in self.status.values() status['passed'] = sum(True for stat in list(self.status.values())
if stat and stat.passed()) if stat and stat.passed())
status['warning'] = sum(True for stat in self.status.values() status['warning'] = sum(True for stat in list(self.status.values())
if stat and stat.warning()) if stat and stat.warning())
status['skipped'] = sum(True for stat in self.status.values() status['skipped'] = sum(True for stat in list(self.status.values())
if stat and stat.skipped()) if stat and stat.skipped())
status['failed'] = sum(True for stat in self.status.values() status['failed'] = sum(True for stat in list(self.status.values())
if stat and stat.failed()) if stat and stat.failed())
status['unknown'] = sum(True for stat in self.status.values() status['unknown'] = sum(True for stat in list(self.status.values())
if stat and stat.unknown()) if stat and stat.unknown())
status['ran'] = sum(True for stat in self.status.values() if stat) status['ran'] = sum(True for stat in list(self.status.values()) if stat)
return status return status

View File

@ -94,14 +94,14 @@ Essentially a backport of the literal_eval function in python 2.6 onwards.
From: http://mail.python.org/pipermail/python-list/2009-September/1219992.html From: http://mail.python.org/pipermail/python-list/2009-September/1219992.html
""" """
_safe_names = {'None': None, 'True': True, 'False': False} _safe_names = {'None': None, 'True': True, 'False': False}
if isinstance(node_or_string, basestring): if isinstance(node_or_string, str):
node_or_string = parse(node_or_string, mode='eval') node_or_string = parse(node_or_string, mode='eval')
if isinstance(node_or_string, ast.Expression): if isinstance(node_or_string, ast.Expression):
node_or_string = node_or_string.node node_or_string = node_or_string.node
def _convert(node): def _convert(node):
'''Convert node/string to expression.''' '''Convert node/string to expression.'''
if isinstance(node, ast.Const) and isinstance(node.value, if isinstance(node, ast.Const) and isinstance(node.value,
(basestring, int, float, long, complex)): (str, int, float, complex)):
return node.value return node.value
elif isinstance(node, ast.Tuple): elif isinstance(node, ast.Tuple):
return tuple(_convert(element) for element in node.nodes) return tuple(_convert(element) for element in node.nodes)
@ -146,7 +146,7 @@ except ImportError:
try: try:
import configparser import configparser
except ImportError: except ImportError:
import ConfigParser as configparser import configparser as configparser
try: try:
compat_input = raw_input compat_input = raw_input
@ -154,6 +154,6 @@ except NameError:
compat_input = input compat_input = input
try: try:
maxint = sys.maxint maxint = sys.maxsize
except AttributeError: except AttributeError:
maxint = sys.maxsize maxint = sys.maxsize

View File

@ -74,8 +74,8 @@ config_file: location of the userconfig file, either relative or absolute.'''
# Alter config file with additional settings provided. # Alter config file with additional settings provided.
if settings: if settings:
for (section_key, section) in settings.items(): for (section_key, section) in list(settings.items()):
for (option_key, value) in section.items(): for (option_key, value) in list(section.items()):
userconfig.set(section_key, option_key, value) userconfig.set(section_key, option_key, value)
# Sensible defaults for the user options. # Sensible defaults for the user options.
@ -201,15 +201,15 @@ config_file: location of the jobconfig file, either relative or absolute.'''
# Alter config file with additional settings provided. # Alter config file with additional settings provided.
if settings: if settings:
for (section_key, section) in settings.items(): for (section_key, section) in list(settings.items()):
for (option_key, value) in section.items(): for (option_key, value) in list(section.items()):
jobconfig.set(section_key, option_key, value) jobconfig.set(section_key, option_key, value)
# Parse job categories. # Parse job categories.
# Just store as list of test names for now. # Just store as list of test names for now.
if jobconfig.has_section('categories'): if jobconfig.has_section('categories'):
test_categories = dict(jobconfig.items('categories')) test_categories = dict(jobconfig.items('categories'))
for (key, val) in test_categories.items(): for (key, val) in list(test_categories.items()):
test_categories[key] = val.split() test_categories[key] = val.split()
jobconfig.remove_section('categories') jobconfig.remove_section('categories')
else: else:
@ -316,7 +316,7 @@ config_file: location of the jobconfig file, either relative or absolute.'''
# Now create the tests (after finding out what the input files are). # Now create the tests (after finding out what the input files are).
tests = [] tests = []
for ((name, path), (test_program, test_dict)) in test_info.items(): for ((name, path), (test_program, test_dict)) in list(test_info.items()):
old_dir = os.getcwd() old_dir = os.getcwd()
os.chdir(path) os.chdir(path)
# Expand any globs in the input files. # Expand any globs in the input files.
@ -455,7 +455,7 @@ def select_tests(all_tests, test_categories, selected_categories, prefix=''):
found = True found = True
tests.append(test) tests.append(test)
if not found: if not found:
print('WARNING: %s test/category not found.\n' % cat) print(('WARNING: %s test/category not found.\n' % cat))
# Only want to run each test once. # Only want to run each test once.
tests = list(compat.compat_set(tests)) tests = list(compat.compat_set(tests))
return tests return tests
@ -483,7 +483,7 @@ the full path.
# Cannot find program. # Cannot find program.
# This still allows us to manipulate previously run tests, just not # This still allows us to manipulate previously run tests, just not
# run new ones... # run new ones...
print('WARNING: cannot find program: %s.' % (program)) print(('WARNING: cannot find program: %s.' % (program)))
# Allow things to proceed with the original path -- the user might # Allow things to proceed with the original path -- the user might
# know what they're doing and the above tests are not always # know what they're doing and the above tests are not always
# sufficient (e.g. if using cygwin but using an MPI implementation # sufficient (e.g. if using cygwin but using an MPI implementation

View File

@ -13,7 +13,7 @@ import sys
def signal_handler(sig, frame): def signal_handler(sig, frame):
'''Capture signal and leave quietly.''' '''Capture signal and leave quietly.'''
print('Signal: %s has been caught. Bye!' % (sig)) print(('Signal: %s has been caught. Bye!' % (sig)))
sys.exit(1) sys.exit(1)

View File

@ -79,7 +79,7 @@ def extract_tagged_data(data_tag, filename):
else: else:
data[key] = [val] data[key] = [val]
# We shouldn't change the data from this point: convert entries to tuples. # We shouldn't change the data from this point: convert entries to tuples.
for (key, val) in data.items(): for (key, val) in list(data.items()):
data[key] = tuple(val) data[key] = tuple(val)
return data return data
@ -130,7 +130,7 @@ and
# overwrite the previous column with the same heading. # overwrite the previous column with the same heading.
data_dict[head[ind]].append(val) data_dict[head[ind]].append(val)
# We shouldn't change the data from this point: convert entries to tuples. # We shouldn't change the data from this point: convert entries to tuples.
for (key, val) in data_dict.items(): for (key, val) in list(data_dict.items()):
data_dict[key] = tuple(val) data_dict[key] = tuple(val)
return data_dict return data_dict

View File

@ -74,11 +74,11 @@ vspace: print out extra new line afterwards if verbose > 1.
elif self.status == self._passed: elif self.status == self._passed:
print('Passed.') print('Passed.')
elif self.status == self._skipped: elif self.status == self._skipped:
print('%s.' % ansi.ansi_format('SKIPPED', 'blue')) print(('%s.' % ansi.ansi_format('SKIPPED', 'blue')))
elif self.status == self._partial: elif self.status == self._partial:
print('%s.' % ansi.ansi_format('WARNING', 'blue')) print(('%s.' % ansi.ansi_format('WARNING', 'blue')))
else: else:
print('%s.' % ansi.ansi_format('**FAILED**', 'red', 'normal', 'bold')) print(('%s.' % ansi.ansi_format('**FAILED**', 'red', 'normal', 'bold')))
if msg and verbose > 1: if msg and verbose > 1:
print(msg) print(msg)
if vspace and verbose > 1: if vspace and verbose > 1:
@ -220,13 +220,13 @@ def compare_data(benchmark, test, default_tolerance, tolerances,
# different numbers of duplicate keys. # different numbers of duplicate keys.
comparable = (bench_params == test_params) comparable = (bench_params == test_params)
key_counts = dict((key,0) for key in bench_params | test_params) key_counts = dict((key,0) for key in bench_params | test_params)
for (key, val) in benchmark.items(): for (key, val) in list(benchmark.items()):
if key not in ignored_params: if key not in ignored_params:
key_counts[key] += len(val) key_counts[key] += len(val)
for (key, val) in test.items(): for (key, val) in list(test.items()):
if key not in ignored_params: if key not in ignored_params:
key_counts[key] -= len(val) key_counts[key] -= len(val)
comparable = comparable and compat.compat_all(kc == 0 for kc in key_counts.values()) comparable = comparable and compat.compat_all(kc == 0 for kc in list(key_counts.values()))
status = Status() status = Status()
msg = [] msg = []
@ -254,7 +254,7 @@ def compare_data(benchmark, test, default_tolerance, tolerances,
param_tol = tolerances.get(param, default_tolerance) param_tol = tolerances.get(param, default_tolerance)
if param_tol == default_tolerance: if param_tol == default_tolerance:
# See if there's a regex that matches. # See if there's a regex that matches.
tol_matches = [tol for tol in tolerances.values() tol_matches = [tol for tol in list(tolerances.values())
if tol.name and re.match(tol.name, param)] if tol.name and re.match(tol.name, param)]
if tol_matches: if tol_matches:
param_tol = tol_matches[0] param_tol = tol_matches[0]