Add an environment variable to explicitly enable/disable azureop build (#527)
* Update ci.yml for Azure Pipelines * Fix the command lines * is requirements-dev.txt * switch to windows * Update windows task * Update ci.yml for Azure Pipelines * add cmake in path on windows * Update ci.yml for Azure Pipelines * add explicit azure python build flag --------- Co-authored-by: Sayan Shaw <52221015+sayanshaw24@users.noreply.github.com>
This commit is contained in:
Родитель
d853d31fc1
Коммит
2b50a82171
|
@ -79,7 +79,7 @@ jobs:
|
|||
displayName: Install requirements.txt
|
||||
|
||||
- script: |
|
||||
CPU_NUMBER=2 python -m pip install -e .
|
||||
CPU_NUMBER=2 python -m pip install .
|
||||
displayName: Build the library and tests
|
||||
|
||||
- script: python -m pip install $(torch.version)
|
||||
|
@ -89,7 +89,40 @@ jobs:
|
|||
python -m pip install -r requirements-dev.txt
|
||||
displayName: Install requirements-dev.txt
|
||||
|
||||
- script: python -m pytest test --verbose
|
||||
- script: cd test && python -m pytest . --verbose
|
||||
displayName: Run python test
|
||||
|
||||
###############
|
||||
# Linux PyDebug
|
||||
###############
|
||||
- job: LinuxPyDbg
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.x'
|
||||
disableDownloadFromRegistry: true
|
||||
addToPath: false
|
||||
architecture: 'x64'
|
||||
|
||||
- script: |
|
||||
python -m pip install --upgrade setuptools pip
|
||||
python -m pip install numpy
|
||||
export OCOS_NO_OPENCV=1
|
||||
export OCOS_SCB_DEBUG=1
|
||||
CPU_NUMBER=2 python -m pip install -e .
|
||||
displayName: Build the python library in editable mode
|
||||
|
||||
- script: |
|
||||
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
||||
python -m pip install -r requirements-dev.txt
|
||||
displayName: Install requirements-dev.txt
|
||||
|
||||
- script: |
|
||||
cd test
|
||||
python -m pytest --ignore=test_cv2.py --ignore=test_tools_add_pre_post_processing_to_model.py . --verbose
|
||||
displayName: Run python test
|
||||
|
||||
###########
|
||||
|
@ -341,6 +374,40 @@ jobs:
|
|||
pytest test
|
||||
displayName: Run python test
|
||||
|
||||
#################
|
||||
# Windows PyDebug
|
||||
#################
|
||||
- job: WinPyDbgBuild
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.x'
|
||||
disableDownloadFromRegistry: true
|
||||
addToPath: false
|
||||
architecture: 'x64'
|
||||
displayName: Use ADO python task
|
||||
|
||||
- script: |
|
||||
python -m pip install --upgrade setuptools pip
|
||||
python -m pip install numpy
|
||||
set OCOS_NO_OPENCV=1
|
||||
set OCOS_SCB_DEBUG=1
|
||||
python -m pip install -v -e .
|
||||
displayName: Build onnxruntime-extensions in editable mode.
|
||||
|
||||
- script: |
|
||||
python -m pip install -r requirements-dev.txt
|
||||
python -m pip install torch torchvision torchaudio
|
||||
displayName: Install dependencies for pytest
|
||||
|
||||
- script: |
|
||||
cd test
|
||||
python -m pytest --ignore=test_cv2.py --ignore=test_tools_add_pre_post_processing_to_model.py . --verbose
|
||||
displayName: Run python test
|
||||
|
||||
#############
|
||||
# WebAssembly
|
||||
#############
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# Minimum CMake required
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(onnxruntime_extensions LANGUAGES C CXX)
|
||||
|
||||
|
@ -78,7 +82,7 @@ set(OCOS_ONNXRUNTIME_VERSION "" CACHE STRING
|
|||
# or it is enabled when OCOS_ENABLE_AZURE is set, which means the user explicitly enables it.
|
||||
if ((DEFINED ENV{BUILD_BUILDID}) OR (DEFINED ENV{OCOS_ENABLE_AZURE}))
|
||||
set(OCOS_ENABLE_AZURE ON CACHE INTERNAL "" FORCE)
|
||||
message("===> AzureOp is enabled by default.")
|
||||
message("=> AzureOp is enabled by default.")
|
||||
endif()
|
||||
|
||||
function(disable_all_operators)
|
||||
|
|
13
setup.py
13
setup.py
|
@ -91,9 +91,14 @@ class BuildCMakeExt(_build_ext):
|
|||
'-DOCOS_ENABLE_CV2=OFF',
|
||||
'-DOCOS_ENABLE_VISION=OFF']
|
||||
|
||||
if os.environ.get('OCOS_ENABLE_AZURE') == '1':
|
||||
cmake_args += ['-DOCOS_ENABLE_AZURE=ON']
|
||||
print ('azure ops enabled')
|
||||
# explicitly set the flag for AzureOp, despite the default value in CMakeLists.txt
|
||||
azure_flag = "ON" if os.environ.get('OCOS_ENABLE_AZURE') == '1' else None
|
||||
if azure_flag is None:
|
||||
# OCOS_NO_AZURE will be ignored if OCOS_ENABLE_AZURE is set.
|
||||
azure_flag = "OFF" if os.environ.get('OCOS_NO_AZURE') == '1' else None
|
||||
if azure_flag is not None:
|
||||
cmake_args += ['-DOCOS_ENABLE_AZURE=' + azure_flag]
|
||||
print("=> AzureOp build flag: " + azure_flag)
|
||||
|
||||
# CMake lets you override the generator - we need to check this.
|
||||
# Can be set with Conda-Build, for example.
|
||||
|
@ -149,6 +154,8 @@ class BuildCMakeExt(_build_ext):
|
|||
if os.environ.get(VSINSTALLDIR_NAME):
|
||||
cmake_exe = os.environ[VSINSTALLDIR_NAME] + \
|
||||
'Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe'
|
||||
# Add this cmake directory into PATH to make sure the child-process still find it.
|
||||
os.environ['PATH'] = os.path.dirname(cmake_exe) + os.pathsep + os.environ['PATH']
|
||||
|
||||
self.spawn([cmake_exe, '-S', str(project_dir), '-B', str(build_temp)] + cmake_args)
|
||||
if not self.dry_run:
|
||||
|
|
Загрузка…
Ссылка в новой задаче