File: decomp.h

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,764 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,825; lisp: 1,106; xml: 1,049; makefile: 579; lex: 557
file content (59 lines) | stat: -rw-r--r-- 1,761 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * decomp.h
 *
 *  Created on: Oct 2018
 *      Author: Norbert Podhorszki
 */

#ifndef DECOMP_H_
#define DECOMP_H_

#include <stddef.h> // size_t

/** Decompose M processes with N-dimensional decomposition in a Column major
 * fashion.
 * INPUT: ndim as N dimension
 *        rank as the MPI rank of the calling process
 *        decomp[] array for the number of processes in each dimension
 * OUTPUT: pos[] array describes the position of this rank in each dimension
 *
 * Requirement: pos[] must be pre-allocated to hold ndim elements
 *
 * Examples:
 * 1. 2-dim, 6 processes with 2x3 decomposition
 *     ndim = 2, decomp[]={2,3}
 *     decomposition calculated according to this table
 *                    pos[1]
 *                  0   1   2
 *                 ----------
 *     pos[0]  0 |  0   2   4
 *             1 |  1   3   5
 *
 */

void decompColumnMajor(const size_t ndim, const size_t rank, const size_t *decomp, size_t *pos);

/** Decompose M processes with N-dimensional decomposition in a Row major
 * fashion.
 * INPUT: ndim as N dimension
 *        rank as the MPI rank of the calling process
 *        decomp[] array for the number of processes in each dimension
 * OUTPUT: pos[] array describes the position of this rank in each dimension
 *
 * Requirement: pos[] must be pre-allocated to hold ndim elements
 *
 * Examples:
 * 1. 2-dim, 6 processes with 2x3 decomposition
 *     ndim = 2, decomp[]={2,3}
 *     decomposition calculated according to this table
 *                    pos[1]
 *                  0   1   2
 *                 ----------
 *     pos[0]  0 |  0   1   2
 *             1 |  3   4   5
 *
 */

void decompRowMajor(const size_t ndim, const size_t rank, const size_t *decomp, size_t *pos);

#endif /* DECOMP_H */