Finalize the library
SUBROUTINE dbcsr_mm_accdrv_lib_finalize()
!! Finalize the library
CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_mm_accdrv_lib_finalize'
INTEGER :: error_handle, ithread
TYPE(thread_private_type), POINTER :: thread_privates
CALL timeset(routineN, error_handle)
ithread = 0
!$ ithread = OMP_GET_THREAD_NUM()
thread_privates => all_thread_privates(ithread)
IF (ASSOCIATED(thread_privates%stack_buffers)) &
CALL deallocate_stackbuffers()
IF (ASSOCIATED(thread_privates%memtype_cbuffer%pool)) &
CALL dbcsr_mempool_destruct(thread_privates%memtype_cbuffer%pool)
!$OMP BARRIER
!$OMP MASTER
DEALLOCATE (all_thread_privates)
!$OMP END MASTER
!How much memory is still allocated on the card?
!istat = dbcsr_acc_dev_mem_info(mem_free, mem_avail)
!WRITE (*,*) "after finalize acc mem: ",mem_free, mem_avail, istat
CALL deallocate_streams()
CALL timestop(error_handle)
END SUBROUTINE dbcsr_mm_accdrv_lib_finalize