[Wien] Fortran 90 bug (?) causes Segmentation fault in DSTART (doreallocate)

Gerhard Fecher fecher at uni-mainz.de
Tue Mar 3 09:37:23 CET 2009


If - like suggested by Hong - the dimension of hilfsfeld is smaller than the one of tf
then it should always give a segmentation fault if you try to
copy the complete tf into hilfsfeld (because min1,min2 > size of hilfsfeld) ,
 independent how you try to do it.

Sorry I don't have the code on my computer I actually work with and can not check it.

If you suspect its min2 = 2507459 causes the problem then check the dimension of hilsfeld and tf

If you suspect the compiler then try to step down to an older Version, if it was working.
or try to switch of optimization for DSTART (use -O0 in the makefile, if this works step up to -O1 , ..., -O3 ).

If it is the usual pthread problem then try -static for linking.

Ciao
Gerhard

====================================
Dr. Gerhard H. Fecher
Institut of Inorganic and Analytical Chemistry
Johannes Gutenberg - University
55099 Mainz
________________________________________
Von: wien-bounces at zeus.theochem.tuwien.ac.at [wien-bounces at zeus.theochem.tuwien.ac.at] im Auftrag von Hong Jiang [jiang at fhi-berlin.mpg.de]
Gesendet: Dienstag, 3. März 2009 08:54
An: A Mailing list for WIEN2k users
Betreff: Re: [Wien] Fortran 90 bug (?) causes Segmentation fault in DSTART (doreallocate)

I think the problem is caused by unintentional use of a huge temporary
array. In the code
    hilfsfeld(1:min1,1:min2)=tf(1:min1,1:min2)
when hilfsfeld and tf have different dimensions and the subarray
tf(1:min1,1:min2) is not contiguous in memory, then an additional
temporary array of min1*min2 size is required to perform this
operation.  For large cases, this requirement may fail, leading to a
Segmentation fault.
A much safer way is probably like

    do j = 1 , min2
       hilfsfeld(1:min1,j)=tf(1:min1,j)
    end do

  -Hong

Oleg Rubel wrote:
> Dear Wien2k Users and Developers,
>
> I have got a segmentation fault error in DSTART while attempting to initialize a surface structure. I use WIEN2k_08.3 (Release 18/9/2008) compiled with Intel Fortran (version 11.0) using the following options:
> FOPT     = -FR -mp1 -w -prec_div -pc80 -pad -align -DINTEL_VML -traceback
> FGEN     =
> LDFLAGS  = $(FOPT) -L/act/intel/mkl/10.1.0.015/lib/em64t -i-static
>
> The segfault takes place at 'module.f' in  'module reallocate' in line
>
>     hilfsfeld(1:min1,1:min2)=tf(1:min1,1:min2)
>
> I was able to fix the error by changing to an old fashion
>
>     integer*4 :: i, j
>     ...
>     do i = 1 , min1
>        do j = 1 , min2
>            hilfsfeld(i,j)=tf(i,j)
>        end do
>     end do
>
> for all instances 'hilfsfeld(1:min1,1:min2)=tf(1:min1,1:min2)' and 'hilfsfeld(1:min1)=tf(1:min1)' in module.f
>
> It is interesting that the error shows up only for relatively large cases. (In my case min2 = 2507459).
>
>
> Sincerely,
>
> Oleg Rubel
>
> --
> Oleg Rubel, PhD
> Thunder Bay Regional Research Institute
> 290 Munro St
> Thunder Bay, ON
> P7A  7T1, Canada
> Phone: +1-807-7663350
> E-mail: rubelo at tbh.net
> Homepage: http://www.staff.uni-marburg.de/~rubel/
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
>


--
-------------------------------------------------------------------------
 Dr Hong Jiang
 Theory Department               + Phone: ++49-30-8413 4833
 Fritz-Haber-Institut der MPG    + Fax: ++49-30-8413 4701
 Faradayweg 4-6                  + E-mail: jiang at fhi-Berlin.mpg.de
 D-14195 Berlin,German           + Homepage: w3.rz-berlin.mpg.de/~jiang

_______________________________________________
Wien mailing list
Wien at zeus.theochem.tuwien.ac.at
http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien


More information about the Wien mailing list