Coder Social home page Coder Social logo

lemonclik / snark-challenge-prover-reference Goto Github PK

View Code? Open in Web Editor NEW

This project forked from palem1988/snark-challenge-prover-reference

0.0 1.0 0.0 2.46 MB

License: Other

CMake 0.61% Shell 0.38% Cuda 0.86% C++ 84.71% Python 5.30% Makefile 0.51% Java 0.06% Batchfile 0.15% C 1.18% M4 0.29% Brainfuck 0.02% Gnuplot 0.02% Assembly 5.92%

snark-challenge-prover-reference's Introduction

Groth16 prover

This directory contains a reference CPU implementation of the Groth16 prover using libsnark.

There are two provers implemented in this repository. The first is libsnark/main.cpp, which has the CPU libsnark reference prover that we compare benchmarks against. You can modify this with debug info if you need, but you shouldn't try and add CUDA calls in it.

The other prover is in cuda_prover_piecewise.cu. It also calls the CPU-based libsnark functions, although through a wrapper library to avoid having to include the libsnark headers‡. Once you have GPU implementations of the expensive algorithms (FFT, multiexp), replace the calls to methods in B with calls to your GPU functions. You will probably need to add functions to the wrapper classes (implemented in libsnark/prover_reference_functions.cpp and libsnark/prover_reference_include/prover_reference_functions.hpp) to copy libsnark data into the format you need for CUDA. If you need help dealing with the wrapper functions, ask around in the #snark-challenge discord channel.

Dependencies

The code should compile and run on Ubuntu 18.04 with the following dependencies installed:

sudo apt-get install -y build-essential \
    cmake \
    git \
    libomp-dev \
    libgmp3-dev \
    libprocps-dev \
    python-markdown \
    libboost-all-dev \
    libssl-dev \
    pkg-config \
    nvidia-cuda-toolkit

Building on MacOS is not recommended as CUDA support is harder to use. (Apple mostly ships with AMD.)

Build

./build.sh

Generate parameters and inputs

./generate_parameters

When iterating on your implementation for correctness (and not performance) smaller constraint systems are fine. In that case, ./generate_parameters fast will give you smaller parameters that don't take as long to generate or prove with.

Run

./main MNT4753 compute MNT4753-parameters MNT4753-input MNT4753-output
./main MNT6753 compute MNT6753-parameters MNT6753-input MNT6753-output
./cuda_prover_piecewise MNT4753 compute MNT4753-parameters MNT4753-input MNT4753-output_cuda
./cuda_prover_piecewise MNT6753 compute MNT6753-parameters MNT6753-input MNT6753-output_cuda

Check results

sha256sum MNT4753-output MNT6753-output MNT4753-output_cuda MNT6753-output_cuda

‡ Due to some bug with nvcc in version 10.1, including any of the mnt4/mnt6 libff headers (a library libsnark uses for finite field arithmetic) leads to a compilation failure. The wrapper library uses something like the pImpl idiom to hide the need for those headers from the caller.

snark-challenge-prover-reference's People

Contributors

imeckler avatar jkrauska avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.