Commit a3a4244f authored by Mathieu Faverge's avatar Mathieu Faverge

Fix testing by checking returned value in init

parent 61123050
......@@ -345,7 +345,7 @@ libhqr_initmtx_tshqr( libhqr_tree_t *qrtree,
free(elts);
free(lists);
return 1;
return 0;
}
......
......@@ -25,6 +25,7 @@ main(int argc, char ** argv)
libhqr_tree_t qrtree;
libhqr_matrix_t matrix;
int iparam[IPARAM_SIZEOF];
int rc;
/* Get options */
parse_arguments( &argc, &argv, iparam );
......@@ -35,7 +36,10 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix, llvl, hlvl, qr_a, qr_p, domino, tsrr );
rc = libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix, llvl, hlvl, qr_a, qr_p, domino, tsrr );
if ( rc != 0 ) {
return EXIT_FAILURE;
}
libhqr_print_svg( &qrtree, "hqr.svg" );
libhqr_finalize( &qrtree );
......
......@@ -25,6 +25,7 @@ main(int argc, char ** argv)
libhqr_tree_t qrtree;
libhqr_matrix_t matrix;
int iparam[IPARAM_SIZEOF];
int rc;
/* Get options */
parse_arguments( &argc, &argv, iparam );
......@@ -35,7 +36,10 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
libhqr_init_sys( &qrtree, LIBHQR_QR, &matrix, P, Q );
rc = libhqr_init_sys( &qrtree, LIBHQR_QR, &matrix, P, Q );
if ( rc != 0 ) {
return EXIT_FAILURE;
}
libhqr_print_svg( &qrtree, "systolic.svg" );
libhqr_finalize( &qrtree );
......
......@@ -24,6 +24,7 @@ main(int argc, char ** argv)
libhqr_tree_t qrtree;
libhqr_matrix_t matrix;
int iparam[IPARAM_SIZEOF];
int rc;
/* Get options */
parse_arguments( &argc, &argv, iparam );
......@@ -34,7 +35,10 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
libhqr_init_tshqr( &qrtree, LIBHQR_QR, &matrix, qr_a, qr_p );
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix, qr_a, qr_p );
if ( rc != 0 ) {
return EXIT_FAILURE;
}
libhqr_print_svg( &qrtree, "tshqr.svg" );
libhqr_finalize( &qrtree );
......
......@@ -95,11 +95,12 @@ main(int argc, char ** argv)
continue;
}
libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
rc = libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --treel=%d --qr_a=%d %s FAILED(%d)\n",
......@@ -161,11 +162,13 @@ main(int argc, char ** argv)
continue;
}
libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
rc = libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --treel=%d --treeh=%d --qr_a=%d --qr_p=%d -d=%d %s FAILED(%d)\n",
......@@ -193,11 +196,13 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
rc = libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --treel=%d --treeh=%d --qr_a=%d --qr_p=%d -d=%d %s FAILED(%d)\n",
......
......@@ -29,7 +29,7 @@ main(int argc, char ** argv)
libhqr_matrix_t matrix;
int iparam[IPARAM_SIZEOF];
int k, minMN;
int k, minMN, rc;
/* Get options */
parse_arguments( &argc, &argv, iparam );
......@@ -41,8 +41,11 @@ main(int argc, char ** argv)
matrix.nt = NT;
minMN = ( NT < MT ) ? NT : MT;
libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
rc = libhqr_init_hqr( &qrtree, LIBHQR_QR, &matrix,
llvl, hlvl, qr_a, qr_p, domino, tsrr );
if ( rc != 0 ) {
return EXIT_FAILURE;
}
libhqr_print_type( &qrtree );
libhqr_print_pivot( &qrtree );
......
......@@ -100,11 +100,13 @@ main(int argc, char ** argv)
NT = all_nt[n];
matrix.nt = NT;
libhqr_init_svd( &qrtree, LIBHQR_QR, &matrix,
hlvl, qr_p, cores, qr_a );
rc = libhqr_init_svd( &qrtree, LIBHQR_QR, &matrix,
hlvl, qr_p, cores, qr_a );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --treeh=%d --qr_a=%d --qr_p=%d -c %d FAILED(%d)\n",
......@@ -130,12 +132,13 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
libhqr_init_svd( &qrtree, LIBHQR_QR, &matrix,
hlvl, qr_p, cores, qr_a );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
rc = libhqr_init_svd( &qrtree, LIBHQR_QR, &matrix,
hlvl, qr_p, cores, qr_a );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --treeh=%d --qr_a=%d --qr_p=%d -c %d FAILED(%d)\n",
argv[0], MT, NT, hlvl, qr_a, qr_p, cores, rc);
......
......@@ -74,9 +74,11 @@ main(int argc, char ** argv)
NT = all_nt[n];
matrix.nt = NT;
libhqr_init_sys( &qrtree, LIBHQR_QR, &matrix, P, Q );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
rc = libhqr_init_sys( &qrtree, LIBHQR_QR, &matrix, P, Q );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --qr_p=%d --qr_a=%d FAILED(%d)\n",
......@@ -100,11 +102,13 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
libhqr_init_sys( &qrtree, LIBHQR_QR, &matrix,
qr_p, qr_a );
rc = libhqr_init_sys( &qrtree, LIBHQR_QR, &matrix,
qr_p, qr_a );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --qr_p=%d --qr_a=%d FAILED(%d)\n",
......
......@@ -75,11 +75,13 @@ main(int argc, char ** argv)
NT = all_nt[n];
matrix.nt = NT;
libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix,
qr_a, qr_p );
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix,
qr_a, qr_p );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --qr_a=%d --qr_p=%d FAILED(%d)\n",
......@@ -103,11 +105,13 @@ main(int argc, char ** argv)
matrix.mt = MT;
matrix.nt = NT;
libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix,
qr_a, qr_p );
rc = libhqr_init_tshqr( &qrtree, LIBHQR_TSQR, &matrix,
qr_a, qr_p );
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
if ( rc == 0 ) {
rc = libhqr_check( &qrtree );
libhqr_finalize( &qrtree );
}
if (rc != 0) {
fprintf(stderr, "%s -M %d -N %d --qr_a=%d --qr_p=%d FAILED(%d)\n",
......
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