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

No adapter found for graphics API AutoGraphicsApi #1691

Open
wangjiawen2013 opened this issue Apr 25, 2024 · 1 comment
Open

No adapter found for graphics API AutoGraphicsApi #1691

wangjiawen2013 opened this issue Apr 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wangjiawen2013
Copy link

Hi,
I am trying to run burn according to the burn book example (https://burn.dev/book/getting-started.html), but it displayed "No adapter found for graphics API AutoGraphicsApi".

this is the Cargo.toml:

[package]
name = "my_burn_app"
version = "0.1.0"
edition = "2021"

[dependencies]
burn = { version = "0.13.0", features = ["wgpu"] }

And this is the main function:

use burn::tensor::Tensor;
use burn::backend::Wgpu;

// Type alias for the backend to use.
type Backend = Wgpu;

fn main() {
    let device = Default::default();
    // Creation of two tensors, the first with explicit values and the second one with ones, with the same shape as the first
    let tensor_1 = Tensor::<Backend, 2>::from_data([[2., 3.], [4., 5.]], &device);
    let tensor_2 = Tensor::<Backend, 2>::ones_like(&tensor_1);

    // Print the element-wise addition (done with the WGPU backend) of the two tensors.
    println!("{}", tensor_1 + tensor_2);
}

When I run it using cargo run, the following error occurred:

[wangjw@localhost my_burn_app]$ cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.23s
     Running `target/debug/my_burn_app`
thread 'main' panicked at /home/wangjw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/burn-wgpu-0.13.0/src/runtime.rs:278:17:
No adapter found for graphics API AutoGraphicsApi
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@laggui
Copy link
Member

laggui commented Apr 25, 2024

For wgpu you might need to install the correct graphics drivers depending on what you want to target. By default, the AutoGraphicsApi targets metal on MacOs and vulkan on other operating systems. For vulkan you can do apt install vulkan (and possibly vulkan-tools if you want to validate the installation).

If you want to use another graphics API you can be explicit when using the wgpu backend. For example, the guide defines the backend as

type MyBackend = Wgpu<AutoGraphicsApi, f32, i32>;

But if you explicitly want to target OpenGl, you can use this instead

type MyBackend = Wgpu<OpenGl, f32, i32>;

with use burn::backend::wgpu::OpenGl;.

@antimora antimora added the bug Something isn't working label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants