Skip to content

Commit fe465db

Browse files
authored
Merge pull request #189 from iotamudelta/ifu
Merge from upstream
2 parents 7353c57 + 2e2d049 commit fe465db

File tree

372 files changed

+8893
-3453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

372 files changed

+8893
-3453
lines changed

.circleci/config.yml

Lines changed: 925 additions & 3 deletions
Large diffs are not rendered by default.

.clang-tidy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Checks: '
44
*
55
,clang-analyzer-*
66
,modernize-*
7+
,-cert-dcl21-cpp
78
,-cert-err58-cpp
89
,-cert-err60-cpp
910
,-clang-diagnostic-*
@@ -12,10 +13,12 @@ Checks: '
1213
,-cppcoreguidelines-pro-bounds-constant-array-index
1314
,-cppcoreguidelines-pro-type-member-init
1415
,-cppcoreguidelines-pro-type-static-cast-downcast
16+
,-cppcoreguidelines-pro-type-union-access
1517
,-cppcoreguidelines-pro-type-vararg
1618
,-cppcoreguidelines-special-member-functions
1719
,-fuchsia-*
1820
,-google-build-using-namespace
21+
,-google-default-arguments
1922
,-google-explicit-constructor
2023
,-google-readability-braces-around-statements
2124
,-google-readability-namespace-comments
@@ -24,6 +27,7 @@ Checks: '
2427
,-google-runtime-references
2528
,-hicpp-braces-around-statements
2629
,-hicpp-explicit-conversions
30+
,-hicpp-member-init
2731
,-hicpp-no-array-decay
2832
,-hicpp-signed-bitwise
2933
,-hicpp-special-member-functions

.jenkins/caffe2/build.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ if [ -z "${SCCACHE}" ] && which ccache > /dev/null; then
6464
export PATH="$CACHE_WRAPPER_DIR:$PATH"
6565
fi
6666

67+
# sccache will fail for CUDA builds if all cores are used for compiling
68+
if [ -z "$MAX_JOBS" ]; then
69+
if [[ "${BUILD_ENVIRONMENT}" == *-cuda* ]] && [ -n "${SCCACHE}" ]; then
70+
MAX_JOBS=`expr $(nproc) - 1`
71+
else
72+
MAX_JOBS=$(nproc)
73+
fi
74+
fi
75+
6776
report_compile_cache_stats() {
6877
if [[ -n "${SCCACHE}" ]]; then
6978
"$SCCACHE" --show-stats
@@ -184,13 +193,6 @@ if [[ -x "$(command -v cmake3)" ]]; then
184193
else
185194
CMAKE_BINARY=cmake
186195
fi
187-
# sccache will fail for CUDA builds if all cores are used for compiling
188-
if [[ "${BUILD_ENVIRONMENT}" == *-cuda* ]] && [ -n "${SCCACHE}" ]; then
189-
MAX_JOBS=`expr $(nproc) - 1`
190-
else
191-
MAX_JOBS=$(nproc)
192-
fi
193-
194196
195197
###############################################################################
196198
# Configure and make

.jenkins/pytorch/build.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
if [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda9-* ]]; then
99
# TODO: move this to Docker
1010
sudo apt-get update
11-
sudo apt-get install libnccl-dev=2.2.13-1+cuda9.0 libnccl2=2.2.13-1+cuda9.0
11+
sudo apt-get install -y --allow-downgrades --allow-change-held-packages libnccl-dev=2.2.13-1+cuda9.0 libnccl2=2.2.13-1+cuda9.0
1212
fi
1313

1414
if [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda8-* ]] || [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda9-cudnn7-py2* ]]; then
1515
# TODO: move this to Docker
1616
sudo apt-get update
17-
sudo apt-get install openmpi-bin libopenmpi-dev
17+
sudo apt-get install -y --allow-downgrades --allow-change-held-packages openmpi-bin libopenmpi-dev
1818
sudo apt-get install -y --no-install-recommends openssh-client openssh-server
1919
sudo mkdir -p /var/run/sshd
2020
fi
@@ -72,8 +72,10 @@ fi
7272

7373
# sccache will fail for CUDA builds if all cores are used for compiling
7474
# gcc 7 with sccache seems to have intermittent OOM issue if all cores are used
75-
if ([[ "$BUILD_ENVIRONMENT" == *cuda* ]] || [[ "$BUILD_ENVIRONMENT" == *gcc7* ]]) && which sccache > /dev/null; then
76-
export MAX_JOBS=`expr $(nproc) - 1`
75+
if [ -z "$MAX_JOBS" ]; then
76+
if ([[ "$BUILD_ENVIRONMENT" == *cuda* ]] || [[ "$BUILD_ENVIRONMENT" == *gcc7* ]]) && which sccache > /dev/null; then
77+
export MAX_JOBS=`expr $(nproc) - 1`
78+
fi
7779
fi
7880

7981
# Target only our CI GPU machine's CUDA arch to speed up the build

.jenkins/pytorch/macos-build.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ if [[ "${JOB_BASE_NAME}" == *cuda9.2* ]]; then
2929
export CUDA_HOME=/Developer/NVIDIA/CUDA-${CUDA_VERSION}
3030
export NO_CUDA=0
3131

32-
# Eigen gives "explicit specialization of class must precede its first use" error
33-
# when compiling with Xcode 9.1 toolchain, so we have to use Xcode 8.2 toolchain instead.
34-
export DEVELOPER_DIR=/Library/Developer/CommandLineTools
32+
if [ -z "${IN_CIRCLECI}" ]; then
33+
# Eigen gives "explicit specialization of class must precede its first use" error
34+
# when compiling with Xcode 9.1 toolchain, so we have to use Xcode 8.2 toolchain instead.
35+
export DEVELOPER_DIR=/Library/Developer/CommandLineTools
36+
fi
3537
else
36-
export DEVELOPER_DIR=/Applications/Xcode9.app/Contents/Developer
38+
if [ -z "${IN_CIRCLECI}" ]; then
39+
export DEVELOPER_DIR=/Applications/Xcode9.app/Contents/Developer
40+
fi
3741
fi
3842

3943
export MACOSX_DEPLOYMENT_TARGET=10.9
@@ -62,5 +66,7 @@ export IMAGE_COMMIT_TAG=${BUILD_ENVIRONMENT}-${IMAGE_COMMIT_ID}
6266
python setup.py install
6367

6468
# Upload torch binaries when the build job is finished
65-
7z a ${IMAGE_COMMIT_TAG}.7z ${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages/torch*
66-
aws s3 cp ${IMAGE_COMMIT_TAG}.7z s3://ossci-macos-build/pytorch/${IMAGE_COMMIT_TAG}.7z --acl public-read
69+
if [ -z "${IN_CIRCLECI}" ]; then
70+
7z a ${IMAGE_COMMIT_TAG}.7z ${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages/torch*
71+
aws s3 cp ${IMAGE_COMMIT_TAG}.7z s3://ossci-macos-build/pytorch/${IMAGE_COMMIT_TAG}.7z --acl public-read
72+
fi

.jenkins/pytorch/macos-test.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@ fi
1616
export PATH="${PYTORCH_ENV_DIR}/miniconda3/bin:$PATH"
1717
source ${PYTORCH_ENV_DIR}/miniconda3/bin/activate
1818
conda install -y mkl mkl-include numpy pyyaml setuptools cmake cffi ninja
19-
rm -rf ${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages/torch*
19+
if [ -z "${IN_CIRCLECI}" ]; then
20+
rm -rf ${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages/torch*
21+
fi
2022

2123
git submodule update --init --recursive
2224
export CMAKE_PREFIX_PATH=${PYTORCH_ENV_DIR}/miniconda3/
2325

2426
# Test PyTorch
25-
if [[ "${JOB_BASE_NAME}" == *cuda9.2* ]]; then
26-
# Eigen gives "explicit specialization of class must precede its first use" error
27-
# when compiling with Xcode 9.1 toolchain, so we have to use Xcode 8.2 toolchain instead.
28-
export DEVELOPER_DIR=/Library/Developer/CommandLineTools
29-
else
30-
export DEVELOPER_DIR=/Applications/Xcode9.app/Contents/Developer
27+
if [ -z "${IN_CIRCLECI}" ]; then
28+
if [[ "${JOB_BASE_NAME}" == *cuda9.2* ]]; then
29+
# Eigen gives "explicit specialization of class must precede its first use" error
30+
# when compiling with Xcode 9.1 toolchain, so we have to use Xcode 8.2 toolchain instead.
31+
export DEVELOPER_DIR=/Library/Developer/CommandLineTools
32+
else
33+
export DEVELOPER_DIR=/Applications/Xcode9.app/Contents/Developer
34+
fi
3135
fi
3236
export MACOSX_DEPLOYMENT_TARGET=10.9
3337
export CXX=clang++
@@ -38,9 +42,11 @@ export MAX_JOBS=2
3842
export IMAGE_COMMIT_TAG=${BUILD_ENVIRONMENT}-${IMAGE_COMMIT_ID}
3943

4044
# Download torch binaries in the test jobs
41-
rm -rf ${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages/torch*
42-
aws s3 cp s3://ossci-macos-build/pytorch/${IMAGE_COMMIT_TAG}.7z ${IMAGE_COMMIT_TAG}.7z
43-
7z x ${IMAGE_COMMIT_TAG}.7z -o"${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages"
45+
if [ -z "${IN_CIRCLECI}" ]; then
46+
rm -rf ${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages/torch*
47+
aws s3 cp s3://ossci-macos-build/pytorch/${IMAGE_COMMIT_TAG}.7z ${IMAGE_COMMIT_TAG}.7z
48+
7z x ${IMAGE_COMMIT_TAG}.7z -o"${PYTORCH_ENV_DIR}/miniconda3/lib/python3.6/site-packages"
49+
fi
4450

4551
test_python_all() {
4652
echo "Ninja version: $(ninja --version)"

.jenkins/pytorch/multigpu-test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,21 @@ COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}-multigpu-test"
88
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
99

1010
echo "Testing pytorch (distributed only)"
11+
12+
if [ -n "${IN_CIRCLECI}" ]; then
13+
if [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda9-* ]]; then
14+
# TODO: move this to Docker
15+
sudo apt-get update
16+
sudo apt-get install -y --allow-downgrades --allow-change-held-packages libnccl-dev=2.2.13-1+cuda9.0 libnccl2=2.2.13-1+cuda9.0
17+
fi
18+
19+
if [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda8-* ]] || [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda9-cudnn7-py2* ]]; then
20+
# TODO: move this to Docker
21+
sudo apt-get update
22+
sudo apt-get install -y --allow-downgrades --allow-change-held-packages openmpi-bin libopenmpi-dev
23+
sudo apt-get install -y --no-install-recommends openssh-client openssh-server
24+
sudo mkdir -p /var/run/sshd
25+
fi
26+
fi
27+
1128
time python test/run_test.py --verbose -i distributed

.jenkins/pytorch/test.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
99

1010
echo "Testing pytorch"
1111

12+
if [ -n "${IN_CIRCLECI}" ]; then
13+
if [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda9-* ]]; then
14+
# TODO: move this to Docker
15+
sudo apt-get update
16+
sudo apt-get install -y --allow-downgrades --allow-change-held-packages libnccl-dev=2.2.13-1+cuda9.0 libnccl2=2.2.13-1+cuda9.0
17+
fi
18+
19+
if [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda8-* ]] || [[ "$BUILD_ENVIRONMENT" == *-xenial-cuda9-cudnn7-py2* ]]; then
20+
# TODO: move this to Docker
21+
sudo apt-get update
22+
sudo apt-get install -y --allow-downgrades --allow-change-held-packages openmpi-bin libopenmpi-dev
23+
sudo apt-get install -y --no-install-recommends openssh-client openssh-server
24+
sudo mkdir -p /var/run/sshd
25+
fi
26+
fi
27+
1228
# JIT C++ extensions require ninja.
1329
git clone https://github.com/ninja-build/ninja --quiet
1430
pushd ninja

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ matrix:
2626
python: "3.6"
2727
install: pip install mypy mypy-extensions
2828
script: mypy @mypy-files.txt
29+
- env: CPP_DOC_CHECK
30+
install: sudo apt-get install -y doxygen
31+
script: cd docs/cpp && ./check-doxygen.sh

CMakeLists.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,11 @@ cmake_dependent_option(
8282
option(USE_FFMPEG "Use ffmpeg" OFF)
8383
option(USE_GFLAGS "Use GFLAGS" ON)
8484
option(USE_GLOG "Use GLOG" ON)
85-
option(USE_GLOO "Use Gloo" ON)
86-
option(USE_GLOO_IBVERBS "Use Gloo IB verbs for distributed support" OFF)
8785
option(USE_LEVELDB "Use LEVELDB" ON)
8886
option(USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
8987
option(USE_LMDB "Use LMDB" ON)
9088
option(USE_METAL "Use Metal for iOS build" ON)
9189
option(USE_MOBILE_OPENGL "Use OpenGL for mobile code" ON)
92-
option(USE_MPI "Use MPI" ON)
9390
option(USE_NATIVE_ARCH "Use -march=native" OFF)
9491
option(USE_NCCL "Use NCCL" ON)
9592
option(USE_SYSTEM_NCCL "Use system-wide NCCL" OFF)
@@ -116,7 +113,16 @@ option(USE_ZSTD "Use ZSTD" OFF)
116113
option(USE_MKLDNN "Use MKLDNN" OFF)
117114
option(USE_IDEEP "Use IDEEP interface in MKL BLAS" ON)
118115
option(USE_MKLML "Use MKLML interface in MKL BLAS" ON)
119-
option(USE_DISTRIBUTED "Use THD (distributed)" OFF)
116+
option(USE_DISTRIBUTED "Use distributed" ON)
117+
cmake_dependent_option(
118+
USE_MPI "Use MPI. Only available if USE_DISTRIBUTED is on." ON
119+
"USE_DISTRIBUTED" OFF)
120+
cmake_dependent_option(
121+
USE_GLOO "Use Gloo. Only available if USE_DISTRIBUTED is on." ON
122+
"USE_DISTRIBUTED" OFF)
123+
cmake_dependent_option(
124+
USE_GLOO_IBVERBS "Use Gloo IB verbs for distributed. Only available if USE_GLOO is on." OFF
125+
"USE_GLOO" OFF)
120126

121127
# Used when building Caffe2 through setup.py
122128
option(BUILDING_WITH_TORCH_LIBS "Tell cmake if Caffe2 is being built alongside torch libs" OFF)
@@ -378,6 +384,7 @@ if (BUILD_SHARED_LIBS)
378384
${PROJECT_SOURCE_DIR}/cmake/public/cuda.cmake
379385
${PROJECT_SOURCE_DIR}/cmake/public/glog.cmake
380386
${PROJECT_SOURCE_DIR}/cmake/public/gflags.cmake
387+
${PROJECT_SOURCE_DIR}/cmake/public/mkl.cmake
381388
${PROJECT_SOURCE_DIR}/cmake/public/protobuf.cmake
382389
${PROJECT_SOURCE_DIR}/cmake/public/threads.cmake
383390
${PROJECT_SOURCE_DIR}/cmake/public/utils.cmake
@@ -397,24 +404,16 @@ else()
397404
endif()
398405

399406
# ---[ Modules
400-
# TODO(orionr): Enable all of this for Windows DLL when we
401-
# can figure out how to get it to build
402-
if (NOT (MSVC AND BUILD_SHARED_LIBS))
403407
add_subdirectory(modules)
404-
endif()
405408

406409
# ---[ Binaries
407410
# Binaries will be built after the Caffe2 main libraries and the modules
408411
# are built. For the binaries, they will be linked to the Caffe2 main
409412
# libraries, as well as all the modules that are built with Caffe2 (the ones
410413
# built in the previous Modules section above).
411-
# TODO(orionr): Enable all of this for Windows DLL when we
412-
# can figure out how to get it to build
413-
if (NOT (MSVC AND BUILD_SHARED_LIBS))
414414
if (BUILD_BINARY)
415415
add_subdirectory(binaries)
416416
endif()
417-
endif()
418417

419418
include(cmake/Summary.cmake)
420419
caffe2_print_configuration_summary()

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/aten/ @apaszke @soumith @colesbury @gchanan @zdevito @ezyang
55
/torch/ @apaszke @soumith @colesbury @gchanan @zdevito @ezyang
66
/docs/source @apaszke @soumith @colesbury @gchanan @zdevito @ezyang @ssnl @zou3519
7+
/docs/cpp @goldsborough @ebetica @apaszke @soumith @colesbury @gchanan @zdevito @ezyang
78
/test @apaszke @soumith @colesbury @gchanan @zdevito @ezyang
89
/tools @apaszke @soumith @colesbury @gchanan @zdevito @ezyang
910
/README.md @apaszke @soumith @colesbury @gchanan @zdevito @ezyang

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ PyTorch uses [Google style](http://sphinxcontrib-napoleon.readthedocs.io/en/late
104104
for formatting docstrings. Length of line inside docstrings block must be limited to 80 characters to
105105
fit into Jupyter documentation popups.
106106

107+
For C++ documentation (https://pytorch.org/cppdocs), we use
108+
[Doxygen](http://www.doxygen.nl/) and then convert it to
109+
[Sphinx](http://www.sphinx-doc.org/) via
110+
[Breathe](https://github.com/michaeljones/breathe) and
111+
[Exhale](https://github.com/svenevs/exhale). Check the [Doxygen
112+
reference](http://www.stack.nl/~dimitri/doxygen/manual/index.html) for more
113+
information on the documentation syntax. To build the documentation locally,
114+
`cd` into `docs/cpp` and then `make html`.
115+
116+
We run Doxygen in CI (Travis) to verify that you do not use invalid Doxygen
117+
commands. To run this check locally, run `./check-doxygen.sh` from inside
118+
`docs/cpp`.
107119

108120
## Managing multiple build trees
109121

aten/src/ATen/ATen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "ATen/OptionsGuard.h"
1717
#include "ATen/core/Scalar.h"
1818
#include "ATen/ScalarOps.h"
19-
#include "ATen/Storage.h"
19+
#include "ATen/core/Storage.h"
2020
#include "ATen/Tensor.h"
2121
#include "ATen/TensorGeometry.h"
2222
#include "ATen/TensorMethods.h"

0 commit comments

Comments
 (0)