Skip to content

Commit

Permalink
Speedywjb (#35)
Browse files Browse the repository at this point in the history
* make sure fstream reader and writer properly call seek. increased FileDisk Read and Write to 64 bit for large buffers

* remove unneeded memory copies in write plot

* rename instead of copy if parent path is the same

* be nicer to ubuntu filesystem

* combine WriteParkToFile writes

* added command line buffer size

* corrected file info
  • Loading branch information
wjblanke authored Jun 4, 2020
1 parent 6eb0a61 commit efbbd55
Show file tree
Hide file tree
Showing 6 changed files with 427 additions and 314 deletions.
5 changes: 3 additions & 2 deletions python-bindings/chiapos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ PYBIND11_MODULE(chiapos, m) {
const std::string tmp2_dir,
const std::string final_dir,
const std::string filename, uint8_t k,
const py::bytes &memo, const py::bytes &id) {
const py::bytes &memo, const py::bytes &id,
uint32_t buffmegabytes) {
std::string memo_str(memo);
const uint8_t* memo_ptr = reinterpret_cast<const uint8_t*>(memo_str.data());
std::string id_str(id);
const uint8_t* id_ptr = reinterpret_cast<const uint8_t*>(id_str.data());
dp.CreatePlotDisk(tmp_dir, tmp2_dir, final_dir, filename, k, memo_ptr, len(memo), id_ptr, len(id));
dp.CreatePlotDisk(tmp_dir, tmp2_dir, final_dir, filename, k, memo_ptr, len(memo), id_ptr, len(id), buffmegabytes);
});

py::class_<DiskProver>(m, "DiskProver")
Expand Down
4 changes: 3 additions & 1 deletion src/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ int main(int argc, char *argv[]) {
string operation = "help";
string memo = "0102030405";
string id = "022fb42c08c12de3a6af053880199806532e79515f94e83461612101f9412f9e";
uint32_t buffmegabytes = 2*1024; // 2 gigabytes

options.allow_unrecognised_options()
.add_options()
Expand All @@ -80,6 +81,7 @@ int main(int argc, char *argv[]) {
("f, file", "Filename", cxxopts::value<string>(filename))
("m, memo", "Memo to insert into the plot", cxxopts::value<string>(memo))
("i, id", "Unique 32-byte seed for the plot", cxxopts::value<string>(id))
("b, buffer", "Megabytes to be used as buffer for sorting and plotting", cxxopts::value<uint32_t>(buffmegabytes))
("help", "Print help");

auto result = options.parse(argc, argv);
Expand Down Expand Up @@ -108,7 +110,7 @@ int main(int argc, char *argv[]) {
HexToBytes(id, id_bytes);

DiskPlotter plotter = DiskPlotter();
plotter.CreatePlotDisk(tempdir, tempdir2, finaldir, filename, k, memo_bytes, memo.size() / 2, id_bytes, 32);
plotter.CreatePlotDisk(tempdir, tempdir2, finaldir, filename, k, memo_bytes, memo.size() / 2, id_bytes, 32, buffmegabytes);
delete[] memo_bytes;
} else if (operation == "prove") {
if (argc < 3) {
Expand Down
Loading

0 comments on commit efbbd55

Please sign in to comment.