### Description If the number of trees is >= 100 and batch size >= 2000, the parallelization by tree becomes slower than the parallelization by rows. However, by applying the parallelization by trees over smaller chunks of data, it is still better than the parallelization by rows. The following script was used to measure the performance [plot_gexternal_lightgbm_reg_per.zip](https://github.com/microsoft/onnxruntime/files/10149092/plot_gexternal_lightgbm_reg_per.zip) with different thresholds. The graph were produced by the script following the graph. * //N means parallelization by rows * //T means parallelization by trees * //T-128 means parallelization by trees every batch of 128 rows. * //T-1024 means parallelization by trees every batch of 1024 rows. The following graphs shows that the parallelization by trees is better than the parallelization by rows on small batches only. It is also better to split the input tensor by chunks of 128 rows and parallelize by trees on every chunk of 128 rows. The proposed changes implements that optimization. It applies the same idea even when there is only one thread. It also makes sure one thread is used when the user only wants one.  ```python import pandas import matplotlib.pyplot as plt filenames = [ ("//N",r"plot_gexternal_lightgbm_reg_per_N.csv"), ("//T", "plot_gexternal_lightgbm_reg_per_T.csv"), ("//T-128", "plot_gexternal_lightgbm_reg_per_128.csv"), ("//T-1024", "plot_gexternal_lightgbm_reg_per_1024.csv"), ] dfs = [] for name, filename in filenames: df = pandas.read_csv(filename) for c in df.columns: if "batch" in c: df[f"-{name}-{c}"] = df[c] dfs.append(df) df = dfs[0][["N"]].copy() for _df in dfs: for c in _df.columns: if c[0] == "-": df[c] = _df[c].copy() fig, ax = plt.subplots(1, 3, figsize=(14, 6)) Ts = [50, 500, 2000] ga = df.set_index("N") for i, nt in enumerate(Ts): cs = [c for c in ga.columns if c.endswith(f"-{nt}")] ga[cs].plot(ax=ax[i], title=f"Trees={nt}", logy=True, logx=True) ``` Below the performance gain for the monothread implementation by looping on data in the inner loop.  ### Motivation and Context Performance. Signed-off-by: xadupre <xadupre@microsoft.com> |
||
|---|---|---|
| .config | ||
| .devcontainer | ||
| .gdn | ||
| .github | ||
| .pipelines | ||
| .vscode | ||
| cgmanifests | ||
| cmake | ||
| csharp | ||
| dockerfiles | ||
| docs | ||
| include/onnxruntime/core | ||
| java | ||
| js | ||
| objectivec | ||
| onnxruntime | ||
| orttraining | ||
| package/rpm | ||
| samples | ||
| test | ||
| tools | ||
| winml | ||
| .clang-format | ||
| .clang-tidy | ||
| .dockerignore | ||
| .flake8 | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| build.amd64.1411.bat | ||
| build.bat | ||
| build.sh | ||
| CITATION.cff | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| lgtm.yml | ||
| LICENSE | ||
| NuGet.config | ||
| ort.wprp | ||
| ORT_icon_for_light_bg.png | ||
| packages.config | ||
| pyproject.toml | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements-doc.txt | ||
| requirements-training.txt | ||
| requirements.txt.in | ||
| SECURITY.md | ||
| setup.py | ||
| ThirdPartyNotices.txt | ||
| VERSION_NUMBER | ||

ONNX Runtime is a cross-platform inference and training machine-learning accelerator.
ONNX Runtime inference can enable faster customer experiences and lower costs, supporting models from deep learning frameworks such as PyTorch and TensorFlow/Keras as well as classical machine learning libraries such as scikit-learn, LightGBM, XGBoost, etc. ONNX Runtime is compatible with different hardware, drivers, and operating systems, and provides optimal performance by leveraging hardware accelerators where applicable alongside graph optimizations and transforms. Learn more →
ONNX Runtime training can accelerate the model training time on multi-node NVIDIA GPUs for transformer models with a one-line addition for existing PyTorch training scripts. Learn more →
Get Started & Resources
-
General Information: onnxruntime.ai
-
Usage documention and tutorials: onnxruntime.ai/docs
-
YouTube video tutorials: youtube.com/@ONNXRuntime
-
Companion sample repositories:
- ONNX Runtime Inferencing: microsoft/onnxruntime-inference-examples
- ONNX Runtime Training: microsoft/onnxruntime-training-examples
Build Pipeline Status
| System | CPU | GPU | EPs |
|---|---|---|---|
| Windows | |||
| Linux | |||
| Mac | |||
| Android | |||
| iOS | |||
| WebAssembly |
Data/Telemetry
Windows distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.
Contributions and Feedback
We welcome contributions! Please see the contribution guidelines.
For feature requests or bug reports, please file a GitHub Issue.
For general discussion or questions, please use GitHub Discussions.
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
License
This project is licensed under the MIT License.