ministark icon indicating copy to clipboard operation
ministark copied to clipboard

fix: add notes on requirements to run example

Open beauwilliams opened this issue 2 years ago • 2 comments

Motivation

Solution

beauwilliams avatar Nov 17 '22 01:11 beauwilliams

To add, here is the trace using gpu flag I mentioned where it failed on my machine. Seems to work without it. Chalking it up to a lib missing somewhere, guessing its CUDA toolchain

cargo +nightly run -r -F parallel,asm,gpu --example brainfuck -- prove ./examples/brainfuck/hello_world.bf --dst ./hello_world.proof
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/admin/Git_Downloads/Web3/Projects/ministark/gpu-poly/Cargo.toml
workspace: /Users/admin/Git_Downloads/Web3/Projects/ministark/Cargo.toml
warning: /Users/admin/Git_Downloads/Web3/Projects/ministark/gpu-poly/Cargo.toml: unused manifest key: target.cfg(target_arch = "aarch64").bench
   Compiling autocfg v1.1.0
   Compiling libc v0.2.137
   Compiling proc-macro2 v1.0.47
   Compiling unicode-ident v1.0.5
   Compiling quote v1.0.21
   Compiling version_check v0.9.4
   Compiling syn v1.0.103
   Compiling cfg-if v1.0.0
   Compiling typenum v1.15.0
   Compiling cc v1.0.74
   Compiling crossbeam-utils v0.8.12
   Compiling either v1.8.0
   Compiling generic-array v0.14.6
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling num-bigint v0.4.3
   Compiling memoffset v0.6.5
   Compiling ppv-lite86 v0.2.16
   Compiling getrandom v0.2.8
   Compiling crossbeam-epoch v0.9.11
   Compiling rand_core v0.6.4
   Compiling ahash v0.7.6
   Compiling rand_chacha v0.3.1
   Compiling serde_derive v1.0.147
   Compiling rand v0.8.5
   Compiling rayon-core v1.9.3
   Compiling unicode-xid v0.2.4
   Compiling once_cell v1.16.0
   Compiling serde v1.0.147
   Compiling block-buffer v0.10.3
   Compiling crypto-common v0.1.6
   Compiling bitflags v1.3.2
   Compiling scopeguard v1.1.0
   Compiling digest v0.10.5
   Compiling itertools v0.10.5
   Compiling core-foundation-sys v0.8.3
   Compiling hashbrown v0.12.3
   Compiling crossbeam-channel v0.5.6
   Compiling ark-std v0.3.0
   Compiling crossbeam-deque v0.8.2
   Compiling num_cpus v1.13.1
   Compiling objc_exception v0.1.2
   Compiling rayon v1.5.3
   Compiling proc-macro-error-attr v1.0.4
   Compiling log v0.4.17
   Compiling foreign-types-shared v0.1.1
   Compiling paste v1.0.9
   Compiling foreign-types v0.3.2
   Compiling core-foundation v0.9.3
   Compiling malloc_buf v0.0.6
   Compiling sha2-asm v0.6.2
   Compiling indexmap v1.9.1
   Compiling proc-macro-error v1.0.4
   Compiling serde_json v1.0.87
   Compiling synstructure v0.12.6
   Compiling core-graphics-types v0.1.1
   Compiling objc v0.2.7
   Compiling atty v0.2.14
   Compiling itoa v1.0.4
   Compiling os_str_bytes v6.3.1
   Compiling thiserror v1.0.37
   Compiling unicode-width v0.1.10
   Compiling anyhow v1.0.66
   Compiling plotters-backend v0.3.4
   Compiling unicode-segmentation v1.10.0
   Compiling half v1.8.2
   Compiling block v0.1.6
   Compiling ryu v1.0.11
   Compiling ciborium-io v0.2.0
   Compiling ciborium-ll v0.2.0
   Compiling plotters-svg v0.3.3
   Compiling heck v0.3.3
   Compiling metal v0.24.0 (https://github.com/gfx-rs/metal-rs#1354dbc9)
   Compiling clap_lex v0.2.4
   Compiling textwrap v0.11.0
   Compiling strsim v0.8.0
   Compiling regex-syntax v0.6.27
   Compiling cpufeatures v0.2.5
   Compiling same-file v1.0.6
   Compiling lazy_static v1.4.0
   Compiling textwrap v0.16.0
   Compiling vec_map v0.8.2
   Compiling cast v0.3.0
   Compiling ansi_term v0.12.1
   Compiling clap v3.2.23
   Compiling walkdir v2.3.2
   Compiling sha2 v0.10.6
   Compiling ark-std v0.3.0 (https://github.com/arkworks-rs/std#7019830e)
   Compiling zeroize_derive v1.3.2
   Compiling ark-serialize-derive v0.3.0 (https://github.com/arkworks-rs/algebra#a4362f92)
   Compiling derivative v2.2.0
   Compiling ark-ff-macros v0.3.0 (https://github.com/arkworks-rs/algebra#a4362f92)
   Compiling ark-ff-asm v0.3.0 (https://github.com/arkworks-rs/algebra#a4362f92)
   Compiling thiserror-impl v1.0.37
   Compiling ark-serialize v0.3.0 (https://github.com/arkworks-rs/algebra#a4362f92)
   Compiling zeroize v1.5.7
   Compiling regex v1.6.0
   Compiling structopt-derive v0.4.18
   Compiling clap v2.34.0
   Compiling criterion-plot v0.5.0
   Compiling ark-ff v0.3.0 (https://github.com/arkworks-rs/algebra#a4362f92)
   Compiling plotters v0.3.4
   Compiling anes v0.1.6
   Compiling oorandom v11.1.3
   Compiling structopt v0.3.26
   Compiling ciborium v0.2.0
   Compiling tinytemplate v1.2.1
   Compiling criterion v0.4.0
   Compiling ark-poly v0.3.0 (https://github.com/andrewmilson/algebra?branch=vec-allocator#5faa1668)
   Compiling ark-ff-optimized v0.1.1 (https://github.com/andrewmilson/optimized-fields#75376076)
   Compiling gpu-poly v0.1.0 (/Users/admin/Git_Downloads/Web3/Projects/ministark/gpu-poly)
warning: unused import: `std::mem::size_of`
 --> gpu-poly/src/utils.rs:4:5
  |
4 | use std::mem::size_of;
  |     ^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: constant `MIN_THREADGROUP_FFT_SIZE` is never used
   --> gpu-poly/src/utils.rs:141:7
    |
141 | const MIN_THREADGROUP_FFT_SIZE: usize = 1024;
    |       ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: function `void_ptr` is never used
   --> gpu-poly/src/utils.rs:165:15
    |
165 | pub(crate) fn void_ptr<T>(v: &T) -> *const std::ffi::c_void {
    |               ^^^^^^^^

   Compiling ministark v0.1.0 (/Users/admin/Git_Downloads/Web3/Projects/ministark)
error[E0433]: failed to resolve: use of undeclared type `GpuFft`
   --> src/fri.rs:534:25
    |
534 |     if domain.size() >= GpuFft::<F>::MIN_SIZE {
    |                         ^^^^^^ use of undeclared type `GpuFft`

error[E0433]: failed to resolve: use of undeclared type `GpuIfft`
   --> src/fri.rs:536:24
    |
536 |         let mut ifft = GpuIfft::from(domain);
    |                        ^^^^^^^ use of undeclared type `GpuIfft`

error[E0433]: failed to resolve: use of undeclared type `GpuFft`
   --> src/fri.rs:548:25
    |
548 |     if domain.size() >= GpuFft::<F>::MIN_SIZE {
    |                         ^^^^^^ use of undeclared type `GpuFft`

error[E0433]: failed to resolve: use of undeclared type `GpuFft`
   --> src/fri.rs:550:23
    |
550 |         let mut fft = GpuFft::from(domain);
    |                       ^^^^^^ use of undeclared type `GpuFft`

error[E0433]: failed to resolve: use of undeclared type `GpuIfft`
  --> src/matrix.rs:87:24
   |
87 |         let mut ifft = GpuIfft::from(domain);
   |                        ^^^^^^^ use of undeclared type `GpuIfft`

error[E0433]: failed to resolve: use of undeclared type `GpuFft`
   --> src/matrix.rs:130:23
    |
130 |         let mut fft = GpuFft::from(domain);
    |                       ^^^^^^ use of undeclared type `GpuFft`

error[E0433]: failed to resolve: use of undeclared type `AddAssignStage`
   --> src/matrix.rs:200:25
    |
200 |             let adder = AddAssignStage::<F>::new(library, n);
    |                         ^^^^^^^^^^^^^^ use of undeclared type `AddAssignStage`

error[E0433]: failed to resolve: use of undeclared type `MulPowStage`
   --> src/matrix.rs:435:22
    |
435 |         let mul_fp = MulPowStage::<Fp>::new(library, n);
    |                      ^^^^^^^^^^^ use of undeclared type `MulPowStage`

error[E0433]: failed to resolve: use of undeclared type `MulPowStage`
   --> src/matrix.rs:436:22
    |
436 |         let mul_fq = MulPowStage::<Fq>::new(library, n);
    |                      ^^^^^^^^^^^ use of undeclared type `MulPowStage`

error[E0433]: failed to resolve: use of undeclared type `MulPowStage`
   --> src/matrix.rs:437:28
    |
437 |         let mul_fq_by_fp = MulPowStage::<Fq, Fp>::new(library, n);
    |                            ^^^^^^^^^^^ use of undeclared type `MulPowStage`

error[E0433]: failed to resolve: use of undeclared type `FillBuffStage`
   --> src/matrix.rs:438:23
    |
438 |         let fill_fq = FillBuffStage::<Fq>::new(library, n);
    |                       ^^^^^^^^^^^^^ use of undeclared type `FillBuffStage`

error[E0433]: failed to resolve: use of undeclared type `FillBuffStage`
   --> src/matrix.rs:439:23
    |
439 |         let fill_fp = FillBuffStage::<Fp>::new(library, n);
    |                       ^^^^^^^^^^^^^ use of undeclared type `FillBuffStage`

error[E0433]: failed to resolve: use of undeclared type `AddAssignStage`
   --> src/matrix.rs:440:22
    |
440 |         let add_fq = AddAssignStage::<Fq>::new(library, n);
    |                      ^^^^^^^^^^^^^^ use of undeclared type `AddAssignStage`

error[E0425]: cannot find value `PLANNER` in this scope
   --> src/matrix.rs:195:28
    |
195 |             let library = &PLANNER.library;
    |                            ^^^^^^^ not found in this scope

error[E0425]: cannot find value `PLANNER` in this scope
   --> src/matrix.rs:196:34
    |
196 |             let command_queue = &PLANNER.command_queue;
    |                                  ^^^^^^^ not found in this scope

error[E0425]: cannot find value `PLANNER` in this scope
   --> src/matrix.rs:430:24
    |
430 |         let library = &PLANNER.library;
    |                        ^^^^^^^ not found in this scope

error[E0425]: cannot find value `PLANNER` in this scope
   --> src/matrix.rs:431:30
    |
431 |         let command_queue = &PLANNER.command_queue;
    |                              ^^^^^^^ not found in this scope

warning: `gpu-poly` (lib) generated 3 warnings (run `cargo fix --lib -p gpu-poly` to apply 1 suggestion)
error[E0425]: cannot find function `buffer_mut_no_copy` in this scope
   --> src/matrix.rs:199:42
    |
199 |             let mut accumulator_buffer = buffer_mut_no_copy(device, &mut accumulator);
    |                                          ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `buffer_no_copy` in this scope
   --> src/matrix.rs:202:37
    |
202 |                 let column_buffer = buffer_no_copy(command_queue.device(), column);
    |                                     ^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `buffer_mut_no_copy` in this scope
   --> src/matrix.rs:444:24
    |
444 |             .map(|col| buffer_mut_no_copy(device, col))
    |                        ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `buffer_mut_no_copy` in this scope
   --> src/matrix.rs:449:37
    |
449 |         let mut scratch_fp_buffer = buffer_mut_no_copy(command_queue.device(), &mut scratch_fp);
    |                                     ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `buffer_mut_no_copy` in this scope
   --> src/matrix.rs:453:37
    |
453 |         let mut scratch_fq_buffer = buffer_mut_no_copy(command_queue.device(), &mut scratch_fq);
    |                                     ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `buffer_no_copy` in this scope
   --> src/matrix.rs:457:33
    |
457 |                 Col::Fp(col) => buffer_no_copy(command_queue.device(), col),
    |                                 ^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `buffer_no_copy` in this scope
   --> src/matrix.rs:458:33
    |
458 |                 Col::Fq(col) => buffer_no_copy(command_queue.device(), col),
    |                                 ^^^^^^^^^^^^^^ not found in this scope

Some errors have detailed explanations: E0425, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `ministark` due to 24 previous errors
warning: build failed, waiting for other jobs to finish...
zsh: exit 101   cargo +nightly run -r -F parallel,asm,gpu --example brainfuck -- prove  --dst

beauwilliams avatar Nov 17 '22 08:11 beauwilliams

@beauwilliams thanks for the trace. What Mac do you have? For now the --feature gpu is only supported on M1 Macs.

In theory the gpu stuff should work on older macs but I just couldn't get it to work. I was originally developing miniSTARK on an older mac with a Radeon Pro GPU. Everything compiled but when I ran it it just didn't work as expected. I filed a bug with Apple at the time but never heard back. I was so fed up it's why I bought a M1 Mac and more or less everything has been working since then.

andrewmilson avatar Nov 18 '22 04:11 andrewmilson