GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing intelpython.github.io — Quick Start Guide - Data Parallel Extension for NumPy (dpnp) 0.22.0dev1 documentation Quick Start Guide¶Device Drivers¶To start programming data parallel devices beyond CPU, you will need an appropriate hardware. The Data Parallel Extension for NumPy* works fine on Intel © laptops with integrated graphics. In majority of cases, your Windows*-based laptop already has all necessary device drivers installed. But if you want the most up-to-date driver, you can always update it to the latest one. Follow device driver installation instructions to complete the step. Python Interpreter¶You will need Python 3.11, 3.12, 3.13, 3.14 or 3.15 installed on your system. If you do not have one yet the easiest way to do that is to install Intel Distribution for Python*. It installs all essential Python numerical and machine learning packages optimized for the Intel hardware, including Data Parallel Extension for NumPy*. If you have Python installation from another vendor, it is fine too. All you need is to install Data Parallel Extension for NumPy* manually as shown in the next installation section. Installation¶Install Package from Intel(R) channel¶You will need one of the commands below:
These commands install dpnp package along with its dependencies, including
Warning Packages from the Intel channel are meant to be used together with dependencies from the conda-forge channel, and might not
work correctly when used in an environment where packages from the Note Before installing with conda or pip it is strongly advised to update Build and Install Conda Package¶Alternatively you can create and activate a local conda build environment: conda create -n build-env conda-build conda activate build-env And to build dpnp package from the sources: conda-build conda-recipe -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels Finally, to install the result package: conda install dpnp -c local Build and Install with scikit-build¶Another way to build and install dpnp package from the source is to use Python
On Linux: conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel \ onedpl-devel cmake scikit-build ninja versioneer pytest ocl-icd-system \ -c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels conda activate build-env On Windows: conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel \ onedpl-devel cmake scikit-build ninja versioneer pytest khronos-opencl-icd-loader\ -c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels conda activate build-env To build and install the package on Linux OS, run: python setup.py build_ext --inplace -- -G Ninja -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx python -m pip install -e . --no-build-isolation To build and install the package on Windows OS, run: python setup.py build_ext --inplace -- -G Ninja -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icx python -m pip install -e . --no-build-isolation Alternatively, to develop on Linux or Windows OS, you can use the driver script: python scripts/build_locally.py
Building for custom SYCL targets¶Project Building Building Builds for CUDA and AMD devices internally use SYCL alias targets that are passed to the compiler. A full list of available SYCL alias targets is available in the DPC++ Compiler User Manual. CUDA build¶To build for CUDA devices, use the To target a specific architecture (e.g., python scripts/build_locally.py --target-cuda=sm_80 To use the default architecture ( python scripts/build_locally.py --target-cuda Note that kernels are built for the default architecture ( For reference, compute architecture strings like AMD build¶To build for AMD devices, use the python scripts/build_locally.py --target-hip=<arch> Note that the oneAPI for AMD GPUs plugin requires the architecture be specified and only one architecture can be specified at a time. To determine the architecture code ( rocminfo | grep 'Name: *gfx.*' This will print names like For example: python scripts/build_locally.py --target-hip=gfx90a Multi-target build¶The default python scripts/build_locally.py --target-cuda --target-hip=gfx90a Command-Line Interface¶The python -m dpnp --includes # print -I flag for dpnp include directory python -m dpnp --include-dir # print path to dpnp include directory python -m dpnp --tensor-includes # print -I flag for libtensor include directory python -m dpnp --tensor-include-dir # print path to libtensor include directory These options are useful when building pybind11 extensions that use
Testing¶To run the test suite from the source tree, after building the package as described above, run: python -m pytest dpnp/tests To run the tests of an installed python -m pytest --pyargs dpnp.tests Examples¶The examples below demonstrates a simple usage of the Data Parallel Extension for NumPy* How to create an array and to sum the elements¶
1""" 2 3import dpnp as np 4 5x = np.asarray([1, 2, 3]) 6print("Array x allocated on the device:", x.device) 7 8y = np.sum(x) 9 10print("Result y is located on the device:", y.device) # The same device as x 11print("Shape of y is:", y.shape) # 0-dimensional array 12print("y =", y) # Expect 6 How to create an array on the specific device type and how the next computations follow it¶
1""" 2 3import dpnp as np 4 5x = np.empty(3) 6try: 7 x = np.asarray([1, 2, 3], device="gpu") 8except Exception: 9 print("GPU device is not available") 10 11print("Array x allocated on the device:", x.device) 12 13y = np.sum(x) 14 15print("Result y is located on the device:", y.device) # The same device as x 16print("Shape of y is:", y.shape) # 0-dimensional array 17print("y=", y) # Expect 6 More examples on how to use |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |