Clearmatics Libff  0.1
C++ library for Finite Fields and Elliptic Curves
profile_algebra_groups_read.cpp
Go to the documentation of this file.
5 
6 #include <aio.h>
7 #include <exception>
8 #include <fcntl.h>
9 #include <fstream>
10 #include <map>
11 #include <sys/mman.h>
12 #include <sys/stat.h>
13 #include <thread>
14 #include <unistd.h>
15 
16 using namespace libff;
17 
18 static const size_t NUM_DIFFERENT_ELEMENTS = 1024;
19 static const size_t NUM_ELEMENTS_TO_READ = 1024 * 1024;
20 static const size_t NUM_ELEMENTS_IN_FILE = 256 * NUM_ELEMENTS_TO_READ;
21 static const size_t MAX_SPARSE_ELEMENT_INTERVAL =
22  NUM_ELEMENTS_IN_FILE / NUM_ELEMENTS_TO_READ;
23 
24 std::string get_filename(const std::string &identifier)
25 {
26  return "group_elements_uncompressed_" + identifier + ".bin";
27 }
28 
30 template<
31  typename GroupT,
32  form_t Form = form_montgomery,
34 bool ensure_group_elements_file_uncompressed(const std::string &identifier)
35 {
36  const std::string filename = get_filename(identifier);
37 
38  // If file doesn't exist, create it.
39  struct stat s;
40  if (stat(filename.c_str(), &s)) {
41  std::cout << " File '" << filename.c_str()
42  << "' does not exist. Creating ... ";
43  std::flush(std::cout);
44 
45  // Fill a buffer with random elements
46  std::vector<GroupT> elements;
47  elements.reserve(NUM_DIFFERENT_ELEMENTS);
48  for (size_t i = 0; i < NUM_DIFFERENT_ELEMENTS; ++i) {
49  elements.push_back(GroupT::random_element());
50  }
51 
52  // Use the buffer to fill the file
53  std::ofstream out_s(
54  filename.c_str(), std::ios_base::out | std::ios_base::binary);
55  for (size_t i = 0; i < NUM_ELEMENTS_IN_FILE; ++i) {
56  group_write<encoding_binary, Form, Comp>(
57  elements[i % NUM_DIFFERENT_ELEMENTS], out_s);
58  }
59  out_s.close();
60 
61  std::cout << "Created\n";
62  return false;
63  }
64 
65  return true;
66 }
67 
68 template<
69  typename GroupT,
70  form_t Form = form_montgomery,
73  const std::string &identifier, const size_t)
74 {
75  const std::string filename = get_filename(identifier);
76 
77  // Measure time taken to read the file
78  std::cout << " Sequential read '" << filename.c_str() << "' (expecting "
79  << std::to_string(NUM_ELEMENTS_TO_READ) << " elements ...\n";
80  {
81  std::vector<GroupT> elements;
82  elements.resize(NUM_DIFFERENT_ELEMENTS);
83 
84  std::ifstream in_s(
85  filename.c_str(), std::ios_base::in | std::ios_base::binary);
86  in_s.exceptions(
87  std::ios_base::eofbit | std::ios_base::badbit |
88  std::ios_base::failbit);
89 
90  {
91  enter_block("Read group elements profiling");
92  for (size_t i = 0; i < NUM_ELEMENTS_TO_READ; ++i) {
93  group_read<encoding_binary, Form, Comp>(
94  elements[i % NUM_DIFFERENT_ELEMENTS], in_s);
95  }
96  leave_block("Read group elements profiling");
97  }
98 
99  in_s.close();
100  }
101 }
102 
103 template<
104  typename GroupT,
105  form_t Form = form_montgomery,
107 void profile_group_read_random_seek_uncompressed(const std::string &identifier)
108 {
109  const std::string filename = get_filename(identifier);
110 
111  // Create a set of random indices. The i-th index to read from will be:
112  // (i + indices[i % NUM_DIFFERENT_ELEMENTS]) % NUM_ELEMENTS_IN_FILE
113  std::vector<size_t> indices;
114  indices.reserve(NUM_DIFFERENT_ELEMENTS);
115  for (size_t i = 0; i < NUM_DIFFERENT_ELEMENTS; ++i) {
116  indices.push_back(rand() % NUM_ELEMENTS_IN_FILE);
117  }
118 
119  // Measure time taken to read the file
120  std::cout << " Random Access Read '" << filename.c_str() << "' ("
121  << std::to_string(NUM_ELEMENTS_TO_READ) << " of "
122  << std::to_string(NUM_ELEMENTS_IN_FILE) << " elements ...\n";
123  {
124  std::vector<GroupT> elements;
125  elements.resize(NUM_DIFFERENT_ELEMENTS);
126 
127  std::ifstream in_s(
128  filename.c_str(), std::ios_base::in | std::ios_base::binary);
129  in_s.exceptions(
130  std::ios_base::eofbit | std::ios_base::badbit |
131  std::ios_base::failbit);
132 
133  const size_t element_size_on_disk = 2 * sizeof(elements[0].X);
134  {
135  enter_block("Read group elements profiling");
136  for (size_t i = 0; i < NUM_ELEMENTS_TO_READ; ++i) {
137  const size_t different_element_idx = i % NUM_DIFFERENT_ELEMENTS;
138  const size_t idx =
139  (indices[different_element_idx] + i) % NUM_ELEMENTS_IN_FILE;
140  const size_t offset = idx * element_size_on_disk;
141  group_read<encoding_binary, Form, Comp>(
142  elements[different_element_idx], in_s.seekg(offset));
143  }
144  leave_block("Read group elements profiling");
145  }
146 
147  in_s.close();
148  }
149 }
150 
151 template<
152  typename GroupT,
153  form_t Form = form_montgomery,
156  const std::string &identifier, const size_t interval)
157 {
158  const std::string filename = get_filename(identifier);
159 
160  // Measure time taken to read the file
161  std::cout << " Random Access Seeks (Ordered) '" << filename.c_str()
162  << "' (" << std::to_string(NUM_ELEMENTS_TO_READ) << " of "
163  << std::to_string(NUM_ELEMENTS_IN_FILE) << " elements ...\n";
164  {
165  std::vector<GroupT> elements;
166  elements.resize(NUM_DIFFERENT_ELEMENTS);
167 
168  std::ifstream in_s(
169  filename.c_str(), std::ios_base::in | std::ios_base::binary);
170  in_s.exceptions(
171  std::ios_base::eofbit | std::ios_base::badbit |
172  std::ios_base::failbit);
173 
174  const size_t element_size_on_disk = 2 * sizeof(elements[0].X);
175  const size_t element_interval_bytes = element_size_on_disk * interval;
176  {
177  enter_block("Read group elements profiling");
178  for (size_t i = 0; i < NUM_ELEMENTS_TO_READ; ++i) {
179  const size_t different_element_idx = i % NUM_DIFFERENT_ELEMENTS;
180  const size_t offset = i * element_interval_bytes;
181  group_read<encoding_binary, Form, Comp>(
182  elements[different_element_idx], in_s.seekg(offset));
183  }
184  leave_block("Read group elements profiling");
185  }
186 
187  in_s.close();
188  }
189 }
190 
191 template<typename GroupT>
193  const std::string &identifier, const size_t)
194 {
195  const std::string filename = get_filename(identifier);
196 
197  // Create a set of random indices. The i-th index to read from will be:
198  // (i + indices[i % NUM_DIFFERENT_ELEMENTS]) % NUM_ELEMENTS_IN_FILE
199  std::vector<size_t> indices;
200  indices.reserve(NUM_DIFFERENT_ELEMENTS);
201  for (size_t i = 0; i < NUM_DIFFERENT_ELEMENTS; ++i) {
202  indices.push_back(rand() % NUM_ELEMENTS_IN_FILE);
203  }
204 
205  // Measure time taken to read the file
206  std::cout << " Random Access Read '" << filename.c_str() << "' ("
207  << std::to_string(NUM_ELEMENTS_TO_READ) << " of "
208  << std::to_string(NUM_ELEMENTS_IN_FILE) << " elements ...\n";
209  {
210  std::vector<GroupT> elements;
211  elements.resize(NUM_DIFFERENT_ELEMENTS);
212 
213  int f = open(filename.c_str(), O_RDONLY);
214  if (f < 0) {
215  throw std::runtime_error("failed to open " + filename);
216  }
217 
218  const size_t element_size_on_disk = 2 * sizeof(elements[0].X);
219  {
220  enter_block("Read group elements profiling");
221  for (size_t i = 0; i < NUM_ELEMENTS_TO_READ; ++i) {
222  const size_t different_element_idx = i % NUM_DIFFERENT_ELEMENTS;
223  const size_t idx =
224  (indices[different_element_idx] + i) % NUM_ELEMENTS_IN_FILE;
225  const size_t offset = idx * element_size_on_disk;
226  GroupT &dest_element = elements[different_element_idx];
227 
228  lseek(f, offset, SEEK_SET);
229  read(f, &dest_element, element_size_on_disk);
230  }
231  leave_block("Read group elements profiling");
232  }
233 
234  close(f);
235  }
236 }
237 
238 template<typename GroupT>
240  const std::string &identifier, const size_t)
241 {
242  const std::string filename = get_filename(identifier);
243 
244  // Measure time taken to read the file
245  std::cout << " Random Access Read '" << filename.c_str() << "' ("
246  << std::to_string(NUM_ELEMENTS_TO_READ) << " of "
247  << std::to_string(NUM_ELEMENTS_IN_FILE) << " elements ...\n";
248  {
249  std::vector<GroupT> elements;
250  elements.resize(NUM_DIFFERENT_ELEMENTS);
251 
252  int f = open(filename.c_str(), O_RDONLY);
253  if (f < 0) {
254  throw std::runtime_error("failed to open " + filename);
255  }
256 
257  const size_t element_size_on_disk = 2 * sizeof(elements[0].X);
258  const size_t element_interval_bytes =
259  element_size_on_disk * NUM_ELEMENTS_IN_FILE / NUM_ELEMENTS_TO_READ;
260  {
261  enter_block("Read group elements profiling");
262  for (size_t i = 0; i < NUM_ELEMENTS_TO_READ; ++i) {
263  const size_t different_element_idx = i % NUM_DIFFERENT_ELEMENTS;
264  const size_t offset = i * element_interval_bytes;
265  GroupT &dest_element = elements[different_element_idx];
266 
267  lseek(f, offset, SEEK_SET);
268  read(f, &dest_element, element_size_on_disk);
269  }
270  leave_block("Read group elements profiling");
271  }
272 
273  close(f);
274  }
275 }
276 
277 template<typename GroupT>
279  const std::string &identifier, const size_t interval)
280 {
281  const std::string filename = get_filename(identifier);
282 
283  // Read sparse elements from a mem-mapped file, ensuring we always proceed
284  // forwards.
285 
286  // Measure time taken to read the file
287  std::cout << " Random Access MMap (Ordered) '" << filename.c_str() << "' ("
288  << NUM_ELEMENTS_TO_READ << " elements, interval: " << interval
289  << ") ...\n";
290  {
291  std::vector<GroupT> elements;
292  elements.resize(NUM_DIFFERENT_ELEMENTS);
293 
294  const size_t element_size_on_disk = 2 * sizeof(elements[0].X);
295  const size_t file_size = NUM_ELEMENTS_IN_FILE * element_size_on_disk;
296 
297  int fd = open(filename.c_str(), O_RDONLY);
298  if (fd < 0) {
299  throw std::runtime_error("failed to open " + filename);
300  }
301 
302  const void *file_base = mmap(
303  nullptr,
304  file_size,
305  PROT_READ,
306  MAP_PRIVATE /* | MAP_NOCACHE */,
307  fd,
308  0);
309  if (MAP_FAILED == file_base) {
310  throw std::runtime_error(
311  std::string("mmap failed: ") + strerror(errno));
312  }
313 
314  const size_t element_interval_bytes = element_size_on_disk * interval;
315 
316  {
317  enter_block("Read group elements profiling");
318  for (size_t i = 0; i < NUM_ELEMENTS_TO_READ; ++i) {
319  const size_t different_element_idx = i % NUM_DIFFERENT_ELEMENTS;
320  const size_t offset = i * element_interval_bytes;
321  GroupT &dest_element = elements[different_element_idx];
322  const GroupT *src =
323  (const GroupT *)(const void *)((size_t)file_base + offset);
324 
325  dest_element.X = src->X;
326  dest_element.Y = src->Y;
327  }
328  leave_block("Read group elements profiling");
329  }
330 
331  if (0 != munmap((void *)file_base, file_size)) {
332  throw std::runtime_error("munmap failed");
333  }
334  close(fd);
335  }
336 }
337 
338 void cb_init(
339  aiocb *cb, int fd, size_t offset_bytes, size_t size_bytes, void *dest)
340 {
341  // std::cout << "cb_init: " << fd << ", off: " << offset_bytes << ", size: "
342  // << size_bytes << ", dst: " << dest << "\n";
343 
344  memset(cb, 0, sizeof(aiocb));
345  cb->aio_fildes = fd;
346  cb->aio_offset = offset_bytes;
347  cb->aio_buf = dest;
348  cb->aio_nbytes = size_bytes;
349  cb->aio_sigevent.sigev_notify = SIGEV_NONE;
350  cb->aio_lio_opcode = LIO_READ;
351 }
352 
353 void cb_enqueue(aiocb *cb)
354 {
355  const int r = aio_read(cb);
356  if (0 == r) {
357  // std::cout << "cb_wait: enqueued\n";
358  return;
359  }
360 
361  throw std::runtime_error(
362  std::string("error from aio_read: ") + strerror(errno));
363 }
364 
365 ssize_t cb_wait(aiocb *cb)
366 {
367  int err;
368  for (;;) {
369  err = aio_error(cb);
370  if (err == EINPROGRESS) {
371  std::this_thread::yield();
372  // sleep(0);
373  continue;
374  }
375 
376  const ssize_t ret = aio_return(cb);
377  if (ret >= 0) {
378  // std::cout << "cb_wait: done\n";
379  return ret;
380  }
381 
382  if (err == ECANCELED) {
383  throw std::runtime_error("aio_error: cancelled");
384  }
385 
386  throw std::runtime_error(
387  std::string("error from aio_error: ") + strerror(errno));
388  }
389 }
390 
391 template<size_t BatchSize> class batched_aio_reader
392 {
393 public:
395  : _fd(fd)
396  , _active_batch(_batch1_ptrs)
397  , _next_batch(_batch2_ptrs)
398  , _next_batch_size(0)
399  {
400  memset(_batch1, 0, sizeof(_batch1));
401  memset(_batch2, 0, sizeof(_batch2));
402  for (size_t i = 0; i < BatchSize; ++i) {
403  _batch1_ptrs[i] = &_batch1[i];
404  _batch2_ptrs[i] = &_batch2[i];
405  }
406  }
407 
409  size_t offset_bytes, size_t size_bytes, void *dest)
410  {
411  assert(_next_batch_size < BatchSize);
412 
413  aiocb *cb = _next_batch[_next_batch_size];
414  cb_init(cb, _fd, offset_bytes, size_bytes, dest);
415 
416  // When first batch is full, enqueue it and allow writing to the next
417  // batch.
418 
419  ++_next_batch_size;
420  if (_next_batch_size == BatchSize) {
421  enqueue_next_batch();
422 
423  std::swap(_active_batch, _next_batch);
424  _next_batch_size = 0;
425  }
426  }
427 
428  void enqueue_read(size_t offset_bytes, size_t size_bytes, void *dest)
429  {
430  assert(_next_batch_size < BatchSize);
431 
432  aiocb *cb = _next_batch[_next_batch_size];
433  cb_init(cb, _fd, offset_bytes, size_bytes, dest);
434 
435  ++_next_batch_size;
436  if (_next_batch_size == BatchSize) {
437  enqueue_next_batch();
438  }
439  }
440 
442  {
443  // Wait for the _active_batch
444  for (size_t i = 0; i < BatchSize; ++i) {
445  int r = cb_wait(_active_batch[i]);
446  if (0 > r) {
447  throw std::runtime_error("bad read result");
448  }
449  if (0 == r) {
450  std::cout << "+";
451  }
452  }
453 
454  // swap pointers so it can be written into
455  std::swap(_active_batch, _next_batch);
456  _next_batch_size = 0;
457  }
458 
459 protected:
461  {
462  int r = lio_listio(LIO_NOWAIT, _next_batch, BatchSize, nullptr);
463  if (r != 0) {
464  throw std::runtime_error("enqueue_batch error");
465  }
466  }
467 
468  const int _fd;
469  aiocb _batch1[BatchSize];
470  aiocb _batch2[BatchSize];
471  aiocb *_batch1_ptrs[BatchSize];
472  aiocb *_batch2_ptrs[BatchSize];
473  aiocb **_active_batch; // Next batch to wait for
474  aiocb **_next_batch; // Batch being filled
476 };
477 
481 template<typename GroupT>
483  const std::string &identifier, const size_t interval)
484 {
485  const std::string filename = get_filename(identifier);
486 
487  // Perform reads from a set of orderd, but random, locations where the
488  // average interval between read locations (the sparsity) is `interval`.
489  // Treat the file as being divided into sections, each of size `interval`.
490  // For each section, we perform a single read from a random offset.
491 
492  // Preecompute the random offsets
493  std::vector<size_t> section_offsets;
494  section_offsets.reserve(NUM_ELEMENTS_TO_READ);
495  for (size_t i = 0; i < NUM_ELEMENTS_TO_READ; ++i) {
496  section_offsets.push_back((size_t)rand() * interval / RAND_MAX);
497  }
498 
499  int fd = open(filename.c_str(), O_RDONLY);
500  if (fd < 0) {
501  throw std::runtime_error("failed to open " + filename);
502  }
503 
504  const size_t BATCH_SIZE = 8;
505  static_assert(
506  0 == (NUM_ELEMENTS_TO_READ % BATCH_SIZE), "invalid batch size");
508 
509  GroupT dest1[BATCH_SIZE];
510  GroupT dest2[BATCH_SIZE];
511  const size_t size_on_disk = 2 * sizeof(dest1[0].X);
512 
513  GroupT *cur_dest = dest1;
514  GroupT *next_dest = dest2;
515 
516  std::cout << " Deep Async Read '" << filename.c_str() << "' ("
517  << std::to_string(NUM_ELEMENTS_TO_READ) << " of "
518  << std::to_string(NUM_ELEMENTS_IN_FILE) << " elements ...\n";
519 
520  {
521  enter_block("Read group elements profiling");
522 
523  size_t i = 0;
524 
525  // Enqueue first requests
526  for (size_t j = 0; j < BATCH_SIZE; ++j) {
528  section_offsets[i + j] * size_on_disk,
529  size_on_disk,
530  cur_dest + j);
531  }
532  i += BATCH_SIZE;
533 
534  // Enqueue all requests
535  for (; i < NUM_ELEMENTS_TO_READ; i += BATCH_SIZE) {
536  // Enqueue next batch
537  for (size_t j = 0; j < BATCH_SIZE; ++j) {
538  reader.enqueue_read(
539  ((i + j) * interval + section_offsets[i + j]) *
540  size_on_disk,
541  size_on_disk,
542  cur_dest + j);
543  }
544 
545  // Wait for current and process
546  reader.wait_last_read();
547 
548  // Swap (at which point, cur_cb is the next element to wait for, and
549  // next_cb is unused).
550  std::swap(cur_dest, next_dest);
551  }
552 
553  // Wait for last request
554  reader.wait_last_read();
555 
556  leave_block("Read group elements profiling");
557  }
558 }
559 
560 typedef void (*profile_fn)(const std::string &, const size_t);
561 
562 template<typename GroupT> class profile_selector
563 {
564 public:
565  std::map<std::string, profile_fn> s_profile_functions = {
566  {std::string("sequential"),
567  profile_group_read_sequential_uncompressed<GroupT>},
568  {std::string("stream"),
569  profile_group_read_random_seek_ordered_uncompressed<GroupT>},
570  {std::string("fd"),
571  profile_group_read_random_seek_fd_ordered_uncompressed<GroupT>},
572  {std::string("mmap"),
573  profile_group_read_random_seek_mmap_ordered_uncompressed<GroupT>},
574  {std::string("aio"),
575  profile_group_read_random_batch_aio_ordered_uncompressed<GroupT>},
576  {std::string("aio-batched"),
577  profile_group_read_random_batch_aio_ordered_uncompressed<GroupT>},
578  };
579 };
580 
581 void usage(const char *const argv0)
582 {
583  std::cout << "Usage: " << argv0 << " [flags]\n"
584  << "\n"
585  << "Flags:\n"
586  << " --interval <interval> Use sparse interval (default "
587  << MAX_SPARSE_ELEMENT_INTERVAL << ")\n"
588  << " --profile <profile name> Run a specific profile "
589  "(default \"all\")\n";
590 }
591 
592 template<typename GroupT>
594  const std::string &profile,
595  const std::string &identifier,
596  const size_t interval)
597 {
598  std::cout << "profile: " << profile << "\n";
599  std::cout << "identifier: " << identifier << "\n";
600 
601  if (!ensure_group_elements_file_uncompressed<GroupT>(identifier)) {
602  return;
603  }
604 
605  class profile_selector<GroupT> p;
606 
607  if (profile == "all") {
608  for (const auto &pair : p.s_profile_functions) {
609  run_profile<GroupT>(pair.first, identifier, interval);
610  }
611  return;
612  }
613 
614  auto it = p.s_profile_functions.find(profile);
615  if (it == p.s_profile_functions.end()) {
616  throw std::runtime_error(std::string("no such profile: ") + profile);
617  }
618 
619  it->second(identifier, interval);
620 }
621 
622 int main(const int argc, char const *const *const argv)
623 {
624  std::string profile = "all";
625  size_t sparse_interval = MAX_SPARSE_ELEMENT_INTERVAL;
626 
627  for (size_t i = 1; i < (size_t)argc; ++i) {
628  const char *const arg = argv[i];
629  if (!strcmp(arg, "--interval")) {
630  sparse_interval = std::stoi(std::string(argv[++i]));
631  } else if (!strcmp(arg, "--profile")) {
632  profile = argv[++i];
633  } else {
634  usage(argv[0]);
635  return 1;
636  }
637  }
638 
639  if (sparse_interval > MAX_SPARSE_ELEMENT_INTERVAL) {
640  throw std::runtime_error("invalid interval");
641  }
642 
643  // Some configurations are disabled for now.
644 
645  std::cout << "alt_bn128_pp\n";
647  run_profile<alt_bn128_G1>(profile, "alt_bn128_G1", sparse_interval);
648  run_profile<alt_bn128_G2>(profile, "alt_bn128_G2", sparse_interval);
649 
650  // For now (to avoid too many large data files and very long runtimes, this
651  // is disabled. Uncomment to run for bls12-377.
652 
653  // std::cout << "bls12_377_pp\n";
654  // bls12_377_pp::init_public_params();
655  // run_profile<bls12_377_G1>("bls12_377_G1");
656  // run_profile<bls12_377_G2>("bls12_377_G2");
657 
658  return 0;
659 }
profile_group_read_random_seek_fd_uncompressed
void profile_group_read_random_seek_fd_uncompressed(const std::string &identifier, const size_t)
Definition: profile_algebra_groups_read.cpp:192
cb_enqueue
void cb_enqueue(aiocb *cb)
Definition: profile_algebra_groups_read.cpp:353
libff::form_t
form_t
Encodings for (de)serialization.
Definition: serialization.hpp:25
batched_aio_reader::batched_aio_reader
batched_aio_reader(int fd)
Definition: profile_algebra_groups_read.cpp:394
libff::enter_block
void enter_block(const std::string &msg, const bool indent)
Definition: profiling.cpp:271
libff::compression_t
compression_t
Enable / disable compression in (de)serialization.
Definition: serialization.hpp:31
profile_group_read_random_seek_uncompressed
void profile_group_read_random_seek_uncompressed(const std::string &identifier)
Definition: profile_algebra_groups_read.cpp:107
batched_aio_reader::_fd
const int _fd
Definition: profile_algebra_groups_read.cpp:468
libff
Definition: ffi.cpp:8
profile_group_read_random_seek_ordered_uncompressed
void profile_group_read_random_seek_ordered_uncompressed(const std::string &identifier, const size_t interval)
Definition: profile_algebra_groups_read.cpp:155
profile_selector::s_profile_functions
std::map< std::string, profile_fn > s_profile_functions
Definition: profile_algebra_groups_read.cpp:565
profile_selector
Definition: profile_algebra_groups_read.cpp:562
batched_aio_reader::_next_batch_size
size_t _next_batch_size
Definition: profile_algebra_groups_read.cpp:475
batched_aio_reader::wait_last_read
void wait_last_read()
Definition: profile_algebra_groups_read.cpp:441
cb_wait
ssize_t cb_wait(aiocb *cb)
Definition: profile_algebra_groups_read.cpp:365
profile_group_read_sequential_uncompressed
void profile_group_read_sequential_uncompressed(const std::string &identifier, const size_t)
Definition: profile_algebra_groups_read.cpp:72
libff::form_montgomery
@ form_montgomery
Definition: serialization.hpp:27
batched_aio_reader::enqueue_next_batch
void enqueue_next_batch()
Definition: profile_algebra_groups_read.cpp:460
profile_group_read_random_seek_fd_ordered_uncompressed
void profile_group_read_random_seek_fd_ordered_uncompressed(const std::string &identifier, const size_t)
Definition: profile_algebra_groups_read.cpp:239
cb_init
void cb_init(aiocb *cb, int fd, size_t offset_bytes, size_t size_bytes, void *dest)
Definition: profile_algebra_groups_read.cpp:338
run_profile
void run_profile(const std::string &profile, const std::string &identifier, const size_t interval)
Definition: profile_algebra_groups_read.cpp:593
batched_aio_reader::_next_batch
aiocb ** _next_batch
Definition: profile_algebra_groups_read.cpp:474
libff::alt_bn128_pp::init_public_params
static void init_public_params()
Definition: alt_bn128_pp.cpp:15
profile_fn
void(* profile_fn)(const std::string &, const size_t)
Definition: profile_algebra_groups_read.cpp:560
alt_bn128_pp.hpp
bls12_377_pp.hpp
libff::compression_off
@ compression_off
Definition: serialization.hpp:32
ensure_group_elements_file_uncompressed
bool ensure_group_elements_file_uncompressed(const std::string &identifier)
Returns true if the file was already present.
Definition: profile_algebra_groups_read.cpp:34
usage
void usage(const char *const argv0)
Definition: profile_algebra_groups_read.cpp:581
profile_group_read_random_seek_mmap_ordered_uncompressed
void profile_group_read_random_seek_mmap_ordered_uncompressed(const std::string &identifier, const size_t interval)
Definition: profile_algebra_groups_read.cpp:278
batched_aio_reader::enqueue_read
void enqueue_read(size_t offset_bytes, size_t size_bytes, void *dest)
Definition: profile_algebra_groups_read.cpp:428
batched_aio_reader
Definition: profile_algebra_groups_read.cpp:391
profiling.hpp
batched_aio_reader::_active_batch
aiocb ** _active_batch
Definition: profile_algebra_groups_read.cpp:473
libff::leave_block
void leave_block(const std::string &msg, const bool indent)
Definition: profiling.cpp:305
main
int main(const int argc, char const *const *const argv)
Definition: profile_algebra_groups_read.cpp:622
profile_group_read_random_batch_aio_ordered_uncompressed
void profile_group_read_random_batch_aio_ordered_uncompressed(const std::string &identifier, const size_t interval)
Definition: profile_algebra_groups_read.cpp:482
NUM_DIFFERENT_ELEMENTS
constexpr size_t NUM_DIFFERENT_ELEMENTS
Definition: profile_multiexp.cpp:15
curve_serialization.hpp
get_filename
std::string get_filename(const std::string &identifier)
Definition: profile_algebra_groups_read.cpp:24
batched_aio_reader::enqueue_read_first_batch
void enqueue_read_first_batch(size_t offset_bytes, size_t size_bytes, void *dest)
Definition: profile_algebra_groups_read.cpp:408