Files
pytorch/tools/build_libtorch.py
Orion Reblitz-Richardson e1e69446f6 Lockdown NO_TEST=1 for tests even more (#11415)
Summary:
Skip torch tests as well when NO_TEST=1 environment variable is set. Also remove the separate ATen code path for not being built with Caffe2, since it will always be built with Caffe2.

cc The controller you requested could not be found.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11415

Reviewed By: soumith

Differential Revision: D9758179

Pulled By: orionr

fbshipit-source-id: e3e3327364fccdc57a703aeaad8c4f30452973fb
2018-09-10 17:27:48 -07:00

30 lines
868 B
Python

import argparse
import os
import shlex
import subprocess
import sys
from setup_helpers.cuda import USE_CUDA
if __name__ == '__main__':
# Placeholder for future interface. For now just gives a nice -h.
parser = argparse.ArgumentParser(description='Build libtorch')
args = parser.parse_args()
os.environ['BUILD_TORCH'] = 'ON'
os.environ['BUILD_TEST'] = 'ON'
os.environ['ONNX_NAMESPACE'] = 'onnx_torch'
os.environ['PYTORCH_PYTHON'] = sys.executable
tools_path = os.path.dirname(os.path.abspath(__file__))
build_pytorch_libs = os.path.join(tools_path, 'build_pytorch_libs.sh')
command = '{} --use-nnpack '.format(build_pytorch_libs)
if USE_CUDA:
command += '--use-cuda '
command += 'caffe2'
sys.stdout.flush()
sys.stderr.flush()
subprocess.check_call(shlex.split(command), universal_newlines=True)