Home > Mobile >  How to compile 10^9 kind-8 integer array in gfortran
How to compile 10^9 kind-8 integer array in gfortran

Time:04-01

I want to create an array of 10^9 kind 8 integers in gfortran (Fortran f90 or f95).

I tried declaring it as follows

integer(kind=8) :: x(1000000000)

I expected it to compile but it doesn't. If instead of 1000000000 I use 100000000 it compiles without a problem. My machine has 64G RAM. What can I do?

CodePudding user response:

Without seeing your code, I suspect you'll be happier as will your OS if you use the heap.

integer, parameter :: nx = 1000000000
integer(8), allocatable :: x(:)      ! Yes, I know 8 is not portable.
allocate(x(nx))
  • Related