Giter VIP home page Giter VIP logo

std's People

Contributors

alex-ozdemir avatar confusesun avatar debris avatar dependabot-preview[bot] avatar howardwu avatar huitseeker avatar huyuncong avatar jon-chuang avatar kobigurk avatar lightyear15 avatar mmagician avatar mmaker avatar paberr avatar pratyush avatar rozbb avatar silathdiir avatar valardragon avatar weikengchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

std's Issues

WASM compilation/Webapp proof of concept

It would be nice if WASM tooling could be added. Short of creating a full webapp, it would be cool if people could simply benchmark performance on their browser. This is related to arkworks-rs/algebra#79 , and the WebGPU benchmarks in browser mode can also be added there.

WASM-specific optimisations may also have to be considered under given compilation options.

I have to investigate how to integrate WebGPU into a WASM compilation pipeline. I don't think it's too hard.

Rename `log2` to `log2_of_next_power_of_two`

Currently, there is a lot of ambiguity in the naming, requiring downstream user to check the original def to get confirmation of what it does. This makes it much clearer.

There is also precedent in the naming in usize methods, for the function next_power_of_two.

algebra_core::io module inconsistent with std::io

When the std feature is on, algebra_core chooses to reexport the std::io library instead of using its own io package. However, some of the implementation in the io package is inconsistent with the std::io library. It might cause some confusion and user has to handle both cases when inconsistency happens.

For example, when user tries to use the Error struct in the io package, when in no_std mode, it is fine to return Err(algebra_core::io::Error), while when the std feature is on it won't compile.

It is because the IO Error implemented by algebra_core is

pub struct Error;

while Error in std::io is

pub struct Error {
    repr: Repr,
}

It might be better to make algebra_core::io more consistent to the standard library, or just use the io package instead of reexporting std::io package regardless of whether std feature is on or off to avoid confusion.

Export `rand::Rng` from `ark_std::rand`

This is related to a number of dependabot's pledges petitions to bump up the version of rand.
arkworks-rs/nonnative#22
arkworks-rs/r1cs-std#31
#15
arkworks-rs/gm17#8
arkworks-rs/algebra#151
arkworks-rs/groth16#19

It would be easy if all these repos use ark_std::rand:... for the needed traits.

In addition, it would be great if we can handle the rand_xorshift in r1cs_std and algebra as well. If we are likely to keep them, it may be useful to import them here as well (since a majority of the repos would use algebra anyway).

`ark_std::error` vs `core::error`

ark_std::error replaces core::error when not using std, but it winds up woefully inferior to the core::error behind #[feature(error_in_core)]. In particular ark_std::error::Error should've the downcast* methods on core::error::Error.

We should probably copy core::error to ark_std::error. Ain't much relevant in the real std::error anymore. If possible, we should detect #[feature(error_in_core)] or even nightly, so as to not replace core::error then.

Interestingly, there were never std::io references in std::error per se. It appears backtrace messed up moving std::error to core::error, but I've no idea why backtrace cannot work with just alloc, or be placed into an extension trait, or whatever.

ark-std does not compile in `no_std`

It seems that ark-std does not compile in no_std, here's the error:

   Compiling ark-std v0.1.0 (https://github.com/arkworks-rs/utils/#423b772d)
error[E0432]: unresolved import `alloc::sync`
Error:   --> /cargo/git/checkouts/utils-540e2bc5e2565ace/423b772/std/src/lib.rs:35:20
   |
35 |     pub use alloc::sync::*;
   |                    ^^^^ could not find `sync` in `alloc`

Investigate parallelization for wasm with `web_worker`

Use web_worker to create a new rayon::ThreadPool to enable parallelization on wasm.

The wasm app will need a initialization for the global ThreadPool, so probably something like this:

fn set_global_pool_to_web_workers() {
    let concurrency = match web_sys::window() {
        Some(window) => window.navigator().hardware_concurrency() as usize,
        None => {
            console_log!("Failed to get hardware concurrency from window. This function is only available in the main browser thread.");
            2
        }
    };
    let worker_pool = pool::WorkerPool::new(concurrency);
    rayon::ThreadPoolBuilder::new()
        .num_threads(concurrency)
        .spawn_handler(|thread| Ok(pool.run(|| thread.run()).unwrap()))
        .build()?;
}

cc @kobigurk @howardwu, this is of interest for speeding up proving and setup ceremonies in the browser.

A new README for utils

Note that this repo we still have the old README from Zexe, and it might be useful to draft a new PR.

Replace `UniformRand` by `CryptoRng + R`

Summary

UniformRand can be replaced by the providers in rand to reduce code complexity

Problem Definition

The base field types need to implement Standard: Distribution<T> as RNG requirement. Example:

https://github.com/arkworks-rs/algebra/blob/master/ec/src/models/short_weierstrass_jacobian.rs#L351-L363

This is superseded by CryptoRng that wraps cryptographic requirements without requiring concrete implementations in T.

Proposal

  • Replace UniformRand by RngCore + CryptoRng
  • Deprecate UniformRand

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Infinite dot when some spawned thread crash which make indent more than 75

โˆ‚

Summary of Bug

I find an issue in my program.
I am trying to spawn thread to run some tasks and the tasks call start_timer and then panic before end_timer. It is normal in my program so I just handle the panic error from thread and try to do other tasks in new spawn threads.
After panic happens some times, my program hang at busy print dot infinitely.

image

Version

Steps to Reproduce

I cannot stable reproduce it but after reviewing the code, I think it is very probably because of the overflow issue when global static INDENT_NUM exceed some number and makes this indent_amount exceed 75 and cause the issue.
https://docs.rs/ark-std/latest/src/ark_std/perf_trace.rs.html#125

After each panic of my spawn thread, I can see more and more dots before Start: and End: logging in my programe and finally if it exceed 75 and the next time when I call a end_timer will trigger the infinitely printing of dot.

Code timing instrumentation

I think it would be nice to have a feature that when activated, will print out the timings for various sub-procedures. A nice standardised format for printing the name of the function and the line numbers could be nice.

When the feature is not activated, this code is not compiled.

The thing I find most annoying is uninstrumenting code, only to discover I want to look at some sub function timings, and I have to reinstrument the code...

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.