Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add environment variable to control default training package's local version #7849

Merged
merged 2 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ def run(self):

local_version = None
enable_training = parse_arg_remove_boolean(sys.argv, '--enable_training')
default_training_package_device = parse_arg_remove_boolean(sys.argv, '--default_training_package_device')

if enable_training:
packages.extend(['onnxruntime.training',
'onnxruntime.training.amp',
Expand All @@ -280,13 +282,16 @@ def run(self):
# this is needed immediately by pytorch/ort so that the user is able to
# install an onnxruntime training package with matching torch cuda version.
package_name = 'onnxruntime-training'
if cuda_version:
# removing '.' to make local Cuda version number in the same form as Pytorch.
local_version = '+cu' + cuda_version.replace('.', '')
if rocm_version:
# removing '.' to make Cuda version number in the same form as Pytorch.
rocm_version = rocm_version.replace('.', '')
local_version = '+rocm' + rocm_version

# we want put default training packages to pypi. pypi does not accept package with a local version.
if not default_training_package_device:
if cuda_version:
# removing '.' to make local Cuda version number in the same form as Pytorch.
local_version = '+cu' + cuda_version.replace('.', '')
if rocm_version:
# removing '.' to make Cuda version number in the same form as Pytorch.
rocm_version = rocm_version.replace('.', '')
local_version = '+rocm' + rocm_version


package_data = {}
Expand Down
8 changes: 7 additions & 1 deletion tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,8 @@ def run_nodejs_tests(nodejs_binding_dir):
def build_python_wheel(
source_dir, build_dir, configs, use_cuda, cuda_version, use_rocm, rocm_version, use_dnnl,
use_tensorrt, use_openvino, use_nuphar, use_vitisai, use_acl, use_armnn, use_dml,
wheel_name_suffix, enable_training, nightly_build=False, featurizers_build=False, use_ninja=False):
wheel_name_suffix, enable_training, nightly_build=False, default_training_package_device=False,
featurizers_build=False, use_ninja=False):
for config in configs:
cwd = get_config_build_dir(build_dir, config)
if is_windows() and not use_ninja:
Expand All @@ -1558,6 +1559,8 @@ def build_python_wheel(
# Any combination of the following arguments can be applied
if nightly_build:
args.append('--nightly_build')
if default_training_package_device:
args.append('--default_training_package_device')
if featurizers_build:
args.append("--use_featurizers")
if wheel_name_suffix:
Expand Down Expand Up @@ -2087,6 +2090,8 @@ def main():
if args.build:
if args.build_wheel:
nightly_build = bool(os.getenv('NIGHTLY_BUILD') == '1')
default_training_package_device = bool(os.getenv('DEFAULT_TRAINING_PACKAGE_DEVICE') == '1')

build_python_wheel(
source_dir,
build_dir,
Expand All @@ -2106,6 +2111,7 @@ def main():
args.wheel_name_suffix,
args.enable_training,
nightly_build=nightly_build,
default_training_package_device=default_training_package_device,
featurizers_build=args.use_featurizers,
use_ninja=(args.cmake_generator == 'Ninja')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ stages:
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx \
-e NVIDIA_VISIBLE_DEVICES=all \
-e NIGHTLY_BUILD \
-e DEFAULT_TRAINING_PACKAGE_DEVICE \
-e BUILD_BUILDNUMBER \
onnxruntimetraininggpubuild \
$(PythonManylinuxDir)/bin/python3 /onnxruntime_src/tools/ci_build/build.py \
Expand Down