Skip to content

Commit 0b32518

Browse files
author
Jason Ramapuram
committed
the get backend count should go after the set backend
1 parent caced4f commit 0b32518

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/unified.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ fn main() {
2626

2727
if available.contains(&AfBackend::AF_BACKEND_CPU){
2828
println!("Evaluating CPU Backend...");
29-
println!("There are {} CPU compute devices", device_count().unwrap());
3029
let err = set_backend(AfBackend::AF_BACKEND_CPU);
30+
println!("There are {} CPU compute devices", device_count().unwrap());
3131
match err {
3232
Ok(_) => test_backend(),
3333
Err(e) => println!("CPU backend error: {}", e),
@@ -36,8 +36,8 @@ fn main() {
3636

3737
if available.contains(&AfBackend::AF_BACKEND_CUDA){
3838
println!("Evaluating CUDA Backend...");
39-
println!("There are {} CUDA compute devices", device_count().unwrap());
4039
let err = set_backend(AfBackend::AF_BACKEND_CUDA);
40+
println!("There are {} CUDA compute devices", device_count().unwrap());
4141
match err {
4242
Ok(_) => test_backend(),
4343
Err(e) => println!("CUDA backend error: {}", e),
@@ -46,8 +46,8 @@ fn main() {
4646

4747
if available.contains(&AfBackend::AF_BACKEND_OPENCL){
4848
println!("Evaluating OpenCL Backend...");
49-
println!("There are {} OpenCL compute devices", device_count().unwrap());
5049
let err = set_backend(AfBackend::AF_BACKEND_OPENCL);
50+
println!("There are {} OpenCL compute devices", device_count().unwrap());
5151
match err {
5252
Ok(_) => test_backend(),
5353
Err(e) => println!("OpenCL backend error: {}", e),

0 commit comments

Comments
 (0)