You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `Intel® Python NumPy vs numba-dpex` sample shows how to achieve the same accuracy of the k-NN model classification while using NumPy, Numba, and Data-parallel Extension for Numba* (numba-dpex).
3
+
The `Intel® Python: NumPy vs numba-dpex` sample shows how to achieve the same accuracy of the k-NN model classification while using NumPy*, Numba*, and Data Parallel Extension for Numba* (numba-dpex).
4
4
5
-
| Area | Description
5
+
| Property | Description
6
6
| :--- | :---
7
-
| What you will learn | How to program using the Data-parallel Extension for Numba* (numba-dpex)
8
-
| Time to complete | 5 minutes
9
7
| Category | Code Optimization
8
+
| What you will learn | How to program using the Data Parallel Extension for Numba* (numba-dpex)
9
+
| Time to complete | 5 minutes
10
10
11
-
>**Note**: The libraries used in this sample are available in Intel® Distribution for Python*as part of the [Intel® AI Analytics Toolkit (AI Kit)](https://software.intel.com/en-us/oneapi/ai-kit).
11
+
>**Note**: This sample is validated on Intel® Distribution for Python*Offline Installer and AI Tools Offline Installer. For the full list of validated platforms refer to [Platform Validation](https://github.com/oneapi-src/oneAPI-samples/tree/master?tab=readme-ov-file#platform-validation).
12
12
13
13
## Purpose
14
14
@@ -20,109 +20,82 @@ In this sample, you will run a k-nearest neighbors algorithm using 3 different I
20
20
|:--- |:---
21
21
| OS | Ubuntu* 20.04
22
22
| Hardware | CPU
23
-
| Software | Intel® AI Analytics Toolkit (AI Kit)
23
+
| Software | Intel® Distribution for Python*
24
24
25
-
### For Local Development Environments
25
+
##Key Implementation Details
26
26
27
-
You will need to download and install the following toolkits, tools, and components to use the sample.
27
+
This sample code is implemented for the CPU using Python. The sample assumes you have numba-dpex installed inside a Conda environment, similar to what is installed with the Intel® Distribution for Python*.
28
28
29
-
-**Intel® AI Analytics Toolkit (AI Kit)**
29
+
The sample tutorial contains one Jupyter Notebook and one Python script. You can use either.
30
30
31
-
You can get the AI Kit from [Intel® oneAPI Toolkits](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html#analytics-kit). <br> See [*Get Started with the Intel® AI Analytics Toolkit for Linux**](https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-ai-linux) for AI Kit installation information and post-installation steps and scripts.
31
+
## Environment Setup
32
+
You will need to download and install the following toolkits to use the sample.
33
+
<!-- Use numbered steps instead of subheadings -->
32
34
33
-
-**Jupyter Notebook**
35
+
**1. Get Intel® Distribution for Python***
34
36
35
-
Install using PIP: `$pip install notebook`. <br> Alternatively, see [*Installing Jupyter*](https://jupyter.org/install) for detailed installation instructions.
37
+
If you have not already, install Intel® Distribution for Python* via [Installer](https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-python-download.html?operatingsystem=linux&linux-install-type=offline).
36
38
37
-
### For Intel® DevCloud
39
+
**2. Activate the Intel® Distribution for Python\* base environment**
40
+
<!-- this step is from AI Tools GSG, please don't modify unless GSG is updated -->
41
+
If the default path is used during the installation of Intel® Distribution for Python*:
42
+
```
43
+
source $HOME/intelpython3/bin/activate
44
+
```
45
+
If a non-default path is used:
46
+
```
47
+
source <custom_path>/bin/activate
48
+
```
38
49
39
-
The necessary tools and components are already installed in the environment. You do not need to install additional components. See [Intel® DevCloud for oneAPI](https://devcloud.intel.com/oneapi/get_started/) for information.
50
+
**3. Clone the GitHub repository**
51
+
<!-- for oneapi-samples: git clone https://github.com/oneapi-src/oneAPI-samples.git
52
+
cd oneAPI-samples/AI-and-Analytics/<samples-folder>/<individual-sample-folder> -->
53
+
<!-- for migrated samples - provide git clone command for individual repo and cd to sample dir -->
cd oneAPI-samples/AI-and-Analytics/Features-and-Functionality/IntelPython_Numpy_Numba_dpex_kNN
57
+
```
40
58
41
-
## Key Implementation Details
59
+
**4. Install dependencies**
60
+
<!-- It is required to have requirement.txt file in sample dir. It should list additional libraries, such as matplotlib, ipykernel etc. -->
61
+
>**Note**: Before running the following commands, make sure your Conda environment is activated
42
62
43
-
This sample code is implemented for the CPU using Python. The sample assumes you have numba-dpex installed inside a Conda environment, similar to what is installed with the Intel® Distribution for Python*.
63
+
```
64
+
pip install ipykernel
65
+
pip install notebook
66
+
```
67
+
For Jupyter Notebook, refer to [Installing Jupyter](https://jupyter.org/install) for detailed installation instructions.
68
+
69
+
## Run the Sample
70
+
>**Note**: Before running the sample, make sure [Environment Setup](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Features-and-Functionality/IntelPython_Numpy_Numba_dpex_kNN#environment-setup) is completed.
44
71
45
-
>**Note**: Read *[Get Started with the Intel® AI Analytics Toolkit for Linux*](https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-ai-linux/top.html)* to find out how you can achieve performance gains for popular deep-learning and machine-learning frameworks through Intel optimizations.
46
-
47
-
## Run the `Intel® Python NumPy vs numba-dpex` Sample
48
-
49
-
### On Linux*
50
-
51
-
> **Note**: If you have not already done so, set up your CLI
52
-
> environment by sourcing the `setvars` script in the root of your oneAPI installation.
53
-
>
54
-
> Linux*:
55
-
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
56
-
> - For private installations: ` . ~/intel/oneapi/setvars.sh`
57
-
> - For non-POSIX shells, like csh, use the following command: `bash -c 'source <install-dir>/setvars.sh ; exec csh'`
58
-
>
59
-
> 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)*.
60
-
61
-
#### Activate Conda
62
-
63
-
1. Activate the Conda environment.
64
-
```
65
-
conda activate base
66
-
```
67
-
By default, the AI Kit is installed in the `/opt/intel/oneapi` folder and requires root privileges to manage it.
68
-
69
-
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.
70
-
71
-
```
72
-
conda create --name usr_base --clone base
73
-
conda activate usr_base
74
-
```
75
-
76
-
#### Run the Python Script
77
-
78
-
1. Change to the sample directory.
79
-
2. Run the script.
80
-
```
81
-
python IntelPython_Numpy_Numba_dpex_kNN.py
82
-
```
83
-
84
-
#### Run the Jupyter Notebook (Optional)
85
-
86
-
1. Launch Jupyter Notebook.
87
-
```
88
-
jupyter notebook --ip=0.0.0.0
89
-
```
90
-
2. Follow the instructions to open the URL with the token in your browser.
91
-
3. Locate and select the Notebook.
92
-
```
93
-
IntelPython_Numpy_Numba_dpex_kNN.ipynb
94
-
```
95
-
4. Run every cell in the Notebook in sequence.
96
-
97
-
#### Troubleshooting
98
-
99
-
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.
100
-
101
-
### Build and Run the Sample on Intel® DevCloud (Optional)
102
-
103
-
>**Note**: For more information on using Intel® DevCloud, see the Intel® oneAPI [Get Started](https://devcloud.intel.com/oneapi/get_started/) page.
104
-
105
-
1. Open a terminal on a Linux* system.
106
-
2. Log in to the Intel® DevCloud.
107
-
```
108
-
ssh devcloud
109
-
```
110
-
3. If the sample is not already available, download the samples from GitHub.
*[Get Started with the Intel® Distribution for Python*](https://www.intel.com/content/www/us/en/developer/articles/technical/get-started-with-intel-distribution-for-python.html)
115
+
*[`Genetic Algorithms on GPU using Intel® Distribution for Python* numba-dpex` Sample](https://github.com/oneapi-src/AI-and-Analytics/Features-and-Functionality/IntelPython_GPU_numba-dpex_Genetic_Algorithm/README.md)
139
116
## License
140
117
141
-
Code samples are licensed under the MIT license. See [License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt)
118
+
Code samples are licensed under the MIT license. See
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