18 printf(
"=== RUN %s\n", __func__);
36 printf(
"%d,%d: FAILED: inconsistent result\n", i, j);
45 printf(
"%ld tests\n", count);
62 printf(
"=== RUN %s\n", __func__);
85 printf(
"%d,%d,%d: FAILED: inconsistent result\n", i, j, k);
96 printf(
"%ld tests\n", count);
111 printf(
"=== RUN %s\n", __func__);
115 unsigned tid = 0; tid += blockIdx.z;
116 tid *= gridDim.y; tid += blockIdx.y;
117 tid *= gridDim.x; tid += blockIdx.x;
118 tid *= blockDim.z; tid += threadIdx.z;
119 tid *= blockDim.y; tid += threadIdx.y;
120 tid *= blockDim.x; tid += threadIdx.x;
122 if (tid > 0xffffffff)
125 uint64_t t[6] = { tid, 0, 0, 0, 0, 0 };
131 if (x[0] != tid) pass =
false;
132 if (x[1] != 0) pass =
false;
133 if (x[2] != 0) pass =
false;
134 if (x[3] != 0) pass =
false;
135 if (x[4] != 0) pass =
false;
136 if (x[5] != 0) pass =
false;
139 printf(
"%d: FAILED after fp_fromUint64\n", tid);
145 if (z[0] != tid*tid) pass =
false;
146 if (z[1] != 0) pass =
false;
147 if (z[2] != 0) pass =
false;
148 if (z[3] != 0) pass =
false;
149 if (z[4] != 0) pass =
false;
150 if (z[5] != 0) pass =
false;
153 printf(
"%d: FAILED after fp_mul\n", tid);
__device__ void fp_print(const char *s, const fp_t &x)
Prints the canonical representation of x to STDOUT.
__device__ __host__ void fp_fromUint64(fp_t &z, const uint64_t *x)
Converts uint64_t[6] to fp_t. After this operation, z represents x mod p.
__device__ bool fp_neq(const fp_t &x, const fp_t &y)
Compares two fp_t residues.
uint64_t fp_t[6]
Residue modulo p. Any 384-bit representative of each residue is allowed, and stored as a 6-element li...
__device__ void fp_mul(fp_t &z, const fp_t &x, const fp_t &y)
Multiplies two Fp residues x and y, stores in z.
__device__ __host__ void fp_cpy(fp_t &z, const fp_t &x)
Copy from x into z.
__managed__ testval_t testval[TESTVALS]
__global__ void FpTestMul(testval_t *testval)
Multiplication test, comparing with the native uint64_t multiplication.
__global__ void FpTestAssociativeMul(testval_t *testval)
Test for the associative property of multiplication.
__global__ void FpTestCommutativeMul(testval_t *testval)
Test for the commutative property of addition.