diff options
Diffstat (limited to 'tensorflow/tools/ci_build/windows/gpu')
-rw-r--r-- | tensorflow/tools/ci_build/windows/gpu/cmake/run_build.bat | 39 | ||||
-rw-r--r-- | tensorflow/tools/ci_build/windows/gpu/cmake/run_py.bat | 46 |
2 files changed, 85 insertions, 0 deletions
diff --git a/tensorflow/tools/ci_build/windows/gpu/cmake/run_build.bat b/tensorflow/tools/ci_build/windows/gpu/cmake/run_build.bat new file mode 100644 index 0000000000..f124012edc --- /dev/null +++ b/tensorflow/tools/ci_build/windows/gpu/cmake/run_build.bat @@ -0,0 +1,39 @@ +:: This script assumes the standard setup on tensorflow Jenkins windows machines. +:: It is NOT guaranteed to work on any other machine. Use at your own risk! +:: +:: REQUIREMENTS: +:: * All installed in standard locations: +:: - JDK8, and JAVA_HOME set. +:: - Microsoft Visual Studio 2015 Community Edition +:: - Msys2 +:: - Anaconda3 +:: - CMake +:: * Before running this script, you have to set BUILD_CC_TESTS and BUILD_PYTHON_TESTS +:: variables to either "ON" or "OFF". +:: * Either have the REPO_ROOT variable set, or run this from the repository root directory. + +:: Check and set REPO_ROOT +IF [%REPO_ROOT%] == [] ( + SET REPO_ROOT=%cd% +) + +:: Import all bunch of variables Visual Studio needs. +CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" +:: Turn echo back on, above script turns it off. +ECHO ON + +:: Some common variables to be shared between runs. +SET CMAKE_EXE="C:\Program Files\cmake\bin\cmake.exe" +SET SWIG_EXE="C:\swigwin-3.0.10\swig.exe" +SET PY_EXE="C:\Program Files\Anaconda3\python.exe" +SET PY_LIB="C:\Program Files\Anaconda3\libs\python35.lib" +SET CUDNN_HOME="c:\tools\cuda" + +SET CMAKE_DIR=%REPO_ROOT%\tensorflow\contrib\cmake +SET MSBUILD_EXE="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" + +:: Run cmake to create Visual Studio Project files. +%CMAKE_EXE% %CMAKE_DIR% -A x64 -DSWIG_EXECUTABLE=%SWIG_EXE% -DPYTHON_EXECUTABLE=%PY_EXE% -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARIES=%PY_LIB% -Dtensorflow_BUILD_PYTHON_TESTS=%BUILD_PYTHON_TESTS% -Dtensorflow_BUILD_CC_TESTS=%BUILD_CC_TESTS% -Dtensorflow_ENABLE_GPU=ON -DCUDNN_HOME=%CUDNN_HOME% + +:: Run msbuild in the resulting VS project files to build a pip package. +%MSBUILD_EXE% /p:Configuration=Release /maxcpucount:32 tf_python_build_pip_package.vcxproj diff --git a/tensorflow/tools/ci_build/windows/gpu/cmake/run_py.bat b/tensorflow/tools/ci_build/windows/gpu/cmake/run_py.bat new file mode 100644 index 0000000000..9307ebb66b --- /dev/null +++ b/tensorflow/tools/ci_build/windows/gpu/cmake/run_py.bat @@ -0,0 +1,46 @@ +:: This script assumes the standard setup on tensorflow Jenkins windows machines. +:: It is NOT guaranteed to work on any other machine. Use at your own risk! +:: +:: REQUIREMENTS: +:: * All installed in standard locations: +:: - JDK8, and JAVA_HOME set. +:: - Microsoft Visual Studio 2015 Community Edition +:: - Msys2 +:: - Anaconda3 +:: - CMake + +:: Record the directory we are in. Script should be invoked from the root of the repository. +SET REPO_ROOT=%cd% + +:: Make sure we have a clean directory to build things in. +SET BUILD_DIR=cmake_build +RMDIR %BUILD_DIR% /S /Q +MKDIR %BUILD_DIR% +CD %BUILD_DIR% + +:: Set which tests to build +SET BUILD_CC_TESTS=OFF +SET BUILD_PYTHON_TESTS=ON + +SET PIP_EXE="C:\Program Files\Anaconda3\Scripts\pip.exe" + +:: Run the CMAKE build to build the pip package. +CALL %REPO_ROOT%\tensorflow\tools\ci_build\windows\gpu\cmake\run_build.bat +if %errorlevel% neq 0 exit /b %errorlevel% + +:: Attempt to upgrade PIP to work around Anaconda issue #542. +%PIP_EXE% install --ignore-installed --upgrade pip setuptools -v -v + +:: Since there are no wildcards in windows command prompt, use dark magic to get the wheel file name. +DIR %REPO_ROOT%\%BUILD_DIR%\tf_python\dist\ /S /B > wheel_filename_file +set /p WHEEL_FILENAME=<wheel_filename_file +del wheel_filename_file + +:: Install the pip package. +echo Installing PIP package... +%PIP_EXE% install --upgrade %WHEEL_FILENAME% -v -v +if %errorlevel% neq 0 exit /b %errorlevel% + +:: Run all python tests if the installation succeeded. +echo Running tests... +ctest -C Release --output-on-failure --jobs 1 |