blitzpp / blitz

Blitz++ Multi-Dimensional Array Library for C++
https://github.com/blitzpp/blitz/wiki
Other
407 stars 83 forks source link

Most efficient way to do tensor-dot-product #107

Closed ClmnsRck closed 5 years ago

ClmnsRck commented 5 years ago
C = sum(A(a,b,c) * B(c,d,e),c);

Is this the fastest way right now, to do a Tensor-Dot-Product(Tensor-Inner-product) in Blitz++?

citibeth commented 5 years ago

I don’t know. Blitz us more arrays not tensors. Have you considered Eigen’s tensor capabilities?

On Fri, Mar 29, 2019 at 07:26 ClmnsRck notifications@github.com wrote:

C = sum(A(a,b,c) * B(c,d,e),c);

Is this the fastest way right now, to do a Tensor-Dot-Product(Tensor-Inner-product) in Blitz++?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/107, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1cd9iJnJrLZ5LUm4vIQGUoiurKsUIQks5vbhSCgaJpZM4cSYpJ .

ClmnsRck commented 5 years ago

I am currently comparing several libraries with tensor-capabilities, such as Fastor, eigen, FTensor, blitz++ and xtensor, which is why i would like to be so fair as to use the most efficient way to do certain tasks.

EDIT: If you know of other libs, i would gladly test those to.

citibeth commented 5 years ago

Thanks I’m curious about the results!

I use blitz over Eigen for multi dim arrays for reasons other than tensor algorithms. (I’m also heavily reliant on Eigen for sparse on sparse matrix multiplication). The people at Eigen are really smart and, my guess is, hard to beat in speed.

On Fri, Mar 29, 2019 at 07:47 ClmnsRck notifications@github.com wrote:

I am currently comparing several libraries with tensor-capabilities, such as Fastor, eigen, FTensor, blitz++ and xtensor, which is why i would like to be so fair as to use the most efficient way to do certain tasks.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/107#issuecomment-478003530, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1cdzTPJPvBiG9DZgnynRBWG9hKNrVOks5vbhlygaJpZM4cSYpJ .

ClmnsRck commented 5 years ago

eigens 3D-Tensor multiplication is extremely well optimised, even to the point, that 1GB tensors times other 1GB tensors only take something aroung 5-10 seconds to complete. I'll make sure to come back to show the results once my tests are reliable enough.

citibeth commented 5 years ago

I would also try examples where youbiterate thrrough the loop explicitly

On Fri, Mar 29, 2019 at 07:54 ClmnsRck notifications@github.com wrote:

eigens 3D-Tensor multiplication is extremely well optimised, even to the point, that 1GB tensors times other 1GB tensors only take something aroung 5-10 seconds to complete. I'll make sure to come back to show the results once my tests are reliable enough.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/107#issuecomment-478005761, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1cd8h5diKdPfY298OPINZtBMz_BBLMks5vbhr8gaJpZM4cSYpJ .

ClmnsRck commented 5 years ago

So like a base case? sequentially going through every index, to see a baseline performance?

citibeth commented 5 years ago

I mean, just write it yourself as a nested loop like one would do in fortran

On Fri, Mar 29, 2019 at 08:01 ClmnsRck notifications@github.com wrote:

So like a base case? sequentially going through every index, to see a baseline performance?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/107#issuecomment-478008139, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1cdztBe6ly11DmtgMjh5qrqMFjhtW0ks5vbhyigaJpZM4cSYpJ .