Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 10286ffe authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

in MORSE_Desc_Create_User we can use the matrix in mat field without...

in MORSE_Desc_Create_User we can use the matrix in mat field without allocating it --> avoid to free it in this case, users could need it and will manage deallocation
parent 691af922
No related branches found
No related tags found
No related merge requests found
......@@ -122,7 +122,7 @@ int MORSE_InitPar(int nworkers, int ncudas, int nthreads_per_worker)
int flag = 0, provided = 0;
MPI_Initialized( &flag );
if ( !flag ) {
MPI_Init_thread( NULL, NULL, MPI_THREAD_MULTIPLE, &provided );
MPI_Init_thread( NULL, NULL, MPI_THREAD_MULTIPLE, &provided );
}
}
#endif
......
......@@ -66,6 +66,7 @@ MORSE_desc_t morse_desc_init(MORSE_enum dtyp, int mb, int nb, int bsiz,
desc.id = nbdesc; nbdesc++;
desc.occurences = 0;
desc.use_mat = 1;
desc.alloc_mat = 1;
desc.register_mat = 1;
#if defined(CHAMELEON_USE_MPI)
......@@ -157,6 +158,7 @@ MORSE_desc_t morse_desc_init_user(MORSE_enum dtyp, int mb, int nb, int bsiz,
desc.id = nbdesc; nbdesc++;
desc.occurences = 0;
desc.use_mat = 1;
desc.alloc_mat = 1;
desc.register_mat = 1;
#if defined(CHAMELEON_USE_MPI)
......@@ -316,7 +318,9 @@ int morse_desc_mat_free( MORSE_desc_t *desc )
RUNTIME_desc_destroy( desc );
if (desc->mat != NULL && desc->use_mat == 1) {
if (desc->mat != NULL &&
desc->use_mat == 1 &&
desc->alloc_mat == 1) {
#ifndef CHAMELEON_SIMULATION
free(desc->mat);
#endif
......@@ -417,6 +421,8 @@ int MORSE_Desc_Create(MORSE_desc_t **desc, void *mat, MORSE_enum dtyp, int mb, i
} else {
(**desc).mat = mat;
/* memory of the matrix is handle by users */
(**desc).alloc_mat = 0;
}
/* Create scheduler structure like registering data */
......@@ -511,6 +517,9 @@ int MORSE_Desc_Create_User(MORSE_desc_t **desc, void *mat, MORSE_enum dtyp, int
/* if the user gives a pointer to the overall data (tiles) we can use it */
(**desc).use_mat = (mat == NULL) ? 0 : 1;
/* memory of the matrix is handle by users */
(**desc).alloc_mat = 0;
/* users data can have multiple forms: let him register tiles */
(**desc).register_mat = 0;
......
......@@ -102,6 +102,7 @@ struct morse_desc_s {
// submatrix desc (occurances>1) to avoid unregistering
// GPU data twice
int use_mat; // 1 if we have a pointer to the overall data mat - else 0
int alloc_mat; // 1 if we handle the allocation of mat - else 0
int register_mat; // 1 if we have to register mat - else 0 (handled by the application)
int myrank; // MPI rank of the descriptor
void *schedopt; // scheduler (QUARK|StarPU) specific structure
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment