Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Stack overflow error

$
0
0

Hi everyone!

I have been having problems with stack overflow error when I am trying to operate arrays through a function implemented in a module. The problem occurs only with arrays larger than 300x300.

I reduced and generalized the code to find where the error is and even then the problem reoccurs. I even compiled on two different computers with different versions of Visual Studio and Intel Parallel Studio and the error remains the same.

Has anyone experienced this same problem? What can I do to solve this error? Is there any compiler option to solve this problem?

The university computer that I am using has installed Microsoft Visual Studio Professional 2013 Update 3, Intel Parallel Studio XE 2016 Update 2 Cluster Edition for Windows.

I am using the following code to the main program:

	program stack_overflow_error
	use mod_example_function
	implicit none
	! Variables
	real(kind = 8), dimension(:,:), allocatable :: A, Afunc
	integer :: n, i, j

	! Body of Matrix_inversion
	open(100, file='matrix300.txt', status='old')

	read(100,*) n
	allocate(A(n,n))
	do i = 1,n
		read(100,*) (A(i,j), j = 1,n)
	end do

	allocate(Afunc(n,n))
	Afunc = func(A)
	close(100)
	end program stack_overflow_error

and the following code to the module with the function:

module mod_example_function
	implicit none
	contains
		function func(A) result(Afunc)
			! Variables
			real(kind = 8), dimension(:,:), intent(in) :: A
			real(kind = 8), dimension(size(A,1),size(A,2)) :: Afunc
			! Body of FUNC
			Afunc = 0
			Afunc = A
		end function func
end module mod_example_function

Attached are the two txt files, one with an array 300x300 and the other with an array 400x400.

Downloadtext/plainDownload

Downloadtext/plainDownload

Attached are also two printscreens with the errors that appear when the program makes the operation with the array 400x400, one when is compiled in 32-bit and the other in the 64-bit.

Stack overflow erro for a matrix 400x400 compile in 32-bit

Stack overflow erro for a matrix 400x400 compile in 64-bit

Zone: 

Thread Topic: 

Help Me

Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>