Finalize the library
SUBROUTINE dbcsr_multiply_lib_finalize() !! Finalize the library CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_multiply_lib_finalize' INTEGER :: error_handle, ithread CALL timeset(routineN, error_handle) CALL dbcsr_mm_multrec_lib_finalize() ithread = 0 !$ ithread = omp_get_thread_num() ! Each thread has its own working-matrix and its own mempool IF (ASSOCIATED(memtype_product_wm(ithread)%p%pool)) & CALL dbcsr_mempool_destruct(memtype_product_wm(ithread)%p%pool) DEALLOCATE (memtype_product_wm(ithread)%p) !$OMP BARRIER !$OMP MASTER DEALLOCATE (memtype_product_wm) ! Deallocate buffers CALL buffers_release() ! Release 3D communicators CALL release_layers_3D_C_reduction(release_buffers=.TRUE.) IF (ASSOCIATED(memtype_trsbuffer_1%pool)) & CALL dbcsr_mempool_destruct(memtype_trsbuffer_1%pool) IF (ASSOCIATED(memtype_trsbuffer_2%pool)) & CALL dbcsr_mempool_destruct(memtype_trsbuffer_2%pool) IF (ASSOCIATED(memtype_normsbuf%pool)) & CALL dbcsr_mempool_destruct(memtype_normsbuf%pool) IF (ASSOCIATED(memtype_offsetsbuf%pool)) & CALL dbcsr_mempool_destruct(memtype_offsetsbuf%pool) IF (ASSOCIATED(memtype_nelemsbuf%pool)) & CALL dbcsr_mempool_destruct(memtype_nelemsbuf%pool) IF (ASSOCIATED(memtype_abpanel_1%pool)) & CALL dbcsr_mempool_destruct(memtype_abpanel_1%pool) IF (ASSOCIATED(memtype_abpanel_2%pool)) & CALL dbcsr_mempool_destruct(memtype_abpanel_2%pool) IF (ASSOCIATED(memtype_mpi_product%pool)) & CALL dbcsr_mempool_destruct(memtype_mpi_product%pool) IF (acc_stream_associated(stream_1)) & CALL acc_stream_destroy(stream_1) IF (acc_stream_associated(stream_2)) & CALL acc_stream_destroy(stream_2) !$OMP END MASTER CALL timestop(error_handle) END SUBROUTINE dbcsr_multiply_lib_finalize