PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
testing_chemm.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <plasma.h>
#include <cblas.h>
#include <lapacke.h>
#include <core_blas.h>
#include "testing_cmain.h"
Include dependency graph for testing_chemm.c:

Go to the source code of this file.

Functions

int testing_chemm (int argc, char **argv)

Detailed Description

PLASMA testing routines PLASMA is a software package provided by Univ. of Tennessee, Univ. of California Berkeley and Univ. of Colorado Denver

Version:
2.4.5
Author:
Mathieu Faverge
Date:
2010-11-15 c Tue Nov 22 14:35:50 2011

Definition in file testing_chemm.c.


Function Documentation

int testing_chemm ( int  argc,
char **  argv 
)

Definition at line 31 of file testing_chemm.c.

References A, B, C, check_solution(), IONE, ISEED, max, PLASMA_chemm(), PLASMA_cplghe(), side, sidestr, uplo, uplostr, and USAGE.

{
/* Check for number of arguments*/
if ( argc != 7 ){
USAGE("HEMM", "alpha beta M N K LDA LDB LDC",
" - alpha : alpha coefficient \n"
" - beta : beta coefficient \n"
" - M : number of rows of matrices A and C \n"
" - N : number of columns of matrices B and C \n"
" - LDA : leading dimension of matrix A \n"
" - LDB : leading dimension of matrix B \n"
" - LDC : leading dimension of matrix C\n");
return -1;
}
PLASMA_Complex32_t alpha = (PLASMA_Complex32_t) atol(argv[0]);
PLASMA_Complex32_t beta = (PLASMA_Complex32_t) atol(argv[1]);
int M = atoi(argv[2]);
int N = atoi(argv[3]);
int LDA = atoi(argv[4]);
int LDB = atoi(argv[5]);
int LDC = atoi(argv[6]);
int MNmax = max(M, N);
float eps;
int info_solution;
int i, j, s, u;
int LDAxM = LDA*MNmax;
int LDBxN = LDB*N;
int LDCxN = LDC*N;
PLASMA_Complex32_t *Cinit = (PLASMA_Complex32_t *)malloc(LDCxN*sizeof(PLASMA_Complex32_t));
PLASMA_Complex32_t *Cfinal = (PLASMA_Complex32_t *)malloc(LDCxN*sizeof(PLASMA_Complex32_t));
/* Check if unable to allocate memory */
if ((!A)||(!B)||(!Cinit)||(!Cfinal)){
printf("Out of Memory \n ");
return -2;
}
eps = LAPACKE_slamch_work('e');
printf("\n");
printf("------ TESTS FOR PLASMA CHEMM ROUTINE ------- \n");
printf(" Size of the Matrix %d by %d\n", M, N);
printf("\n");
printf(" The matrix A is randomly generated for each test.\n");
printf("============\n");
printf(" The relative machine precision (eps) is to be %e \n",eps);
printf(" Computational tests pass if scaled residuals are less than 10.\n");
/*----------------------------------------------------------
* TESTING CHEMM
*/
/* Initialize A */
PLASMA_cplghe( (float)0., MNmax, A, LDA, 51 );
/* Initialize B */
LAPACKE_clarnv_work(IONE, ISEED, LDBxN, B);
/* Initialize C */
LAPACKE_clarnv_work(IONE, ISEED, LDCxN, C);
for (s=0; s<2; s++) {
for (u=0; u<2; u++) {
/* Initialize Cinit / Cfinal */
for ( i = 0; i < M; i++)
for ( j = 0; j < N; j++)
Cinit[LDC*j+i] = C[LDC*j+i];
for ( i = 0; i < M; i++)
for ( j = 0; j < N; j++)
Cfinal[LDC*j+i] = C[LDC*j+i];
/* PLASMA CHEMM */
PLASMA_chemm(side[s], uplo[u], M, N, alpha, A, LDA, B, LDB, beta, Cfinal, LDC);
/* Check the solution */
info_solution = check_solution(side[s], uplo[u], M, N, alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC);
if (info_solution == 0) {
printf("***************************************************\n");
printf(" ---- TESTING CHEMM (%5s, %5s) ....... PASSED !\n", sidestr[s], uplostr[u]);
printf("***************************************************\n");
}
else {
printf("************************************************\n");
printf(" - TESTING CHEMM (%s, %s) ... FAILED !\n", sidestr[s], uplostr[u]);
printf("************************************************\n");
}
}
}
free(A); free(B); free(C);
free(Cinit); free(Cfinal);
return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: