21 int * M,
int * N,
int * K,
23 float * A,
int * IA,
int * JA,
int * DESCA,
24 float * B,
int * IB,
int * JB,
int * DESCB,
26 float * C,
int * IC,
int * JC,
int * DESCC )
28 void pcgemm_( TRANSA, TRANSB, M, N, K, ALPHA, A, IA, JA, DESCA,
29 B, IB, JB, DESCB, BETA, C, IC, JC, DESCC )
34 int * IA, * IB, * IC, * JA, * JB, * JC, * K, * M, * N;
35 float * ALPHA, * BETA;
39 int * DESCA, * DESCB, * DESCC;
245 char DirAB, DirBC, OpC, OpR, TrA, TrB, ctop, ctopsave, rtop,
247 int Ai, Aj, Bi, Bj, ChooseAB, ChooseBC, Ci, Cj, ForceTop, ctxt,
248 info, mycol, myrow, nb, nota, notb, npcol, nprow;
249 double ABest, ACest, BCest, tmp1, tmp2, tmp3, tmp4;
270 if( !( info = ( ( nprow == -1 ) ? -( 1001 +
CTXT_ ) : 0 ) ) )
272 if( ( !nota ) && ( TrA !=
CTRAN ) && ( TrA !=
CCOTRAN ) )
274 PB_Cwarn( ctxt, __LINE__,
"PCGEMM",
"Illegal TRANSA = %c\n", TrA );
277 else if( ( !notb ) && ( TrB !=
CTRAN ) && ( TrB !=
CCOTRAN ) )
279 PB_Cwarn( ctxt, __LINE__,
"PCGEMM",
"Illegal TRANSB = %c\n", TrB );
283 PB_Cchkmat( ctxt,
"PCGEMM",
"A", *M, 3, *K, 5, Ai, Aj, Ad, 10,
286 PB_Cchkmat( ctxt,
"PCGEMM",
"A", *K, 5, *M, 3, Ai, Aj, Ad, 10,
289 PB_Cchkmat( ctxt,
"PCGEMM",
"B", *K, 5, *N, 4, Bi, Bj, Bd, 14,
292 PB_Cchkmat( ctxt,
"PCGEMM",
"B", *N, 4, *K, 5, Bi, Bj, Bd, 14,
294 PB_Cchkmat( ctxt,
"PCGEMM",
"C", *M, 3, *N, 4, Ci, Cj, Cd, 19,
297 if( info ) {
PB_Cabort( ctxt,
"PCGEMM", info );
return; }
302 if( ( *M == 0 ) || ( *N == 0 ) ||
320 ((
char * ) C), Ci, Cj, Cd );
326 ((
char * ) C), Ci, Cj, Cd );
344 ABest = (double)(*K);
345 ACest = (double)(*M);
346 BCest = (double)(*N);
353 ABest *= ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
354 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
358 ACest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
364 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
370 ABest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
371 ( nprow == 1 ?
ZERO : tmp2 );
374 ACest *= ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
376 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
380 BCest *= ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
390 ABest *= ( npcol == 1 ?
ZERO : tmp1 ) +
391 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
395 ACest *=
CBRATIO * ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
396 ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
400 ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
401 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
407 ABest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
408 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
412 ACest *=
CBRATIO * ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
413 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
417 BCest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
421 ChooseAB = ( ( ABest <= ( 1.3 * BCest ) ) && ( ABest <= ( 1.3 * ACest ) ) );
422 ChooseBC = ( ( BCest <= ACest ) && ( ( 1.3 * BCest ) <= ABest ) );
429 ForceTop = ( ( *M > nb ) && ( *N > nb ) && ( *K > nb ) );
482 ((
char *)ALPHA), ((
char *)A), Ai, Aj, Ad, ((
char *)B), Bi,
483 Bj, Bd, ((
char *)BETA), ((
char *)C), Ci, Cj, Cd );
490 ((
char *)ALPHA), ((
char *)A), Ai, Aj, Ad, ((
char *)B), Bi,
491 Bj, Bd, ((
char *)BETA), ((
char *)C), Ci, Cj, Cd );
498 ((
char *)ALPHA), ((
char *)A), Ai, Aj, Ad, ((
char *)B), Bi,
499 Bj, Bd, ((
char *)BETA), ((
char *)C), Ci, Cj, Cd );
506 rtopsave = *
PB_Ctop( &ctxt, &OpR,
ROW, &rtopsave );