Boost logo

Ublas :

Subject: Re: [ublas] LAPACK/BLAS bindings
From: Peter Man (plwm2_at_[hidden])
Date: 2010-06-07 08:08:00


I tested the ublas_getri.cc for both row and column matrices by changing
whether the F_ROW_MAJOR macro is defined.
The same problem occurs.

I think I know what the problem is. Let me summarise what I think the
code does:

1) Calls getri_impl<...>::invoke according to whether the workspace is
given or not.
2) If workspace is not given, then code wishes to create a temporary
optimal_workspace object.
     So, inside the relevant getri_impl<...>::invoke function:
     For netlib-lapack case, this is done by passing lwork=-1 to the
relevant getri function. For the ATLAS case,
     this is done by calling the relevant getri function, where all
workspace arguments are ignored.
3) Then still inside the getri_impl<...>::invoke function, we then
create the optimal_workspace object
     (for netlib-lapack, this is correct, for the ATLAS case a
zero-sized workspace is created).
4) Then a getri_impl<...>::invoke is called which passes the newly
created workspace function as argument.
     Inside this function, all the boost static asserts and boost
asserts are called, and then finally the relevant
     getri function is called.

The problem: for the netlib-lapack, no problem. For the ATLAS case, in
step 2, the clapack getri function is called, in step 3, a zero-sized
workspace is created but
in step 4, exactly the same clapack getri would be called AGAIN, except
that the boost_assert catches that the workspace is too small
since it's zero-sized.

A quick fix i quickly implemented fixed this (for the limited tests i've
done):
  - In step 2, puts preprocessor commands (i.e. #ifndef
BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK)
      to prevent the clapack getri function being called the first time,
and sets opt_size_work = 0.
- In step 4, puts preprocessor commands about the boost_assert
relevant to checking workspace arguments.

This way, for the ATLAS case, the clapack getri is called only once, but
all the useful boost_asserts are called.

Thanks for the help.

Peter

On 07/06/2010 11:01, Thomas Klimpel wrote:
> Peter Man wrote:
>
>> Your answers make sense - how would you suggest working around
>> the getri problem?
>>
> I would first try to understand what the problems are. So my first step would be to reproduce the problems. Then I would gather some more information about what goes wrong. I would probably add the line "std::cout<< "n="<< n<< std::endl;" to the "min_size_work" method at getri.hpp:258 and the line "std::cout<< "opt_size_work="<< opt_size_work<< std::endl;" to the "invoke" method at getri.hpp:248
>
> If it should turn out that the assert is the only problem, I would deactivate it. If it should turn out to be related to column major and row major order, I would try to see where changes are required.
>
> Regards,
> Thomas
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: plwm2_at_[hidden]
>