SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ BI_GetMpiTrType()

MPI_Datatype BI_GetMpiTrType ( BLACSCONTEXT ctxt,
char  uplo,
char  diag,
Int  m,
Int  n,
Int  lda,
MPI_Datatype  Dtype,
Int N 
)

Definition at line 3 of file BI_GetMpiTrType.c.

6{
8 MPI_Datatype TrType;
9 Int info, start, i, k;
10 MpiInt *len, *disp;
11 BLACBUFF *bp;
12
13 if (diag == 'u') start = 1;
14 else start = 0;
15
16/*
17 * Some versions of mpich and its derivitives cannot handle 0 byte typedefs,
18 * so we set type MPI_BYTE as a flag for a 0 byte message
19 */
20#ifdef ZeroByteTypeBug
21 if (m > n) i = n * (m-n) + (n*n) - (n*n)/2 + n/2 - n*start;
22 else i = m * (n-m) + (m*m) - (m*m)/2 + m/2 - m*start;
23 if (i < 1)
24 {
25 *N = 0;
26 return (MPI_BYTE);
27 }
28#endif
29 *N = 1;
30
31/*
32 * Get space to hold the length and displacement values
33 */
34 bp = BI_GetBuff( 2 * n * sizeof(MpiInt) );
35 len = (MpiInt *) bp->Buff;
36 disp = (MpiInt *) &bp->Buff[n*sizeof(MpiInt)];
37
38 if (m > n)
39 {
40 if (uplo == 'u')
41 {
42 k = m - n + 1 - start;
43 for (i=0; i < n; i++)
44 {
45 len[i] = k + i;
46 disp[i] = i*lda;
47 }
48 }
49 else /* uplo = 'l' and m > n */
50 {
51 k = m - start;
52 lda++;
53 len[0] = k;
54 disp[0] = start;
55 for (i=1; i < n; i++)
56 {
57 len[i] = k - i;
58 disp[i] = disp[i-1] + lda;
59 }
60 }
61 }
62 else /* m <= n */
63 {
64 if (uplo == 'u')
65 {
66 k = 1 - start;
67 for (i=0; i < m; i++)
68 {
69 len[i] = i + k;
70 disp[i] = i*lda;
71 }
72 for (; i < n; i++)
73 {
74 len[i] = m;
75 disp[i] = i*lda;
76 }
77 }
78 else /* uplo = 'l' and m <= n */
79 {
80 k = n - m;
81 for (i=0; i < k; i++)
82 {
83 len[i] = m;
84 disp[i] = i*lda;
85 }
86 if (i < n)
87 {
88 k = n - start;
89 len[i] = k - i;
90 disp[i] = i*lda + start;
91 lda++;
92 for (i++; i < n; i++)
93 {
94 len[i] = k - i;
95 disp[i] = disp[i-1] + lda;
96 }
97 }
98 }
99 }
100#ifdef T3ETrError
101/*
102 * Get rid of 0-length segments to keep T3E happy
103 */
104 for (i=0; i < n; i++)
105 {
106 if (len[i] == 0)
107 {
108 for (k=i+1; k < n; k++)
109 {
110 len[k-1] = len[k];
111 disp[k-1] = disp[k];
112 }
113 if (n > 0) n--;
114 i--; /* check new entry for 0-byte */
115 }
116 }
117#endif
118
119 i=MPI_Type_indexed(n, len, disp, Dtype, &TrType);
120 i=MPI_Type_commit(&TrType);
121 return(TrType);
122}
BLACBUFF * BI_GetBuff(Int length)
Definition BI_GetBuff.c:37
#define Int
Definition Bconfig.h:22
#define MpiInt
Definition Bconfig.h:25
char * Buff
Definition Bdef.h:56
Here is the call graph for this function:
Here is the caller graph for this function: