Skip to content
This repository has been archived by the owner on Dec 17, 2022. It is now read-only.

Commit

Permalink
using a modified version of ctbignum library for prime field arithm…
Browse files Browse the repository at this point in the history
…etic. check my PR niekbouman/ctbignum#48
  • Loading branch information
itzmeanjan committed Nov 23, 2021
1 parent 51dc269 commit 03e7bd9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
29 changes: 10 additions & 19 deletions bench_ctbn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ sycl::event benchmark_ff_p_t_addition(sycl::queue &q, const uint32_t dim,
sycl::event evt = q.parallel_for(
sycl::nd_range<2>{sycl::range<2>{dim, dim}, sycl::range<2>{1, wg_size}},
[=](sycl::nd_item<2> it) {
const uint64_t r = it.get_global_id(0);
const uint64_t c = it.get_global_id(1);
ff_p_t op1(2147483648_ZL);
ff_p_t op2(576460752303423488_ZL);

ff_p_t op1{1ul << 31};
ff_p_t op2{1ul << 59};

ff_p_t tmp{0ul};
ff_p_t tmp(0_ZL);
for (uint64_t i = 0ul; i < itr_count; i++) {
tmp += (op1 + op2);
}
Expand All @@ -26,15 +23,12 @@ sycl::event benchmark_ff_p_t_subtraction(sycl::queue &q, const uint32_t dim,
sycl::event evt = q.parallel_for(
sycl::nd_range<2>{sycl::range<2>{dim, dim}, sycl::range<2>{1, wg_size}},
[=](sycl::nd_item<2> it) {
const uint64_t r = it.get_global_id(0);
const uint64_t c = it.get_global_id(1);

ff_p_t op1{1ul << 37};
ff_p_t op2{1ul << 43};
ff_p_t op1(2147483648_ZL);
ff_p_t op2(576460752303423488_ZL);

ff_p_t tmp{0ul};
ff_p_t tmp(0_ZL);
for (uint64_t i = 0ul; i < itr_count; i++) {
tmp -= (op1 - op2);
tmp += (op1 - op2);
}
});
return evt;
Expand All @@ -46,13 +40,10 @@ sycl::event benchmark_ff_p_t_multiplication(sycl::queue &q, const uint32_t dim,
sycl::event evt = q.parallel_for(
sycl::nd_range<2>{sycl::range<2>{dim, dim}, sycl::range<2>{1, wg_size}},
[=](sycl::nd_item<2> it) {
const uint64_t r = it.get_global_id(0);
const uint64_t c = it.get_global_id(1);

ff_p_t op1{1ul << 35};
ff_p_t op2{1ul << 49};
ff_p_t op1(2147483648_ZL);
ff_p_t op2(576460752303423488_ZL);

ff_p_t tmp{0ul};
ff_p_t tmp(0_ZL);
for (uint64_t i = 0ul; i < itr_count; i++) {
tmp += (op1 * op2);
}
Expand Down
2 changes: 1 addition & 1 deletion include/bench_ctbn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <ctbignum/ctbignum.hpp>

using namespace cbn::literals;
using ff_p_t = decltype(cbn::Zq(18446744069414584321_Z));
using ff_p_t = decltype(cbn::Zq(18446744069414584321_ZL));

sycl::event benchmark_ff_p_t_addition(sycl::queue &q, const uint32_t dim,
const uint32_t wg_size,
Expand Down

0 comments on commit 03e7bd9

Please sign in to comment.