Skip to content

Commit 35b093d

Browse files
authored
Merge pull request #181 from thelfer/179-mgis-function-a-coalescent-memory-access-function
179 mgis function a coalescent memory access function
2 parents d120368 + 5b0df51 commit 35b093d

47 files changed

Lines changed: 1154 additions & 357 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/web/functions.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ Multi-component values can be stored:
197197
+-----------++-----------++---------++-----------+------+-----------++-----------++---------++-----------+
198198
~~~~
199199

200+
Non interleaved storage allows coalescent memory accesses, which may be
201+
beneficial on some architectures, including GPUs.
202+
200203
In a element-major pattern, values usually are stored as follows:
201204

202205
~~~~
@@ -274,3 +277,39 @@ The `FunctionView` class has two template parameters:
274277
The `FunctionView` class matches the `FunctionEvaluator` concept (See
275278
Section @sec:mgis:function:overview and [this page](evaluators.html) for
276279
details).
280+
281+
## Tensorial functions
282+
283+
### The `TensorView` class
284+
285+
The `TensorView` class allows to make views which returns tensorial
286+
objects from functions returning data in contiguous memory.
287+
288+
A `TensorView` is generally created by combining a `FunctionView` which
289+
a modifier such as `as_stensor` (See [this page](evaluators.html) for
290+
details).
291+
292+
### The `CoalescedMemoryAccessTensorView` class
293+
294+
Coalescent memory access refers to an access pattern where each
295+
components of a function is accessed through its dedicated memory
296+
location (see the non-interleaved storage pattern described previously).
297+
298+
The `CoalescedMemoryAccessTensorView` class allows to make a tensorial
299+
function view from scalar function view on each components, as follows:
300+
301+
~~~~{.cxx}
302+
real values[8] = {1, 10, // components XX
303+
2, 20, // components YY
304+
3, 30, // components ZZ
305+
4, 40}; // components XY
306+
const auto ne = size_type { 2 };
307+
auto space = BasicLinearSpace{ne};
308+
auto c_xx = ScalarFunctionView{space, std::span{values, ne}};
309+
auto c_yy = ScalarFunctionView{space, std::span{values + ne, ne}};
310+
auto c_zz = ScalarFunctionView{space, std::span{values + 2 * ne, ne}};
311+
auto c_xy = ScalarFunctionView{space, std::span{values + 3 * ne, ne}};
312+
auto f = CoalescedMemoryAccessTensorView<BasicLinearSpace,
313+
tfel::math::stensor<2, real>>{
314+
std::array{c_xx, c_yy, c_zz, c_xy}};
315+
~~~~

include/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,6 @@ if(enable-mgis-function)
8484
mgis_header(MGIS/Function/Tensors TensorModifier.ixx)
8585
mgis_header(MGIS/Function Mechanics.hxx)
8686
mgis_header(MGIS/Function Mechanics.ixx)
87+
mgis_header(MGIS/Function CoalescedMemoryAccessFunctionViewBase.hxx)
88+
mgis_header(MGIS/Function CoalescedMemoryAccessFunctionViewBase.ixx)
8789
endif(enable-mgis-function)

include/MGIS/Function/Algorithms.hxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 23/04/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_ALGORITHMS_HXX

include/MGIS/Function/Algorithms.ixx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 29/04/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_ALGORITHMS_IXX

include/MGIS/Function/BasicLinearQuadratureSpace.hxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 01/05/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_BASICLINEARQUADRATURESPACE_HXX

include/MGIS/Function/BasicLinearSpace.ixx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 01/05/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_BASICLINEARSPACE_IXX

include/MGIS/Function/BinaryOperation.hxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 11/05/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_BINARYOPERATION_HXX

include/MGIS/Function/BinaryOperation.ixx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 11/05/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_BINARYOPERATION_IXX

include/MGIS/Function/BinaryOperationEvaluatorBase.hxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 07/05/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_BINARYOPERATIONEVALUATORBASE_HXX

include/MGIS/Function/BinaryOperationEvaluatorBase.ixx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* \brief
44
* \author Thomas Helfer
55
* \date 07/05/2025
6+
* \copyright (C) Copyright Thomas Helfer 2018.
7+
* Use, modification and distribution are subject
8+
* to one of the following licences:
9+
* - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying
10+
* file LGPL-3.0.txt)
11+
* - CECILL-C, Version 1.0 (See accompanying files
12+
* CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
613
*/
714

815
#ifndef LIB_MGIS_FUNCTION_BINARYOPERATIONEVALUATORBASE_IXX

0 commit comments

Comments
 (0)