microsoft / microsoft/qlib

macos mps device support in benchmarks

Open
#2,050 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

🌟 Feature Description

macos mps device support in benchmarks

Motivation

It would be great to add support for macOS's MPS device.
By default, PyTorch models use CUDA (if available) or CPU, which isn’t very user-friendly for macOS devices with MPS acceleration.
The current device configuration code is:

self.device = "cuda:%s" % (GPU) if torch.cuda.is_available() and GPU >= 0 else "cpu"

To enable MPS support, we could modify the code as follows:

USE_CUDA = torch.cuda.is_available() and GPU >= 0
USE_MPS = torch.backends.mps.is_available()
self.device = torch.device(f'cuda:{GPU}' if USE_CUDA else ('mps' if USE_MPS else 'cpu'))

Alternatively, should we let users configure the device directly via a YAML parameter for more flexibility?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the benchmark device configuration corresponding to the CUDA/CPU code shown in the issue, then inspect how benchmark devices are selected and whether YAML configuration already exists. Done means macOS benchmarks can select and use MPS without breaking CUDA or CPU fallback; the issue does not name a test file or benchmark entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.