octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OctDev] arpack: eigs crash with octave 3.0.5 compiled with --enabl


From: Alexander Barth
Subject: Re: [OctDev] arpack: eigs crash with octave 3.0.5 compiled with --enable-64
Date: Sun, 7 Jun 2009 11:48:04 +0200

On Fri, Jun 5, 2009 at 9:20 PM, David Bateman<address@hidden> wrote:
> Alexander Barth wrote:
>>
>> On Fri, Jun 5, 2009 at 12:20 PM, Alexander
>> Barth<address@hidden> wrote:
>>
>>>
>>> Hi all,
>>>
>>> I have compiled octave with the option enable-64 (and compiled LAPACK,
>>> BLAS and SuiteSparse to use 64-bit indexes). I would like to make the
>>> octave-forge package arpack to work with this option. As BLAS, I have
>>> compiled the Fortran ARPACK library with the option
>>> -fdefault-integer-8 (and -fPIC).
>>> I have no error during the compilation, but a simple test:
>>> eigs(eye(5,5),2) craches octaves (see backtrace below).
>>>
>>> I'm using octave 3.0.5, gcc 4.2.4 on Ubuntu 8.04 (64-bit), arpack-1.0.7.
>>>
>>> Any help or insight how to debug this problem would be greatly
>>> appreciated.
>>>
>>> Thanks
>>> Alex
>>>
>>
>>
>> I think I found the error. If one uses the -fdefault-integer-8 option,
>> also LOGICALs are 8-bytes long
>> (http://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html).
>> In eigs-base.cc, the logical parameters that are passed to ARPACK are
>> only int's. I declared a macro octave_f77_bool_type which is simply
>> octave_idx_type (which becomes 64 bit with --enable-64). If other
>> fortran compiler work differently, it would be easier to modify the
>> code.
>>
>> If people are fine with the attached patch, I can apply it to
>> octave-forge.
>>
>> Cheers,
>> Alex
>>
>
> eigs is in the octave core now that ARPACK is GPLed...
That's great news!
I take the discussion to the maintainers list then.

> Why not just use
> octave_idx_type if the fortran logical index is 8bit with --enable-64?
>

This is in the end what I did, but I declared a macro
octave_f77_bool_type defined as octave_idx_type.

The underlying assumption is that the Fortran compiler uses the same
amount of bytes for INTEGER and LOGICAL. I would prefer to "hide" this
assumption behind a macro since there might be some Fortran compilers
that handle things differently. (After all, it is quite wasteful to
allocate 8 bytes for a variable with only two states).

I looked a bit around how the different Fortran compilers handle the
size of LOGICALs. For gfortran (with and without  -fdefault-integer-8)
and ifort (with and without -i8), the size of LOGICALs will always be
the size of INTEGER. However, with pgf90, the compiler option -i8,
leaves the size of LOGICALs to 4 bytes. Only the option -i8storage
allocates 8 bytes for INTEGER and LOGICAL.

This reminds me also a bit of the assumption that size of a pointer
will always be the same as the size of an int in C. Such assumption is
the classical problem when porting a program to 64-bit CPU.

Cheers,
Alex


reply via email to

[Prev in Thread] Current Thread [Next in Thread]