Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Selecting GPU for TensorFlow-Metal on Mac Pro (2013) with v0.8.0

Hi everyone,

I'm a Mac enthusiast experimenting with tensorflow-metal on my Mac Pro (2013). My question is about GPU selection in tensorflow-metal (v0.8.0), which still supports Intel-based Macs, including my machine.

I've noticed that when running TensorFlow with Metal, it automatically selects a GPU, regardless of what I specify using device indices like "gpu:0", "gpu:1", or "gpu:2". I'm wondering if there's a way to manually specify which GPU should be used via an environment variable or another method.

For reference, I’ve tried the example from TensorFlow’s guide on multi-GPU selection: https://www.tensorflow.org/guide/gpu#using_a_single_gpu_on_a_multi-gpu_system

My goal is to explore performance optimizations by using MirroredStrategy in TensorFlow to leverage multiple GPUs: https://www.tensorflow.org/guide/distributed_training#mirroredstrategy

Interestingly, I discovered that the metalcompute Python library (https://pypi.org/project/metalcompute/) allows to utilize manually selected GPUs on my system, allowing for proper multi-GPU computations. This makes me wonder:

  1. Is there a hidden environment variable or setting that allows manual GPU selection in tensorflow-metal?
  2. Has anyone successfully used MirroredStrategy on multiple GPUs with tensorflow-metal?
  3. Would a bridge between metalcompute and tensorflow-metal be necessary for this use case, or is there a more direct approach?

I’d love to hear if anyone else has experimented with this or has insights on getting finer control over GPU selection. Any thoughts or suggestions would be greatly appreciated!

Thanks!

Answered by DTS Engineer in 830029022

Near the bottom of the Get started with tensorflow-metal page it says that Multi-GPU support is not available in the current version. I suggest filing an enhancement request asking for Multi-GPU support and the ability to select a specific GPU in tensorflow-metal.

You can file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

Near the bottom of the Get started with tensorflow-metal page it says that Multi-GPU support is not available in the current version. I suggest filing an enhancement request asking for Multi-GPU support and the ability to select a specific GPU in tensorflow-metal.

You can file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

Thanks, here is the case number: FB17123065 (Selecting GPU for TensorFlow-Metal on Mac Pro (2013) with v0.8.0)

Selecting GPU for TensorFlow-Metal on Mac Pro (2013) with v0.8.0
 
 
Q