Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 58515121 authored by THIBAULT Samuel's avatar THIBAULT Samuel
Browse files

Use simulation folded allocation from starpu when available

parent 2bcdde67
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2014 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
......@@ -406,9 +406,10 @@ int morse_desc_mat_free( MORSE_desc_t *desc )
if (desc->mat != NULL &&
desc->use_mat == 1 &&
desc->alloc_mat == 1) {
#if !defined(CHAMELEON_SIMULATION) || defined(CHAMELEON_USE_MPI)
free(desc->mat);
#endif
size_t size = (size_t)(desc->llm) * (size_t)(desc->lln)
* (size_t)MORSE_Element_Size(desc->dtyp);
RUNTIME_mat_free(desc->mat, size);
desc->mat = NULL;
}
return MORSE_SUCCESS;
......@@ -496,20 +497,14 @@ int MORSE_Desc_Create(MORSE_desc_t **desc, void *mat, MORSE_enum dtyp, int mb, i
if (mat == NULL) {
#if defined(CHAMELEON_SIMULATION) && !defined(CHAMELEON_USE_MPI)
(*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) {
if (((*desc)->mat = RUNTIME_mat_alloc(size)) == NULL) {
morse_error("MORSE_Desc_Create", "malloc() failed");
return MORSE_ERR_OUT_OF_RESOURCES;
}
(*desc)->alloc_mat = 1;
#endif
} else {
(*desc)->mat = mat;
......
......@@ -4,7 +4,7 @@
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2014 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
......@@ -60,6 +60,8 @@ void RUNTIME_comm_size (int*);
/*******************************************************************************
* RUNTIME Descriptor
**/
void* RUNTIME_mat_alloc (size_t);
void RUNTIME_mat_free (void*, size_t);
void RUNTIME_desc_init (MORSE_desc_t*);
void RUNTIME_desc_create (MORSE_desc_t*);
void RUNTIME_desc_destroy (MORSE_desc_t*);
......
......@@ -4,13 +4,25 @@
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2015 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
#include <stdlib.h>
#include "runtime/parsec/include/morse_parsec.h"
#include <dague/data.h>
void *RUNTIME_mat_alloc( size_t size)
{
return malloc(size);
}
void RUNTIME_mat_free( void *mat, size_t size)
{
(void)size;
free(mat);
return;
}
struct morse_parsec_desc_s {
dague_ddesc_t super;
MORSE_desc_t *desc;
......
......@@ -4,7 +4,7 @@
* 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.
* @copyright (c) 2012-2014, 2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
......@@ -25,6 +25,18 @@
#include <stdlib.h>
#include "runtime/quark/include/morse_quark.h"
void *RUNTIME_mat_alloc( size_t size)
{
return malloc(size);
}
void RUNTIME_mat_free( void *mat, size_t size)
{
(void)size;
free(mat);
return;
}
void RUNTIME_desc_init( MORSE_desc_t *desc )
{
(void)desc;
......
......@@ -4,7 +4,7 @@
* 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.
* @copyright (c) 2012-2014, 2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
......@@ -43,6 +43,34 @@ static int tag_sep = 24;
#endif
#ifdef STARPU_MALLOC_SIMULATION_FOLDED
#define FOLDED STARPU_MALLOC_SIMULATION_FOLDED
#else
#define FOLDED 0
#endif
void *RUNTIME_mat_alloc( size_t size)
{
#if defined(CHAMELEON_SIMULATION) && !defined(STARPU_MALLOC_SIMULATION_FOLDED) && !defined(CHAMELEON_USE_MPI)
return (void*) 1;
#else
void *mat;
if (starpu_malloc_flags(&mat, size, STARPU_MALLOC_PINNED|FOLDED) != 0)
return NULL;
return mat;
#endif
}
void RUNTIME_mat_free( void *mat, size_t size)
{
#if defined(CHAMELEON_SIMULATION) && !defined(STARPU_MALLOC_SIMULATION_FOLDED) && !defined(CHAMELEON_USE_MPI)
return (void*) 1;
#else
starpu_free_flags(mat, size, STARPU_MALLOC_PINNED|FOLDED);
#endif
}
void RUNTIME_desc_create( MORSE_desc_t *desc )
{
int64_t lmt = desc->lmt;
......
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