mirror of
https://github.com/pseXperiments/icicle.git
synced 2026-01-14 15:37:56 -05:00
ICICLE example: Number Theoretic Transform (NTT) in Rust
Key-Takeaway
ICICLE provides Rust bindings to CUDA-accelerated C++ implementation of Number Theoretic Transform.
Usage
ntt::ntt(
/* input slice */ scalars.as_slice(),
/* NTT Direction */ ntt::NTTDir::kForward,
/* NTT Configuration */ &cfg,
/* output slice */ ntt_results.as_slice()
).unwrap();
In this example we use the BN254 and BLS12377 fields.
What's in this example
- Define the size of NTT.
- Generate random inputs on-host
- Set up the domain.
- Configure NTT
- Execute NTT on-device
- Move the result on host
- Compare results with arkworks
Running the example:
# for CPU
./run.sh -d CPU
# for CUDA
./run.sh -d CUDA -b /path/to/cuda/backend/install/dir