diff --git a/EPW/src/ephwann_shuffle.f90 b/EPW/src/ephwann_shuffle.f90 index 85445a3f1..59214b808 100644 --- a/EPW/src/ephwann_shuffle.f90 +++ b/EPW/src/ephwann_shuffle.f90 @@ -301,21 +301,23 @@ ! IF (nbndsub /= nbndep) WRITE(stdout, '(/,5x,a,i4)' ) 'Band disentanglement is used: nbndsub = ', nbndsub ! - ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cu', 1) - ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cuq', 1) - ALLOCATE(lwin(nbndep, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwin', 1) - ALLOCATE(lwinq(nbndep, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwinq', 1) - ALLOCATE(exband(nbnd), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating exband', 1) - cu(:, :, :) = czero - cuq(:, :, :) = czero - lwin(:, :) = .FALSE. - lwinq(:, :) = .FALSE. - exband(:) = .FALSE. + IF (.NOT. (epwread .AND. .NOT. epbread)) THEN + ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cu', 1) + ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating cuq', 1) + ALLOCATE(lwin(nbndep, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwin', 1) + ALLOCATE(lwinq(nbndep, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating lwinq', 1) + ALLOCATE(exband(nbnd), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating exband', 1) + cu(:, :, :) = czero + cuq(:, :, :) = czero + lwin(:, :) = .FALSE. + lwinq(:, :) = .FALSE. + exband(:) = .FALSE. + ENDIF ! ALLOCATE(w2(3 * nat), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error allocating w2', 1) @@ -519,19 +521,18 @@ DEALLOCATE(epmatwe_mem, STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle', 'Error deallocating epmatwe_mem', 1) 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) ! - 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 CALL system_mem_usage(valueRSS) ! diff --git a/EPW/src/ephwann_shuffle_mem.f90 b/EPW/src/ephwann_shuffle_mem.f90 index 82efe26f9..09c715235 100644 --- a/EPW/src/ephwann_shuffle_mem.f90 +++ b/EPW/src/ephwann_shuffle_mem.f90 @@ -287,21 +287,23 @@ ! IF (nbndsub /= nbndep) WRITE(stdout, '(/,5x,a,i4)' ) 'Band disentanglement is used: nbndsub = ', nbndsub ! - ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cu', 1) - ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cuq', 1) - ALLOCATE(lwin(nbndep, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwin', 1) - ALLOCATE(lwinq(nbndep, nks), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwinq', 1) - ALLOCATE(exband(nbnd), STAT = ierr) - IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating exband', 1) - cu(:, :, :) = czero - cuq(:, :, :) = czero - lwin(:, :) = .FALSE. - lwinq(:, :) = .FALSE. - exband(:) = .FALSE. + IF (.NOT. (epwread .AND. .NOT. epbread)) THEN + ALLOCATE(cu(nbndep, nbndsub, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cu', 1) + ALLOCATE(cuq(nbndep, nbndsub, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating cuq', 1) + ALLOCATE(lwin(nbndep, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwin', 1) + ALLOCATE(lwinq(nbndep, nks), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating lwinq', 1) + ALLOCATE(exband(nbnd), STAT = ierr) + IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating exband', 1) + cu(:, :, :) = czero + cuq(:, :, :) = czero + lwin(:, :) = .FALSE. + lwinq(:, :) = .FALSE. + exband(:) = .FALSE. + ENDIF ! ALLOCATE(w2(3 * nat), STAT = ierr) IF (ierr /= 0) CALL errore('ephwann_shuffle_mem', 'Error allocating w2', 1) @@ -475,19 +477,18 @@ IF (.NOT. vme) DEALLOCATE(dmec) DEALLOCATE(epmatwe_mem, STAT = ierr) 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) ! - 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 CALL system_mem_usage(valueRSS) ! diff --git a/EPW/src/io_eliashberg.f90 b/EPW/src/io_eliashberg.f90 index b0a5cb6c5..d531d81a3 100644 --- a/EPW/src/io_eliashberg.f90 +++ b/EPW/src/io_eliashberg.f90 @@ -1228,7 +1228,7 @@ #if defined(__MPI) filephmat = TRIM(dirname) // '/' // 'ephmat' // filelab #else - filephmat = TRIM(tmp_dir) // '/' // 'ephmat' + filephmat = TRIM(dirname) // '/' // 'ephmat' #endif !OPEN(UNIT = iufileph, FILE = filephmat, STATUS = 'unknown', FORM = 'formatted', IOSTAT = ios) OPEN(UNIT = iufileph, FILE = filephmat, STATUS = 'unknown', FORM = 'unformatted', IOSTAT = ios) diff --git a/FFTXlib/fft_parallel.f90 b/FFTXlib/fft_parallel.f90 index 718f51f71..5eb1449dd 100644 --- a/FFTXlib/fft_parallel.f90 +++ b/FFTXlib/fft_parallel.f90 @@ -257,6 +257,10 @@ CONTAINS ! 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 !$omp parallel default(none) & !$omp private(i, j, comm2s) & @@ -350,6 +354,11 @@ CONTAINS ! This implementation requires thread-safe cft_1z ! 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 !$omp parallel default(none) & !$omp private(i, j) & diff --git a/FFTXlib/fft_scalar.ARM_LIB.f90 b/FFTXlib/fft_scalar.ARM_LIB.f90 index c1d4fe968..8e329b776 100644 --- a/FFTXlib/fft_scalar.ARM_LIB.f90 +++ b/FFTXlib/fft_scalar.ARM_LIB.f90 @@ -6,6 +6,13 @@ ! in the root directory of the present distribution, ! 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 !=----------------------------------------------------------------------=! @@ -16,8 +23,6 @@ IMPLICIT NONE SAVE -#if defined(__ARM_LIB) - PRIVATE 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 cfft3ds -#endif !=----------------------------------------------------------------------=! END MODULE fft_scalar_arm !=----------------------------------------------------------------------=! +#endif diff --git a/FFTXlib/fft_scalar.ESSL.f90 b/FFTXlib/fft_scalar.ESSL.f90 index 926c7da82..990558ea9 100644 --- a/FFTXlib/fft_scalar.ESSL.f90 +++ b/FFTXlib/fft_scalar.ESSL.f90 @@ -7,6 +7,13 @@ ! 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 !=----------------------------------------------------------------------=! @@ -15,10 +22,8 @@ IMPLICIT NONE SAVE -#if defined(__LINUX_ESSL) - - PRIVATE - PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds + PRIVATE + PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds ! ... Local Parameter @@ -639,8 +644,7 @@ SUBROUTINE cfft3ds (f, nx, ny, nz, ldx, ldy, ldz, howmany, isign, & END IF RETURN END SUBROUTINE cfft3ds -#endif !=----------------------------------------------------------------------=! END MODULE fft_scalar_essl !=----------------------------------------------------------------------=! - +#endif diff --git a/FFTXlib/fft_scalar.FFTW.f90 b/FFTXlib/fft_scalar.FFTW.f90 index d9dbf1fdd..511983991 100644 --- a/FFTXlib/fft_scalar.FFTW.f90 +++ b/FFTXlib/fft_scalar.FFTW.f90 @@ -6,10 +6,16 @@ ! in the root directory of the present distribution, ! 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 !=----------------------------------------------------------------------=! - USE fft_param !! iso_c_binding provides C_PTR, C_NULL_PTR, C_ASSOCIATED 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 cfft3ds - !=----------------------------------------------------------------------=! END MODULE fft_scalar_FFTW !=----------------------------------------------------------------------=! - +#endif diff --git a/FFTXlib/fft_scalar.FFTW3.f90 b/FFTXlib/fft_scalar.FFTW3.f90 index 5cad9b8ae..2ec97230a 100644 --- a/FFTXlib/fft_scalar.FFTW3.f90 +++ b/FFTXlib/fft_scalar.FFTW3.f90 @@ -16,6 +16,13 @@ ! 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 !=----------------------------------------------------------------------=! @@ -24,7 +31,6 @@ USE fft_param IMPLICIT NONE SAVE -#if defined(__FFTW3) PRIVATE 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 cfft3ds -#endif !=----------------------------------------------------------------------=! END MODULE fft_scalar_fftw3 !=----------------------------------------------------------------------=! +#endif diff --git a/FFTXlib/fft_scalar.SX6.f90 b/FFTXlib/fft_scalar.SX6.f90 index 19a93dede..ecbcaf691 100644 --- a/FFTXlib/fft_scalar.SX6.f90 +++ b/FFTXlib/fft_scalar.SX6.f90 @@ -6,6 +6,13 @@ ! in the root directory of the present distribution, ! 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 !=----------------------------------------------------------------------=! @@ -14,9 +21,8 @@ IMPLICIT NONE SAVE -#if defined(__SX6) - PRIVATE - PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds + PRIVATE + PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds !=----------------------------------------------------------------------=! 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) RETURN END SUBROUTINE cfft3ds -#endif !=----------------------------------------------------------------------=! END MODULE fft_scalar_sx6 !=----------------------------------------------------------------------=! +#endif diff --git a/FFTXlib/fft_scalar.f90 b/FFTXlib/fft_scalar.f90 index 2465412ac..7233c4738 100644 --- a/FFTXlib/fft_scalar.f90 +++ b/FFTXlib/fft_scalar.f90 @@ -32,8 +32,10 @@ USE fft_scalar_sx6 #elif defined(__ARM_LIB) USE fft_scalar_arm -#else +#elif defined(__FFTW) USE fft_scalar_fftw +#else +#error No fft_scalar backend selected! #endif IMPLICIT NONE diff --git a/Modules/io_base.f90 b/Modules/io_base.f90 index 6cd524a77..2ca9628a8 100644 --- a/Modules/io_base.f90 +++ b/Modules/io_base.f90 @@ -675,7 +675,7 @@ MODULE io_base #if defined (__HDF5) CALL qeh5_openfile(h5file, TRIM(filename)//'.hdf5', ACTION = 'read', & error = ierr) - IF ( ierr /= 0 . AND. PRESENT(ier_) ) THEN + IF ( ierr /= 0 .AND. PRESENT(ier_) ) THEN ier_ = ierr RETURN END IF diff --git a/Modules/qexsd_copy.f90 b/Modules/qexsd_copy.f90 index 9b7bd4395..0bde5046c 100644 --- a/Modules/qexsd_copy.f90 +++ b/Modules/qexsd_copy.f90 @@ -380,6 +380,7 @@ CONTAINS U_projection = TRIM ( dft_obj%dftU%U_projection_type ) Hubbard_l =-1 Hubbard_l_back =-1 + backall = .false. ! IF ( dft_obj%dftU%Hubbard_U_ispresent) THEN loop_on_hubbardU:DO ihub =1, dft_obj%dftU%ndim_Hubbard_U diff --git a/PW/src/electrons.f90 b/PW/src/electrons.f90 index dc4c12cbf..4a45074a5 100644 --- a/PW/src/electrons.f90 +++ b/PW/src/electrons.f90 @@ -1485,7 +1485,7 @@ SUBROUTINE electrons_scf ( printout, exxen ) /' -> PAW hartree energy PS =',F17.8,' Ry' & /' -> PAW xc energy AE =',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' ) 9069 FORMAT( ' scf correction =',F17.8,' Ry' ) 9070 FORMAT( ' smearing contrib. (-TS) =',F17.8,' Ry' ) diff --git a/PW/src/force_hub.f90 b/PW/src/force_hub.f90 index 70ebd3478..273858380 100644 --- a/PW/src/force_hub.f90 +++ b/PW/src/force_hub.f90 @@ -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), ! 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 DO ig = 1, npw 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 +#endif ! ! 2. Contribution due to the derivative of (O^{-1/2})_JI which ! is multiplied by atomic wavefunctions diff --git a/PW/tools/Makefile b/PW/tools/Makefile index d15461c98..c9297018c 100644 --- a/PW/tools/Makefile +++ b/PW/tools/Makefile @@ -6,7 +6,7 @@ include ../../make.inc MODFLAGS= $(BASEMOD_FLAGS) \ $(MOD_FLAG)../src 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 # libqela required by xlf for obscure reasons PWOBJS = ../src/libpw.a diff --git a/TDDFPT/src/lr_compute_intq.f90 b/TDDFPT/src/lr_compute_intq.f90 index 780846290..65c7de111 100644 --- a/TDDFPT/src/lr_compute_intq.f90 +++ b/TDDFPT/src/lr_compute_intq.f90 @@ -17,7 +17,7 @@ SUBROUTINE lr_compute_intq USE kinds, ONLY : DP USE ions_base, ONLY : nat, ityp, ntyp => nsp USE noncollin_module, ONLY : noncolin - USE cell_base, ONLY : omega + USE cell_base, ONLY : omega, tpiba USE uspp, ONLY : okvan USE uspp_param, ONLY : upf, lmaxq, nh, nhm USE lr_variables, ONLY : intq @@ -48,7 +48,7 @@ SUBROUTINE lr_compute_intq zero=0.0_DP CALL setqmod (1, xq, zero, qmod, qg) CALL ylmr2 (lmaxq * lmaxq, 1, qg, qmod, ylmk0) - qmod(1) = SQRT (qmod(1)) + qmod(1) = SQRT (qmod(1))*tpiba DO nt = 1, ntyp IF (upf(nt)%tvanp ) THEN diff --git a/install/configure b/install/configure index 51f84e77d..139831991 100755 --- a/install/configure +++ b/install/configure @@ -2920,12 +2920,11 @@ necsx ) ppc64 ) try_mpif90="mpxlf90_r mpf90_r mpif90" try_f90="xlf90_r $try_f90" - try_dflags="-D__XLF" ;; -# PowerPC MareNostrum -ppc64-mn ) +# PowerPC little endian +ppc64le ) + try_mpif90="$try_mpif90 mpixlf" try_f90="xlf90_r" - try_dflags="-D__XLF" ;; # IBM BlueGene - obsolete ppc64-bg | ppc64-bgq ) @@ -2940,7 +2939,6 @@ ppc64-bg | ppc64-bgq ) try_f90="bgxlf90_r" fi try_arflags="ruv" - try_dflags="-D__XLF" ;; * ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $arch : unsupported architecture?" >&5 @@ -3230,7 +3228,7 @@ case "$arch" in elif test "$xlf_version" != "" then echo "${ECHO_T}xlf (version unknonw)" - f90_in_mpif90="xlf" + f90_in_mpif90="xlf90_r" try_dflags="-D__XLF" elif test "$armflang_version" != "" then @@ -3391,7 +3389,7 @@ ppc64-bg*:*xlf90_r ) ppc64-bg*:*xlf90 ) try_cc="bgxlc" ;; -ppc64:*xlf* | ppc64-mn:*xlf* ) +ppc64:*xlf* | ppc64le:*xlf* ) try_cc="xlc_r $try_cc" ;; esac @@ -3770,8 +3768,8 @@ necsx:* ) #try_cflags="-D__SX6 \$(IFLAGS) \$(MODFLAGS)" try_cflags="" ;; -ppc64-mn:* ) - try_cflags="-O3 -q64" +ppc64le:* ) + try_cflags="-O3" ;; ppc64-bg:* ) try_cflags="-O3 -q32" @@ -3810,7 +3808,7 @@ ppc64-bg*:*xlf90_r ) ppc64-bg*:*xlf90 ) try_f77="bgxlf" ;; -ppc64:*xlf* | ppc64-mn:*xlf* ) +ppc64:*xlf* | ppc64le:*xlf* ) try_f77="xlf_r $f90" ;; esac @@ -4187,18 +4185,22 @@ ppc64:*xlf* ) try_f90flags="\$(FFLAGS) -qfree=f90" try_fflags_noopt="-q64 -qthreaded -O0" try_ldflags="-q64 -qthreaded" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; -ppc64-mn:*xlf* ) +ppc64le:*xlf* ) 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 - 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 - try_f90flags="\$(FFLAGS) -qfree=f90" - try_fflags_noopt="-O0 -q64" + try_fflags_openmp="-qsmp=noauto:omp" + try_f90flags="\$(FFLAGS) -qsuffix=cpp=f90" + try_fflags_noopt="-O0" try_ldflags="" + try_ldflags_openmp="-qsmp=noauto:omp" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; @@ -4213,6 +4215,7 @@ ppc64-bg:*xlf* ) try_fflags_noopt="-q32 -O0" try_ldflags="-q32" try_ldflags_openmp="-qsmp=omp -qthreaded" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; @@ -4227,6 +4230,7 @@ ppc64-bgq:*xlf* ) try_fflags_noopt="-O0" try_ldflags="" try_ldflags_openmp="-qstatic -qsmp=noauto:omp -qtm -qthreaded" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; diff --git a/install/m4/x_ac_qe_cc.m4 b/install/m4/x_ac_qe_cc.m4 index 50d90778a..8fe63b568 100644 --- a/install/m4/x_ac_qe_cc.m4 +++ b/install/m4/x_ac_qe_cc.m4 @@ -24,7 +24,7 @@ ppc64-bg*:*xlf90_r ) ppc64-bg*:*xlf90 ) try_cc="bgxlc" ;; -ppc64:*xlf* | ppc64-mn:*xlf* ) +ppc64:*xlf* | ppc64le:*xlf* ) try_cc="xlc_r $try_cc" ;; esac @@ -57,8 +57,8 @@ necsx:* ) #try_cflags="-D__SX6 \$(IFLAGS) \$(MODFLAGS)" try_cflags="" ;; -ppc64-mn:* ) - try_cflags="-O3 -q64" +ppc64le:* ) + try_cflags="-O3" ;; ppc64-bg:* ) try_cflags="-O3 -q32" diff --git a/install/m4/x_ac_qe_f77.m4 b/install/m4/x_ac_qe_f77.m4 index d04e7a1af..66a2dd130 100644 --- a/install/m4/x_ac_qe_f77.m4 +++ b/install/m4/x_ac_qe_f77.m4 @@ -15,7 +15,7 @@ ppc64-bg*:*xlf90_r ) ppc64-bg*:*xlf90 ) try_f77="bgxlf" ;; -ppc64:*xlf* | ppc64-mn:*xlf* ) +ppc64:*xlf* | ppc64le:*xlf* ) try_f77="xlf_r $f90" ;; esac diff --git a/install/m4/x_ac_qe_f90.m4 b/install/m4/x_ac_qe_f90.m4 index 2b9238c80..322ad3b40 100644 --- a/install/m4/x_ac_qe_f90.m4 +++ b/install/m4/x_ac_qe_f90.m4 @@ -144,18 +144,22 @@ ppc64:*xlf* ) try_f90flags="\$(FFLAGS) -qfree=f90" try_fflags_noopt="-q64 -qthreaded -O0" try_ldflags="-q64 -qthreaded" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; -ppc64-mn:*xlf* ) +ppc64le:*xlf* ) 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 - 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 - try_f90flags="\$(FFLAGS) -qfree=f90" - try_fflags_noopt="-O0 -q64" + try_fflags_openmp="-qsmp=noauto:omp" + try_f90flags="\$(FFLAGS) -qsuffix=cpp=f90" + try_fflags_noopt="-O0" try_ldflags="" + try_ldflags_openmp="-qsmp=noauto:omp" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; @@ -170,6 +174,7 @@ ppc64-bg:*xlf* ) try_fflags_noopt="-q32 -O0" try_ldflags="-q32" try_ldflags_openmp="-qsmp=omp -qthreaded" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; @@ -184,6 +189,7 @@ ppc64-bgq:*xlf* ) try_fflags_noopt="-O0" try_ldflags="" try_ldflags_openmp="-qstatic -qsmp=noauto:omp -qtm -qthreaded" + try_dflags="-D__XLF" pre_fdflags="-WF," xlf_flags=1 ;; diff --git a/install/m4/x_ac_qe_mpif90.m4 b/install/m4/x_ac_qe_mpif90.m4 index cf6043ec7..ce163595b 100644 --- a/install/m4/x_ac_qe_mpif90.m4 +++ b/install/m4/x_ac_qe_mpif90.m4 @@ -58,12 +58,11 @@ necsx ) ppc64 ) try_mpif90="mpxlf90_r mpf90_r mpif90" try_f90="xlf90_r $try_f90" - try_dflags="-D__XLF" ;; -# PowerPC MareNostrum -ppc64-mn ) +# PowerPC little endian +ppc64le ) + try_mpif90="$try_mpif90 mpixlf" try_f90="xlf90_r" - try_dflags="-D__XLF" ;; # IBM BlueGene - obsolete ppc64-bg | ppc64-bgq ) @@ -78,7 +77,6 @@ ppc64-bg | ppc64-bgq ) try_f90="bgxlf90_r" fi try_arflags="ruv" - try_dflags="-D__XLF" ;; * ) AC_MSG_WARN($arch : unsupported architecture?) @@ -155,7 +153,7 @@ case "$arch" in elif test "$xlf_version" != "" then echo "${ECHO_T}xlf (version unknonw)" - f90_in_mpif90="xlf" + f90_in_mpif90="xlf90_r" try_dflags="-D__XLF" elif test "$armflang_version" != "" then diff --git a/test-suite/run-epw.sh b/test-suite/run-epw.sh index 55f092fe9..1a5d95190 100755 --- a/test-suite/run-epw.sh +++ b/test-suite/run-epw.sh @@ -37,7 +37,7 @@ then cat $3 fi echo "Gather results in save" - python ../../EPW/bin/pp.py < pp.in + python3 ../../EPW/bin/pp.py < pp.in elif [[ "$1" == "3" ]] then echo "Running EPW ..." @@ -57,7 +57,7 @@ then cat $3 fi echo "Gather results in save" - python ../../EPW/bin/pp.py < pp.in + python3 ../../EPW/bin/pp.py < pp.in elif [[ "$1" == "5" ]] then echo "Removing restart files ..." diff --git a/test-suite/testcode/bin/testcode.py b/test-suite/testcode/bin/testcode.py index 410adc741..ed474227f 100755 --- a/test-suite/testcode/bin/testcode.py +++ b/test-suite/testcode/bin/testcode.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 '''testcode [options] [action1 [action2...]] 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) 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() sys.exit(1) @@ -358,10 +358,10 @@ run_test_args: arguments to pass to test.run_test method. test_store[test.path] = [test] else: 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: - print('Warning: cannot run tests in %s concurrently.' % stests[0].path) - serialized_tests += test_store.values() + print(('Warning: cannot run tests in %s concurrently.' % stests[0].path)) + serialized_tests += list(test_store.values()) semaphore = threading.BoundedSemaphore(tot_nprocs) slock = threading.Lock() @@ -413,10 +413,10 @@ number of tests not checked due to test output file not existing. else: if verbose > 0 and verbose <= 2: 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: - print('Skipping comparison. ' - 'Test file does not exist: %s.\n' % test_file) + print(('Skipping comparison. ' + 'Test file does not exist: %s.\n' % test_file)) not_checked += 1 return not_checked @@ -495,15 +495,15 @@ verbose: level of verbosity in output. ) if not os.path.exists(test_file): if verbose > 0: - print('Skipping diff with %s in %s: %s does not exist.' - % (benchmark, test.path, test_file)) + print(('Skipping diff with %s in %s: %s does not exist.' + % (benchmark, test.path, test_file))) elif not have_benchmark: if verbose > 0: - print('Skipping diff with %s. %s' % (test.path, err)) + print(('Skipping diff with %s. %s' % (test.path, err))) else: if verbose > 0: - print('Diffing %s and %s in %s.' % - (benchmark, test_file, test.path)) + print(('Diffing %s and %s in %s.' % + (benchmark, test_file, test.path))) diff_cmd = '%s %s %s' % (diff_program, benchmark, test_file) diff_popen = subprocess.Popen(diff_cmd, shell=True) diff_popen.wait() @@ -520,10 +520,10 @@ ndays: test files older than ndays are deleted. test_globs = ['test.out*','test.err*'] - print( + print(( 'Delete all %s files older than %s days from each job directory?' % (' '.join(test_globs), ndays) - ) + )) ans = '' while ans != 'y' and ans != '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) benchmark = ' '.join(ids) if len(benchmark.split()) > 1: - print('Setting new benchmarks in userconfig to be: %s.' % - (benchmark)) + print(('Setting new benchmarks in userconfig to be: %s.' % + (benchmark))) else: - print('Setting new benchmark in userconfig to be: %s.' % - (benchmark)) + print(('Setting new benchmark in userconfig to be: %s.' % + (benchmark))) config.set('user', 'benchmark', benchmark) userconfig = open(userconfig, 'w') config.write(userconfig) @@ -638,14 +638,14 @@ verbose: level of verbosity in output (no output if <1). exes = testcode2.compatibility.compat_set(exes) if running: for exe in exes: - print('Using executable: %s.' % (exe)) + print(('Using executable: %s.' % (exe))) # 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: benchmark_ids = ', '.join(tests[0].test_program.benchmark) - print('Benchmarks: %s.' % (benchmark_ids)) + print(('Benchmarks: %s.' % (benchmark_ids))) else: - print('Benchmark: %s.' % (tests[0].test_program.benchmark[0])) + print(('Benchmark: %s.' % (tests[0].test_program.benchmark[0]))) print('') 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: msg = 'All done. %s' % (msg,) if npassed == nran: - print(msg % ('', npassed, nran, ran_test, add_info_msg)) + print((msg % ('', npassed, nran, ran_test, add_info_msg))) 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: - 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: - 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: - 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: - 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. :-( ret_val = 0 diff --git a/test-suite/testcode/lib/testcode2/__init__.py b/test-suite/testcode/lib/testcode2/__init__.py index fb1819e62..acf422121 100644 --- a/test-suite/testcode/lib/testcode2/__init__.py +++ b/test-suite/testcode/lib/testcode2/__init__.py @@ -79,7 +79,7 @@ class TestProgram: self.vcs = None # Set values passed in as keyword options. - for (attr, val) in kwargs.items(): + for (attr, val) in list(kwargs.items()): setattr(self, attr, val) # If using an external verification program, then set the default @@ -196,7 +196,7 @@ class Test: self.tolerances = {} # Set values passed in as keyword options. - for (attr, val) in kwargs.items(): + for (attr, val) in list(kwargs.items()): setattr(self, attr, val) if not self.inputs_args: @@ -318,13 +318,13 @@ class Test: # weren't run. err = 'Previous test in %s caused a system failure.' % (self.path) 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)]: self._update_status(status, (test_input, test_arg)) if verbose > 2: cmd = self.test_program.run_cmd(test_input, test_arg, self.nprocs) - print('Test using %s in %s' % (cmd, self.path)) + print(('Test using %s in %s' % (cmd, self.path))) elif verbose > 0: info_line = util.info_line(self.path, test_input, test_arg, rundir) @@ -348,13 +348,13 @@ first, during initialisation.''' job.create_submit_file(tp_ptr.submit_pattern, cmd, self.submit_template) if verbose > 2: - print('Submitting tests using %s (template submit file) in %s' - % (self.submit_template, self.path)) + print(('Submitting tests using %s (template submit file) in %s' + % (self.submit_template, self.path))) job.start_job() else: # Run locally via subprocess. 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: job = subprocess.Popen(cmd, shell=True) except OSError: @@ -407,10 +407,10 @@ enters self.path. if old_out_files: out_dir = 'test.prev.output.%s' % (self.test_program.test_id) if verbose > 2: - print('WARNING: found existing files matching output ' - 'pattern: %s.' % self.output) - print('WARNING: moving existing output files (%s) to %s.\n' - % (', '.join(old_out_files), out_dir)) + print(('WARNING: found existing files matching output ' + 'pattern: %s.' % self.output)) + print(('WARNING: moving existing output files (%s) to %s.\n' + % (', '.join(old_out_files), out_dir))) if not os.path.exists(out_dir): os.mkdir(out_dir) for out_file in old_out_files: @@ -485,8 +485,8 @@ first, during initialisation.''' cmd = self.test_program.skip_cmd(input_file, args) try: if verbose > 2: - print('Testing whether to skip test using %s in %s.' % - (cmd, self.path)) + print(('Testing whether to skip test using %s in %s.' % + (cmd, self.path))) skip_popen = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) skip_popen.wait() @@ -497,7 +497,7 @@ first, during initialisation.''' # slightly odd syntax in order to be compatible with python # 2.5 and python 2.6/3 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, '') 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) try: if verbose > 2: - print('Analysing test using %s in %s.' % - (verify_cmd, self.path)) + print(('Analysing test using %s in %s.' % + (verify_cmd, self.path))) verify_popen = subprocess.Popen(verify_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) verify_popen.wait() @@ -539,8 +539,8 @@ Assume function is executed in self.path.''' tp_ptr.test_id, input_file, args), ] if verbose > 2: - print('Analysing output using data_tag %s in %s on files %s.' % - (tp_ptr.data_tag, self.path, ' and '.join(data_files))) + print(('Analysing output using data_tag %s in %s on files %s.' % + (tp_ptr.data_tag, self.path, ' and '.join(data_files)))) outputs = [util.extract_tagged_data(tp_ptr.data_tag, dfile) for dfile in data_files] else: @@ -553,41 +553,21 @@ Assume function is executed in self.path.''' for cmd in extract_cmds: try: if verbose > 2: - print('Analysing output using %s in %s.' % - (cmd, self.path)) - # Samuel Ponce: Popen.wait() creates deadlock if the data is too large - # See documented issue for example in: - # 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) - + print(('Analysing output using %s in %s.' % + (cmd, self.path))) + extract_popen = subprocess.run(cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) except OSError: # slightly odd syntax in order to be compatible with python # 2.5 and python 2.6/3 err = 'Analysing output failed: %s' % (sys.exc_info()[1],) raise exceptions.AnalysisError(err) # Convert data string from extract command to dictionary format. - - # SP: Because of the above change, the test below cannot be done: - #if extract_popen.returncode != 0: - # err = extract_popen.communicate()[1].decode('utf-8') - # err = 'Analysing output failed: %s' % (err) - # raise exceptions.AnalysisError(err) - #data_string = extract_popen.communicate()[0].decode('utf-8') - data_string = ''.join(lines) - + if extract_popen.returncode != 0: + err = extract_popen.communicate()[1].decode('utf-8') + err = 'Analysing output failed: %s' % (err) + raise exceptions.AnalysisError(err) + data_string = extract_popen.stdout.decode('utf-8') if self.test_program.extract_fmt == 'table': outputs.append(util.dict_table_string(data_string)) elif self.test_program.extract_fmt == 'yaml': @@ -596,7 +576,7 @@ Assume function is executed in self.path.''' # that from dict_table_string. # ensure all keys are strings so they can be sorted # (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): outputs[-1][str(key)] = tuple(val) 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 # necessarily successfuly!). 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()) - 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()) - 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()) - 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()) - 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()) - 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 diff --git a/test-suite/testcode/lib/testcode2/compatibility.py b/test-suite/testcode/lib/testcode2/compatibility.py index 06fc2a21f..bde465210 100644 --- a/test-suite/testcode/lib/testcode2/compatibility.py +++ b/test-suite/testcode/lib/testcode2/compatibility.py @@ -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 """ _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') if isinstance(node_or_string, ast.Expression): node_or_string = node_or_string.node def _convert(node): '''Convert node/string to expression.''' if isinstance(node, ast.Const) and isinstance(node.value, - (basestring, int, float, long, complex)): + (str, int, float, complex)): return node.value elif isinstance(node, ast.Tuple): return tuple(_convert(element) for element in node.nodes) @@ -146,7 +146,7 @@ except ImportError: try: import configparser except ImportError: - import ConfigParser as configparser + import configparser as configparser try: compat_input = raw_input @@ -154,6 +154,6 @@ except NameError: compat_input = input try: - maxint = sys.maxint + maxint = sys.maxsize except AttributeError: maxint = sys.maxsize diff --git a/test-suite/testcode/lib/testcode2/config.py b/test-suite/testcode/lib/testcode2/config.py index 4a5f68e15..b4d0ebfdc 100644 --- a/test-suite/testcode/lib/testcode2/config.py +++ b/test-suite/testcode/lib/testcode2/config.py @@ -74,8 +74,8 @@ config_file: location of the userconfig file, either relative or absolute.''' # Alter config file with additional settings provided. if settings: - for (section_key, section) in settings.items(): - for (option_key, value) in section.items(): + for (section_key, section) in list(settings.items()): + for (option_key, value) in list(section.items()): userconfig.set(section_key, option_key, value) # 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. if settings: - for (section_key, section) in settings.items(): - for (option_key, value) in section.items(): + for (section_key, section) in list(settings.items()): + for (option_key, value) in list(section.items()): jobconfig.set(section_key, option_key, value) # Parse job categories. # Just store as list of test names for now. if jobconfig.has_section('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() jobconfig.remove_section('categories') 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). 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() os.chdir(path) # Expand any globs in the input files. @@ -455,7 +455,7 @@ def select_tests(all_tests, test_categories, selected_categories, prefix=''): found = True tests.append(test) 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. tests = list(compat.compat_set(tests)) return tests @@ -483,7 +483,7 @@ the full path. # Cannot find program. # This still allows us to manipulate previously run tests, just not # 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 # know what they're doing and the above tests are not always # sufficient (e.g. if using cygwin but using an MPI implementation diff --git a/test-suite/testcode/lib/testcode2/exceptions.py b/test-suite/testcode/lib/testcode2/exceptions.py index 9f509abc2..11652169e 100644 --- a/test-suite/testcode/lib/testcode2/exceptions.py +++ b/test-suite/testcode/lib/testcode2/exceptions.py @@ -13,7 +13,7 @@ import sys def signal_handler(sig, frame): '''Capture signal and leave quietly.''' - print('Signal: %s has been caught. Bye!' % (sig)) + print(('Signal: %s has been caught. Bye!' % (sig))) sys.exit(1) diff --git a/test-suite/testcode/lib/testcode2/util.py b/test-suite/testcode/lib/testcode2/util.py index ea7484618..06922024c 100644 --- a/test-suite/testcode/lib/testcode2/util.py +++ b/test-suite/testcode/lib/testcode2/util.py @@ -79,7 +79,7 @@ def extract_tagged_data(data_tag, filename): else: data[key] = [val] # 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) return data @@ -130,7 +130,7 @@ and # overwrite the previous column with the same heading. data_dict[head[ind]].append(val) # 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) return data_dict diff --git a/test-suite/testcode/lib/testcode2/validation.py b/test-suite/testcode/lib/testcode2/validation.py index e007a2407..08abb4d88 100644 --- a/test-suite/testcode/lib/testcode2/validation.py +++ b/test-suite/testcode/lib/testcode2/validation.py @@ -74,11 +74,11 @@ vspace: print out extra new line afterwards if verbose > 1. elif self.status == self._passed: print('Passed.') elif self.status == self._skipped: - print('%s.' % ansi.ansi_format('SKIPPED', 'blue')) + print(('%s.' % ansi.ansi_format('SKIPPED', 'blue'))) elif self.status == self._partial: - print('%s.' % ansi.ansi_format('WARNING', 'blue')) + print(('%s.' % ansi.ansi_format('WARNING', 'blue'))) else: - print('%s.' % ansi.ansi_format('**FAILED**', 'red', 'normal', 'bold')) + print(('%s.' % ansi.ansi_format('**FAILED**', 'red', 'normal', 'bold'))) if msg and verbose > 1: print(msg) if vspace and verbose > 1: @@ -220,13 +220,13 @@ def compare_data(benchmark, test, default_tolerance, tolerances, # different numbers of duplicate keys. comparable = (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: key_counts[key] += len(val) - for (key, val) in test.items(): + for (key, val) in list(test.items()): if key not in ignored_params: 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() msg = [] @@ -254,7 +254,7 @@ def compare_data(benchmark, test, default_tolerance, tolerances, param_tol = tolerances.get(param, default_tolerance) if param_tol == default_tolerance: # 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_matches: param_tol = tol_matches[0]