OpenRadioss
2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
BI_GetMpiTrType.c
Go to the documentation of this file.
1
#include "
Bdef.h
"
2
3
MPI_Datatype
BI_GetMpiTrType
(
BLACSCONTEXT
*ctxt,
char
uplo,
char
diag,
4
Int
m,
Int
n
,
Int
lda, MPI_Datatype Dtype,
5
Int
*
N
)
6
{
7
BLACBUFF
*
BI_GetBuff
(
Int
);
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
}
BI_GetBuff
BLACBUFF * BI_GetBuff(Int length)
Definition
BI_GetBuff.c:37
BI_GetMpiTrType
MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *ctxt, char uplo, char diag, Int m, Int n, Int lda, MPI_Datatype Dtype, Int *N)
Definition
BI_GetMpiTrType.c:3
Int
#define Int
Definition
Bconfig.h:22
MpiInt
#define MpiInt
Definition
Bconfig.h:25
Bdef.h
BLACBUFF
struct bLaCbUfF BLACBUFF
Definition
Bdef.h:53
BLACSCONTEXT
struct bLaCsCoNtExT BLACSCONTEXT
Definition
Bdef.h:22
N
#define N
Definition
example_user.c:10
disp
if(norm(mat *id.SOL - id.RHS, 'inf') > sqrt(eps)) disp('WARNING els disp)('SOLUTION OK')
Definition
multiplerhs_example.m:18
n
n
Definition
schur_example.m:9
bLaCbUfF::Buff
char * Buff
Definition
Bdef.h:56
engine
extlib
scalapack-2.2.0
BLACS
SRC
BI_GetMpiTrType.c
Generated by
1.15.0