ValeevGroup / tiledarray

A massively-parallel, block-sparse tensor framework written in C++
GNU General Public License v3.0
254 stars 52 forks source link

col-major tile support #35

Open evaleev opened 8 years ago

evaleev commented 8 years ago

need to use col-major tiles, e.g. BTAS::Tensor with col-major storage. This will allow also direct interoperation with ScaLAPACK.

justusc commented 8 years ago

Are you suggesting changing the Tensor to be column major, or an optional parameter (i.e. support both)?

Is the Tile interface wrapper sufficient for this?

evaleev commented 8 years ago

the Tile interface should be sufficient for everything, of course. To get Fortran people and others ideally we need native support (i.e. from TA). Adding this to Tensor is one way. This is a good opportunity to add more BTAS design elements that we need (e.g. Tensor parametrization by index type to support optimal operation for fixed-order data, etc.).

justusc commented 8 years ago

I think this is a reasonable change. This option was in the original TA design. However, I removed it several years ago. The major motivations for the removal were:

  1. Only the row-major ordering was used and and tested.
  2. I wanted to avoid the extra work of implementing two algorithms for a number of classes that iterated over tensor data.
  3. It slowed progress in the early days of development when we did not fully understand what the eventual code design would be.

With the current stability of the code, I think it would be reasonable to add this feature. Most of the logic of data layout is restricted to range and tensor classes. However, this change still encompasses a large amount of code, and therefore will not be a trivial change.

In the future, I plan to finish cleanup of the tensor and range code (likely as a standalone library).

evaleev commented 8 years ago

this issue is related to the design of the generic tensor class for Tile. TWG spec (as implemented in btas::Tensor) is a reasonable start here, at least for design. It was designed to support more general operations than we targeted in TA and be much more composable. E.g. btas::Range already supports the col-major ordering, static rank (this allows to avoid extra mallocs for example), negative index values, etc. btas::Tensor supports runtime and compile-time const propagation, etc. Most of these are unimportant for TiledArray, but a generic tensor library needs these abilities.

The problem with btas is the lack of efficiency in most operations except where the operation maps to BLAS. This can be fixed.

P.S. I made some changes to Tile to permit working with btas::Tensor in the process of moving to Parsec-enabled GPU backend, being able to use custom storage type is essential, I don't see an easy way to do this with TA::Tensor only unless I have CPU only and GPU only Tensors (but this replicated ranges, etc.)

justusc commented 8 years ago

Part of the changes I plan to incorporate include more BTAS like features. Ideally, I would like TA to be an optimized BTAS implementation. Of course TA has its own design constraints that may or may not be compatible with BTAS, and vise versa. We will see how much of BTAS can be incorporated.

evaleev commented 6 years ago

btas tile support added in 0.7.0 should be sufficient. TODO: add tests for col-major btas tiles