21 p0 = 0xFFFFFFFF00000001U,
22 p1 = 0x53BDA402FFFE5BFEU,
23 p2 = 0x3339D80809A1D805U,
24 p3 = 0x73EDA753299D7D48U;
53 for (
int j=0; j<64; i++,j++) {
testval[i][0] = 1ULL << j; }
54 for (
int j=0; j<64; i++,j++) {
testval[i][1] = 1ULL << j; }
55 for (
int j=0; j<64; i++,j++) {
testval[i][2] = 1ULL << j; }
56 for (
int j=0; j<64; i++,j++) {
testval[i][3] = 1ULL << j; }
58 for (
int j=2; j<258; i++,j++) {
65 FILE *pf = fopen(
"/dev/urandom",
"r");
72 printf(
"Fixed/random test values: %d/%d\n", i,
TESTVALS-i);
79 X <<<1,block>>> (&testval[0]); \
80 err = cudaDeviceSynchronize(); \
82 if (err != cudaSuccess) printf("Error %d\n", err); \
83 printf(" (%.2f s)\n", (end - start) * (1.0 / CLOCKS_PER_SEC));
94 int main(
int argc,
char **argv) {
101 level = atoi(argv[1]);
108 if (err != cudaSuccess) {
void init()
initialize test values
int main(int argc, char **argv)
Self test of the functions over Fr.
__managed__ testval_t testval[TESTVALS]
void FrTestFFT()
Tests fft and inverse fft over Fr using KAT.
__global__ void FrTestCommutativeAdd(testval_t *testval)
Test the cumulative property of addition.
__global__ void FrTestAssociativeAdd(testval_t *testval)
Test the associative property of addition.
__global__ void FrTestAddSub(testval_t *testval)
Test for the fr_addsub kernel.
__global__ void FrTestCmp(testval_t *testval)
Test for the comparison function; checks for inconsistencies in the following properties:
__global__ void FrTestSubDistributiveLeft(testval_t *testval)
Check the distributive property of multiplication in Fr (left of subtraction):
__global__ void FrTestAddDistributiveRight(testval_t *testval)
Check the distributive property of multiplication in Fr (right of addition):
__global__ void FrTestAddDistributiveLeft(testval_t *testval)
Check the distributive property of multiplication in Fr (left of addition):
__global__ void FrTestSubDistributiveRight(testval_t *testval)
Check the distributive property of multiplication in Fr (right of subtraction):
__global__ void FrTestFibonacci(testval_t *)
Test addition and subtraction in Fr using a fibonacci sequence (chain dependency) from 1 to ITERATION...
__global__ void FrTestKAT(testval_t *)
tests using KAT for: fr_cpy, fr_reduce4, fr_eq, fr_neq, fr_neg, fr_x2, fr_x3, fr_add,...
__global__ void FrTestAssociativeMul(testval_t *testval)
Test of the associative property of multiplication (x*y)*z == x*(y*z)
__global__ void FrTestCommutativeMul(testval_t *testval)
Test of the commutative property of multiplication x*y == y*x.
__global__ void FrTestMulConst(testval_t *testval)
Test multiply by constant on Fr:
__global__ void FrTestSub(testval_t *testval)
Test of subtraction x == y-(y-x)
void testinit()
Sets a global variable to true if the STDOUT is a terminal. Needs to be done like so because while a ...