Skip to content

Commit d5bb6bf

Browse files
author
nixw
committed
Disable MSM
1 parent bfb3e39 commit d5bb6bf

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

c/curve.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include <string>
22

33
#include "exp.hpp"
4-
//#include "multiexp.hpp"
5-
//#include "run.hpp"
4+
#include "multiexp.hpp"
65
#include "msm/msm.hpp"
76
#include <iostream>
87
#include <chrono>
@@ -121,6 +120,11 @@ class Curve {
121120
}
122121

123122
void multiMulByScalar(Point &r, PointAffine *bases, uint8_t* scalars, unsigned int scalarSize, unsigned int n, unsigned int nThreads=0) {
123+
ParallelMultiexp<Curve<BaseField>> pm(*this);
124+
pm.multiexp(r, bases, scalars, scalarSize, n, nThreads);
125+
}
126+
127+
void multiMulByScalarMSM(Point &r, PointAffine *bases, uint8_t* scalars, unsigned int scalarSize, unsigned int n, unsigned int nThreads=0) {
124128

125129
// Original multiexp
126130
// ***************
@@ -155,8 +159,8 @@ class Curve {
155159
// New multiexp
156160
// ***************
157161

158-
MSM<Curve<BaseField>, BaseField> msm(*this);
159-
msm.run(r, bases, scalars, scalarSize, n, nThreads);
162+
MSM<Curve<BaseField>, BaseField> msm(*this, bases, scalars, scalarSize, n);
163+
msm.run(r, nThreads);
160164

161165
// ***************
162166

@@ -167,6 +171,7 @@ class Curve {
167171

168172
}
169173

174+
170175
#ifdef COUNT_OPS
171176
void resetCounters();
172177
void printCounters();
@@ -177,4 +182,3 @@ class Curve {
177182

178183

179184
#include "curve.cpp"
180-

c/multiexp.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,12 @@ void ParallelMultiexp<Curve>::multiexp(typename Curve::Point &r, typename Curve:
129129
return;
130130
}
131131

132-
std::cout << "scalarSize: " << scalarSize << std::endl;
133-
for (uint32_t i=0; i<scalarSize; i++) {
134-
std::cout << "scalar " << i << ": " << (uint64_t)_scalars[i] << std::endl;
135-
}
136-
137132
bitsPerChunk = log2(n / PME2_PACK_FACTOR);
138133
if (bitsPerChunk > PME2_MAX_CHUNK_SIZE_BITS) bitsPerChunk = PME2_MAX_CHUNK_SIZE_BITS;
139134
if (bitsPerChunk < PME2_MIN_CHUNK_SIZE_BITS) bitsPerChunk = PME2_MIN_CHUNK_SIZE_BITS;
140135
nChunks = ((scalarSize*8 - 1 ) / bitsPerChunk)+1;
141136
accsPerChunk = 1 << bitsPerChunk; // In the chunks last bit is always zero.
142137

143-
// prints all information about the process:
144-
std::cout << "*** MSM Initiate *** (threads: " << nThreads << ", window-bits: " << bitsPerChunk << ", windows: " << nChunks << "points: " << n << ") \n";
145-
146138
typename Curve::Point *chunkResults = new typename Curve::Point[nChunks];
147139
accs = new PaddedPoint[nThreads*accsPerChunk];
148140
// std::cout << "InitTrees " << "\n";

c/multiexp.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define PME2_MIN_CHUNK_SIZE_BITS 2
77

88
template <typename Curve>
9-
class ParallelMultiexp { // MSM
9+
class ParallelMultiexp {
1010

1111
struct PaddedPoint {
1212
typename Curve::Point p;

0 commit comments

Comments
 (0)