Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing instructions for developing and using c3-toolset with Apple Silicon #164

Closed
lazyoracle opened this issue Dec 25, 2021 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@lazyoracle
Copy link
Member

lazyoracle commented Dec 25, 2021

Describe the bug

There are no clear guidelines on how to go about installing or setting up a development environment on Apple Silicon devices eg, the M1 Macbook.

To Reproduce

  • pip install c3-toolset fails on Apple Silicon due to missing dependencies
  • Instructions for setup provided in CONTRIBUTING.md also do not work

Expected behavior

Straightforward way to install or setup dev machine on Apple Silicon

Screenshots

N/A

Environment (please complete the following information)

  • OS: macOS 12.1 Monterey (M1 Macbook Pro 13 inch 2020)
  • Python Version: 3.8
  • c3-toolset Version: 1.4

Additional context

Why do we care about Apple Silicon?

Mostly, because of performance. Here are some crude benchmarks (SHA: af38dae) using:

  • the full c3-toolset test suite invoked with pytest test/
  • the optimization of a two-qubit entangling gate with jupyter nbconvert --to notebook --execute --inplace examples/two_qubit_entangling_gate.ipynb
Architecture OS Configuration Test suite Entangling gate
x86_64 GNU/Linux 24 cores (2x AMD Ryzen 9 3900X) at 2.8GHz, 128 GiB RAM 457 s 448 s
x86_64 macOS 12.1 2019 Macbook Pro 13-in, 2.8GHz Quad-Core Intel Core i7, 16 GiB RAM 395 s 440 s
arm64 macOS 12.1 2020 Macbook Pro 13-in, Apple M1 Chip, 16 GiB RAM 128 s 169 s

Suggested development setup

  1. Install Miniforge on your Apple Silicon Mac (https://github.com/conda-forge/miniforge)
  2. Create a new conda environment (conda create --name=c3-dev python=3.8)
  3. Install the latest tensorflow from conda-forge conda install tensorflow -c conda-forge
  4. Install the corresponding version of tensorflow-probability that matches the version of tensorflow
  5. Install separately the different qiskit submodules (instead of the metapackage) Ref: Install qiskit in ci env Qiskit/qiskit#1201
  6. Use pip to install the rest of the requirements from the requirements.txt file after relaxing all the pinned versions
  7. Edit the setup.py file to remove all the dependencies under install_requires=
  8. Install c3-toolset in development mode using pip install -e .
@lazyoracle lazyoracle added the documentation Improvements or additions to documentation label Dec 25, 2021
@lazyoracle lazyoracle self-assigned this Dec 25, 2021
@lazyoracle
Copy link
Member Author

lazyoracle commented Dec 27, 2021

As of December 27, 2021 the following steps should create an all-inclusive development setup on Apple Silicon Macs with slightly less trouble:

  1. Setup miniforge from here.
  2. Get the required conda environment file by running wget https://gist.githubusercontent.com/lazyoracle/d62f535787605d85019d5ecf649a11ab/raw/environment-c3-dev-m1.yml.
  3. Run conda env create -f environment-c3-dev-m1.yml to create a new conda environment.

@lazyoracle lazyoracle added this to the 1.5 milestone Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant