Mentions légales du service

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

Merge branch 'lapack_api_auxiliary' into 'master'

Blas/Lapack API: add lapack auxiliary routines lacpy and laset

See merge request solverstack/chameleon!328
parents e56ad08a fe6e7c45
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,8 @@ set(ZSRC ...@@ -60,6 +60,8 @@ set(ZSRC
src/lapack_zhemm.c src/lapack_zhemm.c
src/lapack_zher2k.c src/lapack_zher2k.c
src/lapack_zherk.c src/lapack_zherk.c
src/lapack_zlacpy.c
src/lapack_zlaset.c
src/lapack_zlauum.c src/lapack_zlauum.c
src/lapack_zsymm.c src/lapack_zsymm.c
src/lapack_zsyr2k.c src/lapack_zsyr2k.c
......
...@@ -79,6 +79,15 @@ void CHAMELEON_cblas_ztrsm( const CBLAS_ORDER order, const CBLAS_SIDE side, cons ...@@ -79,6 +79,15 @@ void CHAMELEON_cblas_ztrsm( const CBLAS_ORDER order, const CBLAS_SIDE side, cons
const void *alpha, const CHAMELEON_Complex64_t *A, const int lda, const void *alpha, const CHAMELEON_Complex64_t *A, const int lda,
const CHAMELEON_Complex64_t *B, const int ldb ); const CHAMELEON_Complex64_t *B, const int ldb );
int CHAMELEON_lapacke_zlacpy( int matrix_layout, char uplo, int M, int N,
const CHAMELEON_Complex64_t *A, int lda,
CHAMELEON_Complex64_t *B, int ldb );
int CHAMELEON_lapacke_zlaset( int matrix_layout, char uplo, int M, int N,
const CHAMELEON_Complex64_t alpha, const CHAMELEON_Complex64_t beta,
CHAMELEON_Complex64_t *A, int lda );
int CHAMELEON_lapacke_zlauum( int matrix_layout, char uplo, int N, int CHAMELEON_lapacke_zlauum( int matrix_layout, char uplo, int N,
CHAMELEON_Complex64_t *A, int lda ); CHAMELEON_Complex64_t *A, int lda );
......
/**
*
* @file lapack_zlacpy.c
*
* @copyright 2022 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon lapack and lapacke api for lacpy
*
* @version 1.2.0
* @author Mathieu Faverge
* @author Florent Pruvost
* @date 2022-08-19
* @precisions normal z -> s d c
*
*/
#include "chameleon_lapack.h"
#include "lapack_api_common.h"
/* Fortran LAPACK interface */
#define CHAMELEON_lapack_zlacpy CHAMELEON_GLOBAL( chameleon_lapack_zlacpy, CHAMELEON_BLAS_Zlacpy )
void CHAMELEON_lapack_zlacpy ( const char* uplo, const int* m, const int* n,
const CHAMELEON_Complex64_t* a, const int* lda,
CHAMELEON_Complex64_t* b, const int* ldb )
{
CHAMELEON_lapacke_zlacpy( CblasColMajor,
*uplo, *m, *n,
a, *lda,
b, *ldb );
}
/* C LAPACKE interface */
/**
********************************************************************************
*
* @ingroup CHAMELEON_LAPACK_API
*
* CHAMELEON_lapacke_zlacpy - copies all or part of a two-dimensional matrix A to another
* matrix B
*
*******************************************************************************
*
* @param[in] matrix_layout
* Specifies whether the matrices are row or column major, it must be
* set to LAPACK_COL_MAJOR or CblasColMajor (102), the matrix_layout
* supported in Chameleon.
*
* @param[in] uplo
* Specifies the part of the matrix A to be copied to B.
* = 'U' or 'u': Upper triangular
* = 'L' or 'l': Lower triangular
* Otherwise, all of the matrix A is copied.
*
* @param[in] M
* The number of rows of the matrix A. M >= 0.
*
* @param[in] N
* The number of columns of the matrix A. N >= 0.
*
* @param[in] A
* The M-by-N matrix A. If uplo = 'U', only the upper triangle or
* trapezoid is accessed; if uplo = 'L', only the lower triangle or
* trapezoid is accessed.
*
* @param[in] LDA
* The leading dimension of the array A. LDA >= max(1,M).
*
* @param[out] B
* The M-by-N matrix B.
* On exit, B = A in the locations specified by uplo.
*
* @param[in] LDB
* The leading dimension of the array B. LDB >= max(1,M).
*
*******************************************************************************
*
* @retval =0 successful exit
* @retval <0 if -i, the i-th argument had an illegal value
*
*******************************************************************************
*
* @sa CHAMELEON_lapacke_zlacpy
* @sa CHAMELEON_lapacke_clacpy
* @sa CHAMELEON_lapacke_dlacpy
* @sa CHAMELEON_lapacke_slacpy
*
*/
int CHAMELEON_lapacke_zlacpy( int matrix_layout, char uplo, int M, int N,
const CHAMELEON_Complex64_t *A, int lda,
CHAMELEON_Complex64_t *B, int ldb )
{
if ( matrix_layout != CblasColMajor ){
fprintf( stderr, "CHAMELEON ERROR: %s(): %s\n", "CHAMELEON_lapacke_zlacpy", "illegal value of matrix_layout" );
return -1;
}
return CHAMELEON_zlacpy( (cham_uplo_t)chameleon_blastocblas_uplo(&uplo),
M, N, (CHAMELEON_Complex64_t *)A, lda, B, ldb );
}
/**
*
* @file lapack_zlaset.c
*
* @copyright 2022 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon lapack and lapacke api for laset
*
* @version 1.2.0
* @author Mathieu Faverge
* @author Florent Pruvost
* @date 2022-08-19
* @precisions normal z -> s d c
*
*/
#include "chameleon_lapack.h"
#include "lapack_api_common.h"
/* Fortran LAPACK interface */
#define CHAMELEON_lapack_zlaset CHAMELEON_GLOBAL( chameleon_lapack_zlaset, CHAMELEON_BLAS_Zlaset )
void CHAMELEON_lapack_zlaset ( const char* uplo, const int* m, const int* n,
const CHAMELEON_Complex64_t* alpha, const CHAMELEON_Complex64_t* beta,
CHAMELEON_Complex64_t* a, const int* lda )
{
CHAMELEON_lapacke_zlaset( CblasColMajor,
*uplo, *m, *n,
*alpha, *beta,
a, *lda );
}
/* C LAPACKE interface */
/**
********************************************************************************
*
* @ingroup CHAMELEON_LAPACK_API
*
* CHAMELEON_lapacke_zlaset - The routine initializes an m-by-n matrix A to
* beta on the diagonal and alpha on the off-diagonals.
*
*******************************************************************************
*
* @param[in] matrix_layout
* Specifies whether the matrices are row or column major, it must be
* set to LAPACK_COL_MAJOR or CblasColMajor (102), the matrix_layout
* supported in Chameleon.
*
* @param[in] uplo
* Specifies the part of the matrix A .
* = 'U' or 'u': Upper triangular
* = 'L' or 'l': Lower triangular
* Otherwise, all of the matrix A is set.
*
* @param[in] M
* The number of rows of the matrix A. M >= 0.
*
* @param[in] N
* The number of columns of the matrix A. N >= 0.
*
* @param[in] alpha
* All the off diagonal array elements are set to alpha.
*
* @param[in] beta
* All the diagonal array elements are set to beta.
*
* @param[in,out] A
* On entry, the m by n matrix A.
* On exit, A(i,j) = ALPHA, 1 <= i <= m, 1 <= j <= n, i.ne.j;
* A(i,i) = BETA, 1 <= i <= min(m,n)
*
* @param[in] LDA
* The leading dimension of the array A. LDA >= max(1,M).
*
*******************************************************************************
*
* @retval =0 successful exit
* @retval <0 if -i, the i-th argument had an illegal value
*
*******************************************************************************
*
* @sa CHAMELEON_lapacke_zlaset
* @sa CHAMELEON_lapacke_claset
* @sa CHAMELEON_lapacke_dlaset
* @sa CHAMELEON_lapacke_slaset
*
*/
int CHAMELEON_lapacke_zlaset( int matrix_layout, char uplo, int M, int N,
const CHAMELEON_Complex64_t alpha, const CHAMELEON_Complex64_t beta,
CHAMELEON_Complex64_t *A, int lda )
{
if ( matrix_layout != CblasColMajor ){
fprintf( stderr, "CHAMELEON ERROR: %s(): %s\n", "CHAMELEON_lapacke_zlaset", "illegal value of matrix_layout" );
return -1;
}
return CHAMELEON_zlaset( (cham_uplo_t)chameleon_blastocblas_uplo(&uplo),
M, N, alpha, beta, A, lda );
}
...@@ -31,7 +31,7 @@ void CHAMELEON_lapack_zlauum ( const char* uplo, const int* n, ...@@ -31,7 +31,7 @@ void CHAMELEON_lapack_zlauum ( const char* uplo, const int* n,
*uplo, *n, a, *lda ); *uplo, *n, a, *lda );
} }
/* C CBLAS interface */ /* C LAPACKE interface */
/** /**
******************************************************************************** ********************************************************************************
...@@ -89,7 +89,7 @@ int CHAMELEON_lapacke_zlauum( int matrix_layout, char uplo, int N, ...@@ -89,7 +89,7 @@ int CHAMELEON_lapacke_zlauum( int matrix_layout, char uplo, int N,
{ {
if ( matrix_layout != CblasColMajor ){ if ( matrix_layout != CblasColMajor ){
fprintf( stderr, "CHAMELEON ERROR: %s(): %s\n", "CHAMELEON_lapacke_zlauum", "illegal value of matrix_layout" ); fprintf( stderr, "CHAMELEON ERROR: %s(): %s\n", "CHAMELEON_lapacke_zlauum", "illegal value of matrix_layout" );
return; return -1;
} }
return CHAMELEON_zlauum( (cham_uplo_t)chameleon_blastocblas_uplo(&uplo), N, return CHAMELEON_zlauum( (cham_uplo_t)chameleon_blastocblas_uplo(&uplo), N,
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include "testings.h" #include "testings.h"
#include "testing_zcheck.h" #include "testing_zcheck.h"
#include <chameleon/flops.h> #include <chameleon/flops.h>
#if !defined(CHAMELEON_SIMULATION)
#include <coreblas.h>
#endif
static cham_fixdbl_t static cham_fixdbl_t
flops_zlacpy( cham_uplo_t uplo, int M, int N ) flops_zlacpy( cham_uplo_t uplo, int M, int N )
...@@ -120,6 +123,7 @@ testing_zlacpy_std( run_arg_list_t *args, int check ) ...@@ -120,6 +123,7 @@ testing_zlacpy_std( run_arg_list_t *args, int check )
int hres = 0; int hres = 0;
/* Read arguments */ /* Read arguments */
int api = parameters_getvalue_int( "api" );
int nb = run_arg_get_int( args, "nb", 320 ); int nb = run_arg_get_int( args, "nb", 320 );
cham_uplo_t uplo = run_arg_get_uplo( args, "uplo", ChamUpper ); cham_uplo_t uplo = run_arg_get_uplo( args, "uplo", ChamUpper );
int N = run_arg_get_int( args, "N", 1000 ); int N = run_arg_get_int( args, "N", 1000 );
...@@ -144,7 +148,22 @@ testing_zlacpy_std( run_arg_list_t *args, int check ) ...@@ -144,7 +148,22 @@ testing_zlacpy_std( run_arg_list_t *args, int check )
/* Makes a copy of descA to descB */ /* Makes a copy of descA to descB */
testing_start( &test_data ); testing_start( &test_data );
hres = CHAMELEON_zlacpy( uplo, M, N, A, LDA, B, LDB ); switch ( api ) {
case 1:
hres = CHAMELEON_zlacpy( uplo, M, N, A, LDA, B, LDB );
break;
#if !defined(CHAMELEON_SIMULATION)
case 2:
CHAMELEON_lapacke_zlacpy( CblasColMajor, chameleon_lapack_const(uplo), M, N, A, LDA, B, LDB );
break;
#endif
default:
if ( CHAMELEON_Comm_rank() == 0 ) {
fprintf( stderr,
"SKIPPED: This function can only be used with the option --api 1 or --api 2.\n" );
}
return -1;
}
test_data.hres = hres; test_data.hres = hres;
testing_stop( &test_data, flops_zlacpy( uplo, M, N ) ); testing_stop( &test_data, flops_zlacpy( uplo, M, N ) );
......
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