Search code examples
xcodegpuwatchoscoreml

WatchOS + CoreML


hello.

I'm trying to run my CoreML model on Apple Watch 3. Now I have ~160% cpu usage, so I have a delay in recognition.

Is there a way to use GPU?

I'm trying to set 'useCPUOnly = false' and MLModelConfiguration 'computeUnits = .all'. Nothing helps.

func prediction(data: MLMultiArray) throws -> ModelOutputProtocol {
    let options = MLPredictionOptions()
    options.usesCPUOnly = false
    let input = ModelInput(windows: data)
    return try prediction(input: input, options: options)
}


let config = MLModelConfiguration()
config.computeUnits = .all
try model = Model(contentsOf: url, configuration: config)

So in CPU usage I see 160%, in GPU I see 0.

And yes, I use foreground mode.


Solution

  • I don't think Apple Watch 3 has a GPU, it might be showing that to you just because newer ones have. See this wiki page.