1

I am an MacBook M1 user and I am trying to use M1 GPU (MPS) supported by Pytorch. I read that I need to make sure my system is arm64 rather than x86 so I created my env as below:

  CONDA_SUBDIR=osx-arm64 conda create -n nlp2 --clone nlp 

  (nlp2) twang20@C02G82XRQ05N ~ % python --version
  Python 3.9.7
  (nlp2) twang20@C02G82XRQ05N ~ % conda config --env --set subdir 
  osx-arm64
  (nlp2) twang20@C02G82XRQ05N ~ % uname -m
  arm64

However, in torch, when I checked the environment info, it still tells me my architecture is x86-64. I cannot find a way to change it to arm64.

get_pretty_env_info()

Out[2]: 
PyTorch version: 1.12.0.dev20220520
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 11.6.5 (x86_64)
GCC version: Could not collect
Clang version: 13.0.0 (clang-1300.0.29.30)
CMake version: Could not collect
Libc version: N/A
Python version: 3.9.7 (default, Sep 16 2021, 08:50:36)  [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.20.3
[pip3] numpydoc==1.1.0
[pip3] torch==1.12.0.dev20220520
[pip3] torchaudio==0.12.0.dev20220520
[pip3] torchvision==0.13.0.dev20220520
[conda] blas                      

I would expect to see something like this:

OS: macOS 11.6.5 (arm64)
GCC version: Could not collect
Clang version: 13.0.0 (clang-1300.0.29.30)
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.7 (default, Sep 16 2021, 08:50:36)  [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit

How can I make it happen? Thanks.

1
  • Why do you want to change it? Does it not run when you set up as x86
    – Alexander
    Commented May 23, 2022 at 5:26

1 Answer 1

1

Cloning is going to copy/link the packages from the previous environment, which is already x86_64. Instead, you would need to recreate the environment. Something like:

## dump previous environment
conda env export -n nlp --from-history > nlp_x86.yaml

## create new one with temp subdir
CONDA_SUBDIR=osx-arm64 conda env create -n nlp_arm -f nlp_x86.yaml

## permanently set subdir after creation
conda activate nlp_arm
conda config --env --set subdir osx-arm64

However, you'll likely need to edit the YAML to add channels, adjust packages, etc.. For example, some packages may not yet be available.

In particular, the M1 support from PyTorch is still only on nightly builds, so you'll need the pytorch-nightly channel.

Also, note they aren't yet building other PyTorch packages (e.g., torchvision) for osx-arm64, so at the time of this writing, I wouldn't expect full environments to simply swap out to M1 support. Might need to wait for an official release.

Not the answer you're looking for? Browse other questions tagged or ask your own question.