Skip to content

Latest commit

 

History

History
135 lines (117 loc) · 7.01 KB

File metadata and controls

135 lines (117 loc) · 7.01 KB

Get Started with the Intel® Distribution for Python*

The Intel® Distribution for Python* is a cluster of packages including Numba, NumPy, and more. All these packages are optimized via Intel® oneAPI Math Kernel Library (oneMKL) and Intel® oneAPI Data Analytics Library (oneDAL) to make Python* application more efficient.

Supported Installation Options

Install via Intel® AI Analytics Toolkit

The Intel® AI Analytics Toolkit includes the Intel Distribution for Python. So the Intel Distribution for Python is ready for use once the Intel AI Analytics Toolkit installation is finished and the environment activation is run.

Environment Setup

  1. Install the Intel AI Analytics Toolkit.
    To download the Intel Distribution for Python* from the Intel AI Analytics Toolkit, visit here and choose the installation method of your choice. Find detailed information about the toolkit here.
  2. Set up Intel the AI Analytics Toolkit environment.
    Source the setvars script located in the root of your oneAPI installation.
  • Linux*:
    • Sudo:
    . /opt/intel/oneapi/setvars.sh
    
    • User:
    . ~/intel/oneapi/setvars.sh
    
  • Windows:
    C:\Program Files(x86)\Intel\oneAPI\setvars.bat
    

For more information on environment variables, check out how to use the setvars Script for Linux or macOS, or Windows.

  1. Activate the conda environment.
  • Linux*:
    • If you have root access to your oneAPI installation path or if you use the Intel® DevCloud, Intel Python environment will be activated by default. However, if you have activated another environment, you can return with the following command:
      source activate base
      
    • If you do not have root access to your oneAPI installation path:
      By default, the Intel AI Analytics Toolkit is installed in the /opt/intel/oneapi 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:
      conda create --name usr_intelpython --clone base
      
      Then activate your conda environment with the following command:
      source activate usr_intelpython
      
  • Windows:
    C:\ProgramFiles(x86)\Intel\oneAPI\intelpython\python3.x\Scripts\activate
    

Install via Anaconda

  1. Follow Conda Installation Guide to install Conda in your environment. If you already have conda installed in your system, please update your conda:
    conda update conda
    
  2. Add Intel channel.
    Tell conda to choose Intel packages over default packages, when available.
    conda config --add channels intel
    
  3. Install Intel Distribution for Python* via conda. We recommend that you create a new environment while installing. To install the core python3 environment, run:
    conda create -n idp intelpython3_core python=3.x
    
    Please note that “x” in “python=3.x” should signify which version of Python* you would like to install. For example, for Python* version 3.9: conda create -n idp intelpython3_core python=3.9.
  4. Activate the conda environment:
    conda activate idp
    

Sanity Check

After the activation of the environment, type python in the command line to find the Python* distribution info.

  • Linux* & Windows*: python
    The distribution info should include Intel Corporation:
    • Linux:
      Python 3.7.10 (default, Jun 4 2021, 06:52:02)
      [GCC 9.3.0] :: Intel Corporation on linux
      Type "help", "copyright", "credits" or "license" for more information.
      Intel(R) Distribution for Python is brought to you by Intel® Corporation.
      Please check out: https://software.intel.com/en-us/python-distribution
      
    • Windows:
      Python 3.9.10 (main, Mar 21 2022, 08:44:00) [MSC v.1916 64 bit (AMD64)] :: Intel Corporation on win32
      Type "help", "copyright", "credits" or "license" for more information.
      Intel(R) Distribution for Python is brought to you by Intel Corporation.
      Please check out: https://software.intel.com/en-us/python-distribution
      
    These methods can be used as a sanity check that Intel Distribution for Python is properly installed.

Sample Code

Run this numpy sample code in a stock Python* environment and in an IntelPython environment. You will see benefits from IntelPython.

import numpy as np
import time
  
start = time.time()
  
rd = np.random.RandomState(88)
a = rd.randint(1,1000,(1000,1000))
y = rd.randint(1,1000,(1000))
res = np.linalg.solve(a,y)
  
end = time.time()
  
print(res)
print('Time consumed:',end-start)

Build Your Own Project

No special modifications to your existing Python* projects are required to start using them with this toolkit. Check out the Reference Section for Github samples.

References

Support

If you have further questions or need support on your workload optimization, please submit your queries to the Intel AI Analytics Toolkit Forum or IntelPython GitHub, on the Issues or Discussions pages depending on the type of support required.

Notices and Disclaimers

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available updates. See backup for configuration details. No product or component can be absolutely secure.

Your costs and results may vary.

Intel technologies may require enabled hardware, software or service activation.

© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.