diff --git a/compute/pzgebrd_ge2gb.c b/compute/pzgebrd_ge2gb.c index ea49d57ea15f34c33f2e8203f84fe77a05687eb8..0d27a9c089ed5b01ad96a6a755eed89c7fd21116 100644 --- a/compute/pzgebrd_ge2gb.c +++ b/compute/pzgebrd_ge2gb.c @@ -29,7 +29,6 @@ void morse_pzgebrd_ge2gb(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *D, if (A->m >= A->n){ for (k = 0; k < A->nt; k++) { - tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb; tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb; A1 = morse_desc_submatrix(A, k*A->mb, k*A->nb, A->m-k*A->mb, tempkn); @@ -47,7 +46,7 @@ void morse_pzgebrd_ge2gb(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *D, sequence, request); if (k+1 < A->nt){ - tempkn = k+1 == A->nt-1 ? A->n-(k+1)*A->nb : A->nb; + tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb; A1 = morse_desc_submatrix(A, k*A->mb, (k+1)*A->nb, tempkm, A->n-(k+1)*A->nb); A2 = morse_desc_submatrix(A, (k+1)*A->mb, (k+1)*A->nb, A->m-(k+1)*A->mb, A->n-(k+1)*A->nb); @@ -68,7 +67,6 @@ void morse_pzgebrd_ge2gb(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *D, else{ for (k = 0; k < A->mt; k++) { tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb; - tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb; A1 = morse_desc_submatrix(A, k*A->mb, k*A->nb, tempkm, A->n-k*A->nb); A2 = morse_desc_submatrix(A, (k+1)*A->mb, k*A->nb, A->m-(k+1)*A->mb, A->n-k*A->nb); @@ -84,7 +82,7 @@ void morse_pzgebrd_ge2gb(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *D, sequence, request); if (k+1 < A->mt){ - tempkm = k+1 == A->mt-1 ? A->m-(k+1)*A->mb : A->mb; + tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb; A1 = morse_desc_submatrix(A, (k+1)*A->mb, k*A->nb, A->m-(k+1)*A->mb, tempkn); A2 = morse_desc_submatrix(A, (k+1)*A->mb, (k+1)*A->nb, A->m-(k+1)*A->mb, A->n-(k+1)*A->nb); diff --git a/compute/pzgelqf_param.c b/compute/pzgelqf_param.c index c6c5ceeaa3e7a422700bfa9b4f0fc488df9990c6..5acbf7c208b896ff0919fc1a3e13653b85d73d37 100644 --- a/compute/pzgelqf_param.c +++ b/compute/pzgelqf_param.c @@ -147,7 +147,6 @@ void morse_pzgelqf_param( const libhqr_tree_t *qrtree, MORSE_desc_t *A, p = qrtree->currpiv(qrtree, k, n); tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb; - temppn = p == A->nt-1 ? A->n-p*A->nb : A->nb; if (qrtree->gettype(qrtree, k, n) == 0) { /* TS kernel */ diff --git a/compute/pztradd.c b/compute/pztradd.c index 524136171756c19c79d4238e81b7be090e6f03d4..3db356b6eecafc0bccb2e7adeee4ad8a5f762157 100644 --- a/compute/pztradd.c +++ b/compute/pztradd.c @@ -172,7 +172,6 @@ void morse_pztradd(MORSE_enum uplo, MORSE_enum trans, else { for (m = 0; m < B->mt; m++) { tempmm = m == B->mt-1 ? B->m-B->mb*m : B->nb; - ldam = BLKLDD(A, m); ldbm = BLKLDD(B, m); for (n = 0; n < B->nt; n++) { diff --git a/compute/pztrsm.c b/compute/pztrsm.c index a621ad29eddda6f1bfbe6cf45fc323dc4b4e2c4a..366d08bbccaba46cc2e4b41cb02e7c7e74abcc06 100644 --- a/compute/pztrsm.c +++ b/compute/pztrsm.c @@ -193,7 +193,6 @@ void morse_pztrsm(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_enum } RUNTIME_data_flush( sequence, A(B->mt-1-k, B->mt-1-k) ); for (m = k+1; m < B->mt; m++) { - tempmm = m == B->mt-1 ? B->m-m*B->mb : B->mb; ldbm = BLKLDD(B, B->mt-1-m); for (n = 0; n < B->nt; n++) { tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb; diff --git a/compute/pzunmqr.c b/compute/pzunmqr.c index c1897dcc1db6d8ac82d911afc274b1082f310074..d893bc3c18168d2166e3669913276d2e65bec072 100644 --- a/compute/pzunmqr.c +++ b/compute/pzunmqr.c @@ -245,7 +245,6 @@ void morse_pzunmqr(MORSE_enum side, MORSE_enum trans, tempkn = k == B->nt - 1 ? B->n - k * B->nb : B->nb; tempkmin = k == minMT - 1 ? minM - k * A->nb : A->nb; ldak = BLKLDD(A, k); - ldbk = BLKLDD(B, k); for (n = B->nt-1; n > k; n--) { tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb; ldan = BLKLDD(A, n); diff --git a/compute/pzunmqrrh.c b/compute/pzunmqrrh.c index c4d6e3e34367dad7d10634662935ac042d32e280..af3fe285681745e04fd9bafc6c7834a9444bfd10 100644 --- a/compute/pzunmqrrh.c +++ b/compute/pzunmqrrh.c @@ -330,7 +330,6 @@ void morse_pzunmqrrh( MORSE_enum side, MORSE_enum trans, tempMm = M == A->mt-1 ? A->m-M*A->mb : A->mb; tempkmin = chameleon_min(tempMm, tempkn); ldaM = BLKLDD(A, M); - ldbM = BLKLDD(B, M); for (n = chameleon_min(M+BS, A->mt)-1; n > M; n--) { ldan = BLKLDD(A, n); tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb; diff --git a/compute/zgesvd.c b/compute/zgesvd.c index 235bda79b6f0036a05d24d39bee241009bc6b78d..be88952272af125224d03b30bc4050d3e5f2be26 100644 --- a/compute/zgesvd.c +++ b/compute/zgesvd.c @@ -400,8 +400,8 @@ int MORSE_zgesvd_Tile_Async( MORSE_enum jobu, MORSE_enum jobvt, { MORSE_desc_t descA; MORSE_desc_t descT; - MORSE_desc_t descU; - MORSE_desc_t descVT; + MORSE_desc_t descUl, descUt; + MORSE_desc_t descVTl, descVTt; MORSE_desc_t descAB; MORSE_desc_t D, *Dptr = NULL; MORSE_desc_t *subA, *subT, *subUVT; @@ -555,65 +555,61 @@ int MORSE_zgesvd_Tile_Async( MORSE_enum jobu, MORSE_enum jobvt, morse_desc_mat_free( &descAB ); - /* Transform U and Vt into tile format */ - if ( jobu != MorseNoVec ) { - //morse_zooplap2tile( descU, U, NB, NB, LDU, M, 0, 0, M, M, sequence, request, morse_desc_mat_free(&(descU)) ); - } - if ( jobvt != MorseNoVec ) { - //morse_zooplap2tile( descVT, VT, NB, NB, LDVT, N, 0, 0, N, N, sequence, request, morse_desc_mat_free(&(descVT)) ); - } - - morse_sequence_wait( morse, sequence ); - subA = NULL; subT = NULL; subUVT = NULL; + if ( jobu != MorseNoVec ) { + morse_zlap2tile( morse, &descUl, &descUt, MorseDescInout, MorseUpperLower, + U, NB, NB, LDU, M, M, M, sequence, request ); + if ( M < N ){ - subA = morse_desc_submatrix(&descA, descA.mb, 0, descA.m-descA.mb, descA.n-descA.nb); - subUVT = morse_desc_submatrix(&descU, descU.mb, 0, descU.m-descU.mb, descU.n); - subT = morse_desc_submatrix(&descT, descT.mb, 0, descT.m-descT.mb, descT.n-descT.nb); + subA = morse_desc_submatrix(&descA, descA.mb, 0, descA.m -descA.mb, descA.n-descA.nb); + subUVT = morse_desc_submatrix(&descUt, descUt.mb, 0, descUt.m-descUt.mb, descUt.n); + subT = morse_desc_submatrix(&descT, descT.mb, 0, descT.m -descT.mb, descT.n-descT.nb); + morse_pzunmqr( MorseLeft, MorseNoTrans, subA, subUVT, subT, Dptr, sequence, request ); + + free(subA); free(subUVT); free(subT); } else { morse_pzunmqr( MorseLeft, MorseNoTrans, - &descA, &descU, &descT, Dptr, + &descA, &descUt, &descT, Dptr, sequence, request ); } + + morse_ztile2lap( morse, &descUl, &descUt, + MorseDescInout, MorseUpperLower, sequence, request ); } if ( jobvt != MorseNoVec ) { + morse_zlap2tile( morse, &descVTl, &descVTt, MorseDescInout, MorseUpperLower, + VT, NB, NB, LDVT, N, N, N, sequence, request ); + if ( M < N ){ morse_pzunmlq( MorseRight, MorseNoTrans, - &descA, &descVT, &descT, Dptr, + &descA, &descVTt, &descT, Dptr, sequence, request ); } else { - subA = morse_desc_submatrix(&descA, 0, descA.nb, descA.m-descA.mb, descA.n -descA.nb); - subUVT = morse_desc_submatrix(&descVT, 0, descVT.nb, descVT.m, descVT.n-descVT.nb); - subT = morse_desc_submatrix(&descT, 0, descT.nb, descT.m-descT.mb, descT.n -descT.nb); + subA = morse_desc_submatrix(&descA, 0, descA.nb, descA.m-descA.mb, descA.n -descA.nb ); + subUVT = morse_desc_submatrix(&descVTt, 0, descVTt.nb, descVTt.m, descVTt.n-descVTt.nb); + subT = morse_desc_submatrix(&descT, 0, descT.nb, descT.m-descT.mb, descT.n -descT.nb ); + morse_pzunmlq( MorseRight, MorseNoTrans, subA, subUVT, subT, Dptr, sequence, request ); + + free(subA); free(subUVT); free(subT); } - } - /* Transform U and VT into lapack layout */ - if ( jobu != MorseNoVec ) { - //morse_zooptile2lap( descU, U, NB, NB, LDU, M, sequence, request ); - } - if ( jobvt != MorseNoVec ) { - //morse_zooptile2lap( descVT, VT, NB, NB, LDVT, N, sequence, request ); + morse_ztile2lap( morse, &descVTl, &descVTt, + MorseDescInout, MorseUpperLower, sequence, request ); } - morse_sequence_wait( morse, sequence ); - if (subA) { - free(subA); free(subUVT); free(subT); - } - /* Solve the bidiagonal SVD problem */ /* On exit, U and VT are updated with bidiagonal matrix singular vectors */ #if !defined(CHAMELEON_SIMULATION) @@ -626,12 +622,6 @@ int MORSE_zgesvd_Tile_Async( MORSE_enum jobu, MORSE_enum jobvt, } #endif /* !defined(CHAMELEON_SIMULATION) */ - if (jobu != MorseNoVec) { - morse_desc_mat_free( &descU ); - } - if (jobvt != MorseNoVec) { - morse_desc_mat_free( &descVT ); - } free(E); if ( Dptr ) { morse_desc_mat_free( Dptr ); diff --git a/compute/zlange.c b/compute/zlange.c index e0d4658470dc43728270a453372c2fd164a362ce..a7b6ffaf38a4b9dff46aadac6d2b4d8409797154 100644 --- a/compute/zlange.c +++ b/compute/zlange.c @@ -83,7 +83,7 @@ double MORSE_zlange(MORSE_enum norm, int M, int N, { int NB; int status; - double value; + double value = -1.; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -125,7 +125,7 @@ double MORSE_zlange(MORSE_enum norm, int M, int N, } /* Set NT */ - NB = MORSE_NB; + NB = MORSE_NB; morse_sequence_create( morse, &sequence ); @@ -194,7 +194,7 @@ double MORSE_zlange_Tile(MORSE_enum norm, MORSE_desc_t *A ) MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; int status; - double value; + double value = -1.; morse = morse_context_self(); if (morse == NULL) { diff --git a/compute/zlanhe.c b/compute/zlanhe.c index 20d6d2873527213c6d8575ca435151edfdf77460..fb2e7f300990bc7ff424e86793e6f46a76a787f0 100644 --- a/compute/zlanhe.c +++ b/compute/zlanhe.c @@ -83,7 +83,7 @@ double MORSE_zlanhe(MORSE_enum norm, MORSE_enum uplo, int N, { int NB; int status; - double value; + double value = -1.; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -198,7 +198,7 @@ double MORSE_zlanhe_Tile( MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A ) MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; int status; - double value; + double value = -1.; morse = morse_context_self(); if (morse == NULL) { diff --git a/compute/zlansy.c b/compute/zlansy.c index 10a2d3557283c1815585184480852bf62eb41d6c..673532d77d95d763a18d34b8279907da0581c936 100644 --- a/compute/zlansy.c +++ b/compute/zlansy.c @@ -83,7 +83,7 @@ double MORSE_zlansy(MORSE_enum norm, MORSE_enum uplo, int N, { int NB; int status; - double value; + double value = -1.; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -198,7 +198,7 @@ double MORSE_zlansy_Tile( MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A ) MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; int status; - double value; + double value = -1.; morse = morse_context_self(); if (morse == NULL) { diff --git a/compute/zlantr.c b/compute/zlantr.c index 42127a8b32fa5e669e886a61c1158906d9188b1e..224faca65f8f75400e08ad786be2d77a102697cb 100644 --- a/compute/zlantr.c +++ b/compute/zlantr.c @@ -95,7 +95,7 @@ double MORSE_zlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, { int NB; int status; - double value; + double value = -1.; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -220,7 +220,7 @@ double MORSE_zlantr_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, MORS MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; int status; - double value; + double value = -1.; morse = morse_context_self(); if (morse == NULL) { diff --git a/example/lapack_to_morse/step0.c b/example/lapack_to_morse/step0.c index 6879a1ef1e3ab1f0fde0ddb067255e842bb91128..0ae46a070a70d62fa6540d9257c26bc18ea2f4ad 100644 --- a/example/lapack_to_morse/step0.c +++ b/example/lapack_to_morse/step0.c @@ -36,7 +36,8 @@ int main(int argc, char *argv[]) { size_t NRHS; // number of RHS vectors /* declarations to time the program and evaluate performances */ - double fmuls, fadds, flops, gflops, cpu_time; + double fmuls, fadds, flops, gflops, cpu_time, eps, res; + int hres; /* initialize some parameters with default values */ int iparam[IPARAM_SIZEOF]; @@ -52,8 +53,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -137,26 +136,27 @@ int main(int argc, char *argv[]) { /* compute A*X-B, store the result in B */ cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, N, NRHS, N, 1.0, Acpy, N, X, N, -1.0, B, N); - double res = LAPACKE_dlange( LAPACK_COL_MAJOR, 'I', N, NRHS, B, N); + res = LAPACKE_dlange( LAPACK_COL_MAJOR, 'I', N, NRHS, B, N); /* check residual and print a message */ - double eps = LAPACKE_dlamch_work( 'e' ); + eps = LAPACKE_dlamch_work( 'e' ); /* * if hres = 0 then the test succeed * else the test failed */ - int hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); - else + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); + } /* deallocate data */ free(A); diff --git a/example/lapack_to_morse/step1.c b/example/lapack_to_morse/step1.c index 6099a6f9a673f2df637a93b3f28d02f9cd16c1cb..025f6a53494a829039b2eed6185095e0a0544aed 100644 --- a/example/lapack_to_morse/step1.c +++ b/example/lapack_to_morse/step1.c @@ -38,7 +38,6 @@ * The precision is: double */ int main(int argc, char *argv[]) { - size_t N; // matrix order size_t NRHS; // number of RHS vectors int NCPU; // number of cores to use @@ -66,8 +65,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -88,7 +85,7 @@ int main(int argc, char *argv[]) { } /* - * allocate memory for our data using a C macro (see step1.h) + * Allocate memory for our data using a C macro (see step1.h) * - matrix A : size N x N * - set of RHS vectors B : size N x NRHS * - set of solutions vectors X : size N x NRHS @@ -154,17 +151,18 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); - else + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); + } /* deallocate data */ free(A); diff --git a/example/lapack_to_morse/step2.c b/example/lapack_to_morse/step2.c index fbb13949987b0d2379a3e5fabe0b1943f5e59fb2..e0195479c27d63a73647042164ab92f72ec90a70 100644 --- a/example/lapack_to_morse/step2.c +++ b/example/lapack_to_morse/step2.c @@ -29,8 +29,7 @@ * The goal is also to show examples of calling MORSE tile interface. */ int main(int argc, char *argv[]) { - - size_t N; // matrix order + size_t N; // matrix order int NB; // number of rows and columns in tiles int NRHS; // number of RHS vectors int NCPU; // number of cores to use @@ -61,8 +60,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -76,7 +73,7 @@ int main(int argc, char *argv[]) { /* print informations to user */ print_header( argv[0], iparam); - /* Initialize MORSE with main parameters */ + /* Initialize MORSE with main parameters */ if ( MORSE_Init( NCPU, NGPU ) != MORSE_SUCCESS ) { fprintf(stderr, "Error initializing MORSE library\n"); return EXIT_FAILURE; @@ -198,17 +195,18 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); - else + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); + } /* get back results in LAPACK format */ MORSE_dTile_to_Lapack(descA, A, N); diff --git a/example/lapack_to_morse/step3.c b/example/lapack_to_morse/step3.c index fdad78747b24d0704f8be9e8d7be4bcc2bbf848a..eb312137b9fc7e11c031472ea751c147b4f1462e 100644 --- a/example/lapack_to_morse/step3.c +++ b/example/lapack_to_morse/step3.c @@ -27,7 +27,6 @@ * During this step we do not use classical LAPACK matrices (1D array) anymore. */ int main(int argc, char *argv[]) { - size_t N; // matrix order int NB; // number of rows and columns in tiles int NRHS; // number of RHS vectors @@ -62,8 +61,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -77,7 +74,7 @@ int main(int argc, char *argv[]) { /* print informations to user */ print_header( argv[0], iparam); - /* Initialize MORSE with main parameters */ + /* Initialize MORSE with main parameters */ if ( MORSE_Init( NCPU, NGPU ) != MORSE_SUCCESS ) { fprintf(stderr, "Error initializing MORSE library\n"); return EXIT_FAILURE; @@ -181,17 +178,18 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); - else + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); + } /* free the matrix of tiles */ deallocate_tile_matrix(matA, N, N, NB); diff --git a/example/lapack_to_morse/step4.c b/example/lapack_to_morse/step4.c index 6eafc33b1b87f95a5822799e8068351de29a9e4a..32abb06f164fd6e18e1fdf7749ef610ae25269d4 100644 --- a/example/lapack_to_morse/step4.c +++ b/example/lapack_to_morse/step4.c @@ -31,8 +31,7 @@ * subsequent algorithms so that less synchronisations are done. */ int main(int argc, char *argv[]) { - - size_t N; // matrix order + size_t N; // matrix order int NB; // number of rows and columns in tiles int NRHS; // number of RHS vectors int NCPU; // number of cores to use @@ -70,8 +69,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -85,7 +82,7 @@ int main(int argc, char *argv[]) { /* print informations to user */ print_header( argv[0], iparam); - /* Initialize MORSE with main parameters */ + /* Initialize MORSE with main parameters */ if ( MORSE_Init( NCPU, NGPU ) != MORSE_SUCCESS ) { fprintf(stderr, "Error initializing MORSE library\n"); return EXIT_FAILURE; @@ -179,17 +176,18 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); - else + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); + } /* deallocate A, B, X, Acpy and associated descriptors descA, ... */ MORSE_Desc_Destroy( &descA ); diff --git a/example/lapack_to_morse/step5.c b/example/lapack_to_morse/step5.c index 0b7c03a9b27ae942a2f2da93d786fa721fdd7f4f..a3ef2994dced8993bda8d9041f02302bf9cc5034 100644 --- a/example/lapack_to_morse/step5.c +++ b/example/lapack_to_morse/step5.c @@ -31,8 +31,7 @@ * - number of right-hand sides */ int main(int argc, char *argv[]) { - - size_t N; // matrix order + size_t N; // matrix order int NB; // number of rows and columns in tiles int NRHS; // number of RHS vectors int NCPU; // number of cores to use @@ -71,8 +70,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -183,17 +180,18 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", - res, anorm, xnorm, bnorm, - res / N / eps / (anorm * xnorm + bnorm )); - else + res, anorm, xnorm, bnorm, + res / N / eps / (anorm * xnorm + bnorm )); + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", - res, anorm, xnorm, bnorm, - res / N / eps / (anorm * xnorm + bnorm )); + res, anorm, xnorm, bnorm, + res / N / eps / (anorm * xnorm + bnorm )); + } /* deallocate A, B, X, Acpy and associated descriptors descA, ... */ MORSE_Desc_Destroy( &descA ); diff --git a/example/lapack_to_morse/step6.c b/example/lapack_to_morse/step6.c index 49e02c1b00f429c3dfa887a021d7c035f3ed76ff..3397942336eb891c2e32a2e92ba8abd69f3977fc 100644 --- a/example/lapack_to_morse/step6.c +++ b/example/lapack_to_morse/step6.c @@ -29,8 +29,7 @@ * --p= and --q= */ int main(int argc, char *argv[]) { - - size_t N; // matrix order + size_t N; // matrix order int NB; // number of rows and columns in tiles int NRHS; // number of RHS vectors int NCPU; // number of cores to use @@ -72,8 +71,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -181,8 +178,9 @@ int main(int argc, char *argv[]) { /* print informations to user */ gflops = flops / cpu_time; - if ( MORSE_My_Mpi_Rank() == 0 ) + if ( MORSE_My_Mpi_Rank() == 0 ) { printf( "%9.3f %9.2f\n", cpu_time, gflops); + } fflush( stdout ); /************************************************************/ @@ -206,18 +204,19 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); if ( MORSE_My_Mpi_Rank() == 0 ){ printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", - res, anorm, xnorm, bnorm, - res / N / eps / (anorm * xnorm + bnorm )); - else + res, anorm, xnorm, bnorm, + res / N / eps / (anorm * xnorm + bnorm )); + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", - res, anorm, xnorm, bnorm, - res / N / eps / (anorm * xnorm + bnorm )); + res, anorm, xnorm, bnorm, + res / N / eps / (anorm * xnorm + bnorm )); + } } /* deallocate A, B, X, Acpy and associated descriptors descA, ... */ diff --git a/example/lapack_to_morse/step7.c b/example/lapack_to_morse/step7.c index 4aa0b0001f3a8dfd4f71ec4b4892f47c62ab2016..2c5f408725edc0c78a604997ab3ec94ece680184 100644 --- a/example/lapack_to_morse/step7.c +++ b/example/lapack_to_morse/step7.c @@ -33,8 +33,7 @@ * and therefore this approach is much more flexible. */ int main(int argc, char *argv[]) { - - size_t N; // matrix order + size_t N; // matrix order int NB; // number of rows and columns in tiles int NRHS; // number of RHS vectors int NCPU; // number of cores to use @@ -76,8 +75,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv * It makes sense only if this program is linked with pthread and @@ -189,8 +186,9 @@ int main(int argc, char *argv[]) { /* print informations to user */ gflops = flops / cpu_time; - if ( MORSE_My_Mpi_Rank() == 0 ) + if ( MORSE_My_Mpi_Rank() == 0 ) { printf( "%9.3f %9.2f\n", cpu_time, gflops); + } fflush( stdout ); /************************************************************/ @@ -214,18 +212,19 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); if ( MORSE_My_Mpi_Rank() == 0 ){ printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", - res, anorm, xnorm, bnorm, - res / N / eps / (anorm * xnorm + bnorm )); - else + res, anorm, xnorm, bnorm, + res / N / eps / (anorm * xnorm + bnorm )); + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", - res, anorm, xnorm, bnorm, - res / N / eps / (anorm * xnorm + bnorm )); + res, anorm, xnorm, bnorm, + res / N / eps / (anorm * xnorm + bnorm )); + } } /* deallocate A, B, X, Acpy and associated descriptors descA, ... */ diff --git a/example/out_of_core/out_of_core.c b/example/out_of_core/out_of_core.c index 0db7f3af70c30d48d13f027c7c8fcd4731d34844..90af9ca34e5a59fed75f872d262552863b61457c 100644 --- a/example/out_of_core/out_of_core.c +++ b/example/out_of_core/out_of_core.c @@ -56,8 +56,6 @@ int main(int argc, char *argv[]) { fadds = (double)( FADDS_POTRF(N) + 2 * FADDS_TRSM(N,NRHS) ); fmuls = (double)( FMULS_POTRF(N) + 2 * FMULS_TRSM(N,NRHS) ); flops = 1e-9 * (fmuls + fadds); - gflops = 0.0; - cpu_time = 0.0; /* initialize the number of thread if not given by the user in argv */ if ( iparam[IPARAM_THRDNBR] == -1 ) { @@ -166,17 +164,18 @@ int main(int argc, char *argv[]) { * if hres = 0 then the test succeed * else the test failed */ - hres = 0; - hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 ); + hres = ( (res / N / eps / (anorm * xnorm + bnorm )) > 100.0 ); printf( " ||Ax-b|| ||A|| ||x|| ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||) RETURN\n"); - if (hres) + if (hres) { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e FAILURE \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); - else + } + else { printf( "%8.5e %8.5e %8.5e %8.5e %8.5e SUCCESS \n", res, anorm, xnorm, bnorm, res / N / eps / (anorm * xnorm + bnorm )); + } /* free descriptors descA, descB, descX, descAC */ MORSE_Desc_Destroy( &descA );