I have an extremely simple code,
program main
implicit none
integer, parameter :: i4=selected_int_kind(9)
integer, parameter :: i8=selected_int_kind(15)
integer, parameter :: r8=selected_real_kind(15,9)
integer(kind=i8) :: np
np = 2
call test03(np)
stop
end
subroutine test03(n)
integer, parameter :: i4=selected_int_kind(9)
integer, parameter :: i8=selected_int_kind(15)
integer, parameter :: r8=selected_real_kind(15,9)
integer ( kind = i8 ), intent(in) :: n
real ( kind = r8 ) :: warray(n,4),normal(n,4)
warray = 1.0
write(6,*) 'reshape', reshape(warray,shape(warray))
return
end subroutine test03
I use Intel OneAPI + visual studio 2015/2017.
Problem is, when I run it, it just give me '‘insufficient virtual memory’ error below,
in ‘debug’ mode it also have this error.
Does anyone know why?
Thank you very much in advance!
However, if I enable the below options setting default integer and real as kind 8, it works fine again.
On the other hand, if the warray is allocatable, then it works fine too,
program main
implicit none
integer, parameter :: i4=selected_int_kind(9)
integer, parameter :: i8=selected_int_kind(15)
integer, parameter :: r8=selected_real_kind(15,9)
integer(kind=i8) :: np
np = 2
call test03(np)
stop
end
subroutine test03(n)
implicit none
integer, parameter :: i4=selected_int_kind(9)
integer, parameter :: i8=selected_int_kind(15)
integer, parameter :: r8=selected_real_kind(15,9)
integer ( kind = i8 ), intent(in) :: n
real ( kind = r8 ), allocatable :: warray(:,:)
allocate(warray(n,4))
warray = 1.0
write(6,*) 'reshape', reshape(warray,shape(warray))
deallocate(warray)
return
end subroutine test03
I just do not understand clearly why allocatable array works fine, while define warray(n,2) just give me the error.