diff --git a/testing/testing_zgetrf.c b/testing/testing_zgetrf.c index c6b69612ad90e0c8be3165d81aaac57427bd0359..5657d49b6435619644d70292096978e5d6ec2521 100644 --- a/testing/testing_zgetrf.c +++ b/testing/testing_zgetrf.c @@ -44,7 +44,7 @@ testing_zgetrf_desc( run_arg_list_t *args, int check ) int minMN = chameleon_min( M, N ); /* Descriptors */ - CHAM_desc_t *descA; + CHAM_desc_t *descA, *descIPIV; void *ws = NULL; CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb ); @@ -52,6 +52,8 @@ testing_zgetrf_desc( run_arg_list_t *args, int check ) /* Creates the matrices */ CHAMELEON_Desc_Create( &descA, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, M, N, P, Q ); + CHAMELEON_Desc_Create( + &descIPIV, CHAMELEON_MAT_ALLOC_TILE, ChamInteger, nb, 1, nb, minMN, 1, 0, 0, minMN, 1, P, Q ); /* Fills the matrix with random values */ if ( diag == ChamUnit ) { @@ -69,11 +71,12 @@ testing_zgetrf_desc( run_arg_list_t *args, int check ) /* Calculates the solution */ testing_start( &test_data ); if ( async ) { - hres = CHAMELEON_zgetrf_Tile_Async( descA, ws, test_data.sequence, &test_data.request ); + hres = CHAMELEON_zgetrf_Tile_Async( descA, descIPIV, ws, test_data.sequence, &test_data.request ); CHAMELEON_Desc_Flush( descA, test_data.sequence ); + CHAMELEON_Desc_Flush( descIPIV, test_data.sequence ); } else { - hres = CHAMELEON_zgetrf_Tile( descA ); + hres = CHAMELEON_zgetrf_Tile( descA, descIPIV ); } test_data.hres = hres; testing_stop( &test_data, flops_zgetrf( M, N ) ); @@ -81,14 +84,19 @@ testing_zgetrf_desc( run_arg_list_t *args, int check ) /* Checks the factorization and residual */ #if !defined(CHAMELEON_SIMULATION) if ( check ) { - CHAM_desc_t *descA0c; + CHAM_desc_t *descA0c, *descIPIVc; CHAM_desc_t *descA0 = CHAMELEON_Desc_Copy( descA, CHAMELEON_MAT_ALLOC_TILE ); + int *ipiv; /* Create A0c as local to rank 0 on all nodes to gather the matrix */ CHAMELEON_Desc_Create_User( &descA0c, (void*)CHAMELEON_MAT_ALLOC_GLOBAL, ChamComplexDouble, nb, nb, nb*nb, M, N, 0, 0, M, N, 1, 1, chameleon_getaddr_cm, chameleon_getblkldd_cm, NULL ); + CHAMELEON_Desc_Create_User( + &descIPIVc, (void*)CHAMELEON_MAT_ALLOC_GLOBAL, ChamInteger, + nb, 1, nb, M, 1, 0, 0, M, 1, 1, 1, + chameleon_getaddr_cm, chameleon_getblkldd_cm, NULL ); if ( diag == ChamUnit ) { CHAMELEON_zplgtr_Tile( 0, ChamUpper, descA0c, seedA ); @@ -98,21 +106,19 @@ testing_zgetrf_desc( run_arg_list_t *args, int check ) CHAMELEON_zplrnt_Tile( descA0c, seedA ); } + /* Cheat code: float (s) is the same size as int */ + CHAMELEON_slacpy_Tile( ChamUpperLower, descIPIV, descIPIVc ); + ipiv = descIPIVc->mat; + /* Compute the permutation of A0: P * A0 */ if ( CHAMELEON_Comm_rank() == 0 ) { - int i, j; - int *ipiv = (int *)calloc( M, sizeof(int) ); - - for (i = 0; i < M; i++) { - ipiv[i] = i+1; - } - LAPACKE_zlaswp( LAPACK_COL_MAJOR, N, descA0c->mat, M, 1, M, ipiv, 1 ); - free( ipiv ); } CHAMELEON_zlacpy_Tile( ChamUpperLower, descA0c, descA0 ); CHAMELEON_Desc_Destroy( &descA0c ); + CHAMELEON_Desc_Destroy( &descIPIVc ); + hres += check_zxxtrf( args, ChamGeneral, ChamUpperLower, descA0, descA ); @@ -125,6 +131,7 @@ testing_zgetrf_desc( run_arg_list_t *args, int check ) } CHAMELEON_Desc_Destroy( &descA ); + CHAMELEON_Desc_Destroy( &descIPIV ); return hres; }