Skip to content

Commit e6e1825

Browse files
jkinskyjimmytweikrzeszewalexsin368ZhaoqiongZ
authored
Intel® Python XGBoost Performance sample readme update (#1463)
* Fixes for 2023.1 AI Kit (#1409) * Intel Python Numpy Numba_dpes kNN sample (#1292) * *.py and *.ipynb files with implementation * README.md and sample.json files with documentation * License and thir party programs * Adding PyTorch Training Optimizations with AMX BF16 oneAPI sample (#1293) * add IntelPytorch Quantization code samples (#1301) * add IntelPytorch Quantization code samples * fix the spelling error in the README file * use john's README with grammar fix and title change * Rename third-party-grograms.txt to third-party-programs.txt Co-authored-by: Jimmy Wei <[email protected]> * AMX bfloat16 mixed precision learning TensorFlow Transformer sample (#1317) * [New Sample] Intel Extension for TensorFlow Getting Started (#1313) * first draft * Update README.md * remove redunant file * [New Sample] [oneDNN] Benchdnn tutorial (#1315) * New Sample: benchDNN tutorial * Update readme: new sample * Rename sample to benchdnn_tutorial * Name fix * Add files via upload (#1320) * [New Sample] oneCCL Bindings for PyTorch Getting Started (#1316) * Update README.md * [New Sample] oneCCL Bindings for PyTorch Getting Started * Update README.md * add torch-ccl version check * [New Sample] Intel Extension for PyTorch Getting Started (#1314) * add new ipex GSG notebook for dGPU * Update sample.json for expertise field * Update requirements.txt Update package versions to comply with Snyk tool * Updated title field in sample.json in TF Transformer AMX bfloat16 Mixed Precision sample to fit within character length range (#1327) * add arch checker class (#1332) * change gpu.patch to convert the code samples from cpu to gpu correctly (#1334) * Fixes for spelling in AMX bfloat16 transformer sample and printing error in python code in numpy vs numba sample (#1335) * 2023.1 ai kit itex get started example fix (#1338) * Fix the typo * Update ResNet50_Inference.ipynb * fix resnet inference demo link (#1339) * Fix printing issue in numpy vs numba AI sample (#1356) * Fix Invalid Kmeans parameters on oneAPI 2023 (#1345) * Update README to add new samples into the list (#1366) * PyTorch AMX BF16 Training sample: remove graphs and performance numbers (#1408) * Adding PyTorch Training Optimizations with AMX BF16 oneAPI sample * remove performance graphs, update README * remove graphs from README and folder * update top README in Features and Functionality --------- Co-authored-by: krzeszew <[email protected]> Co-authored-by: alexsin368 <[email protected]> Co-authored-by: ZhaoqiongZ <[email protected]> Co-authored-by: Louie Tsai <[email protected]> Co-authored-by: Orel Yehuda <[email protected]> Co-authored-by: yuning <[email protected]> Co-authored-by: Wang, Kai Lawrence <[email protected]> Co-authored-by: xiguiw <[email protected]> * Update Restructured to match new template. Updated some formatting. Removed images since they reference a different sample. Added section on running the python script in local environment. Corrected some branding. Added information about looking at notebook to determine how to configure the two conda environments. --------- Co-authored-by: Jimmy Wei <[email protected]> Co-authored-by: krzeszew <[email protected]> Co-authored-by: alexsin368 <[email protected]> Co-authored-by: ZhaoqiongZ <[email protected]> Co-authored-by: Louie Tsai <[email protected]> Co-authored-by: Orel Yehuda <[email protected]> Co-authored-by: yuning <[email protected]> Co-authored-by: Wang, Kai Lawrence <[email protected]> Co-authored-by: xiguiw <[email protected]>
1 parent 61bd0f7 commit e6e1825

File tree

3 files changed

+69
-78
lines changed

3 files changed

+69
-78
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,122 @@
1-
# `Intel® Python XGBoost Performance Sample`
2-
This sample code illustrates how to analyze the performance benefit from using Intel optimizations upstreamed by Intel to latest XGBoost compared to un-optimized XGBoost 0.81. It demonstrates how to use software products that can be found in the [Intel® AI Analytics Toolkit (AI Kit)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html).
1+
# `Intel® Python XGBoost Performance` Sample
32

4-
| Optimized for | Description
5-
| :--- | :---
6-
| OS | 64-bit Linux: Ubuntu 18.04 or higher
7-
| Hardware | Intel Atom® Processors; Intel® Core™ Processor Family; Intel® Xeon® Processor Family; Intel® Xeon® Scalable processor family
8-
| Software | XGBoost, Intel® AI Analytics Toolkit
9-
| What you will learn | How to analyze the performance benefit from using Intel optimizations upstreamed by Intel to the latest XGBoost compared to un-optimized XGBoost 0.81
10-
| Time to complete | 10-15 minutes
3+
This `Intel® Python XGBoost Performance` sample illustrates how to analyze the performance benefit from using Intel optimizations upstreamed by Intel to latest XGBoost compared to un-optimized XGBoost 0.81. It demonstrates how to use software products that can be found in the [Intel® AI Analytics Toolkit (AI Kit)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html).
4+
5+
| Area | Description
6+
| :--- | :---
7+
| What you will learn | How to analyze the performance benefit from using Intel optimizations upstreamed by Intel to the latest XGBoost compared to un-optimized XGBoost 0.81
8+
| Time to complete | 10-15 minutes
9+
| Category | Code Optimization
1110

1211
## Purpose
1312

14-
XGBoost is a widely used gradient boosting library in the classical ML area. Designed for flexibility, performance, and portability, XGBoost includes optimized distributed gradient boosting frameworks and implements Machine Learning algorithms underneath.
13+
XGBoost is a widely used gradient boosting library in the classical machine learning (ML) area. Designed for flexibility, performance, and portability, XGBoost includes optimized distributed gradient boosting frameworks and implements Machine Learning algorithms underneath.
14+
15+
## Prerequisites
1516

16-
In this sample, you will an XGBoost model and prediction using Intel optimizations upstreamed by Intel to the latest XGBoost package and the un-optimized XGBoost 0.81 for comparison.
17+
| Optimized for | Description
18+
|:--- |:---
19+
| OS | Ubuntu* 18.04 or higher
20+
| Hardware | Intel Atom® processors <br> Intel® Core™ processor family <br> Intel® Xeon® processor family <br> Intel® Xeon® Scalable processor family
21+
| Software | XGBoost <br> Intel® AI Analytics Toolkit (AI Kit)
1722

1823
## Key Implementation Details
19-
This XGBoost sample code is implemented for the CPU using the Python language. The example assumes you XGBoost installed inside a conda environment, similar to what is delivered with the installation of the Intel® Distribution for Python* as part of the [Intel® AI Analytics Toolkit](https://software.intel.com/en-us/oneapi/ai-kit). It also assumes you have set up an additional XGBoost 0.81 conda environment, with details on how to do so explained within the sample and this README.
2024

21-
## License
22-
Code samples are licensed under the MIT license. See
23-
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
25+
In this sample, you will use a XGBoost model and prediction using Intel optimizations upstreamed by Intel to the latest XGBoost package and the un-optimized XGBoost 0.81 for comparison.
2426

25-
Third-party program Licenses can be found here: [third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt)
27+
This XGBoost sample code is implemented for the CPU using the Python language. The example assumes you XGBoost installed inside a conda environment, similar to what is delivered with the installation of the Intel® Distribution for Python* as part of the [Intel® AI Analytics Toolkit](https://software.intel.com/en-us/oneapi/ai-kit). It also assumes you have set up an additional XGBoost 0.81 conda environment, with details on how to do so explained within the sample and this README.
2628

27-
## Building XGBoost for CPU
29+
## Set Environment Variables
2830

29-
XGBoost is ready for use once you finish the Intel® AI Analytics Toolkit installation and have run the post installation script.
31+
When working with the command-line interface (CLI), you should configure the oneAPI toolkits using environment variables. Set up your CLI environment by sourcing the `setvars` script every time you open a new terminal window. This practice ensures that your compiler, libraries, and tools are ready for development.
3032

31-
You can refer to the oneAPI [main page](https://software.intel.com/en-us/oneapi) for toolkit installation and the Toolkit [Getting Started Guide for Linux](https://software.intel.com/en-us/get-started-with-intel-oneapi-linux-get-started-with-the-intel-ai-analytics-toolkit) for post-installation steps and scripts.
33+
## Run the `Intel® Python XGBoost Performance` Sample
34+
35+
### On Linux*
3236

3337
> **Note**: If you have not already done so, set up your CLI
34-
> environment by sourcing the `setvars` script located in
35-
> the root of your oneAPI installation.
36-
>
37-
> Linux Sudo: . /opt/intel/oneapi/setvars.sh
38-
>
39-
> Linux User: . ~/intel/oneapi/setvars.sh
38+
> environment by sourcing the `setvars` script in the root of your oneAPI installation.
4039
>
41-
> Windows: C:\Program Files(x86)\Intel\oneAPI\setvars.bat
40+
> Linux*:
41+
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
42+
> - For private installations: ` . ~/intel/oneapi/setvars.sh`
43+
> - For non-POSIX shells, like csh, use the following command: `bash -c 'source <install-dir>/setvars.sh ; exec csh'`
4244
>
43-
>For more information on environment variables, see Use the setvars Script for [Linux or macOS](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos.html), or [Windows](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-windows.html).
45+
> For more information on configuring environment variables, see *[Use the setvars Script with Linux* or macOS*](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos.html)*.
4446
45-
### Activate conda environment With Root Access
47+
XGBoost is ready for use once you finish the Intel® AI Analytics Toolkit installation and have run the post installation script.
4648

47-
Intel Python environment will be active by default. However, if you activated another environment, you can return with the following command:
49+
You can refer to the oneAPI [main page](https://software.intel.com/en-us/oneapi) for toolkit installation and the Toolkit [Getting Started Guide for Linux](https://software.intel.com/en-us/get-started-with-intel-oneapi-linux-get-started-with-the-intel-ai-analytics-toolkit) for post-installation steps and scripts.
50+
51+
#### Activate Conda with Root Access
52+
53+
By default, the AI Kit is installed in the `/opt/intel/oneapi` folder and requires root privileges to manage it. However, if you activated another environment, you can return with the following command.
4854

49-
#### On a Linux* System
5055
```
5156
source activate base
5257
```
5358

54-
### Activate conda environment Without Root Access (Optional)
59+
#### Activate Conda without Root Access (Optional)
5560

56-
By default, the Intel® AI Analytics Toolkit is installed in the inteloneapi folder, which requires root privileges to manage it. If you would like to bypass using root access to manage your conda environment, then you can clone your desired conda environment using the following command:
61+
You can choose to activate Conda environment without root access. To bypass root access to manage your Conda environment, clone and activate your desired Conda environment using the following commands similar to the following.
5762

58-
#### On a Linux* System
5963
```
6064
conda create --name usr_intelpython --clone base
61-
```
62-
63-
Then activate your conda environment with the following command:
64-
65-
```
6665
source activate usr_intelpython
6766
```
6867

69-
### Install Jupyter Notebook
68+
#### Install Jupyter Notebook
69+
7070
```
7171
conda install jupyter nb_conda_kernels
7272
```
7373

74-
### Building XGBoost 0.81 Conda Environment
74+
### Build Another XGBoost 0.81 Conda Environment
7575

76-
To see the performance comparison to the latest XGBoost with Intel optimizations and un-optimized XGBoost 0.81, you will be required to run this sample in a second conda environment with XGBoost 0.81 installed.
77-
78-
### View in Jupyter Notebook
79-
80-
_Note: This distributed execution cannot be launched from the jupyter notebook version, but you can still view inside the notebook to follow the included write-up and description._
81-
82-
Launch Jupyter Notebook in the directory housing the code example
83-
84-
```
85-
jupyter notebook
86-
```
76+
To see the performance comparison to the latest XGBoost with Intel optimizations and un-optimized XGBoost 0.81, you must run this sample in a second conda environment with **XGBoost 0.81** installed.
8777

88-
## Running the Sample
78+
See the information in the Jupyter Notebook on how to set up and run the different conda environments.
8979

90-
### Running the Sample as a Jupyter Notebook
80+
### View in Jupyter Notebook
9181

92-
Open .pynb file and run cells in Jupyter Notebook using the "Run" button (see the image using "Modin Getting Started" sample)
82+
> **Note**: This distributed sample cannot be executed from the Jupyter Notebook, but you can read the description and follow the program flow in the Notebook.
9383
94-
![Click the Run Button in the Jupyter Notebook](Jupyter_Run.jpg "Run Button on Jupyter Notebook")
84+
#### Open Jupyter Notebook
9585

96-
##### Expected Printed Output for Cells (with similar numbers):
97-
```
98-
[CODE_SAMPLE_COMPLETED_SUCCESFULLY]
99-
```
86+
> **Note**: This distributed sample cannot be executed from the Jupyter Notebook, but you can read the description and follow the program flow in the Notebook.
10087
101-
### Running the Sample as a Python File
88+
1. Change to the sample directory.
89+
2. Launch Jupyter Notebook.
90+
```
91+
jupyter notebook
92+
```
93+
3. Locate and select the Notebook.
94+
```
95+
IntelPython_XGBoost_Performance.ipynb
96+
```
97+
4. Click the **Run** button to move through the cells in sequence.
10298

103-
Open notebook in Jupyter and download as python file (see the image using "daal4py Hello World" sample)
99+
### Run the Python Script
104100

105-
![Download as python file in the Jupyter Notebook](Jupyter_Save_Py.jpg "Download as python file in the Jupyter Notebook")
101+
1. Change to the sample directory.
102+
2. Locate and run the script.
103+
```
104+
python IntelPython_XGBoost_Performance.py
105+
```
106106

107-
Run the Program
107+
#### Troubleshooting
108108

109-
`python IntelPython_XGBoost_Performance.py`
109+
If you receive an error message, troubleshoot the problem using the **Diagnostics Utility for Intel® oneAPI Toolkits**. The diagnostic utility provides configuration and system checks to help find missing dependencies, permissions errors, and other issues. See the *[Diagnostics Utility for Intel® oneAPI Toolkits User Guide](https://www.intel.com/content/www/us/en/develop/documentation/diagnostic-utility-user-guide/top.html)* for more information on using the utility.
110110

111-
The output files of the script will be saved in the included models and result directories.
111+
## Example Output
112112

113-
##### Expected Printed Output (with similar numbers):
114113
```
115114
[CODE_SAMPLE_COMPLETED_SUCCESFULLY]
116115
```
117-
### Using Visual Studio Code* (VS Code)
118116

119-
You can use VS Code extensions to set your environment, create launch configurations,
120-
and browse and download samples.
121-
122-
The basic steps to build and run a sample using VS Code include:
123-
- Download a sample using the extension **Code Sample Browser for Intel oneAPI Toolkits**.
124-
- Configure the oneAPI environment with the extension **Environment Configurator for Intel oneAPI Toolkits**.
125-
- Open a Terminal in VS Code (**Terminal>New Terminal**).
126-
- Run the sample in the VS Code terminal using the instructions below.
117+
## License
127118

128-
To learn more about the extensions and how to configure the oneAPI environment, see
129-
[Using Visual Studio Code with Intel® oneAPI Toolkits](https://software.intel.com/content/www/us/en/develop/documentation/using-vs-code-with-intel-oneapi/top.html).
119+
Code samples are licensed under the MIT license. See
120+
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
130121

131-
After learning how to use the extensions for Intel oneAPI Toolkits, return to this readme for instructions on how to build and run a sample.
122+
Third-party program Licenses can be found here: [third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).

0 commit comments

Comments
 (0)