Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 0de2046c authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Merge branch 'issue43' into 'master'

Fix issue #43 - Submatrix fields

Closes #43

See merge request solverstack/chameleon!82
parents da2935a5 95f105e7
......@@ -62,7 +62,7 @@ int morse_desc_check (const MORSE_desc_t *desc);
int morse_desc_mat_alloc(MORSE_desc_t *desc);
int morse_desc_mat_free (MORSE_desc_t *desc);
#define BLKLDD(A, k) A->get_blkldd( A,k )
#define BLKLDD(A, k) A->get_blkldd( A, k )
/**
* Internal function to return address of block (m,n) with m,n = block indices
......@@ -174,18 +174,21 @@ inline static int morse_getblkldd_cm(const MORSE_desc_t *A, int m) {
/**
* Internal function to return MPI rank of element A(m,n) with m,n = block indices
*/
inline static int morse_getrankof_2d(const MORSE_desc_t *desc, int m, int n)
inline static int morse_getrankof_2d(const MORSE_desc_t *A, int m, int n)
{
return (m % desc->p) * desc->q + (n % desc->q);
int mm = m + A->i / A->mb;
int nn = n + A->j / A->nb;
return (mm % A->p) * A->q + (nn % A->q);
}
/**
* Internal function to return MPI rank of element DIAG(m,0) with m,n = block indices
*/
inline static int morse_getrankof_2d_diag(const MORSE_desc_t *desc, int m, int n)
inline static int morse_getrankof_2d_diag(const MORSE_desc_t *A, int m, int n)
{
int mm = m + A->i / A->mb;
assert( n == 0 );
return (m % desc->p) * desc->q + (m % desc->q);
return (mm % A->p) * A->q + (mm % A->q);
}
......
......@@ -262,7 +262,8 @@ void RUNTIME_desc_create( MORSE_desc_t *mdesc )
default: morse_fatal_error("MORSE_Element_Size", "undefined type"); break;
}
parsec_matrix_add2arena_tile( parsec_dtd_arenas[pdesc->arena_index], datatype, mdesc->mb*mdesc->nb*MORSE_Element_Size(mdesc->dtyp) );
parsec_matrix_add2arena_tile( parsec_dtd_arenas[pdesc->arena_index], datatype,
mdesc->mb * mdesc->nb * MORSE_Element_Size(mdesc->dtyp) );
#endif
/* /\* Overwrite the leading dimensions to store the padding *\/ */
/* mdesc->llm = mdesc->mb * mdesc->lmt; */
......@@ -287,7 +288,9 @@ void RUNTIME_desc_destroy( MORSE_desc_t *mdesc )
for(i=0; i<nb_local_tiles; i++, data++)
{
parsec_data_destroy( *data );
if (*data) {
parsec_data_destroy( *data );
}
}
free( pdesc->data_map );
......
......@@ -368,10 +368,13 @@ void RUNTIME_desc_flush( const MORSE_desc_t *desc,
}
void RUNTIME_data_flush( const MORSE_sequence_t *sequence,
const MORSE_desc_t *A, int Am, int An )
const MORSE_desc_t *A, int m, int n )
{
starpu_data_handle_t *handle = (starpu_data_handle_t*)(A->schedopt);
handle += ((int64_t)(A->lmt) * (int64_t)An + (int64_t)Am);
int64_t mm = m + (A->i / A->mb);
int64_t nn = n + (A->j / A->nb);
starpu_data_handle_t *handle = A->schedopt;
handle += ((int64_t)A->lmt) * nn + mm;
if (*handle == NULL) {
return;
......@@ -381,7 +384,7 @@ void RUNTIME_data_flush( const MORSE_sequence_t *sequence,
starpu_mpi_cache_flush( MPI_COMM_WORLD, *handle );
#endif
if ( morse_desc_islocal( A, Am, An ) ) {
if ( morse_desc_islocal( A, m, n ) ) {
chameleon_starpu_data_wont_use( *handle );
}
......@@ -416,32 +419,32 @@ void RUNTIME_data_migrate( const MORSE_sequence_t *sequence,
#define STARPU_MAIN_RAM 0
#endif
void *RUNTIME_data_getaddr( const MORSE_desc_t *desc, int m, int n )
void *RUNTIME_data_getaddr( const MORSE_desc_t *A, int m, int n )
{
int64_t im = m + (desc->i / desc->mb);
int64_t jn = n + (desc->j / desc->nb);
int64_t mm = m + (A->i / A->mb);
int64_t nn = n + (A->j / A->nb);
starpu_data_handle_t *ptrtile = desc->schedopt;
ptrtile += ((int64_t)desc->lmt) * jn + im;
starpu_data_handle_t *ptrtile = A->schedopt;
ptrtile += ((int64_t)A->lmt) * nn + mm;
if (*ptrtile == NULL) {
int home_node = -1;
void *user_ptr = NULL;
int myrank = desc->myrank;
int owner = desc->get_rankof( desc, m, n );
int64_t eltsze = MORSE_Element_Size(desc->dtyp);
int tempmm = (im == desc->lmt-1) ? (desc->lm - im * desc->mb) : desc->mb;
int tempnn = (jn == desc->lnt-1) ? (desc->ln - jn * desc->nb) : desc->nb;
int myrank = A->myrank;
int owner = A->get_rankof( A, m, n );
int64_t eltsze = MORSE_Element_Size(A->dtyp);
int tempmm = (mm == A->lmt-1) ? (A->lm - mm * A->mb) : A->mb;
int tempnn = (nn == A->lnt-1) ? (A->ln - nn * A->nb) : A->nb;
if ( myrank == owner ) {
user_ptr = desc->get_blkaddr(desc, m, n);
user_ptr = A->get_blkaddr(A, m, n);
if ( user_ptr != NULL ) {
home_node = STARPU_MAIN_RAM;
}
}
starpu_matrix_data_register( ptrtile, home_node, (uintptr_t) user_ptr,
BLKLDD(desc, im),
BLKLDD(A, m),
tempmm, tempnn, eltsze );
#ifdef HAVE_STARPU_DATA_SET_COORDINATES
......@@ -450,8 +453,8 @@ void *RUNTIME_data_getaddr( const MORSE_desc_t *desc, int m, int n )
#if defined(CHAMELEON_USE_MPI)
{
int64_t block_ind = desc->lmt * jn + im;
starpu_mpi_data_register(*ptrtile, (desc->id << tag_sep) | (block_ind), owner);
int64_t block_ind = A->lmt * nn + mm;
starpu_mpi_data_register(*ptrtile, (A->id << tag_sep) | (block_ind), owner);
}
#endif /* defined(CHAMELEON_USE_MPI) */
}
......
......@@ -118,10 +118,13 @@ void RUNTIME_set_reduction_methods(starpu_data_handle_t handle, MORSE_enum dtyp)
#if defined(CHAMELEON_USE_MPI) && defined(HAVE_STARPU_MPI_CACHED_RECEIVE)
static inline int
chameleon_starpu_data_iscached(const MORSE_desc_t *A, int Am, int An)
chameleon_starpu_data_iscached(const MORSE_desc_t *A, int m, int n)
{
starpu_data_handle_t *ptrtile = (starpu_data_handle_t*)(A->schedopt);
ptrtile += ((int64_t)(A->lmt) * (int64_t)An + (int64_t)Am);
int64_t mm = m + (A->i / A->mb);
int64_t nn = n + (A->j / A->nb);
starpu_data_handle_t *ptrtile = A->schedopt;
ptrtile += ((int64_t)A->lmt) * nn + mm;
if (!(*ptrtile))
return 0;
......
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