Commit b33153a7 authored by Mathieu Faverge's avatar Mathieu Faverge

Fix issue with desc created/destroyed in mat_alloc/free

parent a29ceeb8
...@@ -99,6 +99,7 @@ void morse_pzhetrd_he2hb(MORSE_enum uplo, ...@@ -99,6 +99,7 @@ void morse_pzhetrd_he2hb(MORSE_enum uplo,
MorseComplexDouble, A->mb, A->nb, (A->mb*A->nb), 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); 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 ); morse_desc_mat_alloc( AT );
RUNTIME_desc_create( AT );
/* Let's extract the diagonal in a temporary copy that contains A and A' */ /* Let's extract the diagonal in a temporary copy that contains A and A' */
for (k = 1; k < A->nt; k++){ for (k = 1; k < A->nt; k++){
......
...@@ -42,7 +42,8 @@ ...@@ -42,7 +42,8 @@
descA = morse_desc_init_diag( \ descA = morse_desc_init_diag( \
MorseComplexDouble, (mb), (nb), ((mb)*(nb)), \ MorseComplexDouble, (mb), (nb), ((mb)*(nb)), \
(m), (n), (i), (j), (m), (n), p, q); \ (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) \ #define morse_zdesc_alloc( descA, mb, nb, lm, ln, i, j, m, n, free) \
descA = morse_desc_init( \ descA = morse_desc_init( \
...@@ -52,7 +53,8 @@ ...@@ -52,7 +53,8 @@
morse_error( __func__, "morse_desc_mat_alloc() failed"); \ morse_error( __func__, "morse_desc_mat_alloc() failed"); \
{free;}; \ {free;}; \
return MORSE_ERR_OUT_OF_RESOURCES; \ return MORSE_ERR_OUT_OF_RESOURCES; \
} } \
RUNTIME_desc_create( &(descA) );
/***************************************************************************//** /***************************************************************************//**
* Declarations of internal sequential functions * Declarations of internal sequential functions
...@@ -175,17 +177,15 @@ morse_zlap2tile( MORSE_context_t *morse, ...@@ -175,17 +177,15 @@ morse_zlap2tile( MORSE_context_t *morse,
*descAt = morse_desc_init( MorseComplexDouble, mb, nb, (mb)*(nb), *descAt = morse_desc_init( MorseComplexDouble, mb, nb, (mb)*(nb),
lm, ln, 0, 0, m, n, 1, 1 ); lm, ln, 0, 0, m, n, 1, 1 );
RUNTIME_desc_create( descAl );
RUNTIME_desc_create( descAt );
if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {
if ( morse_desc_mat_alloc( descAt ) ) { if ( morse_desc_mat_alloc( descAt ) ) {
morse_error( "morse_zlap2tile", "morse_desc_mat_alloc() failed"); morse_error( "morse_zlap2tile", "morse_desc_mat_alloc() failed");
RUNTIME_desc_destroy( descAl );
RUNTIME_desc_destroy( descAt );
return MORSE_ERR_OUT_OF_RESOURCES; return MORSE_ERR_OUT_OF_RESOURCES;
} }
RUNTIME_desc_create( descAl );
RUNTIME_desc_create( descAt );
if ( mode & MorseDescInput ) { if ( mode & MorseDescInput ) {
morse_pzlacpy( uplo, descAl, descAt, seq, req ); morse_pzlacpy( uplo, descAl, descAt, seq, req );
} }
...@@ -193,6 +193,10 @@ morse_zlap2tile( MORSE_context_t *morse, ...@@ -193,6 +193,10 @@ morse_zlap2tile( MORSE_context_t *morse,
else { else {
morse_fatal_error( "morse_zlap2tile", "INPLACE translation not supported yet"); morse_fatal_error( "morse_zlap2tile", "INPLACE translation not supported yet");
descAt->mat = A; descAt->mat = A;
RUNTIME_desc_create( descAl );
RUNTIME_desc_create( descAt );
if ( mode & MorseDescInput ) { if ( mode & MorseDescInput ) {
/* MORSE_zgecfi_Async( lm, ln, A, MorseCM, mb, nb, */ /* MORSE_zgecfi_Async( lm, ln, A, MorseCM, mb, nb, */
/* MorseCCRB, mb, nb, seq, req ); */ /* MorseCCRB, mb, nb, seq, req ); */
......
...@@ -307,7 +307,6 @@ int morse_desc_check(const MORSE_desc_t *desc) ...@@ -307,7 +307,6 @@ int morse_desc_check(const MORSE_desc_t *desc)
**/ **/
int morse_desc_mat_alloc( 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 size = (size_t)(desc->llm) * (size_t)(desc->lln)
* (size_t)MORSE_Element_Size(desc->dtyp); * (size_t)MORSE_Element_Size(desc->dtyp);
if ((desc->mat = RUNTIME_malloc(size)) == NULL) { if ((desc->mat = RUNTIME_malloc(size)) == NULL) {
...@@ -317,7 +316,6 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc ) ...@@ -317,7 +316,6 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc )
/* The matrix has already been registered by the Runtime alloc */ /* The matrix has already been registered by the Runtime alloc */
desc->register_mat = 0; desc->register_mat = 0;
RUNTIME_desc_create(desc);
return MORSE_SUCCESS; return MORSE_SUCCESS;
} }
...@@ -327,8 +325,6 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc ) ...@@ -327,8 +325,6 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc )
**/ **/
int morse_desc_mat_free( MORSE_desc_t *desc ) int morse_desc_mat_free( MORSE_desc_t *desc )
{ {
RUNTIME_desc_destroy( desc );
if ( (desc->mat != NULL) && if ( (desc->mat != NULL) &&
(desc->use_mat == 1 ) && (desc->use_mat == 1 ) &&
(desc->alloc_mat == 1 ) ) (desc->alloc_mat == 1 ) )
......
...@@ -94,6 +94,8 @@ int morse_alloc_ibnb_tile(int M, int N, MORSE_enum func, int type, MORSE_desc_t ...@@ -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; return MORSE_ERR_OUT_OF_RESOURCES;
} }
RUNTIME_desc_create( *desc );
/* Check that everything is ok */ /* Check that everything is ok */
status = morse_desc_check(*desc); status = morse_desc_check(*desc);
if (status != MORSE_SUCCESS) { 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 ...@@ -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; return MORSE_ERR_OUT_OF_RESOURCES;
} }
RUNTIME_desc_create( *desc );
return MORSE_SUCCESS; return MORSE_SUCCESS;
} }
......
...@@ -86,9 +86,9 @@ ...@@ -86,9 +86,9 @@
* *
******************************************************************************/ ******************************************************************************/
int CORE_zgetrf_incpiv(int M, int N, int IB, int CORE_zgetrf_incpiv( int M, int N, int IB,
MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *A, int LDA,
int *IPIV, int *INFO) int *IPIV, int *INFO )
{ {
int i, j, k, sb; int i, j, k, sb;
int iinfo; int iinfo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment