Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit b4b0b315 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Integrate the GEADD/TRADD routines from plasma

parent 998c7a2a
......@@ -65,7 +65,9 @@ set(ZSRC
pztrmm.c
pztrsm.c
pztrsmpl.c
pztradd.c
###
zgeadd.c
zgemm.c
zhemm.c
zher2k.c
......@@ -73,13 +75,13 @@ set(ZSRC
zsymm.c
zsyr2k.c
zsyrk.c
ztradd.c
ztrmm.c
ztrsm.c
ztrsmpl.c
##################
# LAPACK
##################
pzgeadd.c
pzgelqf.c
pzgelqfrh.c
pzgeqrf.c
......
/**
*
* @copyright (c) 2009-2014 The University of Tennessee and The University
* 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.
*
**/
/**
*
* @file pzgeadd.c
*
* MORSE auxiliary routines
* MORSE is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 2.5.0
* @comment This file has been automatically generated
* from Plasma 2.5.0 for MORSE 1.0.0
* @author Mathieu Faverge
* @author Emmanuel Agullo
* @author Cedric Castagnede
* @date 2010-11-15
* @precisions normal z -> s d c
*
**/
#include "control/common.h"
#define A(m,n) A, m, n
#define B(m,n) B, m, n
/***************************************************************************//**
*
**/
/***************************************************************************//**
*
**/
void morse_pzgeadd(MORSE_Complex64_t alpha, MORSE_desc_t *A, MORSE_desc_t *B,
MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_option_t options;
int X, Y;
int m, n;
int ldam, ldbm;
morse = morse_context_self();
if (sequence->status != MORSE_SUCCESS)
return;
RUNTIME_options_init(&options, morse, sequence, request);
for (m = 0; m < A->mt; m++) {
X = m == A->mt-1 ? A->m-m*A->mb : A->mb;
ldam = BLKLDD(A, m);
ldbm = BLKLDD(B, m);
for (n = 0; n < A->nt; n++) {
Y = n == A->nt-1 ? A->n-n*A->nb : A->nb;
MORSE_TASK_zgeadd(
&options,
X, Y,
alpha, A(m, n), ldam,
B(m, n), ldbm);
}
}
RUNTIME_options_finalize(&options, morse);
MORSE_TASK_dataflush_all();
}
......@@ -114,9 +114,9 @@ void morse_pzlange(MORSE_enum norm, MORSE_desc_t *A, double *result,
for(m = 0; m < A->mt; m++) {
MORSE_TASK_dgeadd(
&options,
1, tempkn, 1.0,
VECNORMS_STEP1(m, n), 1,
VECNORMS_STEP2(0, n), 1);
MorseNoTrans, 1, tempkn, A->mb,
1.0, VECNORMS_STEP1(m, n), 1,
1.0, VECNORMS_STEP2(0, n), 1);
}
/*
......@@ -215,18 +215,18 @@ void morse_pzlange(MORSE_enum norm, MORSE_desc_t *A, double *result,
for(n = A->myrank % A->q + A->q; n < A->nt; n+=A->q) {
MORSE_TASK_dgeadd(
&options,
tempkm, 1, 1.0,
VECNORMS_STEP1(m, n), tempkm,
VECNORMS_STEP1(m, A->myrank % A->q), tempkm);
MorseNoTrans, tempkm, 1, A->mb,
1.0, VECNORMS_STEP1(m, n), tempkm,
1.0, VECNORMS_STEP1(m, A->myrank % A->q), tempkm);
}
/* compute vector sums between tiles in rows between ranks */
for(n = 0; n < A->q; n++) {
MORSE_TASK_dgeadd(
&options,
tempkm, 1, 1.0,
VECNORMS_STEP1(m, n), tempkm,
VECNORMS_STEP2(m, 0), tempkm);
MorseNoTrans, tempkm, 1, A->mb,
1.0, VECNORMS_STEP1(m, n), tempkm,
1.0, VECNORMS_STEP2(m, 0), tempkm);
}
/*
......
......@@ -160,9 +160,9 @@ void morse_pzlanhe(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re
for(n = 0; n < A->nt; n++) {
MORSE_TASK_dgeadd(
&options,
tempkm, 1, 1.0,
VECNORMS_STEP1(m, n), tempkm,
VECNORMS_STEP2(m, 0), tempkm);
MorseNoTrans, tempkm, 1, A->mb,
1.0, VECNORMS_STEP1(m, n), tempkm,
1.0, VECNORMS_STEP2(m, 0), tempkm);
}
/*
* Compute max norm of each segment of the final vector in the
......
......@@ -160,9 +160,9 @@ void morse_pzlansy(MORSE_enum norm, MORSE_enum uplo, MORSE_desc_t *A, double *re
for(n = 0; n < A->nt; n++) {
MORSE_TASK_dgeadd(
&options,
tempkm, 1, 1.0,
VECNORMS_STEP1(m, n), tempkm,
VECNORMS_STEP2(m, 0), tempkm);
MorseNoTrans, tempkm, 1, A->mb,
1.0, VECNORMS_STEP1(m, n), tempkm,
1.0, VECNORMS_STEP2(m, 0), tempkm);
}
/*
* Compute max norm of each segment of the final vector in the
......
......@@ -128,9 +128,9 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag,
tempkn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
MORSE_TASK_dgeadd(
&options,
1, tempkn, 1.0,
VECNORMS_STEP1(m, n), 1,
VECNORMS_STEP2(0, n), 1);
MorseNoTrans, 1, tempkn, A->mb,
1.0, VECNORMS_STEP1(m, n), 1,
1.0, VECNORMS_STEP2(0, n), 1);
}
}
}
......@@ -178,9 +178,9 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag,
for(m = n; m < A->mt; m++) {
MORSE_TASK_dgeadd(
&options,
1, tempkn, 1.0,
VECNORMS_STEP1(m, n), 1,
VECNORMS_STEP2(0, n), 1);
MorseNoTrans, 1, tempkn, A->mb,
1.0, VECNORMS_STEP1(m, n), 1,
1.0, VECNORMS_STEP2(0, n), 1);
}
}
}
......@@ -292,9 +292,9 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag,
for(n = m; n < A->nt; n++) {
MORSE_TASK_dgeadd(
&options,
tempkm, 1, 1.0,
VECNORMS_STEP1(m, n), tempkm,
VECNORMS_STEP2(m, 0), tempkm);
MorseNoTrans, tempkm, 1, A->mb,
1.0, VECNORMS_STEP1(m, n), tempkm,
1.0, VECNORMS_STEP2(m, 0), tempkm);
}
}
......@@ -347,9 +347,9 @@ void morse_pzlantr(MORSE_enum norm, MORSE_enum uplo, MORSE_enum diag,
tempkm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
MORSE_TASK_dgeadd(
&options,
tempkm, 1, 1.0,
VECNORMS_STEP1(m, n), tempkm,
VECNORMS_STEP2(m, 0), tempkm);
MorseNoTrans, tempkm, 1, A->mb,
1.0, VECNORMS_STEP1(m, n), tempkm,
1.0, VECNORMS_STEP2(m, 0), tempkm);
}
}
}
......
/**
*
* @copyright (c) 2009-2014 The University of Tennessee and The University
* 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.
*
**/
/**
*
* @file pztradd.c
*
* MORSE auxiliary routines
* MORSE is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 2.7.1
* @comment This file has been automatically generated
* from Plasma 2.5.0 for MORSE 1.0.0
* @author Emmanuel Agullo
* @author Mathieu Faverge
* @date 2011-11-03
* @precisions normal z -> s d c
*
**/
#include "control/common.h"
#define A(m, n) A, m, n
#define B(m, n) B, m, n
/***************************************************************************//**
* Parallel tile matrix-matrix multiplication - dynamic scheduling
**/
void morse_pztradd(MORSE_enum uplo, MORSE_enum trans,
MORSE_Complex64_t alpha, MORSE_desc_t *A,
MORSE_Complex64_t beta, MORSE_desc_t *B,
MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_option_t options;
int tempmm, tempnn, tempmn, tempnm;
int m, n;
int ldam, ldan, ldbm, ldbn;
morse = morse_context_self();
if (sequence->status != MORSE_SUCCESS)
return;
RUNTIME_options_init(&options, morse, sequence, request);
switch(uplo){
case MorseLower:
if (trans == MorseNoTrans) {
for (n = 0; n < min(B->mt,B->nt); n++) {
tempnm = n == B->mt-1 ? B->m-n*B->mb : B->mb;
tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb;
ldan = BLKLDD(A, n);
ldbn = BLKLDD(B, n);
MORSE_TASK_ztradd(
&options,
uplo, trans, tempnm, tempnn, B->mb,
alpha, A(n, n), ldan,
beta, B(n, n), ldbn);
for (m = n+1; m < B->mt; m++) {
tempmm = m == B->mt-1 ? B->m-B->mb*m : B->nb;
ldam = BLKLDD(A, m);
ldbm = BLKLDD(B, m);
MORSE_TASK_zgeadd(
&options,
trans, tempmm, tempnn, B->mb,
alpha, A(m, n), ldam,
beta, B(m, n), ldbm);
}
}
}
else {
for (n = 0; n < min(B->mt,B->nt); n++) {
tempnm = n == B->mt-1 ? B->m-n*B->mb : B->mb;
tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb;
ldan = BLKLDD(A, n);
ldbn = BLKLDD(B, n);
MORSE_TASK_ztradd(
&options,
uplo, trans, tempnm, tempnn, B->mb,
alpha, A(n, n), ldan,
beta, B(n, n), ldbn);
for (m = n+1; m < B->mt; m++) {
tempmm = m == B->mt-1 ? B->m-B->mb*m : B->nb;
ldbm = BLKLDD(B, m);
MORSE_TASK_zgeadd(
&options,
trans, tempmm, tempnn, B->mb,
alpha, A(n, m), ldan,
beta, B(m, n), ldbm);
}
}
}
break;
case MorseUpper:
if (trans == MorseNoTrans) {
for (m = 0; m < min(B->mt,B->nt); m++) {
tempmm = m == B->mt-1 ? B->m-B->mb*m : B->nb;
tempmn = m == B->nt-1 ? B->n-m*B->nb : B->nb;
ldam = BLKLDD(A, m);
ldbm = BLKLDD(B, m);
MORSE_TASK_ztradd(
&options,
uplo, trans, tempmm, tempmn, B->mb,
alpha, A(m, m), ldam,
beta, B(m, m), ldbm);
for (n = m+1; n < B->nt; n++) {
tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb;
MORSE_TASK_zgeadd(
&options,
trans, tempmm, tempnn, B->mb,
alpha, A(m, n), ldam,
beta, B(m, n), ldbm);
}
}
}
else {
for (m = 0; m < min(B->mt,B->nt); m++) {
tempmm = m == B->mt-1 ? B->m-B->mb*m : B->nb;
tempmn = m == B->nt-1 ? B->n-m*B->nb : B->nb;
ldam = BLKLDD(A, m);
ldbm = BLKLDD(B, m);
MORSE_TASK_ztradd(
&options,
uplo, trans, tempmm, tempmn, B->mb,
alpha, A(m, m), ldam,
beta, B(m, m), ldbm);
for (n = m+1; n < B->nt; n++) {
tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb;
ldan = BLKLDD(A, n);
MORSE_TASK_zgeadd(
&options,
trans, tempmm, tempnn, B->mb,
alpha, A(n, m), ldan,
beta, B(m, n), ldbm);
}
}
}
break;
case MorseUpperLower:
default:
if (trans == MorseNoTrans) {
for (m = 0; m < B->mt; m++) {
tempmm = m == B->mt-1 ? B->m-B->mb*m : B->nb;
ldam = BLKLDD(A, m);
ldbm = BLKLDD(B, m);
for (n = 0; n < B->nt; n++) {
tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb;
MORSE_TASK_zgeadd(
&options,
trans, tempmm, tempnn, B->mb,
alpha, A(m, n), ldam,
beta, B(m, n), ldbm);
}
}
}
else {
for (m = 0; m < B->mt; m++) {
tempmm = m == B->mt-1 ? B->m-B->mb*m : B->nb;
ldam = BLKLDD(A, m);
ldbm = BLKLDD(B, m);
for (n = 0; n < B->nt; n++) {
tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb;
ldan = BLKLDD(A, n);
MORSE_TASK_zgeadd(
&options,
trans, tempmm, tempnn, B->mb,
alpha, A(n, m), ldan,
beta, B(m, n), ldbm);
}
}
}
}
}
/**
*
* @copyright (c) 2009-2014 The University of Tennessee and The University
* 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.
*
**/
/**
*
* @file zgeadd.c
*
* MORSE computational routines
* MORSE is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 2.5.0
* @comment This file has been automatically generated
* from Plasma 2.5.0 for MORSE 1.0.0
* @author Mathieu Faverge
* @date 2011-11-03
* @precisions normal z -> s d c
*
**/
#include "control/common.h"
/***************************************************************************//**
*
* @ingroup MORSE_Complex64_t
*
* MORSE_zgeadd - Performs a matrix addition similarly to the pzgeadd()
* function from the PBLAS library:
*
* \f[ C = \alpha op( A ) + \beta B \f],
*
* where op( X ) is one of
*
* op( X ) = X or op( X ) = X' or op( X ) = conjg( X' )
*
* alpha and beta are scalars, and A, and B are matrices, with op( A ) and B
* two m by n matrices.
*
*******************************************************************************
*
* @param[in] trans
* Specifies whether the matrix A is transposed, not transposed or
* conjugate transposed:
* = MorseNoTrans: A is not transposed;
* = MorseTrans: A is transposed;
* = MorseConjTrans: A is conjugate transposed.
*
* @param[in] M
* M specifies the number of rows of the matrix op( A ) and of the matrix B. M >= 0.
*
* @param[in] N
* N specifies the number of columns of the matrix op( A ) and of the matrix B. N >= 0.
*
* @param[in] alpha
* alpha specifies the scalar alpha
*
* @param[in] A
* A is a LDA-by-ka matrix, where ka is N when trans = MorseNoTrans,
* and is M otherwise.
*
* @param[in] LDA
* The leading dimension of the array A. LDA >= max(1,K), where K is M
* when trans = MorseNoTrans, and is N when otherwise.
*
* @param[in] beta
* beta specifies the scalar beta
*
* @param[in,out] B
* B is a LDB-by-N matrix.
*
* @param[in] LDB
* The leading dimension of the array B. LDB >= max(1,M).
*
*******************************************************************************
*
* @return
* \retval MORSE_SUCCESS successful exit
*
*******************************************************************************
*
* @sa MORSE_zgeadd_Tile
* @sa MORSE_cgeadd
* @sa MORSE_dgeadd
* @sa MORSE_sgeadd
*
******************************************************************************/
int MORSE_zgeadd(MORSE_enum trans, int M, int N,
MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA,
MORSE_Complex64_t beta, MORSE_Complex64_t *B, int LDB)
{
int NB;
int Am, An;
int status;
MORSE_desc_t descA, descB;
MORSE_context_t *morse;
MORSE_sequence_t *sequence = NULL;
MORSE_request_t request = MORSE_REQUEST_INITIALIZER;
morse = morse_context_self();
if (morse == NULL) {
morse_fatal_error("MORSE_zgeadd", "MORSE not initialized");
return MORSE_ERR_NOT_INITIALIZED;
}
/* Check input arguments */
if ((trans != MorseNoTrans) && (trans != MorseTrans) && (trans != MorseConjTrans)) {
morse_error("MORSE_zgeadd", "illegal value of trans");
return -1;
}
if ( trans == MorseNoTrans ) {
Am = M; An = N;
} else {
Am = N; An = M;
}
if (M < 0) {
morse_error("MORSE_zgeadd", "illegal value of M");
return -2;
}
if (N < 0) {
morse_error("MORSE_zgeadd", "illegal value of N");
return -3;
}
if (LDA < max(1, Am)) {
morse_error("MORSE_zgeadd", "illegal value of LDA");
return -6;
}
if (LDB < max(1, M)) {
morse_error("MORSE_zgeadd", "illegal value of LDB");
return -9;
}
/* Quick return */
if (M == 0 || N == 0 ||
((alpha == (MORSE_Complex64_t)0.0) && beta == (MORSE_Complex64_t)1.0))
return MORSE_SUCCESS;
/* Tune NB depending on M, N & NRHS; Set NBNBSIZE */
status = morse_tune(MORSE_FUNC_ZGEMM, M, N, 0);
if (status != MORSE_SUCCESS) {
morse_error("MORSE_zgeadd", "morse_tune() failed");
return status;
}
/* Set MT & NT & KT */
NB = MORSE_NB;
morse_sequence_create(morse, &sequence);
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */
morse_zooplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, sequence, &request,
morse_desc_mat_free(&(descA)) );
morse_zooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, sequence, &request,
morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)));
/* } else { */
/* morse_ziplap2tile( descA, A, NB, NB, LDA, An, 0, 0, Am, An, */
/* sequence, &request); */
/* morse_ziplap2tile( descB, B, NB, NB, LDB, N, 0, 0, M, N, */
/* sequence, &request); */
/* } */
/* Call the tile interface */
MORSE_zgeadd_Tile_Async(
trans, alpha, &descA, beta, &descB, sequence, &request);
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) { */
morse_zooptile2lap( descB, B, NB, NB, LDB, N, sequence, &request);
morse_sequence_wait(morse, sequence);
morse_desc_mat_free(&descA);
morse_desc_mat_free(&descB);
/* } else { */
/* morse_ziptile2lap( descA, A, NB, NB, LDA, An, sequence, &request); */
/* morse_ziptile2lap( descB, B, NB, NB, LDB, N, sequence, &request); */
/* morse_dynamic_sync(); */
/* } */
status = sequence->status;
morse_sequence_destroy(morse, sequence);
return status;
}
/***************************************************************************//**
*
* @ingroup MORSE_Complex64_t_Tile
*
* MORSE_zgeadd_Tile - Performs a matrix addition similarly to the pzgeadd()
* function from the PBLAS library.
* Tile equivalent of MORSE_zgeadd().
* Operates on matrices stored by tiles.
* All matrices are passed through descriptors.
* All dimensions are taken from the descriptors.
*
*******************************************************************************