Mentions légales du service

Skip to content
Snippets Groups Projects
Commit fd7564f2 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Merge branch 'issue25/double_registration' into 'master'

Cuda double registration

Closes #25

See merge request !38
parents 3e7b6723 bc5ce254
No related branches found
No related tags found
1 merge request!38Cuda double registration
Pipeline #
...@@ -243,6 +243,8 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc ) ...@@ -243,6 +243,8 @@ int morse_desc_mat_alloc( MORSE_desc_t *desc )
return MORSE_ERR_OUT_OF_RESOURCES; return MORSE_ERR_OUT_OF_RESOURCES;
} }
/* The matrix has already been registered by the Runtime alloc */
desc->register_mat = 0;
RUNTIME_desc_create(desc); RUNTIME_desc_create(desc);
return MORSE_SUCCESS; return MORSE_SUCCESS;
...@@ -453,7 +455,6 @@ int MORSE_Desc_Create_User(MORSE_desc_t **desc, void *mat, MORSE_enum dtyp, int ...@@ -453,7 +455,6 @@ 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, **desc = morse_desc_init_user(dtyp, mb, nb, bsiz, lm, ln, i, j, m, n, p, q,
get_blkaddr, get_blkldd, get_rankof); get_blkaddr, get_blkldd, get_rankof);
/* if the user gives a pointer to the overall data (tiles) we can use it */ /* if the user gives a pointer to the overall data (tiles) we can use it */
(**desc).use_mat = (mat == NULL) ? 0 : 1; (**desc).use_mat = (mat == NULL) ? 0 : 1;
......
/** /**
* *
* @copyright (c) 2009-2014 The University of Tennessee and The University * @copyright (c) 2009-2014 The University of Tennessee and The University of
* of Tennessee Research Foundation. * Tennessee Research Foundation. All rights reserved.
* All rights reserved. * @copyright (c) 2012-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* @copyright (c) 2012-2016 Inria. All rights reserved. * Univ. Bordeaux. All rights reserved.
* @copyright (c) 2012-2014, 2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* *
**/ **/
/** /**
* *
* @file runtime_descriptor.c * @file runtime_descriptor.c
...@@ -29,17 +27,17 @@ ...@@ -29,17 +27,17 @@
#if defined(CHAMELEON_USE_MPI) #if defined(CHAMELEON_USE_MPI)
/* Take 24 bits for the tile id, and 7 bits for descriptor id. /* Take 24 bits for the tile id, and 7 bits for descriptor id.
These values can be changed through the call MORSE_user_tag_size(int tag_width, int tag_sep) */ These values can be changed through the call MORSE_user_tag_size(int tag_width, int tag_sep) */
#define TAG_WIDTH_MIN 20 #define TAG_WIDTH_MIN 20
static int tag_width = 31; static int tag_width = 31;
static int tag_sep = 24; static int tag_sep = 24;
static int _tag_mpi_initialized_ = 0; static int _tag_mpi_initialized_ = 0;
#ifndef HAVE_STARPU_MPI_DATA_REGISTER #ifndef HAVE_STARPU_MPI_DATA_REGISTER
#define starpu_mpi_data_register( handle_, tag_, owner_ ) \ #define starpu_mpi_data_register( handle_, tag_, owner_ ) \
do { \ do { \
starpu_data_set_rank( (handle_), (owner_) ); \ starpu_data_set_rank( (handle_), (owner_) ); \
starpu_data_set_tag( (handle_), (tag_) ); \ starpu_data_set_tag( (handle_), (tag_) ); \
} while(0) } while(0)
#endif #endif
...@@ -53,16 +51,16 @@ static int _tag_mpi_initialized_ = 0; ...@@ -53,16 +51,16 @@ static int _tag_mpi_initialized_ = 0;
void RUNTIME_user_tag_size(int user_tag_width, int user_tag_sep) { void RUNTIME_user_tag_size(int user_tag_width, int user_tag_sep) {
#if defined(CHAMELEON_USE_MPI) #if defined(CHAMELEON_USE_MPI)
if (_tag_mpi_initialized_ == 0) { if (_tag_mpi_initialized_ == 0) {
tag_width=user_tag_width; tag_width=user_tag_width;
tag_sep=user_tag_sep; tag_sep=user_tag_sep;
} else } else
morse_error("RUNTIME_user_tag_size", "must be called before creating any Morse descriptor with MORSE_Desc_create(). The tag sizes will not be modified."); morse_error("RUNTIME_user_tag_size", "must be called before creating any Morse descriptor with MORSE_Desc_create(). The tag sizes will not be modified.");
#endif #endif
} }
void *RUNTIME_mat_alloc( size_t size) void *RUNTIME_mat_alloc( size_t size )
{ {
#if defined(CHAMELEON_SIMULATION) && !defined(STARPU_MALLOC_SIMULATION_FOLDED) && !defined(CHAMELEON_USE_MPI) #if defined(CHAMELEON_SIMULATION) && !defined(STARPU_MALLOC_SIMULATION_FOLDED) && !defined(CHAMELEON_USE_MPI)
return (void*) 1; return (void*) 1;
...@@ -75,7 +73,7 @@ void *RUNTIME_mat_alloc( size_t size) ...@@ -75,7 +73,7 @@ void *RUNTIME_mat_alloc( size_t size)
#endif #endif
} }
void RUNTIME_mat_free( void *mat, size_t size) void RUNTIME_mat_free( void *mat, size_t size )
{ {
#if defined(CHAMELEON_SIMULATION) && !defined(STARPU_MALLOC_SIMULATION_FOLDED) && !defined(CHAMELEON_USE_MPI) #if defined(CHAMELEON_SIMULATION) && !defined(STARPU_MALLOC_SIMULATION_FOLDED) && !defined(CHAMELEON_USE_MPI)
return; return;
...@@ -109,11 +107,13 @@ void RUNTIME_desc_create( MORSE_desc_t *desc ) ...@@ -109,11 +107,13 @@ void RUNTIME_desc_create( MORSE_desc_t *desc )
{ {
int64_t eltsze = MORSE_Element_Size(desc->dtyp); int64_t eltsze = MORSE_Element_Size(desc->dtyp);
size_t size = (size_t)(desc->llm) * (size_t)(desc->lln) * eltsze; size_t size = (size_t)(desc->llm) * (size_t)(desc->lln) * eltsze;
cudaError_t rc;
/* Register the matrix as pinned memory */ /* Register the matrix as pinned memory */
if ( cudaHostRegister( desc->mat, size, cudaHostRegisterPortable ) != cudaSuccess ) rc = cudaHostRegister( desc->mat, size, cudaHostRegisterPortable );
if ( rc != cudaSuccess )
{ {
morse_warning("RUNTIME_desc_create(StarPU)", "cudaHostRegister failed to register the matrix as pinned memory"); morse_warning("RUNTIME_desc_create(StarPU): cudaHostRegister - ", cudaGetErrorString( rc ));
} }
} }
} }
...@@ -209,8 +209,8 @@ void RUNTIME_desc_destroy( MORSE_desc_t *desc ) ...@@ -209,8 +209,8 @@ void RUNTIME_desc_destroy( MORSE_desc_t *desc )
void RUNTIME_desc_init( MORSE_desc_t *desc ) void RUNTIME_desc_init( MORSE_desc_t *desc )
{ {
(void)desc; (void)desc;
return; return;
} }
void RUNTIME_desc_submatrix( MORSE_desc_t *desc ) void RUNTIME_desc_submatrix( MORSE_desc_t *desc )
......
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