6

I'm about to convert some GPU kernels of my project from OpenCL/Cuda to Metal in order to run my application on Apple devices. Currently, my project was written completely in C/C++. After doing some research, I think I need to get my hand dirty with Swift or Objective-C. But to be honest, I'm not sure about this stuff because Metal language for computation and deep learning is quite new.

I know there's a library called "CoreML", but my app requires some custom kernels. My question: what is the best way to deal with low-level API of Apple devices in my situation?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
dk1111
  • 188
  • 1
  • 5
  • There is also a language variant Objective-C++ supports full c++ with the added smalltalk syntax for dealing with Foundation classes. If you are using the "Core" libraries, the API syntax is C like and not smalltalk like, so it may be possible to not even need to learn swift or Objective-C. – silicontrip Dec 27 '20 at 05:34

1 Answers1

9

The Metal Shading Language is a version of C++. I haven't had too much trouble with porting OpenCL or CUDA kernels to Metal.

Core ML only supports a limited set of layers. You can write your own custom layers, which involves writing a CPU version and optionally a GPU version (in the Metal language).

I wrote a blog post about this: http://machinethink.net/blog/coreml-custom-layers/

Matthijs Hollemans
  • 7,706
  • 2
  • 16
  • 23