Deallocation of GPU data now resets out-of-date flag. Moreover allocation is not checked if call on CPU data only flags GPU data ood

This commit is contained in:
Pietro Bonfa 2018-08-08 12:06:38 +02:00
parent 34c4d74743
commit fabcb0959b
6 changed files with 70 additions and 35 deletions

View File

@ -64,7 +64,7 @@
IF (PRESENT(debug_info) ) print *, "using_gg ", debug_info, gg_ood
!
IF (gg_ood) THEN
IF (.not. allocated(gg_d)) THEN
IF ((.not. allocated(gg_d)) .and. (intento_ < 2)) THEN
CALL errore('using_gg_d', 'PANIC: sync of gg from gg_d with unallocated array. Bye!!', 1)
stop
END IF
@ -140,7 +140,7 @@
IF (PRESENT(debug_info) ) print *, "using_g ", debug_info, g_ood
!
IF (g_ood) THEN
IF (.not. allocated(g_d)) THEN
IF ((.not. allocated(g_d)) .and. (intento_ < 2)) THEN
CALL errore('using_g_d', 'PANIC: sync of g from g_d with unallocated array. Bye!!', 1)
stop
END IF
@ -216,7 +216,7 @@
IF (PRESENT(debug_info) ) print *, "using_mill ", debug_info, mill_ood
!
IF (mill_ood) THEN
IF (.not. allocated(mill_d)) THEN
IF ((.not. allocated(mill_d)) .and. (intento_ < 2)) THEN
CALL errore('using_mill_d', 'PANIC: sync of mill from mill_d with unallocated array. Bye!!', 1)
stop
END IF
@ -292,7 +292,7 @@
IF (PRESENT(debug_info) ) print *, "using_eigts1 ", debug_info, eigts1_ood
!
IF (eigts1_ood) THEN
IF (.not. allocated(eigts1_d)) THEN
IF ((.not. allocated(eigts1_d)) .and. (intento_ < 2)) THEN
CALL errore('using_eigts1_d', 'PANIC: sync of eigts1 from eigts1_d with unallocated array. Bye!!', 1)
stop
END IF
@ -368,7 +368,7 @@
IF (PRESENT(debug_info) ) print *, "using_eigts2 ", debug_info, eigts2_ood
!
IF (eigts2_ood) THEN
IF (.not. allocated(eigts2_d)) THEN
IF ((.not. allocated(eigts2_d)) .and. (intento_ < 2)) THEN
CALL errore('using_eigts2_d', 'PANIC: sync of eigts2 from eigts2_d with unallocated array. Bye!!', 1)
stop
END IF
@ -444,7 +444,7 @@
IF (PRESENT(debug_info) ) print *, "using_eigts3 ", debug_info, eigts3_ood
!
IF (eigts3_ood) THEN
IF (.not. allocated(eigts3_d)) THEN
IF ((.not. allocated(eigts3_d)) .and. (intento_ < 2)) THEN
CALL errore('using_eigts3_d', 'PANIC: sync of eigts3 from eigts3_d with unallocated array. Bye!!', 1)
stop
END IF
@ -504,11 +504,17 @@
!
SUBROUTINE deallocate_gvect_gpu
IF( ALLOCATED( gg_d ) ) DEALLOCATE( gg_d )
gg_d_ood = .false.
IF( ALLOCATED( g_d ) ) DEALLOCATE( g_d )
g_d_ood = .false.
IF( ALLOCATED( mill_d ) ) DEALLOCATE( mill_d )
mill_d_ood = .false.
IF( ALLOCATED( eigts1_d ) ) DEALLOCATE( eigts1_d )
eigts1_d_ood = .false.
IF( ALLOCATED( eigts2_d ) ) DEALLOCATE( eigts2_d )
eigts2_d_ood = .false.
IF( ALLOCATED( eigts3_d ) ) DEALLOCATE( eigts3_d )
eigts3_d_ood = .false.
END SUBROUTINE deallocate_gvect_gpu
!=----------------------------------------------------------------------------=!
END MODULE gvect_gpum

View File

@ -94,7 +94,7 @@
IF (PRESENT(debug_info) ) print *, "using_indv ", debug_info, indv_ood
!
IF (indv_ood) THEN
IF (.not. allocated(indv_d)) THEN
IF ((.not. allocated(indv_d)) .and. (intento_ < 2)) THEN
CALL errore('using_indv_d', 'PANIC: sync of indv from indv_d with unallocated array. Bye!!', 1)
stop
END IF
@ -170,7 +170,7 @@
IF (PRESENT(debug_info) ) print *, "using_nhtol ", debug_info, nhtol_ood
!
IF (nhtol_ood) THEN
IF (.not. allocated(nhtol_d)) THEN
IF ((.not. allocated(nhtol_d)) .and. (intento_ < 2)) THEN
CALL errore('using_nhtol_d', 'PANIC: sync of nhtol from nhtol_d with unallocated array. Bye!!', 1)
stop
END IF
@ -246,7 +246,7 @@
IF (PRESENT(debug_info) ) print *, "using_nhtolm ", debug_info, nhtolm_ood
!
IF (nhtolm_ood) THEN
IF (.not. allocated(nhtolm_d)) THEN
IF ((.not. allocated(nhtolm_d)) .and. (intento_ < 2)) THEN
CALL errore('using_nhtolm_d', 'PANIC: sync of nhtolm from nhtolm_d with unallocated array. Bye!!', 1)
stop
END IF
@ -322,7 +322,7 @@
IF (PRESENT(debug_info) ) print *, "using_ijtoh ", debug_info, ijtoh_ood
!
IF (ijtoh_ood) THEN
IF (.not. allocated(ijtoh_d)) THEN
IF ((.not. allocated(ijtoh_d)) .and. (intento_ < 2)) THEN
CALL errore('using_ijtoh_d', 'PANIC: sync of ijtoh from ijtoh_d with unallocated array. Bye!!', 1)
stop
END IF
@ -398,7 +398,7 @@
IF (PRESENT(debug_info) ) print *, "using_indv_ijkb0 ", debug_info, indv_ijkb0_ood
!
IF (indv_ijkb0_ood) THEN
IF (.not. allocated(indv_ijkb0_d)) THEN
IF ((.not. allocated(indv_ijkb0_d)) .and. (intento_ < 2)) THEN
CALL errore('using_indv_ijkb0_d', 'PANIC: sync of indv_ijkb0 from indv_ijkb0_d with unallocated array. Bye!!', 1)
stop
END IF
@ -474,7 +474,7 @@
IF (PRESENT(debug_info) ) print *, "using_vkb ", debug_info, vkb_ood
!
IF (vkb_ood) THEN
IF (.not. allocated(vkb_d)) THEN
IF ((.not. allocated(vkb_d)) .and. (intento_ < 2)) THEN
CALL errore('using_vkb_d', 'PANIC: sync of vkb from vkb_d with unallocated array. Bye!!', 1)
stop
END IF
@ -550,7 +550,7 @@
IF (PRESENT(debug_info) ) print *, "using_becsum ", debug_info, becsum_ood
!
IF (becsum_ood) THEN
IF (.not. allocated(becsum_d)) THEN
IF ((.not. allocated(becsum_d)) .and. (intento_ < 2)) THEN
CALL errore('using_becsum_d', 'PANIC: sync of becsum from becsum_d with unallocated array. Bye!!', 1)
stop
END IF
@ -626,7 +626,7 @@
IF (PRESENT(debug_info) ) print *, "using_ebecsum ", debug_info, ebecsum_ood
!
IF (ebecsum_ood) THEN
IF (.not. allocated(ebecsum_d)) THEN
IF ((.not. allocated(ebecsum_d)) .and. (intento_ < 2)) THEN
CALL errore('using_ebecsum_d', 'PANIC: sync of ebecsum from ebecsum_d with unallocated array. Bye!!', 1)
stop
END IF
@ -702,7 +702,7 @@
IF (PRESENT(debug_info) ) print *, "using_dvan ", debug_info, dvan_ood
!
IF (dvan_ood) THEN
IF (.not. allocated(dvan_d)) THEN
IF ((.not. allocated(dvan_d)) .and. (intento_ < 2)) THEN
CALL errore('using_dvan_d', 'PANIC: sync of dvan from dvan_d with unallocated array. Bye!!', 1)
stop
END IF
@ -778,7 +778,7 @@
IF (PRESENT(debug_info) ) print *, "using_deeq ", debug_info, deeq_ood
!
IF (deeq_ood) THEN
IF (.not. allocated(deeq_d)) THEN
IF ((.not. allocated(deeq_d)) .and. (intento_ < 2)) THEN
CALL errore('using_deeq_d', 'PANIC: sync of deeq from deeq_d with unallocated array. Bye!!', 1)
stop
END IF
@ -854,7 +854,7 @@
IF (PRESENT(debug_info) ) print *, "using_qq_nt ", debug_info, qq_nt_ood
!
IF (qq_nt_ood) THEN
IF (.not. allocated(qq_nt_d)) THEN
IF ((.not. allocated(qq_nt_d)) .and. (intento_ < 2)) THEN
CALL errore('using_qq_nt_d', 'PANIC: sync of qq_nt from qq_nt_d with unallocated array. Bye!!', 1)
stop
END IF
@ -930,7 +930,7 @@
IF (PRESENT(debug_info) ) print *, "using_qq_at ", debug_info, qq_at_ood
!
IF (qq_at_ood) THEN
IF (.not. allocated(qq_at_d)) THEN
IF ((.not. allocated(qq_at_d)) .and. (intento_ < 2)) THEN
CALL errore('using_qq_at_d', 'PANIC: sync of qq_at from qq_at_d with unallocated array. Bye!!', 1)
stop
END IF
@ -1006,7 +1006,7 @@
IF (PRESENT(debug_info) ) print *, "using_nhtoj ", debug_info, nhtoj_ood
!
IF (nhtoj_ood) THEN
IF (.not. allocated(nhtoj_d)) THEN
IF ((.not. allocated(nhtoj_d)) .and. (intento_ < 2)) THEN
CALL errore('using_nhtoj_d', 'PANIC: sync of nhtoj from nhtoj_d with unallocated array. Bye!!', 1)
stop
END IF
@ -1082,7 +1082,7 @@
IF (PRESENT(debug_info) ) print *, "using_qq_so ", debug_info, qq_so_ood
!
IF (qq_so_ood) THEN
IF (.not. allocated(qq_so_d)) THEN
IF ((.not. allocated(qq_so_d)) .and. (intento_ < 2)) THEN
CALL errore('using_qq_so_d', 'PANIC: sync of qq_so from qq_so_d with unallocated array. Bye!!', 1)
stop
END IF
@ -1158,7 +1158,7 @@
IF (PRESENT(debug_info) ) print *, "using_dvan_so ", debug_info, dvan_so_ood
!
IF (dvan_so_ood) THEN
IF (.not. allocated(dvan_so_d)) THEN
IF ((.not. allocated(dvan_so_d)) .and. (intento_ < 2)) THEN
CALL errore('using_dvan_so_d', 'PANIC: sync of dvan_so from dvan_so_d with unallocated array. Bye!!', 1)
stop
END IF
@ -1234,7 +1234,7 @@
IF (PRESENT(debug_info) ) print *, "using_deeq_nc ", debug_info, deeq_nc_ood
!
IF (deeq_nc_ood) THEN
IF (.not. allocated(deeq_nc_d)) THEN
IF ((.not. allocated(deeq_nc_d)) .and. (intento_ < 2)) THEN
CALL errore('using_deeq_nc_d', 'PANIC: sync of deeq_nc from deeq_nc_d with unallocated array. Bye!!', 1)
stop
END IF
@ -1294,21 +1294,37 @@
!
SUBROUTINE deallocate_uspp_gpu
IF( ALLOCATED( indv_d ) ) DEALLOCATE( indv_d )
indv_d_ood = .false.
IF( ALLOCATED( nhtol_d ) ) DEALLOCATE( nhtol_d )
nhtol_d_ood = .false.
IF( ALLOCATED( nhtolm_d ) ) DEALLOCATE( nhtolm_d )
nhtolm_d_ood = .false.
IF( ALLOCATED( ijtoh_d ) ) DEALLOCATE( ijtoh_d )
ijtoh_d_ood = .false.
IF( ALLOCATED( indv_ijkb0_d ) ) DEALLOCATE( indv_ijkb0_d )
indv_ijkb0_d_ood = .false.
IF( ALLOCATED( vkb_d ) ) DEALLOCATE( vkb_d )
vkb_d_ood = .false.
IF( ALLOCATED( becsum_d ) ) DEALLOCATE( becsum_d )
becsum_d_ood = .false.
IF( ALLOCATED( ebecsum_d ) ) DEALLOCATE( ebecsum_d )
ebecsum_d_ood = .false.
IF( ALLOCATED( dvan_d ) ) DEALLOCATE( dvan_d )
dvan_d_ood = .false.
IF( ALLOCATED( deeq_d ) ) DEALLOCATE( deeq_d )
deeq_d_ood = .false.
IF( ALLOCATED( qq_nt_d ) ) DEALLOCATE( qq_nt_d )
qq_nt_d_ood = .false.
IF( ALLOCATED( qq_at_d ) ) DEALLOCATE( qq_at_d )
qq_at_d_ood = .false.
IF( ALLOCATED( nhtoj_d ) ) DEALLOCATE( nhtoj_d )
nhtoj_d_ood = .false.
IF( ALLOCATED( qq_so_d ) ) DEALLOCATE( qq_so_d )
qq_so_d_ood = .false.
IF( ALLOCATED( dvan_so_d ) ) DEALLOCATE( dvan_so_d )
dvan_so_d_ood = .false.
IF( ALLOCATED( deeq_nc_d ) ) DEALLOCATE( deeq_nc_d )
deeq_nc_d_ood = .false.
END SUBROUTINE deallocate_uspp_gpu
!=----------------------------------------------------------------------------=!
END MODULE uspp_gpum

View File

@ -55,7 +55,7 @@
IF (PRESENT(debug_info) ) print *, "using_evc ", debug_info, evc_ood
!
IF (evc_ood) THEN
IF (.not. allocated(evc_d)) THEN
IF ((.not. allocated(evc_d)) .and. (intento_ < 2)) THEN
CALL errore('using_evc_d', 'PANIC: sync of evc from evc_d with unallocated array. Bye!!', 1)
stop
END IF
@ -131,7 +131,7 @@
IF (PRESENT(debug_info) ) print *, "using_psic ", debug_info, psic_ood
!
IF (psic_ood) THEN
IF (.not. allocated(psic_d)) THEN
IF ((.not. allocated(psic_d)) .and. (intento_ < 2)) THEN
CALL errore('using_psic_d', 'PANIC: sync of psic from psic_d with unallocated array. Bye!!', 1)
stop
END IF
@ -207,7 +207,7 @@
IF (PRESENT(debug_info) ) print *, "using_psic_nc ", debug_info, psic_nc_ood
!
IF (psic_nc_ood) THEN
IF (.not. allocated(psic_nc_d)) THEN
IF ((.not. allocated(psic_nc_d)) .and. (intento_ < 2)) THEN
CALL errore('using_psic_nc_d', 'PANIC: sync of psic_nc from psic_nc_d with unallocated array. Bye!!', 1)
stop
END IF
@ -267,8 +267,11 @@
!
SUBROUTINE deallocate_wavefunctions_gpu
IF( ALLOCATED( evc_d ) ) DEALLOCATE( evc_d )
evc_d_ood = .false.
IF( ALLOCATED( psic_d ) ) DEALLOCATE( psic_d )
psic_d_ood = .false.
IF( ALLOCATED( psic_nc_d ) ) DEALLOCATE( psic_nc_d )
psic_nc_d_ood = .false.
END SUBROUTINE deallocate_wavefunctions_gpu
!=----------------------------------------------------------------------------=!
END MODULE wavefunctions_gpum

View File

@ -52,7 +52,7 @@
IF (PRESENT(debug_info) ) print *, "using_h_diag ", debug_info, h_diag_ood
!
IF (h_diag_ood) THEN
IF (.not. allocated(h_diag_d)) THEN
IF ((.not. allocated(h_diag_d)) .and. (intento_ < 2)) THEN
CALL errore('using_h_diag_d', 'PANIC: sync of h_diag from h_diag_d with unallocated array. Bye!!', 1)
stop
END IF
@ -128,7 +128,7 @@
IF (PRESENT(debug_info) ) print *, "using_s_diag ", debug_info, s_diag_ood
!
IF (s_diag_ood) THEN
IF (.not. allocated(s_diag_d)) THEN
IF ((.not. allocated(s_diag_d)) .and. (intento_ < 2)) THEN
CALL errore('using_s_diag_d', 'PANIC: sync of s_diag from s_diag_d with unallocated array. Bye!!', 1)
stop
END IF
@ -188,7 +188,9 @@
!
SUBROUTINE deallocate_g_psi_mod_gpu
IF( ALLOCATED( h_diag_d ) ) DEALLOCATE( h_diag_d )
h_diag_d_ood = .false.
IF( ALLOCATED( s_diag_d ) ) DEALLOCATE( s_diag_d )
s_diag_d_ood = .false.
END SUBROUTINE deallocate_g_psi_mod_gpu
!=----------------------------------------------------------------------------=!
END MODULE g_psi_mod_gpum

View File

@ -52,7 +52,7 @@
IF (PRESENT(debug_info) ) print *, "using_g2kin ", debug_info, g2kin_ood
!
IF (g2kin_ood) THEN
IF (.not. allocated(g2kin_d)) THEN
IF ((.not. allocated(g2kin_d)) .and. (intento_ < 2)) THEN
CALL errore('using_g2kin_d', 'PANIC: sync of g2kin from g2kin_d with unallocated array. Bye!!', 1)
stop
END IF
@ -128,7 +128,7 @@
IF (PRESENT(debug_info) ) print *, "using_et ", debug_info, et_ood
!
IF (et_ood) THEN
IF (.not. allocated(et_d)) THEN
IF ((.not. allocated(et_d)) .and. (intento_ < 2)) THEN
CALL errore('using_et_d', 'PANIC: sync of et from et_d with unallocated array. Bye!!', 1)
stop
END IF
@ -188,7 +188,9 @@
!
SUBROUTINE deallocate_wvfct_gpu
IF( ALLOCATED( g2kin_d ) ) DEALLOCATE( g2kin_d )
g2kin_d_ood = .false.
IF( ALLOCATED( et_d ) ) DEALLOCATE( et_d )
et_d_ood = .false.
END SUBROUTINE deallocate_wvfct_gpu
!=----------------------------------------------------------------------------=!
END MODULE wvfct_gpum
@ -252,7 +254,7 @@
IF (PRESENT(debug_info) ) print *, "using_qrad ", debug_info, qrad_ood
!
IF (qrad_ood) THEN
IF (.not. allocated(qrad_d)) THEN
IF ((.not. allocated(qrad_d)) .and. (intento_ < 2)) THEN
CALL errore('using_qrad_d', 'PANIC: sync of qrad from qrad_d with unallocated array. Bye!!', 1)
stop
END IF
@ -328,7 +330,7 @@
IF (PRESENT(debug_info) ) print *, "using_tab ", debug_info, tab_ood
!
IF (tab_ood) THEN
IF (.not. allocated(tab_d)) THEN
IF ((.not. allocated(tab_d)) .and. (intento_ < 2)) THEN
CALL errore('using_tab_d', 'PANIC: sync of tab from tab_d with unallocated array. Bye!!', 1)
stop
END IF
@ -404,7 +406,7 @@
IF (PRESENT(debug_info) ) print *, "using_tab_at ", debug_info, tab_at_ood
!
IF (tab_at_ood) THEN
IF (.not. allocated(tab_at_d)) THEN
IF ((.not. allocated(tab_at_d)) .and. (intento_ < 2)) THEN
CALL errore('using_tab_at_d', 'PANIC: sync of tab_at from tab_at_d with unallocated array. Bye!!', 1)
stop
END IF
@ -480,7 +482,7 @@
IF (PRESENT(debug_info) ) print *, "using_tab_d2y ", debug_info, tab_d2y_ood
!
IF (tab_d2y_ood) THEN
IF (.not. allocated(tab_d2y_d)) THEN
IF ((.not. allocated(tab_d2y_d)) .and. (intento_ < 2)) THEN
CALL errore('using_tab_d2y_d', 'PANIC: sync of tab_d2y from tab_d2y_d with unallocated array. Bye!!', 1)
stop
END IF
@ -540,9 +542,13 @@
!
SUBROUTINE deallocate_us_gpu
IF( ALLOCATED( qrad_d ) ) DEALLOCATE( qrad_d )
qrad_d_ood = .false.
IF( ALLOCATED( tab_d ) ) DEALLOCATE( tab_d )
tab_d_ood = .false.
IF( ALLOCATED( tab_at_d ) ) DEALLOCATE( tab_at_d )
tab_at_d_ood = .false.
IF( ALLOCATED( tab_d2y_d ) ) DEALLOCATE( tab_d2y_d )
tab_d2y_d_ood = .false.
END SUBROUTINE deallocate_us_gpu
!=----------------------------------------------------------------------------=!
END MODULE us_gpum
@ -597,7 +603,7 @@
IF (PRESENT(debug_info) ) print *, "using_fcoef ", debug_info, fcoef_ood
!
IF (fcoef_ood) THEN
IF (.not. allocated(fcoef_d)) THEN
IF ((.not. allocated(fcoef_d)) .and. (intento_ < 2)) THEN
CALL errore('using_fcoef_d', 'PANIC: sync of fcoef from fcoef_d with unallocated array. Bye!!', 1)
stop
END IF
@ -657,6 +663,7 @@
!
SUBROUTINE deallocate_spin_orb_gpu
IF( ALLOCATED( fcoef_d ) ) DEALLOCATE( fcoef_d )
fcoef_d_ood = .false.
END SUBROUTINE deallocate_spin_orb_gpu
!=----------------------------------------------------------------------------=!
END MODULE spin_orb_gpum

View File

@ -49,7 +49,7 @@
IF (PRESENT(debug_info) ) print *, "using_vrs ", debug_info, vrs_ood
!
IF (vrs_ood) THEN
IF (.not. allocated(vrs_d)) THEN
IF ((.not. allocated(vrs_d)) .and. (intento_ < 2)) THEN
CALL errore('using_vrs_d', 'PANIC: sync of vrs from vrs_d with unallocated array. Bye!!', 1)
stop
END IF
@ -109,6 +109,7 @@
!
SUBROUTINE deallocate_scf_gpu
IF( ALLOCATED( vrs_d ) ) DEALLOCATE( vrs_d )
vrs_d_ood = .false.
END SUBROUTINE deallocate_scf_gpu
!=----------------------------------------------------------------------------=!
END MODULE scf_gpum