Skip to content

Commit

Permalink
Further improvements to fl CI in open source
Browse files Browse the repository at this point in the history
Summary:
Updates CI infrastructure and configuration for flashlight.

Start using `gpu.small` (`p3.2xlarge`) instances on AWS vis-a-vis CircleCI with the built-in `ubuntu-1604:201903-01` image.

> It looks like we're downloading and installing CUDA, Docker, and NVIDIA Docker - why??

Unfortunately, CircleCI's VM images, even if they do have NVIDIA/CUDA drivers on them, don't support running a Docker image with nvidia-docker (flags need to be passed at the Docker invocation at runtime). We're forced to install CUDA and nvidia-docker as a result so we can manually invoke `sudo docker run --runtime=nvidia ...`

Other changes/notes:
- The CPU build still uses a normal VM instance with the CPU base docker image. Reduce the number of threads to 1 since any more causes the compiler to OOM for some reason
- Since tests don't compltely pass with the CPU backend yet (there are still a few unimplemented exceptions), don't run CPU tests
- GPU backend builds now take advantage of as many available threads as possible with `-j$(nproc)`
- Separates the CPU and CUDA builds into two different workflows so they're done in parallel.

Reviewed By: VitaliyLi

Differential Revision: D16806968

fbshipit-source-id: 02dea7034fc78d18a5e4a56735dc1c40cb56a07f
  • Loading branch information
jacobkahn authored and facebook-github-bot committed Aug 14, 2019
1 parent cd5b82f commit 37846d5
Showing 1 changed file with 57 additions and 7 deletions.
64 changes: 57 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,74 @@

version: 2.0

gpu: &gpu
machine:
image: ubuntu-1604:201903-01
resource_class: gpu.small

jobs:
build:
docker:
- image: flml/flashlight:cuda-base-latest
build-cuda:
<<: *gpu
steps:
- checkout
- run:
name: Setup Docker and nvidia-docker
command: |
# Install CUDA 9.2
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.2.148-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.2.148-1_amd64.deb
sudo apt-get update || true
sudo apt-get --yes --force-yes install cuda
nvidia-smi
# Install Docker
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
# Install nvidia-docker
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
# Install nvidia-docker2 and reload the Docker daemon configuration
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
- run:
name: Build flashlight with CUDA backend inside nvidia-docker
command: |
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DFLASHLIGHT_BACKEND=CUDA
make && make install
sudo docker run --runtime=nvidia --rm -itd --ipc=host --name flashlight flml/flashlight:cuda-base-latest
sudo docker exec -it flashlight bash -c "mkdir /flashlight"
sudo docker cp . flashlight:/flashlight
sudo docker exec -it flashlight bash -c "\
cd /flashlight && pwd && ls && mkdir -p build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DFLASHLIGHT_BACKEND=CUDA && \
make -j$(nproc) && make install && make test"
build-cpu:
docker:
- image: flml/flashlight:cpu-base-latest
steps:
- checkout
- run:
name: Build flashlight with CPU backend
command: |
export MKLROOT=/opt/intel/mkl && mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DFLASHLIGHT_BACKEND=CPU
make && make install
make -j1 && make install
workflows:
version: 2
build_and_install:
jobs:
- build-cuda
- build-cpu

0 comments on commit 37846d5

Please sign in to comment.