Commit f9a6f752 authored by Mathieu Faverge's avatar Mathieu Faverge

Fix the greedy in local tree, and add possibility to switch from flat to...

Fix the greedy in local tree, and add possibility to switch from flat to greedy at distributed level
parent a3a4244f
......@@ -207,7 +207,7 @@ int libhqr_init_hqr( libhqr_tree_t *qrtree,
int libhqr_init_tshqr( libhqr_tree_t *qrtree,
libhqr_facto_e trans, libhqr_matrix_t *A,
int a, int p );
libhqr_tree_e hlvl, int a, int p );
void libhqr_finalize( libhqr_tree_t *qrtree );
......
......@@ -59,7 +59,7 @@ tshqr_getm( const libhqr_tree_t *qrtree, int k, int i )
int
libhqr_initmtx_tshqr( libhqr_tree_t *qrtree,
libhqr_facto_e trans, libhqr_matrix_t *A,
int a, int p )
libhqr_tree_e hlvl, int a, int p )
{
libhqr_tile_args_t *args;
libhqr_tile_info_t *tileinfo;
......@@ -238,9 +238,6 @@ libhqr_initmtx_tshqr( libhqr_tree_t *qrtree,
continue;
}
/* Upgrade elt1 */
tileinfo[elt1->id].type = LIBHQR_KILLED_BY_DISTTREE;
while( elt2 != NULL )
{
int date = libhqr_imax( elt1->date, elt2->date ) + 1;
......@@ -265,8 +262,15 @@ libhqr_initmtx_tshqr( libhqr_tree_t *qrtree,
/* Push back elt2 to level3 for next round */
l = ( elt2->id / p ) / a;
libhqr_list_push( lists3 + i * low_mt + l, elt2 );
/* Push back elt1 */
libhqr_list_push( lists1 + i, elt1 );
elt1 = libhqr_list_pop( lists1 + i );
elt2 = libhqr_list_pop( lists1 + i );
}
/* Upgrade last element */
tileinfo[elt1->id].type = LIBHQR_KILLED_BY_DISTTREE;
libhqr_list_push( lists0, elt1 );
}
......@@ -304,6 +308,11 @@ libhqr_initmtx_tshqr( libhqr_tree_t *qrtree,
i = elt2->id % p;
l = ( elt2->id / p ) / a;
libhqr_list_push( lists3 + i * low_mt + l, elt2 );
if ( hlvl != LIBHQR_FLAT_TREE ) {
libhqr_list_push( lists0, elt1 );
elt1 = libhqr_list_pop( lists0 );
}
elt2 = libhqr_list_pop( lists0 );
}
......@@ -352,8 +361,8 @@ libhqr_initmtx_tshqr( libhqr_tree_t *qrtree,
int
libhqr_init_tshqr( libhqr_tree_t *qrtree,
libhqr_facto_e trans, libhqr_matrix_t *A,
int a, int p )
libhqr_tree_e hlvl, int a, int p )
{
return libhqr_initmtx_tshqr( qrtree, trans, A, a, p );
return libhqr_initmtx_tshqr( qrtree, trans, A, hlvl, a, p );
}
......@@ -35,7 +35,7 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix, qr_a, qr_p );
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix, LIBHQR_FLAT_TREE, qr_a, qr_p );
if ( rc != 0 ) {
return EXIT_FAILURE;
}
......
......@@ -37,63 +37,70 @@ main(int argc, char ** argv)
/* Test many combinations */
if ( check ) {
libhqr_tree_e all_hlvl[] = { LIBHQR_FLAT_TREE, LIBHQR_GREEDY_TREE };
int all_qr_p[] = { 1, 3, 5, 7, 8 };
int all_qr_a[] = { 1, 2, 4, 7 };
int all_mt[] = { 1, 3, 4, 10, 17, 25, 128 };
int all_nt[] = { 1, 2, 5, 13, 26, 58 };
int nb_hlvl = sizeof( all_hlvl ) / sizeof( libhqr_tree_e );
int nb_qr_p = sizeof( all_qr_p ) / sizeof( int );
int nb_qr_a = sizeof( all_qr_a ) / sizeof( int );
int nb_mt = sizeof( all_mt ) / sizeof( int );
int nb_nt = sizeof( all_nt ) / sizeof( int );
int p, a, m, n;
int h, p, a, m, n;
int done, todo;
done = 0;
/* HQR */
todo = nb_mt * nb_nt * nb_qr_a * nb_qr_p;
todo = nb_mt * nb_nt * nb_qr_a * nb_qr_p * nb_hlvl;
/* qr_p */
for( p=0; p<nb_qr_p; p++) {
qr_p = all_qr_p[p];
/* hlvl */
for( h=0; h<nb_hlvl; h++) {
hlvl = all_hlvl[h];
P = qr_p;
matrix.nodes = P;
matrix.p = P;
/* qr_p */
for( p=0; p<nb_qr_p; p++) {
qr_p = all_qr_p[p];
/* qr_a */
for( a=0; a<nb_qr_a; a++) {
qr_a = all_qr_a[a];
P = qr_p;
matrix.nodes = P;
matrix.p = P;
/* MT */
for( m=0; m<nb_mt; m++) {
MT = all_mt[m];
matrix.mt = MT;
/* qr_a */
for( a=0; a<nb_qr_a; a++) {
qr_a = all_qr_a[a];
for( n=0; n<nb_nt; n++) {
NT = all_nt[n];
matrix.nt = NT;
/* MT */
for( m=0; m<nb_mt; m++) {
MT = all_mt[m];
matrix.mt = MT;
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix,
qr_a, qr_p );
for( n=0; n<nb_nt; n++) {
NT = all_nt[n];
matrix.nt = NT;
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix,
hlvl, qr_a, qr_p );
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --qr_a=%d --qr_p=%d FAILED(%d)\n",
argv[0], MT, NT, qr_a, qr_p, rc);
ret++;
if (check == 1) {
return 0;
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
}
done++;
printf("\r%6d / %6d", done, todo);
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --hlvl=%d --qr_a=%d --qr_p=%d FAILED(%d)\n",
argv[0], MT, NT, hlvl, qr_a, qr_p, rc);
ret++;
if (check == 1) {
return 0;
}
}
done++;
printf("\r%6d / %6d", done, todo);
}
}
}
}
......@@ -106,7 +113,7 @@ main(int argc, char ** argv)
matrix.nt = NT;
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix,
qr_a, qr_p );
hlvl, qr_a, qr_p );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
......@@ -114,13 +121,13 @@ main(int argc, char ** argv)
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --qr_a=%d --qr_p=%d FAILED(%d)\n",
argv[0], MT, NT, qr_a, qr_p, rc);
fprintf(stderr, "%s -M %d -N %d --hlvl=%d --qr_a=%d --qr_p=%d FAILED(%d)\n",
argv[0], MT, NT, hlvl, qr_a, qr_p, rc);
ret++;
}
else {
fprintf(stderr, "%s -M %d -N %d --qr_a=%d --qr_p=%d SUCCESS\n",
argv[0], MT, NT, qr_a, qr_p);
fprintf(stderr, "%s -M %d -N %d --hlvl=%d --qr_a=%d --qr_p=%d SUCCESS\n",
argv[0], MT, NT, hlvl, qr_a, qr_p);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment