Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28865 Discussions

"Killed" message when trying to read huge file.

Yeon__Jejoon
Novice
1,159 Views

I'm trying to read a file using the same script I asked a question before in 

https://community.intel.com/t5/Intel-Fortran-Compiler/How-can-I-read-a-file-with-varying-number-of-columns/m-p/1189853

This post. The input data looks like 

8055 3 2 5608 5176 0 0.900 0.814 1.714 2.000 -0.466
8444 3 3 5755 6479 3139 0 0.473 0.309 0.729 1.511 2.000 -0.391
6479 1 6 8444 6895 6710 144 8257 3374 0 0.309 0.623 0.743 0.515 0.650 0.636 3.726 0.000 1.142
8407 2 3 8760 2459 9228 0 0.751 0.811 0.412 2.474 0.000 1.133
5222 3 2 4801 7092 0 0.690 0.615 1.524 2.000 -0.437
1089 3 3 7284 4801 7092 0 0.392 0.900 0.359 1.651 2.000 -0.519

and I'm using a script like: 

Program test
implicit none
integer nn
parameter (nn = 50000)
...
integer,dimension(nn,nn) :: conn
integer,dimension(nn) :: atype,nbonds,atindex,atpointer
integer,dimension(nn) :: molnr,atid2,atype2,paint,atid
real,dimension(nn,nn) :: bos
real,dimension(nn) :: x,y,z,abo,nlp,q,aBO2,aBO3,aBO4,aBO5,aBO6
real,dimension(nn) :: aBO7,aBO8,aBO9,charge,charge2
real,dimension(nn) :: sBO2,sBO3,sBO4,sBO5,sBO6,sBO7,sBO8,sBO9

...
do i=1,nat
read (2,*)atid2(i),atype2(i),nbonds(i),(conn(i,j),j=1,nbonds(i)),molnr(i),(bos(i,j),j=1,nbonds(i)),abo(i),nlp(i),charge2(i)
enddo
...

Now, I need to read a huge number of lines (the number of line per each datablock is 400000 lines. ) So I increased "nn" to 450000. Then, I compiled this with: 

ifort test.f -mcmodel medium -o test_script

Then when I execute this script, then "killed" message appears. 

$ ./test_script

Killed 

 

The script reads the data and works perfectly with a small-sized file with the same format, and small number of "nn", like nn=50000. But when I increase "nn", it just shows "Killed" message. What would be the best way to escape from this situation? 

 

This is not my PC or laptop, this is the server cluster of my workplace. 

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.5.274 Build 20180823
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.

$ uname -a
Linux login00 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

 

 

Labels (1)
0 Kudos
5 Replies
Steve_Lionel
Honored Contributor III
1,144 Views

There's probably some resource limit set by the cluster system managers that you exceeded. You'll need to ask them about it.

0 Kudos
Arjen_Markus
Honored Contributor I
1,128 Views

You have two two-dimensional arrays, conn and bos. If you set the parameter nn to 450000 then each will occupy some 8 GB - giving a total of 16 GB. This may exceed the stack space. Try instead to allocate these arrays.

Another thing: compile the program with array bound checking to make sure that nbonds(i) does not exceed the value of nn.

0 Kudos
Yeon__Jejoon
Novice
1,094 Views

May I ask other ways to allocate arrays, and compile with array bound checking? 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,081 Views

...

integer,allocatable,dimension(:,:) :: conn
integer,allocatable,dimension(:) :: atype,nbonds,atindex,atpointer
integer,allocatable,dimension(:) :: molnr,atid2,atype2,paint,atid
real,allocatable,dimension(:,:) :: bos
real,allocatable,dimension(nn) :: x,y,z,abo,nlp,q,aBO2,aBO3,aBO4,aBO5,aBO6
real,allocatable,dimension(nn) :: aBO7,aBO8,aBO9,charge,charge2
real,allocatable,dimension(nn) :: sBO2,sBO3,sBO4,sBO5,sBO6,sBO7,sBO8,sBO9

...
allocate(conn(nn,nn))
allocate(atype(nn),nbonds(nn),atindex(nn),atpointer(nn))
allocate(molnr(nn),atid2(nn),atype2(nn),paint(nn),atid(nn))
allocate(bos(nn,nn))
allocate(x(nn),y(nn),z(nn),abo(nn),nlp(nn),q(nn),aBO2(nn),aBO3(nn),aBO4(nn),aBO5(nn),aBO6(nn))
allocate(aBO7(nn),aBO8(nn),aBO9(nn),charge(nn),charge2(nn))
allocate(sBO2(nn),sBO3(nn),sBO4(nn),sBO5(nn),sBO6(nn),sBO7(nn),sBO8(nn),sBO9(nn))

 

Also, you will likely have to avoid array expressions and revert to explicit DO loop(s), as an array expression may generate a temporary array on stack.

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,080 Views

I forgot to mention. Linux has a "feature" called the OOM-killer which is designed to kill runaway applications. See the link highlighted for additional information.

Jim Dempsey

0 Kudos
Reply