Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add notes on requirements to run example #13

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

beauwilliams
Copy link

Motivation

Solution

Maybe there is a better way to fix or document this, but for devs currently using a cargo installed by package manager i.e homebrew the example commands will fail. Noting for now mostly if anyone else runs into this too :)
Comment on lines +28 to +29
- Ensure `echo $CC` returns `gcc` #prerequisites i.e apples gcc distributed with xcode and
- Ensure `which gcc` returns `/usr/bin/gcc` (MacOSX users)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Damn. I had no idea $CC and gcc needed to be configured. Just thought xcrun would handle choosing the right stuff. Out of curiosity what happened when these were not configured?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm maybe a little odd :) running gcc-11 because I use some stuff with my neovim that needs it. I would imagine typically this might not be an issue. Afaik typically CC=gcc for standard macos install.

Here is the full trace

❯ $HOME/.cargo/bin/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 serde v1.0.147
   Compiling objc_exception v0.1.2
   Compiling ark-ff v0.3.0 (https://github.com/arkworks-rs/algebra#a4362f92)
   Compiling thiserror v1.0.37
   Compiling textwrap v0.11.0
   Compiling plotters-svg v0.3.3
   Compiling clap_lex v0.2.4
   Compiling heck v0.3.3
   Compiling indexmap v1.9.1
   Compiling ciborium-ll v0.2.0
The following warnings were emitted during compilation:

warning: extern/exception.m: In function 'RustObjCExceptionThrow':
warning: extern/exception.m:5:5: error: '-fobjc-exceptions' is required to enable Objective-C exception syntax
warning:     5 |     @throw exception;
warning:       |     ^~~~~~
warning: extern/exception.m:4:32: warning: parameter 'exception' set but not used [-Wunused-but-set-parameter]
warning:     4 | void RustObjCExceptionThrow(id exception) {
warning:       |                             ~~~^~~~~~~~~

error: failed to run custom build command for `objc_exception v0.1.2`

Caused by:
  process didn't exit successfully: `/Users/admin/Git_Downloads/Web3/Projects/ministark/target/release/build/objc_exception-34f6154be5fcf3f7/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
  CC_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
  CC_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("gcc-11")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
  CFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
  CFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh")
  running: "gcc-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/Users/admin/Git_Downloads/Web3/Projects/ministark/target/release/build/objc_exception-ab1b56d750c21f1f/out/extern/exception.o" "-c" "extern/exception.m"
  cargo:warning=extern/exception.m: In function 'RustObjCExceptionThrow':
  cargo:warning=extern/exception.m:5:5: error: '-fobjc-exceptions' is required to enable Objective-C exception syntax
  cargo:warning=    5 |     @throw exception;
  cargo:warning=      |     ^~~~~~
  cargo:warning=extern/exception.m:4:32: warning: parameter 'exception' set but not used [-Wunused-but-set-parameter]
  cargo:warning=    4 | void RustObjCExceptionThrow(id exception) {
  cargo:warning=      |                             ~~~^~~~~~~~~
  exit status: 1

  --- stderr


  error occurred: Command "gcc-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/Users/admin/Git_Downloads/Web3/Projects/ministark/target/release/build/objc_exception-ab1b56d750c21f1f/out/extern/exception.o" "-c" "extern/exception.m" with args "gcc-11" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
zsh: exit 101   $HOME/.cargo/bin/cargo +nightly run -r -F parallel,asm,gpu --example brainfuc

@beauwilliams
Copy link
Author

beauwilliams commented Nov 17, 2022

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

@andrewmilson
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants