program
comment "#!/bin/bash"
comment "# shellcheck disable=SC2086,SC2006,SC2207,SC2076,SC2155,SC20"...
comment "# TODO: Re-enable shellchecks above"
command
command_name
word "set"
word "-eux"
word "-o"
word "pipefail"
comment "# This script checks the following things on binaries"
comment "# 1. The gcc abi matches DESIRED_DEVTOOLSET"
comment "# 2. MacOS binaries do not link against OpenBLAS"
comment "# 3. There are no protobuf symbols of any sort anywhere (tur"...
comment "# this is currently not true)"
comment "# 4. Standard Python imports work"
comment "# 5. MKL is available everywhere except for MacOS wheels"
comment "# 6. XNNPACK is available everywhere except for MacOS wheels"
comment "# 7. CUDA is setup correctly and does not hang"
comment "# 8. Magma is available for CUDA builds"
comment "# 9. CuDNN is available for CUDA builds"
comment "#"
comment "# This script needs the env variables DESIRED_PYTHON, DESIRE"...
comment "# DESIRED_DEVTOOLSET and PACKAGE_TYPE"
comment "#"
comment "# This script expects PyTorch to be installed into the activ"...
comment "# Python returned by `which python`). Or, if this is testing"...
comment "# Pythonless binary, then it expects to be in the root folde"...
comment "# libtorch package."
comment "# ensure we don't link to system libraries, linked libraries"...
comment "# Save the old LD_LIBRARY_PATH to restore it later"
variable_assignment
variable_name "OLD_LD_LIBRARY_PATH"
= "="
string
" "\""
expansion
${ "${"
variable_name "LD_LIBRARY_PATH"
:- ":-"
} "}"
" "\""
unset_command
unset "unset"
variable_name "LD_LIBRARY_PATH"
if_statement (+25 nodes collapsed)
if_statement (+25 nodes collapsed)
if_statement (+25 nodes collapsed)
if_statement (+25 nodes collapsed)
comment "# The install root depends on both the package type and the "...
comment "# All MacOS packages use conda, even for the wheel packages."
if_statement (+165 nodes collapsed)
comment "############################################################"...
comment "# Check GCC ABI"
comment "############################################################"...
comment "# NOTE: As of https://github.com/pytorch/pytorch/issues/1265"...
comment "# wheels with cxx11-abi"
command
command_name
word "echo"
string
" "\""
string_content "Checking that the gcc ABI is what we expect"
" "\""
if_statement (+57 nodes collapsed)
comment "# if on Darwin"
comment "############################################################"...
comment "# Check for no OpenBLAS"
comment "# TODO Check for no Protobuf symbols (not finished)"
comment "# Print *all* runtime dependencies"
comment "############################################################"...
comment "# We have to loop through all shared libraries for this"
if_statement (+259 nodes collapsed)
function_definition (+291 nodes collapsed)
variable_assignment (+27 nodes collapsed)
function_definition
word "build_and_run_example_cpp"
( "("
) ")"
compound_statement
{ "{"
command
command_name
word "setup_link_flags"
command
command_name
word "g++"
concatenation
expansion
${ "${"
variable_name "TEST_CODE_DIR"
} "}"
word "/"
$ "$"
word "1.cpp"
concatenation
word "-I"
expansion
${ "${"
variable_name "install_root"
} "}"
word "/include"
concatenation
word "-I"
expansion
${ "${"
variable_name "install_root"
} "}"
word "/include/torch/csrc/api/include"
word "-std=gnu++17"
concatenation
word "-L"
expansion
${ "${"
variable_name "install_root"
} "}"
word "/lib"
expansion
${ "${"
variable_name "REF_LIB"
} "}"
expansion
${ "${"
variable_name "ADDITIONAL_LINKER_FLAGS"
} "}"
word "-ltorch"
simple_expansion
$ "$"
variable_name "TORCH_CPU_LINK_FLAGS"
simple_expansion
$ "$"
variable_name "TORCH_CUDA_LINK_FLAGS"
simple_expansion
$ "$"
variable_name "C10_LINK_FLAGS"
word "-o"
simple_expansion
$ "$"
variable_name "1"
command
command_name
concatenation
word "./"
simple_expansion
$ "$"
variable_name "1"
} "}"
comment "############################################################"...
comment "# Check simple Python/C++ calls"
comment "############################################################"...
if_statement (+64 nodes collapsed)
comment "############################################################"...
comment "# Check torch.git_version"
comment "############################################################"...
if_statement (+34 nodes collapsed)
comment "############################################################"...
comment "# Check for MKL"
comment "############################################################"...
if_statement (+164 nodes collapsed)
comment "############################################################"...
comment "# Check for XNNPACK"
comment "############################################################"...
if_statement (+101 nodes collapsed)
comment "############################################################"...
comment "# Check XPU configured correctly"
comment "############################################################"...
if_statement (+40 nodes collapsed)
comment "############################################################"...
comment "# Check CUDA configured correctly"
comment "############################################################"...
comment "# Skip these for Windows machines without GPUs"
if_statement (+63 nodes collapsed)
comment "# Test that CUDA builds are setup correctly"
comment "# Skip CUDA hardware checks for aarch64 as they run on CPU-o"...
if_statement (+226 nodes collapsed)
comment "# if cuda"
comment "##########################"
comment "# Run parts of smoke tests"
comment "##########################"
if_statement (+94 nodes collapsed)
comment "############################################################"...
comment "# Check PyTorch supports TCP_TLS gloo transport"
comment "############################################################"...
if_statement (+107 nodes collapsed)
comment "############################################################"...
comment "# Restore LD_LIBRARY_PATH to its original value"
comment "############################################################"...
if_statement (+27 nodes collapsed)