Boost logo

Ublas :

From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2007-03-28 16:28:20


Hi Manuel,

Thanks for this contribution. I am planning to add it, but I have
problems with compiling the regression tests for the blas bindings. They
seem to be broken. I have already figured out some problems, but I think
it has been ages that these tests have been run!

Could you in the meantime add this code to you local version?

I am also interested in seeing the performance difference between
std::copy and blas::copy. I think many people on the list would be quite
interested. Thanks!

Karl

Quoting Manuel González Castro <iinmgc00_at_[hidden]>:
> Hi,
>
> my colleague Francisco is out of the office, so I will answer on
> behalf
> him:
>
> Karl Meerbergen wrote:
> > I checked the source code. The symbol copy is defined in
> > blas1_overload.hpp, but not in blas1.hpp.
> >
> > I recall that copy was not implemented because of the
> > availability of std::copy(), which should also work well.
> >
> > Do you really want to use blas::copy ?
>
> We use uBLAS as core for our multibody dynamics simulation software.
> Now
> we are comparing high-performance BLAS implementations (ATLAS,
> GotoBLAS,
> ACML, MKL) in terms of efficiency. The bindings helped us a lot: we
> can
> change the BLAS implementation transparently from uBLAS to others.
>
> The copy function is used in bottleneck code, and therefore we
> suspect
> than a fast BLAS implementation, which performs better than
> std::copy,
> can help us.
>
> Since detail::copy functions are already defined in
> blas1_overload.hpp,
> the problem can be solved by adding to blas1.hpp the following code
> for
> the "boost::numeric::bindings::blas::copy" function, it is very
> similar
> to "axpy" in the same file (line #37):
>
> ------------- start --------------
> // y <- x
> template < typename vector_type_x, typename vector_type_y >
> void copy(const vector_type_x &x, vector_type_y &y )
> {
> #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
> BOOST_STATIC_ASSERT( ( is_same< typename traits::vector_traits<
> vector_type_y >::value_type, typename traits::vector_traits<
> vector_type_x >::value_type >::value ) ) ;
> #else
> BOOST_STATIC_ASSERT( ( is_same< typename
> vector_type_y::value_type,
> typename vector_type_x::value_type >::value ) ) ;
> #endif
> assert( traits::vector_size( x ) == traits::vector_size( y ) ) ;
>
> const int n = traits::vector_size( x ) ;
> const int stride_x = traits::vector_stride( x ) ;
> const int stride_y = traits::vector_stride( y ) ;
> const value_type *x_ptr = traits::vector_storage( x ) ;
> value_type *y_ptr = traits::vector_storage( y ) ;
>
> detail::copy( n, x_ptr, stride_x, y_ptr, stride_y ) ;
> }
> ------------- end --------------
>
>
> Thanks,
> Manuel
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
>