1 #ifndef TEST_BBLAS_BASE_HPP_
2 #define TEST_BBLAS_BASE_HPP_
3 
4 #include "bblas_mat64.hpp"
5 #include <gmp.h>
6 #include <cstdint>
7 #include <vector>
8 #include <string>
9 #include "gmp_aux.h"
10 #ifdef HAVE_M4RI
11 /* To test against m4ri routines, include a checkout of
12  * https://bitbucket.org/malb/m4ri.git under linalg/m4ri, and run
13  * "autoreconf -i" there ; cado-nfs cmake logic then detects it and
14  * enables the corresponding code here (and in a few other places in
15  * test_bblas). */
16 #include "m4ri/m4ri.h"
17 #endif
18 
uint64_random(gmp_randstate_t rstate)19 static inline uint64_t uint64_random(gmp_randstate_t rstate)
20 {
21     uint64_t a;
22     memfill_random(&a, sizeof(uint64_t), rstate);
23     return a;
24 }
25 
26 struct test_bblas_base {
27     gmp_randstate_t rstate;
28 
29     unsigned int nmax;
30 
31     uint64_t * xr;
32     uint64_t * r;
33     uint64_t * a;
34     uint64_t * b;
35     mat64 w;
36     mat64 wt;
37 
38 #ifdef  HAVE_M4RI
39     mzd_t *R;
40     mzd_t *A;
41     mzd_t *R64;
42     mzd_t *A64;
43     mzd_t *W;
44     mzd_t *WT;
45 
46     /* These functions are defined in test_bblas_m4ri.cpp */
47     static void mzd_set_mem(mzd_t * M, const uint64_t * s, unsigned int n);
48     static void mzd_set_memT(mzd_t * M, const uint64_t * s, unsigned int n);
49     static void mzd_check_mem(mzd_t * M, uint64_t * s, unsigned int n);
50 #endif  /* HAVE_M4RI */
51 
52     static int test_accel;
53 
54     typedef std::vector<std::string> tags_t;
55 
56     test_bblas_base(unsigned int nmax);
57     ~test_bblas_base();
58 
set_seedtest_bblas_base59     void set_seed(int seed) { gmp_randseed_ui(rstate, seed); }
60 
61     bool matches(std::string const & s, tags_t const & T, bool & match);
62 };
63 
64 #endif	/* TEST_BBLAS_BASE_HPP_ */
65