Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.64 KB

GPUAccOnMac.md

File metadata and controls

47 lines (30 loc) · 1.64 KB

...menustart

...menuend

GPU Accelerate on MacOSX

  • PyTorch AMD (not support MacOSX)

    • The official AMD instructions on building Pytorch is here
  • OpenCL

  • Mac-optimized TensorFlow

    • CATUION: you must import mlcompute , see details below
    • To get started, visit Apple’s GitHub repo for instructions to download and install the Mac-optimized TensorFlow 2.4 fork.
    python3.8 -m venv tf_osx
    source tf_osx/bin/activate
    
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"
    • select compute device
    # Import mlcompute module to use the optional set_mlc_device API for device selection with ML Compute.
    from tensorflow.python.compiler.mlcompute import mlcompute
    
    # Select CPU device.
    mlcompute.set_mlc_device(device_name='cpu') # Available options are 'cpu', 'gpu', and ‘any'.
  • TensofFlow docker

    docker pull tensorflow/tensorflow:latest
    docker run --rm -v `pwd`:/scripts  tensorflow/tensorflow:latest python /scripts/tf_test.py