Skip to content

Commit

Permalink
Add --uplo command line parameter, use lower by default in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
abouteiller committed Dec 9, 2024
1 parent be3971e commit 397c47b
Show file tree
Hide file tree
Showing 27 changed files with 134 additions and 132 deletions.
21 changes: 18 additions & 3 deletions tests/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ char *PARSEC_SCHED_NAME[] = {
MPI_Datatype SYNCHRO = MPI_BYTE;
#endif /* PARSEC_HAVE_MPI */

const int side[2] = { dplasmaLeft, dplasmaRight };
const int uplo[2] = { dplasmaUpper, dplasmaLower };
const int diag[2] = { dplasmaNonUnit, dplasmaUnit };
const int sides[2] = { dplasmaLeft, dplasmaRight };
const int uplos[2] = { dplasmaUpper, dplasmaLower };
const int diags[2] = { dplasmaNonUnit, dplasmaUnit };
const int trans[3] = { dplasmaNoTrans, dplasmaTrans, dplasmaConjTrans };
const int norms[4] = { dplasmaMaxNorm, dplasmaOneNorm, dplasmaInfNorm, dplasmaFrobeniusNorm };

Expand Down Expand Up @@ -97,6 +97,7 @@ void print_usage(void)
" -s --SMB --kp : repetitions in the process grid row cyclicity (formerly supertiles) (default: 1)\n"
" -S --SNB --kq : repetitions in the process grid column cyclicity (formerly supertiles) (default: 1)\n"
" -z --HNB --HMB : Inner NB/MB used for recursive algorithms (default: MB)\n"
" -u --uplo : upper/lower triangular matrix (when applicable)\n"
" -x --check : verify the results\n"
" -X --check_inv : verify the results against the inverse\n"
" -b --sync : call the step by step version of the algorithm if exists\n"
Expand Down Expand Up @@ -219,6 +220,8 @@ static struct option long_options[] =
{"kq", required_argument, 0, 'S'},
{"SNB", required_argument, 0, 'S'},
{"S", required_argument, 0, 'S'},
{"uplo", required_argument, 0, 'u'},
{"u", required_argument, 0, 'u'},
{"check", no_argument, 0, 'x'},
{"x", no_argument, 0, 'x'},
{"check_inv", no_argument, 0, 'X'},
Expand Down Expand Up @@ -342,6 +345,17 @@ static void read_arguments(int *_argc, char*** _argv, int* iparam)
case 'T': iparam[IPARAM_NB] = atoi(optarg); break;
case 's': iparam[IPARAM_KP] = atoi(optarg); break;
case 'S': iparam[IPARAM_KQ] = atoi(optarg); break;
case 'u':
if('u' == optarg[0] || 'U' == optarg[0]) {
iparam[IPARAM_UPLO] = dplasmaUpper;
break;
}
if('l' == optarg[0] || 'L' == optarg[0]) {
iparam[IPARAM_UPLO] = dplasmaLower;
break;
}
fprintf(stderr, "#!!!!! malformed uplo value %s (accepted: u, U, l, L). Value ignored!\n", optarg);
break;

case 'X': iparam[IPARAM_CHECKINV] = 1;
/* Fall through */
Expand Down Expand Up @@ -598,6 +612,7 @@ void iparam_default_facto(int* iparam)
iparam[IPARAM_LDA] = -'m';
iparam[IPARAM_LDB] = 0;
iparam[IPARAM_LDC] = 0;
iparam[IPARAM_UPLO] = dplasmaLower;
}

void iparam_default_solve(int* iparam)
Expand Down
11 changes: 7 additions & 4 deletions tests/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ enum iparam_t {
IPARAM_KP, /* Number of rows repetititions in a k-cyclic distribution */
IPARAM_HMB, /* Small MB for recursive hdags */
IPARAM_HNB, /* Small NB for recursive hdags */
IPARAM_UPLO, /* Upper/Lower triangular */
IPARAM_CHECK, /* Checking activated or not */
IPARAM_CHECKINV, /* Inverse Checking activated or not */
IPARAM_ASYNC, /* Bench the asynchronous version */
Expand Down Expand Up @@ -119,6 +120,7 @@ void iparam_default_ibnbmb(int* iparam, int ib, int nb, int mb);
int MT = (M%MB==0) ? (M/MB) : (M/MB+1); \
int NT = (N%NB==0) ? (N/NB) : (N/NB+1); \
int KT = (K%MB==0) ? (K/MB) : (K/MB+1); \
int uplo = iparam[IPARAM_UPLO]; \
int check = iparam[IPARAM_CHECK]; \
int check_inv = iparam[IPARAM_CHECKINV]; \
int loud = iparam[IPARAM_VERBOSE]; \
Expand All @@ -130,7 +132,7 @@ void iparam_default_ibnbmb(int* iparam, int ib, int nb, int mb);
(void)rank;(void)nodes;(void)cores;(void)gpus;(void)P;(void)Q;(void)M;(void)N;(void)K;(void)NRHS; \
(void)LDA;(void)LDB;(void)LDC;(void)IB;(void)MB;(void)NB;(void)MT;(void)NT;(void)KT; \
(void)KP;(void)KQ;(void)IP;(void)JQ;(void)HMB;(void)HNB;(void)check;(void)loud;(void)async; \
(void)scheduler;(void)butterfly_level;(void)check_inv;(void)random_seed;(void)matrix_init;(void)nruns;
(void)scheduler;(void)butterfly_level;(void)uplo;(void)check_inv;(void)random_seed;(void)matrix_init;(void)nruns;

/* Define a double type which not pass through the precision generation process */
typedef double DagDouble_t;
Expand All @@ -153,9 +155,9 @@ typedef double DagDouble_t;
extern MPI_Datatype SYNCHRO;
#endif /* PARSEC_HAVE_MPI */

extern const int side[2];
extern const int uplo[2];
extern const int diag[2];
extern const int sides[2];
extern const int uplos[2];
extern const int diags[2];
extern const int trans[3];
extern const int norms[4];
extern const char *sidestr[2];
Expand Down Expand Up @@ -219,6 +221,7 @@ static inline int min(int a, int b) { return a < b ? a : b; }
PROFILING_SAVE_iINFO("PARAM_KP", iparam[IPARAM_KQ]); \
PROFILING_SAVE_iINFO("PARAM_KQ", iparam[IPARAM_KP]); \
PROFILING_SAVE_iINFO("PARAM_HNB", iparam[IPARAM_HNB]); \
PROFILING_SAVE_iINFO("PARAM_UPLO", iparam[IPARAM_UPLO]); \
PROFILING_SAVE_iINFO("PARAM_CHECK", iparam[IPARAM_CHECK]); \
PROFILING_SAVE_iINFO("PARAM_CHECKINV", iparam[IPARAM_CHECKINV]); \
PROFILING_SAVE_iINFO("PARAM_VERBOSE", iparam[IPARAM_VERBOSE]); \
Expand Down
6 changes: 3 additions & 3 deletions tests/testing_zgeadd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 The University of Tennessee and The University
* Copyright (c) 2009-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
Expand Down Expand Up @@ -104,7 +104,7 @@ int main(int argc, char ** argv)

/* Create GEMM PaRSEC */
if(loud) printf("Compute ... ... ");
dplasma_ztradd(parsec, uplo[u], trans[tA],
dplasma_ztradd(parsec, uplos[u], trans[tA],
(dplasma_complex64_t)alpha,
(parsec_tiled_matrix_t *)&dcA,
(dplasma_complex64_t)beta,
Expand All @@ -113,7 +113,7 @@ int main(int argc, char ** argv)

/* Check the solution */
info_solution = check_tr_solution( parsec, (rank == 0) ? loud : 0,
uplo[u], trans[tA],
uplos[u], trans[tA],
alpha, Am, An,
(parsec_tiled_matrix_t *)&dcA,
beta, M, N,
Expand Down
3 changes: 1 addition & 2 deletions tests/testing_zhebut.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 The University of Tennessee and The University
* Copyright (c) 2009-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
Expand Down Expand Up @@ -29,7 +29,6 @@ int main(int argc, char ** argv)
parsec_context_t* parsec;
int iparam[IPARAM_SIZEOF];
int ret = 0;
dplasma_enum_t uplo = dplasmaLower;
dplasma_complex64_t *U_but_vec;
DagDouble_t time_butterfly, time_facto, time_total;

Expand Down
3 changes: 1 addition & 2 deletions tests/testing_zheev.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2023 The University of Tennessee and The University
* Copyright (c) 2011-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
Expand Down Expand Up @@ -27,7 +27,6 @@ int main(int argc, char *argv[])
{
parsec_context_t* parsec;
int iparam[IPARAM_SIZEOF];
dplasma_enum_t uplo = dplasmaLower;
int j;
int rc;

Expand Down
13 changes: 6 additions & 7 deletions tests/testing_zhemm.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 The University of Tennessee and The University
* Copyright (c) 2009-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
Expand Down Expand Up @@ -65,7 +65,6 @@ int main(int argc, char ** argv)
if(!check)
{
dplasma_enum_t side = dplasmaLeft;
dplasma_enum_t uplo = dplasmaLower;
int Am = ( side == dplasmaLeft ? M : N );
LDA = max(LDA, Am);

Expand Down Expand Up @@ -103,33 +102,33 @@ int main(int argc, char ** argv)

for (s=0; s<2; s++) {
/* initializing matrix structure */
int Am = ( side[s] == dplasmaLeft ? M : N );
int Am = ( sides[s] == dplasmaLeft ? M : N );
LDA = max(LDA, Am);

for (u=0; u<2; u++) {

PASTE_CODE_ALLOCATE_MATRIX(dcA, 1,
parsec_matrix_sym_block_cyclic, (&dcA, PARSEC_MATRIX_COMPLEX_DOUBLE,
rank, MB, NB, LDA, Am, 0, 0,
Am, Am, P, nodes/P, uplo[u]));
Am, Am, P, nodes/P, uplos[u]));

if (loud > 2) printf("Generate matrices ... ");
dplasma_zplghe( parsec, 0., uplo[u], (parsec_tiled_matrix_t *)&dcA, Aseed);
dplasma_zplghe( parsec, 0., uplos[u], (parsec_tiled_matrix_t *)&dcA, Aseed);
dplasma_zlacpy( parsec, dplasmaUpperLower,
(parsec_tiled_matrix_t *)&dcC2, (parsec_tiled_matrix_t *)&dcC );
if (loud > 2) printf("Done\n");

/* Compute */
if (loud > 2) printf("Compute ... ... ");
dplasma_zhemm(parsec, side[s], uplo[u],
dplasma_zhemm(parsec, sides[s], uplos[u],
alpha, (parsec_tiled_matrix_t *)&dcA,
(parsec_tiled_matrix_t *)&dcB,
beta, (parsec_tiled_matrix_t *)&dcC);
if (loud > 2) printf("Done\n");

/* Check the solution */
info_solution = check_solution(parsec, rank == 0 ? loud : 0,
side[s], uplo[u],
sides[s], uplos[u],
alpha, Am, Am, Aseed,
beta, M, N, Bseed, Cseed,
&dcC);
Expand Down
11 changes: 5 additions & 6 deletions tests/testing_zher2k.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 The University of Tennessee and The University
* Copyright (c) 2009-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
Expand Down Expand Up @@ -42,7 +42,6 @@ int main(int argc, char ** argv)

if(!check)
{
dplasma_enum_t uplo = dplasmaLower;
dplasma_enum_t trans = dplasmaNoTrans;
int Am, An;

Expand Down Expand Up @@ -102,7 +101,7 @@ int main(int argc, char ** argv)
PASTE_CODE_ALLOCATE_MATRIX(dcC, 1,
parsec_matrix_sym_block_cyclic, (&dcC, PARSEC_MATRIX_COMPLEX_DOUBLE,
rank, MB, NB, LDC, N, 0, 0,
N, N, P, nodes/P, uplo[u]));
N, N, P, nodes/P, uplos[u]));

for (t=0; t<2; t++) {
#if defined(PRECISION_z) || defined(PRECISION_c)
Expand All @@ -126,20 +125,20 @@ int main(int argc, char ** argv)
if (loud > 2) printf("Generate matrices ... ");
dplasma_zplrnt( parsec, 0, (parsec_tiled_matrix_t *)&dcA, Aseed);
dplasma_zplrnt( parsec, 0, (parsec_tiled_matrix_t *)&dcB, Bseed);
dplasma_zplghe( parsec, 0., uplo[u], (parsec_tiled_matrix_t *)&dcC, Cseed);
dplasma_zplghe( parsec, 0., uplos[u], (parsec_tiled_matrix_t *)&dcC, Cseed);
if (loud > 2) printf("Done\n");

/* Compute */
if (loud > 2) printf("Compute ... ... ");
dplasma_zher2k(parsec, uplo[u], trans[t],
dplasma_zher2k(parsec, uplos[u], trans[t],
alpha, (parsec_tiled_matrix_t *)&dcA,
(parsec_tiled_matrix_t *)&dcB,
beta, (parsec_tiled_matrix_t *)&dcC);
if (loud > 2) printf("Done\n");

/* Check the solution */
info_solution = check_solution(parsec, rank == 0 ? loud : 0,
uplo[u], trans[t],
uplos[u], trans[t],
alpha, Am, An, Aseed, Bseed,
beta, N, N, Cseed,
&dcC);
Expand Down
11 changes: 5 additions & 6 deletions tests/testing_zherk.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 The University of Tennessee and The University
* Copyright (c) 2009-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
Expand Down Expand Up @@ -41,7 +41,6 @@ int main(int argc, char ** argv)

if(!check)
{
dplasma_enum_t uplo = dplasmaLower;
dplasma_enum_t trans = dplasmaNoTrans;
int Am = ( trans == dplasmaNoTrans ? N : K );
int An = ( trans == dplasmaNoTrans ? K : N );
Expand Down Expand Up @@ -99,7 +98,7 @@ int main(int argc, char ** argv)
PASTE_CODE_ALLOCATE_MATRIX(dcC, 1,
parsec_matrix_sym_block_cyclic, (&dcC, PARSEC_MATRIX_COMPLEX_DOUBLE,
rank, MB, NB, LDC, N, 0, 0,
N, N, P, nodes/P, uplo[u]));
N, N, P, nodes/P, uplos[u]));

for (t=0; t<2; t++) {
#if defined(PRECISION_z) || defined(PRECISION_c)
Expand All @@ -117,20 +116,20 @@ int main(int argc, char ** argv)

if (loud > 2) printf("Generate matrices ... ");
dplasma_zplrnt( parsec, 0, (parsec_tiled_matrix_t *)&dcA, Aseed);
dplasma_zlacpy( parsec, uplo[u],
dplasma_zlacpy( parsec, uplos[u],
(parsec_tiled_matrix_t *)&dcC2, (parsec_tiled_matrix_t *)&dcC );
if (loud > 2) printf("Done\n");

/* Compute */
if (loud > 2) printf("Compute ... ... ");
dplasma_zherk(parsec, uplo[u], trans[t],
dplasma_zherk(parsec, uplos[u], trans[t],
alpha, (parsec_tiled_matrix_t *)&dcA,
beta, (parsec_tiled_matrix_t *)&dcC);
if (loud > 2) printf("Done\n");

/* Check the solution */
info_solution = check_solution(parsec, rank == 0 ? loud : 0,
uplo[u], trans[t],
uplos[u], trans[t],
alpha, Am, An, Aseed,
beta, N, N, Cseed,
&dcC);
Expand Down
16 changes: 8 additions & 8 deletions tests/testing_zlange.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 The University of Tennessee and The University
* Copyright (c) 2009-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
Expand Down Expand Up @@ -145,7 +145,7 @@ int main(int argc, char ** argv)
printf("***************************************************\n");
}
if(loud > 2) printf("+++ Computing norm %s ... ", normsstr[i]);
normdag = dplasma_zlantr(parsec, norms[i], uplo[u], diag[d],
normdag = dplasma_zlantr(parsec, norms[i], uplos[u], diags[d],
(parsec_tiled_matrix_t *)&dcA);

if ( rank == 0 ) {
Expand Down Expand Up @@ -220,16 +220,16 @@ int main(int argc, char ** argv)
PASTE_CODE_ALLOCATE_MATRIX(dcA, 1,
parsec_matrix_sym_block_cyclic, (&dcA, PARSEC_MATRIX_COMPLEX_DOUBLE,
rank, MB, NB, LDA, N, 0, 0,
M, N, P, nodes/P, uplo[u]));
M, N, P, nodes/P, uplos[u]));

dplasma_zplgsy( parsec, 0., uplo[u], (parsec_tiled_matrix_t *)&dcA, 3872);
dplasma_zplgsy( parsec, 0., uplos[u], (parsec_tiled_matrix_t *)&dcA, 3872);

for(i=0; i<4; i++) {
if ( rank == 0 ) {
printf("***************************************************\n");
}
if(loud > 2) printf("+++ Computing norm %s ... ", normsstr[i]);
normdag = dplasma_zlansy(parsec, norms[i], uplo[u],
normdag = dplasma_zlansy(parsec, norms[i], uplos[u],
(parsec_tiled_matrix_t *)&dcA);

if ( rank == 0 ) {
Expand Down Expand Up @@ -300,16 +300,16 @@ int main(int argc, char ** argv)
PASTE_CODE_ALLOCATE_MATRIX(dcA, 1,
parsec_matrix_sym_block_cyclic, (&dcA, PARSEC_MATRIX_COMPLEX_DOUBLE,
rank, MB, NB, LDA, N, 0, 0,
M, N, P, nodes/P, uplo[u]));
M, N, P, nodes/P, uplos[u]));

dplasma_zplghe( parsec, 0., uplo[u], (parsec_tiled_matrix_t *)&dcA, 3872);
dplasma_zplghe( parsec, 0., uplos[u], (parsec_tiled_matrix_t *)&dcA, 3872);

for(i=0; i<4; i++) {
if ( rank == 0 ) {
printf("***************************************************\n");
}
if(loud > 2) printf("+++ Computing norm %s ... ", normsstr[i]);
normdag = dplasma_zlanhe(parsec, norms[i], uplo[u],
normdag = dplasma_zlanhe(parsec, norms[i], uplos[u],
(parsec_tiled_matrix_t *)&dcA);

if ( rank == 0 ) {
Expand Down
1 change: 0 additions & 1 deletion tests/testing_zpoinv.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ int main(int argc, char ** argv)
{
parsec_context_t* parsec;
int iparam[IPARAM_SIZEOF];
dplasma_enum_t uplo = dplasmaLower;
int info = 0;
int ret = 0;

Expand Down
Loading

0 comments on commit 397c47b

Please sign in to comment.