onnxruntime/tools/scripts/python_test.sh
Changming Sun e91d91ae4f
Fix a build issue: /MP was not enabled correctly (#19190)
### Description

In PR #19073 I mistunderstood the value of "--parallel". Instead of
testing if args.parallel is None or not , I should test the returned
value of number_of_parallel_jobs function.

If build.py was invoked without --parallel, then args.parallel equals to
1. Because it is the default value. Then we should not add "/MP".
However, the current code adds it. Because if `args.paralllel` is
evaluated to `if 1` , which is True.
If build.py was invoked with --parallel with additional numbers, then
args.parallel equals to 0. Because it is unspecified. Then we should add
"/MP". However, the current code does not add it. Because `if
args.paralllel` is evaluated to `if 0` , which is False.

This also adds a new build flag: use_binskim_compliant_compile_flags, which is intended to be only used in ONNX Runtime team's build pipelines for compliance reasons. 

### Motivation and Context
2024-01-29 12:45:38 -08:00

28 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
set -ex
export src_dir=$1
export build_dir=$2
export config=$3
# it's for manylinux image
export PATH=/opt/python/cp38-cp38/bin:$PATH
echo Install Python Deps
cp $src_dir/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt $build_dir/requirements.txt
python3 -m pip install -r $build_dir/requirements.txt
mkdir -p $build_dir/requirements_torch_cpu/
cp $src_dir/tools/ci_build/github/linux/docker/scripts/training/ortmodule/stage1/requirements_torch_cpu/requirements.txt $build_dir/requirements_torch_cpu/requirements.txt
python3 -m pip install -r $build_dir/requirements_torch_cpu/requirements.txt
python3 -m pip list | grep onnx
echo Install $config python package
rm -rf $build_dir/$config/onnxruntime $build_dir/$config/pybind11
python3 -m pip install $build_dir/$config/dist/*.whl
echo Run $config unit tests
pushd $build_dir/$config/
python3 $src_dir/tools/ci_build/build.py --build_dir $build_dir --cmake_generator Ninja --config $config --test --skip_submodule_sync --build_shared_lib --parallel --use_binskim_compliant_compile_flags --build_wheel --enable_onnx_tests --enable_transformers_tool_test --ctest_path ""
popd