Commit 1ff90ef1 authored by Mathieu Faverge's avatar Mathieu Faverge

Merge branch 'cleanup/lapack_to_tile' into 'master'

Cleanup - Lapack to tile

See merge request !78
parents 99b1c7ee e2236009
......@@ -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
......
......@@ -235,7 +235,6 @@ set(ZSRC
##################
#pzshift.c
#pzpack.c
pztile.c
ztile.c
##################
# BUILD
......
......@@ -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++){
......
......@@ -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);
}
......
......@@ -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) );
......
......@@ -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);
}
......@@ -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) );
......
/**
*
* @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 );
}
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}