Installing Bluefog

Bluefog currently supports MacOS and Linux only.

Installing Bluefog from Pip (CPU)

Installing from pip should be sufficient for most Bluefog users. However, our implementation highly independent on the MPI and other libraries. Please make sure that python>=3.7 and gcc>=4.0 and supporting std=C++11 in your development environment. We recommend using conda as python environment control. Most dependent python package should be automatically installed through the pip. Lastly, we relied on the MPI implementation, please install open-mpi>=4.0 download link and instruction for CPU usage. After you think the environment is all set, just run following command to install Bluefog:

pip install --no-cache-dir bluefog

Note

We haven’t fully tested our compatiblity with hisotrical torch versions. It is guaranteed at least for torch==1.4.0 and torchvision==0.5.0 case. Remember if the torch version is changed, you have to re-install bluefog completely.

Note

If --no-cache-dir is not present, you may receive the error information like Failed building wheel for bluefog, which won’t fail the installation though. The reason is Bluefog is a library with C-extention, which needs to be built on your system. Check this stack overflow answer if you are interested.

Installing Bluefog from Pip (GPU)

All steps for GPU case are the same as CPU case except for the OpenMPI installation. In order to get full support of GPU, you have to install CUDA>=10.1 and install pytorch with the GPU support version. It is highly recommended to use NCCL instead of OpenMPI as GPU communication implementation. We require the NCCL>=2.7 since our implementation heavily relied on the new ncclSend and ncclRecv API introduced after version 2.7. To install Bluefog with NCCL implementation, you need to run

BLUEFOG_WITH_NCCL=1 pip install --no-cache-dir bluefog

You can also install the GPU-aware OpenMPI as GPU communication implementation. To do that, you can configure the open install setting after the download of OpenMPI:

./configure --prefix={YOUR_OWN_PREFIX} --with-cuda && \
make -j $(nproc) all && \
make install

Installing Bluefog from Github Directly

Important

The lastest functionality may not be able avaiable through pip install bluefog. Installing from Github is better during our early development stage.

First, please check your environment as mentioned in above subsections. Then, clone or download the bluefog repository from Github. Last, just run the following command under the root folder of bluefog repository:

pip install .

Use Bluefog through Docker

The docker image for Bluefog can be accessed through Docker Hub. For more details, check Bluefog Docker Usage page.

  1. Download docker image with CUDA support:

sudo docker pull bluefoglib/bluefog:gpu-0.2.2
  1. Download docker image with only CPU support:

sudo docker pull bluefoglib/bluefog:cpu-0.2.2