https://github.com/lanl/matar
MATAR is a C++ software library to allow developers to easily create and use dense and sparse data representations that are also portable across disparate architectures using Kokkos.
https://github.com/lanl/matar
data-oriented kokkos performance portability
Last synced: about 2 months ago
JSON representation
MATAR is a C++ software library to allow developers to easily create and use dense and sparse data representations that are also portable across disparate architectures using Kokkos.
- Host: GitHub
- URL: https://github.com/lanl/matar
- Owner: lanl
- Created: 2021-01-20T17:29:44.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-19T15:59:09.000Z (10 months ago)
- Last Synced: 2024-12-19T16:44:41.371Z (10 months ago)
- Topics: data-oriented, kokkos, performance, portability
- Language: C++
- Homepage: https://lanl.github.io/MATAR/
- Size: 17.6 MB
- Stars: 26
- Watchers: 6
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MATAR
MATAR is a C++ library that addresses the need for simple, fast, and memory-efficient multi-dimensional data representations for dense and sparse storage that arise with numerical methods and in software applications. The data representations are designed to perform well across multiple computer architectures, including CPUs and GPUs. MATAR allows users to easily create and use intricate data representations that are also portable across disparate architectures using Kokkos. The performance aspect is achieved by forcing contiguous memory layout (or as close to contiguous as possible) for multi-dimensional and multi-size dense or sparse MATrix and ARray (hence, MATAR) types. Results show that MATAR has the capability to improve memory utilization, performance, and programmer productivity in scientific computing. This is achieved by fitting more work into the available memory, minimizing memory loads required, and by loading memory in the most efficient order.
## Examples
* [ELEMENTS](https://github.com/lanl/ELEMENTS/): MATAR is a part of the ELEMENTS Library (LANL C# C20058) and it underpins the routines implemented in ELEMENTS. MATAR is available in a stand-alone directory outside of the ELEMENTS directory because it can aid many code applications. The dense and sparse storage types in MATAR are the foundation for the ELEMENTS library, which contains mathematical functions to support a very broad range of element types including: linear, quadratic, and cubic serendipity elements in 2D and 3D; high-order spectral elements; and a linear 4D element. An unstructured high-order mesh class is available in ELEMENTS and it takes advantage of MATAR for efficient access of various mesh entities.* [Fierro](https://github.com/lanl/Fierro): The MATAR library underpins the Fierro code that is designed to simulate quasi-static solid mechanics problems and material dynamics problems.
* Simple examples are in the /example folder## Descriptions
* All Array MATAR types (e.g., CArray, ViewCArray, FArray, RaggedRightArray, etc.) start with an index of 0 and stop at an index of N-1, where N is the number of entries.
* All Matrix MATAR types (e.g., CMatrix, ViewCMatrix, FMatrix, etc.) start with an index of 1 and stop at an index of N, where N is the number of entries.
* The MATAR View types (e.g., ViewCArray, ViewCMatrix, ViewFArray, etc. ) are designed to accept a pointer to an existing 1D array and then access that 1D data as a multi-dimensional array. The MATAR View types can also be used to slice an existing View.
* The C dense storage and View types (e.g., CArray, ViewCArray, CMatrix, etc.) access the data following the C/C++ language convection of having the last index in a multi-dimensional array vary the quickest. In a 2D CArray A, the index j in A(i,j) varies first followed by the index i, so the optimal performance is achieved using the following loop ordering.
```
// Optimal use of CArray
for (i=0,i (A, 3, 3); // access as A(i,j)// create a 3D array of doubles
auto B = CArray (3,3,3); // access as B(i,j,k)// create a slice of the 3D array at index 1
auto C = ViewCArray (&B(1,0,0),3,3); // access as C(j,k)// create a 4D matrix of doubles, indices start at 1
auto D = CMatrix (10,9,8,7); // access as D(i,j,k,l)// create a 2D view of a standard array
std::array E1d;
auto E = ViewCArray (&E1d[0], 3, 3);
E(0,0) = 1; // and so on// create a ragged-right array of integers
//
// [1, 2, 3]
// [4, 5]
// [6]
// [7, 8, 9, 10]
//
size_t my_strides[4] = {3, 2, 1, 4};
RaggedRightArray ragged(my_strides, 4);
int value = 1;
for (int i=0; i<4; i++){
for (int j=0; j