QUDA  v1.1.0
A library for QCD on GPUs
Classes | Macros | Typedefs | Enumerations | Functions | Variables
blas_test.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <quda_internal.h>
#include <color_spinor_field.h>
#include <blas_quda.h>
#include <host_utils.h>
#include <command_line_params.h>
#include <dslash_reference.h>
#include <gtest/gtest.h>

Go to the source code of this file.

Classes

class  BlasTest
 

Macros

#define ERROR(a)   fabs(blas::norm2(*a##D) - blas::norm2(*a##H)) / blas::norm2(*a##H)
 

Typedefs

using prec_pair_t = std::pair< QudaPrecision, QudaPrecision >
 

Enumerations

enum class  Kernel {
  copyHS , copyLS , axpbyz , ax ,
  caxpy , caxpby , cxpaypbz , axpyBzpcx ,
  axpyZpbx , caxpbypzYmbw , cabxpyAx , caxpyXmaz ,
  norm2 , reDotProduct , axpbyzNorm , axpyCGNorm ,
  caxpyNorm , caxpyXmazNormX , cabxpyzAxNorm , cDotProduct ,
  caxpyDotzy , cDotProductNormA , caxpbypzYmbwcDotProductUYNormY , HeavyQuarkResidualNorm ,
  xpyHeavyQuarkResidualNorm , tripleCGReduction , tripleCGUpdate , axpyReDot ,
  caxpyBxpz , caxpyBzpx , axpy_block , caxpy_block ,
  axpyBzpcx_block , reDotProductNorm_block , reDotProduct_block , cDotProductNorm_block ,
  cDotProduct_block , caxpyXmazMR
}
 

Functions

void setPrec (ColorSpinorParam &param, QudaPrecision precision)
 
void display_test_info ()
 
bool is_multi (Kernel kernel)
 
bool is_copy (Kernel kernel)
 
bool is_site_unroll (Kernel kernel)
 
bool skip_kernel (prec_pair_t pair, Kernel kernel)
 
void initFields (prec_pair_t prec_pair)
 
void freeFields ()
 
double benchmark (Kernel kernel, const int niter)
 
double test (Kernel kernel)
 
int main (int argc, char **argv)
 
prec_pair_t prec_idx_map (int idx)
 
 TEST_P (BlasTest, verify)
 
 TEST_P (BlasTest, benchmark)
 
std::string getblasname (testing::TestParamInfo<::testing::tuple< int, int >> param)
 
 INSTANTIATE_TEST_SUITE_P (QUDA, BlasTest, Combine(Range(0,(Nprec *(Nprec+1))/2), Range(0, Nkernels)), getblasname)
 

Variables

ColorSpinorFieldxH
 
ColorSpinorFieldyH
 
ColorSpinorFieldzH
 
ColorSpinorFieldwH
 
ColorSpinorFieldvH
 
ColorSpinorFieldxoH
 
ColorSpinorFieldyoH
 
ColorSpinorFieldzoH
 
ColorSpinorFieldxD
 
ColorSpinorFieldyD
 
ColorSpinorFieldzD
 
ColorSpinorFieldwD
 
ColorSpinorFieldvD
 
ColorSpinorFieldxmD
 
ColorSpinorFieldymD
 
ColorSpinorFieldzmD
 
ColorSpinorFieldxoD
 
ColorSpinorFieldyoD
 
ColorSpinorFieldzoD
 
ColorSpinorFieldwoD
 
ColorSpinorFieldvoD
 
ColorSpinorFieldxmoD
 
ColorSpinorFieldymoD
 
ColorSpinorFieldzmoD
 
std::vector< cpuColorSpinorField * > xmH
 
std::vector< cpuColorSpinorField * > ymH
 
std::vector< cpuColorSpinorField * > zmH
 
int Nspin
 
int Ncolor
 
const std::map< QudaPrecision, std::string > prec_map
 
const int Nprec = prec_map.size()
 
const std::map< Kernel, std::string > kernel_map
 
const int Nkernels = kernel_map.size()
 

Macro Definition Documentation

◆ ERROR

#define ERROR (   a)    fabs(blas::norm2(*a##D) - blas::norm2(*a##H)) / blas::norm2(*a##H)

Definition at line 541 of file blas_test.cpp.

Typedef Documentation

◆ prec_pair_t

Definition at line 65 of file blas_test.cpp.

Enumeration Type Documentation

◆ Kernel

enum Kernel
strong
Enumerator
copyHS 
copyLS 
axpbyz 
ax 
caxpy 
caxpby 
cxpaypbz 
axpyBzpcx 
axpyZpbx 
caxpbypzYmbw 
cabxpyAx 
caxpyXmaz 
norm2 
reDotProduct 
axpbyzNorm 
axpyCGNorm 
caxpyNorm 
caxpyXmazNormX 
cabxpyzAxNorm 
cDotProduct 
caxpyDotzy 
cDotProductNormA 
caxpbypzYmbwcDotProductUYNormY 
HeavyQuarkResidualNorm 
xpyHeavyQuarkResidualNorm 
tripleCGReduction 
tripleCGUpdate 
axpyReDot 
caxpyBxpz 
caxpyBzpx 
axpy_block 
caxpy_block 
axpyBzpcx_block 
reDotProductNorm_block 
reDotProduct_block 
cDotProductNorm_block 
cDotProduct_block 
caxpyXmazMR 

Definition at line 74 of file blas_test.cpp.

Function Documentation

◆ benchmark()

double benchmark ( Kernel  kernel,
const int  niter 
)

Definition at line 349 of file blas_test.cpp.

◆ display_test_info()

void display_test_info ( )

Definition at line 55 of file blas_test.cpp.

◆ freeFields()

void freeFields ( )

Definition at line 315 of file blas_test.cpp.

◆ getblasname()

std::string getblasname ( testing::TestParamInfo<::testing::tuple< int, int >>  param)

Definition at line 1144 of file blas_test.cpp.

◆ initFields()

void initFields ( prec_pair_t  prec_pair)

Definition at line 201 of file blas_test.cpp.

◆ INSTANTIATE_TEST_SUITE_P()

INSTANTIATE_TEST_SUITE_P ( QUDA  ,
BlasTest  ,
Combine(Range(0,(Nprec *(Nprec+1))/2), Range(0, Nkernels))  ,
getblasname   
)

◆ is_copy()

bool is_copy ( Kernel  kernel)

Definition at line 165 of file blas_test.cpp.

◆ is_multi()

bool is_multi ( Kernel  kernel)

Definition at line 160 of file blas_test.cpp.

◆ is_site_unroll()

bool is_site_unroll ( Kernel  kernel)

Definition at line 168 of file blas_test.cpp.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1001 of file blas_test.cpp.

◆ prec_idx_map()

prec_pair_t prec_idx_map ( int  idx)

Definition at line 1060 of file blas_test.cpp.

◆ setPrec()

void setPrec ( ColorSpinorParam param,
QudaPrecision  precision 
)

Definition at line 53 of file blas_test.cpp.

◆ skip_kernel()

bool skip_kernel ( prec_pair_t  pair,
Kernel  kernel 
)

Definition at line 173 of file blas_test.cpp.

◆ test()

double test ( Kernel  kernel)

Definition at line 543 of file blas_test.cpp.

◆ TEST_P() [1/2]

TEST_P ( BlasTest  ,
benchmark   
)

Definition at line 1121 of file blas_test.cpp.

◆ TEST_P() [2/2]

TEST_P ( BlasTest  ,
verify   
)

Definition at line 1097 of file blas_test.cpp.

Variable Documentation

◆ kernel_map

const std::map<Kernel, std::string> kernel_map

Definition at line 117 of file blas_test.cpp.

◆ Ncolor

int Ncolor

Definition at line 51 of file blas_test.cpp.

◆ Nkernels

const int Nkernels = kernel_map.size()

Definition at line 157 of file blas_test.cpp.

◆ Nprec

const int Nprec = prec_map.size()

Definition at line 72 of file blas_test.cpp.

◆ Nspin

int Nspin

Definition at line 50 of file blas_test.cpp.

◆ prec_map

const std::map<QudaPrecision, std::string> prec_map
Initial value:
= {{QUDA_QUARTER_PRECISION, "quarter"},
{QUDA_SINGLE_PRECISION, "single"},
{QUDA_DOUBLE_PRECISION, "double"}}
@ QUDA_DOUBLE_PRECISION
Definition: enum_quda.h:65
@ QUDA_SINGLE_PRECISION
Definition: enum_quda.h:64
@ QUDA_QUARTER_PRECISION
Definition: enum_quda.h:62
@ QUDA_HALF_PRECISION
Definition: enum_quda.h:63

Definition at line 67 of file blas_test.cpp.

◆ vD

Definition at line 35 of file blas_test.cpp.

◆ vH

Definition at line 32 of file blas_test.cpp.

◆ voD

Definition at line 41 of file blas_test.cpp.

◆ wD

Definition at line 35 of file blas_test.cpp.

◆ wH

Definition at line 32 of file blas_test.cpp.

◆ woD

Definition at line 41 of file blas_test.cpp.

◆ xD

Definition at line 35 of file blas_test.cpp.

◆ xH

This is the blas_test for checking correctness of the blas and reduction functions used by the lienar solvers. Any blas kernels that are added to QUDA should have a test added here.

For kernels that have mixed-precision support, we can test this functionality as well. The number of precision cominations we test are Nprec * (Nprec + 1)/2, which corresponds to all uni-precision combinations ("this precision") and all combinations with the "other precision" > "this precision".

Definition at line 32 of file blas_test.cpp.

◆ xmD

Definition at line 38 of file blas_test.cpp.

◆ xmH

std::vector<cpuColorSpinorField *> xmH

Definition at line 47 of file blas_test.cpp.

◆ xmoD

Definition at line 44 of file blas_test.cpp.

◆ xoD

Definition at line 41 of file blas_test.cpp.

◆ xoH

Definition at line 32 of file blas_test.cpp.

◆ yD

Definition at line 35 of file blas_test.cpp.

◆ yH

Definition at line 32 of file blas_test.cpp.

◆ ymD

Definition at line 38 of file blas_test.cpp.

◆ ymH

std::vector<cpuColorSpinorField *> ymH

Definition at line 48 of file blas_test.cpp.

◆ ymoD

Definition at line 44 of file blas_test.cpp.

◆ yoD

Definition at line 41 of file blas_test.cpp.

◆ yoH

Definition at line 32 of file blas_test.cpp.

◆ zD

Definition at line 35 of file blas_test.cpp.

◆ zH

Definition at line 32 of file blas_test.cpp.

◆ zmD

Definition at line 38 of file blas_test.cpp.

◆ zmH

std::vector<cpuColorSpinorField *> zmH

Definition at line 49 of file blas_test.cpp.

◆ zmoD

Definition at line 44 of file blas_test.cpp.

◆ zoD

Definition at line 41 of file blas_test.cpp.

◆ zoH

Definition at line 32 of file blas_test.cpp.