runmetal

run Apple Metal framework


Keywords
apple, metal, gpu
License
MIT
Install
pip install runmetal==0.1

Documentation

runmetal: call Apple Metal Framework from Python (or YAML-recipe)

  • numpy array -> GPU buffer -> compute -> copy result into numpy array

requirements

  • macOS
  • Xcode (or CommandLineTools)
    • Metal Framework
  • Python 3.x

install

(python)

  • brew install pyenv
  • pyenv install 3.7.1

(venv)

  • python -m venv .
  • ./bin/pip install -r requirements.txt
  • ./bin/python setup.py install
  • ./bin/runmetal run example/xxx.yaml

examples(YAML)

  • pi
    • calculate π by monte carlo
      • numpy.random.random()
      • -> copy numpy to GPU buffer
      • -> compute sqrt(xx+yy) < 1.0
      • -> copy GPU buffer to numpy bool8 array
      • numpy.sum(result == True)/len(result)*4
    • runmetal run example/pi.yaml
  • rand
    • random number generator (LCG)

examples(python)

TBD