Mentions légales du service

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

Descriptors: use the chameleon_get.. functions from the helpers and remove them from other places

parent 6b9f8837
No related branches found
No related tags found
1 merge request!343Restructure the visibility of the descriptors functions
...@@ -38,6 +38,7 @@ set(CHAMELEON_CONTROL ...@@ -38,6 +38,7 @@ set(CHAMELEON_CONTROL
../control/control.c ../control/control.c
../control/descriptor.c ../control/descriptor.c
../control/descriptor_rec.c ../control/descriptor_rec.c
../control/descriptor_helpers.c
../control/workspace.c ../control/workspace.c
../control/tile.c ../control/tile.c
../control/chameleon_f77.c ../control/chameleon_f77.c
......
...@@ -113,27 +113,6 @@ void chameleon_desc_init_tiles( CHAM_desc_t *desc, blkrankof_fct_t rankof ) ...@@ -113,27 +113,6 @@ void chameleon_desc_init_tiles( CHAM_desc_t *desc, blkrankof_fct_t rankof )
} }
} }
/**
* Internal function to return MPI rank of element A(m,n) with m,n = block indices
*/
int chameleon_getrankof_2d( const CHAM_desc_t *A, int m, int n )
{
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
*/
int chameleon_getrankof_2d_diag( const CHAM_desc_t *A, int m, int n )
{
int mm = m + A->i / A->mb;
assert( m == n );
(void)n;
return (mm % A->p) * A->q + (mm % A->q);
}
/** /**
****************************************************************************** ******************************************************************************
* *
......
...@@ -37,20 +37,6 @@ extern "C" { ...@@ -37,20 +37,6 @@ extern "C" {
/** /**
* Internal routines * Internal routines
*/ */
inline static void* chameleon_geteltaddr(const CHAM_desc_t *A, int m, int n, int eltsize);
inline static void* chameleon_getaddr_cm (const CHAM_desc_t *A, int m, int n);
inline static void* chameleon_getaddr_ccrb (const CHAM_desc_t *A, int m, int n);
inline static void* chameleon_getaddr_null (const CHAM_desc_t *A, int m, int n);
inline static void* chameleon_getaddr_diag (const CHAM_desc_t *A, int m, int n);
inline static int chameleon_getblkldd_cm (const CHAM_desc_t *A, int m);
inline static int chameleon_getblkldd_ccrb(const CHAM_desc_t *A, int m);
/**
* Data distributions
*/
int chameleon_getrankof_2d(const CHAM_desc_t *desc, int m, int n);
int chameleon_getrankof_2d_diag(const CHAM_desc_t *desc, int m, int n);
static inline int chameleon_getrankof_tile(const CHAM_desc_t *desc, int m, int n) { static inline int chameleon_getrankof_tile(const CHAM_desc_t *desc, int m, int n) {
CHAM_tile_t *tile = desc->get_blktile( desc, m, n ); CHAM_tile_t *tile = desc->get_blktile( desc, m, n );
assert( tile != NULL ); assert( tile != NULL );
...@@ -87,78 +73,6 @@ CHAM_desc_t* chameleon_desc_submatrix( CHAM_desc_t *descA, int i, int j, int m, ...@@ -87,78 +73,6 @@ CHAM_desc_t* chameleon_desc_submatrix( CHAM_desc_t *descA, int i, int j, int m,
void chameleon_desc_destroy ( CHAM_desc_t *desc ); void chameleon_desc_destroy ( CHAM_desc_t *desc );
int chameleon_desc_check ( const CHAM_desc_t *desc ); int chameleon_desc_check ( const CHAM_desc_t *desc );
/**
* Internal function to return address of block (m,n) with m,n = block indices
*/
inline static void* chameleon_getaddr_ccrb(const CHAM_desc_t *A, int m, int n)
{
size_t mm = m + A->i / A->mb;
size_t nn = n + A->j / A->nb;
size_t eltsize = CHAMELEON_Element_Size(A->dtyp);
size_t offset = 0;
#if defined(CHAMELEON_USE_MPI)
assert( A->myrank == A->get_rankof( A, mm, nn) );
mm = mm / A->p;
nn = nn / A->q;
#endif
if (mm < (size_t)(A->llm1)) {
if (nn < (size_t)(A->lln1))
offset = (size_t)(A->bsiz) * (mm + (size_t)(A->llm1) * nn);
else
offset = A->A12 + ((size_t)(A->mb * (A->lln%A->nb)) * mm);
}
else {
if (nn < (size_t)(A->lln1))
offset = A->A21 + ((size_t)((A->llm%A->mb) * A->nb) * nn);
else
offset = A->A22;
}
return (void*)((intptr_t)A->mat + (offset*eltsize) );
}
/**
* Internal function to return address of block (m,n) with m,n = block indices
*/
inline static void *chameleon_getaddr_cm(const CHAM_desc_t *A, int m, int n)
{
size_t mm = m + A->i / A->mb;
size_t nn = n + A->j / A->nb;
size_t eltsize = CHAMELEON_Element_Size(A->dtyp);
size_t offset = 0;
#if defined(CHAMELEON_USE_MPI)
assert( A->myrank == A->get_rankof( A, mm, nn) );
mm = mm / A->p;
nn = nn / A->q;
#endif
offset = (size_t)(A->llm * A->nb) * nn + (size_t)(A->mb) * mm;
return (void*)((intptr_t)A->mat + (offset*eltsize) );
}
/**
* Internal function to return address of block (m,n) with m,n = block indices
*/
inline static void *chameleon_getaddr_diag( const CHAM_desc_t *A, int m, int n )
{
assert( m == n );
(void)n;
return chameleon_getaddr_ccrb( A, m, 0 );
}
/**
* Internal function to return address of block (m,n) with m,n = block indices
* This version lets the runtime allocate on-demand.
*/
inline static void *chameleon_getaddr_null(const CHAM_desc_t *A, int m, int n)
{
(void)A; (void)m; (void)n;
return NULL;
}
/** /**
* Internal function to return address of block (m,n) with m,n = block indices * Internal function to return address of block (m,n) with m,n = block indices
*/ */
...@@ -204,20 +118,6 @@ inline static void* chameleon_geteltaddr(const CHAM_desc_t *A, int m, int n, int ...@@ -204,20 +118,6 @@ inline static void* chameleon_geteltaddr(const CHAM_desc_t *A, int m, int n, int
return (void*)((intptr_t)A->mat + (offset*eltsize) ); return (void*)((intptr_t)A->mat + (offset*eltsize) );
} }
/**
* Internal function to return the leading dimension of element A(m,*) with m,n = block indices
*/
inline static int chameleon_getblkldd_ccrb(const CHAM_desc_t *A, int m)
{
int mm = m + A->i / A->mb;
return ( ((mm+1) == A->lmt) && ((A->lm % A->mb) != 0)) ? A->lm % A->mb : A->mb;
}
inline static int chameleon_getblkldd_cm(const CHAM_desc_t *A, int m) {
(void)m;
return A->llm;
}
/** /**
* Detect if the tile is local or not * Detect if the tile is local or not
*/ */
......
...@@ -58,6 +58,7 @@ set(CHAMELEON_HDRS ...@@ -58,6 +58,7 @@ set(CHAMELEON_HDRS
chameleon/timer.h chameleon/timer.h
chameleon/types.h chameleon/types.h
chameleon/flops.h chameleon/flops.h
chameleon/descriptor_helpers.h
) )
# Add generated headers # Add generated headers
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "chameleon/constants.h" #include "chameleon/constants.h"
#include "chameleon/types.h" #include "chameleon/types.h"
#include "chameleon/struct.h" #include "chameleon/struct.h"
#include "chameleon/descriptor_helpers.h"
/* **************************************************************************** /* ****************************************************************************
* CHAMELEON runtime common API * CHAMELEON runtime common API
......
...@@ -22,34 +22,6 @@ ...@@ -22,34 +22,6 @@
#include "testing_zcheck.h" #include "testing_zcheck.h"
#include <chameleon/flops.h> #include <chameleon/flops.h>
/**
* Internal function to return address of block (m,n) with m,n = block indices
*/
inline static void *
chameleon_getaddr_cm( const CHAM_desc_t *A, int m, int n )
{
size_t mm = m + A->i / A->mb;
size_t nn = n + A->j / A->nb;
size_t eltsize = CHAMELEON_Element_Size( A->dtyp );
size_t offset = 0;
#if defined(CHAMELEON_USE_MPI)
assert( A->myrank == A->get_rankof( A, mm, nn ) );
mm = mm / A->p;
nn = nn / A->q;
#endif
offset = (size_t)( A->llm * A->nb ) * nn + (size_t)( A->mb ) * mm;
return (void *)( (intptr_t)A->mat + ( offset * eltsize ) );
}
inline static int
chameleon_getblkldd_cm( const CHAM_desc_t *A, int m )
{
(void)m;
return A->llm;
}
int int
testing_zprint_desc( run_arg_list_t *args, int check ) testing_zprint_desc( run_arg_list_t *args, int check )
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment