diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6fa958b65b8d4cf5028bff528f4f7291863a139..7b4b35d4c37fbe91717448d7b397df9b75295e7d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,7 +45,7 @@ test_starpu_cuda_mpi: - chameleon_starpu_mpi.lcov script: - (cd build && - ctest --no-compress-output -V -j 5 + ctest --no-compress-output -V -R "test_shm_s|mpi_s" -D ExperimentalTest -D ExperimentalCoverage @@ -90,7 +90,7 @@ test_starpu_simgrid: script: - source .gitlab-ci-env.sh simu - (cd build && - ctest --no-compress-output -V -j 5 + ctest --no-compress-output -V -D ExperimentalTest -D ExperimentalCoverage -D ExperimentalSubmit @@ -130,7 +130,7 @@ test_quark: - chameleon_quark.lcov script: - (cd build && - ctest --no-compress-output -V -j 5 + ctest --no-compress-output -V -R "test_shm_s" -D ExperimentalTest -D ExperimentalCoverage diff --git a/compute/CMakeLists.txt b/compute/CMakeLists.txt index 0034ceb13b1da10d440a280f07fd4b27bf55e401..45700455d95c5a27fd8aa2cbe3ce7f07ab1245a9 100644 --- a/compute/CMakeLists.txt +++ b/compute/CMakeLists.txt @@ -235,7 +235,6 @@ set(ZSRC ################## #pzshift.c #pzpack.c - pztile.c ztile.c ################## # BUILD diff --git a/compute/pzhetrd_he2hb.c b/compute/pzhetrd_he2hb.c index 74c3396149dfc3a4e1d34e129ca2676dcb31f7f8..98301f2b214dc8ddfda207f630f4c324c8137ef0 100644 --- a/compute/pzhetrd_he2hb.c +++ b/compute/pzhetrd_he2hb.c @@ -99,6 +99,7 @@ void morse_pzhetrd_he2hb(MORSE_enum uplo, MorseComplexDouble, A->mb, A->nb, (A->mb*A->nb), chameleon_min(A->mt, A->nt) * A->mb, A->nb, 0, 0, chameleon_min(A->mt, A->nt) * A->mb, A->nb, 1, 1); morse_desc_mat_alloc( AT ); + RUNTIME_desc_create( AT ); /* Let's extract the diagonal in a temporary copy that contains A and A' */ for (k = 1; k < A->nt; k++){ diff --git a/compute/pzlange.c b/compute/pzlange.c index f893a4d9b45d1d0f04bbc06397b7c469b69fe880..0394d6d335b3faf9247e1a80368ce308ba5758e2 100644 --- a/compute/pzlange.c +++ b/compute/pzlange.c @@ -154,6 +154,9 @@ void morse_pzlange( MORSE_enum norm, MORSE_desc_t *A, double *result, VECNORMS_STEP1(m, n), 1 ); } } + MORSE_Desc_Flush( VECNORMS_STEP2, sequence ); + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); MORSE_Desc_Destroy( &(VECNORMS_STEP2) ); break; @@ -271,6 +274,9 @@ void morse_pzlange( MORSE_enum norm, MORSE_desc_t *A, double *result, VECNORMS_STEP1(m, n), 1 ); } } + MORSE_Desc_Flush( VECNORMS_STEP2, sequence ); + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); MORSE_Desc_Destroy( &(VECNORMS_STEP2) ); break; @@ -339,6 +345,8 @@ void morse_pzlange( MORSE_enum norm, MORSE_desc_t *A, double *result, } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); break; @@ -400,6 +408,8 @@ void morse_pzlange( MORSE_enum norm, MORSE_desc_t *A, double *result, } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); } diff --git a/compute/pzlanhe.c b/compute/pzlanhe.c index af3b5bbab0bdff3c67545b22427c59730915d31e..ef78f795fc9f33310a95affcaa84e8ee4ffb59cd 100644 --- a/compute/pzlanhe.c +++ b/compute/pzlanhe.c @@ -202,6 +202,9 @@ void morse_pzlanhe(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re VECNORMS_STEP1(m, n), 1 ); } } + MORSE_Desc_Flush( VECNORMS_STEP2, sequence ); + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); @@ -338,6 +341,8 @@ void morse_pzlanhe(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); @@ -449,6 +454,8 @@ void morse_pzlanhe(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); diff --git a/compute/pzlansy.c b/compute/pzlansy.c index f71eb5cb0f410729e187318be9bad6441ca876b6..f89d4302f24cb2caa16421a705f48e4997bdc729 100644 --- a/compute/pzlansy.c +++ b/compute/pzlansy.c @@ -202,11 +202,11 @@ void morse_pzlansy(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re VECNORMS_STEP1(m, n), 1 ); } } + MORSE_Desc_Flush( VECNORMS_STEP2, sequence ); + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); - *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); - MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); MORSE_Desc_Destroy( &(VECNORMS_STEP2) ); - MORSE_Desc_Destroy( &(RESULT) ); break; /* * MorseFrobeniusNorm @@ -347,10 +347,9 @@ void morse_pzlansy(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); - *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); - MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); - MORSE_Desc_Destroy( &(RESULT) ); break; /* @@ -458,11 +457,15 @@ void morse_pzlansy(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); - *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); - MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); - MORSE_Desc_Destroy( &(RESULT) ); } + + *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); + + MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); + MORSE_Desc_Destroy( &(RESULT) ); RUNTIME_options_ws_free(&options); RUNTIME_options_finalize(&options, morse); } diff --git a/compute/pzlantr.c b/compute/pzlantr.c index 7c1e28b71c2c739c5cd13229f35151d544a2c10b..5f6606615b9dfde5c1968432f5c4fe919f80a4b8 100644 --- a/compute/pzlantr.c +++ b/compute/pzlantr.c @@ -225,6 +225,9 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, VECNORMS_STEP1(m, n), 1 ); } } + MORSE_Desc_Flush( VECNORMS_STEP2, sequence ); + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); @@ -394,6 +397,9 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, VECNORMS_STEP1(m, n), 1 ); } } + MORSE_Desc_Flush( VECNORMS_STEP2, sequence ); + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); @@ -534,6 +540,8 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); @@ -658,6 +666,8 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, } } + MORSE_Desc_Flush( VECNORMS_STEP1, sequence ); + MORSE_Desc_Flush( RESULT, sequence ); RUNTIME_sequence_wait(morse, sequence); *result = *(double *)VECNORMS_STEP1->get_blkaddr(VECNORMS_STEP1, A->myrank / A->q, A->myrank % A->q ); MORSE_Desc_Destroy( &(VECNORMS_STEP1) ); diff --git a/compute/pztile.c b/compute/pztile.c deleted file mode 100644 index 6b9b49a8233d3ebfbc8a0c967aa13b7bd0c60da8..0000000000000000000000000000000000000000 --- a/compute/pztile.c +++ /dev/null @@ -1,161 +0,0 @@ -/** - * - * @copyright (c) 2009-2014 The University of Tennessee and The University - * of Tennessee Research Foundation. - * All rights reserved. - * @copyright (c) 2012-2014 Inria. All rights reserved. - * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - * - **/ - -/** - * - * @file pztile.c - * - * MORSE auxiliary routines - * MORSE is a software package provided by Univ. of Tennessee, - * Univ. of California Berkeley and Univ. of Colorado Denver - * - * @version 0.9.0 - * @author Jakub Kurzak - * @author Mathieu Faverge - * @author Cedric Castagnede - * @date 2010-11-15 - * @precisions normal z -> c d s - * - **/ -#include "control/common.h" - -#define A(m, n) A, m, n -#define B(m, n) &B, m, n - -/******************************************************************************* - * Conversion from LAPACK F77 matrix layout to tile layout - dynamic scheduling - **/ -void morse_pzlapack_to_tile(MORSE_Complex64_t *Af77, int ldaf77, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) -{ - MORSE_context_t *morse; - MORSE_option_t options; - MORSE_desc_t B; - int m, n; - int ldam; - int tempmm, tempnn; - - morse = morse_context_self(); - if (sequence->status != MORSE_SUCCESS) - return; - RUNTIME_options_init(&options, morse, sequence, request); - - B = morse_desc_init( - MorseComplexDouble, A->mb, A->nb, A->bsiz, - ldaf77, A->n, 0, 0, A->m, A->n, 1, 1); - - B.get_blkaddr = morse_getaddr_cm; - B.get_blkldd = morse_getblkldd_cm; - B.mat = Af77; - B.styp = MorseCM; - - RUNTIME_desc_create( &B ); - - for (m = 0; m < A->mt; m++) { - tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb; - ldam = BLKLDD(A, m); - for (n = 0; n < A->nt; n++) { - tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb; - MORSE_TASK_zlacpy( - &options, - MorseUpperLower, - tempmm, tempnn, A->mb, - B(m, n), ldaf77, - A(m, n), ldam); - } - } - - RUNTIME_desc_flush( &B, sequence ); - RUNTIME_sequence_wait( morse, sequence ); - RUNTIME_options_finalize( &options, morse ); - RUNTIME_desc_destroy( &B ); -} - -/******************************************************************************* - * Conversion from LAPACK F77 matrix layout to tile layout - dynamic scheduling - **/ -void morse_pztile_to_lapack(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int ldaf77, - MORSE_sequence_t *sequence, MORSE_request_t *request) -{ - MORSE_context_t *morse; - MORSE_option_t options; - MORSE_desc_t B; - int m, n; - int ldam; - int tempmm, tempnn; - - morse = morse_context_self(); - if (sequence->status != MORSE_SUCCESS) - return; - RUNTIME_options_init(&options, morse, sequence, request); - - B = morse_desc_init( - MorseComplexDouble, A->mb, A->nb, A->bsiz, - ldaf77, A->n, 0, 0, A->m, A->n, 1, 1); - - B.get_blkaddr = morse_getaddr_cm; - B.get_blkldd = morse_getblkldd_cm; - B.mat = Af77; - B.styp = MorseCM; - - RUNTIME_desc_create( &B ); - - for (m = 0; m < A->mt; m++) { - tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb; - ldam = BLKLDD(A, m); - for (n = 0; n < A->nt; n++) { - tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb; - MORSE_TASK_zlacpy( - &options, - MorseUpperLower, - tempmm, tempnn, A->mb, - A(m, n), ldam, - B(m, n), ldaf77); - } - } - - RUNTIME_desc_flush( &B, sequence ); - RUNTIME_sequence_wait( morse, sequence ); - RUNTIME_options_finalize( &options, morse ); - RUNTIME_desc_destroy( &B ); -} - - -/******************************************************************************* - * Zeroes a submatrix in tile layout - dynamic scheduling - **/ -void morse_pztile_zero(MORSE_desc_t *A, MORSE_sequence_t *sequence, MORSE_request_t *request) -{ - MORSE_context_t *morse; - MORSE_option_t options; - int m, n; - int ldam; - int tempmm, tempnn; - - morse = morse_context_self(); - if (sequence->status != MORSE_SUCCESS) - return; - RUNTIME_options_init(&options, morse, sequence, request); - - for (m = 0; m < A->mt; m++) { - tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb; - ldam = BLKLDD(A, m); - for (n = 0; n < A->nt; n++) { - tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb; - MORSE_TASK_ztile_zero( - &options, - 0, tempnn, 0, tempmm, - A(m, n), ldam); - } - } - - RUNTIME_sequence_wait( morse, sequence ); - RUNTIME_options_finalize( &options, morse ); -} diff --git a/compute/zbuild.c b/compute/zbuild.c index 71fadaac9434b5d8357a9bddac6360fb0cfefe02..7fe753ef6ae56796ab8041ed1fdf7181727c132c 100644 --- a/compute/zbuild.c +++ b/compute/zbuild.c @@ -84,14 +84,14 @@ ******************************************************************************/ int MORSE_zbuild( MORSE_enum uplo, int M, int N, MORSE_Complex64_t *A, int LDA, - void *user_data, void* user_build_callback) + void *user_data, void* user_build_callback ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -124,18 +124,26 @@ int MORSE_zbuild( MORSE_enum uplo, int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); - morse_zdesc_alloc(descA, NB, NB, LDA, N, 0, 0, M, N, morse_desc_mat_free(&descA)); + morse_sequence_create( morse, &sequence ); + + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescOutput, uplo, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zbuild_Tile_Async(uplo, &descA, user_data, user_build_callback, sequence, &request ); + MORSE_zbuild_Tile_Async( uplo, &descAt, user_data, user_build_callback, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescOutput, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -195,11 +203,15 @@ int MORSE_zbuild_Tile( MORSE_enum uplo, MORSE_desc_t *A, morse_fatal_error("MORSE_zbuild_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); + MORSE_zbuild_Tile_Async( uplo, A, user_data, user_build_callback, sequence, &request ); - morse_sequence_wait(morse, sequence); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -249,7 +261,7 @@ int MORSE_zbuild_Tile( MORSE_enum uplo, MORSE_desc_t *A, int MORSE_zbuild_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, void *user_data, void* user_build_callback, MORSE_sequence_t *sequence, - MORSE_request_t *request) + MORSE_request_t *request ) { MORSE_context_t *morse; @@ -267,10 +279,12 @@ int MORSE_zbuild_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -279,10 +293,11 @@ int MORSE_zbuild_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, } /* Quick return */ - if (chameleon_min( A->m, A->n ) == 0) + if (chameleon_min( A->m, A->n ) == 0) { return MORSE_SUCCESS; + } - morse_pzbuild(uplo, A, user_data, user_build_callback, sequence, request); + morse_pzbuild( uplo, A, user_data, user_build_callback, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgeadd.c b/compute/zgeadd.c index b6e85b32297b0b56bbd9b3e0d9aaa6a46230e657..5478a00aab4624a466d1df0536ed61a8fea76604 100644 --- a/compute/zgeadd.c +++ b/compute/zgeadd.c @@ -91,14 +91,15 @@ * @sa MORSE_sgeadd * ******************************************************************************/ -int MORSE_zgeadd(MORSE_enum trans, int M, int N, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t beta, MORSE_Complex64_t *B, int LDB) +int MORSE_zgeadd( MORSE_enum trans, int M, int N, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t beta, MORSE_Complex64_t *B, int LDB ) { int NB; int Am, An; int status; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -151,37 +152,31 @@ int MORSE_zgeadd(MORSE_enum trans, int M, int N, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - /* } else { */ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */ - /* sequence, &request); */ - /* morse_ziplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, */ - /* sequence, &request); */ - /* } */ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgeadd_Tile_Async( - trans, alpha, &descA, beta, &descB, sequence, &request); + MORSE_zgeadd_Tile_Async( trans, alpha, &descAt, beta, &descBt, sequence, &request ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooptile2lap( descB, B, NB, NB, LDB, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - /* } else { */ - /* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request); */ - /* morse_ziptile2lap( descB, B, NB, NB, LDB, N, sequence, &request); */ - /* morse_dynamic_sync(); */ - /* } */ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -233,9 +228,9 @@ int MORSE_zgeadd(MORSE_enum trans, int M, int N, * @sa MORSE_sgeadd_Tile * ******************************************************************************/ -int MORSE_zgeadd_Tile(MORSE_enum trans, - MORSE_Complex64_t alpha, MORSE_desc_t *A, - MORSE_Complex64_t beta, MORSE_desc_t *B) +int MORSE_zgeadd_Tile( MORSE_enum trans, + MORSE_Complex64_t alpha, MORSE_desc_t *A, + MORSE_Complex64_t beta, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -247,14 +242,16 @@ int MORSE_zgeadd_Tile(MORSE_enum trans, morse_fatal_error("MORSE_zgeadd_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgeadd_Tile_Async(trans, alpha, A, beta, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgeadd_Tile_Async( trans, alpha, A, beta, B, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -287,10 +284,10 @@ int MORSE_zgeadd_Tile(MORSE_enum trans, * @sa MORSE_sgeadd_Tile_Async * ******************************************************************************/ -int MORSE_zgeadd_Tile_Async(MORSE_enum trans, - MORSE_Complex64_t alpha, MORSE_desc_t *A, - MORSE_Complex64_t beta, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgeadd_Tile_Async( MORSE_enum trans, + MORSE_Complex64_t alpha, MORSE_desc_t *A, + MORSE_Complex64_t beta, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; int M, N; @@ -310,10 +307,12 @@ int MORSE_zgeadd_Tile_Async(MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -363,11 +362,13 @@ int MORSE_zgeadd_Tile_Async(MORSE_enum trans, N = B->n; /* Quick return */ - if (M == 0 || N == 0 || - ((alpha == (MORSE_Complex64_t)0.0) && beta == (MORSE_Complex64_t)1.0)) + if ( (M == 0) || (N == 0) || + ((alpha == (MORSE_Complex64_t)0.0) && (beta == (MORSE_Complex64_t)1.0)) ) + { return MORSE_SUCCESS; + } - morse_pztradd(MorseUpperLower, trans, alpha, A, beta, B, sequence, request); + morse_pztradd( MorseUpperLower, trans, alpha, A, beta, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgelqf.c b/compute/zgelqf.c index 55b9284837f7af7fd60f17702fcba108942c4d1b..bcab0855fa87c58f57ba961245b9d0837e5c0559 100644 --- a/compute/zgelqf.c +++ b/compute/zgelqf.c @@ -75,16 +75,16 @@ * @sa MORSE_zgelqs * ******************************************************************************/ -int MORSE_zgelqf(int M, int N, +int MORSE_zgelqf( int M, int N, MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descT) + MORSE_desc_t *descT ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -120,30 +120,26 @@ int MORSE_zgelqf(int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgelqf_Tile_Async(&descA, descT, sequence, &request); + MORSE_zgelqf_Tile_Async( &descAt, descT, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -186,7 +182,7 @@ int MORSE_zgelqf(int M, int N, * @sa MORSE_zgelqs_Tile * ******************************************************************************/ -int MORSE_zgelqf_Tile(MORSE_desc_t *A, MORSE_desc_t *T) +int MORSE_zgelqf_Tile( MORSE_desc_t *A, MORSE_desc_t *T ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -198,13 +194,16 @@ int MORSE_zgelqf_Tile(MORSE_desc_t *A, MORSE_desc_t *T) morse_fatal_error("MORSE_zgelqf_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgelqf_Tile_Async(A, T, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgelqf_Tile_Async( A, T, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -237,8 +236,8 @@ int MORSE_zgelqf_Tile(MORSE_desc_t *A, MORSE_desc_t *T) * @sa MORSE_zgelqs_Tile_Async * ******************************************************************************/ -int MORSE_zgelqf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgelqf_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *T, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -257,10 +256,12 @@ int MORSE_zgelqf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -277,10 +278,10 @@ int MORSE_zgelqf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, N) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, N) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int m = chameleon_min(A->mt, A->nt) * A->mb; @@ -290,13 +291,17 @@ int MORSE_zgelqf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, #endif if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzgelqf(A, T, Dptr, sequence, request); + morse_pzgelqf( A, T, Dptr, sequence, request ); } else { - morse_pzgelqfrh(A, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzgelqfrh( A, T, Dptr, MORSE_RHBLK, sequence, request ); } if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgelqf_param.c b/compute/zgelqf_param.c index d650ba8ad5f3b180d22f0011dd334ce27b3b55b8..fe0623cb701f9831a7bc00ca19bb0fc6754ccd5c 100644 --- a/compute/zgelqf_param.c +++ b/compute/zgelqf_param.c @@ -72,16 +72,16 @@ * @sa MORSE_zgelqs * ******************************************************************************/ -int MORSE_zgelqf_param(const libhqr_tree_t *qrtree, int M, int N, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT) +int MORSE_zgelqf_param( const libhqr_tree_t *qrtree, int M, int N, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -117,30 +117,26 @@ int MORSE_zgelqf_param(const libhqr_tree_t *qrtree, int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgelqf_param_Tile_Async(qrtree, &descA, descTS, descTT, sequence, &request); + MORSE_zgelqf_param_Tile_Async( qrtree, &descAt, descTS, descTT, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -183,7 +179,7 @@ int MORSE_zgelqf_param(const libhqr_tree_t *qrtree, int M, int N, * @sa MORSE_zgelqs_Tile * ******************************************************************************/ -int MORSE_zgelqf_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT) +int MORSE_zgelqf_param_Tile( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -195,13 +191,17 @@ int MORSE_zgelqf_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ morse_fatal_error("MORSE_zgelqf_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgelqf_param_Tile_Async(qrtree, A, TS, TT, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgelqf_param_Tile_Async( qrtree, A, TS, TT, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -234,8 +234,8 @@ int MORSE_zgelqf_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ * @sa MORSE_zgelqs_Tile_Async * ******************************************************************************/ -int MORSE_zgelqf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgelqf_param_Tile_Async( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -254,10 +254,12 @@ int MORSE_zgelqf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -278,10 +280,10 @@ int MORSE_zgelqf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, N) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, N) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int m = chameleon_min(A->mt, A->nt) * A->mb; @@ -290,9 +292,14 @@ int MORSE_zgelqf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, } #endif - morse_pzgelqf_param(qrtree, A, TS, TT, Dptr, sequence, request); + morse_pzgelqf_param( qrtree, A, TS, TT, Dptr, sequence, request ); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgelqs.c b/compute/zgelqs.c index b9410fd3d107681ccdbeac7bd54ed92537ba0580..ccf896144f1af0d4f7188ac3f27d91a17d2ea8b1 100644 --- a/compute/zgelqs.c +++ b/compute/zgelqs.c @@ -81,17 +81,18 @@ * @sa MORSE_zgelqf * ******************************************************************************/ -int MORSE_zgelqs(int M, int N, int NRHS, +int MORSE_zgelqs( int M, int N, int NRHS, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descT, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -135,37 +136,31 @@ int MORSE_zgelqs(int M, int N, int NRHS, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgelqs_Tile_Async(&descA, descT, &descB, sequence, &request); + MORSE_zgelqs_Tile_Async( &descAt, descT, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -208,7 +203,7 @@ int MORSE_zgelqs(int M, int N, int NRHS, * @sa MORSE_zgelqf_Tile * ******************************************************************************/ -int MORSE_zgelqs_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B) +int MORSE_zgelqs_Tile( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -220,14 +215,17 @@ int MORSE_zgelqs_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B) morse_fatal_error("MORSE_zgelqs_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgelqs_Tile_Async(A, T, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgelqs_Tile_Async( A, T, B, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -261,8 +259,8 @@ int MORSE_zgelqs_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B) * @sa MORSE_zgelqf_Tile_Async * ******************************************************************************/ -int MORSE_zgelqs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgelqs_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_desc_t *subB; MORSE_desc_t *subA; @@ -283,10 +281,12 @@ int MORSE_zgelqs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -307,18 +307,18 @@ int MORSE_zgelqs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { - return MORSE_SUCCESS; - } -*/ + /* + if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { + return MORSE_SUCCESS; + } + */ /* subB = morse_desc_submatrix(B, A->m, 0, A->n-A->m, B->n); - morse_pztile_zero(subB, sequence, request); - free(subB); */ + morse_pzlaset( MorseUpperLower, 0., 0., subB, sequence, request ); + free(subB); */ subB = morse_desc_submatrix(B, 0, 0, A->m, B->n); subA = morse_desc_submatrix(A, 0, 0, A->m, A->m); - morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); + morse_pztrsm( MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); free(subA); free(subB); @@ -331,14 +331,19 @@ int MORSE_zgelqs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, #endif if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzunmlq(MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request); + morse_pzunmlq( MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request ); } else { - morse_pzunmlqrh(MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzunmlqrh( MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request ); } if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgelqs_param.c b/compute/zgelqs_param.c index ac5c26520b0d471eabea1a527630959d135dc55a..ffac93d2ef8e3972741a96e56b75d1cf76e24dca 100644 --- a/compute/zgelqs_param.c +++ b/compute/zgelqs_param.c @@ -83,17 +83,18 @@ * @sa MORSE_zgelqf * ******************************************************************************/ -int MORSE_zgelqs_param(const libhqr_tree_t *qrtree, int M, int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT, - MORSE_Complex64_t *B, int LDB) +int MORSE_zgelqs_param( const libhqr_tree_t *qrtree, int M, int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -137,37 +138,31 @@ int MORSE_zgelqs_param(const libhqr_tree_t *qrtree, int M, int N, int NRHS, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgelqs_param_Tile_Async(qrtree, &descA, descTS, descTT, &descB, sequence, &request); + MORSE_zgelqs_param_Tile_Async( qrtree, &descAt, descTS, descTT, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -213,7 +208,8 @@ int MORSE_zgelqs_param(const libhqr_tree_t *qrtree, int M, int N, int NRHS, * @sa MORSE_zgelqf_Tile * ******************************************************************************/ -int MORSE_zgelqs_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B) +int MORSE_zgelqs_param_Tile( const libhqr_tree_t *qrtree, MORSE_desc_t *A, + MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -225,14 +221,18 @@ int MORSE_zgelqs_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ morse_fatal_error("MORSE_zgelqs_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgelqs_param_Tile_Async(qrtree, A, TS, TT, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgelqs_param_Tile_Async( qrtree, A, TS, TT, B, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -266,8 +266,8 @@ int MORSE_zgelqs_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ * @sa MORSE_zgelqf_Tile_Async * ******************************************************************************/ -int MORSE_zgelqs_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgelqs_param_Tile_Async( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_desc_t *subB; MORSE_desc_t *subA; @@ -288,10 +288,12 @@ int MORSE_zgelqs_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -316,18 +318,18 @@ int MORSE_zgelqs_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { - return MORSE_SUCCESS; - } -*/ + /* + if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { + return MORSE_SUCCESS; + } + */ /* subB = morse_desc_submatrix(B, A->m, 0, A->n-A->m, B->n); - morse_pztile_zero(subB, sequence, request); - free(subB); */ + morse_pzlaset( MorseUpperLower, 0., 0., subB, sequence, request ); + free(subB); */ subB = morse_desc_submatrix(B, 0, 0, A->m, B->n); subA = morse_desc_submatrix(A, 0, 0, A->m, A->m); - morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); + morse_pztrsm( MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); free(subA); free(subB); @@ -339,9 +341,15 @@ int MORSE_zgelqs_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, } #endif - morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request); + morse_pzunmlq_param( qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request ); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgels.c b/compute/zgels.c index 4ab15cb6d82b1b12fb3cdc18df73a7f04abcb674..74d65ca46ff14367be7a567f941a1f87e5e7a15b 100644 --- a/compute/zgels.c +++ b/compute/zgels.c @@ -107,10 +107,10 @@ * @sa MORSE_sgels * ******************************************************************************/ -int MORSE_zgels(MORSE_enum trans, int M, int N, int NRHS, +int MORSE_zgels( MORSE_enum trans, int M, int N, int NRHS, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descT, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int i, j; int NB; @@ -118,7 +118,8 @@ int MORSE_zgels(MORSE_enum trans, int M, int N, int NRHS, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -169,51 +170,39 @@ int MORSE_zgels(MORSE_enum trans, int M, int N, int NRHS, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); + /* Submit the matrix conversion */ if ( M >= N ) { -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, M, NRHS, sequence, &request ); } else { -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); } /* Call the tile interface */ - MORSE_zgels_Tile_Async(MorseNoTrans, &descA, descT, &descB, sequence, &request); + MORSE_zgels_Tile_Async( MorseNoTrans, &descAt, descT, &descBt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -271,8 +260,8 @@ int MORSE_zgels(MORSE_enum trans, int M, int N, int NRHS, * @sa MORSE_sgels_Tile * ******************************************************************************/ -int MORSE_zgels_Tile(MORSE_enum trans, MORSE_desc_t *A, - MORSE_desc_t *T, MORSE_desc_t *B) +int MORSE_zgels_Tile( MORSE_enum trans, MORSE_desc_t *A, + MORSE_desc_t *T, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -284,14 +273,17 @@ int MORSE_zgels_Tile(MORSE_enum trans, MORSE_desc_t *A, morse_fatal_error("MORSE_zgels_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgels_Tile_Async(trans, A, T, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgels_Tile_Async( trans, A, T, B, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -324,9 +316,9 @@ int MORSE_zgels_Tile(MORSE_enum trans, MORSE_desc_t *A, * @sa MORSE_sgels_Tile_Async * ******************************************************************************/ -int MORSE_zgels_Tile_Async(MORSE_enum trans, MORSE_desc_t *A, - MORSE_desc_t *T, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgels_Tile_Async( MORSE_enum trans, MORSE_desc_t *A, + MORSE_desc_t *T, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_desc_t *subA; MORSE_desc_t *subB; @@ -347,10 +339,12 @@ int MORSE_zgels_Tile_Async(MORSE_enum trans, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -375,12 +369,12 @@ int MORSE_zgels_Tile_Async(MORSE_enum trans, MORSE_desc_t *A, return morse_request_fail(sequence, request, MORSE_ERR_NOT_SUPPORTED); } /* Quick return - currently NOT equivalent to LAPACK's: - if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { - for (i = 0; i < chameleon_max(M, N); i++) - for (j = 0; j < NRHS; j++) - B[j*LDB+i] = 0.0; - return MORSE_SUCCESS; - } + if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { + for (i = 0; i < chameleon_max(M, N); i++) + for (j = 0; j < NRHS; j++) + B[j*LDB+i] = 0.0; + return MORSE_SUCCESS; + } */ if (A->m >= A->n) { @@ -393,24 +387,24 @@ int MORSE_zgels_Tile_Async(MORSE_enum trans, MORSE_desc_t *A, #endif if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzgeqrf(A, T, Dptr, sequence, request); + morse_pzgeqrf( A, T, Dptr, sequence, request ); - morse_pzunmqr(MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request); + morse_pzunmqr( MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request ); } else { - morse_pzgeqrfrh(A, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzgeqrfrh( A, T, Dptr, MORSE_RHBLK, sequence, request ); - morse_pzunmqrrh(MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzunmqrrh( MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request ); } subB = morse_desc_submatrix(B, 0, 0, A->n, B->n); subA = morse_desc_submatrix(A, 0, 0, A->n, A->n); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); } else { /* subB = morse_desc_submatrix(B, A->m, 0, A->n-A->m, B->n); - morse_pztile_zero(subB, sequence, request); - free(subB); */ + morse_pzlaset( MorseUpperLower, 0., 0., subB, sequence, request ); + free(subB); */ #if defined(CHAMELEON_COPY_DIAG) { int m = chameleon_min(A->mt, A->nt) * A->mb; @@ -419,20 +413,20 @@ int MORSE_zgels_Tile_Async(MORSE_enum trans, MORSE_desc_t *A, } #endif if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzgelqf(A, T, Dptr, sequence, request); + morse_pzgelqf( A, T, Dptr, sequence, request ); } else { - morse_pzgelqfrh(A, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzgelqfrh( A, T, Dptr, MORSE_RHBLK, sequence, request ); } subB = morse_desc_submatrix(B, 0, 0, A->m, B->n); subA = morse_desc_submatrix(A, 0, 0, A->m, A->m); - morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); + morse_pztrsm( MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzunmlq(MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request); + morse_pzunmlq( MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request ); } else { - morse_pzunmlqrh(MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzunmlqrh( MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request ); } } @@ -440,7 +434,12 @@ int MORSE_zgels_Tile_Async(MORSE_enum trans, MORSE_desc_t *A, free(subB); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgels_param.c b/compute/zgels_param.c index 9e91871be2973d89a78be91aa3c2e788074d757f..5619b004a8cb233b87e1bb877440b836f621e1f9 100644 --- a/compute/zgels_param.c +++ b/compute/zgels_param.c @@ -109,10 +109,10 @@ * @sa MORSE_sgels * ******************************************************************************/ -int MORSE_zgels_param(const libhqr_tree_t *qrtree, MORSE_enum trans, int M, int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT, - MORSE_Complex64_t *B, int LDB) +int MORSE_zgels_param( const libhqr_tree_t *qrtree, MORSE_enum trans, int M, int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT, + MORSE_Complex64_t *B, int LDB ) { int i, j; int NB; @@ -120,7 +120,8 @@ int MORSE_zgels_param(const libhqr_tree_t *qrtree, MORSE_enum trans, int M, int MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -171,51 +172,38 @@ int MORSE_zgels_param(const libhqr_tree_t *qrtree, MORSE_enum trans, int M, int /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); + /* Submit the matrix conversion */ if ( M >= N ) { - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - /* } else {*/ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ - /* sequence, &request);*/ - /* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS,*/ - /* sequence, &request);*/ - /* }*/ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, M, NRHS, sequence, &request ); } else { - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - /* } else {*/ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ - /* sequence, &request);*/ - /* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ - /* sequence, &request);*/ - /* }*/ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); } /* Call the tile interface */ - MORSE_zgels_param_Tile_Async(qrtree, MorseNoTrans, &descA, descTS, descTT, &descB, sequence, &request); + MORSE_zgels_param_Tile_Async( qrtree, MorseNoTrans, &descAt, descTS, descTT, &descBt, sequence, &request ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - /* } else {*/ - /* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ - /* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ - /* morse_sequence_wait(morse, sequence);*/ - /* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -276,8 +264,8 @@ int MORSE_zgels_param(const libhqr_tree_t *qrtree, MORSE_enum trans, int M, int * @sa MORSE_sgels_Tile * ******************************************************************************/ -int MORSE_zgels_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum trans, MORSE_desc_t *A, - MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B) +int MORSE_zgels_param_Tile( const libhqr_tree_t *qrtree, MORSE_enum trans, MORSE_desc_t *A, + MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -289,14 +277,18 @@ int MORSE_zgels_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum trans, MORSE_ morse_fatal_error("MORSE_zgels_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgels_param_Tile_Async(qrtree, trans, A, TS, TT, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgels_param_Tile_Async( qrtree, trans, A, TS, TT, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( B, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -329,9 +321,9 @@ int MORSE_zgels_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum trans, MORSE_ * @sa MORSE_sgels_Tile_Async * ******************************************************************************/ -int MORSE_zgels_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum trans, MORSE_desc_t *A, - MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgels_param_Tile_Async( const libhqr_tree_t *qrtree, MORSE_enum trans, MORSE_desc_t *A, + MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_desc_t *subA; MORSE_desc_t *subB; @@ -352,10 +344,12 @@ int MORSE_zgels_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -404,9 +398,9 @@ int MORSE_zgels_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum trans, subB = morse_desc_submatrix(B, 0, 0, A->n, B->n); subA = morse_desc_submatrix(A, 0, 0, A->n, A->n); - morse_pzgeqrf_param(qrtree, A, TS, TT, Dptr, sequence, request); - morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); + morse_pzgeqrf_param( qrtree, A, TS, TT, Dptr, sequence, request ); + morse_pzunmqr_param( qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request ); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); } else { #if defined(CHAMELEON_COPY_DIAG) @@ -420,16 +414,22 @@ int MORSE_zgels_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum trans, subB = morse_desc_submatrix(B, 0, 0, A->m, B->n); subA = morse_desc_submatrix(A, 0, 0, A->m, A->m); - morse_pzgelqf_param(qrtree, A, TS, TT, Dptr, sequence, request); - morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); - morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request); + morse_pzgelqf_param( qrtree, A, TS, TT, Dptr, sequence, request ); + morse_pztrsm( MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); + morse_pzunmlq_param( qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request ); } free(subA); free(subB); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgemm.c b/compute/zgemm.c index 332b540061849362a78b9c4dc8d893e39ae56bbb..92101a69bb9e0f7ea48f6101e7332924e4837b1c 100644 --- a/compute/zgemm.c +++ b/compute/zgemm.c @@ -130,15 +130,17 @@ * @sa MORSE_sgemm * ******************************************************************************/ -int MORSE_zgemm(MORSE_enum transA, MORSE_enum transB, int M, int N, int K, +int MORSE_zgemm( MORSE_enum transA, MORSE_enum transB, int M, int N, int K, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB, - MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC) + MORSE_Complex64_t *B, int LDB, + MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC ) { int NB; int Am, An, Bm, Bn; int status; - MORSE_desc_t descA, descB, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; + MORSE_desc_t descCl, descCt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -208,43 +210,36 @@ int MORSE_zgemm(MORSE_enum transA, MORSE_enum transB, int M, int N, int K, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); - -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, Bn, 0, 0, Bm, Bn, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, Bn, 0, 0, Bm, Bn, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, */ -/* sequence, &request);*/ -/* }*/ + morse_sequence_create( morse, &sequence ); + + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInput, MorseUpperLower, + B, NB, NB, LDB, Bn, Bm, Bn, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgemm_Tile_Async( - transA, transB, alpha, &descA, &descB, beta, &descC, sequence, &request); - -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, Bn, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + MORSE_zgemm_Tile_Async( transA, transB, alpha, &descAt, &descBt, beta, &descCt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -305,9 +300,9 @@ int MORSE_zgemm(MORSE_enum transA, MORSE_enum transB, int M, int N, int K, * @sa MORSE_sgemm_Tile * ******************************************************************************/ -int MORSE_zgemm_Tile(MORSE_enum transA, MORSE_enum transB, - MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_Complex64_t beta, MORSE_desc_t *C) +int MORSE_zgemm_Tile( MORSE_enum transA, MORSE_enum transB, + MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_Complex64_t beta, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -319,15 +314,17 @@ int MORSE_zgemm_Tile(MORSE_enum transA, MORSE_enum transB, morse_fatal_error("MORSE_zgemm_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgemm_Tile_Async(transA, transB, alpha, A, B, beta, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgemm_Tile_Async( transA, transB, alpha, A, B, beta, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( C, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -359,10 +356,10 @@ int MORSE_zgemm_Tile(MORSE_enum transA, MORSE_enum transB, * @sa MORSE_sgemm_Tile_Async * ******************************************************************************/ -int MORSE_zgemm_Tile_Async(MORSE_enum transA, MORSE_enum transB, +int MORSE_zgemm_Tile_Async( MORSE_enum transA, MORSE_enum transB, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_Complex64_t beta, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; int M, N, K; @@ -383,10 +380,12 @@ int MORSE_zgemm_Tile_Async(MORSE_enum transA, MORSE_enum transB, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -461,11 +460,13 @@ int MORSE_zgemm_Tile_Async(MORSE_enum transA, MORSE_enum transB, K = An; /* Quick return */ - if (M == 0 || N == 0 || - ((alpha == (MORSE_Complex64_t)0.0 || K == 0) && beta == (MORSE_Complex64_t)1.0)) + if ( (M == 0) || (N == 0) || + (((alpha == (MORSE_Complex64_t)0.0) || (K == 0)) && (beta == (MORSE_Complex64_t)1.0)) ) + { return MORSE_SUCCESS; + } - morse_pzgemm(transA, transB, alpha, A, B, beta, C, sequence, request); + morse_pzgemm( transA, transB, alpha, A, B, beta, C, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgeqrf.c b/compute/zgeqrf.c index 5e500472b0dd8c3ed530b94c9e230b7833bd8172..6695351de0915ddcb7d5ff6dde9ba993b9f3b197 100644 --- a/compute/zgeqrf.c +++ b/compute/zgeqrf.c @@ -74,16 +74,16 @@ * @sa MORSE_zgeqrs * ******************************************************************************/ -int MORSE_zgeqrf(int M, int N, +int MORSE_zgeqrf( int M, int N, MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descT) + MORSE_desc_t *descT ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -119,30 +119,26 @@ int MORSE_zgeqrf(int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgeqrf_Tile_Async(&descA, descT, sequence, &request); + MORSE_zgeqrf_Tile_Async( &descAt, descT, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -185,7 +181,7 @@ int MORSE_zgeqrf(int M, int N, * @sa MORSE_zgeqrs_Tile * ******************************************************************************/ -int MORSE_zgeqrf_Tile(MORSE_desc_t *A, MORSE_desc_t *T) +int MORSE_zgeqrf_Tile( MORSE_desc_t *A, MORSE_desc_t *T ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -197,13 +193,16 @@ int MORSE_zgeqrf_Tile(MORSE_desc_t *A, MORSE_desc_t *T) morse_fatal_error("MORSE_zgeqrf_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgeqrf_Tile_Async(A, T, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgeqrf_Tile_Async( A, T, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -236,8 +235,8 @@ int MORSE_zgeqrf_Tile(MORSE_desc_t *A, MORSE_desc_t *T) * @sa MORSE_zgeqrs_Tile_Async * ******************************************************************************/ -int MORSE_zgeqrf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgeqrf_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *T, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -256,10 +255,12 @@ int MORSE_zgeqrf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -276,10 +277,10 @@ int MORSE_zgeqrf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, N) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, N) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int n = chameleon_min(A->mt, A->nt) * A->nb; @@ -289,13 +290,17 @@ int MORSE_zgeqrf_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, #endif if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzgeqrf(A, T, Dptr, sequence, request); + morse_pzgeqrf( A, T, Dptr, sequence, request ); } else { - morse_pzgeqrfrh(A, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzgeqrfrh( A, T, Dptr, MORSE_RHBLK, sequence, request ); } if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgeqrf_param.c b/compute/zgeqrf_param.c index a67f508db78185e1264e6935a0cfa379df024c1c..5e5b220f010c1ad2872a461b9df78e5b81167f8f 100644 --- a/compute/zgeqrf_param.c +++ b/compute/zgeqrf_param.c @@ -77,16 +77,16 @@ * @sa MORSE_zgeqrs * ******************************************************************************/ -int MORSE_zgeqrf_param(const libhqr_tree_t *qrtree, int M, int N, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT) +int MORSE_zgeqrf_param( const libhqr_tree_t *qrtree, int M, int N, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -122,30 +122,26 @@ int MORSE_zgeqrf_param(const libhqr_tree_t *qrtree, int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgeqrf_param_Tile_Async(qrtree, &descA, descTS, descTT, sequence, &request); + MORSE_zgeqrf_param_Tile_Async( qrtree, &descAt, descTS, descTT, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -192,7 +188,7 @@ int MORSE_zgeqrf_param(const libhqr_tree_t *qrtree, int M, int N, * @sa MORSE_zgeqrs_param_Tile * ******************************************************************************/ -int MORSE_zgeqrf_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT) +int MORSE_zgeqrf_param_Tile( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -204,13 +200,17 @@ int MORSE_zgeqrf_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ morse_fatal_error("MORSE_zgeqrf_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgeqrf_param_Tile_Async(qrtree, A, TS, TT, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgeqrf_param_Tile_Async( qrtree, A, TS, TT, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -243,8 +243,8 @@ int MORSE_zgeqrf_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ * @sa MORSE_zgeqrs_param_Tile_Async * ******************************************************************************/ -int MORSE_zgeqrf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgeqrf_param_Tile_Async( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -263,10 +263,12 @@ int MORSE_zgeqrf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -287,10 +289,10 @@ int MORSE_zgeqrf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, N) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, N) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int n = chameleon_min(A->mt, A->nt) * A->nb; @@ -299,10 +301,15 @@ int MORSE_zgeqrf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, } #endif - morse_pzgeqrf_param(qrtree, A, TS, TT, Dptr, sequence, request); + morse_pzgeqrf_param( qrtree, A, TS, TT, Dptr, sequence, request ); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgeqrs.c b/compute/zgeqrs.c index 29b962f4f6c5f20483682f54eff2822ee9402edc..d8de43c6ebff5b2c2974ca2e9c2babc10cd60d89 100644 --- a/compute/zgeqrs.c +++ b/compute/zgeqrs.c @@ -81,17 +81,18 @@ * @sa MORSE_zgeqrf * *******************************************************************************/ -int MORSE_zgeqrs(int M, int N, int NRHS, +int MORSE_zgeqrs( int M, int N, int NRHS, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descT, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -135,37 +136,31 @@ int MORSE_zgeqrs(int M, int N, int NRHS, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, M, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgeqrs_Tile_Async(&descA, descT, &descB, sequence, &request); + MORSE_zgeqrs_Tile_Async( &descAt, descT, &descBt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -207,7 +202,7 @@ int MORSE_zgeqrs(int M, int N, int NRHS, * @sa MORSE_zgeqrf_Tile * ******************************************************************************/ -int MORSE_zgeqrs_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B) +int MORSE_zgeqrs_Tile( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -219,15 +214,17 @@ int MORSE_zgeqrs_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B) morse_fatal_error("MORSE_zgeqrs_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgeqrs_Tile_Async(A, T, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( T, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + MORSE_zgeqrs_Tile_Async( A, T, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -261,8 +258,8 @@ int MORSE_zgeqrs_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B) * @sa MORSE_zgeqrf_Tile_Async * ******************************************************************************/ -int MORSE_zgeqrs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgeqrs_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_desc_t *subA; MORSE_desc_t *subB; @@ -283,10 +280,12 @@ int MORSE_zgeqrs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -307,11 +306,11 @@ int MORSE_zgeqrs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { - return MORSE_SUCCESS; - } -*/ + /* + if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) { + return MORSE_SUCCESS; + } + */ #if defined(CHAMELEON_COPY_DIAG) { int n = chameleon_min(A->mt, A->nt) * A->nb; @@ -321,20 +320,25 @@ int MORSE_zgeqrs_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B, #endif if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzunmqr(MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request); + morse_pzunmqr( MorseLeft, MorseConjTrans, A, B, T, Dptr, sequence, request ); } else { - morse_pzunmqrrh(MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzunmqrrh( MorseLeft, MorseConjTrans, A, B, T, Dptr, MORSE_RHBLK, sequence, request ); } subB = morse_desc_submatrix(B, 0, 0, A->n, B->n); subA = morse_desc_submatrix(A, 0, 0, A->n, A->n); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); free(subA); free(subB); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgeqrs_param.c b/compute/zgeqrs_param.c index 6e6cb28b394e3b1d815757968cd6dcbf5ae56ae6..cd7f17b6b5ec4601db4ac7457bea27eca6f8fb80 100644 --- a/compute/zgeqrs_param.c +++ b/compute/zgeqrs_param.c @@ -76,17 +76,18 @@ * @sa MORSE_zgeqrf * *******************************************************************************/ -int MORSE_zgeqrs_param(const libhqr_tree_t *qrtree, int M, int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT, - MORSE_Complex64_t *B, int LDB) +int MORSE_zgeqrs_param( const libhqr_tree_t *qrtree, int M, int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -130,37 +131,31 @@ int MORSE_zgeqrs_param(const libhqr_tree_t *qrtree, int M, int N, int NRHS, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, M, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgeqrs_param_Tile_Async(qrtree, &descA, descTS, descTT, &descB, sequence, &request); + MORSE_zgeqrs_param_Tile_Async( qrtree, &descAt, descTS, descTT, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -202,7 +197,8 @@ int MORSE_zgeqrs_param(const libhqr_tree_t *qrtree, int M, int N, int NRHS, * @sa MORSE_zgeqrf_Tile * ******************************************************************************/ -int MORSE_zgeqrs_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B) +int MORSE_zgeqrs_param_Tile( const libhqr_tree_t *qrtree, MORSE_desc_t *A, + MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -214,16 +210,18 @@ int MORSE_zgeqrs_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ morse_fatal_error("MORSE_zgeqrs_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgeqrs_param_Tile_Async(qrtree, A, TS, TT, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( TS, sequence ); - RUNTIME_desc_flush( TT, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgeqrs_param_Tile_Async( qrtree, A, TS, TT, B, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -257,9 +255,9 @@ int MORSE_zgeqrs_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ * @sa MORSE_zgeqrf_Tile_Async * ******************************************************************************/ -int MORSE_zgeqrs_param_Tile_Async(const libhqr_tree_t *qrtree, - MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgeqrs_param_Tile_Async( const libhqr_tree_t *qrtree, + MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_desc_t *subA; MORSE_desc_t *subB; @@ -280,10 +278,12 @@ int MORSE_zgeqrs_param_Tile_Async(const libhqr_tree_t *qrtree, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -324,14 +324,20 @@ int MORSE_zgeqrs_param_Tile_Async(const libhqr_tree_t *qrtree, subB = morse_desc_submatrix(B, 0, 0, A->n, B->n); subA = morse_desc_submatrix(A, 0, 0, A->n, A->n); - morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request); + morse_pzunmqr_param( qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request ); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request ); free(subA); free(subB); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgesv_incpiv.c b/compute/zgesv_incpiv.c index ca0ca1e6a74dfa96cce66e4616ebd1be54f4af4c..700f6b02e960c8723090f567f33107b467f6dddc 100644 --- a/compute/zgesv_incpiv.c +++ b/compute/zgesv_incpiv.c @@ -86,17 +86,18 @@ * @sa MORSE_sgesv_incpiv * ******************************************************************************/ -int MORSE_zgesv_incpiv(int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descL, int *IPIV, - MORSE_Complex64_t *B, int LDB) +int MORSE_zgesv_incpiv( int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descL, int *IPIV, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -134,37 +135,31 @@ int MORSE_zgesv_incpiv(int N, int NRHS, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgesv_incpiv_Tile_Async(&descA, descL, IPIV, &descB, sequence, &request); + MORSE_zgesv_incpiv_Tile_Async( &descAt, descL, IPIV, &descBt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -212,7 +207,7 @@ int MORSE_zgesv_incpiv(int N, int NRHS, * @sa MORSE_zcgesv_Tile * ******************************************************************************/ -int MORSE_zgesv_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B) +int MORSE_zgesv_incpiv_Tile( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -224,14 +219,17 @@ int MORSE_zgesv_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_d morse_fatal_error("MORSE_zgesv_incpiv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgesv_incpiv_Tile_Async(A, L, IPIV, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zgesv_incpiv_Tile_Async( A, L, IPIV, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( L, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -265,8 +263,8 @@ int MORSE_zgesv_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_d * @sa MORSE_zcgesv_Tile_Async * ******************************************************************************/ -int MORSE_zgesv_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgesv_incpiv_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -284,10 +282,12 @@ int MORSE_zgesv_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, M return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -308,16 +308,16 @@ int MORSE_zgesv_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, M return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ - morse_pzgetrf_incpiv(A, L, IPIV, sequence, request); + morse_pzgetrf_incpiv( A, L, IPIV, sequence, request ); - morse_pztrsmpl(A, B, L, IPIV, sequence, request); + morse_pztrsmpl( A, B, L, IPIV, sequence, request ); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgesv_nopiv.c b/compute/zgesv_nopiv.c index bc0d9bdf9d3fd297954c2a6cc14d692c59002705..0a5753ad3753d7cef81d1f2a6f91be709d16df02 100644 --- a/compute/zgesv_nopiv.c +++ b/compute/zgesv_nopiv.c @@ -86,16 +86,17 @@ * @sa MORSE_sgesv_nopiv * ******************************************************************************/ -int MORSE_zgesv_nopiv(int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) +int MORSE_zgesv_nopiv( int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -133,37 +134,31 @@ int MORSE_zgesv_nopiv(int N, int NRHS, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgesv_nopiv_Tile_Async(&descA, &descB, sequence, &request); + MORSE_zgesv_nopiv_Tile_Async( &descAt, &descBt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -204,7 +199,7 @@ int MORSE_zgesv_nopiv(int N, int NRHS, * @sa MORSE_zcgesv_Tile * ******************************************************************************/ -int MORSE_zgesv_nopiv_Tile(MORSE_desc_t *A, MORSE_desc_t *B) +int MORSE_zgesv_nopiv_Tile( MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -216,14 +211,16 @@ int MORSE_zgesv_nopiv_Tile(MORSE_desc_t *A, MORSE_desc_t *B) morse_fatal_error("MORSE_zgesv_nopiv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgesv_nopiv_Tile_Async(A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zgesv_nopiv_Tile_Async( A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -257,8 +254,8 @@ int MORSE_zgesv_nopiv_Tile(MORSE_desc_t *A, MORSE_desc_t *B) * @sa MORSE_zcgesv_Tile_Async * ******************************************************************************/ -int MORSE_zgesv_nopiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgesv_nopiv_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -276,10 +273,12 @@ int MORSE_zgesv_nopiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -296,16 +295,16 @@ int MORSE_zgesv_nopiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *B, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ - morse_pzgetrf_nopiv(A, sequence, request); + morse_pzgetrf_nopiv( A, sequence, request ); - morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, MorseLower, MorseNoTrans, MorseUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request ); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgesvd.c b/compute/zgesvd.c index 968c0a01b427303b55a50c8574231d407222a849..ba35c4da4e0164dbe0bb319ffea38209cbaa41b1 100644 --- a/compute/zgesvd.c +++ b/compute/zgesvd.c @@ -147,20 +147,20 @@ * @sa MORSE_sgesvd * ******************************************************************************/ -int MORSE_zgesvd(MORSE_enum jobu, MORSE_enum jobvt, +int MORSE_zgesvd( MORSE_enum jobu, MORSE_enum jobvt, int M, int N, MORSE_Complex64_t *A, int LDA, double *S, MORSE_desc_t *descT, MORSE_Complex64_t *U, int LDU, - MORSE_Complex64_t *VT, int LDVT) + MORSE_Complex64_t *VT, int LDVT ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -212,30 +212,26 @@ int MORSE_zgesvd(MORSE_enum jobu, MORSE_enum jobvt, /* Set MT, NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - /* } else { */ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, */ - /* sequence, &request); */ - /* } */ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgesvd_Tile_Async(jobu, jobvt, &descA, S, descT, U, LDU, VT, LDVT, sequence, &request); + MORSE_zgesvd_Tile_Async( jobu, jobvt, &descAt, S, descT, U, LDU, VT, LDVT, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooptile2lap( descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - /* } else { */ - /* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request); */ - /* morse_sequence_wait(morse, sequence); */ - /* } */ + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -339,16 +335,16 @@ int MORSE_zgesvd(MORSE_enum jobu, MORSE_enum jobvt, * @sa MORSE_sgesvd_Tile * ******************************************************************************/ -int MORSE_zgesvd_Tile(MORSE_enum jobu, MORSE_enum jobvt, - MORSE_desc_t *A, - double *S, - MORSE_desc_t *T, - MORSE_Complex64_t *U, int LDU, - MORSE_Complex64_t *VT, int LDVT) +int MORSE_zgesvd_Tile( MORSE_enum jobu, MORSE_enum jobvt, + MORSE_desc_t *A, + double *S, + MORSE_desc_t *T, + MORSE_Complex64_t *U, int LDU, + MORSE_Complex64_t *VT, int LDVT ) { - MORSE_context_t *morse; + MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; - MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + MORSE_request_t request = MORSE_REQUEST_INITIALIZER; int status; morse = morse_context_self(); @@ -356,11 +352,16 @@ int MORSE_zgesvd_Tile(MORSE_enum jobu, MORSE_enum jobvt, morse_fatal_error("MORSE_zgesvd_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgesvd_Tile_Async(jobu, jobvt, A, S, T, U, LDU, VT, LDVT, sequence, &request); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgesvd_Tile_Async( jobu, jobvt, A, S, T, U, LDU, VT, LDVT, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -394,17 +395,18 @@ int MORSE_zgesvd_Tile(MORSE_enum jobu, MORSE_enum jobvt, * @sa MORSE_sgesvd_Tile_Async * ******************************************************************************/ -int MORSE_zgesvd_Tile_Async(MORSE_enum jobu, MORSE_enum jobvt, - MORSE_desc_t *A, - double *S, - MORSE_desc_t *T, - MORSE_Complex64_t *U, int LDU, - MORSE_Complex64_t *VT, int LDVT, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgesvd_Tile_Async( MORSE_enum jobu, MORSE_enum jobvt, + MORSE_desc_t *A, + double *S, + MORSE_desc_t *T, + MORSE_Complex64_t *U, int LDU, + MORSE_Complex64_t *VT, int LDVT, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_desc_t descA; MORSE_desc_t descT; - MORSE_desc_t descU, descVT; + MORSE_desc_t descU; + MORSE_desc_t descVT; MORSE_desc_t descAB; MORSE_desc_t D, *Dptr = NULL; MORSE_desc_t *subA, *subT, *subUVT; @@ -430,10 +432,12 @@ int MORSE_zgesvd_Tile_Async(MORSE_enum jobu, MORSE_enum jobvt, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -534,7 +538,7 @@ int MORSE_zgesvd_Tile_Async(MORSE_enum jobu, MORSE_enum jobvt, } } - morse_sequence_wait(morse, sequence); + morse_sequence_wait( morse, sequence ); #if !defined(CHAMELEON_SIMULATION) info = LAPACKE_zgbbrd( LAPACK_COL_MAJOR, @@ -550,16 +554,17 @@ int MORSE_zgesvd_Tile_Async(MORSE_enum jobu, MORSE_enum jobvt, fprintf(stderr, "MORSE_zgesvd_Tile_Async: LAPACKE_zgbbrd = %d\n", info ); } #endif /* !defined(CHAMELEON_SIMULATION) */ - morse_desc_mat_free(&descAB); + 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)) ); + //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_zooplap2tile( descVT, VT, NB, NB, LDVT, N, 0, 0, N, N, sequence, request, morse_desc_mat_free(&(descVT)) ); } - morse_sequence_wait(morse, sequence); + + morse_sequence_wait( morse, sequence ); subA = NULL; subT = NULL; @@ -598,13 +603,14 @@ int MORSE_zgesvd_Tile_Async(MORSE_enum jobu, MORSE_enum jobvt, /* Transform U and VT into lapack layout */ if ( jobu != MorseNoVec ) { - morse_zooptile2lap( descU, U, NB, NB, LDU, M, sequence, request ); + //morse_zooptile2lap( descU, U, NB, NB, LDU, M, sequence, request ); } if ( jobvt != MorseNoVec ) { - morse_zooptile2lap( descVT, VT, NB, NB, LDVT, N, sequence, request ); + //morse_zooptile2lap( descVT, VT, NB, NB, LDVT, N, sequence, request ); } - morse_sequence_wait(morse, sequence); + morse_sequence_wait( morse, sequence ); + if (subA) { free(subA); free(subUVT); free(subT); } @@ -627,7 +633,7 @@ int MORSE_zgesvd_Tile_Async(MORSE_enum jobu, MORSE_enum jobvt, morse_desc_mat_free( &descVT ); free(E); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zgetrf_incpiv.c b/compute/zgetrf_incpiv.c index aaf96f147bfdf88424c2200fd29eb645e005aa47..a86915d081d5b92b07269f534348dc985c023f7d 100644 --- a/compute/zgetrf_incpiv.c +++ b/compute/zgetrf_incpiv.c @@ -78,16 +78,16 @@ * @sa MORSE_zgetrs_incpiv * ******************************************************************************/ -int MORSE_zgetrf_incpiv(int M, int N, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descL, int *IPIV) +int MORSE_zgetrf_incpiv( int M, int N, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descL, int *IPIV ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -121,30 +121,26 @@ int MORSE_zgetrf_incpiv(int M, int N, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgetrf_incpiv_Tile_Async(&descA, descL, IPIV, sequence, &request); + MORSE_zgetrf_incpiv_Tile_Async( &descAt, descL, IPIV, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -190,7 +186,7 @@ int MORSE_zgetrf_incpiv(int M, int N, * @sa MORSE_zgetrs_incpiv_Tile * ******************************************************************************/ -int MORSE_zgetrf_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV) +int MORSE_zgetrf_incpiv_Tile( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -202,13 +198,16 @@ int MORSE_zgetrf_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV) morse_fatal_error("MORSE_zgetrf_incpiv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgetrf_incpiv_Tile_Async(A, L, IPIV, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgetrf_incpiv_Tile_Async( A, L, IPIV, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( L, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -241,8 +240,8 @@ int MORSE_zgetrf_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV) * @sa MORSE_zgetrs_incpiv_Tile_Async * ******************************************************************************/ -int MORSE_zgetrf_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgetrf_incpiv_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -260,10 +259,12 @@ int MORSE_zgetrf_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -280,12 +281,12 @@ int MORSE_zgetrf_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(M, N) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, N) == 0) + return MORSE_SUCCESS; + */ - morse_pzgetrf_incpiv(A, L, IPIV, sequence, request); + morse_pzgetrf_incpiv( A, L, IPIV, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgetrf_nopiv.c b/compute/zgetrf_nopiv.c index 5e56c4a8b6bd8dffd399385ebc61bcf2ac52ea36..cf44857a8df9ac437e6b9bd4ef6b5c84de571d94 100644 --- a/compute/zgetrf_nopiv.c +++ b/compute/zgetrf_nopiv.c @@ -72,12 +72,12 @@ * @sa MORSE_sgetrf_nopiv * ******************************************************************************/ -int MORSE_zgetrf_nopiv(int M, int N, - MORSE_Complex64_t *A, int LDA) +int MORSE_zgetrf_nopiv( int M, int N, + MORSE_Complex64_t *A, int LDA ) { int NB; int status; - MORSE_desc_t descA ; + MORSE_desc_t descAl, descAt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -114,32 +114,26 @@ int MORSE_zgetrf_nopiv(int M, int N, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, - sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpperLower, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zgetrf_nopiv_Tile_Async(&descA, sequence, &request); + MORSE_zgetrf_nopiv_Tile_Async( &descAt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request ); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N,*/ -/* sequence, &request );*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -178,7 +172,7 @@ int MORSE_zgetrf_nopiv(int M, int N, * @sa MORSE_zgetrs_Tile * ******************************************************************************/ -int MORSE_zgetrf_nopiv_Tile(MORSE_desc_t *A) +int MORSE_zgetrf_nopiv_Tile( MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -190,13 +184,15 @@ int MORSE_zgetrf_nopiv_Tile(MORSE_desc_t *A) morse_fatal_error("MORSE_zgetrf_nopiv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgetrf_nopiv_Tile_Async(A, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zgetrf_nopiv_Tile_Async( A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -233,9 +229,9 @@ int MORSE_zgetrf_nopiv_Tile(MORSE_desc_t *A) * @sa MORSE_zgetrs_Tile_Async * ******************************************************************************/ -int MORSE_zgetrf_nopiv_Tile_Async(MORSE_desc_t *A, - MORSE_sequence_t *sequence, - MORSE_request_t *request) +int MORSE_zgetrf_nopiv_Tile_Async( MORSE_desc_t *A, + MORSE_sequence_t *sequence, + MORSE_request_t *request ) { MORSE_context_t *morse; @@ -253,10 +249,12 @@ int MORSE_zgetrf_nopiv_Tile_Async(MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -270,7 +268,7 @@ int MORSE_zgetrf_nopiv_Tile_Async(MORSE_desc_t *A, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - morse_pzgetrf_nopiv(A, sequence, request); + morse_pzgetrf_nopiv( A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgetrs_incpiv.c b/compute/zgetrs_incpiv.c index 195b0895d444eb00ca8e7b5ad70bff8bd06a5800..f877c8aa38b8d1ab39c86809842803384e53ba85 100644 --- a/compute/zgetrs_incpiv.c +++ b/compute/zgetrs_incpiv.c @@ -88,17 +88,18 @@ * @sa MORSE_zgetrf_incpiv * ******************************************************************************/ -int MORSE_zgetrs_incpiv(MORSE_enum trans, int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descL, int *IPIV, - MORSE_Complex64_t *B, int LDB) +int MORSE_zgetrs_incpiv( MORSE_enum trans, int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descL, int *IPIV, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -140,36 +141,31 @@ int MORSE_zgetrs_incpiv(MORSE_enum trans, int N, int NRHS, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgetrs_incpiv_Tile_Async(&descA, descL, IPIV, &descB, sequence, &request); + MORSE_zgetrs_incpiv_Tile_Async( &descAt, descL, IPIV, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -215,7 +211,7 @@ int MORSE_zgetrs_incpiv(MORSE_enum trans, int N, int NRHS, * @sa MORSE_zgetrf_incpiv_Tile * ******************************************************************************/ -int MORSE_zgetrs_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B) +int MORSE_zgetrs_incpiv_Tile( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -227,14 +223,17 @@ int MORSE_zgetrs_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_ morse_fatal_error("MORSE_zgetrs_incpiv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgetrs_incpiv_Tile_Async(A, L, IPIV, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zgetrs_incpiv_Tile_Async( A, L, IPIV, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( L, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -268,8 +267,8 @@ int MORSE_zgetrs_incpiv_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_ * @sa MORSE_zgetrf_incpiv_Tile_Async * ******************************************************************************/ -int MORSE_zgetrs_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgetrs_incpiv_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -287,10 +286,12 @@ int MORSE_zgetrs_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -311,13 +312,13 @@ int MORSE_zgetrs_incpiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ - morse_pztrsmpl(A, B, L, IPIV, sequence, request); + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ + morse_pztrsmpl( A, B, L, IPIV, sequence, request ); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zgetrs_nopiv.c b/compute/zgetrs_nopiv.c index f92c66abf05da77ee81aa117a5ac2f1d21411e03..7833e3eafad5da98d755e1af57c94b89dd3c94d0 100644 --- a/compute/zgetrs_nopiv.c +++ b/compute/zgetrs_nopiv.c @@ -83,16 +83,17 @@ * @sa MORSE_zgetrf_nopiv * ******************************************************************************/ -int MORSE_zgetrs_nopiv(MORSE_enum trans, int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) +int MORSE_zgetrs_nopiv( MORSE_enum trans, int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -134,36 +135,31 @@ int MORSE_zgetrs_nopiv(MORSE_enum trans, int N, int NRHS, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zgetrs_nopiv_Tile_Async(&descA, &descB, sequence, &request); + MORSE_zgetrs_nopiv_Tile_Async( &descAt, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -203,7 +199,7 @@ int MORSE_zgetrs_nopiv(MORSE_enum trans, int N, int NRHS, * @sa MORSE_zgetrf_nopiv_Tile * ******************************************************************************/ -int MORSE_zgetrs_nopiv_Tile(MORSE_desc_t *A, MORSE_desc_t *B) +int MORSE_zgetrs_nopiv_Tile( MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -215,14 +211,16 @@ int MORSE_zgetrs_nopiv_Tile(MORSE_desc_t *A, MORSE_desc_t *B) morse_fatal_error("MORSE_zgetrs_nopiv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zgetrs_nopiv_Tile_Async(A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zgetrs_nopiv_Tile_Async( A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -256,8 +254,8 @@ int MORSE_zgetrs_nopiv_Tile(MORSE_desc_t *A, MORSE_desc_t *B) * @sa MORSE_zgetrf_nopiv_Tile_Async * ******************************************************************************/ -int MORSE_zgetrs_nopiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zgetrs_nopiv_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -275,10 +273,12 @@ int MORSE_zgetrs_nopiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -295,13 +295,13 @@ int MORSE_zgetrs_nopiv_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *B, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ - morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request); + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ + morse_pztrsm( MorseLeft, MorseLower, MorseNoTrans, MorseUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request ); - morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, (MORSE_Complex64_t)1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zheevd.c b/compute/zheevd.c index 8094b590b35474f80f0740ba8a04389eeb557b6b..7346739297368b2bdc181beeaf0a99385fe418ee 100644 --- a/compute/zheevd.c +++ b/compute/zheevd.c @@ -100,17 +100,17 @@ * @sa MORSE_ssyev * ******************************************************************************/ -int MORSE_zheevd(MORSE_enum jobz, MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA, - double *W, - MORSE_desc_t *descT) +int MORSE_zheevd( MORSE_enum jobz, MORSE_enum uplo, int N, + MORSE_Complex64_t *A, int LDA, + double *W, + MORSE_desc_t *descT ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -123,7 +123,7 @@ int MORSE_zheevd(MORSE_enum jobz, MORSE_enum uplo, int N, morse_error("MORSE_zheevd", "illegal value of jobz"); return -1; } - if (uplo != MorseLower && uplo != MorseUpper) { + if ((uplo != MorseLower) && (uplo != MorseUpper)) { morse_error("MORSE_zheevd", "illegal value of uplo"); return -2; } @@ -150,30 +150,26 @@ int MORSE_zheevd(MORSE_enum jobz, MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - /* } else { */ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ - /* sequence, &requoest); */ - /* } */ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zheevd_Tile_Async(jobz, uplo, &descA, W, descT, sequence, &request); + MORSE_zheevd_Tile_Async( jobz, uplo, &descAt, W, descT, sequence, &request ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooptile2lap( descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - /* } else { */ - /* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request); */ - /* morse_sequence_wait(morse, sequence); */ - /* } */ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -244,12 +240,12 @@ int MORSE_zheevd(MORSE_enum jobz, MORSE_enum uplo, int N, * @sa MORSE_ssyev * ******************************************************************************/ -int MORSE_zheevd_Tile(MORSE_enum jobz, MORSE_enum uplo, - MORSE_desc_t *A, double *W, MORSE_desc_t *T) +int MORSE_zheevd_Tile( MORSE_enum jobz, MORSE_enum uplo, + MORSE_desc_t *A, double *W, MORSE_desc_t *T ) { - MORSE_context_t *morse; + MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; - MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + MORSE_request_t request = MORSE_REQUEST_INITIALIZER; int status; morse = morse_context_self(); @@ -257,14 +253,16 @@ int MORSE_zheevd_Tile(MORSE_enum jobz, MORSE_enum uplo, morse_fatal_error("MORSE_zheevd_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zheevd_Tile_Async(jobz, uplo, A, W, T, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( T, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + MORSE_zheevd_Tile_Async( jobz, uplo, A, W, T, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -334,19 +332,20 @@ int MORSE_zheevd_Tile(MORSE_enum jobz, MORSE_enum uplo, * @sa MORSE_ssyev_Tile_Async * ******************************************************************************/ -int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, - MORSE_desc_t *A, double *W, MORSE_desc_t *T, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zheevd_Tile_Async( MORSE_enum jobz, MORSE_enum uplo, + MORSE_desc_t *A, double *W, MORSE_desc_t *T, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t descA; MORSE_desc_t descT; MORSE_desc_t D, *Dptr = NULL; MORSE_Complex64_t *Q2; - int N, NB, status; + int N, status; double *E; MORSE_Complex64_t *V; - MORSE_desc_t descQ2, descV; + MORSE_desc_t descQ2; + MORSE_desc_t descV; MORSE_desc_t *subA, *subQ, *subT; morse = morse_context_self(); @@ -363,10 +362,12 @@ int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -386,7 +387,7 @@ int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, morse_error("MORSE_zheevd_Tile_Async", "illegal value of jobz"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseLower && uplo != MorseUpper) { + if ((uplo != MorseLower) && (uplo != MorseUpper)) { morse_error("MORSE_zheevd_Tile_Async", "illegal value of uplo"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } @@ -399,8 +400,7 @@ int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - N = descA.m; - NB = chameleon_min(descA.mb,descA.m); + N = descA.m; /* Allocate data structures for reduction to tridiagonal form */ E = malloc( (N - 1) * sizeof(double) ); @@ -425,7 +425,6 @@ int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, morse_error("MORSE_zheevd_Tile", "MORSE_zhetrd failed"); } - if (jobz == MorseNoVec){ #if !defined(CHAMELEON_SIMULATION) /* Tridiagonal eigensolver */ @@ -469,21 +468,21 @@ int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, /* Q from MORSE_zhetrd refers to Q2 (lapack layout) */ /* V from LAPACKE_zstedc refers to V (lapack layout) */ /* The final eigenvectors are (Q1 Q2 V) or (Q1^h Q2 V) */ - morse_zooplap2tile( descQ2, Q2, NB, NB, N, N, 0, 0, N, N, sequence, request, - morse_desc_mat_free(&(descQ2)) ); - morse_zooplap2tile( descV, V, NB, NB, N, N, 0, 0, N, N, sequence, request, - morse_desc_mat_free(&(descQ2)); morse_desc_mat_free(&(descV)) ); + /* morse_zooplap2tile( descQ2, Q2, NB, NB, N, N, 0, 0, N, N, sequence, request, */ + /* morse_desc_mat_free( &descQ2 ) ); */ + /* morse_zooplap2tile( descV, V, NB, NB, N, N, 0, 0, N, N, sequence, request, */ + /* morse_desc_mat_free(&(descQ2)); morse_desc_mat_free(&(descV)) ); */ if (uplo == MorseLower) { #if defined(CHAMELEON_COPY_DIAG) - { - int n = chameleon_min(A->mt, A->nt) * A->nb; - morse_zdesc_alloc(D, A->mb, A->nb, A->m, n, 0, 0, A->m, n, ); - Dptr = &D; - } + { + int n = chameleon_min(A->mt, A->nt) * A->nb; + morse_zdesc_alloc(D, A->mb, A->nb, A->m, n, 0, 0, A->m, n, ); + Dptr = &D; + } #endif subA = morse_desc_submatrix(&descA, descA.mb, 0, descA.m -descA.mb, descA.n-descA.nb); - subQ = morse_desc_submatrix(&descQ2, descQ2.mb, 0, descQ2.m-descQ2.mb, descQ2.n ); + subQ = morse_desc_submatrix(&descQ2, descQ2.mb, 0, descQ2.m-descQ2.mb, descQ2.n ); subT = morse_desc_submatrix(&descT, descT.mb, 0, descT.m -descT.mb, descT.n-descT.nb); /* Compute Q2 = Q1 * Q2 */ @@ -495,19 +494,19 @@ int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, morse_pzgemm( MorseNoTrans, MorseNoTrans, 1.0, &descQ2, &descV, 0.0, &descA, - sequence, request); + sequence, request ); } else { #if defined(CHAMELEON_COPY_DIAG) - { - int m = chameleon_min(A->mt, A->nt) * A->mb; - morse_zdesc_alloc(D, A->mb, A->nb, m, A->n, 0, 0, m, A->n, ); - Dptr = &D; - } + { + int m = chameleon_min(A->mt, A->nt) * A->mb; + morse_zdesc_alloc(D, A->mb, A->nb, m, A->n, 0, 0, m, A->n, ); + Dptr = &D; + } #endif subA = morse_desc_submatrix(&descA, 0, descA.nb, descA.m -descA.mb, descA.n -descA.nb ); - subQ = morse_desc_submatrix(&descQ2, descQ2.mb, 0, descQ2.m-descQ2.mb, descQ2.n ); + subQ = morse_desc_submatrix(&descQ2, descQ2.mb, 0, descQ2.m-descQ2.mb, descQ2.n ); subT = morse_desc_submatrix(&descT, 0, descT.nb, descT.m -descT.mb, descT.n -descT.nb ); /* Compute Q2 = Q1^h * Q2 */ @@ -519,21 +518,22 @@ int MORSE_zheevd_Tile_Async(MORSE_enum jobz, MORSE_enum uplo, morse_pzgemm( MorseNoTrans, MorseNoTrans, 1.0, &descQ2, &descV, 0.0, &descA, - sequence, request); + sequence, request ); } - morse_sequence_wait(morse, sequence); + morse_sequence_wait( morse, sequence ); free(subA); free(subQ); free(subT); - morse_desc_mat_free(&descQ2); + morse_desc_mat_free( &descQ2 ); free(Q2); - morse_desc_mat_free(&descV); + /* Cleanup the temporary data */ + morse_desc_mat_free( &descV ); free(V); free(E); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zhemm.c b/compute/zhemm.c index 5b6b31852f6335f10dde0a428acb5988abb6338d..ce06a71dab415bba74aa660e34c21b270d79bfab 100644 --- a/compute/zhemm.c +++ b/compute/zhemm.c @@ -106,15 +106,17 @@ * @sa MORSE_shemm * ******************************************************************************/ -int MORSE_zhemm(MORSE_enum side, MORSE_enum uplo, int M, int N, +int MORSE_zhemm( MORSE_enum side, MORSE_enum uplo, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB, - MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC) + MORSE_Complex64_t *B, int LDB, + MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC ) { int NB; int Am; int status; - MORSE_desc_t descA, descB, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; + MORSE_desc_t descCl, descCt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -171,43 +173,36 @@ int MORSE_zhemm(MORSE_enum side, MORSE_enum uplo, int M, int N, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, Am, 0, 0, Am, Am, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, Am, 0, 0, Am, Am,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, Am, Am, Am, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInput, MorseUpperLower, + B, NB, NB, LDB, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zhemm_Tile_Async( - side, uplo, alpha, &descA, &descB, beta, &descC, sequence, &request); + MORSE_zhemm_Tile_Async( side, uplo, alpha, &descAt, &descBt, beta, &descCt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, Am, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, N, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -270,9 +265,9 @@ int MORSE_zhemm(MORSE_enum side, MORSE_enum uplo, int M, int N, * @sa MORSE_shemm_Tile * ******************************************************************************/ -int MORSE_zhemm_Tile(MORSE_enum side, MORSE_enum uplo, +int MORSE_zhemm_Tile( MORSE_enum side, MORSE_enum uplo, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_Complex64_t beta, MORSE_desc_t *C) + MORSE_Complex64_t beta, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -284,15 +279,17 @@ int MORSE_zhemm_Tile(MORSE_enum side, MORSE_enum uplo, morse_fatal_error("MORSE_zhemm_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zhemm_Tile_Async(side, uplo, alpha, A, B, beta, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zhemm_Tile_Async(side, uplo, alpha, A, B, beta, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -324,10 +321,10 @@ int MORSE_zhemm_Tile(MORSE_enum side, MORSE_enum uplo, * @sa MORSE_shemm_Tile_Async * ******************************************************************************/ -int MORSE_zhemm_Tile_Async(MORSE_enum side, MORSE_enum uplo, +int MORSE_zhemm_Tile_Async( MORSE_enum side, MORSE_enum uplo, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_Complex64_t beta, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -345,10 +342,12 @@ int MORSE_zhemm_Tile_Async(MORSE_enum side, MORSE_enum uplo, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -416,11 +415,13 @@ int MORSE_zhemm_Tile_Async(MORSE_enum side, MORSE_enum uplo, } /* Quick return */ - if (C->m == 0 || C->n == 0 || - ( (alpha == (MORSE_Complex64_t)0.0) && (beta == (MORSE_Complex64_t)1.0) )) + if ( (C->m == 0) || (C->n == 0) || + ( (alpha == (MORSE_Complex64_t)0.0) && (beta == (MORSE_Complex64_t)1.0) ) ) + { return MORSE_SUCCESS; + } - morse_pzhemm(side, uplo, alpha, A, B, beta, C, sequence, request); + morse_pzhemm( side, uplo, alpha, A, B, beta, C, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zher2k.c b/compute/zher2k.c index e8f2e6d892b9bf8be8b7c8f3fff666afce446ece..71608495f399ad90c52a5b4dd4c00a9366a5f3b2 100644 --- a/compute/zher2k.c +++ b/compute/zher2k.c @@ -83,7 +83,7 @@ * @param[in] LDB * The leading dimension of the array B. LDB must be at least * max( 1, N ), otherwise LDB must be at least max( 1, K ). - * + * * @param[in] beta * beta specifies the scalar beta. * @@ -108,14 +108,16 @@ * @sa MORSE_sher2k * ******************************************************************************/ -int MORSE_zher2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, - double beta, MORSE_Complex64_t *C, int LDC) +int MORSE_zher2k( MORSE_enum uplo, MORSE_enum trans, int N, int K, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, + double beta, MORSE_Complex64_t *C, int LDC ) { int NB; int Am, An; int status; - MORSE_desc_t descA, descB, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; + MORSE_desc_t descCl, descCt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -135,7 +137,7 @@ int MORSE_zher2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, morse_error("MORSE_zher2k", "illegal value of trans"); return -2; } - if ( trans == MorseNoTrans ) { + if ( trans == MorseNoTrans ) { Am = N; An = K; } else { Am = K; An = N; @@ -176,42 +178,36 @@ int MORSE_zher2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, An, 0, 0, Am, An, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInput, MorseUpperLower, + B, NB, NB, LDB, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, uplo, + C, NB, NB, LDC, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zher2k_Tile_Async(uplo, trans, alpha, &descA, &descB, beta, &descC, sequence, &request); + MORSE_zher2k_Tile_Async( uplo, trans, alpha, &descAt, &descBt, beta, &descCt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, uplo, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, An, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -269,9 +265,9 @@ int MORSE_zher2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, * @sa MORSE_sher2k * ******************************************************************************/ -int MORSE_zher2k_Tile(MORSE_enum uplo, MORSE_enum trans, - MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - double beta, MORSE_desc_t *C) +int MORSE_zher2k_Tile( MORSE_enum uplo, MORSE_enum trans, + MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, + double beta, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -283,15 +279,17 @@ int MORSE_zher2k_Tile(MORSE_enum uplo, MORSE_enum trans, morse_fatal_error("MORSE_zher2k_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zher2k_Tile_Async(uplo, trans, alpha, A, B, beta, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zher2k_Tile_Async( uplo, trans, alpha, A, B, beta, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -323,10 +321,10 @@ int MORSE_zher2k_Tile(MORSE_enum uplo, MORSE_enum trans, * @sa MORSE_sher2k_Tile_Async * ******************************************************************************/ -int MORSE_zher2k_Tile_Async(MORSE_enum uplo, MORSE_enum trans, - MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - double beta, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zher2k_Tile_Async( MORSE_enum uplo, MORSE_enum trans, + MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, + double beta, MORSE_desc_t *C, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; int N, K; @@ -346,10 +344,12 @@ int MORSE_zher2k_Tile_Async(MORSE_enum uplo, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -405,11 +405,13 @@ int MORSE_zher2k_Tile_Async(MORSE_enum uplo, MORSE_enum trans, K = An; /* Quick return */ - if ( N == 0 || - ((alpha == (MORSE_Complex64_t)0.0 || K == 0) && beta == (double)1.0)) + if ( (N == 0) || + (((alpha == (MORSE_Complex64_t)0.0) || (K == 0)) && (beta == (double)1.0)) ) + { return MORSE_SUCCESS; + } - morse_pzher2k(uplo, trans, alpha, A, B, beta, C, sequence, request); + morse_pzher2k( uplo, trans, alpha, A, B, beta, C, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zherk.c b/compute/zherk.c index 6fbe72d552b780604b3b3026e7c68e3cb7452227..b99dd19884401cb400d435abc60dea745f9e333f 100644 --- a/compute/zherk.c +++ b/compute/zherk.c @@ -98,14 +98,15 @@ * @sa MORSE_sherk * ******************************************************************************/ -int MORSE_zherk(MORSE_enum uplo, MORSE_enum trans, int N, int K, +int MORSE_zherk( MORSE_enum uplo, MORSE_enum trans, int N, int K, double alpha, MORSE_Complex64_t *A, int LDA, - double beta, MORSE_Complex64_t *C, int LDC) + double beta, MORSE_Complex64_t *C, int LDC ) { int NB; int Am, An; int status; - MORSE_desc_t descA, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descCl, descCt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -125,7 +126,7 @@ int MORSE_zherk(MORSE_enum uplo, MORSE_enum trans, int N, int K, morse_error("MORSE_zherk", "illegal value of trans"); return -2; } - if ( trans == MorseNoTrans ) { + if ( trans == MorseNoTrans ) { Am = N; An = K; } else { Am = K; An = N; @@ -162,36 +163,31 @@ int MORSE_zherk(MORSE_enum uplo, MORSE_enum trans, int N, int K, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, uplo, + C, NB, NB, LDC, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zherk_Tile_Async(uplo, trans, alpha, &descA, beta, &descC, sequence, &request); + MORSE_zherk_Tile_Async( uplo, trans, alpha, &descAt, beta, &descCt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -245,9 +241,9 @@ int MORSE_zherk(MORSE_enum uplo, MORSE_enum trans, int N, int K, * @sa MORSE_sherk * ******************************************************************************/ -int MORSE_zherk_Tile(MORSE_enum uplo, MORSE_enum trans, +int MORSE_zherk_Tile( MORSE_enum uplo, MORSE_enum trans, double alpha, MORSE_desc_t *A, - double beta, MORSE_desc_t *C) + double beta, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -259,14 +255,16 @@ int MORSE_zherk_Tile(MORSE_enum uplo, MORSE_enum trans, morse_fatal_error("MORSE_zherk_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zherk_Tile_Async(uplo, trans, alpha, A, beta, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zherk_Tile_Async( uplo, trans, alpha, A, beta, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -298,10 +296,10 @@ int MORSE_zherk_Tile(MORSE_enum uplo, MORSE_enum trans, * @sa MORSE_sherk_Tile_Async * ******************************************************************************/ -int MORSE_zherk_Tile_Async(MORSE_enum uplo, MORSE_enum trans, +int MORSE_zherk_Tile_Async( MORSE_enum uplo, MORSE_enum trans, double alpha, MORSE_desc_t *A, double beta, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; int N, K; @@ -321,10 +319,12 @@ int MORSE_zherk_Tile_Async(MORSE_enum uplo, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -376,11 +376,13 @@ int MORSE_zherk_Tile_Async(MORSE_enum uplo, MORSE_enum trans, K = An; /* Quick return */ - if ( N == 0 || - ((alpha == (double)0.0 || K == 0) && beta == (double)1.0)) + if ( (N == 0) || + (((alpha == (double)0.0) || (K == 0)) && (beta == (double)1.0)) ) + { return MORSE_SUCCESS; + } - morse_pzherk(uplo, trans, alpha, A, beta, C, sequence, request); + morse_pzherk( uplo, trans, alpha, A, beta, C, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zhetrd.c b/compute/zhetrd.c index e69bce8a9eb5f25e76f796a2cd2857f65df93daf..5593d45a4b18c68d3403bdf7bee88be86f2449eb 100644 --- a/compute/zhetrd.c +++ b/compute/zhetrd.c @@ -113,19 +113,19 @@ * @sa MORSE_ssytrd * ******************************************************************************/ -int MORSE_zhetrd(MORSE_enum jobz, MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA, - double *D, - double *E, - MORSE_desc_t *descT, - MORSE_Complex64_t *Q, int LDQ) +int MORSE_zhetrd( MORSE_enum jobz, MORSE_enum uplo, int N, + MORSE_Complex64_t *A, int LDA, + double *D, + double *E, + MORSE_desc_t *descT, + MORSE_Complex64_t *Q, int LDQ ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -138,7 +138,7 @@ int MORSE_zhetrd(MORSE_enum jobz, MORSE_enum uplo, int N, morse_error("MORSE_zhetrd", "illegal value of jobz"); return -1; } - if (uplo != MorseLower && uplo != MorseUpper) { + if ((uplo != MorseLower) && (uplo != MorseUpper)) { morse_error("MORSE_zhetrd", "illegal value of uplo"); return -1; } @@ -164,30 +164,26 @@ int MORSE_zhetrd(MORSE_enum jobz, MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - /* } else { */ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ - /* sequence, &request); */ - /* } */ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zhetrd_Tile_Async(jobz, uplo, &descA, D, E, descT, Q, LDQ, sequence, &request); + MORSE_zhetrd_Tile_Async( jobz, uplo, &descAt, D, E, descT, Q, LDQ, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooptile2lap( descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - /* } else { */ - /* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request); */ - /* morse_sequence_wait(morse, sequence); */ - /* } */ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -271,9 +267,9 @@ int MORSE_zhetrd(MORSE_enum jobz, MORSE_enum uplo, int N, * @sa MORSE_zhetrd_Tile * ******************************************************************************/ -int MORSE_zhetrd_Tile(MORSE_enum jobz, MORSE_enum uplo, - MORSE_desc_t *A, double *D, double *E, - MORSE_desc_t *T, MORSE_Complex64_t *Q, int LDQ) +int MORSE_zhetrd_Tile( MORSE_enum jobz, MORSE_enum uplo, + MORSE_desc_t *A, double *D, double *E, + MORSE_desc_t *T, MORSE_Complex64_t *Q, int LDQ ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -285,11 +281,16 @@ int MORSE_zhetrd_Tile(MORSE_enum jobz, MORSE_enum uplo, morse_fatal_error("MORSE_zhetrd_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zhetrd_Tile_Async(jobz, uplo, A, D, E, T, Q, LDQ, sequence, &request); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zhetrd_Tile_Async( jobz, uplo, A, D, E, T, Q, LDQ, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -325,14 +326,14 @@ int MORSE_zhetrd_Tile(MORSE_enum jobz, MORSE_enum uplo, * @sa MORSE_ssytrd_Tile_Async * ******************************************************************************/ -int MORSE_zhetrd_Tile_Async(MORSE_enum jobz, - MORSE_enum uplo, - MORSE_desc_t *A, - double *W, - double *E, - MORSE_desc_t *T, - MORSE_Complex64_t *Q, int LDQ, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zhetrd_Tile_Async( MORSE_enum jobz, + MORSE_enum uplo, + MORSE_desc_t *A, + double *W, + double *E, + MORSE_desc_t *T, + MORSE_Complex64_t *Q, int LDQ, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t descA; @@ -356,10 +357,12 @@ int MORSE_zhetrd_Tile_Async(MORSE_enum jobz, } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -378,7 +381,7 @@ int MORSE_zhetrd_Tile_Async(MORSE_enum jobz, morse_error("MORSE_zhetrd_Tile_Async", "illegal value of jobz"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseLower && uplo != MorseUpper) { + if ((uplo != MorseLower) && (uplo != MorseUpper)) { morse_error("MORSE_zhetrd_Tile_Async", "illegal value of uplo"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } @@ -416,7 +419,8 @@ int MORSE_zhetrd_Tile_Async(MORSE_enum jobz, /* Copy data into band structure */ morse_pztile2band( uplo, A, &descAB, sequence, request ); - morse_sequence_wait(morse, sequence); + + morse_sequence_wait( morse, sequence ); /* Reduce band matrix to tridiagonal matrix */ #if !defined(CHAMELEON_SIMULATION) @@ -431,9 +435,9 @@ int MORSE_zhetrd_Tile_Async(MORSE_enum jobz, } #endif /* !defined(CHAMELEON_SIMULATION) */ if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + morse_desc_mat_free( Dptr ); } - morse_desc_mat_free(&descAB); + morse_desc_mat_free( &descAB ); (void)D; return MORSE_SUCCESS; } diff --git a/compute/zlacpy.c b/compute/zlacpy.c index 3088442702a338f26aa23fbba300a5aa8e9bd9a9..d47417ac4d7bdc868db32dae4d94bdac3fad0ae3 100644 --- a/compute/zlacpy.c +++ b/compute/zlacpy.c @@ -74,16 +74,17 @@ * @sa MORSE_slacpy * ******************************************************************************/ -int MORSE_zlacpy(MORSE_enum uplo, int M, int N, +int MORSE_zlacpy( MORSE_enum uplo, int M, int N, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -116,7 +117,7 @@ int MORSE_zlacpy(MORSE_enum uplo, int M, int N, /* Quick return */ if (chameleon_min(N, M) == 0) - return (double)0.0; + return (double)0.0; /* Tune NB depending on M, N & NRHS; Set NBNB */ status = morse_tune(MORSE_FUNC_ZGEMM, M, N, 0); @@ -128,34 +129,30 @@ int MORSE_zlacpy(MORSE_enum uplo, int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, uplo, + B, NB, NB, LDB, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlacpy_Tile_Async(uplo, &descA, &descB, sequence, &request); + MORSE_zlacpy_Tile_Async( uplo, &descAt, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, uplo, sequence, &request ); - morse_sequence_destroy(morse, sequence); + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); + + morse_sequence_destroy( morse, sequence ); return MORSE_SUCCESS; } @@ -200,22 +197,29 @@ int MORSE_zlacpy(MORSE_enum uplo, int M, int N, * @sa MORSE_slacpy_Tile * ******************************************************************************/ -int MORSE_zlacpy_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) +int MORSE_zlacpy_Tile( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + int status; morse = morse_context_self(); if (morse == NULL) { morse_fatal_error("MORSE_zlacpy_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlacpy_Tile_Async(uplo, A, B, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_sequence_destroy(morse, sequence); - return MORSE_SUCCESS; + morse_sequence_create( morse, &sequence ); + + MORSE_zlacpy_Tile_Async( uplo, A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return status; } /** @@ -245,8 +249,8 @@ int MORSE_zlacpy_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) * @sa MORSE_slacpy_Tile_Async * ******************************************************************************/ -int MORSE_zlacpy_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zlacpy_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -264,10 +268,12 @@ int MORSE_zlacpy_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -295,7 +301,7 @@ int MORSE_zlacpy_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_SUCCESS; } - morse_pzlacpy(uplo, A, B, sequence, request); + morse_pzlacpy( uplo, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zlange.c b/compute/zlange.c index 82831613fd334461bc4f2a1e1cf437d6eb328a03..e351bb5c7672c141f0e357cb53213f06c39fc6dc 100644 --- a/compute/zlange.c +++ b/compute/zlange.c @@ -84,7 +84,7 @@ * ******************************************************************************/ double MORSE_zlange(MORSE_enum norm, int M, int N, - MORSE_Complex64_t *A, int LDA) + MORSE_Complex64_t *A, int LDA ) { int NB; int status; @@ -92,7 +92,7 @@ double MORSE_zlange(MORSE_enum norm, int M, int N, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -101,7 +101,7 @@ double MORSE_zlange(MORSE_enum norm, int M, int N, } /* Check input arguments */ if ( (norm != MorseMaxNorm) && (norm != MorseOneNorm) - && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { + && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { morse_error("MORSE_zlange", "illegal value of norm"); return -1; } @@ -120,7 +120,7 @@ double MORSE_zlange(MORSE_enum norm, int M, int N, /* Quick return */ if (chameleon_min(N, M) == 0) - return (double)0.0; + return (double)0.0; /* Tune NB depending on M, N & NRHS; Set NBNB */ status = morse_tune(MORSE_FUNC_ZGEMM, M, N, 0); @@ -132,30 +132,25 @@ double MORSE_zlange(MORSE_enum norm, int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlange_Tile_Async(norm, &descA, &value, sequence, &request); + MORSE_zlange_Tile_Async( norm, &descAt, &value, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - RUNTIME_desc_flush( &descA, sequence ); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return value; } @@ -198,11 +193,12 @@ double MORSE_zlange(MORSE_enum norm, int M, int N, * @sa MORSE_slange_Tile * ******************************************************************************/ -double MORSE_zlange_Tile(MORSE_enum norm, MORSE_desc_t *A) +double MORSE_zlange_Tile(MORSE_enum norm, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + int status; double value; morse = morse_context_self(); @@ -210,11 +206,16 @@ double MORSE_zlange_Tile(MORSE_enum norm, MORSE_desc_t *A) morse_fatal_error("MORSE_zlange_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlange_Tile_Async(norm, A, &value, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_sequence_destroy(morse, sequence); - return value; + morse_sequence_create( morse, &sequence ); + + MORSE_zlange_Tile_Async( norm, A, &value, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return ( status == MORSE_SUCCESS ) ? value : (double)status; } /** @@ -244,8 +245,8 @@ double MORSE_zlange_Tile(MORSE_enum norm, MORSE_desc_t *A) * @sa MORSE_slange_Tile_Async * ******************************************************************************/ -int MORSE_zlange_Tile_Async(MORSE_enum norm, MORSE_desc_t *A, double *value, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zlange_Tile_Async( MORSE_enum norm, MORSE_desc_t *A, double *value, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -263,10 +264,12 @@ int MORSE_zlange_Tile_Async(MORSE_enum norm, MORSE_desc_t *A, double *value, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -289,7 +292,7 @@ int MORSE_zlange_Tile_Async(MORSE_enum norm, MORSE_desc_t *A, double *value, return MORSE_SUCCESS; } - morse_pzlange(norm, A, value, sequence, request); + morse_pzlange( norm, A, value, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zlanhe.c b/compute/zlanhe.c index e666221ace06405bf247ff7faab0d9b2cc7ec18d..e43a8111d29f62922cd24050badb702d29875b32 100644 --- a/compute/zlanhe.c +++ b/compute/zlanhe.c @@ -84,7 +84,7 @@ * ******************************************************************************/ double MORSE_zlanhe(MORSE_enum norm, MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA) + MORSE_Complex64_t *A, int LDA ) { int NB; int status; @@ -92,7 +92,7 @@ double MORSE_zlanhe(MORSE_enum norm, MORSE_enum uplo, int N, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -101,7 +101,7 @@ double MORSE_zlanhe(MORSE_enum norm, MORSE_enum uplo, int N, } /* Check input arguments */ if ( (norm != MorseMaxNorm) && (norm != MorseOneNorm) - && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { + && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { morse_error("MORSE_zlanhe", "illegal value of norm"); return -1; } @@ -120,7 +120,7 @@ double MORSE_zlanhe(MORSE_enum norm, MORSE_enum uplo, int N, /* Quick return */ if ( N == 0) - return (double)0.0; + return (double)0.0; /* Tune NB depending on M, N & NRHS; Set NBNB */ status = morse_tune(MORSE_FUNC_ZGEMM, N, N, 0); @@ -132,30 +132,25 @@ double MORSE_zlanhe(MORSE_enum norm, MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlanhe_Tile_Async(norm, uplo, &descA, &value, sequence, &request); + MORSE_zlanhe_Tile_Async( norm, uplo, &descAt, &value, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - RUNTIME_desc_flush( &descA, sequence ); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return value; } @@ -202,11 +197,12 @@ double MORSE_zlanhe(MORSE_enum norm, MORSE_enum uplo, int N, * @sa MORSE_slanhe_Tile * ******************************************************************************/ -double MORSE_zlanhe_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A) +double MORSE_zlanhe_Tile( MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + int status; double value; morse = morse_context_self(); @@ -214,11 +210,16 @@ double MORSE_zlanhe_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A) morse_fatal_error("MORSE_zlanhe_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlanhe_Tile_Async(norm, uplo, A, &value, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_sequence_destroy(morse, sequence); - return value; + morse_sequence_create( morse, &sequence ); + + MORSE_zlanhe_Tile_Async( norm, uplo, A, &value, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return ( status == MORSE_SUCCESS ) ? value : (double)status; } /** @@ -248,8 +249,8 @@ double MORSE_zlanhe_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A) * @sa MORSE_slanhe_Tile_Async * ******************************************************************************/ -int MORSE_zlanhe_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *value, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zlanhe_Tile_Async( MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *value, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -267,10 +268,12 @@ int MORSE_zlanhe_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, d return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -297,7 +300,7 @@ int MORSE_zlanhe_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, d return MORSE_SUCCESS; } - morse_pzlanhe(norm, uplo, A, value, sequence, request); + morse_pzlanhe( norm, uplo, A, value, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zlansy.c b/compute/zlansy.c index 35df4fc8912e33279b04fa6af22974ec005a1e11..cb97a551881bb1cdb44580e6f3ca7d6631500964 100644 --- a/compute/zlansy.c +++ b/compute/zlansy.c @@ -84,7 +84,7 @@ * ******************************************************************************/ double MORSE_zlansy(MORSE_enum norm, MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA) + MORSE_Complex64_t *A, int LDA ) { int NB; int status; @@ -92,7 +92,7 @@ double MORSE_zlansy(MORSE_enum norm, MORSE_enum uplo, int N, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -101,7 +101,7 @@ double MORSE_zlansy(MORSE_enum norm, MORSE_enum uplo, int N, } /* Check input arguments */ if ( (norm != MorseMaxNorm) && (norm != MorseOneNorm) - && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { + && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { morse_error("MORSE_zlansy", "illegal value of norm"); return -1; } @@ -120,7 +120,7 @@ double MORSE_zlansy(MORSE_enum norm, MORSE_enum uplo, int N, /* Quick return */ if ( N == 0) - return (double)0.0; + return (double)0.0; /* Tune NB depending on M, N & NRHS; Set NBNB */ status = morse_tune(MORSE_FUNC_ZGEMM, N, N, 0); @@ -132,28 +132,25 @@ double MORSE_zlansy(MORSE_enum norm, MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlansy_Tile_Async(norm, uplo, &descA, &value, sequence, &request); + MORSE_zlansy_Tile_Async( norm, uplo, &descAt, &value, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return value; } @@ -200,11 +197,12 @@ double MORSE_zlansy(MORSE_enum norm, MORSE_enum uplo, int N, * @sa MORSE_slansy_Tile * ******************************************************************************/ -double MORSE_zlansy_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A) +double MORSE_zlansy_Tile( MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + int status; double value; morse = morse_context_self(); @@ -212,11 +210,16 @@ double MORSE_zlansy_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A) morse_fatal_error("MORSE_zlansy_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlansy_Tile_Async(norm, uplo, A, &value, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_sequence_destroy(morse, sequence); - return value; + morse_sequence_create( morse, &sequence ); + + MORSE_zlansy_Tile_Async( norm, uplo, A, &value, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return ( status == MORSE_SUCCESS ) ? value : (double)status; } /** @@ -246,8 +249,8 @@ double MORSE_zlansy_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A) * @sa MORSE_slansy_Tile_Async * ******************************************************************************/ -int MORSE_zlansy_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *value, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zlansy_Tile_Async( MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *value, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -265,10 +268,12 @@ int MORSE_zlansy_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, d return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -295,7 +300,7 @@ int MORSE_zlansy_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, d return MORSE_SUCCESS; } - morse_pzlansy(norm, uplo, A, value, sequence, request); + morse_pzlansy( norm, uplo, A, value, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zlantr.c b/compute/zlantr.c index 3f5e8f1eda3637f3c91541e8da96c816a732dbf6..f803abd84474cbe35a720c2bd5e98d20bd727a5d 100644 --- a/compute/zlantr.c +++ b/compute/zlantr.c @@ -96,7 +96,7 @@ * ******************************************************************************/ double MORSE_zlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, - int M, int N, MORSE_Complex64_t *A, int LDA) + int M, int N, MORSE_Complex64_t *A, int LDA ) { int NB; int status; @@ -104,7 +104,7 @@ double MORSE_zlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -113,15 +113,15 @@ double MORSE_zlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, } /* Check input arguments */ if ( (norm != MorseMaxNorm) && (norm != MorseOneNorm) - && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { + && (norm != MorseInfNorm) && (norm != MorseFrobeniusNorm) ) { morse_error("MORSE_zlantr", "illegal value of norm"); return -1; } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zlantr", "illegal value of uplo"); return -2; } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_zlantr", "illegal value of diag"); return -3; } @@ -140,7 +140,7 @@ double MORSE_zlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, /* Quick return */ if (chameleon_min(N, M) == 0) - return (double)0.0; + return (double)0.0; /* Tune NB depending on M, N & NRHS; Set NBNB */ status = morse_tune(MORSE_FUNC_ZGEMM, M, N, 0); @@ -152,28 +152,25 @@ double MORSE_zlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlantr_Tile_Async(norm, uplo, diag, &descA, &value, sequence, &request); + MORSE_zlantr_Tile_Async( norm, uplo, diag, &descAt, &value, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return value; } @@ -222,11 +219,12 @@ double MORSE_zlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, * @sa MORSE_slantr_Tile * ******************************************************************************/ -double MORSE_zlantr_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A) +double MORSE_zlantr_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + int status; double value; morse = morse_context_self(); @@ -234,11 +232,16 @@ double MORSE_zlantr_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, MORS morse_fatal_error("MORSE_zlantr_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlantr_Tile_Async(norm, uplo, diag, A, &value, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_sequence_destroy(morse, sequence); - return value; + morse_sequence_create( morse, &sequence ); + + MORSE_zlantr_Tile_Async( norm, uplo, diag, A, &value, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return ( status == MORSE_SUCCESS ) ? value : (double)status; } /** @@ -268,9 +271,9 @@ double MORSE_zlantr_Tile(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, MORS * @sa MORSE_slantr_Tile_Async * ******************************************************************************/ -int MORSE_zlantr_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, - MORSE_desc_t *A, double *value, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zlantr_Tile_Async( MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, + MORSE_desc_t *A, double *value, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -288,10 +291,12 @@ int MORSE_zlantr_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -308,11 +313,11 @@ int MORSE_zlantr_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, morse_error("MORSE_zlantr_Tile", "illegal value of norm"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zlantr_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_zlantr_Tile", "illegal value of diag"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } @@ -323,7 +328,7 @@ int MORSE_zlantr_Tile_Async(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag, return MORSE_SUCCESS; } - morse_pzlantr(norm, uplo, diag, A, value, sequence, request); + morse_pzlantr( norm, uplo, diag, A, value, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zlascal.c b/compute/zlascal.c index c86ca1da02ebad9066a30f628521088f95ad0d94..b37d8f61881884d7b7dcd943f7c7b5b44c55f0be 100644 --- a/compute/zlascal.c +++ b/compute/zlascal.c @@ -62,12 +62,12 @@ * @sa MORSE_slascal * ******************************************************************************/ -int MORSE_zlascal(MORSE_enum uplo, int M, int N, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA) +int MORSE_zlascal( MORSE_enum uplo, int M, int N, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA ) { int NB; int status; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -79,7 +79,7 @@ int MORSE_zlascal(MORSE_enum uplo, int M, int N, } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower && uplo != MorseUpperLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower) && (uplo != MorseUpperLower)) { morse_error("MORSE_zlascal", "illegal value of uplo"); return -1; } @@ -111,31 +111,26 @@ int MORSE_zlascal(MORSE_enum uplo, int M, int N, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N , 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlascal_Tile_Async( - uplo, alpha, &descA, sequence, &request); + MORSE_zlascal_Tile_Async( uplo, alpha, &descAt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap( descA, A, NB, NB, LDA, N, sequence, &request); - RUNTIME_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_dynamic_sync();*/ -/* }*/ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -179,8 +174,8 @@ int MORSE_zlascal(MORSE_enum uplo, int M, int N, * @sa MORSE_slascal_Tile * ******************************************************************************/ -int MORSE_zlascal_Tile(MORSE_enum uplo, - MORSE_Complex64_t alpha, MORSE_desc_t *A) +int MORSE_zlascal_Tile( MORSE_enum uplo, + MORSE_Complex64_t alpha, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -192,11 +187,15 @@ int MORSE_zlascal_Tile(MORSE_enum uplo, morse_fatal_error("MORSE_zlascal_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlascal_Tile_Async(uplo, alpha, A, sequence, &request); - RUNTIME_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zlascal_Tile_Async( uplo, alpha, A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -229,9 +228,9 @@ int MORSE_zlascal_Tile(MORSE_enum uplo, * @sa MORSE_slascal_Tile_Async * ******************************************************************************/ -int MORSE_zlascal_Tile_Async(MORSE_enum uplo, +int MORSE_zlascal_Tile_Async( MORSE_enum uplo, MORSE_Complex64_t alpha, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t descA; @@ -250,10 +249,12 @@ int MORSE_zlascal_Tile_Async(MORSE_enum uplo, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -263,7 +264,7 @@ int MORSE_zlascal_Tile_Async(MORSE_enum uplo, descA = *A; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower && uplo != MorseUpperLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower) && (uplo != MorseUpperLower)) { morse_error("MORSE_zlascal", "illegal value of uplo"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } @@ -276,9 +277,11 @@ int MORSE_zlascal_Tile_Async(MORSE_enum uplo, /* Quick return */ if ( (descA.m == 0) || (descA.n == 0) || (alpha == (MORSE_Complex64_t)1.0) ) + { return MORSE_SUCCESS; + } - morse_pzlascal( uplo, alpha, A, sequence, request); + morse_pzlascal( uplo, alpha, A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zlaset.c b/compute/zlaset.c index fab26797f9a563522dcb8d744d81070a9bc5dc0b..41093bc7d0468aa7cf7e5b0c7df96d7da21b69e8 100644 --- a/compute/zlaset.c +++ b/compute/zlaset.c @@ -75,16 +75,16 @@ * @sa MORSE_slaset * ******************************************************************************/ -int MORSE_zlaset(MORSE_enum uplo, int M, int N, +int MORSE_zlaset( MORSE_enum uplo, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t beta, - MORSE_Complex64_t *A, int LDA) + MORSE_Complex64_t *A, int LDA ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -113,7 +113,7 @@ int MORSE_zlaset(MORSE_enum uplo, int M, int N, /* Quick return */ if (chameleon_min(N, M) == 0) - return (double)0.0; + return (double)0.0; /* Tune NB depending on M, N & NRHS; Set NBNB */ status = morse_tune(MORSE_FUNC_ZGEMM, M, N, 0); @@ -125,28 +125,25 @@ int MORSE_zlaset(MORSE_enum uplo, int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlaset_Tile_Async(uplo, alpha, beta, &descA, sequence, &request); + MORSE_zlaset_Tile_Async( uplo, alpha, beta, &descAt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); - morse_sequence_destroy(morse, sequence); + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + + morse_sequence_destroy( morse, sequence ); return MORSE_SUCCESS; } @@ -187,24 +184,30 @@ int MORSE_zlaset(MORSE_enum uplo, int M, int N, * @sa MORSE_slaset_Tile * ******************************************************************************/ -int MORSE_zlaset_Tile(MORSE_enum uplo, +int MORSE_zlaset_Tile( MORSE_enum uplo, MORSE_Complex64_t alpha, MORSE_Complex64_t beta, - MORSE_desc_t *A) + MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; + int status; morse = morse_context_self(); if (morse == NULL) { morse_fatal_error("MORSE_zlaset_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlaset_Tile_Async(uplo, alpha, beta, A, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_sequence_destroy(morse, sequence); - return MORSE_SUCCESS; + morse_sequence_create( morse, &sequence ); + + MORSE_zlaset_Tile_Async( uplo, alpha, beta, A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return status; } /** @@ -234,10 +237,10 @@ int MORSE_zlaset_Tile(MORSE_enum uplo, * @sa MORSE_slaset_Tile_Async * ******************************************************************************/ -int MORSE_zlaset_Tile_Async(MORSE_enum uplo, +int MORSE_zlaset_Tile_Async( MORSE_enum uplo, MORSE_Complex64_t alpha, MORSE_Complex64_t beta, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -255,10 +258,12 @@ int MORSE_zlaset_Tile_Async(MORSE_enum uplo, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -282,7 +287,7 @@ int MORSE_zlaset_Tile_Async(MORSE_enum uplo, return MORSE_SUCCESS; } - morse_pzlaset(uplo, alpha, beta, A, sequence, request); + morse_pzlaset( uplo, alpha, beta, A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zlauum.c b/compute/zlauum.c index 8ef3f032d56c4805b9e8fad10267a7cc1eb97a26..7c29cf3908488ddd67fa090718b3daaab92556dd 100644 --- a/compute/zlauum.c +++ b/compute/zlauum.c @@ -77,23 +77,23 @@ * @sa MORSE_zpotri * ******************************************************************************/ -int MORSE_zlauum(MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA) +int MORSE_zlauum( MORSE_enum uplo, int N, + MORSE_Complex64_t *A, int LDA ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; - + MORSE_desc_t descAl, descAt; + morse = morse_context_self(); if (morse == NULL) { morse_fatal_error("MORSE_zlauum", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zlauum", "illegal value of uplo"); return -1; } @@ -119,30 +119,26 @@ int MORSE_zlauum(MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zlauum_Tile_Async(uplo, &descA, sequence, &request); + MORSE_zlauum_Tile_Async( uplo, &descAt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -187,7 +183,7 @@ int MORSE_zlauum(MORSE_enum uplo, int N, * @sa MORSE_zpotri_Tile * ******************************************************************************/ -int MORSE_zlauum_Tile(MORSE_enum uplo, MORSE_desc_t *A) +int MORSE_zlauum_Tile( MORSE_enum uplo, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -199,13 +195,15 @@ int MORSE_zlauum_Tile(MORSE_enum uplo, MORSE_desc_t *A) morse_fatal_error("MORSE_zlauum_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zlauum_Tile_Async(uplo, A, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zlauum_Tile_Async( uplo, A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -240,8 +238,8 @@ int MORSE_zlauum_Tile(MORSE_enum uplo, MORSE_desc_t *A) * @sa MORSE_zpotri_Tile_Async * ******************************************************************************/ -int MORSE_zlauum_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zlauum_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -259,10 +257,12 @@ int MORSE_zlauum_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -274,16 +274,16 @@ int MORSE_zlauum_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, morse_error("MORSE_zlauum_Tile", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zlauum_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return */ -/* - if (chameleon_max(N, 0) == 0) - return MORSE_SUCCESS; -*/ - morse_pzlauum(uplo, A, sequence, request); + /* + if (chameleon_max(N, 0) == 0) + return MORSE_SUCCESS; + */ + morse_pzlauum( uplo, A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zplghe.c b/compute/zplghe.c index 0d7af992710735c1e17462eb6e5d6d8f71bb6c36..5f8deeee1f8174ba6eb659b97d140243beefb537 100644 --- a/compute/zplghe.c +++ b/compute/zplghe.c @@ -84,7 +84,7 @@ int MORSE_zplghe( double bump, MORSE_enum uplo, int N, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -113,19 +113,26 @@ int MORSE_zplghe( double bump, MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - morse_zdesc_alloc(descA, NB, NB, LDA, N, 0, 0, N, N, morse_desc_mat_free(&descA)); + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescOutput, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zplghe_Tile_Async( bump, uplo, &descA, seed, sequence, &request ); + MORSE_zplghe_Tile_Async( bump, uplo, &descAt, seed, sequence, &request ); - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescOutput, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -184,11 +191,15 @@ int MORSE_zplghe_Tile( double bump, MORSE_enum uplo, MORSE_desc_t *A, morse_fatal_error("MORSE_zplghe_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); + MORSE_zplghe_Tile_Async( bump, uplo, A, seed, sequence, &request ); - morse_sequence_wait(morse, sequence); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -244,10 +255,12 @@ int MORSE_zplghe_Tile_Async( double bump, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -264,7 +277,7 @@ int MORSE_zplghe_Tile_Async( double bump, if (chameleon_min( A->m, A->n ) == 0) return MORSE_SUCCESS; - morse_pzplghe(bump, uplo, A, seed, sequence, request); + morse_pzplghe( bump, uplo, A, seed, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zplgsy.c b/compute/zplgsy.c index 7c8e8aeda0f5d1e96d384d40b529751a266875c8..31ec6fdc714d98fd2d8e0ca6a5fd56c2c13be896 100644 --- a/compute/zplgsy.c +++ b/compute/zplgsy.c @@ -84,7 +84,7 @@ int MORSE_zplgsy( MORSE_Complex64_t bump, MORSE_enum uplo, int N, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -113,19 +113,26 @@ int MORSE_zplgsy( MORSE_Complex64_t bump, MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - morse_zdesc_alloc(descA, NB, NB, LDA, N, 0, 0, N, N, morse_desc_mat_free(&descA)); + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescOutput, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zplgsy_Tile_Async( bump, uplo, &descA, seed, sequence, &request ); + MORSE_zplgsy_Tile_Async( bump, uplo, &descAt, seed, sequence, &request ); - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescOutput, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -172,7 +179,7 @@ int MORSE_zplgsy( MORSE_Complex64_t bump, MORSE_enum uplo, int N, * ******************************************************************************/ int MORSE_zplgsy_Tile( MORSE_Complex64_t bump, MORSE_enum uplo, - MORSE_desc_t *A, + MORSE_desc_t *A, unsigned long long int seed ) { MORSE_context_t *morse; @@ -185,11 +192,15 @@ int MORSE_zplgsy_Tile( MORSE_Complex64_t bump, MORSE_enum uplo, morse_fatal_error("MORSE_zplgsy_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); + MORSE_zplgsy_Tile_Async( bump, uplo, A, seed, sequence, &request ); - morse_sequence_wait(morse, sequence); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -246,10 +257,12 @@ int MORSE_zplgsy_Tile_Async( MORSE_Complex64_t bump, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -266,7 +279,7 @@ int MORSE_zplgsy_Tile_Async( MORSE_Complex64_t bump, if (chameleon_min( A->m, A->n ) == 0) return MORSE_SUCCESS; - morse_pzplgsy(bump, uplo, A, seed, sequence, request); + morse_pzplgsy( bump, uplo, A, seed, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zplrnt.c b/compute/zplrnt.c index 45e141e11fb5191fe9b2d40b94c7f7a58904f278..17edaa9d72de578abfb3e913b2fe1157494fc028 100644 --- a/compute/zplrnt.c +++ b/compute/zplrnt.c @@ -78,7 +78,7 @@ int MORSE_zplrnt( int M, int N, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -111,19 +111,26 @@ int MORSE_zplrnt( int M, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); - morse_zdesc_alloc(descA, NB, NB, LDA, N, 0, 0, M, N, morse_desc_mat_free(&descA)); + morse_sequence_create( morse, &sequence ); + + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescOutput, MorseUpperLower, + A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zplrnt_Tile_Async( &descA, seed, sequence, &request ); + MORSE_zplrnt_Tile_Async( &descAt, seed, sequence, &request ); - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescOutput, MorseUpperLower, sequence, &request ); - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + status = sequence->status; + morse_sequence_destroy( morse, sequence ); return status; } @@ -175,11 +182,15 @@ int MORSE_zplrnt_Tile( MORSE_desc_t *A, morse_fatal_error("MORSE_zplrnt_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); + MORSE_zplrnt_Tile_Async( A, seed, sequence, &request ); - morse_sequence_wait(morse, sequence); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -216,7 +227,7 @@ int MORSE_zplrnt_Tile( MORSE_desc_t *A, int MORSE_zplrnt_Tile_Async( MORSE_desc_t *A, unsigned long long int seed, MORSE_sequence_t *sequence, - MORSE_request_t *request) + MORSE_request_t *request ) { MORSE_context_t *morse; @@ -234,10 +245,12 @@ int MORSE_zplrnt_Tile_Async( MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -254,7 +267,7 @@ int MORSE_zplrnt_Tile_Async( MORSE_desc_t *A, if (chameleon_min( A->m, A->n ) == 0) return MORSE_SUCCESS; - morse_pzplrnt(A, seed, sequence, request); + morse_pzplrnt( A, seed, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zposv.c b/compute/zposv.c index 5fe1ab279a4feb38ac097f80ca68bfed70807a54..6f4615ce69fbe0b6ae145d5bbe7ef5ba3ec94941 100644 --- a/compute/zposv.c +++ b/compute/zposv.c @@ -95,16 +95,17 @@ * @sa MORSE_sposv * ******************************************************************************/ -int MORSE_zposv(MORSE_enum uplo, int N, int NRHS, +int MORSE_zposv( MORSE_enum uplo, int N, int NRHS, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -112,7 +113,7 @@ int MORSE_zposv(MORSE_enum uplo, int N, int NRHS, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zposv", "illegal value of uplo"); return -1; } @@ -145,39 +146,33 @@ int MORSE_zposv(MORSE_enum uplo, int N, int NRHS, } /* Set NT & NTRHS */ - NB = MORSE_NB; + NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zposv_Tile_Async(uplo, &descA, &descB, sequence, &request); + MORSE_zposv_Tile_Async( uplo, &descAt, &descBt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -228,9 +223,9 @@ int MORSE_zposv(MORSE_enum uplo, int N, int NRHS, * @sa MORSE_cposv_Tile * @sa MORSE_dposv_Tile * @sa MORSE_sposv_Tile -* + * ******************************************************************************/ -int MORSE_zposv_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) +int MORSE_zposv_Tile( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -242,14 +237,16 @@ int MORSE_zposv_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) morse_fatal_error("MORSE_zposv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zposv_Tile_Async(uplo, A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zposv_Tile_Async( uplo, A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -282,8 +279,8 @@ int MORSE_zposv_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) * @sa MORSE_sposv_Tile_Async * ******************************************************************************/ -int MORSE_zposv_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zposv_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -301,10 +298,12 @@ int MORSE_zposv_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -320,21 +319,21 @@ int MORSE_zposv_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, morse_error("MORSE_zposv_Tile", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zposv_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return - currently NOT equivalent to LAPACK's * LAPACK does not have such check for DPOSV */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ - morse_pzpotrf(uplo, A, sequence, request); + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ + morse_pzpotrf( uplo, A, sequence, request ); - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseConjTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseConjTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request ); - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseConjTrans, MorseNonUnit, 1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseConjTrans, MorseNonUnit, 1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zpotrf.c b/compute/zpotrf.c index 08261848912dfe3913b30bc45f3e0ffd3adb1d9d..f37ee389b55fdc2ab7d11c0c02560f4b91b9eda4 100644 --- a/compute/zpotrf.c +++ b/compute/zpotrf.c @@ -83,15 +83,15 @@ * @sa MORSE_zpotrs * ******************************************************************************/ -int MORSE_zpotrf(MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA) +int MORSE_zpotrf( MORSE_enum uplo, int N, + MORSE_Complex64_t *A, int LDA ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -99,7 +99,7 @@ int MORSE_zpotrf(MORSE_enum uplo, int N, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotrf", "illegal value of uplo"); return -1; } @@ -123,32 +123,28 @@ int MORSE_zpotrf(MORSE_enum uplo, int N, } /* Set NT */ - NB = MORSE_NB; + NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zpotrf_Tile_Async(uplo, &descA, sequence, &request); + MORSE_zpotrf_Tile_Async( uplo, &descAt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -199,7 +195,7 @@ int MORSE_zpotrf(MORSE_enum uplo, int N, * @sa MORSE_zpotrs_Tile * ******************************************************************************/ -int MORSE_zpotrf_Tile(MORSE_enum uplo, MORSE_desc_t *A) +int MORSE_zpotrf_Tile( MORSE_enum uplo, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -211,13 +207,15 @@ int MORSE_zpotrf_Tile(MORSE_enum uplo, MORSE_desc_t *A) morse_fatal_error("MORSE_zpotrf_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zpotrf_Tile_Async(uplo, A, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zpotrf_Tile_Async( uplo, A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -251,8 +249,8 @@ int MORSE_zpotrf_Tile(MORSE_enum uplo, MORSE_desc_t *A) * @sa MORSE_zpotrs_Tile_Async * ******************************************************************************/ -int MORSE_zpotrf_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zpotrf_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -270,10 +268,12 @@ int MORSE_zpotrf_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -285,16 +285,16 @@ int MORSE_zpotrf_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, morse_error("MORSE_zpotrf_Tile_Async", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotrf_Tile_Async", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return */ -/* - if (chameleon_max(N, 0) == 0) - return MORSE_SUCCESS; -*/ - morse_pzpotrf(uplo, A, sequence, request); + /* + if (chameleon_max(N, 0) == 0) + return MORSE_SUCCESS; + */ + morse_pzpotrf( uplo, A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zpotri.c b/compute/zpotri.c index 801f077cc45b83a80792ea563a91551e4be1f9e2..6662a1c661608b63269d537b8def7ed4c54c4f77 100644 --- a/compute/zpotri.c +++ b/compute/zpotri.c @@ -74,15 +74,15 @@ * @sa MORSE_zpotrf * ******************************************************************************/ -int MORSE_zpotri(MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA) +int MORSE_zpotri( MORSE_enum uplo, int N, + MORSE_Complex64_t *A, int LDA ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -90,7 +90,7 @@ int MORSE_zpotri(MORSE_enum uplo, int N, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotri", "illegal value of uplo"); return -1; } @@ -116,30 +116,26 @@ int MORSE_zpotri(MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zpotri_Tile_Async(uplo, &descA, sequence, &request); + MORSE_zpotri_Tile_Async( uplo, &descAt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -187,7 +183,7 @@ int MORSE_zpotri(MORSE_enum uplo, int N, * @sa MORSE_zpotrf_Tile * ******************************************************************************/ -int MORSE_zpotri_Tile(MORSE_enum uplo, MORSE_desc_t *A) +int MORSE_zpotri_Tile( MORSE_enum uplo, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -199,13 +195,15 @@ int MORSE_zpotri_Tile(MORSE_enum uplo, MORSE_desc_t *A) morse_fatal_error("MORSE_zpotri_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zpotri_Tile_Async(uplo, A, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zpotri_Tile_Async( uplo, A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -240,8 +238,8 @@ int MORSE_zpotri_Tile(MORSE_enum uplo, MORSE_desc_t *A) * @sa MORSE_zpotrf_Tile_Async * ******************************************************************************/ -int MORSE_zpotri_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zpotri_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -259,10 +257,12 @@ int MORSE_zpotri_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -274,18 +274,18 @@ int MORSE_zpotri_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, morse_error("MORSE_zpotri_Tile_Async", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotri_Tile_Async", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return */ -/* - if (chameleon_max(N, 0) == 0) - return MORSE_SUCCESS; -*/ - morse_pztrtri(uplo, MorseNonUnit, A, sequence, request); + /* + if (chameleon_max(N, 0) == 0) + return MORSE_SUCCESS; + */ + morse_pztrtri( uplo, MorseNonUnit, A, sequence, request ); - morse_pzlauum(uplo, A, sequence, request); + morse_pzlauum( uplo, A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zpotrimm.c b/compute/zpotrimm.c index 180725746aa845cb28b197c915d64304e6e226e1..ec2f8759a6a6dd690545751c165cbfd71044c36b 100644 --- a/compute/zpotrimm.c +++ b/compute/zpotrimm.c @@ -74,17 +74,19 @@ * @sa MORSE_zpotrf * ******************************************************************************/ -int MORSE_zpotrimm(MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB, - MORSE_Complex64_t *C, int LDC) +int MORSE_zpotrimm( MORSE_enum uplo, int N, + MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t *B, int LDB, + MORSE_Complex64_t *C, int LDC ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; + MORSE_desc_t descCl, descCt; morse = morse_context_self(); if (morse == NULL) { @@ -92,7 +94,7 @@ int MORSE_zpotrimm(MORSE_enum uplo, int N, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotrimm", "illegal value of uplo"); return -1; } @@ -126,38 +128,36 @@ int MORSE_zpotrimm(MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInput, MorseUpperLower, + B, NB, NB, LDB, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zpotrimm_Tile_Async(uplo, &descA, &descB, &descC, sequence, &request); + MORSE_zpotrimm_Tile_Async( uplo, &descAt, &descBt, &descCt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, A, NB, NB, LDB, N, sequence, &request); - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -205,7 +205,7 @@ int MORSE_zpotrimm(MORSE_enum uplo, int N, * @sa MORSE_zpotrf_Tile * ******************************************************************************/ -int MORSE_zpotrimm_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc_t *C) +int MORSE_zpotrimm_Tile( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -217,13 +217,17 @@ int MORSE_zpotrimm_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, MORSE morse_fatal_error("MORSE_zpotrimm_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zpotrimm_Tile_Async(uplo, A, B, C, sequence, &request); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zpotrimm_Tile_Async( uplo, A, B, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( C, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -258,8 +262,8 @@ int MORSE_zpotrimm_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, MORSE * @sa MORSE_zpotrf_Tile_Async * ******************************************************************************/ -int MORSE_zpotrimm_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zpotrimm_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc_t *C, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -277,10 +281,12 @@ int MORSE_zpotrimm_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -308,7 +314,7 @@ int MORSE_zpotrimm_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, morse_error("MORSE_zpotrimm_Tile_Async", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotrimm_Tile_Async", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } @@ -317,11 +323,11 @@ int MORSE_zpotrimm_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, if (chameleon_max(N, 0) == 0) return MORSE_SUCCESS; */ - morse_pzpotrimm(uplo, A, B, C, sequence, request); + morse_pzpotrimm( uplo, A, B, C, sequence, request ); /* - morse_pztrtri(uplo, MorseNonUnit, A, sequence, request); - morse_pzlauum(uplo, A, sequence, request); - */ + morse_pztrtri( uplo, MorseNonUnit, A, sequence, request ); + morse_pzlauum( uplo, A, sequence, request ); + */ return MORSE_SUCCESS; } diff --git a/compute/zpotrs.c b/compute/zpotrs.c index 0494b688426132276bb426e911b8645bbd439e35..7ff43c5698b9f6eda87fe6342edf3abdca8ed95d 100644 --- a/compute/zpotrs.c +++ b/compute/zpotrs.c @@ -80,16 +80,17 @@ * @sa MORSE_zpotrf * ******************************************************************************/ -int MORSE_zpotrs(MORSE_enum uplo, int N, int NRHS, +int MORSE_zpotrs( MORSE_enum uplo, int N, int NRHS, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -97,7 +98,7 @@ int MORSE_zpotrs(MORSE_enum uplo, int N, int NRHS, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotrs", "illegal value of uplo"); return -1; } @@ -131,36 +132,31 @@ int MORSE_zpotrs(MORSE_enum uplo, int N, int NRHS, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zpotrs_Tile_Async(uplo, &descA, &descB, sequence, &request); + MORSE_zpotrs_Tile_Async( uplo, &descAt, &descBt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -205,7 +201,7 @@ int MORSE_zpotrs(MORSE_enum uplo, int N, int NRHS, * @sa MORSE_zpotrf_Tile * ******************************************************************************/ -int MORSE_zpotrs_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) +int MORSE_zpotrs_Tile( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -217,14 +213,16 @@ int MORSE_zpotrs_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) morse_fatal_error("MORSE_zpotrs_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zpotrs_Tile_Async(uplo, A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zpotrs_Tile_Async( uplo, A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -258,8 +256,8 @@ int MORSE_zpotrs_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) * @sa MORSE_zpotrf_Tile_Async * ******************************************************************************/ -int MORSE_zpotrs_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zpotrs_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -277,10 +275,12 @@ int MORSE_zpotrs_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -296,18 +296,18 @@ int MORSE_zpotrs_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, morse_error("MORSE_zpotrs_Tile", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zpotrs_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseConjTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request); + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseConjTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request ); - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseConjTrans, MorseNonUnit, 1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseConjTrans, MorseNonUnit, 1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zsymm.c b/compute/zsymm.c index 344f04da6f07ecd8b3be760a95e8d3621aaee504..a6662f3e9adeb3b6c2468e4ee859f325c94395af 100644 --- a/compute/zsymm.c +++ b/compute/zsymm.c @@ -106,15 +106,17 @@ * @sa MORSE_ssymm * ******************************************************************************/ -int MORSE_zsymm(MORSE_enum side, MORSE_enum uplo, int M, int N, +int MORSE_zsymm( MORSE_enum side, MORSE_enum uplo, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB, - MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC) + MORSE_Complex64_t *B, int LDB, + MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC ) { int NB; int Am; int status; - MORSE_desc_t descA, descB, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; + MORSE_desc_t descCl, descCt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -171,43 +173,36 @@ int MORSE_zsymm(MORSE_enum side, MORSE_enum uplo, int M, int N, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, Am, 0, 0, Am, Am, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, Am, 0, 0, Am, Am,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, Am, Am, Am, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInput, MorseUpperLower, + B, NB, NB, LDB, N, M, N, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zsymm_Tile_Async( - side, uplo, alpha, &descA, &descB, beta, &descC, sequence, &request); + MORSE_zsymm_Tile_Async( side, uplo, alpha, &descAt, &descBt, beta, &descCt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, Am, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, N, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -270,9 +265,9 @@ int MORSE_zsymm(MORSE_enum side, MORSE_enum uplo, int M, int N, * @sa MORSE_ssymm_Tile * ******************************************************************************/ -int MORSE_zsymm_Tile(MORSE_enum side, MORSE_enum uplo, +int MORSE_zsymm_Tile( MORSE_enum side, MORSE_enum uplo, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_Complex64_t beta, MORSE_desc_t *C) + MORSE_Complex64_t beta, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -284,15 +279,17 @@ int MORSE_zsymm_Tile(MORSE_enum side, MORSE_enum uplo, morse_fatal_error("MORSE_zsymm_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zsymm_Tile_Async(side, uplo, alpha, A, B, beta, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zsymm_Tile_Async(side, uplo, alpha, A, B, beta, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( C, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -324,10 +321,10 @@ int MORSE_zsymm_Tile(MORSE_enum side, MORSE_enum uplo, * @sa MORSE_ssymm_Tile_Async * ******************************************************************************/ -int MORSE_zsymm_Tile_Async(MORSE_enum side, MORSE_enum uplo, +int MORSE_zsymm_Tile_Async( MORSE_enum side, MORSE_enum uplo, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_Complex64_t beta, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -345,10 +342,12 @@ int MORSE_zsymm_Tile_Async(MORSE_enum side, MORSE_enum uplo, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -416,11 +415,13 @@ int MORSE_zsymm_Tile_Async(MORSE_enum side, MORSE_enum uplo, } /* Quick return */ - if (C->m == 0 || C->n == 0 || - ( (alpha == (MORSE_Complex64_t)0.0) && (beta == (MORSE_Complex64_t)1.0) )) + if ( (C->m == 0) || (C->n == 0) || + ( (alpha == (MORSE_Complex64_t)0.0) && (beta == (MORSE_Complex64_t)1.0) ) ) + { return MORSE_SUCCESS; + } - morse_pzsymm(side, uplo, alpha, A, B, beta, C, sequence, request); + morse_pzsymm( side, uplo, alpha, A, B, beta, C, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zsyr2k.c b/compute/zsyr2k.c index 50c9b234e36efeb66d03c3347ebc1c6e88a56f2d..84a501a4808176c987358ebbca2a9d9a0a5a2d27 100644 --- a/compute/zsyr2k.c +++ b/compute/zsyr2k.c @@ -83,7 +83,7 @@ * @param[in] LDB * The leading dimension of the array B. LDB must be at least * max( 1, N ), otherwise LDB must be at least max( 1, K ). - * + * * @param[in] beta * beta specifies the scalar beta. * @@ -108,14 +108,16 @@ * @sa MORSE_ssyr2k * ******************************************************************************/ -int MORSE_zsyr2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, - MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC) +int MORSE_zsyr2k( MORSE_enum uplo, MORSE_enum trans, int N, int K, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, + MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC ) { int NB; int Am, An; int status; - MORSE_desc_t descA, descB, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; + MORSE_desc_t descCl, descCt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -135,7 +137,7 @@ int MORSE_zsyr2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, morse_error("MORSE_zsyr2k", "illegal value of trans"); return -2; } - if ( trans == MorseNoTrans ) { + if ( trans == MorseNoTrans ) { Am = N; An = K; } else { Am = K; An = N; @@ -176,42 +178,36 @@ int MORSE_zsyr2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, An, 0, 0, Am, An, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInput, MorseUpperLower, + B, NB, NB, LDB, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, uplo, + C, NB, NB, LDC, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zsyr2k_Tile_Async(uplo, trans, alpha, &descA, &descB, beta, &descC, sequence, &request); + MORSE_zsyr2k_Tile_Async( uplo, trans, alpha, &descAt, &descBt, beta, &descCt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, uplo, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, An, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -269,9 +265,9 @@ int MORSE_zsyr2k(MORSE_enum uplo, MORSE_enum trans, int N, int K, * @sa MORSE_ssyr2k * ******************************************************************************/ -int MORSE_zsyr2k_Tile(MORSE_enum uplo, MORSE_enum trans, - MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_Complex64_t beta, MORSE_desc_t *C) +int MORSE_zsyr2k_Tile( MORSE_enum uplo, MORSE_enum trans, + MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_Complex64_t beta, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -283,15 +279,17 @@ int MORSE_zsyr2k_Tile(MORSE_enum uplo, MORSE_enum trans, morse_fatal_error("MORSE_zsyr2k_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zsyr2k_Tile_Async(uplo, trans, alpha, A, B, beta, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zsyr2k_Tile_Async( uplo, trans, alpha, A, B, beta, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -323,10 +321,10 @@ int MORSE_zsyr2k_Tile(MORSE_enum uplo, MORSE_enum trans, * @sa MORSE_ssyr2k_Tile_Async * ******************************************************************************/ -int MORSE_zsyr2k_Tile_Async(MORSE_enum uplo, MORSE_enum trans, - MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_Complex64_t beta, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zsyr2k_Tile_Async( MORSE_enum uplo, MORSE_enum trans, + MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_Complex64_t beta, MORSE_desc_t *C, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; int N, K; @@ -346,10 +344,12 @@ int MORSE_zsyr2k_Tile_Async(MORSE_enum uplo, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -406,10 +406,10 @@ int MORSE_zsyr2k_Tile_Async(MORSE_enum uplo, MORSE_enum trans, /* Quick return */ if ( N == 0 || - ((alpha == (MORSE_Complex64_t)0.0 || K == 0) && beta == (MORSE_Complex64_t)1.0)) + ((alpha == (MORSE_Complex64_t)0.0 || K == 0) && beta == (MORSE_Complex64_t)1.0)) return MORSE_SUCCESS; - morse_pzsyr2k(uplo, trans, alpha, A, B, beta, C, sequence, request); + morse_pzsyr2k( uplo, trans, alpha, A, B, beta, C, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zsyrk.c b/compute/zsyrk.c index 4b29d6b7f93eb1e267d901ae11a897b6119bc634..2dd3e6ac15d9a225cbc45c5b79fde39396386a61 100644 --- a/compute/zsyrk.c +++ b/compute/zsyrk.c @@ -98,14 +98,15 @@ * @sa MORSE_ssyrk * ******************************************************************************/ -int MORSE_zsyrk(MORSE_enum uplo, MORSE_enum trans, int N, int K, +int MORSE_zsyrk( MORSE_enum uplo, MORSE_enum trans, int N, int K, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC) + MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC ) { int NB; int Am, An; int status; - MORSE_desc_t descA, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descCl, descCt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -125,7 +126,7 @@ int MORSE_zsyrk(MORSE_enum uplo, MORSE_enum trans, int N, int K, morse_error("MORSE_zsyrk", "illegal value of trans"); return -2; } - if ( trans == MorseNoTrans ) { + if ( trans == MorseNoTrans ) { Am = N; An = K; } else { Am = K; An = N; @@ -162,36 +163,31 @@ int MORSE_zsyrk(MORSE_enum uplo, MORSE_enum trans, int N, int K, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpperLower, + A, NB, NB, LDA, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, uplo, + C, NB, NB, LDC, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zsyrk_Tile_Async(uplo, trans, alpha, &descA, beta, &descC, sequence, &request); + MORSE_zsyrk_Tile_Async( uplo, trans, alpha, &descAt, beta, &descCt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, uplo, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -245,9 +241,9 @@ int MORSE_zsyrk(MORSE_enum uplo, MORSE_enum trans, int N, int K, * @sa MORSE_ssyrk * ******************************************************************************/ -int MORSE_zsyrk_Tile(MORSE_enum uplo, MORSE_enum trans, +int MORSE_zsyrk_Tile( MORSE_enum uplo, MORSE_enum trans, MORSE_Complex64_t alpha, MORSE_desc_t *A, - MORSE_Complex64_t beta, MORSE_desc_t *C) + MORSE_Complex64_t beta, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -259,14 +255,16 @@ int MORSE_zsyrk_Tile(MORSE_enum uplo, MORSE_enum trans, morse_fatal_error("MORSE_zsyrk_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zsyrk_Tile_Async(uplo, trans, alpha, A, beta, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zsyrk_Tile_Async( uplo, trans, alpha, A, beta, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -298,10 +296,10 @@ int MORSE_zsyrk_Tile(MORSE_enum uplo, MORSE_enum trans, * @sa MORSE_ssyrk_Tile_Async * ******************************************************************************/ -int MORSE_zsyrk_Tile_Async(MORSE_enum uplo, MORSE_enum trans, +int MORSE_zsyrk_Tile_Async( MORSE_enum uplo, MORSE_enum trans, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_Complex64_t beta, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; int N, K; @@ -321,10 +319,12 @@ int MORSE_zsyrk_Tile_Async(MORSE_enum uplo, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -377,10 +377,10 @@ int MORSE_zsyrk_Tile_Async(MORSE_enum uplo, MORSE_enum trans, /* Quick return */ if ( N == 0 || - ((alpha == (MORSE_Complex64_t)0.0 || K == 0) && beta == (MORSE_Complex64_t)1.0)) + ((alpha == (MORSE_Complex64_t)0.0 || K == 0) && beta == (MORSE_Complex64_t)1.0)) return MORSE_SUCCESS; - morse_pzsyrk(uplo, trans, alpha, A, beta, C, sequence, request); + morse_pzsyrk( uplo, trans, alpha, A, beta, C, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zsysv.c b/compute/zsysv.c index d39bda8bfff3341c1453dcd894478e17d9de50e2..a53b8cb57eb575da39f9b05387dec10f8483b09f 100644 --- a/compute/zsysv.c +++ b/compute/zsysv.c @@ -92,16 +92,17 @@ * @sa MORSE_csysv * ******************************************************************************/ -int MORSE_zsysv(MORSE_enum uplo, int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) +int MORSE_zsysv( MORSE_enum uplo, int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -109,7 +110,7 @@ int MORSE_zsysv(MORSE_enum uplo, int N, int NRHS, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zsysv", "illegal value of uplo"); return -1; } @@ -144,37 +145,31 @@ int MORSE_zsysv(MORSE_enum uplo, int N, int NRHS, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zsysv_Tile_Async(uplo, &descA, &descB, sequence, &request); + MORSE_zsysv_Tile_Async( uplo, &descAt, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -221,9 +216,9 @@ int MORSE_zsysv(MORSE_enum uplo, int N, int NRHS, * @sa MORSE_zsysv * @sa MORSE_zsysv_Tile_Async * @sa MORSE_csysv_Tile -* + * ******************************************************************************/ -int MORSE_zsysv_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) +int MORSE_zsysv_Tile( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -235,14 +230,16 @@ int MORSE_zsysv_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) morse_fatal_error("MORSE_zsysv_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zsysv_Tile_Async(uplo, A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zsysv_Tile_Async( uplo, A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -273,8 +270,8 @@ int MORSE_zsysv_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) * @sa MORSE_csysv_Tile_Async * ******************************************************************************/ -int MORSE_zsysv_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zsysv_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -292,10 +289,12 @@ int MORSE_zsysv_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -311,21 +310,21 @@ int MORSE_zsysv_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, morse_error("MORSE_zsysv_Tile", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zsysv_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return - currently NOT equivalent to LAPACK's * LAPACK does not have such check for Dsysv */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ - morse_pzsytrf(uplo, A, sequence, request); + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ + morse_pzsytrf( uplo, A, sequence, request ); - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request ); - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseTrans, MorseNonUnit, 1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseTrans, MorseNonUnit, 1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zsytrf.c b/compute/zsytrf.c index c2e3eeead99ea9237859064a13a66558fdc25360..11d74b77576fe3474cfd29ef9396a1788abd88c9 100644 --- a/compute/zsytrf.c +++ b/compute/zsytrf.c @@ -78,15 +78,15 @@ * @sa MORSE_zpotrs * ******************************************************************************/ -int MORSE_zsytrf(MORSE_enum uplo, int N, - MORSE_Complex64_t *A, int LDA) +int MORSE_zsytrf( MORSE_enum uplo, int N, + MORSE_Complex64_t *A, int LDA ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -94,7 +94,7 @@ int MORSE_zsytrf(MORSE_enum uplo, int N, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zsytrf", "illegal value of uplo"); return -1; } @@ -120,30 +120,26 @@ int MORSE_zsytrf(MORSE_enum uplo, int N, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_zsytrf_Tile_Async(uplo, &descA, sequence, &request); + MORSE_zsytrf_Tile_Async( uplo, &descAt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -188,7 +184,7 @@ int MORSE_zsytrf(MORSE_enum uplo, int N, * @sa MORSE_csytrf_Tile * ******************************************************************************/ -int MORSE_zsytrf_Tile(MORSE_enum uplo, MORSE_desc_t *A) +int MORSE_zsytrf_Tile( MORSE_enum uplo, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -200,13 +196,15 @@ int MORSE_zsytrf_Tile(MORSE_enum uplo, MORSE_desc_t *A) morse_fatal_error("MORSE_zsytrf_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zsytrf_Tile_Async(uplo, A, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zsytrf_Tile_Async( uplo, A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -237,8 +235,8 @@ int MORSE_zsytrf_Tile(MORSE_enum uplo, MORSE_desc_t *A) * @sa MORSE_csytrf_Tile_Async * ******************************************************************************/ -int MORSE_zsytrf_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zsytrf_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -256,10 +254,12 @@ int MORSE_zsytrf_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -271,16 +271,16 @@ int MORSE_zsytrf_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, morse_error("MORSE_zsytrf_Tile_Async", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zsytrf_Tile_Async", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return */ -/* - if (chameleon_max(N, 0) == 0) - return MORSE_SUCCESS; -*/ - morse_pzsytrf(uplo, A, sequence, request); + /* + if (chameleon_max(N, 0) == 0) + return MORSE_SUCCESS; + */ + morse_pzsytrf( uplo, A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zsytrs.c b/compute/zsytrs.c index df6f7d9dea81ba12ef7e6f443d14f3f9105b2796..7223993d95d2b857c8eebdb664f1c318fecf9333 100644 --- a/compute/zsytrs.c +++ b/compute/zsytrs.c @@ -79,16 +79,17 @@ * @sa MORSE_csytrs * ******************************************************************************/ -int MORSE_zsytrs(MORSE_enum uplo, int N, int NRHS, - MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) +int MORSE_zsytrs( MORSE_enum uplo, int N, int NRHS, + MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -96,7 +97,7 @@ int MORSE_zsytrs(MORSE_enum uplo, int N, int NRHS, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zsytrs", "illegal value of uplo"); return -1; } @@ -130,36 +131,31 @@ int MORSE_zsytrs(MORSE_enum uplo, int N, int NRHS, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_zsytrs_Tile_Async(uplo, &descA, &descB, sequence, &request); + MORSE_zsytrs_Tile_Async( uplo, &descAt, &descBt, sequence, &request ); + + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ - status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -201,7 +197,7 @@ int MORSE_zsytrs(MORSE_enum uplo, int N, int NRHS, * @sa MORSE_csytrs_Tile * ******************************************************************************/ -int MORSE_zsytrs_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) +int MORSE_zsytrs_Tile( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -213,14 +209,16 @@ int MORSE_zsytrs_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) morse_fatal_error("MORSE_zsytrs_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zsytrs_Tile_Async(uplo, A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zsytrs_Tile_Async( uplo, A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -251,8 +249,8 @@ int MORSE_zsytrs_Tile(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B) * @sa MORSE_csytrs_Tile_Async * ******************************************************************************/ -int MORSE_zsytrs_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zsytrs_Tile_Async( MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -270,10 +268,12 @@ int MORSE_zsytrs_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -289,18 +289,18 @@ int MORSE_zsytrs_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, MORSE_desc_t *B, morse_error("MORSE_zsytrs_Tile", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_zsytrs_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } /* Quick return */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request); + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseTrans : MorseNoTrans, MorseNonUnit, 1.0, A, B, sequence, request ); - morse_pztrsm(MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseTrans, MorseNonUnit, 1.0, A, B, sequence, request); + morse_pztrsm( MorseLeft, uplo, uplo == MorseUpper ? MorseNoTrans : MorseTrans, MorseNonUnit, 1.0, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/ztile.c b/compute/ztile.c index 5377a78643d356f397c3e46011c097a8113a157d..868a565e4178542648efe0234f848cd32a651df6 100644 --- a/compute/ztile.c +++ b/compute/ztile.c @@ -55,18 +55,18 @@ * ******************************************************************************* * - * @sa MORSE_zLapack_to_Tile_Async * @sa MORSE_zTile_to_Lapack * @sa MORSE_cLapack_to_Tile * @sa MORSE_dLapack_to_Tile * @sa MORSE_sLapack_to_Tile * ******************************************************************************/ -int MORSE_zLapack_to_Tile(MORSE_Complex64_t *Af77, int LDA, MORSE_desc_t *A) +int MORSE_zLapack_to_Tile( MORSE_Complex64_t *Af77, int LDA, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request; + MORSE_desc_t *B; int status; morse = morse_context_self(); @@ -79,79 +79,28 @@ int MORSE_zLapack_to_Tile(MORSE_Complex64_t *Af77, int LDA, MORSE_desc_t *A) morse_error("MORSE_zLapack_to_Tile", "invalid descriptor"); return MORSE_ERR_ILLEGAL_VALUE; } - morse_sequence_create(morse, &sequence); - morse_pzlapack_to_tile( Af77, LDA, A, sequence, &request); + /* Create the B descriptor to handle the Lapack format matrix */ + MORSE_Desc_Create_User( &B, Af77, MorseComplexDouble, A->mb, A->nb, A->bsiz, + LDA, A->n, 0, 0, A->m, A->n, 1, 1, + morse_getaddr_cm, morse_getblkldd_cm, NULL ); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_sequence_wait( morse, sequence ); + /* Start the computation */ + morse_sequence_create( morse, &sequence ); - status = sequence->status; - morse_sequence_destroy(morse, sequence); - return status; -} + morse_pzlacpy( MorseUpperLower, B, A, sequence, &request ); -/** - ******************************************************************************** - * - * @ingroup MORSE_Complex64_t_Tile_Async - * - * MORSE_zLapack_to_Tile_Async - Conversion from LAPACK layout to tile layout. - * Non-blocking equivalent of MORSE_zLapack_to_Tile(). - * May return before the computation is finished. - * Allows for pipelining of operations ar runtime. - * - * - ******************************************************************************* - * - * @param[in] Af77 - * LAPACK matrix. - * - * @param[in] LDA - * The leading dimension of the matrix Af77. - * - * @param[in,out] A - * Descriptor of the MORSE matrix in tile layout. - * If MORSE_TRANSLATION_MODE is set to MORSE_INPLACE, - * A->mat is not used and set to Af77 when returns, else if - * MORSE_TRANSLATION_MODE is set to MORSE_OUTOFPLACE, - * A->mat has to be allocated before. - * - * @param[in] sequence - * Identifies the sequence of function calls that this call belongs to - * (for completion checks and exception handling purposes). - * - * @param[out] request - * Identifies this function call (for exception handling purposes). - * - ******************************************************************************* - * - * @sa MORSE_zTile_to_Lapack_Async - * @sa MORSE_zLapack_to_Tile - * @sa MORSE_cLapack_to_Tile_Async - * @sa MORSE_dLapack_to_Tile_Async - * @sa MORSE_sLapack_to_Tile_Async - * - ******************************************************************************/ -int MORSE_zLapack_to_Tile_Async(MORSE_Complex64_t *Af77, int LDA, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) -{ - MORSE_context_t *morse; + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( A, sequence ); - morse = morse_context_self(); - if (morse == NULL) { - morse_fatal_error("MORSE_zLapack_to_Tile", "MORSE not initialized"); - return MORSE_ERR_NOT_INITIALIZED; - } - /* Check descriptor for correctness */ - if (morse_desc_check( A ) != MORSE_SUCCESS) { - morse_error("MORSE_zLapack_to_Tile", "invalid descriptor"); - return MORSE_ERR_ILLEGAL_VALUE; - } + morse_sequence_wait( morse, sequence ); - morse_pzlapack_to_tile( Af77, LDA, A, sequence, request); + /* Destroy temporary B descriptor */ + MORSE_Desc_Destroy( &B ); - return MORSE_SUCCESS; + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return status; } /** @@ -183,18 +132,18 @@ int MORSE_zLapack_to_Tile_Async(MORSE_Complex64_t *Af77, int LDA, MORSE_desc_t * * ******************************************************************************* * - * @sa MORSE_zTile_to_Lapack_Async * @sa MORSE_zLapack_to_Tile * @sa MORSE_cTile_to_Lapack * @sa MORSE_dTile_to_Lapack * @sa MORSE_sTile_to_Lapack * -******************************************************************************/ -int MORSE_zTile_to_Lapack(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int LDA) + ******************************************************************************/ +int MORSE_zTile_to_Lapack( MORSE_desc_t *A, MORSE_Complex64_t *Af77, int LDA ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request; + MORSE_desc_t *B; int status; morse = morse_context_self(); @@ -207,76 +156,25 @@ int MORSE_zTile_to_Lapack(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int LDA) morse_error("MORSE_zTile_to_Lapack", "invalid descriptor"); return MORSE_ERR_ILLEGAL_VALUE; } - morse_sequence_create(morse, &sequence); - morse_pztile_to_lapack( A, Af77, LDA, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_sequence_wait( morse, sequence ); + /* Create the B descriptor to handle the Lapack format matrix */ + MORSE_Desc_Create_User( &B, Af77, MorseComplexDouble, A->mb, A->nb, A->bsiz, + LDA, A->n, 0, 0, A->m, A->n, 1, 1, + morse_getaddr_cm, morse_getblkldd_cm, NULL ); - status = sequence->status; - morse_sequence_destroy(morse, sequence); - return status; -} + /* Start the computation */ + morse_sequence_create( morse, &sequence ); -/** - ******************************************************************************** - * - * @ingroup MORSE_Complex64_t_Tile_Async - * - * MORSE_zTile_to_Lapack_Async - Conversion from LAPACK layout to tile layout. - * Non-blocking equivalent of MORSE_zTile_to_Lapack(). - * May return before the computation is finished. - * Allows for pipelining of operations ar runtime. - * - * - ******************************************************************************* - * - * @param[in] A - * Descriptor of the MORSE matrix in tile layout. - * - * @param[in,out] Af77 - * LAPACK matrix. - * If MORSE_TRANSLATION_MODE is set to MORSE_INPLACE, - * Af77 has to be A->mat, else if - * MORSE_TRANSLATION_MODE is set to MORSE_OUTOFPLACE, - * Af77 has to be allocated before. - * - * @param[in] LDA - * The leading dimension of the matrix Af77. - * - * @param[in] sequence - * Identifies the sequence of function calls that this call belongs to - * (for completion checks and exception handling purposes). - * - * @param[out] request - * Identifies this function call (for exception handling purposes). - * - ******************************************************************************* - * - * @sa MORSE_zLapack_to_Tile_Async - * @sa MORSE_zTile_to_Lapack - * @sa MORSE_cTile_to_Lapack_Async - * @sa MORSE_dTile_to_Lapack_Async - * @sa MORSE_sTile_to_Lapack_Async - * - ******************************************************************************/ -int MORSE_zTile_to_Lapack_Async(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int LDA, - MORSE_sequence_t *sequence, MORSE_request_t *request) -{ - MORSE_context_t *morse; + morse_pzlacpy( MorseUpperLower, A, B, sequence, &request ); - morse = morse_context_self(); - if (morse == NULL) { - morse_fatal_error("MORSE_zTile_to_Lapack", "MORSE not initialized"); - return MORSE_ERR_NOT_INITIALIZED; - } - /* Check descriptor for correctness */ - if (morse_desc_check( A ) != MORSE_SUCCESS) { - morse_error("MORSE_zTile_to_Lapack", "invalid descriptor"); - return MORSE_ERR_ILLEGAL_VALUE; - } + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); - morse_pztile_to_lapack( A, Af77, LDA, sequence, request ); + MORSE_Desc_Destroy( &B ); - return MORSE_SUCCESS; + status = sequence->status; + morse_sequence_destroy( morse, sequence ); + return status; } diff --git a/compute/ztpgqrt.c b/compute/ztpgqrt.c index bf6fee28d640f5e6345299766d1e983c74a5a7d3..d28a530995221f3bd0181658f6e23c836712fd1a 100644 --- a/compute/ztpgqrt.c +++ b/compute/ztpgqrt.c @@ -144,7 +144,10 @@ int MORSE_ztpgqrt( int M, int N, int K, int L, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descQ1, descQ2, descV1, descV2; + MORSE_desc_t descQ1l, descQ1t; + MORSE_desc_t descQ2l, descQ2t; + MORSE_desc_t descV1l, descV1t; + MORSE_desc_t descV2l, descV2t; int minMK = chameleon_min( M, K ); morse = morse_context_self(); @@ -205,49 +208,41 @@ int MORSE_ztpgqrt( int M, int N, int K, int L, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descV1, V1, NB, NB, LDV1, K, 0, 0, M, K, sequence, &request, - morse_desc_mat_free(&(descV1)) ); - morse_zooplap2tile( descV2, V2, NB, NB, LDV2, K, 0, 0, M, K, sequence, &request, - (morse_desc_mat_free(&(descV1)), - morse_desc_mat_free(&(descV2))) ); - morse_zooplap2tile( descQ1, Q1, NB, NB, LDQ1, N, 0, 0, K, N, sequence, &request, - (morse_desc_mat_free(&(descV1)), - morse_desc_mat_free(&(descV2)), - morse_desc_mat_free(&(descQ1))) ); - morse_zooplap2tile( descQ2, Q2, NB, NB, LDQ2, N, 0, 0, M, N, sequence, &request, - (morse_desc_mat_free(&(descV1)), - morse_desc_mat_free(&(descV2)), - morse_desc_mat_free(&(descQ1)), - morse_desc_mat_free(&(descQ2))) ); -/* } else {*/ -/* morse_ziplap2tile( descQ1, Q1, NB, NB, LDQ1, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descV1l, &descV1t, MorseDescInput, MorseUpperLower, + V1, NB, NB, LDV1, K, M, K, sequence, &request ); + morse_zlap2tile( morse, &descV2l, &descV2t, MorseDescInput, MorseUpperLower, + V2, NB, NB, LDV2, K, M, K, sequence, &request ); + morse_zlap2tile( morse, &descQ1l, &descQ1t, MorseDescInout, MorseUpperLower, + Q1, NB, NB, LDQ1, N, K, N, sequence, &request ); + morse_zlap2tile( morse, &descQ2l, &descQ2t, MorseDescInout, MorseUpperLower, + Q2, NB, NB, LDQ2, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_ztpgqrt_Tile_Async(L, &descV1, descT1, &descV2, descT2, &descQ1, &descQ2, sequence, &request); + MORSE_ztpgqrt_Tile_Async( L, &descV1t, descT1, &descV2t, descT2, &descQ1t, &descQ2t, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descQ1, Q1, NB, NB, LDQ1, N, sequence, &request); - morse_zooptile2lap(descQ2, Q2, NB, NB, LDQ2, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descV1); - morse_desc_mat_free(&descV2); - morse_desc_mat_free(&descQ1); - morse_desc_mat_free(&descQ2); -/* } else {*/ -/* morse_ziptile2lap( descV1, V1, NB, NB, LDV1, K, sequence, &request);*/ -/* morse_ziptile2lap( descV2, V2, NB, NB, LDV2, K, sequence, &request);*/ -/* morse_ziptile2lap( descQ1, Q1, NB, NB, LDQ1, N, sequence, &request);*/ -/* morse_ziptile2lap( descQ2, Q2, NB, NB, LDQ2, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descV1l, &descV1t, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descV2l, &descV2t, + MorseDescInput, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descQ1l, &descQ1t, + MorseDescInout, MorseUpperLower, sequence, &request ); + morse_ztile2lap( morse, &descQ2l, &descQ2t, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descV1l, &descV1t ); + morse_ztile2lap_cleanup( morse, &descV2l, &descV2t ); + morse_ztile2lap_cleanup( morse, &descQ1l, &descQ1t ); + morse_ztile2lap_cleanup( morse, &descQ2l, &descQ2t ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -294,14 +289,20 @@ int MORSE_ztpgqrt_Tile( int L, morse_fatal_error("MORSE_ztpgqrt_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_ztpgqrt_Tile_Async(L, V1, T1, V2, T2, Q1, Q2, sequence, &request); - RUNTIME_desc_flush( Q1, sequence ); - RUNTIME_desc_flush( Q2, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_ztpgqrt_Tile_Async( L, V1, T1, V2, T2, Q1, Q2, sequence, &request ); + MORSE_Desc_Flush( V1, sequence ); + MORSE_Desc_Flush( T1, sequence ); + MORSE_Desc_Flush( V2, sequence ); + MORSE_Desc_Flush( T2, sequence ); + MORSE_Desc_Flush( Q1, sequence ); + MORSE_Desc_Flush( Q2, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -357,10 +358,12 @@ int MORSE_ztpgqrt_Tile_Async( int L, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(V1) != MORSE_SUCCESS) { @@ -400,7 +403,7 @@ int MORSE_ztpgqrt_Tile_Async( int L, { int minMT; if (V1->m > V1->n) { - minMT = V1->nt; + minMT = V1->nt; } else { minMT = V1->mt; } @@ -415,10 +418,18 @@ int MORSE_ztpgqrt_Tile_Async( int L, morse_pztpgqrt( L, V1, T1, V2, T2, Q1, Q2, Dptr, sequence, request ); /* } */ /* else { */ - /* morse_pztpgqrtrh(Q1, T, MORSE_RHBLK, sequence, request); */ + /* morse_pztpgqrtrh( Q1, T, MORSE_RHBLK, sequence, request ); */ /* } */ if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( V1, sequence ); + MORSE_Desc_Flush( T1, sequence ); + MORSE_Desc_Flush( V2, sequence ); + MORSE_Desc_Flush( T2, sequence ); + MORSE_Desc_Flush( Q1, sequence ); + MORSE_Desc_Flush( Q2, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/ztpqrt.c b/compute/ztpqrt.c index 3298638e02705a80365fc645a57c1c906e76c021..9f5f60bbffdeac37cbad20448128fae9a053466d 100644 --- a/compute/ztpqrt.c +++ b/compute/ztpqrt.c @@ -138,7 +138,8 @@ int MORSE_ztpqrt( int M, int N, int L, MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; int minMN = chameleon_min( M, N ); morse = morse_context_self(); @@ -183,35 +184,31 @@ int MORSE_ztpqrt( int M, int N, int L, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, sequence, &request, - (morse_desc_mat_free(&(descA)), morse_desc_mat_free(&(descB))) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, MorseUpper, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_ztpqrt_Tile_Async(L, &descA, &descB, descT, sequence, &request); + MORSE_ztpqrt_Tile_Async( L, &descAt, &descBt, descT, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_zooptile2lap(descB, B, NB, NB, LDB, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, MorseUpper, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -266,14 +263,17 @@ int MORSE_ztpqrt_Tile( int L, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc_t *T morse_fatal_error("MORSE_ztpqrt_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_ztpqrt_Tile_Async(L, A, B, T, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_ztpqrt_Tile_Async( L, A, B, T, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + MORSE_Desc_Flush( T, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -325,10 +325,12 @@ int MORSE_ztpqrt_Tile_Async( int L, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -354,10 +356,10 @@ int MORSE_ztpqrt_Tile_Async( int L, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc } /* if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { */ - morse_pztpqrt(L, A, B, T, sequence, request); + morse_pztpqrt( L, A, B, T, sequence, request ); /* } */ /* else { */ - /* morse_pztpqrtrh(A, T, MORSE_RHBLK, sequence, request); */ + /* morse_pztpqrtrh( A, T, MORSE_RHBLK, sequence, request ); */ /* } */ return MORSE_SUCCESS; diff --git a/compute/ztradd.c b/compute/ztradd.c index 7bbf05f99cc7828f7c8f7201cf1d63258c5a605d..bd88723f3df62ac702ab43c91ee3899661725b9c 100644 --- a/compute/ztradd.c +++ b/compute/ztradd.c @@ -97,14 +97,15 @@ * @sa MORSE_stradd * ******************************************************************************/ -int MORSE_ztradd(MORSE_enum uplo, MORSE_enum trans, int M, int N, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t beta, MORSE_Complex64_t *B, int LDB) +int MORSE_ztradd( MORSE_enum uplo, MORSE_enum trans, int M, int N, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t beta, MORSE_Complex64_t *B, int LDB ) { int NB; int Am, An; int status; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; @@ -161,37 +162,31 @@ int MORSE_ztradd(MORSE_enum uplo, MORSE_enum trans, int M, int N, /* Set MT & NT & KT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); - /* } else { */ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */ - /* sequence, &request); */ - /* morse_ziplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, */ - /* sequence, &request); */ - /* } */ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, An, Am, An, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, uplo, + B, NB, NB, LDB, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_ztradd_Tile_Async( - uplo, trans, alpha, &descA, beta, &descB, sequence, &request); + MORSE_ztradd_Tile_Async( uplo, trans, alpha, &descAt, beta, &descBt, sequence, &request ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */ - morse_zooptile2lap( descB, B, NB, NB, LDB, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); - /* } else { */ - /* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request); */ - /* morse_ziptile2lap( descB, B, NB, NB, LDB, N, sequence, &request); */ - /* morse_dynamic_sync(); */ - /* } */ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -249,9 +244,9 @@ int MORSE_ztradd(MORSE_enum uplo, MORSE_enum trans, int M, int N, * @sa MORSE_stradd_Tile * ******************************************************************************/ -int MORSE_ztradd_Tile(MORSE_enum uplo, MORSE_enum trans, +int MORSE_ztradd_Tile( MORSE_enum uplo, MORSE_enum trans, MORSE_Complex64_t alpha, MORSE_desc_t *A, - MORSE_Complex64_t beta, MORSE_desc_t *B) + MORSE_Complex64_t beta, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -263,14 +258,16 @@ int MORSE_ztradd_Tile(MORSE_enum uplo, MORSE_enum trans, morse_fatal_error("MORSE_ztradd_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_ztradd_Tile_Async(uplo, trans, alpha, A, beta, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_ztradd_Tile_Async( uplo, trans, alpha, A, beta, B, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -303,10 +300,10 @@ int MORSE_ztradd_Tile(MORSE_enum uplo, MORSE_enum trans, * @sa MORSE_stradd_Tile_Async * ******************************************************************************/ -int MORSE_ztradd_Tile_Async(MORSE_enum uplo, MORSE_enum trans, - MORSE_Complex64_t alpha, MORSE_desc_t *A, - MORSE_Complex64_t beta, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_ztradd_Tile_Async( MORSE_enum uplo, MORSE_enum trans, + MORSE_Complex64_t alpha, MORSE_desc_t *A, + MORSE_Complex64_t beta, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; int M, N; @@ -326,10 +323,12 @@ int MORSE_ztradd_Tile_Async(MORSE_enum uplo, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -383,7 +382,7 @@ int MORSE_ztradd_Tile_Async(MORSE_enum uplo, MORSE_enum trans, ((alpha == (MORSE_Complex64_t)0.0) && beta == (MORSE_Complex64_t)1.0)) return MORSE_SUCCESS; - morse_pztradd(uplo, trans, alpha, A, beta, B, sequence, request); + morse_pztradd( uplo, trans, alpha, A, beta, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/ztrmm.c b/compute/ztrmm.c index 434621d6da5963f885d2e35142b9d1db28b8f22f..3496308a72a917e781343b596c7836c4fe9a4d59 100644 --- a/compute/ztrmm.c +++ b/compute/ztrmm.c @@ -100,18 +100,19 @@ * @sa MORSE_strmm * ******************************************************************************/ -int MORSE_ztrmm(MORSE_enum side, MORSE_enum uplo, +int MORSE_ztrmm( MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, int N, int NRHS, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB, NA; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -120,9 +121,9 @@ int MORSE_ztrmm(MORSE_enum side, MORSE_enum uplo, } if (side == MorseLeft) { - NA = N; + NA = N; } else { - NA = NRHS; + NA = NRHS; } /* Check input arguments */ @@ -130,7 +131,7 @@ int MORSE_ztrmm(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrmm", "illegal value of side"); return -1; } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_ztrmm", "illegal value of uplo"); return -2; } @@ -141,7 +142,7 @@ int MORSE_ztrmm(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrmm", "illegal value of transA"); return -3; } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_ztrmm", "illegal value of diag"); return -4; } @@ -175,37 +176,31 @@ int MORSE_ztrmm(MORSE_enum side, MORSE_enum uplo, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, NA, 0, 0, NA, NA, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, NA, 0, 0, NA, NA, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, NA, NA, NA, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_ztrmm_Tile_Async( - side, uplo, transA, diag, alpha, &descA, &descB, sequence, &request); + MORSE_ztrmm_Tile_Async( side, uplo, transA, diag, alpha, &descAt, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, NA, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -271,9 +266,9 @@ int MORSE_ztrmm(MORSE_enum side, MORSE_enum uplo, * @sa MORSE_strmm_Tile * ******************************************************************************/ -int MORSE_ztrmm_Tile(MORSE_enum side, MORSE_enum uplo, +int MORSE_ztrmm_Tile( MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, - MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B) + MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -285,14 +280,16 @@ int MORSE_ztrmm_Tile(MORSE_enum side, MORSE_enum uplo, morse_fatal_error("MORSE_ztrmm_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_ztrmm_Tile_Async(side, uplo, transA, diag, alpha, A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_ztrmm_Tile_Async(side, uplo, transA, diag, alpha, A, B, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -324,10 +321,10 @@ int MORSE_ztrmm_Tile(MORSE_enum side, MORSE_enum uplo, * @sa MORSE_strmm_Tile_Async * ******************************************************************************/ -int MORSE_ztrmm_Tile_Async(MORSE_enum side, MORSE_enum uplo, +int MORSE_ztrmm_Tile_Async( MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -345,10 +342,12 @@ int MORSE_ztrmm_Tile_Async(MORSE_enum side, MORSE_enum uplo, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -368,7 +367,7 @@ int MORSE_ztrmm_Tile_Async(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrmm_Tile", "illegal value of side"); return morse_request_fail(sequence, request, -1); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_ztrmm_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -2); } @@ -376,13 +375,13 @@ int MORSE_ztrmm_Tile_Async(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrmm_Tile", "illegal value of transA"); return morse_request_fail(sequence, request, -3); } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_ztrmm_Tile", "illegal value of diag"); return morse_request_fail(sequence, request, -4); } /* Quick return */ - morse_pztrmm(side, uplo, transA, diag, alpha, A, B, sequence, request); + morse_pztrmm( side, uplo, transA, diag, alpha, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/ztrsm.c b/compute/ztrsm.c index db4e89dec01cd316b7933dd5faf1c798923cf1e1..053be9e3e2774c022818fbd7fdc6c5c783258285 100644 --- a/compute/ztrsm.c +++ b/compute/ztrsm.c @@ -101,18 +101,19 @@ * @sa MORSE_strsm * ******************************************************************************/ -int MORSE_ztrsm(MORSE_enum side, MORSE_enum uplo, +int MORSE_ztrsm( MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, int N, int NRHS, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB, NA; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -121,9 +122,9 @@ int MORSE_ztrsm(MORSE_enum side, MORSE_enum uplo, } if (side == MorseLeft) { - NA = N; + NA = N; } else { - NA = NRHS; + NA = NRHS; } /* Check input arguments */ @@ -131,7 +132,7 @@ int MORSE_ztrsm(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrsm", "illegal value of side"); return -1; } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_ztrsm", "illegal value of uplo"); return -2; } @@ -139,7 +140,7 @@ int MORSE_ztrsm(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrsm", "illegal value of transA"); return -3; } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_ztrsm", "illegal value of diag"); return -4; } @@ -173,37 +174,31 @@ int MORSE_ztrsm(MORSE_enum side, MORSE_enum uplo, /* Set NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, NA, 0, 0, NA, NA, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, NA, 0, 0, NA, NA, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, uplo, + A, NB, NB, LDA, NA, NA, NA, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_ztrsm_Tile_Async( - side, uplo, transA, diag, alpha, &descA, &descB, sequence, &request); + MORSE_ztrsm_Tile_Async( side, uplo, transA, diag, alpha, &descAt, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, NA, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, uplo, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } /** @@ -269,9 +264,9 @@ int MORSE_ztrsm(MORSE_enum side, MORSE_enum uplo, * @sa MORSE_strsm_Tile * ******************************************************************************/ -int MORSE_ztrsm_Tile(MORSE_enum side, MORSE_enum uplo, +int MORSE_ztrsm_Tile( MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, - MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B) + MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -283,14 +278,16 @@ int MORSE_ztrsm_Tile(MORSE_enum side, MORSE_enum uplo, morse_fatal_error("MORSE_ztrsm_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_ztrsm_Tile_Async(side, uplo, transA, diag, alpha, A, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_ztrsm_Tile_Async(side, uplo, transA, diag, alpha, A, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -322,10 +319,10 @@ int MORSE_ztrsm_Tile(MORSE_enum side, MORSE_enum uplo, * @sa MORSE_strsm_Tile_Async * ******************************************************************************/ -int MORSE_ztrsm_Tile_Async(MORSE_enum side, MORSE_enum uplo, +int MORSE_ztrsm_Tile_Async( MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -343,10 +340,12 @@ int MORSE_ztrsm_Tile_Async(MORSE_enum side, MORSE_enum uplo, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -366,7 +365,7 @@ int MORSE_ztrsm_Tile_Async(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrsm_Tile", "illegal value of side"); return morse_request_fail(sequence, request, -1); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_ztrsm_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -2); } @@ -374,13 +373,13 @@ int MORSE_ztrsm_Tile_Async(MORSE_enum side, MORSE_enum uplo, morse_error("MORSE_ztrsm_Tile", "illegal value of transA"); return morse_request_fail(sequence, request, -3); } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_ztrsm_Tile", "illegal value of diag"); return morse_request_fail(sequence, request, -4); } /* Quick return */ - morse_pztrsm(side, uplo, transA, diag, alpha, A, B, sequence, request); + morse_pztrsm( side, uplo, transA, diag, alpha, A, B, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/ztrsmpl.c b/compute/ztrsmpl.c index 0439834108f356cdb5ed263047c219f069596656..d84670ad98dc9fcf87bcccfd63c73b3538380f2c 100644 --- a/compute/ztrsmpl.c +++ b/compute/ztrsmpl.c @@ -80,17 +80,18 @@ * @sa MORSE_zgetrf_incpiv * ******************************************************************************/ -int MORSE_ztrsmpl(int N, int NRHS, +int MORSE_ztrsmpl( int N, int NRHS, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descL, int *IPIV, - MORSE_Complex64_t *B, int LDB) + MORSE_Complex64_t *B, int LDB ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descB; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descBl, descBt; morse = morse_context_self(); if (morse == NULL) { @@ -128,36 +129,31 @@ int MORSE_ztrsmpl(int N, int NRHS, /* Set Mt, NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, */ -/* sequence, &request);*/ -/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseLower, + A, NB, NB, LDA, N, N, N, sequence, &request ); + morse_zlap2tile( morse, &descBl, &descBt, MorseDescInout, MorseUpperLower, + B, NB, NB, LDB, NRHS, N, NRHS, sequence, &request ); /* Call the tile interface */ - MORSE_ztrsmpl_Tile_Async(&descA, descL, IPIV, &descB, sequence, &request); + MORSE_ztrsmpl_Tile_Async( &descAt, descL, IPIV, &descBt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descB); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseLower, sequence, &request ); + morse_ztile2lap( morse, &descBl, &descBt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descBl, &descBt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -200,7 +196,7 @@ int MORSE_ztrsmpl(int N, int NRHS, * @sa MORSE_zgetrf_incpiv_Tile * ******************************************************************************/ -int MORSE_ztrsmpl_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B) +int MORSE_ztrsmpl_Tile( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -212,14 +208,17 @@ int MORSE_ztrsmpl_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t morse_fatal_error("MORSE_ztrsmpl_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_ztrsmpl_Tile_Async(A, L, IPIV, B, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( B, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_ztrsmpl_Tile_Async( A, L, IPIV, B, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( L, sequence ); + MORSE_Desc_Flush( B, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -253,8 +252,8 @@ int MORSE_ztrsmpl_Tile(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t * @sa MORSE_zgetrf_incpiv_Tile_Async * ******************************************************************************/ -int MORSE_ztrsmpl_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_ztrsmpl_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_desc_t *B, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -272,10 +271,12 @@ int MORSE_ztrsmpl_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_ return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -296,11 +297,11 @@ int MORSE_ztrsmpl_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV, MORSE_ return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (chameleon_min(N, NRHS) == 0) - return MORSE_SUCCESS; -*/ - morse_pztrsmpl(A, B, L, IPIV, sequence, request); + /* + if (chameleon_min(N, NRHS) == 0) + return MORSE_SUCCESS; + */ + morse_pztrsmpl( A, B, L, IPIV, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/ztrtri.c b/compute/ztrtri.c index 2f2d36c6040991076ab17946577becfde41f311a..e4d822d94fce6c2b348925b26faf29c0bed71cfa 100644 --- a/compute/ztrtri.c +++ b/compute/ztrtri.c @@ -82,15 +82,15 @@ * @sa MORSE_zpotri * ******************************************************************************/ -int MORSE_ztrtri(MORSE_enum uplo, MORSE_enum diag, int N, - MORSE_Complex64_t *A, int LDA) +int MORSE_ztrtri( MORSE_enum uplo, MORSE_enum diag, int N, + MORSE_Complex64_t *A, int LDA ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA; + MORSE_desc_t descAl, descAt; morse = morse_context_self(); if (morse == NULL) { @@ -98,11 +98,11 @@ int MORSE_ztrtri(MORSE_enum uplo, MORSE_enum diag, int N, return MORSE_ERR_NOT_INITIALIZED; } /* Check input arguments */ - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_ztrtri", "illegal value of uplo"); return -1; } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_ztrtri", "illegal value of diag"); return -2; } @@ -126,32 +126,28 @@ int MORSE_ztrtri(MORSE_enum uplo, MORSE_enum diag, int N, } /* Set NT */ - NB = MORSE_NB; + NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo, + A, NB, NB, LDA, N, N, N, sequence, &request ); /* Call the tile interface */ - MORSE_ztrtri_Tile_Async(uplo, diag, &descA, sequence, &request); + MORSE_ztrtri_Tile_Async( uplo, diag, &descAt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInout, uplo, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -206,7 +202,7 @@ int MORSE_ztrtri(MORSE_enum uplo, MORSE_enum diag, int N, * @sa MORSE_zpotri_Tile * ******************************************************************************/ -int MORSE_ztrtri_Tile(MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A) +int MORSE_ztrtri_Tile( MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -218,13 +214,15 @@ int MORSE_ztrtri_Tile(MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A) morse_fatal_error("MORSE_ztrtri_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_ztrtri_Tile_Async(uplo, diag, A, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_ztrtri_Tile_Async( uplo, diag, A, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -258,8 +256,8 @@ int MORSE_ztrtri_Tile(MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A) * @sa MORSE_zpotri_Tile_Async * ******************************************************************************/ -int MORSE_ztrtri_Tile_Async(MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_ztrtri_Tile_Async( MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; @@ -277,10 +275,12 @@ int MORSE_ztrtri_Tile_Async(MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -292,20 +292,20 @@ int MORSE_ztrtri_Tile_Async(MORSE_enum uplo, MORSE_enum diag, MORSE_desc_t *A, morse_error("MORSE_ztrtri_Tile", "only square tiles supported"); return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } - if (uplo != MorseUpper && uplo != MorseLower) { + if ((uplo != MorseUpper) && (uplo != MorseLower)) { morse_error("MORSE_ztrtri_Tile", "illegal value of uplo"); return morse_request_fail(sequence, request, -1); } - if (diag != MorseUnit && diag != MorseNonUnit) { + if ((diag != MorseUnit) && (diag != MorseNonUnit)) { morse_error("MORSE_ztrtri_Tile", "illegal value of diag"); return morse_request_fail(sequence, request, -2); } /* Quick return */ -/* - if (chameleon_max(N, 0) == 0) - return MORSE_SUCCESS; -*/ - morse_pztrtri(uplo, diag, A, sequence, request); + /* + if (chameleon_max(N, 0) == 0) + return MORSE_SUCCESS; + */ + morse_pztrtri( uplo, diag, A, sequence, request ); return MORSE_SUCCESS; } diff --git a/compute/zunglq.c b/compute/zunglq.c index 7ececcb759dc1614ec1ec3b72f2691c541c6c841..f8738d76871d662731b63610adc717d64bd31ffe 100644 --- a/compute/zunglq.c +++ b/compute/zunglq.c @@ -81,17 +81,18 @@ * @sa MORSE_zgelqf * ******************************************************************************/ -int MORSE_zunglq(int M, int N, int K, +int MORSE_zunglq( int M, int N, int K, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descT, - MORSE_Complex64_t *Q, int LDQ) + MORSE_Complex64_t *Q, int LDQ ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descQ; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descQl, descQt; morse = morse_context_self(); if (morse == NULL) { @@ -134,36 +135,31 @@ int MORSE_zunglq(int M, int N, int K, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, K, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descQ))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, K, N,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpper, + A, NB, NB, LDA, N, K, N, sequence, &request ); + morse_zlap2tile( morse, &descQl, &descQt, MorseDescInout, MorseUpperLower, + Q, NB, NB, LDQ, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zunglq_Tile_Async(&descA, descT, &descQ, sequence, &request); + MORSE_zunglq_Tile_Async( &descAt, descT, &descQt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descQ, Q, NB, NB, LDQ, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descQ); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descQ, Q, NB, NB, LDQ, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpper, sequence, &request ); + morse_ztile2lap( morse, &descQl, &descQt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descQl, &descQt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -202,7 +198,7 @@ int MORSE_zunglq(int M, int N, int K, * @sa MORSE_zgelqf_Tile * ******************************************************************************/ -int MORSE_zunglq_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q) +int MORSE_zunglq_Tile( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -214,14 +210,17 @@ int MORSE_zunglq_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q) morse_fatal_error("MORSE_zunglq_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zunglq_Tile_Async(A, T, Q, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( Q, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zunglq_Tile_Async( A, T, Q, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Q, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -253,8 +252,8 @@ int MORSE_zunglq_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q) * @sa MORSE_zgelqf_Tile_Async * ******************************************************************************/ -int MORSE_zunglq_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zunglq_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -273,10 +272,12 @@ int MORSE_zunglq_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -298,10 +299,10 @@ int MORSE_zunglq_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, } /* Quick return - currently NOT equivalent to LAPACK's: * CALL DLASET( 'Full', MAX( M, N ), NRHS, ZERO, ZERO, Q, LDQ ) */ -/* - if (chameleon_min(M, N) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, N) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { @@ -311,16 +312,21 @@ int MORSE_zunglq_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, } #endif - morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request); + morse_pzlaset( MorseUpperLower, 0., 1., Q, sequence, request ); if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzunglq(A, Q, T, Dptr, sequence, request); + morse_pzunglq( A, Q, T, Dptr, sequence, request ); } else { - morse_pzunglqrh(A, Q, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzunglqrh( A, Q, T, Dptr, MORSE_RHBLK, sequence, request ); } if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( Q, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zunglq_param.c b/compute/zunglq_param.c index 5b6d30e6065194ea3f825b7304f889c8f9be2bb9..45110d3f79934e99119b81a80f52fe27e6c8d31b 100644 --- a/compute/zunglq_param.c +++ b/compute/zunglq_param.c @@ -78,17 +78,18 @@ * @sa MORSE_zgelqf * ******************************************************************************/ -int MORSE_zunglq_param(const libhqr_tree_t *qrtree, int M, int N, int K, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT, - MORSE_Complex64_t *Q, int LDQ) +int MORSE_zunglq_param( const libhqr_tree_t *qrtree, int M, int N, int K, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT, + MORSE_Complex64_t *Q, int LDQ ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descQ; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descQl, descQt; morse = morse_context_self(); if (morse == NULL) { @@ -131,36 +132,31 @@ int MORSE_zunglq_param(const libhqr_tree_t *qrtree, int M, int N, int K, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, K, N, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descQ))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, K, N,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpper, + A, NB, NB, LDA, N, K, N, sequence, &request ); + morse_zlap2tile( morse, &descQl, &descQt, MorseDescInout, MorseUpperLower, + Q, NB, NB, LDQ, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zunglq_param_Tile_Async(qrtree, &descA, descTS, descTT, &descQ, sequence, &request); + MORSE_zunglq_param_Tile_Async( qrtree, &descAt, descTS, descTT, &descQt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descQ, Q, NB, NB, LDQ, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descQ); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/ -/* morse_ziptile2lap( descQ, Q, NB, NB, LDQ, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpper, sequence, &request ); + morse_ztile2lap( morse, &descQl, &descQt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descQl, &descQt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -199,7 +195,7 @@ int MORSE_zunglq_param(const libhqr_tree_t *qrtree, int M, int N, int K, * @sa MORSE_zgelqf_Tile * ******************************************************************************/ -int MORSE_zunglq_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q) +int MORSE_zunglq_param_Tile( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -211,14 +207,18 @@ int MORSE_zunglq_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ morse_fatal_error("MORSE_zunglq_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zunglq_param_Tile_Async(qrtree, A, TS, TT, Q, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( Q, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zunglq_param_Tile_Async( qrtree, A, TS, TT, Q, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Q, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -250,8 +250,8 @@ int MORSE_zunglq_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ * @sa MORSE_zgelqf_Tile_Async * ******************************************************************************/ -int MORSE_zunglq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zunglq_param_Tile_Async( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -270,10 +270,12 @@ int MORSE_zunglq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -299,10 +301,10 @@ int MORSE_zunglq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, } /* Quick return - currently NOT equivalent to LAPACK's: * CALL DLASET( 'Full', MAX( M, N ), NRHS, ZERO, ZERO, Q, LDQ ) */ -/* - if (chameleon_min(M, N) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, N) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int m = chameleon_min(A->mt, A->nt) * A->mb; @@ -311,11 +313,17 @@ int MORSE_zunglq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, } #endif - morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request); - morse_pzunglq_param(qrtree, A, Q, TS, TT, Dptr, sequence, request); + morse_pzlaset( MorseUpperLower, 0., 1., Q, sequence, request ); + morse_pzunglq_param( qrtree, A, Q, TS, TT, Dptr, sequence, request ); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( Q, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zungqr.c b/compute/zungqr.c index 822dc4e568f7c9bca64af7c37746b57105aeba7f..954f2da51d54070bcc6feb12fc1c66aa6d8664ae 100644 --- a/compute/zungqr.c +++ b/compute/zungqr.c @@ -81,17 +81,18 @@ * @sa MORSE_zgeqrf * ******************************************************************************/ -int MORSE_zungqr(int M, int N, int K, +int MORSE_zungqr( int M, int N, int K, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descT, - MORSE_Complex64_t *Q, int LDQ) + MORSE_Complex64_t *Q, int LDQ ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descQ; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descQl, descQt; morse = morse_context_self(); if (morse == NULL) { @@ -133,36 +134,31 @@ int MORSE_zungqr(int M, int N, int K, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, K, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descQ))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, K,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseLower, + A, NB, NB, LDA, N, M, K, sequence, &request ); + morse_zlap2tile( morse, &descQl, &descQt, MorseDescInout, MorseUpperLower, + Q, NB, NB, LDQ, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zungqr_Tile_Async(&descA, descT, &descQ, sequence, &request); + MORSE_zungqr_Tile_Async( &descAt, descT, &descQt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descQ, Q, NB, NB, LDQ, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descQ); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, K, sequence, &request);*/ -/* morse_ziptile2lap( descQ, Q, NB, NB, LDQ, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseLower, sequence, &request ); + morse_ztile2lap( morse, &descQl, &descQt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descQl, &descQt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -201,7 +197,7 @@ int MORSE_zungqr(int M, int N, int K, * @sa MORSE_zgeqrf_Tile * ******************************************************************************/ -int MORSE_zungqr_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q) +int MORSE_zungqr_Tile( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -213,14 +209,17 @@ int MORSE_zungqr_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q) morse_fatal_error("MORSE_zungqr_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zungqr_Tile_Async(A, T, Q, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( Q, sequence ); - morse_sequence_wait(morse, sequence); - + morse_sequence_create( morse, &sequence ); + + MORSE_zungqr_Tile_Async( A, T, Q, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Q, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -252,8 +251,8 @@ int MORSE_zungqr_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q) * @sa MORSE_zgeqrf_Tile_Async * ******************************************************************************/ -int MORSE_zungqr_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zungqr_Tile_Async( MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -272,10 +271,12 @@ int MORSE_zungqr_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -296,10 +297,10 @@ int MORSE_zungqr_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (N <= 0) - return MORSE_SUCCESS; -*/ + /* + if (N <= 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int n = chameleon_min(A->mt, A->nt) * A->nb; @@ -308,16 +309,21 @@ int MORSE_zungqr_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *Q, } #endif - morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request); + morse_pzlaset( MorseUpperLower, 0., 1., Q, sequence, request ); if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { - morse_pzungqr(A, Q, T, Dptr, sequence, request); + morse_pzungqr( A, Q, T, Dptr, sequence, request ); } else { - morse_pzungqrrh(A, Q, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzungqrrh( A, Q, T, Dptr, MORSE_RHBLK, sequence, request ); } if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( Q, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zungqr_param.c b/compute/zungqr_param.c index af88ea598d0b1f9c13bfd1c328f5f5ec2e1170d3..8621b7816829436859c3cafe994ad6bbb0f9fc6a 100644 --- a/compute/zungqr_param.c +++ b/compute/zungqr_param.c @@ -78,19 +78,20 @@ * @sa MORSE_zgeqrf * ******************************************************************************/ -int MORSE_zungqr_param(const libhqr_tree_t *qrtree, - int M, int N, int K, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, - MORSE_desc_t *descTT, - MORSE_Complex64_t *Q, int LDQ) +int MORSE_zungqr_param( const libhqr_tree_t *qrtree, + int M, int N, int K, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, + MORSE_desc_t *descTT, + MORSE_Complex64_t *Q, int LDQ ) { int NB; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descQ; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descQl, descQt; morse = morse_context_self(); if (morse == NULL) { @@ -132,36 +133,31 @@ int MORSE_zungqr_param(const libhqr_tree_t *qrtree, /* Set NT */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, K, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descQ))); - /* } else {*/ - /* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, K,*/ - /* sequence, &request);*/ - /* morse_ziplap2tile( descQ, Q, NB, NB, LDQ, N, 0, 0, M, N,*/ - /* sequence, &request);*/ - /* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseLower, + A, NB, NB, LDA, N, M, K, sequence, &request ); + morse_zlap2tile( morse, &descQl, &descQt, MorseDescInout, MorseUpperLower, + Q, NB, NB, LDQ, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zungqr_param_Tile_Async(qrtree, &descA, descTS, descTT, &descQ, sequence, &request); + MORSE_zungqr_param_Tile_Async( qrtree, &descAt, descTS, descTT, &descQt, sequence, &request ); - /* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descQ, Q, NB, NB, LDQ, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descQ); - /* } else {*/ - /* morse_ziptile2lap( descA, A, NB, NB, LDA, K, sequence, &request);*/ - /* morse_ziptile2lap( descQ, Q, NB, NB, LDQ, N, sequence, &request);*/ - /* morse_sequence_wait(morse, sequence);*/ - /* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseLower, sequence, &request ); + morse_ztile2lap( morse, &descQl, &descQt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descQl, &descQt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -200,7 +196,7 @@ int MORSE_zungqr_param(const libhqr_tree_t *qrtree, * @sa MORSE_zgeqrf_Tile * ******************************************************************************/ -int MORSE_zungqr_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q) +int MORSE_zungqr_param_Tile( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -212,14 +208,18 @@ int MORSE_zungqr_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ morse_fatal_error("MORSE_zungqr_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zungqr_param_Tile_Async(qrtree, A, TS, TT, Q, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( Q, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zungqr_param_Tile_Async( qrtree, A, TS, TT, Q, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Q, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -251,7 +251,7 @@ int MORSE_zungqr_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_ * @sa MORSE_zgeqrf_Tile_Async * ******************************************************************************/ -int MORSE_zungqr_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q, MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zungqr_param_Tile_Async( const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q, MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -269,10 +269,12 @@ int MORSE_zungqr_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -297,10 +299,10 @@ int MORSE_zungqr_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE); } /* Quick return */ -/* - if (N <= 0) - return MORSE_SUCCESS; - */ + /* + if (N <= 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int n = chameleon_min(A->mt, A->nt) * A->nb; @@ -309,11 +311,17 @@ int MORSE_zungqr_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, } #endif - morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request); - morse_pzungqr_param(qrtree, A, Q, TS, TT, Dptr, sequence, request); + morse_pzlaset( MorseUpperLower, 0., 1., Q, sequence, request ); + morse_pzungqr_param( qrtree, A, Q, TS, TT, Dptr, sequence, request ); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( Q, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zunmlq.c b/compute/zunmlq.c index 81535c19d79ff71a24345609b2e319ad90c4056a..5901868c47a07b34ecc01815c8532909387c8d0d 100644 --- a/compute/zunmlq.c +++ b/compute/zunmlq.c @@ -105,17 +105,18 @@ * @sa MORSE_zgelqf * ******************************************************************************/ -int MORSE_zunmlq(MORSE_enum side, MORSE_enum trans, int M, int N, int K, +int MORSE_zunmlq( MORSE_enum side, MORSE_enum trans, int M, int N, int K, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descT, - MORSE_Complex64_t *C, int LDC) + MORSE_Complex64_t *C, int LDC ) { int NB, An; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descCl, descCt; morse = morse_context_self(); if (morse == NULL) { @@ -171,37 +172,31 @@ int MORSE_zunmlq(MORSE_enum side, MORSE_enum trans, int M, int N, int K, /* Set MT, NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, K, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, K, An,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpper, + A, NB, NB, LDA, An, K, An, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zunmlq_Tile_Async( - side, trans, &descA, descT, &descC, sequence, &request); + MORSE_zunmlq_Tile_Async( side, trans, &descAt, descT, &descCt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpper, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -254,8 +249,8 @@ int MORSE_zunmlq(MORSE_enum side, MORSE_enum trans, int M, int N, int K, * @sa MORSE_zgelqf_Tile * ******************************************************************************/ -int MORSE_zunmlq_Tile(MORSE_enum side, MORSE_enum trans, - MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *C) +int MORSE_zunmlq_Tile( MORSE_enum side, MORSE_enum trans, + MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -267,14 +262,17 @@ int MORSE_zunmlq_Tile(MORSE_enum side, MORSE_enum trans, morse_fatal_error("MORSE_zunmlq_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zunmlq_Tile_Async(side, trans, A, T, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zunmlq_Tile_Async(side, trans, A, T, C, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -306,9 +304,9 @@ int MORSE_zunmlq_Tile(MORSE_enum side, MORSE_enum trans, * @sa MORSE_zgelqf_Tile_Async * ******************************************************************************/ -int MORSE_zunmlq_Tile_Async(MORSE_enum side, MORSE_enum trans, +int MORSE_zunmlq_Tile_Async( MORSE_enum side, MORSE_enum trans, MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -327,10 +325,12 @@ int MORSE_zunmlq_Tile_Async(MORSE_enum side, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -358,10 +358,10 @@ int MORSE_zunmlq_Tile_Async(MORSE_enum side, MORSE_enum trans, } /* Quick return - currently NOT equivalent to LAPACK's: * CALL DLASET( 'Full', MAX( M, N ), NRHS, ZERO, ZERO, C, LDC ) */ -/* - if (chameleon_min(M, chameleon_min(N, K)) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, chameleon_min(N, K)) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { int m = chameleon_min(A->mt, A->nt) * A->mb; @@ -373,16 +373,21 @@ int MORSE_zunmlq_Tile_Async(MORSE_enum side, MORSE_enum trans, if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { if ( (trans == MorseConjTrans) && (side == MorseLeft) ) { - morse_pzunmlq(side, trans, A, C, T, Dptr, sequence, request); + morse_pzunmlq( side, trans, A, C, T, Dptr, sequence, request ); } else { - morse_pzunmlq(side, trans, A, C, T, Dptr, sequence, request); + morse_pzunmlq( side, trans, A, C, T, Dptr, sequence, request ); } } else { - morse_pzunmlqrh(side, trans, A, C, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzunmlqrh( side, trans, A, C, T, Dptr, MORSE_RHBLK, sequence, request ); } if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( C, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zunmlq_param.c b/compute/zunmlq_param.c index b6f746d02e23a78cbfdd0853a34953d6d04fdac5..4a637513666d3b5f5485712645b7cf32d061e6c0 100644 --- a/compute/zunmlq_param.c +++ b/compute/zunmlq_param.c @@ -104,17 +104,18 @@ * @sa MORSE_zgelqf * ******************************************************************************/ -int MORSE_zunmlq_param(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, int M, int N, int K, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT, - MORSE_Complex64_t *C, int LDC) +int MORSE_zunmlq_param( const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, int M, int N, int K, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT, + MORSE_Complex64_t *C, int LDC ) { int NB, An; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descCl, descCt; morse = morse_context_self(); if (morse == NULL) { @@ -170,37 +171,31 @@ int MORSE_zunmlq_param(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum /* Set MT, NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, K, An, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, K, An,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseUpper, + A, NB, NB, LDA, An, K, An, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zunmlq_param_Tile_Async( - qrtree, side, trans, &descA, descTS, descTT, &descC, sequence, &request); + MORSE_zunmlq_param_Tile_Async( qrtree, side, trans, &descAt, descTS, descTT, &descCt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseUpper, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -253,8 +248,8 @@ int MORSE_zunmlq_param(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum * @sa MORSE_zgelqf_Tile * ******************************************************************************/ -int MORSE_zunmlq_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, - MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C) +int MORSE_zunmlq_param_Tile( const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, + MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -266,14 +261,18 @@ int MORSE_zunmlq_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_ morse_fatal_error("MORSE_zunmlq_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zunmlq_param_Tile_Async(qrtree, side, trans, A, TS, TT, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zunmlq_param_Tile_Async( qrtree, side, trans, A, TS, TT, C, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -305,9 +304,9 @@ int MORSE_zunmlq_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_ * @sa MORSE_zgelqf_Tile_Async * ******************************************************************************/ -int MORSE_zunmlq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, - MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zunmlq_param_Tile_Async( const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, + MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -326,10 +325,12 @@ int MORSE_zunmlq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum side, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -361,10 +362,10 @@ int MORSE_zunmlq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum side, } /* Quick return - currently NOT equivalent to LAPACK's: * CALL DLASET( 'Full', MAX( M, N ), NRHS, ZERO, ZERO, C, LDC ) */ -/* - if (chameleon_min(M, chameleon_min(N, K)) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, chameleon_min(N, K)) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { @@ -374,10 +375,16 @@ int MORSE_zunmlq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum side, } #endif - morse_pzunmlq_param(qrtree, side, trans, A, C, TS, TT, Dptr, sequence, request); + morse_pzunmlq_param( qrtree, side, trans, A, C, TS, TT, Dptr, sequence, request ); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( C, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zunmqr.c b/compute/zunmqr.c index 4464aaecbe90f5d6bbf86bf4c644aa89ccbe87d5..7e836f91f1ff8e026496681e9db7d5855aa65e6f 100644 --- a/compute/zunmqr.c +++ b/compute/zunmqr.c @@ -107,17 +107,18 @@ * @sa MORSE_zgeqrf * ******************************************************************************/ -int MORSE_zunmqr(MORSE_enum side, MORSE_enum trans, int M, int N, int K, +int MORSE_zunmqr( MORSE_enum side, MORSE_enum trans, int M, int N, int K, MORSE_Complex64_t *A, int LDA, MORSE_desc_t *descT, - MORSE_Complex64_t *C, int LDC) + MORSE_Complex64_t *C, int LDC ) { int NB, Am; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descCl, descCt; morse = morse_context_self(); if (morse == NULL) { @@ -174,37 +175,31 @@ int MORSE_zunmqr(MORSE_enum side, MORSE_enum trans, int M, int N, int K, /* Set MT, NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, K, 0, 0, Am, K, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, K, 0, 0, Am, K,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseLower, + A, NB, NB, LDA, K, Am, K, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zunmqr_Tile_Async( - side, trans, &descA, descT, &descC, sequence, &request); + MORSE_zunmqr_Tile_Async( side, trans, &descAt, descT, &descCt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, K, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -258,8 +253,8 @@ int MORSE_zunmqr(MORSE_enum side, MORSE_enum trans, int M, int N, int K, * @sa MORSE_zgeqrf_Tile * ******************************************************************************/ -int MORSE_zunmqr_Tile(MORSE_enum side, MORSE_enum trans, - MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *C) +int MORSE_zunmqr_Tile( MORSE_enum side, MORSE_enum trans, + MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -271,14 +266,17 @@ int MORSE_zunmqr_Tile(MORSE_enum side, MORSE_enum trans, morse_fatal_error("MORSE_zunmqr_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zunmqr_Tile_Async(side, trans, A, T, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zunmqr_Tile_Async(side, trans, A, T, C, sequence, &request ); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( C, sequence ); + + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -310,9 +308,9 @@ int MORSE_zunmqr_Tile(MORSE_enum side, MORSE_enum trans, * @sa MORSE_zgeqrf_Tile_Async * ******************************************************************************/ -int MORSE_zunmqr_Tile_Async(MORSE_enum side, MORSE_enum trans, +int MORSE_zunmqr_Tile_Async( MORSE_enum side, MORSE_enum trans, MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -331,10 +329,12 @@ int MORSE_zunmqr_Tile_Async(MORSE_enum side, MORSE_enum trans, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -362,10 +362,10 @@ int MORSE_zunmqr_Tile_Async(MORSE_enum side, MORSE_enum trans, } /* Quick return - currently NOT equivalent to LAPACK's: * CALL DLASET( 'Full', MAX( M, N ), NRHS, ZERO, ZERO, C, LDC ) */ -/* - if (chameleon_min(M, chameleon_min(N, K)) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, chameleon_min(N, K)) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { @@ -375,21 +375,26 @@ int MORSE_zunmqr_Tile_Async(MORSE_enum side, MORSE_enum trans, } #endif - if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { + if (morse->householder == MORSE_FLAT_HOUSEHOLDER) { if ( (trans == MorseConjTrans) && (side == MorseLeft) ) { - morse_pzunmqr(side, trans, A, C, T, Dptr, sequence, request); + morse_pzunmqr( side, trans, A, C, T, Dptr, sequence, request ); } else { - morse_pzunmqr(side, trans, A, C, T, Dptr, sequence, request); + morse_pzunmqr( side, trans, A, C, T, Dptr, sequence, request ); } } else { - morse_pzunmqrrh(side, trans, A, C, T, Dptr, MORSE_RHBLK, sequence, request); + morse_pzunmqrrh( side, trans, A, C, T, Dptr, MORSE_RHBLK, sequence, request ); } if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( C, sequence ); + MORSE_Desc_Flush( T, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/compute/zunmqr_param.c b/compute/zunmqr_param.c index d285caabf0ce422062a6b621355c85bf309c4de4..45c88e5750f2c250327db48c6a6d2bc714faec2b 100644 --- a/compute/zunmqr_param.c +++ b/compute/zunmqr_param.c @@ -107,18 +107,19 @@ * @sa MORSE_zgeqrf * ******************************************************************************/ -int MORSE_zunmqr_param(const libhqr_tree_t *qrtree, - MORSE_enum side, MORSE_enum trans, int M, int N, int K, - MORSE_Complex64_t *A, int LDA, - MORSE_desc_t *descTS, MORSE_desc_t *descTT, - MORSE_Complex64_t *C, int LDC) +int MORSE_zunmqr_param( const libhqr_tree_t *qrtree, + MORSE_enum side, MORSE_enum trans, int M, int N, int K, + MORSE_Complex64_t *A, int LDA, + MORSE_desc_t *descTS, MORSE_desc_t *descTT, + MORSE_Complex64_t *C, int LDC ) { int NB, Am; int status; MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; MORSE_request_t request = MORSE_REQUEST_INITIALIZER; - MORSE_desc_t descA, descC; + MORSE_desc_t descAl, descAt; + MORSE_desc_t descCl, descCt; morse = morse_context_self(); if (morse == NULL) { @@ -175,37 +176,31 @@ int MORSE_zunmqr_param(const libhqr_tree_t *qrtree, /* Set MT, NT & NTRHS */ NB = MORSE_NB; - morse_sequence_create(morse, &sequence); + morse_sequence_create( morse, &sequence ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooplap2tile( descA, A, NB, NB, LDA, K, 0, 0, Am, K, sequence, &request, - morse_desc_mat_free(&(descA)) ); - morse_zooplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N, sequence, &request, - morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descC))); -/* } else {*/ -/* morse_ziplap2tile( descA, A, NB, NB, LDA, K, 0, 0, Am, K,*/ -/* sequence, &request);*/ -/* morse_ziplap2tile( descC, C, NB, NB, LDC, N, 0, 0, M, N,*/ -/* sequence, &request);*/ -/* }*/ + /* Submit the matrix conversion */ + morse_zlap2tile( morse, &descAl, &descAt, MorseDescInput, MorseLower, + A, NB, NB, LDA, K, Am, K, sequence, &request ); + morse_zlap2tile( morse, &descCl, &descCt, MorseDescInout, MorseUpperLower, + C, NB, NB, LDC, N, M, N, sequence, &request ); /* Call the tile interface */ - MORSE_zunmqr_param_Tile_Async( - qrtree, side, trans, &descA, descTS, descTT, &descC, sequence, &request); + MORSE_zunmqr_param_Tile_Async( qrtree, side, trans, &descAt, descTS, descTT, &descCt, sequence, &request ); -/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/ - morse_zooptile2lap(descC, C, NB, NB, LDC, N, sequence, &request); - morse_sequence_wait(morse, sequence); - morse_desc_mat_free(&descA); - morse_desc_mat_free(&descC); -/* } else {*/ -/* morse_ziptile2lap( descA, A, NB, NB, LDA, K, sequence, &request);*/ -/* morse_ziptile2lap( descC, C, NB, NB, LDC, N, sequence, &request);*/ -/* morse_sequence_wait(morse, sequence);*/ -/* }*/ + /* Submit the matrix conversion back */ + morse_ztile2lap( morse, &descAl, &descAt, + MorseDescInput, MorseLower, sequence, &request ); + morse_ztile2lap( morse, &descCl, &descCt, + MorseDescInout, MorseUpperLower, sequence, &request ); + + morse_sequence_wait( morse, sequence ); + + /* Cleanup the temporary data */ + morse_ztile2lap_cleanup( morse, &descAl, &descAt ); + morse_ztile2lap_cleanup( morse, &descCl, &descCt ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -259,8 +254,8 @@ int MORSE_zunmqr_param(const libhqr_tree_t *qrtree, * @sa MORSE_zgeqrf_Tile * ******************************************************************************/ -int MORSE_zunmqr_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, - MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C) +int MORSE_zunmqr_param_Tile( const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_enum trans, + MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C ) { MORSE_context_t *morse; MORSE_sequence_t *sequence = NULL; @@ -272,14 +267,18 @@ int MORSE_zunmqr_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_ morse_fatal_error("MORSE_zunmqr_param_Tile", "MORSE not initialized"); return MORSE_ERR_NOT_INITIALIZED; } - morse_sequence_create(morse, &sequence); - MORSE_zunmqr_param_Tile_Async(qrtree, side, trans, A, TS, TT, C, sequence, &request); - RUNTIME_desc_flush( A, sequence ); - RUNTIME_desc_flush( C, sequence ); - morse_sequence_wait(morse, sequence); + morse_sequence_create( morse, &sequence ); + + MORSE_zunmqr_param_Tile_Async( qrtree, side, trans, A, TS, TT, C, sequence, &request ); + + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( C, sequence ); + morse_sequence_wait( morse, sequence ); status = sequence->status; - morse_sequence_destroy(morse, sequence); + morse_sequence_destroy( morse, sequence ); return status; } @@ -311,10 +310,10 @@ int MORSE_zunmqr_param_Tile(const libhqr_tree_t *qrtree, MORSE_enum side, MORSE_ * @sa MORSE_zgeqrf_Tile_Async * ******************************************************************************/ -int MORSE_zunmqr_param_Tile_Async(const libhqr_tree_t *qrtree, - MORSE_enum side, MORSE_enum trans, - MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C, - MORSE_sequence_t *sequence, MORSE_request_t *request) +int MORSE_zunmqr_param_Tile_Async( const libhqr_tree_t *qrtree, + MORSE_enum side, MORSE_enum trans, + MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *C, + MORSE_sequence_t *sequence, MORSE_request_t *request ) { MORSE_context_t *morse; MORSE_desc_t D, *Dptr = NULL; @@ -333,10 +332,12 @@ int MORSE_zunmqr_param_Tile_Async(const libhqr_tree_t *qrtree, return MORSE_ERR_UNALLOCATED; } /* Check sequence status */ - if (sequence->status == MORSE_SUCCESS) + if (sequence->status == MORSE_SUCCESS) { request->status = MORSE_SUCCESS; - else + } + else { return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED); + } /* Check descriptors for correctness */ if (morse_desc_check(A) != MORSE_SUCCESS) { @@ -368,10 +369,10 @@ int MORSE_zunmqr_param_Tile_Async(const libhqr_tree_t *qrtree, } /* Quick return - currently NOT equivalent to LAPACK's: * CALL DLASET( 'Full', MAX( M, N ), NRHS, ZERO, ZERO, C, LDC ) */ -/* - if (chameleon_min(M, chameleon_min(N, K)) == 0) - return MORSE_SUCCESS; -*/ + /* + if (chameleon_min(M, chameleon_min(N, K)) == 0) + return MORSE_SUCCESS; + */ #if defined(CHAMELEON_COPY_DIAG) { @@ -381,10 +382,16 @@ int MORSE_zunmqr_param_Tile_Async(const libhqr_tree_t *qrtree, } #endif - morse_pzunmqr_param(qrtree, side, trans, A, C, TS, TT, Dptr, sequence, request); + morse_pzunmqr_param( qrtree, side, trans, A, C, TS, TT, Dptr, sequence, request ); if (Dptr != NULL) { - morse_desc_mat_free(Dptr); + MORSE_Desc_Flush( A, sequence ); + MORSE_Desc_Flush( C, sequence ); + MORSE_Desc_Flush( TS, sequence ); + MORSE_Desc_Flush( TT, sequence ); + MORSE_Desc_Flush( Dptr, sequence ); + morse_sequence_wait( morse, sequence ); + morse_desc_mat_free( Dptr ); } (void)D; return MORSE_SUCCESS; diff --git a/control/CMakeLists.txt b/control/CMakeLists.txt index 0fd19f58836468a32c90843685864374aa455d46..5cc1b6b04e00f3351d4d80b872c6b3ed7f121d59 100644 --- a/control/CMakeLists.txt +++ b/control/CMakeLists.txt @@ -50,7 +50,6 @@ set(CHAMELEON_HDRS global.h morse_f77.h morsewinthread.h - tile.h workspace.h ) diff --git a/control/common.h b/control/common.h index 81bce72c4f73839e0f48a2bcfaba627df088d34f..1df9385bafadfcc64fde9eb5a603035ad1e67915 100644 --- a/control/common.h +++ b/control/common.h @@ -78,7 +78,6 @@ #include "control/auxiliary.h" #include "control/context.h" #include "control/descriptor.h" -#include "control/tile.h" #include "control/async.h" /******************************************************************************* @@ -108,7 +107,6 @@ #define MorseIPT_Panel 1 #define MorseIPT_All 2 - /******************************************************************************* * Global array of LAPACK constants **/ diff --git a/control/compute_z.h b/control/compute_z.h index 2ac2d5090918260460aad57952c551f59ff4e433..168277b4be24bcdaf37024488cfc93aef9e0cfb1 100644 --- a/control/compute_z.h +++ b/control/compute_z.h @@ -28,14 +28,22 @@ * **/ +/******************************************************************************* + * LAPACK/Tile Descriptor accesses + **/ +#define MorseDescInput 1 +#define MorseDescOutput 2 +#define MorseDescInout (MorseDescInput | MorseDescOutput) + /***************************************************************************//** * Macro for matrix conversion / Lapack interface **/ -#define morse_zdesc_alloc_diag(descA, mb, nb, lm, ln, i, j, m, n, p, q) \ +#define morse_zdesc_alloc_diag( descA, mb, nb, lm, ln, i, j, m, n, p, q) \ descA = morse_desc_init_diag( \ MorseComplexDouble, (mb), (nb), ((mb)*(nb)), \ (m), (n), (i), (j), (m), (n), p, q); \ - morse_desc_mat_alloc( &(descA) ); + morse_desc_mat_alloc( &(descA) ); \ + RUNTIME_desc_create( &(descA) ); #define morse_zdesc_alloc( descA, mb, nb, lm, ln, i, j, m, n, free) \ descA = morse_desc_init( \ @@ -45,34 +53,8 @@ morse_error( __func__, "morse_desc_mat_alloc() failed"); \ {free;}; \ return MORSE_ERR_OUT_OF_RESOURCES; \ - } - -#define morse_zooplap2tile( descA, A, mb, nb, lm, ln, i, j, m, n, seq, req, free) \ - descA = morse_desc_init( \ - MorseComplexDouble, (mb), (nb), ((mb)*(nb)), \ - (lm), (ln), (i), (j), (m), (n), 1, 1); \ - if ( morse_desc_mat_alloc( &(descA) ) ) { \ - morse_error( __func__, "morse_desc_mat_alloc() failed"); \ - {free;}; \ - return MORSE_ERR_OUT_OF_RESOURCES; \ } \ - morse_pzlapack_to_tile(A, lm, &descA, seq, req); - -#define morse_ziplap2tile( descA, A, mb, nb, lm, ln, i, j, m, n, seq, req) \ - descA = morse_desc_init( \ - MorseComplexDouble, (mb), (nb), ((mb)*(nb)), \ - (lm), (ln), (i), (j), (m), (n), 1, 1); \ - descA.mat = A; \ - MORSE_zgecfi_Async((lm), (ln), (A), MorseCM, (mb), (nb), \ - MorseCCRB, (mb), (nb), (seq), (req)); - - -#define morse_zooptile2lap( descA, A, mb, nb, lm, ln, seq, req) \ - morse_pztile_to_lapack(&descA, A, lm, seq, req); - -#define morse_ziptile2lap( descA, A, mb, nb, lm, ln, seq, req) \ - MORSE_zgecfi_Async((lm), (ln), (A), MorseCCRB, (mb), (nb), \ - MorseCM, (mb), (nb), (seq), (req)); + RUNTIME_desc_create( &(descA) ); /***************************************************************************//** * Declarations of internal sequential functions @@ -171,3 +153,98 @@ void morse_pzunglq_param(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_des void morse_pzungqr_param(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *Q, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *D, MORSE_sequence_t *sequence, MORSE_request_t *request); + + +/** + * @brief Internal function to convert the lapack format to tile format in + * LAPACK interface calls + */ +static inline int +morse_zlap2tile( MORSE_context_t *morse, + MORSE_desc_t *descAl, MORSE_desc_t *descAt, + MORSE_enum mode, MORSE_enum uplo, + MORSE_Complex64_t *A, int mb, int nb, int lm, int ln, int m, int n, + MORSE_sequence_t *seq, MORSE_request_t *req ) +{ + /* Initialize the Lapack descriptor */ + *descAl = morse_desc_init_user( MorseComplexDouble, mb, nb, (mb)*(nb), + lm, ln, 0, 0, m, n, 1, 1, + morse_getaddr_cm, morse_getblkldd_cm, NULL ); + descAl->mat = A; + descAl->styp = MorseCM; + + /* Initialize the tile descriptor */ + *descAt = morse_desc_init( MorseComplexDouble, mb, nb, (mb)*(nb), + lm, ln, 0, 0, m, n, 1, 1 ); + + if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { + if ( morse_desc_mat_alloc( descAt ) ) { + morse_error( "morse_zlap2tile", "morse_desc_mat_alloc() failed"); + return MORSE_ERR_OUT_OF_RESOURCES; + } + + RUNTIME_desc_create( descAl ); + RUNTIME_desc_create( descAt ); + + if ( mode & MorseDescInput ) { + morse_pzlacpy( uplo, descAl, descAt, seq, req ); + } + } + else { + morse_fatal_error( "morse_zlap2tile", "INPLACE translation not supported yet"); + descAt->mat = A; + + RUNTIME_desc_create( descAl ); + RUNTIME_desc_create( descAt ); + + if ( mode & MorseDescInput ) { + /* MORSE_zgecfi_Async( lm, ln, A, MorseCM, mb, nb, */ + /* MorseCCRB, mb, nb, seq, req ); */ + } + return MORSE_ERR_NOT_SUPPORTED; + } + + return MORSE_SUCCESS; +} + +/** + * @brief Internal function to convert back the tile format to the lapack format + * in LAPACK interface calls + */ +static inline int +morse_ztile2lap( MORSE_context_t *morse, MORSE_desc_t *descAl, MORSE_desc_t *descAt, + MORSE_enum mode, MORSE_enum uplo, MORSE_sequence_t *seq, MORSE_request_t *req ) +{ + if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { + if ( mode & MorseDescOutput ) { + morse_pzlacpy( uplo, descAt, descAl, seq, req ); + } + } + else { + morse_fatal_error( "morse_ztile2lap", "INPLACE translation not supported yet"); + if ( mode & MorseDescOutput ) { + /* MORSE_zgecfi_Async( descAl->lm, descAl->ln, descAl->mat, */ + /* MorseCCRB, descAl->mb, descAl->nb, */ + /* MorseCM, descAl->mb, descAl->nb, seq, req ); */ + } + return MORSE_ERR_NOT_SUPPORTED; + } + RUNTIME_desc_flush( descAl, seq ); + RUNTIME_desc_flush( descAt, seq ); + + return MORSE_SUCCESS; +} + +/** + * @brief Internal function to cleanup the temporary data from the layout + * conversions in LAPACK interface calls + */ +static inline void +morse_ztile2lap_cleanup( MORSE_context_t *morse, MORSE_desc_t *descAl, MORSE_desc_t *descAt ) +{ + if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { + morse_desc_mat_free( descAt ); + } + RUNTIME_desc_destroy( descAl ); + RUNTIME_desc_destroy( descAt ); +} diff --git a/control/descriptor.c b/control/descriptor.c index de7d216bdda0750193727395791c2fe9d3631479..2459329895893f8f9435f4433db6c35df3c1ba83 100644 --- a/control/descriptor.c +++ b/control/descriptor.c @@ -258,7 +258,7 @@ MORSE_desc_t* morse_desc_submatrix(MORSE_desc_t *descA, int i, int j, int m, int /******************************************************************************* * Check for descriptor correctness **/ -int morse_desc_check(MORSE_desc_t *desc) +int morse_desc_check(const MORSE_desc_t *desc) { if (desc == NULL) { morse_error("morse_desc_check", "NULL descriptor"); @@ -307,7 +307,6 @@ int morse_desc_check(MORSE_desc_t *desc) **/ int morse_desc_mat_alloc( MORSE_desc_t *desc ) { - size_t size = (size_t)(desc->llm) * (size_t)(desc->lln) * (size_t)MORSE_Element_Size(desc->dtyp); if ((desc->mat = RUNTIME_malloc(size)) == NULL) { @@ -317,7 +316,6 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc ) /* The matrix has already been registered by the Runtime alloc */ desc->register_mat = 0; - RUNTIME_desc_create(desc); return MORSE_SUCCESS; } @@ -327,8 +325,6 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc ) **/ int morse_desc_mat_free( MORSE_desc_t *desc ) { - RUNTIME_desc_destroy( desc ); - if ( (desc->mat != NULL) && (desc->use_mat == 1 ) && (desc->alloc_mat == 1 ) ) @@ -751,6 +747,7 @@ int MORSE_Desc_Destroy(MORSE_desc_t **desc) return MORSE_ERR_UNALLOCATED; } + RUNTIME_desc_destroy( *desc ); morse_desc_mat_free( *desc ); free(*desc); *desc = NULL; diff --git a/control/descriptor.h b/control/descriptor.h index 2f6c6afe937bfe04fa8d93f6f4c4a26154d4ece4..37cb2b19a026eabd6e740673b8b6a2416a37bbce 100644 --- a/control/descriptor.h +++ b/control/descriptor.h @@ -63,7 +63,7 @@ MORSE_desc_t morse_desc_init_user(MORSE_enum dtyp, int mb, int nb, int bsiz, int (*get_rankof)( const MORSE_desc_t*, int, int )); MORSE_desc_t* morse_desc_submatrix(MORSE_desc_t *descA, int i, int j, int m, int n); -int morse_desc_check (MORSE_desc_t *desc); +int morse_desc_check (const MORSE_desc_t *desc); int morse_desc_mat_alloc(MORSE_desc_t *desc); int morse_desc_mat_free (MORSE_desc_t *desc); diff --git a/control/morse_zf77.c b/control/morse_zf77.c index 8ea877f355cf352aebc047f2d8d5a65b79a47501..c9013dcc4c3675709ddb2cc4dd690da3ee1cc85e 100644 --- a/control/morse_zf77.c +++ b/control/morse_zf77.c @@ -40,9 +40,7 @@ * FORTRAN API - math functions (simple interface) **/ #define MORSE_ZLAPACK_TO_TILE MORSE_FNAME(zlapack_to_tile, ZLAPACK_TO_TILE) -#define MORSE_ZLAPACK_TO_TILE_ASYNC MORSE_FNAME(zlapack_to_tile_async, ZLAPACK_TO_TILE_ASYNC) #define MORSE_ZTILE_TO_LAPACK MORSE_FNAME(ztile_to_lapack, ZTILE_TO_LAPACK) -#define MORSE_ZTILE_TO_LAPACK_ASYNC MORSE_FNAME(ztile_to_lapack_async, ZTILE_TO_LAPACK_ASYNC) //#define MORSE_ZGEBRD MORSE_FNAME(zgebrd , ZGEBRD ) //#define MORSE_ZGECFI MORSE_FNAME(zgecfi , ZGECFI ) //#define MORSE_ZGECFI_ASYNC MORSE_FNAME(zgecfi_async , ZGECFI_ASYNC ) @@ -293,15 +291,9 @@ void MORSE_ZLAPACK_TO_TILE(MORSE_Complex64_t *Af77, int *LDA, MORSE_desc_t *A, int *info) { *info = MORSE_zLapack_to_Tile(Af77, *LDA, A); } -void MORSE_ZLAPACK_TO_TILE_ASYNC(MORSE_Complex64_t *Af77, int *LDA, MORSE_desc_t *A, MORSE_sequence_t *sequence, MORSE_request_t *request, int *info) -{ *info = MORSE_zLapack_to_Tile_Async(Af77, *LDA, A, sequence, request); } - void MORSE_ZTILE_TO_LAPACK(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int *LDA, int *info) { *info = MORSE_zTile_to_Lapack(A, Af77, *LDA); } -void MORSE_ZTILE_TO_LAPACK_ASYNC(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int *LDA, MORSE_sequence_t *sequence, MORSE_request_t *request, int *info) -{ *info = MORSE_zTile_to_Lapack_Async(A, Af77, *LDA, sequence, request); } - //void MORSE_ZGEBRD(int *M, int *N, MORSE_Complex64_t *A, int *LDA, double *D, double *E, MORSE_desc_t **descT, int *info) //{ *info = MORSE_zgebrd(*M, *N, A, *LDA, D, E, *descT); } // diff --git a/control/morse_zf90.F90 b/control/morse_zf90.F90 index 78c4631dd3c84fc1a76011e71865de0e4387184c..c9bf4035a99c4ac19d5db88427f5569126c67ab4 100644 --- a/control/morse_zf90.F90 +++ b/control/morse_zf90.F90 @@ -96,20 +96,6 @@ module morse_z end function MORSE_zLapack_to_Tile_c end interface - interface - function MORSE_zLapack_to_Tile_Async_c(Af77,LDA,A,sequence,request) & - & bind(c, name='MORSE_zLapack_to_Tile_Async') - use iso_c_binding - implicit none - integer(kind=c_int) :: MORSE_zLapack_to_Tile_Async_c - type(c_ptr), value :: Af77 - integer(kind=c_int), value :: LDA - type(c_ptr), value :: A - type(c_ptr), value :: sequence - type(c_ptr), value :: request - end function MORSE_zLapack_to_Tile_Async_c - end interface - interface function MORSE_zTile_to_Lapack_c(A,Af77,LDA) & & bind(c, name='MORSE_zTile_to_Lapack') @@ -122,20 +108,6 @@ module morse_z end function MORSE_zTile_to_Lapack_c end interface - interface - function MORSE_zTile_to_Lapack_Async_c(A,Af77,LDA,sequence,request) & - & bind(c, name='MORSE_zTile_to_Lapack_Async') - use iso_c_binding - implicit none - integer(kind=c_int) :: MORSE_zTile_to_Lapack_Async_c - type(c_ptr), value :: A - type(c_ptr), value :: Af77 - integer(kind=c_int), value :: LDA - type(c_ptr), value :: sequence - type(c_ptr), value :: request - end function MORSE_zTile_to_Lapack_Async_c - end interface - interface function MORSE_zgebrd_c(M,N,A,LDA,D,E,descT) & & bind(c, name='MORSE_zgebrd') @@ -5507,28 +5479,4 @@ module morse_z info = MORSE_zTile_to_Lapack_c(A,c_loc(Af77),LDA) end subroutine MORSE_zTile_to_Lapack - subroutine MORSE_zLapack_to_Tile_Async(Af77,LDA,A,sequence,request,info) - use iso_c_binding - implicit none - integer(kind=c_int), intent(out) :: info - integer(kind=c_int), intent(in) :: LDA - complex(kind=c_double_complex), intent(in), target :: Af77(LDA,*) - type(c_ptr), value :: A ! Arg managed by MORSE: opaque to Fortran - type(c_ptr), value :: request ! Arg managed by MORSE: opaque to Fortran - type(c_ptr), value :: sequence ! Arg managed by MORSE: opaque to Fortran - info = MORSE_zLapack_to_Tile_Async_c(c_loc(Af77),LDA,A,sequence,request) - end subroutine MORSE_zLapack_to_Tile_Async - - subroutine MORSE_zTile_to_Lapack_Async(A,Af77,LDA,sequence,request,info) - use iso_c_binding - implicit none - integer(kind=c_int), intent(out) :: info - integer(kind=c_int), intent(in) :: LDA - complex(kind=c_double_complex), intent(out), target :: Af77(LDA,*) - type(c_ptr), value :: A ! Arg managed by MORSE: opaque to Fortran - type(c_ptr), value :: request ! Arg managed by MORSE: opaque to Fortran - type(c_ptr), value :: sequence ! Arg managed by MORSE: opaque to Fortran - info = MORSE_zTile_to_Lapack_Async_c(A,c_loc(Af77),LDA,sequence,request) - end subroutine MORSE_zTile_to_Lapack_Async - end module morse_z diff --git a/control/tile.c b/control/tile.c index ea216a770a6767745e2659cc27e4f312a3161808..2d2a05270486126208ccaa885c6f87ed56ed9078 100644 --- a/control/tile.c +++ b/control/tile.c @@ -29,10 +29,8 @@ * @brief Group routines exposed to users for matrices conversion LAPACK-Tile * */ - #include "control/common.h" #include "control/auxiliary.h" -#include "control/tile.h" /** *************************************************************************** * @@ -59,54 +57,21 @@ *****************************************************************************/ int MORSE_Lapack_to_Tile(void *Af77, int LDA, MORSE_desc_t *A) { - MORSE_context_t *morse; - MORSE_sequence_t *sequence = NULL; - MORSE_request_t request; - int status; - - morse = morse_context_self(); - if (morse == NULL) { - morse_fatal_error("MORSE_Lapack_to_Tile", "MORSE not initialized"); - return MORSE_ERR_NOT_INITIALIZED; - } - /* Check descriptor for correctness */ - if (morse_desc_check(A) != MORSE_SUCCESS) { - morse_error("MORSE_Lapack_to_Tile", "invalid descriptor"); - return MORSE_ERR_ILLEGAL_VALUE; - } - morse_sequence_create(morse, &sequence); switch( A->dtyp ) { -#if defined(PRECISION_s) - case MorseRealFloat: - morse_pslapack_to_tile(Af77, LDA, A, sequence, &request); - break; -#endif - -#if defined(PRECISION_d) - case MorseRealDouble: - morse_pdlapack_to_tile(Af77, LDA, A, sequence, &request); + case MorseComplexDouble: + return MORSE_zLapack_to_Tile( (MORSE_Complex64_t *)Af77, LDA, A ); break; -#endif - -#if defined(PRECISION_c) case MorseComplexFloat: - morse_pclapack_to_tile(Af77, LDA, A, sequence, &request); + return MORSE_cLapack_to_Tile( (MORSE_Complex32_t *)Af77, LDA, A ); break; -#endif - -#if defined(PRECISION_z) - case MorseComplexDouble: - morse_pzlapack_to_tile(Af77, LDA, A, sequence, &request); + case MorseRealFloat: + return MORSE_sLapack_to_Tile( (float *)Af77, LDA, A ); break; -#endif - + case MorseRealDouble: default: - morse_error("MORSE_Lapack_to_Tile", "Type unknown"); + return MORSE_dLapack_to_Tile( (double *)Af77, LDA, A ); } - RUNTIME_barrier(morse); - status = sequence->status; - morse_sequence_destroy(morse, sequence); - return status; + return MORSE_ERR_ILLEGAL_VALUE; } /** *************************************************************************** @@ -134,52 +99,19 @@ int MORSE_Lapack_to_Tile(void *Af77, int LDA, MORSE_desc_t *A) *****************************************************************************/ int MORSE_Tile_to_Lapack(MORSE_desc_t *A, void *Af77, int LDA) { - MORSE_context_t *morse; - MORSE_sequence_t *sequence = NULL; - MORSE_request_t request; - int status; - - morse = morse_context_self(); - if (morse == NULL) { - morse_fatal_error("MORSE_Tile_to_Lapack", "MORSE not initialized"); - return MORSE_ERR_NOT_INITIALIZED; - } - /* Check descriptor for correctness */ - if (morse_desc_check(A) != MORSE_SUCCESS) { - morse_error("MORSE_Tile_to_Lapack", "invalid descriptor"); - return MORSE_ERR_ILLEGAL_VALUE; - } - morse_sequence_create(morse, &sequence); switch( A->dtyp ) { -#if defined(PRECISION_s) - case MorseRealFloat: - morse_pstile_to_lapack(A, Af77, LDA, sequence, &request); - break; -#endif - -#if defined(PRECISION_d) - case MorseRealDouble: - morse_pdtile_to_lapack(A, Af77, LDA, sequence, &request); + case MorseComplexDouble: + return MORSE_zTile_to_Lapack( A, (MORSE_Complex64_t *)Af77, LDA ); break; -#endif - -#if defined(PRECISION_c) case MorseComplexFloat: - morse_pctile_to_lapack(A, Af77, LDA, sequence, &request); + return MORSE_cTile_to_Lapack( A, (MORSE_Complex32_t *)Af77, LDA ); break; -#endif - -#if defined(PRECISION_z) - case MorseComplexDouble: - morse_pztile_to_lapack(A, Af77, LDA, sequence, &request); + case MorseRealFloat: + return MORSE_sTile_to_Lapack( A, (float *)Af77, LDA ); break; -#endif - + case MorseRealDouble: default: - morse_error("MORSE_Tile_to_Lapack", "Type unknown"); + return MORSE_dTile_to_Lapack( A, (double *)Af77, LDA ); } - RUNTIME_barrier(morse); - status = sequence->status; - morse_sequence_destroy(morse, sequence); - return status; + return MORSE_ERR_ILLEGAL_VALUE; } diff --git a/control/tile.h b/control/tile.h deleted file mode 100644 index 0cde00ce27af81b6fede36e1fb99ec83fe6beb01..0000000000000000000000000000000000000000 --- a/control/tile.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * @copyright (c) 2009-2014 The University of Tennessee and The University - * of Tennessee Research Foundation. - * All rights reserved. - * @copyright (c) 2012-2014 Inria. All rights reserved. - * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - * - **/ - -/** - * - * @file tile.h - * - * MORSE auxiliary routines - * MORSE is a software package provided by Univ. of Tennessee, - * Univ. of California Berkeley and Univ. of Colorado Denver - * - * @version 0.9.0 - * @author Jakub Kurzak - * @author Cedric Castagnede - * @date 2010-11-15 - * - **/ -#ifndef _MORSE_TILE_H_ -#define _MORSE_TILE_H_ - -#if defined( _WIN32 ) || defined( _WIN64 ) -typedef __int64 int64_t; -#else -#include <inttypes.h> -#endif - -#define ELTADDR(A, type, m, n) (type *)morse_geteltaddr(A, m, n) -#define ELTLDD(A, k) ( ( (((k)-1)/(A).mb) + (A).i/(A).mb) < (A).lm1 ? (A).mb : (A).lm%(A).mb ) - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * Internal routines - dynamic scheduling - **/ -void morse_pztile_to_lapack(MORSE_desc_t*, MORSE_Complex64_t*, int, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pctile_to_lapack(MORSE_desc_t*, MORSE_Complex32_t*, int, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pdtile_to_lapack(MORSE_desc_t*, double*, int, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pstile_to_lapack(MORSE_desc_t*, float*, int, MORSE_sequence_t *sequence, MORSE_request_t *request); - -void morse_pzlapack_to_tile(MORSE_Complex64_t*, int, MORSE_desc_t*, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pclapack_to_tile(MORSE_Complex32_t*, int, MORSE_desc_t*, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pdlapack_to_tile(double*, int, MORSE_desc_t*, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pslapack_to_tile(float*, int, MORSE_desc_t*, MORSE_sequence_t *sequence, MORSE_request_t *request); - -void morse_pztile_zero(MORSE_desc_t *dA, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pctile_zero(MORSE_desc_t *dA, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pdtile_zero(MORSE_desc_t *dA, MORSE_sequence_t *sequence, MORSE_request_t *request); -void morse_pstile_zero(MORSE_desc_t *dA, MORSE_sequence_t *sequence, MORSE_request_t *request); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/control/workspace.c b/control/workspace.c index efcb49f8c9f5be51ed3f9cbf6cdc3bcaff815b69..852402979c754194e26fec04c906ea8dfe47b941 100644 --- a/control/workspace.c +++ b/control/workspace.c @@ -94,6 +94,8 @@ int morse_alloc_ibnb_tile(int M, int N, MORSE_enum func, int type, MORSE_desc_t return MORSE_ERR_OUT_OF_RESOURCES; } + RUNTIME_desc_create( *desc ); + /* Check that everything is ok */ status = morse_desc_check(*desc); if (status != MORSE_SUCCESS) { @@ -156,6 +158,8 @@ int morse_alloc_ipiv(int M, int N, MORSE_enum func, int type, MORSE_desc_t **des return MORSE_ERR_OUT_OF_RESOURCES; } + RUNTIME_desc_create( *desc ); + return MORSE_SUCCESS; } diff --git a/coreblas/compute/core_zgetrf_incpiv.c b/coreblas/compute/core_zgetrf_incpiv.c index 220d8794e04617a0632f892ac51ec1e8ed6a6724..52456b02751661c7d2cf7bea897fb8d09ea23b7f 100644 --- a/coreblas/compute/core_zgetrf_incpiv.c +++ b/coreblas/compute/core_zgetrf_incpiv.c @@ -86,9 +86,9 @@ * ******************************************************************************/ -int CORE_zgetrf_incpiv(int M, int N, int IB, - MORSE_Complex64_t *A, int LDA, - int *IPIV, int *INFO) +int CORE_zgetrf_incpiv( int M, int N, int IB, + MORSE_Complex64_t *A, int LDA, + int *IPIV, int *INFO ) { int i, j, k, sb; int iinfo; diff --git a/include/chameleon/morse_constants.h b/include/chameleon/morse_constants.h index 8ffe90dc0868c8d574dd5fde01cc92fe63724fba..5638145bd06671d87a12bd4fb17c540b9529beb1 100644 --- a/include/chameleon/morse_constants.h +++ b/include/chameleon/morse_constants.h @@ -109,7 +109,6 @@ #define morse_const_neg(const) (((const-1)^0x01)+1) - /** **************************************************************************** * MORSE constants - boolean **/ @@ -119,7 +118,6 @@ #define MORSE_CPU ((1ULL)<<1) #define MORSE_CUDA ((1ULL)<<3) - /** **************************************************************************** * State machine switches **/ @@ -149,7 +147,6 @@ #define MORSE_INPLACE 1 #define MORSE_OUTOFPLACE 2 - /** **************************************************************************** * MORSE constants - success & error codes **/ @@ -166,7 +163,6 @@ #define MORSE_ERR_UNEXPECTED -110 #define MORSE_ERR_SEQUENCE_FLUSHED -111 - /** **************************************************************************** * Kernels options **/ @@ -181,7 +177,6 @@ #define CALLBACK 17 #define REDUX 18 - /** **************************************************************************** * MORSE ??? **/ diff --git a/include/chameleon/morse_z.h b/include/chameleon/morse_z.h index 89e0be9c89cd3af78fa66f8f73a71d89150578d0..2c504d54445271296b67344f4a4f06e8a6db3b97 100644 --- a/include/chameleon/morse_z.h +++ b/include/chameleon/morse_z.h @@ -349,8 +349,6 @@ int MORSE_Alloc_Workspace_zgetrf_incpiv_Tile(int N, MORSE_desc_t **descL, int ** **/ int MORSE_zLapack_to_Tile(MORSE_Complex64_t *Af77, int LDA, MORSE_desc_t *A); int MORSE_zTile_to_Lapack(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int LDA); -int MORSE_zLapack_to_Tile_Async(MORSE_Complex64_t *Af77, int LDA, MORSE_desc_t *A, MORSE_sequence_t *sequence, MORSE_request_t *request); -int MORSE_zTile_to_Lapack_Async(MORSE_desc_t *A, MORSE_Complex64_t *Af77, int LDA, MORSE_sequence_t *sequence, MORSE_request_t *request); /** **************************************************************************** * User Builder function prototypes