Hello
I am trying to use Mac M1 GPU in tensorflow C API.
My code calls tensorflow C API via Rust bindings.
match Library::load("libmetal_plugin.dylib") {
Ok(lib) => println!("Loaded plugin successfully. {:?}", lib.op_list()),
Err(e) => println!("WARNING: Unable to load plugin. {}", e),
};
// Load the saved model exported in python
let mut graph = Graph::new();
let bundle = SavedModelBundle::load(&SessionOptions::new(),
&["serve"],
&mut graph,
export_dir).expect("Unable to load model from disk");
println!("{:?}", bundle.session.device_list().unwrap() );
tensorflow::Library::load internally calls tensorflow C API TF_LoadLibrary to load the plugin. And it does successfully load the plugin.
Then I tried to enumerate the devices by device_list(). Only CPU is there.
[Device { name: "/job:localhost/replica:0/task:0/device:CPU:0", device_type: "CPU", memory_bytes: 268435456, incarnation: 13748960769752595872 }]
GPU does work in tensorflow when I use python to train. Is there some extra work needed to make it work in tensorflow C API?
Tensorflow C library version 2.9.0