Page 1 of 1

Allocation attempt of qindx_B of negative size.

PostPosted: Mon Apr 22, 2019 7:41 pm
by vjhalani
Hi all,

I am using Yambo 4.4 and getting this error when going to fine k-grids for the BSE. This error did not occur on a 30^3 k-grid in GaAs, but it crashes early on when going to the 40^3 grid. An example log file is as follows:

<05m-20s> P1337: [01] CPU structure, Files & I/O Directories
<05m-20s> P1337: CPU-Threads:1408(CPU)-8(threads)
<05m-20s> P1337: CPU-Threads:BS(environment)-1408 1 1(CPUs)-k eh t(ROLEs)
<05m-21s> P1337: [02] CORE Variables Setup
<05m-21s> P1337: [02.01] Unit cells
<05m-21s> P1337: [02.02] Symmetries
<05m-21s> P1337: [02.03] RL shells
<05m-21s> P1337: [02.04] K-grid lattice
<05m-25s> P1337: [02.05] Energies [ev] & Occupations
<05m-46s> P1337: [03] Transferred momenta grid
<05m-47s> P1337: [RL indx] Q-grid:User defined / from ndb.kindx.


<05m-48s> P1337: [WARNING]Allocation of k%ptbz failed. Object was already allocated in [%ptbz]
P1337: [ERROR] STOP signal received while in :[03] Transferred momenta grid
P1337: [ERROR]Allocation attempt of qindx_B of negative size.

I've attached the report file and the input files as well. Let me know if there's any other information I can provide!

Grazie,
Vatsal

Re: Allocation attempt of qindx_B of negative size.

PostPosted: Tue May 07, 2019 10:36 pm
by vjhalani
I am still hoping to hear back regarding this issue.

I checked and added print statements before qindx_B is allocated, at line 168 in mod_R_lattice.F:

print *, "nXkbz = ", nXkbz
YAMBO_ALLOC(qindx_B,(nXkbz,nXkbz,2))

and found that the value of nXkbz is 64000, as expected for a 40^3 grid, and is not negative. I cannot find where YAMBO_ALLOC is defined, but the error message comes from the sz variable passed to MEM_manager. Perhaps the size is nXkbz^2*2, which is about 8E9, which is causing an overflow for a signed 4 byte int? Just throwing out ideas.

Grazie,
Vatsal

Re: Allocation attempt of qindx_B of negative size.

PostPosted: Wed May 08, 2019 12:15 am
by Davide Sangalli
Sorry for the late reply.

The source of the problem
Code: Select all
PXXX: [ERROR] STOP signal received while in :[XX] xxxxx xxxxx
PXXX: [ERROR]Allocation attempt of XXXXXXX of negative size.

is the automatic system of memory check implemented in yambo, which calls MEM_driver.
You can recompile yambo with
Code: Select all
--disable-memory-profile
which should switch off the the check.

In particular "_MEM_CHECK" becomes undefined and in src/memory/MEM_manager.F everything after line 65 is not compiled.

Best,
D.

Re: Allocation attempt of qindx_B of negative size.

PostPosted: Wed May 08, 2019 1:07 am
by vjhalani
Ah, ok I see. Thanks Davide! I do like the memory profiler though in general. Is there a way to fix the check to not think it is allocating arrays of negative size so I can keep it enabled?

Re: Allocation attempt of qindx_B of negative size.

PostPosted: Wed May 08, 2019 8:39 am
by Davide Sangalli
I'll open a bug in our bug tracker and try to fix it.
However please notice that, from my understanding, yambo is not really trying to allocate a vector of negative size.
It's just the MEM_driver interface which is not properly reading the size of the element.

If you want to double check that, still with the
Code: Select all
--disable-memory-profile
option, you can compile yambo with the fortran bounds check.
For gfortran you need to set
Code: Select all
FCFLAGS="-fcheck=bounds"
when you run the configure.
Compilers different from gfortran may require a different syntax. I'll refer from now on to BOUNDS_CHECK_FLAG
The BOUNDS_CHECK_FLAG gives a minimal slowdown to the application

However a warning. Do not just set FCFLAGS with the BOUNDS_CHECK_FLAG, otherwise all automatic optimization options will be discarded.
If you are already setting some FCFLAGS for optimization just add the BOUNDS_CHECK_FLAG to them
Code: Select all
FCFLAGS="USUAL_VALUES BOUNDS_CHECK_FLAG"
. Otherwise if you usually do not set them manually, first run the configure without setting FCFLAGS, then read which are the automatic FCFLAGS used by yambo in the configure report and then rerun the configure with
Code: Select all
FCFLAGS="DEFAULT_VALUES BOUNDS_CHECK_FLAG"

(Replace DEFAULT_VALUES with what you need).

After that, if a vector with negative size is allocated, you will immediately get an "out of bounds message" when the code will try to use it.

Best,
D.

Re: Allocation attempt of qindx_B of negative size.

PostPosted: Wed May 08, 2019 6:59 pm
by vjhalani
Ok, I understand, thanks!

Re: Allocation attempt of qindx_B of negative size.

PostPosted: Mon May 13, 2019 6:53 pm
by vjhalani
Ciao,

Unfortunately, disabling the memory profiler did not stop this error. Now it seems yambo crashes with a segmentation fault at the same place but without printing any error messages. I also tried what you suggested and added the "-check bounds" flag to ifort and, as you suspected, it does not seem to show any errors either.