6 template <
typename Float>
23 for (
int x=0;
x<t.Volume();
x++) {
24 for (
int s=0;
s<t.Nspin();
s++) {
25 for (
int c=0; c<t.Ncolor(); c++) {
26 for (
int z=0; z<2; z++) {
36 void point(T &t,
int x,
int s,
int c) { t(x, s, c, 0) = 1.0; }
44 else errorQuda(
"Unsupported source type %d", sourceType);
50 else errorQuda(
"Unsupported source type %d", sourceType);
59 template <
class U,
class V>
61 int fail_check = 16*tol;
62 int *fail =
new int[fail_check];
63 for (
int f=0; f<fail_check; f++) fail[f] = 0;
65 int N = 2*u.Nspin()*u.Ncolor();
66 int *iter =
new int[N];
67 for (
int i=0; i<N; i++) iter[i] = 0;
69 for (
int x=0;
x<u.Volume();
x++) {
73 for (
int s=0;
s<u.Nspin();
s++) {
74 for (
int c=0; c<u.Ncolor(); c++) {
75 for (
int z=0; z<2; z++) {
76 int j = (
s*u.Ncolor() + c)*2+z;
79 double diff = fabs(u(
x,
s,c,z) - v(
x,
s,c,z));
81 for (
int f=0; f<fail_check; f++) {
82 if (diff >
pow(10.0,-(f+1)/(
double)tol)) {
100 for (
int i=0; i<N; i++)
printfQuda(
"%d fails = %d\n", i, iter[i]);
102 int accuracy_level =0;
103 for (
int f=0; f<fail_check; f++) {
104 if (fail[f] == 0) accuracy_level = f+1;
107 for (
int f=0; f<fail_check; f++) {
108 printfQuda(
"%e Failures: %d / %d = %e\n",
pow(10.0,-(f+1)/(
double)tol),
109 fail[f], u.Volume()*N, fail[f] / (double)(u.Volume()*N));
115 return accuracy_level;
149 template <
class Order>
152 for (
int s=0;
s<o.Nspin();
s++) {
153 std::cout <<
"x = " << x <<
", s = " <<
s <<
", { ";
154 for (
int c=0; c<o.Ncolor(); c++) {
155 std::cout <<
" ( " << o(x, s, c, 0) <<
" , " ;
156 if (c<o.Ncolor()-1) std::cout << o(x, s, c, 1) <<
" ) ," ;
157 else std::cout << o(x, s, c, 1) <<
" ) " ;
159 std::cout <<
" } " << std::endl;
int genericCompare(const cpuColorSpinorField &a, const cpuColorSpinorField &b, int tol)
void print_vector(const Order &o, unsigned int x)
int compareSpinor(const U &u, const V &v, const int tol)
enum QudaSourceType_s QudaSourceType
__host__ __device__ ValueType pow(ValueType x, ExponentType e)
void genericSource(cpuColorSpinorField &a, QudaSourceType sourceType, int x, int s, int c)
QudaFieldOrder FieldOrder() const
void genericPrintVector(cpuColorSpinorField &a, unsigned int x)
void point(T &t, int x, int s, int c)
ColorSpinorFieldOrder< Float > * createOrder(const cpuColorSpinorField &a)
QudaPrecision Precision() const