Skip to content

wtnb75/runmetal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

runmetal: Apple Metal(GPU) Framework caller

  • 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)

(released version)

  • pip install runmetal

usage(runmetal command)

Usage: runmetal [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  compile
  lsdev
  mtlinfo
  run
  • compile
    • precompile source in YAML to .metallib
    • ... may not work (depends on your environment)
  • lsdev
    • list GPU device
  • mtlinfo
  • run
    • run recipe

examples(YAML)

  • pi
    • calculate π by monte carlo
      • numpy.random.random()
      • -> copy numpy to GPU buffer
      • -> compute sqrt(x*x+y*y) < 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)
    • runmetal run example/rand.yaml

examples(python)

About

Python + Apple Metal Framework = ?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published