diff --git a/.circleci/config.yml b/.circleci/config.yml index c005d5bb21..e6eca78ea5 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ references: pip install "$TORCH_VERSION" pip install -r requirements.txt -q sudo pip install pytest pytest-cov pytest-flake8 -q - pip install -r ./tests/requirements.txt -q + pip install -r ./tests/requirements-devel.txt -q tests: &tests run: diff --git a/.drone.yml b/.drone.yml index 7c30e80525..23f520c0b7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,7 +6,7 @@ name: torch-GPU steps: - name: testing - image: pytorch/pytorch:1.4-cuda10.1-cudnn7-devel + image: pytorchlightning/pytorch_lightning:devel-pt_1_4 environment: SLURM_LOCALID: 0 @@ -31,11 +31,10 @@ steps: - pip install pip -U - pip --version - nvidia-smi -# - bash ./tests/install_AMP.sh + # - bash ./tests/install_AMP.sh - apt-get update && apt-get install -y cmake - pip install -r requirements.txt --user -q - - pip install coverage pytest pytest-cov pytest-flake8 codecov -q - - pip install -r ./tests/requirements.txt --user -q + - pip install -r ./tests/requirements-devel.txt --user -q - pip list - python -c "import torch ; print(' & '.join([torch.cuda.get_device_name(i) for i in range(torch.cuda.device_count())]) if torch.cuda.is_available() else 'only CPU')" - coverage run --source pytorch_lightning -m py.test pytorch_lightning tests benchmarks -v --doctest-modules # --flake8 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fbde00f6fa..f2cd71f3a8 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -129,7 +129,7 @@ Test your work locally to speed up your work since so you can focus only in part To setup a local development environment, install both local and test dependencies: ```bash pip install -r requirements.txt -pip install -r tests/requirements.txt +pip install -r tests/requirements-devel.txt ``` You can run the full test-case in your terminal via this bash script: diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index defc84e885..4f94ba0450 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -81,7 +81,7 @@ jobs: run: | # python -m pip install --upgrade --user pip pip install -r requirements.txt -U -f https://download.pytorch.org/whl/torch_stable.html -q - HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install -r ./tests/requirements.txt -q + HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install -r ./tests/requirements-devel.txt -q # pip install tox coverage python --version pip --version diff --git a/requirements-extra.txt b/requirements-extra.txt index c47e130db0..bab1f3dd1f 100644 --- a/requirements-extra.txt +++ b/requirements-extra.txt @@ -7,4 +7,5 @@ test_tube>=0.7.5 wandb>=0.8.21 trains>=0.14.1 matplotlib>=3.1.1 -horovod[pytorch]>=0.19.1 \ No newline at end of file +# no need to install with [pytorch] as pytorch is already installed and torchvision is required only for Horovod examples +horovod>=0.19.1 \ No newline at end of file diff --git a/tests/Dockerfile b/tests/Dockerfile index d0d2f4ca5a..876d6fbf54 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -1,7 +1,27 @@ ARG TORCH_VERSION=1.4 ARG CUDA_VERSION=10.1 -FROM pytorch/pytorch:${TORCH_VERSION}-cuda${CUDA_VERSION}-cudnn7-runtime +FROM pytorch/pytorch:${TORCH_VERSION}-cuda${CUDA_VERSION}-cudnn7-devel + +ENV HOROVOD_GPU_ALLREDUCE: NCCL +ENV HOROVOD_GPU_BROADCAST: NCCL +ENV HOROVOD_WITH_PYTORCH: 1 +ENV HOROVOD_WITHOUT_TENSORFLOW: 1 +ENV HOROVOD_WITHOUT_MXNET: 1 +ENV HOROVOD_WITH_GLOO: 1 +ENV HOROVOD_WITHOUT_MPI: 1 +ENV PATH: "$PATH:/root/.local/bin" +ENV MAKEFLAGS: "-j$(nproc)" + +COPY ./tests/install_AMP.sh install_AMP.sh +COPY ./requirements.txt requirements.txt +COPY ./requirements-extra.txt requirements-extra.txt +COPY ./tests/requirements.txt requirements-tests.txt # Install AMP -RUN bash ./tests/install_AMP.sh +RUN apt-get update && apt-get install -y cmake && \ + bash install_AMP.sh && \ + pip install -r requirements.txt --user && \ + pip install -r requirements-extra.txt --user && \ + pip install -r requirements-tests.txt --user && \ + pip list diff --git a/tests/README.md b/tests/README.md index dd35709d8a..c931a2a02e 100644 --- a/tests/README.md +++ b/tests/README.md @@ -17,7 +17,7 @@ cd pytorch-lightning bash tests/install_AMP.sh # install dev deps -pip install -r tests/requirements.txt +pip install -r tests/requirements-devel.txt # run tests py.test -v @@ -36,7 +36,7 @@ Make sure to run coverage on a GPU machine with at least 2 GPUs and NVIDIA apex ```bash cd pytorch-lightning -# generate coverage (coverage is also installed as part of dev dependencies under tests/requirements.txt) +# generate coverage (coverage is also installed as part of dev dependencies under tests/requirements-devel.txt) coverage run --source pytorch_lightning -m py.test pytorch_lightning tests examples -v --doctest-modules # print coverage stats @@ -46,4 +46,16 @@ coverage report -m coverage xml ``` +## Building test image +You can build it on your own, note it takes lots of time, be prepared. +```bash +git clone +docker image build -t pytorch_lightning:devel-pt_1_4 -f tests/Dockerfile --build-arg TORCH_VERSION=1.4 . +``` +To build other versions, select different Dockerfile. +```bash +docker image list +docker run --rm -it pytorch_lightning:devel-pt_1_4 bash +docker image rm pytorch_lightning:devel-pt_1_4 +``` diff --git a/tests/requirements-devel.txt b/tests/requirements-devel.txt new file mode 100644 index 0000000000..2ff897d29e --- /dev/null +++ b/tests/requirements-devel.txt @@ -0,0 +1,5 @@ +# install all extra dependencies for full package testing +-r ../requirements-extra.txt + +# extended list of dependencies dor development and run lint and tests +-r ./requirements.txt \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt index d579c97fb3..79a10e3ea5 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,3 @@ -# install all extra dependencies for full package testing --r ../requirements-extra.txt - -# extended list of dependencies dor development and run lint and tests coverage codecov pytest>=3.0.5