Skip to content

Commit 496785d

Browse files
authored
update tips and tricks for cuda override
xref: conda-forge/tensorflow-feedstock#174 and conda-forge/blog#52
1 parent f2fd69e commit 496785d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/user/tipsandtricks.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,17 @@ To verify that the correct platform is being used, run the following commands af
130130
131131
python -c "import platform;print(platform.machine())" # Should print "x86_64"
132132
echo "CONDA_SUBDIR: $CONDA_SUBDIR" # Should print "CONDA_SUBDIR: osx-64"
133+
134+
Installing CUDA-enabled packages like TensorFlow and PyTorch
135+
============================================================
136+
137+
In conda-forge, some packages are available with GPU support. These packages not only take significantly longer to compile and build, but they also result in rather large binaries that users download. As an effort to maximize accessibility to users with lower connection and/or storage bandwidth, there is an ongoing effort to limit installing packages compiled for GPU use unnecessarily on CPU machines by default. This is accomplished by adding a run dependency, `__cuda`, that detects if the local machine has a GPU. However, this introduces challenges to people who may prefer to still download and use `-gpu` packages even on a non-GPU machine. For example, login nodes on HPCs often do not have GPUs and the compute counterparts with GPUs often do not have internet access. In this case, the user can still override the default settings via the environemnt variable `CONDA_CUDA_OVERRIDE`. At the time of writing (February 2022), our conclusion is this safe default behavior is best for most of conda-forge users, with an easy override option available. Please let us know if you have thoughts on this.
138+
139+
In order to override the default behavior, a user can set the environemnt variable `CONDA_CUDA_OVERRIDE` like below to install TensorFlow with GPU support even on a machine with CPU only.
140+
141+
.. code-block:: bash
142+
CONDA_CUDA_OVERRIDE="" mamba install tensorflow -c conda-forge
143+
# OR
144+
CONDA_CUDA_OVERRIDE="11.2" mamba install tensorflow -c conda-forge
145+
146+
For context, for TensorFlow 2.7.0, `CONDA_CUDA_OVERRIDE="11.2" mamba install tensorflow -c conda-forge` results in approximately 2 GB to download while `CONDA_CUDA_OVERRIDE="11.2" mamba install tensorflow=2.7.0=cpu* -c conda-forge` results in approximately 200 MB to download. That is a significant storage wasted if one only needs the `-cpu` variant.

0 commit comments

Comments
 (0)