1562 Commits

Author SHA1 Message Date
567842e68d Check system dependencies first
Summary:
This PR changes the cmake of Caffe2 to look for system dependencies before resorting to the submodules in `third-party`. Only googletest should logically be in third-party, the other libraries should ideally be installed as system dependencies by the user. This PR adds system dependency checks for Gloo, CUB, pybind11, Eigen and benchmark, as these were missing from the cmake files.

In addition it removes the execution of `git submodule update --init` in cmake. This seems like bad behavior to me, it should be up to the user to download submodules and manage the git repository.
Closes https://github.com/caffe2/caffe2/pull/382

Differential Revision: D5124123

Pulled By: Yangqing

fbshipit-source-id: cc34dda58ffec447874a89d01058721c02a52476
2017-05-24 14:31:51 -07:00
e03e14a71e Clean up binary build cmake script
Summary:
After the change we will be able to simply define targets and find dependencies.
Closes https://github.com/caffe2/caffe2/pull/640

Differential Revision: D5121700

Pulled By: Yangqing

fbshipit-source-id: 2d21e1afbccb09614054feccdd1bef55cbe3b035
2017-05-24 13:47:26 -07:00
033ab9da1b Adding video data layer for caffe2
Summary: Adding a simple video data layer which allows to read video data from frames, videos and output 5D tensor. It also allows multiple labels. The current implementation is based on ffmpeg

Differential Revision: D4801798

fbshipit-source-id: 46448e9c65fb055c2d71855447383a33ade0e444
2017-05-05 14:16:38 -07:00
395a80f757 Check GCC version if compiling with CUDA support
Summary:
Otherwise compilation fails pretty far into the build, which is inconvenient.

The error reported when trying to compile with GCC 6:

    CUDA 8.0 is not compatible with GCC version >= 6. Use the following
    options to configure GCC version 5:

      -DCMAKE_CXX_COMPILER=/usr/bin/g++-5
      -DCMAKE_C_COMPILER=/usr/bin/gcc-5
      -DCUDA_HOST_COMPILER:FILEPATH=/usr/bin/gcc-5
Closes https://github.com/caffe2/caffe2/pull/504

Reviewed By: akyrola

Differential Revision: D5004299

Pulled By: pietern

fbshipit-source-id: 185cd2f846f291a48e1d41ce0d87ca69e7f2c593
2017-05-04 12:19:17 -07:00
b3b66e3d00 MKL related files with review comments incorporated
Summary:
This PR is based on commit "977c6b3" as this version allows MKL to use all the cores available.
All MKL related files are added here after incorporating review comments, major changes include

1. usage of Clang-format(Linter) with --style = Google
2. usage of macros for checking input and filter dimension in the mkl operators
3. merged Max and Average pooling functions
4. created a new folder for mkl related python scripts in Python folder and moved them there
5. there is no mkl_alexnet_test.py as that was redundant while convnet_benchmark.py does the same thing
Closes https://github.com/caffe2/caffe2/pull/270

Differential Revision: D4905219

Pulled By: Yangqing

fbshipit-source-id: e5f5b189714a835b93b9ebda24c52e09572dfca7
2017-04-25 00:31:29 -07:00
437a670ce8 Enable building Gloo only on 64-bit systems
Summary:
Cannot guarantee Gloo will build on 32-bit systems as we don't run continuous build/test for this.

Verified this works by changing 8 to 7 and observing USE_GLOO defaulting to OFF.
Closes https://github.com/caffe2/caffe2/pull/401

Differential Revision: D4943135

Pulled By: pietern

fbshipit-source-id: 1972658afe819951e24ffbec76eb615c36ab0cc2
2017-04-24 17:40:31 -07:00
8387bc4680 Added Python_ADDITIONAL_VERSIONS to cmake so python 2 is default.
Summary:
When installing on systems such as Arch Linux where the default python version is 3 the build will fail. To fix this instead of changing the python link in the shell it is more efficient to set the default python version allowed by cmake.
Closes https://github.com/caffe2/caffe2/pull/361

Differential Revision: D4932214

Pulled By: Yangqing

fbshipit-source-id: 06997d2df68b8e4037d72fd49813f6f74ca7591b
2017-04-24 15:52:25 -07:00
9f86de2dc7 Support WatchOS build
Summary:
To build, run
`IOS_PLATFORM=WATCHOS scripts/build_ios.sh`
Closes https://github.com/caffe2/caffe2/pull/321

Reviewed By: Yangqing

Differential Revision: D4923400

Pulled By: salexspb

fbshipit-source-id: 3a87f068562a01e972ea915c9be32f0667e8ea19
2017-04-20 18:15:47 -07:00
b89688658c Missing CUDA_NVCC_FLAGS & CUDA_HOST_COMPILER flags at GPU arch detection.
Summary:
This tiny patch fix missing ```CUDA_NVCC_FLAGS``` & ```CUDA_HOST_ARCH``` from ```caffe_detect_installed_gpus()```.

-----------------

People may want define their custom flags or compilers that are more CUDA compatible. Automatic gpu arch detection ignores these flags and fail. Example of such custom flags:

```
cmake . \
-DCUDA_ARCH_NAME="Auto" \
-DCUDA_HOST_COMPILER="/usr/bin/gcc5"
```

* Autodetection part fails regardless proper compiler flags are passed, due to system gcc 7.0 that doesnt work with CUDA thus all arch will be enabled:
```
-- The C compiler identification is GNU 7.0.1
-- The CXX compiler identification is GNU 7.0.1
...//\\...
-- CUDA detected: 8.0
...//\\...
-- Automatic GPU detection failed. Building for all known architectures.
-- Added CUDA NVCC flags for: sm_20 sm_21 sm_30 sm_35 sm_50 sm_60 sm_61
```
* Patch fix the autodetection time as expected:
```
$ cmake ../ -DCUDA_NVCC_FLAGS="-Xcompiler=-std=c++03 -I/usr/include/cuda/"
-- The C compiler identification is
Closes https://github.com/caffe2/caffe2/pull/288

Differential Revision: D4914215

Pulled By: Yangqing

fbshipit-source-id: c407a750e03cb163f9d57f9f6403042704046014
2017-04-19 11:02:23 -07:00
22f3825d8f Cmake mobile build improvements
Summary:
(1) integrate gcc compatible nnpack
(2) speed up the ios travis ci.
Closes https://github.com/caffe2/caffe2/pull/268

Differential Revision: D4897576

Pulled By: Yangqing

fbshipit-source-id: 729fa2e4b5be6f1d0b8d55305f047116969ff61f
2017-04-16 16:46:58 -07:00
6490d58a75 Add cuda path to nccl build
Summary:
This was found necessary on some CentOS. aaronmarkham
Closes https://github.com/caffe2/caffe2/pull/240

Differential Revision: D4819591

Pulled By: Yangqing

fbshipit-source-id: 40161cd484a2c8d43f26077919ad2762440dde13
2017-04-03 10:05:26 -07:00
254ee9b099 Fix protobuf build to properly include directories
Summary:
aaronmarkham - I think this should fix the oss build.
slayton58 FYI
kmatzen FYI
Closes https://github.com/caffe2/caffe2/pull/238

Differential Revision: D4812550

Pulled By: Yangqing

fbshipit-source-id: 5703e403ef22c02e87f885bad8379fd5a8e06cdb
2017-03-31 13:20:10 -07:00
5bee34eb84 Add git submodule init command
Summary:
aaronmarkham
Closes https://github.com/caffe2/caffe2/pull/237

Differential Revision: D4808930

Pulled By: Yangqing

fbshipit-source-id: c598fac789e97280d12961b0be257607ebf82244
2017-03-31 00:32:15 -07:00
afe3df32f5 test existence of confu and ninja before installing nnpack.
Summary:
TSIA
Closes https://github.com/caffe2/caffe2/pull/229

Differential Revision: D4795563

Pulled By: aaronmarkham

fbshipit-source-id: 4df871760a1124bb7a2ef226d01b4ced12d21ab1
2017-03-29 10:18:07 -07:00
92f2220589 Add whitelist capability for smaller mobile binaries
Summary:
This helps adjusting mobile build sizes when necessary.
Closes https://github.com/caffe2/caffe2/pull/228

Differential Revision: D4795135

Pulled By: Yangqing

fbshipit-source-id: 70a0dc35b31d5c8038081aedeb464e47e4284217
2017-03-29 08:47:08 -07:00
661fa5915d minor bugfix for cmake
Summary: TSIA

Reviewed By: asaadaldien

Differential Revision: D4778069

fbshipit-source-id: 965bd7e00738ed508d5a9b0cae109b73ba1e9b62
2017-03-26 18:46:31 -07:00
d5880b128e CMake support for Gloo dependency
Summary:
This also requires a change to cmake/External/nccl.cmake to use the
static NCCL binary instead of the shared object. When the Caffe2/Gloo
build uses the bundled NCCL version it should be packaged up in the
resulting libraries and not cause another runtime dependency on a
library that has to be installed separately.
Closes https://github.com/caffe2/caffe2/pull/218

Differential Revision: D4769926

Pulled By: pietern

fbshipit-source-id: 5c85559992c200d874f4218724823815ffb5adb5
2017-03-24 08:32:24 -07:00
aa4d07d3c4 bugfix for Windows, esp. VS 2017
Summary:
aaronmarkham this solves your Windows build issue. Basically:

(1) VS 2017 does not have CUDA support yet, and we will be waiting on NVidia to do so.

(2) VS 2015 and 2017 need different cmake generator strings.

This PR shows how to determine those and also updates appveyor to do contbuild guard for the following 3 settings:
- VS2015 without cuda
- VS2017 without cuda
- VS2015 with cuda
Closes https://github.com/caffe2/caffe2/pull/210

Differential Revision: D4745007

Pulled By: Yangqing

fbshipit-source-id: 50952552843abd0eb6f4145d9f132daeee3a6794
2017-03-21 05:17:59 -07:00
1aa5231fb3 make nnpack build on mac/linux, and also contbuild support
Summary:
* add custom ninja install

* minimal build for nnpack

* force -fPIC for nnpack
Closes https://github.com/caffe2/caffe2/pull/207

Differential Revision: D4729265

Pulled By: Yangqing

fbshipit-source-id: 2ed345a4fda6b4811af03cd1898e2402dda58701
2017-03-17 15:19:07 -07:00
a15776c868 Fix for Windows build
Summary:
suppressed warning, added noexcept to destructors, and fixed an inclusion bug introduced today in the top_k diff.
Closes https://github.com/caffe2/caffe2/pull/206

Differential Revision: D4729263

Pulled By: Yangqing

fbshipit-source-id: 20166382f1e3547713f7d554a151a5387f0a41c1
2017-03-17 10:19:06 -07:00
f449af378d Explicitly pass CXX to NCCL Makefile
Summary:
Necessary if CXX isn't set when cmake is called. The CXX variable will then be
empty which prevents make from using its own default.
Closes https://github.com/caffe2/caffe2/pull/202

Differential Revision: D4711113

Pulled By: Yangqing

fbshipit-source-id: 895c07044b263ba9b5440453978248506d7ac225
2017-03-14 18:33:36 -07:00
1741fd839f Re-apply windows diff D4657831
Summary:
(Note: previous revert was due to a race condition between D4657831 and
D4659953 that I failed to catch.)

After this, we should have contbuild guarding the Windows build both with
and without CUDA.

This includes a series of changes that are needed to make Windows build,
specifically:

(1) Various flags that are needed in the cmake system, specially dealing
with /MD, /MT, cuda, cudnn, whole static linking, etc.
(2) Contbuild scripts based on appveyo.
(3) For Windows build, note that one will need to use "cmake --build" to
build stuff so that the build type is consistent between configuration and
actual build. see scripts\build_windows.bat for details.
(4) In logging.h, ERROR is already defined by Windows. I don't have a good
solution now, and as a result, LOG(ERROR) on windows is going to be
LOG(INFO).
(5) variable length array is not supported by MSVC (and it is not part of
C++ standard). As a result I replaced them with vectors.
(6) sched.h is not available on Windows, so akyrola 's awesome simple
async net might encounter some slowdown due to no affinity setting on
Windows.
(7) MSVC has a bug that does not work very well with template calls inide
a templated function call, which is a known issue that should be fixed in
MSVC 2017. However for now this means changes to conv_op_impl.h and
recurrent_net_op.h. No actual functionalities are changed.
(8) std host function calls are not supported in CUDA8+MSVC, so I changed
lp_pool (and maybe a few others) to use cuda device functions.
(9) The current Scale and Axpy has heavy templating that does not work
well with MSVC. As a result I reverted azzolini 's changes to the Scale
and Axpy interface, moved the fixed-length version to ScaleFixedSize and
AxpyFixedSize.
(10) CUDA + MSVC does not deal with Eigen well, so I guarded all Eigen
parts to only the non-CUDA part.
(11) In conclusion, it is fun but painful to deal with visual c++.

Differential Revision: D4666745

fbshipit-source-id: 3c9035083067bdb19a16d9c345c1ce66b6a86600
2017-03-07 11:02:12 -08:00
039c3cf0ba Revert D4657831: [caffe2][PR] Changes for Windows build to pass.
Summary: This reverts commit 070ded372ed78a7e3e3919fdffa1d337640f146e

Differential Revision: D4657831

fbshipit-source-id: 3a0fb403936a9257776d637ce3ba5dbd81e1119f
2017-03-06 21:02:36 -08:00
7b8c7b11d2 Changes for Windows build to pass.
Summary:
After this, we should have contbuild guarding the Windows build both with
and without CUDA.

This includes a series of changes that are needed to make Windows build,
specifically:

(1) Various flags that are needed in the cmake system, specially dealing
with /MD, /MT, cuda, cudnn, whole static linking, etc.
(2) Contbuild scripts based on appveyo.
(3) For Windows build, note that one will need to use "cmake --build" to
build stuff so that the build type is consistent between configuration and
actual build. see scripts\build_windows.bat for details.
(4) In logging.h, ERROR is already defined by Windows. I don't have a good
solution now, and as a result, LOG(ERROR) on windows is going to be
LOG(INFO).
(5) variable length array is not supported by MSVC (and it is not part of
C++ standard). As a result I replaced them with vectors.
(6) sched.h is not available on Windows, so akyrola 's awesome simple
async net might encounter some slowdown due to no affinity setting on
Windows.
(7) MSVC has a
Closes https://github.com/caffe2/caffe2/pull/183

Reviewed By: ajtulloch

Differential Revision: D4657831

Pulled By: Yangqing

fbshipit-source-id: 070ded372ed78a7e3e3919fdffa1d337640f146e
2017-03-06 20:03:37 -08:00
642b5a863f Adding changes that enable MSVC build
Summary:
MSVC 2015 has known bugs about template functions so these changes aim to fix them - no functional differences introduced.
Closes https://github.com/caffe2/caffe2/pull/179

Reviewed By: ajtulloch

Differential Revision: D4635241

Pulled By: Yangqing

fbshipit-source-id: a282a96e1e626e9440c1e3f3cb15b5b1fa710887
2017-03-01 16:47:58 -08:00
e30e94cb71 Made CNMEM optional and added a few cmake components
Summary:
(1) Since cub seems to be a better memory pool I made cnmem optional.
(2) Added MKL testing since Intel now provides an apt source, but that doesn't seem to work right now.
(3) Added cmake file for nervana gpu.
Closes https://github.com/caffe2/caffe2/pull/175

Differential Revision: D4627056

Pulled By: Yangqing

fbshipit-source-id: 9676fa32fce2a29574c0bf7e9d31660b5535cb51
2017-02-28 10:16:49 -08:00
4b52cbe636 turn off deprecation warning if glog needs so
Summary:
This addresses #162 for thatguymike
Closes https://github.com/caffe2/caffe2/pull/172

Differential Revision: D4620982

Pulled By: Yangqing

fbshipit-source-id: df3ef45f2c95418c538baa65d5dde3755cb25d1c
2017-02-27 10:07:58 -08:00
1d26baa0fc use CMAKE_SYSTEM_NAME instead of LINUX
Summary: Closes https://github.com/caffe2/caffe2/pull/170

Differential Revision: D4617063

Pulled By: Yangqing

fbshipit-source-id: cec9bc3f2f7324fd0281e92fab3d96e2cd4ed9e7
2017-02-24 19:47:41 -08:00
aa875869dc Added more summary information for debugging python versions
Summary: Closes https://github.com/caffe2/caffe2/pull/167

Reviewed By: Yangqing

Differential Revision: D4610416

Pulled By: bwasti

fbshipit-source-id: 0f56941bed2a75105787e518a71638916e4d503f
2017-02-23 19:46:39 -08:00
23602488cc Fix ProtoBuf.cmake to use PROTOBUF_LIBRARY as well
Summary: Closes https://github.com/caffe2/caffe2/pull/152

Reviewed By: Yangqing

Differential Revision: D4577524

Pulled By: bwasti

fbshipit-source-id: 019ced46dc474c413ba00a98b8fdeb7230a28b55
2017-02-17 19:16:47 -08:00
d4b1d347e9 minor: make cmake cuda ready
Summary: Closes https://github.com/caffe2/caffe2/pull/153

Differential Revision: D4571506

Pulled By: Yangqing

fbshipit-source-id: 4e887071774749fb84d34cab114dad4587d36ff1
2017-02-16 06:11:29 -08:00
7ee9984556 Added local build and apple fix for generating .so files
Summary: Closes https://github.com/caffe2/caffe2/pull/147

Reviewed By: bwasti

Differential Revision: D4564024

Pulled By: JoelMarcey

fbshipit-source-id: 526a5ab700f9356a3c93a6c64dc38e44a173559c
2017-02-16 06:11:28 -08:00
c7c4b00a50 windows build: getting there
Summary:
This clears up a bunch of windows build errors, but there are still 12 errors mostly relating to
- template keywords
- initializer list
- pthreadpool

that are not readily available on windows. Also, cuda build is being disabled right now.

Current error can be found here: https://ci.appveyor.com/project/Yangqing/caffe2-w2ucm
Closes https://github.com/caffe2/caffe2/pull/151

Reviewed By: bwasti

Differential Revision: D4564591

Pulled By: Yangqing

fbshipit-source-id: adacad5fa2d6d52d586700947972e3674e3b6e60
2017-02-15 16:00:45 -08:00
e865c940a5 initial version of windows build
Summary:
This is essentially https://github.com/caffe2/caffe2/pull/146/ but shipit
failed to trigger task determinator.

Reviewed By: bwasti

Differential Revision: D4557698

fbshipit-source-id: b0e6777957e76df4e23671371098c2c6fe83b55c
2017-02-13 23:02:40 -08:00
54fc123610 Halfway into windows port
Summary: There are still a lot to clean up, but this is a start change.

Reviewed By: bwasti

Differential Revision: D4543980

fbshipit-source-id: 757fc49db230b56996f02d5de9b69030ebbf3b77
2017-02-13 09:46:18 -08:00
274ac2b590 Add cmake guard for python, build for tegra X1
Summary:
In short: cmake is lovely.
Closes https://github.com/caffe2/caffe2/pull/131

Differential Revision: D4517234

Pulled By: Yangqing

fbshipit-source-id: 1117878393f8fe7d6bebbc4a06a3c37b734f3222
2017-02-07 13:17:50 -08:00
8553bd3f68 Ensure we are not using Eigen LGPL code, and build on raspbian.
Summary:
Turns out that building on raspbian is easy as a cake for caffe2 - cmake is awesome.
Closes https://github.com/caffe2/caffe2/pull/112

Differential Revision: D4480985

Pulled By: Yangqing

fbshipit-source-id: 5dbe5e1e71d8680dea7a5ec8a9ce7fbe6aa5270a
2017-01-30 09:44:27 -08:00
3a82b33f84 Use protobuf's own cmake scripts and add travis for ios
Summary: Closes https://github.com/caffe2/caffe2/pull/110

Differential Revision: D4475170

Pulled By: Yangqing

fbshipit-source-id: 5964db04186619ac563f516cb202c5e2ba543403
2017-01-28 13:29:32 -08:00
59d263280e fix directory reference in cmake for inclusion as library
Summary: This fixes build that include caffe2 and change the value of CMAKE_BINARY_DIR to their own binary dir.  Allows the generation of protobuf headers/files in particular.

Reviewed By: Yangqing

Differential Revision: D4466126

fbshipit-source-id: eba264094dd2bff07a7f050b95fd2d5525462b09
2017-01-26 14:44:37 -08:00
e3ea3e8c12 MKL convolution operator
Summary: Closes https://github.com/caffe2/caffe2/pull/102

Differential Revision: D4448886

Pulled By: Yangqing

fbshipit-source-id: 914d11cd79107895a9755154df3526fcf71a31ea
2017-01-23 09:59:30 -08:00
be1224c0a7 cmake: allow execution of python files without make install
Summary:
This will help issues like #99
Closes https://github.com/caffe2/caffe2/pull/101

Differential Revision: D4448397

Pulled By: Yangqing

fbshipit-source-id: ede3fafc1b1314886583e8ea38948bb31e69347b
2017-01-22 13:29:37 -08:00
0d5f3654b2 Adding back untracked files from manual github pull
Summary: Github import didn't work and the manual import lost some files.

Reviewed By: Yangqing

Differential Revision: D4408509

fbshipit-source-id: ec8edb8c02876410f0ef212bde6847a7ba327fe4
2017-01-12 08:59:19 -08:00
1cd166d330 CMake completions work
Summary: Closes https://github.com/caffe2/caffe2/pull/88

Differential Revision: D4404292

Pulled By: bwasti

fbshipit-source-id: 8a4351c2dee5136aaa12b90f1a61fd7afee51994
2017-01-11 16:59:22 -08:00
603784c8cb fix typo 2017-01-05 10:48:26 -08:00
69ce8cafde Don't add levelDB dependency unless Snappy is also present 2017-01-05 09:55:09 -08:00
10bad040c2 Merge branch 'master' into cmake 2017-01-05 09:52:45 -08:00
ac03e65929 Move c++11 check to cmake 2.8
Previous check required cmake >= 3.1
2017-01-05 12:15:54 -05:00
83b2f282de Need to set c++11 before check_cxx_source_compiles 2017-01-04 21:38:24 -08:00
46a403250f Make build for Android a bit easier 2017-01-04 20:50:06 -08:00
7734235a6a Add misc check for the long type, and temporarily disabled
core_overhead_benchmark to remove the benchmark dependency for all
binaries
2017-01-04 20:46:19 -08:00