-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[WIP] Windows dev environment configuration, update install instructions from source in the docs #17808
[WIP] Windows dev environment configuration, update install instructions from source in the docs #17808
Changes from 35 commits
f80a477
be588c2
fae6d34
5febea3
0d4e884
3416a64
33fc990
395c513
bc2d895
74a8d8c
ada659f
977b56e
7cbc4a9
78b0f28
9c9758a
5a2fa87
55c5e93
f62198a
af0d910
ef64105
73437de
19cc08b
01e3faf
2fef756
a786bfc
f6f5a6a
5d14df3
9944a2e
ca81f3a
dddbf2a
3997316
2054768
ba1896e
e0b8a23
bac2b67
27cce4a
12e8a6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
+38 −0 | .github/workflows/githubci.yml | |
+0 −87 | .travis.yml | |
+1 −1 | README.md | |
+13 −0 | appveyor.yml | |
+0 −1 | cmake/build_config.h.in | |
+1 −16 | doc/Doxyfile | |
+0 −1 | include/dmlc/build_config_default.h | |
+18 −18 | include/dmlc/concurrentqueue.h | |
+7 −14 | scripts/packages.mk | |
+0 −0 | scripts/s390x/Dockerfile | |
+0 −0 | scripts/s390x/build_via_cmake.sh | |
+1 −1 | scripts/s390x/ci_build.sh | |
+0 −0 | scripts/s390x/entrypoint.sh | |
+0 −32 | scripts/setup_nvcc.sh | |
+9 −5 | scripts/test_script.sh | |
+0 −3 | scripts/travis/travis_before_cache.sh | |
+0 −13 | scripts/travis/travis_osx_install.sh | |
+0 −40 | scripts/travis/travis_setup_env.sh | |
+0 −16 | src/build_config.cc |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,13 +33,20 @@ | |
import zipfile | ||
from distutils.dir_util import copy_tree | ||
from enum import Enum | ||
from subprocess import check_call | ||
from subprocess import check_call, call | ||
|
||
from util import * | ||
|
||
|
||
# Fix for broken PATH with newline inserted presumably by VS studio installation of SQL server or | ||
# other component which makes visual studio stop working. | ||
os.environ['PATH']=os.environ.get('PATH').replace('\n','') | ||
|
||
KNOWN_VCVARS = { | ||
# https://gitlab.kitware.com/cmake/cmake/issues/18920 | ||
'VS 2015': r'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat', | ||
'VS 2017': r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat' | ||
'VS 2017': r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat', | ||
'VS 2019': r'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat' | ||
} | ||
|
||
|
||
|
@@ -54,10 +61,14 @@ class BuildFlavour(Enum): | |
|
||
CMAKE_FLAGS = { | ||
'WIN_CPU': ( | ||
'-DCMAKE_C_COMPILER=cl ' | ||
'-DCMAKE_CXX_COMPILER=cl ' | ||
'-DUSE_CUDA=OFF ' | ||
'-DUSE_CUDNN=OFF ' | ||
'-DENABLE_CUDA_RTC=OFF ' | ||
'-DUSE_OPENCV=ON ' | ||
'-DOpenCV_RUNTIME=vc15 ' | ||
'-DOpenCV_ARCH=x64 ' | ||
'-DUSE_OPENMP=ON ' | ||
'-DUSE_BLAS=open ' | ||
'-DUSE_LAPACK=ON ' | ||
|
@@ -67,10 +78,14 @@ class BuildFlavour(Enum): | |
'-DCMAKE_BUILD_TYPE=Release') | ||
|
||
, 'WIN_CPU_MKLDNN': ( | ||
'-DCMAKE_C_COMPILER=cl ' | ||
'-DCMAKE_CXX_COMPILER=cl ' | ||
'-DUSE_CUDA=OFF ' | ||
'-DUSE_CUDNN=OFF ' | ||
'-DENABLE_CUDA_RTC=OFF ' | ||
'-DUSE_OPENCV=ON ' | ||
'-DOpenCV_RUNTIME=vc15 ' | ||
'-DOpenCV_ARCH=x64 ' | ||
'-DUSE_OPENMP=ON ' | ||
'-DUSE_BLAS=open ' | ||
'-DUSE_LAPACK=ON ' | ||
|
@@ -80,10 +95,14 @@ class BuildFlavour(Enum): | |
'-DCMAKE_BUILD_TYPE=Release') | ||
|
||
, 'WIN_CPU_MKLDNN_MKL': ( | ||
'-DCMAKE_C_COMPILER=cl ' | ||
'-DCMAKE_CXX_COMPILER=cl ' | ||
'-DUSE_CUDA=OFF ' | ||
'-DUSE_CUDNN=OFF ' | ||
'-DENABLE_CUDA_RTC=OFF ' | ||
'-DUSE_OPENCV=ON ' | ||
'-DOpenCV_RUNTIME=vc15 ' | ||
'-DOpenCV_ARCH=x64 ' | ||
'-DUSE_OPENMP=ON ' | ||
'-DUSE_BLAS=mkl ' | ||
'-DUSE_LAPACK=ON ' | ||
|
@@ -93,10 +112,14 @@ class BuildFlavour(Enum): | |
'-DCMAKE_BUILD_TYPE=Release') | ||
|
||
, 'WIN_CPU_MKL': ( | ||
'-DCMAKE_C_COMPILER=cl ' | ||
'-DCMAKE_CXX_COMPILER=cl ' | ||
'-DUSE_CUDA=OFF ' | ||
'-DUSE_CUDNN=OFF ' | ||
'-DENABLE_CUDA_RTC=OFF ' | ||
'-DUSE_OPENCV=ON ' | ||
'-DOpenCV_RUNTIME=vc15 ' | ||
'-DOpenCV_ARCH=x64 ' | ||
'-DUSE_OPENMP=ON ' | ||
'-DUSE_BLAS=mkl ' | ||
'-DUSE_LAPACK=ON ' | ||
|
@@ -106,29 +129,37 @@ class BuildFlavour(Enum): | |
'-DCMAKE_BUILD_TYPE=Release') | ||
|
||
, 'WIN_GPU': ( | ||
'-DCMAKE_C_COMPILER=cl ' | ||
'-DCMAKE_CXX_COMPILER=cl ' | ||
'-DUSE_CUDA=ON ' | ||
'-DUSE_CUDNN=ON ' | ||
'-DENABLE_CUDA_RTC=ON ' | ||
'-DUSE_OPENCV=ON ' | ||
'-DOpenCV_RUNTIME=vc15 ' | ||
'-DOpenCV_ARCH=x64 ' | ||
'-DUSE_OPENMP=ON ' | ||
'-DUSE_BLAS=open ' | ||
'-DUSE_LAPACK=ON ' | ||
'-DUSE_DIST_KVSTORE=OFF ' | ||
'-DMXNET_CUDA_ARCH="5.2" ' | ||
'-DMXNET_CUDA_ARCH="7.5" ' | ||
leezu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'-DCMAKE_CXX_FLAGS="/FS /MD /O2 /Ob2" ' | ||
'-DUSE_MKL_IF_AVAILABLE=OFF ' | ||
'-DCMAKE_BUILD_TYPE=Release') | ||
|
||
, 'WIN_GPU_MKLDNN': ( | ||
'-DCMAKE_C_COMPILER=cl ' | ||
'-DCMAKE_CXX_COMPILER=cl ' | ||
'-DUSE_CUDA=ON ' | ||
'-DUSE_CUDNN=ON ' | ||
'-DENABLE_CUDA_RTC=ON ' | ||
'-DUSE_OPENCV=ON ' | ||
'-DOpenCV_RUNTIME=vc15 ' | ||
'-DOpenCV_ARCH=x64 ' | ||
'-DUSE_OPENMP=ON ' | ||
'-DUSE_BLAS=open ' | ||
'-DUSE_LAPACK=ON ' | ||
'-DUSE_DIST_KVSTORE=OFF ' | ||
'-DMXNET_CUDA_ARCH="5.2" ' | ||
'-DMXNET_CUDA_ARCH="7.5" ' | ||
'-DUSE_MKLDNN=ON ' | ||
'-DCMAKE_CXX_FLAGS="/FS /MD /O2 /Ob2" ' | ||
'-DCMAKE_BUILD_TYPE=Release') | ||
|
@@ -140,38 +171,40 @@ def windows_build(args): | |
logging.info("Using vcvars environment:\n{}".format(args.vcvars)) | ||
|
||
path = args.output | ||
os.makedirs(path, exist_ok=True) | ||
|
||
mxnet_root = get_mxnet_root() | ||
logging.info("Found MXNet root: {}".format(mxnet_root)) | ||
# cuda thrust + VS is flaky so try multiple times if fail | ||
MAXIMUM_TRY = 5 | ||
build_try = 0 | ||
|
||
while build_try < MAXIMUM_TRY: | ||
if os.path.exists(path): | ||
shutil.rmtree(path) | ||
os.makedirs(path, exist_ok=True) | ||
|
||
url = 'https://github.com/Kitware/CMake/releases/download/v3.16.1/cmake-3.16.1-win64-x64.zip' | ||
with tempfile.TemporaryDirectory() as tmpdir: | ||
cmake_file_path = download_file(url, tmpdir) | ||
with zipfile.ZipFile(cmake_file_path, 'r') as zip_ref: | ||
# Create $tmpdir\cmake-3.16.1-win64-x64\bin\cmake.exe | ||
zip_ref.extractall(tmpdir) | ||
mxnet_root = get_mxnet_root() | ||
logging.info("Found MXNet root: {}".format(mxnet_root)) | ||
|
||
with remember_cwd(): | ||
os.chdir(path) | ||
cmd = "\"{}\" && {} -G \"NMake Makefiles JOM\" {} {}".format( | ||
args.vcvars, | ||
os.path.join(tmpdir, 'cmake-3.16.1-win64-x64', 'bin', 'cmake.exe'), | ||
CMAKE_FLAGS[args.flavour], mxnet_root) | ||
cmd = "\"{}\" && cmake -G Ninja {} {}".format(args.vcvars, | ||
CMAKE_FLAGS[args.flavour], | ||
mxnet_root) | ||
logging.info("Generating project with CMake:\n{}".format(cmd)) | ||
check_call(cmd, shell=True) | ||
|
||
cmd = "\"{}\" && jom".format(args.vcvars) | ||
logging.info("Building with jom:\n{}".format(cmd)) | ||
cmd = "\"{}\" && ninja".format(args.vcvars) | ||
logging.info("Building:\n{}".format(cmd)) | ||
|
||
t0 = int(time.time()) | ||
check_call(cmd, shell=True) | ||
|
||
logging.info( | ||
"Build flavour: {} complete in directory: \"{}\"".format( | ||
args.flavour, os.path.abspath(path))) | ||
logging.info("Build took {}".format( | ||
datetime.timedelta(seconds=int(time.time() - t0)))) | ||
ret = call(cmd, shell=True) | ||
|
||
if ret != 0: | ||
build_try += 1 | ||
logging.info("{} build(s) have failed".format(build_try)) | ||
else: | ||
logging.info("Build flavour: {} complete in directory: \"{}\"".format(args.flavour, os.path.abspath(path))) | ||
logging.info("Build took {}".format(datetime.timedelta(seconds=int(time.time() - t0)))) | ||
break | ||
windows_package(args) | ||
|
||
|
||
|
@@ -193,6 +226,7 @@ def windows_package(args): | |
for dll in dlls: | ||
logging.info("packing dll: %s", dll) | ||
shutil.copy(dll, pkgdir_lib) | ||
|
||
os.chdir(get_mxnet_root()) | ||
logging.info('packing python bindings') | ||
copy_tree('python', j(pkgdir, 'python')) | ||
|
@@ -221,9 +255,6 @@ def main(): | |
logging.getLogger().setLevel(logging.INFO) | ||
logging.basicConfig(format='%(asctime)-15s %(message)s') | ||
logging.info("MXNet Windows build helper") | ||
instance_info = ec2_instance_info() | ||
if instance_info: | ||
logging.info("EC2: %s", instance_info) | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-o", "--output", | ||
|
@@ -233,7 +264,7 @@ def main(): | |
|
||
parser.add_argument("--vcvars", | ||
help="vcvars batch file location, typically inside vs studio install dir", | ||
default=KNOWN_VCVARS['VS 2015'], | ||
default=KNOWN_VCVARS['VS 2019'], | ||
type=str) | ||
|
||
parser.add_argument("--arch", | ||
|
@@ -253,12 +284,8 @@ def main(): | |
system = platform.system() | ||
if system == 'Windows': | ||
logging.info("Detected Windows platform") | ||
if 'OpenBLAS_HOME' not in os.environ: | ||
os.environ["OpenBLAS_HOME"] = "C:\\Program Files\\OpenBLAS-v0.2.19" | ||
if 'OpenCV_DIR' not in os.environ: | ||
os.environ["OpenCV_DIR"] = "C:\\Program Files\\OpenCV-v3.4.1\\build" | ||
if 'CUDA_PATH' not in os.environ: | ||
os.environ["CUDA_PATH"] = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.2" | ||
os.environ["CUDA_PATH"] = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.2" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is your concern? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We didn't agree on increasing the minimum cuda version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We agreed on using VS 2019. Cuda 10 is a requirement for using VS 2019 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure about that? Usually visual studio can be upgraded by installing the vc++ toolset which then grants the possibility to compile other cuda versions. I'm not aware that this categorically excluded. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if 'MKL_ROOT' not in os.environ: | ||
os.environ["MKL_ROOT"] = "C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries\\windows\\mkl" | ||
windows_build(args) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,8 +38,9 @@ | |
|
||
from util import config_logging | ||
|
||
DOCKER_STOP_TIMEOUT_SECONDS = 3 | ||
DOCKER_STOP_TIMEOUT_SECONDS = 10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change |
||
CONTAINER_WAIT_SECONDS = 600 | ||
DOCKER_CLIENT_TIMEOUT = 600 | ||
|
||
|
||
class SafeDockerClient: | ||
|
@@ -54,7 +55,7 @@ def _trim_container_id(cid): | |
return cid[:12] | ||
|
||
def __init__(self): | ||
self._docker_client = docker.from_env() | ||
self._docker_client = docker.from_env(timeout=DOCKER_CLIENT_TIMEOUT) | ||
self._containers = set() | ||
self._docker_stop_timeout = DOCKER_STOP_TIMEOUT_SECONDS | ||
self._container_wait_seconds = CONTAINER_WAIT_SECONDS | ||
|
@@ -245,4 +246,4 @@ def main(command_line_arguments): | |
|
||
|
||
if __name__ == "__main__": | ||
exit(main(sys.argv[1:])) | ||
exit(main(sys.argv[1:])) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,11 @@ $env:MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0 | |
$env:MXNET_SUBGRAPH_VERBOSE=0 | ||
$env:MXNET_HOME=[io.path]::combine($PSScriptRoot, 'mxnet_home') | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's print all ENV Vars to compare state of env vars in CI run vs manual powershell test |
||
$env:PATH+=[io.path]::combine($pwd.Path,"windows_package\lib") | ||
|
||
C:\Python37\Scripts\pip install -r tests\requirements.txt | ||
C:\Python37\Scripts\pip install -e $env:PYTHONPATH | ||
|
||
C:\Python37\python.exe -m nose -v --with-timer --timer-ok 1 --timer-warning 15 --timer-filter warning,error --with-xunit --xunit-file nosetests_unittest.xml tests\python\unittest | ||
if ($LastExitCode -ne 0) { Throw ("Error running unittest, python exited with status code " + ('{0:X}' -f $LastExitCode)) } | ||
C:\Python37\python.exe -m nose -v --with-timer --timer-ok 1 --timer-warning 15 --timer-filter warning,error --with-xunit --xunit-file nosetests_operator.xml tests\python\gpu\test_operator_gpu.py | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
|
||
$ErrorActionPreference = "Stop" | ||
Set-StrictMode -Version Latest | ||
function Check-Call { | ||
param ( | ||
[scriptblock]$ScriptBlock | ||
) | ||
Write-Host "Executing $ScriptBlock" | ||
& @ScriptBlock | ||
if (($lastexitcode -ne 0)) { | ||
Write-Error "Execution failed with $lastexitcode" | ||
exit $lastexitcode | ||
} | ||
} | ||
Check-Call { setx PATH "$($env:path);c:\Program Files\CMake\bin;C:\Program Files\opencv\x64\vc15\bin;" /m } | ||
Set-ExecutionPolicy Bypass -Scope Process -Force | ||
$progressPreference = 'silentlyContinue' | ||
Invoke-WebRequest -Uri https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.4/npp.7.8.4.Installer.exe -OutFile npp.7.8.4.Installer.exe | ||
Check-Call { .\npp.7.8.4.Installer.exe /S } | ||
Invoke-WebRequest -Uri https://chocolatey.org/install.ps1 -OutFile install.ps1 | ||
./install.ps1 | ||
#Check-Call { C:\ProgramData\chocolatey\choco install python2 -y --no-progress } | ||
Check-Call { C:\ProgramData\chocolatey\choco install python --version=3.7.0 --force -y --no-progress -r} | ||
Check-Call { C:\Python37\python -m pip install --upgrade pip } | ||
Check-Call { C:\Python37\python -m pip install -r requirements.txt } | ||
#Check-Call { C:\Python27\python -m pip install --upgrade pip } | ||
#Check-Call { C:\Python27\python -m pip install -r requirements.txt } | ||
|
||
Check-Call { C:\ProgramData\chocolatey\choco install git -y -r --no-progress } | ||
Check-Call { C:\ProgramData\chocolatey\choco install 7zip -y -r --no-progress } | ||
Check-Call { C:\ProgramData\chocolatey\choco install cmake -y -r --no-progress } | ||
Check-Call { C:\ProgramData\chocolatey\choco install ninja -y -r --no-progress } | ||
|
||
# Deps | ||
Check-Call { C:\Python37\python windows_deps_headless_installer.py } | ||
|
||
# Other software | ||
#Check-Call { C:\ProgramData\chocolatey\choco install jom -y } | ||
#Check-Call { C:\ProgramData\chocolatey\choco install mingw -y -r --no-progress } | ||
Check-Call { C:\ProgramData\chocolatey\choco install javaruntime -y -r --no-progress } | ||
|
||
# update path after all software is installed | ||
refreshenv | ||
|
||
Write-Output "End" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChaiBapchya @vexilligera you added this line, but it doesn't have any effect as it is overwritte in the line below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does append right?
I thought we are appending to
CMAKE_CXX_FLAGS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the typo!!!!
CMAKE_CXX_FLAGS
instead ofCMAKE_C_FLAGS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. I thought it would append...