FK20 CUDA
fk20test_fft_rand.cu
Go to the documentation of this file.
1 // bls12_381: Arithmetic for BLS12-381
2 // Copyright 2022-2023 Dag Arne Osvik
3 // Copyright 2022-2023 Luan Cardoso dos Santos
4 
5 #warning "Functionality of this file has been replaced by fk20_512."
6 
7 #include <stdio.h>
8 #include <unistd.h>
9 
10 #include "g1.cuh"
11 #include "fk20test.cuh"
12 #include "fk20.cuh"
13 
14 
15 //static __managed__ uint8_t cmp[16*512];
16 //static __managed__ fr_t fr_tmp[16*512];
17 //static __managed__ g1p_t g1p_tmp[512];
18 
19 //Global correct answers, read from the instrumented fk20 python implementation
20 static __managed__ size_t elementsRead;
21 static __managed__ fr_t polynomial[4096];
22 static __managed__ g1p_t setup[4097];
23 static __managed__ g1p_t xext_fft[16][512];
24 static __managed__ fr_t toeplitz_coefficients[16][512];
25 static __managed__ fr_t toeplitz_coefficients_fft[16][512];
26 static __managed__ g1p_t hext_fft[512];
27 static __managed__ g1p_t h[512];
28 static __managed__ g1p_t h_fft[512];
29 
30 #define readAndCheck(var) do{ \
31  elementsRead = fread(var, 1, sizeof(var), inputStream); \
32  if(elementsRead != sizeof(var)){ \
33  printf("NONFATAL: Unbale to read test vectors, aborting\n"); \
34  return; \
35  } else { \
36  printf(" Read in " #var " %ld Bytes\n", elementsRead); \
37  } \
38  }while(0)
39 
40 void FK20TestFFTRand(FILE *inputStream) {
41  /*
42  * Reads from inputStream values generated by the python implementation, and test against those.
43  * if the inputstream is NULL, then read from stdin
44  */
45 
46  if (inputStream == NULL){
47  inputStream = stdin;
48  }
49 
50  if (isatty(fileno(inputStream)))
51  return;
52 
53  printf(">>>> Rand Tests\n");
54 
61  readAndCheck(h);
63 
65  h2h_fft(h, h_fft);
66  h_fft2h(h_fft, h);
69 
74 
75 
76  //Null the pointer if we used STDIN
77  if (inputStream == stdin){
78  inputStream = NULL;
79  }
80 }
81 
82 // vim: ts=4 et sw=4 si
__managed__ g1p_t xext_fft[16][512]
__managed__ g1p_t hext_fft[512 *512]
__managed__ g1p_t h_fft[512 *512]
__managed__ fr_t toeplitz_coefficients[512 *16][512]
__managed__ fr_t polynomial[512 *4096]
__managed__ fr_t toeplitz_coefficients_fft[512 *16][512]
__managed__ g1p_t h[512 *512]
__managed__ g1p_t setup[4097]
void h_fft2h(g1p_t h_fft_l[512], g1p_t h_l[512])
Test for g1p_ift: h_fft -> h.
void fk20_poly2toeplitz_coefficients_test(fr_t polynomial[4096], fr_t toeplitz_coefficients[16][512])
Test for fk20_poly2toeplitz_coefficients: polynomial -> toeplitz_coefficients.
void fk20_msmloop(g1p_t hext_fft_l[512], fr_t toeplitz_coefficients_fft_l[16][512], g1p_t xext_fft_l[16][512])
Test for fk20_msm: Toeplitz_coefficients+xext_fft -> hext_fft.
void h2h_fft(g1p_t h_l[512], g1p_t h_fft_l[512])
Test for g1p_fft: h -> h_fft.
Definition: fk20test_fft.cu:79
void fk20_poly2hext_fft_test(fr_t polynomial_l[4096], g1p_t xext_fft_l[16][512], g1p_t hext_fft_l[512])
Test for fk20_poly2hext_fft: polynomial -> hext_fft.
void hext_fft2h_fft(g1p_t hext_fft_l[512], g1p_t h_fft_l[512])
Test for fk20_hext_fft2h_fft: hext_fft -> h_fft.
void fk20_poly2h_fft_test(fr_t polynomial_l[4096], g1p_t xext_fft_l[16][512], g1p_t h_fft_l[512])
Test for fk20_poly2h_fft: polynomial -> h_fft.
void toeplitz_coefficients2toeplitz_coefficients_fft(fr_t toeplitz_coefficients_l[16][512], fr_t toeplitz_coefficients_fft_l[16][512])
Test for fr_fft: toeplitz_coefficients -> toeplitz_coefficients_fft.
Definition: fk20test_fft.cu:44
void hext_fft2h(g1p_t hext_fft_l[512], g1p_t h_l[512])
Test for g1p_ift: hext_fft -> h.
#define readAndCheck(var)
void FK20TestFFTRand(FILE *inputStream)
uint64_t fr_t[4]
Subgroup element stored as a 256-bit array (a 4-element little-endian array of uint64_t)....
Definition: fr.cuh:24
G1 point in projective coordinates.
Definition: g1.cuh:27