Commit 91108685 authored by PRUVOST Florent's avatar PRUVOST Florent

do not allocate a matrix if NULL pointer is given for mat in...

do not allocate a matrix if NULL pointer is given for mat in MORSE_Desc_Create_User --> let the user manage the allocation of his data
parent 5c307575
......@@ -503,25 +503,7 @@ int MORSE_Desc_Create_User(MORSE_desc_t **desc, void *mat, MORSE_enum dtyp, int
**desc = morse_desc_init_user(dtyp, mb, nb, bsiz, lm, ln, i, j, m, n, p, q,
get_blkaddr, get_blkldd, get_rankof);
if (mat == NULL) {
#ifdef CHAMELEON_SIMULATION
(**desc).mat = (void*) 1;
#else
/* TODO: a call to morse_desc_mat_alloc should be made, but require to
move the call to RUNTIME_desc_create within the function */
size_t size = (size_t)((*desc)->llm) * (size_t)((*desc)->lln)
* (size_t)morse_element_size((*desc)->dtyp);
if (((**desc).mat = malloc(size)) == NULL) {
morse_error("MORSE_Desc_Create", "malloc() failed");
return MORSE_ERR_OUT_OF_RESOURCES;
}
#endif
} else {
(**desc).mat = mat;
}
(**desc).mat = mat;
/* Create scheduler structure like registering data */
RUNTIME_desc_create( *desc );
......
......@@ -101,27 +101,18 @@ int main(int argc, char *argv[]) {
MORSE_zplghe_Tile( (double)N, descA, 51 );
/* generate RHS */
MORSE_Desc_Create_User(&descB, NULL, MorseComplexDouble,
NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1,
morse_getaddr_ccrb,
morse_getblkldd_ccrb,
morse_getrankof_2d);
MORSE_Desc_Create(&descB, NULL, MorseComplexDouble,
NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1);
MORSE_zplrnt_Tile( descB, 7672 );
/* copy A before facto. in order to check the result */
MORSE_Desc_Create_User(&descAC, NULL, MorseComplexDouble,
NB, NB, NB*NB, N, N, 0, 0, N, N, 1, 1,
morse_getaddr_ccrb,
morse_getblkldd_ccrb,
morse_getrankof_2d);
MORSE_Desc_Create(&descAC, NULL, MorseComplexDouble,
NB, NB, NB*NB, N, N, 0, 0, N, N, 1, 1);
MORSE_zlacpy_Tile(MorseUpperLower, descA, descAC);
/* copy B before solving in order to check the result */
MORSE_Desc_Create_User(&descX, NULL, MorseComplexDouble,
NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1,
morse_getaddr_ccrb,
morse_getblkldd_ccrb,
morse_getrankof_2d);
MORSE_Desc_Create(&descX, NULL, MorseComplexDouble,
NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1);
MORSE_zlacpy_Tile(MorseUpperLower, descB, descX);
/* solve the system AX = B using the Cholesky factorization,
......
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