Skip to content

Commit caced4f

Browse files
author
Jason Ramapuram
committed
add get device count to each backend for example
1 parent ab49215 commit caced4f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/unified.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ 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());
2930
let err = set_backend(AfBackend::AF_BACKEND_CPU);
3031
match err {
3132
Ok(_) => test_backend(),
@@ -35,6 +36,7 @@ fn main() {
3536

3637
if available.contains(&AfBackend::AF_BACKEND_CUDA){
3738
println!("Evaluating CUDA Backend...");
39+
println!("There are {} CUDA compute devices", device_count().unwrap());
3840
let err = set_backend(AfBackend::AF_BACKEND_CUDA);
3941
match err {
4042
Ok(_) => test_backend(),
@@ -44,6 +46,7 @@ fn main() {
4446

4547
if available.contains(&AfBackend::AF_BACKEND_OPENCL){
4648
println!("Evaluating OpenCL Backend...");
49+
println!("There are {} OpenCL compute devices", device_count().unwrap());
4750
let err = set_backend(AfBackend::AF_BACKEND_OPENCL);
4851
match err {
4952
Ok(_) => test_backend(),

0 commit comments

Comments
 (0)