forked from filecoin-project/ec-gpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add clman source generation config
- Loading branch information
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
version: 0.1.0 | ||
dyns: | ||
ff.cl: | ||
dockerfile: gen.Dockerfile | ||
args: "$FIELD_NAME $FIELD_MODULUS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM rust:1.31 | ||
WORKDIR /usr/src/ff-cl-gen | ||
RUN USER=root cargo init --bin | ||
COPY ./rust-toolchain ./rust-toolchain | ||
RUN cargo build --release | ||
COPY ./Cargo.toml ./Cargo.toml | ||
RUN cargo fetch | ||
COPY ./src ./src | ||
RUN cargo build --release | ||
RUN apt-get update && apt-get install nano | ||
RUN echo '\ | ||
extern crate rand_core; \n#\ | ||
[macro_use] \n\ | ||
extern crate fff; \n\ | ||
use fff::{Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr}; \n#\ | ||
[derive(PrimeField)] \n#\ | ||
[PrimeFieldModulus = "FIELD_MODULUS"] \n#\ | ||
[PrimeFieldGenerator = "7"] \n\ | ||
struct Fp(FpRepr); \n\ | ||
fn main() { \n\ | ||
println!("{}", ff_cl_gen::field::<Fp>("FIELD_NAME")); \n\ | ||
}' > ./src/main.rs | ||
|
||
RUN echo '\ | ||
rm -rf ./target/release/ff-cl-gen > /dev/null 2>&1 \n\ | ||
sed -i "s/FIELD_NAME/$1/g" src/main.rs > /dev/null 2>&1 \n\ | ||
sed -i "s/FIELD_MODULUS/$2/g" src/main.rs > /dev/null 2>&1 \n\ | ||
cargo build --release > /dev/null 2>&1 \n\ | ||
./target/release/ff-cl-gen' > ./gen.sh | ||
|
||
ENTRYPOINT ["sh", "./gen.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use ff::PrimeField; | ||
use fff::PrimeField; | ||
use itertools::*; | ||
use num_bigint::BigUint; | ||
|
||
|