Giter Club home page Giter Club logo

Comments (1)

calebwin avatar calebwin commented on May 23, 2024 3

Hi!

This is not possible at the moment, unfortunately. I recently open-sourced a new version of Emu (not yet published to Crates.io) with significant changes to improve robustness, ease-of-use, and performance. This new version, too, at the moment will use the first device found.

I believe single-GPU, single-threaded is a good default but here is an idea I have for allowing selection, concurrency-

#[gpu_use]
fn main() {
    let mut data = vec![0.0; 1000];

    gpu_do!(load(data));
    gpu_do!(launch());
    for i in 0..1000 {
        data[i] = data[i] + 0.1;
    }
    gpu_do!(read(data));
}
#[gpu_use("nvidia", "nvidia")] // initialize first 2 devices with names containing substring "nvidia"
fn main() {
    let mut a = vec![0.0; 1000];
    let mut b = vec![0.0; 1000];
    let mut c = vec![0.0; 1000];

    gpu_do!(open(1)); // specify that 2nd in initialized list should be used; if not specified, default is 1st in initialized list to be used
    gpu_do!(load_async(a));
    gpu_do!(load_async(b));
    gpu_do!(load_async(c)); // all of a, b, c can be loaded asynchronously
    gpu_do!(await()); // wait for all loading to finish
    gpu_do!(launch()); // this could also be launch_async if we wanted to do something while running on GPU
    for i in 0..1000 {
        c[i] = a[i] + b[i];
    }
    gpu_do!(read_async(data)); // reading can be async while we do some computation until we actually need the data
}

from emu.

Related Issues (20)

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.