pytorch/examples

MNIST Hogwild on Apple Silicon

Open

#1,105 opened on Dec 22, 2022

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Python (21,634 stars) (9,429 forks)batch import
help wanted

Description

Any help would be appreciated! Unable to run multiprocessing with mps device

Context

  • Pytorch version: 2.0.0.dev20221220
  • Operating System and version: macOS 13.1

Your Environment

  • Installed using source? [yes/no]: no
  • Are you planning to deploy it using docker container? [yes/no]: no
  • Is it a CPU or GPU environment?: Trying to use GPU
  • Which example are you using: MNIST Hogwild
  • Link to code or data to repro [if any]: https://github.com/pytorch/examples/tree/main/mnist_hogwild

Expected Behavior

Adding argument --mps should result in training with GPU

Current Behavior

Runtimeerror: share_filename: only available on CPU

Traceback (most recent call last):
  File "/Volumes/Main/pytorch/main.py", line 87, in <module>
    model.share_memory()  # gradients are allocated lazily, so they are not shared here
  File "/Users/jeffreythomas/opt/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2340, in share_memory
    return self._apply(lambda t: t.share_memory_())
  File "/Users/jeffreythomas/opt/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/nn/modules/module.py", line 784, in _apply
    module._apply(fn)
  File "/Users/jeffreythomas/opt/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/nn/modules/module.py", line 807, in _apply
    param_applied = fn(param)
  File "/Users/jeffreythomas/opt/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2340, in <lambda>
    return self._apply(lambda t: t.share_memory_())
  File "/Users/jeffreythomas/opt/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/_tensor.py", line 616, in share_memory_
    self._typed_storage()._share_memory_()
  File "/Users/jeffreythomas/opt/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/storage.py", line 701, in _share_memory_
    self._untyped_storage.share_memory_()
  File "/Users/jeffreythomas/opt/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/storage.py", line 209, in share_memory_
    self._share_filename_cpu_()
RuntimeError: _share_filename_: only available on CPU

Possible Solution

Steps to Reproduce

  1. Clone repo
  2. Run with --mps on Apple M1 Ultra ...

Contributor guide

MNIST Hogwild on Apple Silicon · pytorch/examples#1105 | Good First Issue