From 37f28b8ef0ab9b9a7e3f629533900894da8b3083 Mon Sep 17 00:00:00 2001 From: Felix Soubelet <felix.soubelet@protonmail.com> Date: Tue, 27 Dec 2022 18:31:57 +0100 Subject: [PATCH 1/3] typos and co --- docs/guides/apple_silicon.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/guides/apple_silicon.md b/docs/guides/apple_silicon.md index 3112df7..cd4f970 100644 --- a/docs/guides/apple_silicon.md +++ b/docs/guides/apple_silicon.md @@ -1,11 +1,11 @@ # Apple Silicon Machines With their Apple Silicon chips, the Apple machines have moved to an `arm64` architecture (from the `x86-64` of the Intel ones). -While the new chips are a great upgrade on their Intel counterparts, the new architecture involves some caveats and requires a transition from most softwares to run natively. +While the new chips are a great upgrade on their Intel counterparts, the new architecture involves some caveats and requires a transition from most pieces of software to run natively. Thankfully, all programs meant for the retired Intel `x86-64` chips can be run through [Rosetta 2][rosetta2], a translation layer provided by Apple. -The following link is a useful resource to see which apps and softwares are optmised for Apple Silicon devices: https://isapplesiliconready.com/. +The following link is a useful resource to see which apps and pieces of software are optimized for Apple Silicon devices: https://isapplesiliconready.com/. ### Rosetta 2 @@ -26,8 +26,8 @@ The easiest way to handle your Python virtual environments is to use `miniforge` Don't know what a **virtual environment** is or what purpose it serves? Here is a good (but lengthy) [primer on virtual environments][virtual_env_primer]{target=_blank} by RealPython. -The [Github page of Miniforge][miniforge] contains download links to their installers for various configurations (conda/mamba, CPython/Pypy, amd64/arm64/macos-arm64 etc). -I personnaly recommend the `mambaforge` distributions, as the `mamba` tool is an amazing alternative to `conda` that one would be missing out on. +The [GitHub page of Miniforge][miniforge] contains download links to their installers for various configurations (conda/mamba, CPython/Pypy, amd64/arm64/macos-arm64 etc.). +I personally recommend the `mambaforge` distributions, as the `mamba` tool is an amazing alternative to `conda` that one would be missing out on. !!! tip "Intel-Type Python Environments" @@ -51,9 +51,9 @@ As `MAD-X` does not run natively on Apple Silicon chips, neither does `cpymad`. As a consequence, in order to install `cpymad` on Apple Silicon, one needs to create an `osx-64`-type architecture environment in which to install the package. For instructions on how to do so, see the **Intel-Type Python Environments** tooltip in the [Python Setup](#python-setup) section. -### Tensorflow on Silicon GPU +### TensorFlow on Silicon GPU -In version `2.5`, Tensorflow has introduced the [PluggableDevice][pluggable_device_blog] plugins API, which Apple has used to provide a plugin to make `tensorflow` aware of the GPU available on Apple Silicon chips. +In version `2.5`, TensorFlow has introduced the [PluggableDevice][pluggable_device_blog] plugins API, which Apple has used to provide a plugin to make `tensorflow` aware of the GPU available on Apple Silicon chips. If one has a `miniforge` or `mambaforge` setup as instructed in the [Python Setup](#python-setup) above, creating a Python 3.9 environment to make use of `tensorflow` natively, running on the Apple Silicon GPU, is as simple as: ```bash @@ -65,7 +65,7 @@ python -m pip install --upgrade tensorflow-metal # PluggableDevice plugin ``` That's it! -There is nothing more to do, Tensorflow will automatically detect the GPU and will use it for computations. +There is nothing more to do, TensorFlow will automatically detect the GPU and will use it for computations. ??? success "Verifying the Install" One can test that the installation has made `tensorflow` aware of the Apple Silicon GPU by running the following script: @@ -127,7 +127,7 @@ python -m pip install --pre torch torchvision torchaudio --extra-index-url https ``` ??? info "Making PyTorch use the GPU" - The PyTorch integration with Metal is not as seamless as the Tensorflow one, and just like with any other accelerators, PyTorch requires you to explicitely set the `device` for calculations. + The PyTorch integration with Metal is not as seamless as the TensorFlow one, and just like with any other accelerators, PyTorch requires you to explicitly set the `device` for calculations. To use the Apple Silicon GPU, one has to specify the device as `mps` (Metal Performance Shaders) in either the `torch.device` constructor, or when creating tensors: ```python import torch @@ -174,7 +174,7 @@ Here is [a guide](https://wikis.cern.ch/display/CONT/Containerisation+Guide+and+ ### AFS -The `Auristor` filesystem works on Apple Silicon and can enable one to access `AFS`. +The `Auristor` file system works on Apple Silicon and can enable one to access `AFS`. A step-by-step guide is available at the [following link](https://blog.auristor.com/2021/01/installing-auristorfs-clients-for-macos.html). !!! danger "Here Be Demons!" -- GitLab From b8cf98fc1496f84404848ee7f18eb88eea9d354a Mon Sep 17 00:00:00 2001 From: Felix Soubelet <felix.soubelet@protonmail.com> Date: Tue, 27 Dec 2022 18:33:20 +0100 Subject: [PATCH 2/3] update in tensorflow section --- docs/guides/apple_silicon.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/apple_silicon.md b/docs/guides/apple_silicon.md index cd4f970..971a0b5 100644 --- a/docs/guides/apple_silicon.md +++ b/docs/guides/apple_silicon.md @@ -106,7 +106,7 @@ There is nothing more to do, TensorFlow will automatically detect the GPU and wi ``` !!! info "" - Note that the device is created with `0 MB memory`, which is normal since the Apple Silicon GPU shares a unified memory with the CPU and does not have a dedicated device memory. + Note that the device is detected with `0 MB memory`, which is normal since the Apple Silicon GPU shares a unified memory with the CPU and does not have a dedicated device memory. Additionally, one can open the Activity Monitor during the model training and confirm that the Python process gets a high percentage value in the `GPU` column. -- GitLab From f88b6fcd1c1ce47a22f1de142c8bcaea9f757ac1 Mon Sep 17 00:00:00 2001 From: Felix Soubelet <felix.soubelet@protonmail.com> Date: Tue, 27 Dec 2022 18:34:15 +0100 Subject: [PATCH 3/3] update as pytorch 1.12 is no longer nightly --- docs/guides/apple_silicon.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/guides/apple_silicon.md b/docs/guides/apple_silicon.md index 971a0b5..f694808 100644 --- a/docs/guides/apple_silicon.md +++ b/docs/guides/apple_silicon.md @@ -121,11 +121,6 @@ conda activate pytorch python -m pip install torch torchvision torchaudio ``` -As the `1.12` version is currently a nightly build, the impatient can install it with: -```bash -python -m pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu -``` - ??? info "Making PyTorch use the GPU" The PyTorch integration with Metal is not as seamless as the TensorFlow one, and just like with any other accelerators, PyTorch requires you to explicitly set the `device` for calculations. To use the Apple Silicon GPU, one has to specify the device as `mps` (Metal Performance Shaders) in either the `torch.device` constructor, or when creating tensors: -- GitLab