Re: [eigen] Use Eigen as BLAS |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Use Eigen as BLAS*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Mon, 20 Feb 2017 10:32:09 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=qvKtfyEI+Un7hk+sjUDi0CccqHPlpIaY9zZWhnPzANI=; b=vapbMn0vHiqfCeofVol7iy3aT3gtqU1b7xWkbqlGMi85iifhJOUACMOK84DTpksa7V yM7VuCbykE1ble48ZdAQhWSpwBLx5bGlVcPOKX37DhXGBZulQ1BNacE4NINgqH7RMCn6 LDczi3hzOIKCkKeFI7R5MdNCqoXOFF7n0uiHhK+PLZ6UEXQOCrplW0RGggNFFi33AbAG ap28DKeEM3z9zRSn8i43gVf8deEikwWWktJgWkY5WVM9C/6/JLMg53VOi46ZlY62ErhC q+5Y6lToehR7lLfbEua6ph8DOPVOZ6tRWvKXMcDLTQwtSQAun9ONqn3vajnZg4R/tVsN neWw==

On Mon, Feb 20, 2017 at 8:33 AM, Peter <list@xxxxxxxxxxxxxxxxx> wrote:

Dear Mathieu and Gael,

Am 19.02.2017 um 11:32 schrieb Gael Guennebaud:

Yes and no. There is one BLAS API in eigen/blas, but its goal is to compile a BLAS compatible library. Converting it to a header-only lib would be a bad idea because BLAS functions are not templated, so you would end up compiling

the entire blas every time... Then if you are looking for something like:

MatrixXd A, B, C;

gemm(A,B,alpha,C,1);

I'm afraid it's a little bit more complicated, as one has to deal with the leading dimension parameter.

In addition the interface should be given by e.g.

void dgemm( const char*, const char*, const int&, const int&, const int&, const double&,

const double*, const int&, const double*, const int&, const double&, double*, const int&);

Still unclear to me. With such prototypes no arbitrary scalar type, no range checking, and everything will be compiled for every compilation unit (the order of minutes...). And as I said, this one is already available in Eigen's source /blas folder (modulo the int& versus int*).

Perhaps you want:

template<typename Scalar,typename Index>

void gemm( const char*, const char*, const Index&, const Index&, const Index&, const Scalar&,

const Scalar*, const int&, const Scalar*, const Index&, const Scalar&, Scalar*, const Index&);

const Scalar*, const int&, const Scalar*, const Index&, const Scalar&, Scalar*, const Index&);

to get custom scalar types and no huge compilation overhead, but still no range checking. This version can be easily accomplished through a slight refactoring of the code in eigen/blas.

For range checking you have to pass Eigen's object and then passing the leading dimensions become useless, which is why I suggested gemm(A,B,alpha,C,1);, but then simply use C++ Eigen's API.

I'm not sure to see the point.

In case one is the author/coauthor of a code using BLAS calls I see several good reasons

in wanting a header only BLAS version.

(1) A good starting point for switching to Eigen, e.g. benchmarking the own application, before performing a switch

for this, just builld libeigenblas.so and link to it.

gael

**References**:**[eigen] Use Eigen as BLAS***From:*Mathieu Dutour

**Re: [eigen] Use Eigen as BLAS***From:*Gael Guennebaud

**Re: [eigen] Use Eigen as BLAS***From:*Peter

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Use Eigen as BLAS** - Next by Date:
**Re: [eigen] memory error** - Previous by thread:
**Re: [eigen] Use Eigen as BLAS** - Next by thread:
**[eigen] memory error**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |