Commit b7731f39 authored by PRUVOST Florent's avatar PRUVOST Florent

distribute data needed for ibnb and block-diagonal workspaces

parent b57517dc
......@@ -104,7 +104,7 @@ void morse_pzgelqf(MORSE_desc_t *A, MORSE_desc_t *T,
/* necessary to avoid dependencies between tslqt and unmlq tasks regarding the diag tile */
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, (minMT-1)*A->mb, A->nb, 0, 0, (minMT-1)*A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, (minMT-1)*A->mb, A->nb, 0, 0, (minMT-1)*A->mb, A->nb, A->p, A->q);
for (k = 0; k < min(A->mt, A->nt); k++) {
tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
......
......@@ -107,7 +107,7 @@ void morse_pzgelqfrh(MORSE_desc_t *A, MORSE_desc_t *T, int BS,
/* necessary to avoid dependencies between tasks regarding the diag tile */
nblk = ( A->nt + BS -1 ) / BS;
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb, A->p, A->q);
for (k = 0; k < min(A->mt, A->nt); k++) {
tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
......
......@@ -99,7 +99,7 @@ void morse_pzgeqrf(MORSE_desc_t *A, MORSE_desc_t *T,
/* necessary to avoid dependencies between tsqrt and unmqr tasks regarding the diag tile */
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb, A->p, A->q);
for (k = 0; k < minMNT; k++) {
tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
......
......@@ -105,7 +105,7 @@ void morse_pzgeqrfrh(MORSE_desc_t *A, MORSE_desc_t *T, int BS,
/* necessary to avoid dependencies between tasks regarding the diag tile */
nblk = ( A->mt + BS -1 ) / BS;
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb, A->p, A->q);
K = min(A->mt, A->nt);
for (k = 0; k < K; k++) {
......
......@@ -75,7 +75,7 @@ void morse_pzgetrf_incpiv(MORSE_desc_t *A, MORSE_desc_t *L, int *IPIV,
/* necessary to avoid dependencies between tasks regarding the diag tile */
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb, A->p, A->q);
for (k = 0; k < minMNT; k++) {
tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
......
......@@ -93,7 +93,7 @@ void morse_pzunglq(MORSE_desc_t *A, MORSE_desc_t *Q, MORSE_desc_t *T,
/* necessary to avoid dependencies between tasks regarding the diag tile */
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, minMT*A->mb, A->nb, 0, 0, minMT*A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, minMT*A->mb, A->nb, 0, 0, minMT*A->mb, A->nb, A->p, A->q);
for (k = min(A->mt, A->nt)-1; k >= 0; k--) {
tempAkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
......
......@@ -92,7 +92,7 @@ void morse_pzunglqrh(MORSE_desc_t *A, MORSE_desc_t *Q,
/* necessary to avoid dependencies between tasks regarding the diag tile */
nblk = ( A->nt + BS -1 ) / BS;
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb, A->p, A->q);
K = min(A->mt, A->nt);
for (k = K-1; k >= 0; k--) {
......
......@@ -87,7 +87,7 @@ void morse_pzungqr(MORSE_desc_t *A, MORSE_desc_t *Q, MORSE_desc_t *T,
/* necessary to avoid dependencies between tasks regarding the diag tile */
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb, A->p, A->q);
for (k = min(A->mt, A->nt)-1; k >= 0; k--) {
tempAkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
......
......@@ -94,7 +94,7 @@ void morse_pzungqrrh(MORSE_desc_t *A, MORSE_desc_t *Q,
/* necessary to avoid dependencies between tasks regarding the diag tile */
nblk = ( A->mt + BS -1 ) / BS;
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb, A->p, A->q);
K = min(A->mt, A->nt);
for (k = K-1; k >= 0; k--) {
......
......@@ -95,7 +95,7 @@ void morse_pzunmlq(MORSE_enum side, MORSE_enum trans,
/* necessary to avoid dependencies between tasks regarding the diag tile */
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, minMT*A->mb, A->nb, 0, 0, minMT*A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, minMT*A->mb, A->nb, 0, 0, minMT*A->mb, A->nb, A->p, A->q);
if (side == MorseLeft ) {
if (trans == MorseNoTrans) {
......
......@@ -94,7 +94,7 @@ void morse_pzunmlqrh(MORSE_enum side, MORSE_enum trans,
/* necessary to avoid dependencies between tasks regarding the diag tile */
nblk = ( A->nt + BS -1 ) / BS;
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb, A->p, A->q);
K = min(A->mt, A->nt);
if (side == MorseLeft ) {
......
......@@ -87,7 +87,7 @@ void morse_pzunmqr(MORSE_enum side, MORSE_enum trans,
/* necessary to avoid dependencies between tasks regarding the diag tile */
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, min(A->m, A->n), A->nb, 0, 0, min(A->m, A->n), A->nb, A->p, A->q);
if (A->m > A->n) {
minM = A->n;
......
......@@ -94,7 +94,7 @@ void morse_pzunmqrrh(MORSE_enum side, MORSE_enum trans,
/* necessary to avoid dependencies between tasks regarding the diag tile */
nblk = ( A->mt + BS -1 ) / BS;
DIAG = (MORSE_desc_t*)malloc(sizeof(MORSE_desc_t));
morse_zdesc_alloc2(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb);
morse_zdesc_alloc_diag(*DIAG, A->mb, A->nb, nblk * A->mb, A->nb, 0, 0, nblk * A->mb, A->nb, A->p, A->q);
K = min(A->mt, A->nt);
if (side == MorseLeft ) {
......
......@@ -199,7 +199,7 @@ int MORSE_zgeqrf_Tile(MORSE_desc_t *A, MORSE_desc_t *T)
MORSE_zgeqrf_Tile_Async(A, T, sequence, &request);
RUNTIME_barrier(morse);
RUNTIME_desc_getoncpu(A);
status = sequence->status;
morse_sequence_destroy(morse, sequence);
return status;
......
......@@ -220,8 +220,9 @@ int MORSE_zgeqrs_Tile(MORSE_desc_t *A, MORSE_desc_t *T, MORSE_desc_t *B)
MORSE_zgeqrs_Tile_Async(A, T, B, sequence, &request);
RUNTIME_barrier(morse);
RUNTIME_desc_getoncpu(A);
RUNTIME_desc_getoncpu(B);
RUNTIME_desc_getoncpu(T);
RUNTIME_desc_getoncpu(B);
status = sequence->status;
morse_sequence_destroy(morse, sequence);
return status;
......
......@@ -31,10 +31,10 @@
/***************************************************************************//**
* Macro for matrix conversion / Lapack interface
**/
#define morse_zdesc_alloc2(descA, mb, nb, lm, ln, i, j, m, n) \
descA = morse_desc_init( \
MorseComplexDouble, (mb), (nb), ((mb)*(nb)), \
(m), (n), (i), (j), (m), (n), 1, 1); \
#define morse_zdesc_alloc_diag(descA, mb, nb, lm, ln, i, j, m, n, p, q) \
descA = morse_desc_init_diag( \
MorseComplexDouble, (mb), (nb), ((mb)*(nb)), \
(m), (n), (i), (j), (m), (n), p, q); \
morse_desc_mat_alloc( &(descA) );
#define morse_zdesc_alloc( descA, mb, nb, lm, ln, i, j, m, n, free) \
......
......@@ -127,6 +127,95 @@ MORSE_desc_t morse_desc_init(MORSE_enum dtyp, int mb, int nb, int bsiz,
return desc;
}
/*******************************************************************************
* Internal static descriptor initializer for a block diagonal matrix
**/
MORSE_desc_t morse_desc_init_diag(MORSE_enum dtyp, int mb, int nb, int bsiz,
int lm, int ln, int i, int j,
int m, int n, int p, int q)
{
MORSE_desc_t desc;
desc.get_blkaddr = morse_getaddr_ccrb;
desc.get_blkldd = morse_getblkldd_ccrb;
desc.get_rankof = morse_getrankof_2d_diag;
// Matrix properties
desc.dtyp = dtyp;
// seems useless
//desc.styp = MorseCCRB;
desc.mb = mb;
desc.nb = nb;
desc.bsiz = bsiz;
// Large matrix parameters
desc.lm = lm;
desc.ln = ln;
// Large matrix derived parameters
desc.lmt = (lm%mb==0) ? (lm/mb) : (lm/mb+1);
desc.lnt = (ln%nb==0) ? (ln/nb) : (ln/nb+1);
// Submatrix parameters
desc.i = i;
desc.j = j;
desc.m = m;
desc.n = n;
// Submatrix derived parameters
desc.mt = (m == 0) ? 0 : (i+m-1)/mb - i/mb + 1;
desc.nt = (n == 0) ? 0 : (j+n-1)/nb - j/nb + 1;
desc.id = nbdesc; nbdesc++;
desc.occurences = 0;
desc.use_mat = 1;
desc.alloc_mat = 1;
desc.register_mat = 1;
#if defined(CHAMELEON_USE_MPI)
MPI_Comm_rank( MPI_COMM_WORLD, &(desc.myrank) );
#else
desc.myrank = 0;
#endif
// Grid size
desc.p = p;
desc.q = q;
// Local dimensions in tiles
if ( desc.myrank < (p*q) ) {
desc.llmt = (desc.lmt + p - 1) / p;
desc.llnt = (desc.lnt + q - 1) / q;
// Local dimensions
if ( ((desc.lmt-1) % p) == (desc.myrank / q) ) {
desc.llm = ( desc.llmt - 1 ) * mb + ((lm%mb==0) ? mb : (lm%mb));
} else {
desc.llm = desc.llmt * mb;
}
if ( ((desc.lnt-1) % q) == (desc.myrank % q) ) {
desc.lln = ( desc.llnt - 1 ) * nb + ((ln%nb==0) ? nb : (ln%nb));
} else {
desc.lln = desc.llnt * nb;
}
desc.llm1 = (desc.llm/mb);
desc.lln1 = (desc.lln/nb);
} else {
desc.llmt = 0;
desc.llnt = 0;
desc.llm = 0;
desc.lln = 0;
desc.llm1 = 0;
desc.lln1 = 0;
}
// Matrix address
desc.mat = NULL;
desc.A21 = (size_t)(desc.llm - desc.llm%mb)*(size_t)(desc.lln - desc.lln%nb);
desc.A12 = (size_t)( desc.llm%mb)*(size_t)(desc.lln - desc.lln%nb) + desc.A21;
desc.A22 = (size_t)(desc.llm - desc.llm%mb)*(size_t)( desc.lln%nb) + desc.A12;
RUNTIME_desc_init( &desc );
return desc;
}
/*******************************************************************************
* Static descriptor initializer for users
**/
......@@ -386,6 +475,12 @@ int morse_desc_mat_free( MORSE_desc_t *desc )
* @param[in] n
* Number of columns of the submatrix.
*
* @param[in] p
* 2D-block cyclic distribution in rows.
*
* @param[in] q
* 2D-block cyclic distribution in columns.
*
******************************************************************************
*
* @return
......
......@@ -47,9 +47,12 @@ inline static int morse_getblkldd_ccrb(const MORSE_desc_t *A, int m);
* Data distributions
*/
inline static int morse_getrankof_2d(const MORSE_desc_t *desc, int m, int n);
inline static int morse_getrankof_2d_diag(const MORSE_desc_t *desc, int m, int n);
MORSE_desc_t morse_desc_init(MORSE_enum dtyp, int mb, int nb, int bsiz,
int lm, int ln, int i, int j, int m, int n, int p, int q);
MORSE_desc_t morse_desc_init_diag(MORSE_enum dtyp, int mb, int nb, int bsiz,
int lm, int ln, int i, int j, int m, int n, int p, int q);
MORSE_desc_t morse_desc_init_user(MORSE_enum dtyp, int mb, int nb, int bsiz,
int lm, int ln, int i, int j,
int m, int n, int p, int q,
......@@ -169,6 +172,15 @@ inline static int morse_getrankof_2d(const MORSE_desc_t *desc, int m, int n)
return (m % desc->p) * desc->q + (n % desc->q);
}
/*******************************************************************************
* Internal function to return MPI rank of element DIAG(m,0)
**/
inline static int morse_getrankof_2d_diag(const MORSE_desc_t *desc, int m, int n)
{
return (m % desc->p) * desc->q + (m % desc->q);
}
/*******************************************************************************
* Detect if the tile is local or not
**/
......
......@@ -891,23 +891,23 @@ void MORSE_ZUNMQR_TILE_ASYNC(MORSE_enum *side, MORSE_enum *trans, MORSE_desc_t *
//void MORSE_ALLOC_WORKSPACE_ZGEHRD(int *N, MORSE_desc_t **descT, int *info)
//{ *info = MORSE_Alloc_Workspace_zgehrd(*N, descT); }
void MORSE_ALLOC_WORKSPACE_ZGELQF(int *M, int *N, MORSE_desc_t **T, int *info)
{ *info = MORSE_Alloc_Workspace_zgelqf(*M, *N, T); }
void MORSE_ALLOC_WORKSPACE_ZGELQF(int *M, int *N, MORSE_desc_t **T, int *p, int *q, int *info)
{ *info = MORSE_Alloc_Workspace_zgelqf(*M, *N, T, *p, *q); }
void MORSE_ALLOC_WORKSPACE_ZGELQF_TILE(int *M, int *N, MORSE_desc_t **descT, int *info)
{ *info = MORSE_Alloc_Workspace_zgelqf_Tile(*M, *N, descT); }
void MORSE_ALLOC_WORKSPACE_ZGELQF_TILE(int *M, int *N, MORSE_desc_t **descT, int *p, int *q, int *info)
{ *info = MORSE_Alloc_Workspace_zgelqf_Tile(*M, *N, descT, *p, *q); }
void MORSE_ALLOC_WORKSPACE_ZGELS(int *M, int *N, MORSE_desc_t **T, int *info)
{ *info = MORSE_Alloc_Workspace_zgels(*M, *N, T); }
void MORSE_ALLOC_WORKSPACE_ZGELS(int *M, int *N, MORSE_desc_t **T, int *p, int *q, int *info)
{ *info = MORSE_Alloc_Workspace_zgels(*M, *N, T, *p, *q); }
void MORSE_ALLOC_WORKSPACE_ZGELS_TILE(int *M, int *N, MORSE_desc_t **descT, int *info)
{ *info = MORSE_Alloc_Workspace_zgels_Tile(*M, *N, descT); }
void MORSE_ALLOC_WORKSPACE_ZGELS_TILE(int *M, int *N, MORSE_desc_t **descT, int *p, int *q, int *info)
{ *info = MORSE_Alloc_Workspace_zgels_Tile(*M, *N, descT, *p, *q); }
void MORSE_ALLOC_WORKSPACE_ZGEQRF(int *M, int *N, MORSE_desc_t **T, int *info)
{ *info = MORSE_Alloc_Workspace_zgeqrf(*M, *N, T); }
void MORSE_ALLOC_WORKSPACE_ZGEQRF(int *M, int *N, MORSE_desc_t **T, int *p, int *q, int *info)
{ *info = MORSE_Alloc_Workspace_zgeqrf(*M, *N, T, *p, *q); }
void MORSE_ALLOC_WORKSPACE_ZGEQRF_TILE(int *M, int *N, MORSE_desc_t **descT, int *info)
{ *info = MORSE_Alloc_Workspace_zgeqrf_Tile(*M, *N, descT); }
void MORSE_ALLOC_WORKSPACE_ZGEQRF_TILE(int *M, int *N, MORSE_desc_t **descT, int *p, int *q, int *info)
{ *info = MORSE_Alloc_Workspace_zgeqrf_Tile(*M, *N, descT, *p, *q); }
void MORSE_ALLOC_WORKSPACE_ZGESV_INCPIV(int *N, MORSE_desc_t **descL, int **IPIV, int *info)
{ *info = MORSE_Alloc_Workspace_zgesv_incpiv(*N, descL, IPIV); }
......
This diff is collapsed.
......@@ -38,7 +38,7 @@
/*******************************************************************************
*
**/
int morse_alloc_ibnb_tile(int M, int N, MORSE_enum func, int type, MORSE_desc_t **desc)
int morse_alloc_ibnb_tile(int M, int N, MORSE_enum func, int type, MORSE_desc_t **desc, int p, int q)
{
int status;
int IB, NB, MT, NT;
......@@ -85,8 +85,7 @@ int morse_alloc_ibnb_tile(int M, int N, MORSE_enum func, int type, MORSE_desc_t
morse_error("morse_alloc_ibnb_tile", "malloc() failed");
return MORSE_ERR_OUT_OF_RESOURCES;
}
/* TODO: Fix the distribution of the workspace */
**desc = morse_desc_init(type, IB, NB, IB*NB, lm, ln, 0, 0, lm, ln, 1, 1);
**desc = morse_desc_init(type, IB, NB, IB*NB, lm, ln, 0, 0, lm, ln, p, q);
/* Allocate matrix */
if (morse_desc_mat_alloc(*desc)) {
......
......@@ -32,7 +32,7 @@ extern "C" {
/*******************************************************************************
* Internal routines
**/
int morse_alloc_ibnb_tile(int M, int N, MORSE_enum func, int type, MORSE_desc_t **desc);
int morse_alloc_ibnb_tile(int M, int N, MORSE_enum func, int type, MORSE_desc_t **desc, int p, int q);
int morse_alloc_ipiv(int M, int N, MORSE_enum func, int type, MORSE_desc_t **desc, void **IPIV);
#ifdef __cplusplus
......
This diff is collapsed.
......@@ -264,29 +264,28 @@ int MORSE_zunmqr_Tile_Async(MORSE_enum side, MORSE_enum trans, MORSE_desc_t *A,
int MORSE_Alloc_Workspace_zgesv_incpiv( int N, MORSE_desc_t **descL, int **IPIV);
int MORSE_Alloc_Workspace_zgetrf_incpiv(int M, int N, MORSE_desc_t **descL, int **IPIV);
int MORSE_Alloc_Workspace_zgebrd(int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zgeev( int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zgehrd(int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zgelqf(int M, int N, MORSE_desc_t **T);
int MORSE_Alloc_Workspace_zgels( int M, int N, MORSE_desc_t **T);
int MORSE_Alloc_Workspace_zgeqrf(int M, int N, MORSE_desc_t **T);
int MORSE_Alloc_Workspace_zgesvd(int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zheev( int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zheevd( int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zhegv( int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zhegvd( int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zhetrd(int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zgebrd(int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zgeev( int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zgehrd(int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zgelqf(int M, int N, MORSE_desc_t **T, int p, int q);
int MORSE_Alloc_Workspace_zgels( int M, int N, MORSE_desc_t **T, int p, int q);
int MORSE_Alloc_Workspace_zgeqrf(int M, int N, MORSE_desc_t **T, int p, int q);
int MORSE_Alloc_Workspace_zgesvd(int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zheev( int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zheevd( int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zhegv( int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zhegvd( int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zhetrd(int M, int N, MORSE_desc_t **descT, int p, int q);
/** ****************************************************************************
* Declarations of workspace allocation functions (tile layout, asynchronous execution) - alphabetical order
**/
int MORSE_Alloc_Workspace_zgetri_Tile_Async(MORSE_desc_t *A, MORSE_desc_t *W);
/* Warning: Those functions are deprecated */
int MORSE_Alloc_Workspace_zgelqf_Tile(int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zgels_Tile( int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zgeqrf_Tile(int M, int N, MORSE_desc_t **descT);
int MORSE_Alloc_Workspace_zgelqf_Tile(int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zgels_Tile( int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zgeqrf_Tile(int M, int N, MORSE_desc_t **descT, int p, int q);
int MORSE_Alloc_Workspace_zgesv_incpiv_Tile (int N, MORSE_desc_t **descL, int **IPIV);
int MORSE_Alloc_Workspace_zgetrf_incpiv_Tile(int N, MORSE_desc_t **descL, int **IPIV);
......
......@@ -270,7 +270,7 @@ int testing_zgels(int argc, char **argv)
MORSE_Set(MORSE_HOUSEHOLDER_SIZE, rh);
}
MORSE_Alloc_Workspace_zgels(M, N, &T);
MORSE_Alloc_Workspace_zgels(M, N, &T, 1, 1);
memset(T->mat, 0, (T->llm*T->lln)*sizeof(MORSE_Complex64_t));
eps = BLAS_dfpinfo( blas_eps );
......
......@@ -46,7 +46,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_zplrnt( M, N, A, LDA, 453 );
MORSE_zplrnt( M, NRHS, x, LDB, 5673 );
MORSE_Alloc_Workspace_zgels(M, N, &T);
MORSE_Alloc_Workspace_zgels(M, N, &T, P, Q);
memset(T->mat, 0, (T->llm*T->lln)*sizeof(MorseComplexDouble));
/* Save A and b */
......
......@@ -45,7 +45,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_zplrnt_Tile( descX, 673 );
/* Allocate Workspace */
MORSE_Alloc_Workspace_zgels_Tile(M, N, &descT);
MORSE_Alloc_Workspace_zgels_Tile(M, N, &descT, P, Q);
memset(descT->mat, 0, (descT->llm*descT->lln)*sizeof(MorseComplexDouble));
/* Save A and B for check */
......@@ -54,7 +54,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_zlacpy_Tile(MorseUpperLower, descX, descB);
}
/* Do the computations */
/* MORSE ZGELS */
START_TIMING();
MORSE_zgels_Tile( MorseNoTrans, descA, descT, descX );
STOP_TIMING();
......
......@@ -43,7 +43,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_zplrnt(M, N, A, LDA, 3456);
/* Allocate Workspace */
MORSE_Alloc_Workspace_zgels(M, N, &T);
MORSE_Alloc_Workspace_zgels(M, N, &T, P, Q);
memset(T->mat, 0, (T->llm*T->lln)*sizeof(MorseComplexDouble));
/* Save AT in lapack layout for check */
......
......@@ -44,10 +44,10 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
}
/* Allocate Workspace */
MORSE_Alloc_Workspace_zgels_Tile(M, N, &descT);
MORSE_Alloc_Workspace_zgels_Tile(M, N, &descT, P, Q);
memset(descT->mat, 0, (descT->llm*descT->lln)*sizeof(MorseComplexDouble));
/* Do the computations */
/* MORSE ZGEQRF */
START_TIMING();
MORSE_zgeqrf_Tile( descA, descT );
STOP_TIMING();
......@@ -62,19 +62,20 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
/* Compute the solution */
MORSE_zgeqrs_Tile( descA, descT, descX );
/* Check solution */
dparam[IPARAM_ANORM] = MORSE_zlange_Tile(MorseInfNorm, descAC);
dparam[IPARAM_BNORM] = MORSE_zlange_Tile(MorseInfNorm, descB);
dparam[IPARAM_XNORM] = MORSE_zlange_Tile(MorseInfNorm, descX);
MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, 1.0, descAC, descX, -1.0, descB );
dparam[IPARAM_RES] = MORSE_zlange_Tile(MorseInfNorm, descB);
PASTE_CODE_FREE_MATRIX( descX );
PASTE_CODE_FREE_MATRIX( descAC );
PASTE_CODE_FREE_MATRIX( descX )
PASTE_CODE_FREE_MATRIX( descAC )
PASTE_CODE_FREE_MATRIX( descB )
}
/* Free data */
MORSE_Dealloc_Workspace(&descT);
PASTE_CODE_FREE_MATRIX( descA );
PASTE_CODE_FREE_MATRIX( descA )
return 0;
}
......@@ -39,18 +39,18 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
PASTE_CODE_ALLOCATE_MATRIX_TILE( descX, check, MORSE_Complex64_t, MorseComplexDouble, LDB, M, NRHS );
PASTE_CODE_ALLOCATE_MATRIX_TILE( descAC, check, MORSE_Complex64_t, MorseComplexDouble, LDA, M, N );
PASTE_CODE_ALLOCATE_MATRIX_TILE( descB, check, MORSE_Complex64_t, MorseComplexDouble, LDB, M, NRHS );
MORSE_zplrnt_Tile(descA, 3456);
/* Save A for check */
if (check == 1){
MORSE_zlacpy_Tile(MorseUpperLower, descA, descAC);
}
START_TIMING();
MORSE_zgetrf_nopiv_Tile( descA );
STOP_TIMING();
/* Check the solution */
if ( check )
{
......
......@@ -23,7 +23,6 @@
#define _FADDS FADDS_POTRF( N )
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......@@ -41,14 +40,13 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_zplghe_Tile( (double)N, descA, 51 );
/* Save A for check */
//PASTE_TILE_TO_LAPACK( descA, A, check, MORSE_Complex64_t, LDA, N );
if (check == 1){
MORSE_zlacpy_Tile(MorseUpperLower, descA, descAC);
}
//RUNTIME_zlocality_allrestrict( STARPU_CUDA );
/* MORSE ZPOSV */
/* MORSE ZPOTRF */
START_TIMING();
MORSE_zpotrf_Tile(uplo, descA);
STOP_TIMING();
......@@ -56,39 +54,26 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
/* Check the solution */
if ( check )
{
/* Initialize and save B */
MORSE_zplrnt_Tile( descB, 7672 );
// PASTE_TILE_TO_LAPACK( descB, B, check, MORSE_Complex64_t, LDB, NRHS );
// MORSE_zpotrs_Tile( uplo, descA, descB );
// PASTE_TILE_TO_LAPACK( descB, X, check, MORSE_Complex64_t, LDB, NRHS );
// /* LAPACK check */
// if ( MORSE_My_Mpi_Rank() == 0 ) {
// dparam[IPARAM_RES] = z_check_solution(N, N, NRHS, A, LDA, B, X, LDB,
// &(dparam[IPARAM_ANORM]),
// &(dparam[IPARAM_BNORM]),
// &(dparam[IPARAM_XNORM]));
// }
MORSE_zlacpy_Tile(MorseUpperLower, descB, descX);
/* Compute the solution */
MORSE_zpotrs_Tile( uplo, descA, descX );
/* Check solution */
dparam[IPARAM_ANORM] = MORSE_zlange_Tile(MorseInfNorm, descAC);
dparam[IPARAM_BNORM] = MORSE_zlange_Tile(MorseInfNorm, descB);
dparam[IPARAM_XNORM] = MORSE_zlange_Tile(MorseInfNorm, descX);
// if ( MORSE_My_Mpi_Rank() == 0 )
// printf("Morse anorm, xnorm, bnorm: %e,%e,%e\n",dparam[IPARAM_ANORM],dparam[IPARAM_XNORM],dparam[IPARAM_BNORM]);
MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, 1.0, descAC, descX, -1.0, descB );
dparam[IPARAM_RES] = MORSE_zlange_Tile(MorseInfNorm, descB);
MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, 1.0, descAC, descX, -1.0, descB );
dparam[IPARAM_RES] = MORSE_zlange_Tile(MorseInfNorm, descB);
PASTE_CODE_FREE_MATRIX( descB );
// free( A );
// free( B );
// free( X );
PASTE_CODE_FREE_MATRIX( descAC );
PASTE_CODE_FREE_MATRIX( descX );
}
PASTE_CODE_FREE_MATRIX( descA );
MORSE_TASK_dataflush_all();
return 0;
}
......@@ -86,21 +86,23 @@ enum dparam_timing {
int64_t IB = iparam[IPARAM_IB]; \
int64_t MB = iparam[IPARAM_MB]; \
int64_t NB = iparam[IPARAM_NB]; \
int64_t P = iparam[IPARAM_P]; \
int64_t Q = iparam[IPARAM_Q]; \
int64_t MT = (M%MB==0) ? (M/MB) : (M/MB+1); \
int64_t NT = (N%NB==0) ? (N/NB) : (N/NB+1); \
int check = iparam[IPARAM_CHECK]; \
int loud = iparam[IPARAM_VERBOSE]; \
(void)M;(void)N;(void)K;(void)NRHS; \
(void)LDA;(void)LDB;(void)LDC; \
(void)IB;(void)MB;(void)NB;(void)MT;(void)NT; \
(void)check;(void)loud;
(void)IB;(void)MB;(void)NB;(void)P;(void)Q; \
(void)MT;(void)NT;(void)check;(void)loud;
/* Paste code to allocate a matrix in desc if cond_init is true */
#define PASTE_CODE_ALLOCATE_MATRIX_TILE(_desc_, _cond_, _type_, _type2_, _lda_, _m_, _n_) \
MORSE_desc_t *_desc_ = NULL; \
if( _cond_ ) { \
MORSE_Desc_Create(&(_desc_), NULL, _type2_, MB, NB, MB*NB, _lda_, _n_, 0, 0, _m_, _n_, \
iparam[IPARAM_P], iparam[IPARAM_Q]); \
P, Q); \
}
#define PASTE_CODE_FREE_MATRIX(_desc_) \
......@@ -196,20 +198,20 @@ enum dparam_timing {
*
*/
#define START_TIMING() \
t = -RUNTIME_get_time(); \
START_DAG(); \
START_TRACING(); \
START_DISTRIBUTED(); \
t = -RUNTIME_get_time();
START_DISTRIBUTED();
#define STOP_TIMING() \
STOP_DISTRIBUTED(); \
t += RUNTIME_get_time(); \
STOP_TRACING(); \
STOP_DAG(); \
if (iparam[IPARAM_PROFILE] == 2) { \
RUNTIME_kernelprofile_display(); \
RUNTIME_schedprofile_display(); \
} \
*t_ = t;
*t_ = t; \
STOP_DISTRIBUTED(); \
STOP_TRACING(); \
STOP_DAG();
#endif /* TIMING_H */
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