pytorch/scripts
Edward Yang c56464d13e Turn off warnings on Windows CI. (#24331)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/24331

Currently our logs are something like 40M a pop.  Turning off warnings and turning on verbose makefiles (to see the compile commands) reduces this to more like 8M. We could probably reduce log size more but verbose makefile is really useful and we'll keep it turned on for Windows.

Some findings:

1. Setting `CMAKE_VERBOSE_MAKEFILE` inside CMakelists.txt itself as suggested in https://github.com/ninja-build/ninja/issues/900#issuecomment-417917630 does not work on Windows. Setting `-DCMAKE_VERBOSE_MAKEFILE=1` does work (and we respect this environment variable.)
2. The high (`/W3`) warning level is by default on MSVC is due to cmake inserting this in the default flags. On recent versions of cmake, CMP0092 can be used to disable this flag in the default set. The string replace trick sort of works, but the standard snippet you'll find on the internet won't disable the flag from nvcc. I inspected the CUDA cmake code and verified it does respect CMP0092
3. `EHsc` is also in the default flags; this one cannot be suppressed via a policy. The string replace trick seems to work...
4. ... however, it seems nvcc implicitly inserts an `/EHs` after `-Xcompiler` specified flags, which means that if we add `/EHa` to our set of flags, you'll get a warning from nvcc. So we probably have to figure out how to exclude EHa from the nvcc flags set (EHs does seem to work fine.)
5. To suppress warnings in nvcc, you must BOTH pass `-w` and `-Xcompiler /w`. Individually these are not enough.

The patch applies these things; it also fixes a bug where nvcc verbose command printing doesn't work with `-GNinja`.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Differential Revision: D17131746

Pulled By: ezyang

fbshipit-source-id: fb142f8677072a5430664b28155373088f074c4b
2019-08-30 07:11:07 -07:00
..
appveyor move flags to c10 (#12144) 2018-10-04 02:09:56 -07:00
fbcode-dev-setup s/fwdproxy.any/fwdproxy/g in fbsource (#16024) 2019-01-15 17:26:31 -08:00
model_zoo Bump up opset version to 7 in Caffe2 ONNX exporter (#8854) 2018-06-28 07:39:02 -07:00
onnx fix the CI job for onnx (#22946) 2019-07-17 09:50:06 -07:00
add_apache_header.sh Re-license to Apache 2017-09-28 16:22:00 -07:00
apache_header.txt Re-license to Apache 2017-09-28 16:22:00 -07:00
apache_python.txt Add script for removing Apache header. 2018-03-27 13:10:18 -07:00
build_android.sh tweak scripts/build_android.sh for ABI and header install (#20152) 2019-05-07 17:44:07 -07:00
build_host_protoc.sh Port all PyTorch and Caffe2 jobs to CircleCI (#11264) 2018-09-05 16:28:11 -07:00
build_ios.sh Enable QNNPACK for iOS (#24030) 2019-08-13 21:10:59 -07:00
build_local.sh Port all PyTorch and Caffe2 jobs to CircleCI (#11264) 2018-09-05 16:28:11 -07:00
build_raspbian.sh Fix target name. 2019-02-22 17:27:16 -08:00
build_tegra_x1.sh Allow specifying cmake build directory in the build scripts 2017-11-20 20:32:30 -08:00
build_tizen.sh Allow specifying cmake build directory in the build scripts 2017-11-20 20:32:30 -08:00
build_windows.bat Turn off warnings on Windows CI. (#24331) 2019-08-30 07:11:07 -07:00
diagnose_protobuf.py Fix several DeprecationWarning: invalid escape sequence (#15733) 2019-01-05 08:53:35 -08:00
get_python_cmake_flags.py [caffe2][build] Update python cmake flag print script (#7306) 2018-05-08 00:34:42 -07:00
proto.ps1 Sync fbcode/caffe2 and xplat/caffe2 (1) (#19218) 2019-04-13 21:45:52 -07:00
read_conda_versions.sh Adding gcc4 conda builds (#2283) 2018-03-17 17:26:37 -07:00
README.md Enhance build_ios.sh to be consistent with build_android.sh (#18564) 2019-03-28 21:37:55 -07:00
remove_apache_header.sh Add script for removing Apache header. 2018-03-27 13:10:18 -07:00
run_mobilelab.py Sync fbcode/caffe2 and xplat/caffe2 (1) (#19218) 2019-04-13 21:45:52 -07:00
temp.sh Add script for removing Apache header. 2018-03-27 13:10:18 -07:00

This directory contains the useful tools.

build_android.sh

This script is to build PyTorch/Caffe2 library for Android. Take the following steps to start the build:

  • set ANDROID_NDK to the location of ndk
export ANDROID_NDK=YOUR_NDK_PATH
  • run build_android.sh
#in your PyTorch root directory
bash scripts/build_android.sh

If succeeded, the libraries and headers would be generated to build_android/install directory. You can then copy these files from build_android/install to your Android project for further usage.

You can also override the cmake flags via command line, e.g., following command will also compile the executable binary files:

bash scripts/build_android.sh -DBUILD_BINARY=ON

build_ios.sh

This script is to build PyTorch/Caffe2 library for iOS, and can only be performed on macOS. Take the following steps to start the build:

  • Install Xcode from App Store, and configure "Command Line Tools" properly on Xcode.
  • Install the dependencies:
brew install cmake automake libtool
  • run build_ios.sh
#in your PyTorch root directory
bash scripts/build_ios.sh

If succeeded, the libraries and headers would be generated to build_ios/install directory. You can then copy these files to your Xcode project for further usage.