subroutine alloc_var_R4P_7D(var, ulb, file_unit, msg, verbose)
!< Allocate CPU variable with memory checking (kind R4P, rank 6).
!<
!<```fortran
!< use penf
!< real(R4P), allocatable :: a(:,:,:,:,:,:,:)
!< integer(I4P) :: ulb(2,7)=reshape([1,1, &
!< 1,2, &
!< 1,3, &
!< 1,4, &
!< 1,5, &
!< 1,6, &
!< 1,7],&
!< [2,7])
!< open(unit=666, file='doctest-mem.log')
!< call allocate_variable(a, ulb, file_unit=666, verbose=.true.)
!< close(666, status='delete')
!< print*, allocated(a)
!<```
!=> T <<<
real(R4P), allocatable, intent(inout) :: var(:,:,:,:,:,:,:) !< Varibale to be allocate on CPU.
integer(I4P), intent(in) :: ulb(2,7) !< Upper/lower bounds of variable.
integer(I4P), intent(in), optional :: file_unit !< File unit for verbose output.
character(*), intent(in), optional :: msg !< Message to be printed in verbose mode.
logical, intent(in), optional :: verbose !< Flag to activate verbose mode.
integer(I4P) :: file_unit_ !< File unit for verbose output, local var.
character(:), allocatable :: msg_ !< Message to be printed in verbose mode, local var.
logical :: verbose_ !< Flag to activate verbose mode, local var.
integer(I8P) :: mem_free, mem_total !< CPU memory.
file_unit_ = stdout ; if (present(file_unit)) file_unit_ = file_unit
msg_ = '' ; if (present(msg )) msg_ = msg
verbose_ = .false. ; if (present(verbose)) verbose_ = verbose
if (allocated(var)) deallocate(var)
if (verbose_) then
call get_memory_info(mem_total, mem_free)
write(file_unit_,'(A)') msg_//'free/total memory BEFORE allocate:'//trim(str([mem_free,mem_total]))//'[bytes]'
endif
allocate(var(ulb(1,1):ulb(2,1), ulb(1,2):ulb(2,2), ulb(1,3):ulb(2,3), ulb(1,4):ulb(2,4), ulb(1,5):ulb(2,5), ulb(1,6):ulb(2,6), &
ulb(1,7):ulb(2,7)))
if (verbose_) then
call get_memory_info(mem_total, mem_free)
write(file_unit_,'(A)') msg_//'free/total memory AFTER allocate:'//trim(str([mem_free,mem_total]))//'[bytes]'
endif
endsubroutine alloc_var_R4P_7D