From 819f5c53c02b21f6b948399f7c7b4d2ed447c533 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Sat, 31 Mar 2018 13:19:35 +0200 Subject: [PATCH] Add a common header for testings --- tests/CMakeLists.txt | 2 + tests/core_zgeadd.c | 2 +- tests/core_zplrnt.c | 2 +- tests/get_options.c | 2 +- tests/p_spm_tests.c | 2 +- tests/spm_convert_tests.c | 2 +- tests/spm_dof_expand_tests.c | 4 +- tests/spm_dof_matvec_tests.c | 4 +- tests/spm_dof_norm_tests.c | 4 +- tests/spm_matvec_tests.c | 2 +- tests/spm_norm_tests.c | 2 +- tests/spm_tests.h | 90 ++++++++++++++++++++++++++++++++++++ tests/z_spm_tests.c | 2 +- 13 files changed, 106 insertions(+), 14 deletions(-) create mode 100644 tests/spm_tests.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b1c55063..76e2fc5d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,6 +10,8 @@ ### include(RulesPrecisions) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + ## Generate the test library files for all required precisions set(LIB_SOURCES z_spm_tests.c diff --git a/tests/core_zgeadd.c b/tests/core_zgeadd.c index bde4d626..758224eb 100644 --- a/tests/core_zgeadd.c +++ b/tests/core_zgeadd.c @@ -15,7 +15,7 @@ * @precisions normal z -> c d s * **/ -#include <spm.h> +#include <spm_tests.h> #include "cblas.h" /** diff --git a/tests/core_zplrnt.c b/tests/core_zplrnt.c index b22e2dfe..e210cab7 100644 --- a/tests/core_zplrnt.c +++ b/tests/core_zplrnt.c @@ -17,7 +17,7 @@ * @precisions normal z -> c d s * **/ -#include <spm.h> +#include <spm_tests.h> #ifndef DOXYGEN_SHOULD_SKIP_THIS #define Rnd64_A 6364136223846793005ULL diff --git a/tests/get_options.c b/tests/get_options.c index 40c2d281..6116e34f 100644 --- a/tests/get_options.c +++ b/tests/get_options.c @@ -13,7 +13,7 @@ * @date 2017-06-15 * */ -#include <spm.h> +#include <spm_tests.h> #include <unistd.h> #if defined(HAVE_GETOPT_H) #include <getopt.h> diff --git a/tests/p_spm_tests.c b/tests/p_spm_tests.c index a3add89d..03043263 100644 --- a/tests/p_spm_tests.c +++ b/tests/p_spm_tests.c @@ -22,7 +22,7 @@ #include <math.h> #include <string.h> #include <assert.h> -#include <spm.h> +#include <spm_tests.h> #include "cblas.h" #include "lapacke.h" #include <p_spm.h> diff --git a/tests/spm_convert_tests.c b/tests/spm_convert_tests.c index 885d23d0..bfff58cb 100644 --- a/tests/spm_convert_tests.c +++ b/tests/spm_convert_tests.c @@ -23,7 +23,7 @@ #include <string.h> #include <assert.h> #include <time.h> -#include <spm.h> +#include <spm_tests.h> #define PRINT_RES(_ret_) \ if(_ret_ == -1) { \ diff --git a/tests/spm_dof_expand_tests.c b/tests/spm_dof_expand_tests.c index 48302804..40cafbf6 100644 --- a/tests/spm_dof_expand_tests.c +++ b/tests/spm_dof_expand_tests.c @@ -2,7 +2,7 @@ * * @file spm_dof_expand_tests.c * - * Tests and validate the spmNorm routines when the spm hold constant and/or variadic dofs. + * Tests and validate the spmNorm routines when the spm_tests.hold constant and/or variadic dofs. * * @copyright 2015-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, * Univ. Bordeaux. All rights reserved. @@ -23,7 +23,7 @@ #include <string.h> #include <assert.h> #include <time.h> -#include "spm.h" +#include "spm_tests.h" int z_spm_norm_check( const spmatrix_t *spm ); int c_spm_norm_check( const spmatrix_t *spm ); diff --git a/tests/spm_dof_matvec_tests.c b/tests/spm_dof_matvec_tests.c index c73b8241..275cd055 100644 --- a/tests/spm_dof_matvec_tests.c +++ b/tests/spm_dof_matvec_tests.c @@ -2,7 +2,7 @@ * * @file spm_dof_matvec_tests.c * - * Tests and validate the spmMatVec routines when the spm hold constant and/or variadic dofs. + * Tests and validate the spmMatVec routines when the spm_tests.hold constant and/or variadic dofs. * * @copyright 2015-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, * Univ. Bordeaux. All rights reserved. @@ -21,7 +21,7 @@ #include <string.h> #include <assert.h> #include <time.h> -#include "spm.h" +#include "spm_tests.h" int z_spm_matvec_check( int trans, const spmatrix_t *spm ); int c_spm_matvec_check( int trans, const spmatrix_t *spm ); diff --git a/tests/spm_dof_norm_tests.c b/tests/spm_dof_norm_tests.c index cb6879fa..1e75148d 100644 --- a/tests/spm_dof_norm_tests.c +++ b/tests/spm_dof_norm_tests.c @@ -2,7 +2,7 @@ * * @file spm_dof_norm_tests.c * - * Tests and validate the spm_norm routines when the spm hold constant and/or variadic dofs. + * Tests and validate the spm_norm routines when the spm_tests.hold constant and/or variadic dofs. * * @copyright 2015-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, * Univ. Bordeaux. All rights reserved. @@ -20,7 +20,7 @@ #include <string.h> #include <assert.h> #include <time.h> -#include <spm.h> +#include <spm_tests.h> int z_spm_norm_check( const spmatrix_t *spm ); int c_spm_norm_check( const spmatrix_t *spm ); diff --git a/tests/spm_matvec_tests.c b/tests/spm_matvec_tests.c index b608b09e..1dc61ad3 100644 --- a/tests/spm_matvec_tests.c +++ b/tests/spm_matvec_tests.c @@ -20,7 +20,7 @@ #include <string.h> #include <assert.h> #include <time.h> -#include "spm.h" +#include "spm_tests.h" int z_spm_matvec_check( int trans, const spmatrix_t *spm ); int c_spm_matvec_check( int trans, const spmatrix_t *spm ); diff --git a/tests/spm_norm_tests.c b/tests/spm_norm_tests.c index 4b1d7bd1..35496256 100644 --- a/tests/spm_norm_tests.c +++ b/tests/spm_norm_tests.c @@ -20,7 +20,7 @@ #include <string.h> #include <assert.h> #include <time.h> -#include <spm.h> +#include <spm_tests.h> int z_spm_norm_check( const spmatrix_t *spm ); int c_spm_norm_check( const spmatrix_t *spm ); diff --git a/tests/spm_tests.h b/tests/spm_tests.h new file mode 100644 index 00000000..2be8bee1 --- /dev/null +++ b/tests/spm_tests.h @@ -0,0 +1,90 @@ +/** + * + * @file spm_tests.h + * + * SParse Matrix package testings header. + * + * @copyright 2016-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * Univ. Bordeaux. All rights reserved. + * + * @version 1.0.0 + * @author Mathieu Faverge + * @date 2013-06-24 + * + **/ +#ifndef _spm_tests_h_ +#define _spm_tests_h_ + +#include <stdlib.h> +#include <assert.h> +#include <stdio.h> +#include <spm.h> + +void spmGetOptions( int argc, char **argv, + spm_driver_t *driver, char **filename ); + +void core_zplrnt( int m, int n, spm_complex64_t *A, int lda, + int gM, int m0, int n0, unsigned long long int seed ); +int core_zgeadd( spm_trans_t trans, + spm_int_t M, + spm_int_t N, + spm_complex64_t alpha, + const spm_complex64_t *A, + spm_int_t LDA, + spm_complex64_t beta, + spm_complex64_t *B, + spm_int_t LDB ); + +void core_cplrnt( int m, int n, spm_complex32_t *A, int lda, + int gM, int m0, int n0, unsigned long long int seed ); +int core_cgeadd( spm_trans_t trans, + spm_int_t M, + spm_int_t N, + spm_complex32_t alpha, + const spm_complex32_t *A, + spm_int_t LDA, + spm_complex32_t beta, + spm_complex32_t *B, + spm_int_t LDB ); + +void core_dplrnt( int m, int n, double *A, int lda, + int gM, int m0, int n0, unsigned long long int seed ); +int core_dgeadd( spm_trans_t trans, + spm_int_t M, + spm_int_t N, + double alpha, + const double *A, + spm_int_t LDA, + double beta, + double *B, + spm_int_t LDB ); + +void core_splrnt( int m, int n, float *A, int lda, + int gM, int m0, int n0, unsigned long long int seed ); +int core_sgeadd( spm_trans_t trans, + spm_int_t M, + spm_int_t N, + float alpha, + const float *A, + spm_int_t LDA, + float beta, + float *B, + spm_int_t LDB ); + +void z_spm_print_check( char *filename, const spmatrix_t *spm ); +int z_spm_matvec_check( int trans, const spmatrix_t *spm ); +int z_spm_norm_check( const spmatrix_t *spm ); + +void c_spm_print_check( char *filename, const spmatrix_t *spm ); +int c_spm_matvec_check( int trans, const spmatrix_t *spm ); +int c_spm_norm_check( const spmatrix_t *spm ); + +void d_spm_print_check( char *filename, const spmatrix_t *spm ); +int d_spm_matvec_check( int trans, const spmatrix_t *spm ); +int d_spm_norm_check( const spmatrix_t *spm ); + +void s_spm_print_check( char *filename, const spmatrix_t *spm ); +int s_spm_matvec_check( int trans, const spmatrix_t *spm ); +int s_spm_norm_check( const spmatrix_t *spm ); + +#endif /* _spm_tests_h_ */ diff --git a/tests/z_spm_tests.c b/tests/z_spm_tests.c index 54615c56..6d74e8f8 100644 --- a/tests/z_spm_tests.c +++ b/tests/z_spm_tests.c @@ -24,7 +24,7 @@ #include <math.h> #include <string.h> #include <assert.h> -#include <spm.h> +#include <spm_tests.h> #include "cblas.h" #include "lapacke.h" #include <z_spm.h> -- GitLab