### Install dpnp using Pip Source: https://intelpython.github.io/dpnp/quick_start_guide Installs the dpnp package from Intel's PyPI repository using pip. This command fetches dpnp and its required components. ```bash python -m pip install --index-url https://software.repos.intel.com/python/pypi dpnp ``` -------------------------------- ### Build and Install dpnp with scikit-build (Windows) Source: https://intelpython.github.io/dpnp/quick_start_guide Builds and installs the dpnp package from source on Windows using scikit-build and Ninja. It specifies the Intel C/C++ compiler (icx). ```bash python setup.py install -- -G Ninja -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icx ``` -------------------------------- ### Create and Sum Array with dpnp Source: https://intelpython.github.io/dpnp/quick_start_guide Demonstrates creating a dpnp array and calculating the sum of its elements. It shows how to check the device allocation of the array and the resulting sum. ```python import dpnp as np x = np.asarray([1, 2, 3]) print("Array x allocated on the device:", x.device) y = np.sum(x) print("Result y is located on the device:", y.device) # The same device as x print("Shape of y is:", y.shape) # 0-dimensional array print("y =", y) # Expect 6 ``` -------------------------------- ### DPNP arange Function Example Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_arraycreation Demonstrates the basic usage of the dpnp.arange function to create arrays with evenly spaced values. Shows examples with default parameters and custom start, stop, and step values. ```python import dpnp as np # Example 1: Default start and step print(np.arange(3)) # Example 2: Custom start and default step print(np.arange(3, 7)) # Example 3: Custom start, stop, and step print(np.arange(3, 7, 2)) ``` -------------------------------- ### Build and Install dpnp with scikit-build (Linux) Source: https://intelpython.github.io/dpnp/quick_start_guide Builds and installs the dpnp package from source on Linux using scikit-build and Ninja. It specifies the Intel C/C++ compilers (icx, icpx). ```bash python setup.py install -- -G Ninja -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx ``` -------------------------------- ### Example: Summing Array Elements in dpnp Source: https://intelpython.github.io/dpnp/_sources/quick_start_guide.rst Demonstrates a basic usage of dpnp for creating an array and calculating the sum of its elements. This example is part of the dpnp library's demonstration scripts. ```python import dpnp # Example code for summing array elements would go here # (Actual code not provided in the source text, only reference to file) ``` -------------------------------- ### Install dpnp using Conda Source: https://intelpython.github.io/dpnp/quick_start_guide Installs the dpnp package and its dependencies, including dpctl and necessary runtimes, from Intel's Conda channel. It also includes packages from conda-forge for compatibility. ```bash conda install dpnp -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels ``` -------------------------------- ### Create Conda Build Environment Source: https://intelpython.github.io/dpnp/quick_start_guide Sets up a Conda environment named 'build-env' with the necessary tools for building Conda packages, specifically 'conda-build'. ```bash conda create -n build-env conda-build conda activate build-env ``` -------------------------------- ### Build dpnp for AMD Devices Source: https://intelpython.github.io/dpnp/quick_start_guide Builds the dpnp library with support for AMD devices using the `--target-hip=` argument. The `` must be a valid architecture code for your AMD GPU, which can be found using `rocminfo`. Only one architecture can be specified at a time. ```bash python scripts/build_locally.py --target-hip= ``` ```bash rocminfo | grep 'Name: *gfx.*' ``` -------------------------------- ### Develop dpnp Locally using Driver Script (Linux) Source: https://intelpython.github.io/dpnp/quick_start_guide Uses a provided driver script to facilitate local development and building of the dpnp package on Linux systems. ```bash python scripts/build_locally.py ``` -------------------------------- ### Create Conda Build Environment for scikit-build (Windows) Source: https://intelpython.github.io/dpnp/quick_start_guide Creates a Conda environment named 'build-env' on Windows with all necessary development packages for building dpnp using scikit-build, including DPC++ components and Intel libraries. ```bash conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel \ onedpl-devel cmake scikit-build ninja versioneer pytest intel-gpu-ocl-icd-system \ -c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels conda activate build-env ``` -------------------------------- ### DPNP HammingFactory get() Method Source: https://intelpython.github.io/dpnp/backend_doc/structdpnp_1_1extensions_1_1window_1_1kernels_1_1_hamming_factory Documentation for the `get()` member function within the `HammingFactory` struct in the `dpnp::extensions::window::kernels` namespace. ```APIDOC ## GET /dpnp/extensions/window/kernels/HammingFactory/get ### Description Retrieves an instance of the Hamming kernel function. ### Method GET ### Endpoint /dpnp/extensions/window/kernels/HammingFactory/get ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **fnT** (function_pointer) - A pointer to the Hamming kernel function. #### Response Example ```json { "kernel_function": "" } ``` ### Source File `/github/workspace/dpnp/backend/extensions/window/hamming.hpp` ``` -------------------------------- ### Create Array on Specific Device Type with dpnp Source: https://intelpython.github.io/dpnp/quick_start_guide Illustrates creating a dpnp array on a specific device type, such as 'gpu', and how subsequent computations, like summation, inherit the device context. Includes error handling for cases where the specified device is unavailable. ```python import dpnp as np x = np.empty(3) try: x = np.asarray([1, 2, 3], device="gpu") except Exception: print("GPU device is not available") print("Array x allocated on the device:", x.device) y = np.sum(x) print("Result y is located on the device:", y.device) # The same device as x print("Shape of y is:", y.shape) # 0-dimensional array print("y=", y) # Expect 6 ``` -------------------------------- ### DPNP HanningFactory get() Method Source: https://intelpython.github.io/dpnp/backend_doc/structdpnp_1_1extensions_1_1window_1_1kernels_1_1_hanning_factory Provides access to the Hanning window kernel function. ```APIDOC ## GET /dpnp/extensions/window/kernels/HanningFactory/get ### Description Retrieves the Hanning window kernel function. This is a factory method that returns the actual functor for generating Hanning windows. ### Method GET ### Endpoint /dpnp/extensions/window/kernels/HanningFactory/get ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body needed for this GET request." } ``` ### Response #### Success Response (200) - **fnT** (function pointer or functor type) - A callable object or function pointer that generates Hanning window values. #### Response Example ```json { "example": "// Returns a callable Hanning functor or function pointer" } ``` ### Error Handling - **404**: If the endpoint is not found. - **500**: Internal server error during kernel retrieval. ``` -------------------------------- ### dpnp.asfortranarray Example Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.asfortranarray Demonstrates how to use dpnp.asfortranarray to create a Fortran-contiguous array from a C-contiguous array. It also shows that calling the function on an already Fortran-contiguous array returns the same object. Examples include creating arrays on different devices or with specified USM types. ```python >>> import dpnp as np # Starting with a C-contiguous array: >>> x = np.ones((2, 3), order='C') >>> x.flags['C_CONTIGUOUS'] True # Calling asfortranarray makes a Fortran-contiguous copy: >>> y = np.asfortranarray(x) >>> y.flags['F_CONTIGUOUS'] True >>> x is y False # Now, starting with a Fortran-contiguous array: >>> x = np.ones((2, 3), order='F') >>> x.flags['F_CONTIGUOUS'] True # Then, calling asfortranarray returns the same object: >>> y = np.asfortranarray(x) >>> x is y True # Creating an array on a different device or with a specified usm_type >>> x0 = np.asarray([1, 2, 3]) >>> x = np.asfortranarray(x0) # default case >>> x, x.device, x.usm_type (array([1, 2, 3]), Device(level_zero:gpu:0), 'device') >>> y = np.asfortranarray(x0, device="cpu") >>> y, y.device, y.usm_type (array([1, 2, 3]), Device(opencl:cpu:0), 'device') >>> z = np.asfortranarray(x0, usm_type="host") >>> z, z.device, z.usm_type (array([1, 2, 3]), Device(level_zero:gpu:0), 'host') ``` -------------------------------- ### Example: Array Computations on Specific Device in dpnp Source: https://intelpython.github.io/dpnp/_sources/quick_start_guide.rst Illustrates how to create an array on a specific device type and perform subsequent computations on it using dpnp. This showcases device-aware array operations. ```python # Example code for device-specific array computations would go here # (Actual code not provided in the source text, only reference to file) ``` -------------------------------- ### Install Built Conda Package Source: https://intelpython.github.io/dpnp/quick_start_guide Installs a dpnp package that has been previously built locally using Conda. The '-c local' flag points to the local package repository. ```bash conda install dpnp -c local ``` -------------------------------- ### Utility - get_include Source: https://intelpython.github.io/dpnp/reference/other The `get_include` function returns the directory containing the *.h header files for the DPNP C++ backend. ```APIDOC ## GET /get_include ### Description Return the directory that contains *.h header files of dpnp C++ backend. ### Method GET ### Endpoint /get_include ### Response #### Success Response (200) - **include_path** (string) - The path to the include directory. #### Response Example ```json { "include_path": "/path/to/dpnp/include" } ``` ``` -------------------------------- ### DPNP C++ Backend Kernel Library - dpnp::extensions::blas::DotuContigFactory Source: https://intelpython.github.io/dpnp/backend_doc/structdpnp_1_1extensions_1_1blas_1_1_dotu_contig_factory-members Documentation for the `get()` method within the `DotuContigFactory` class, which is part of the DPNP C++ backend kernel library's BLAS extensions. ```APIDOC ## dpnp::extensions::blas::DotuContigFactory< fnT, varT >::get() ### Description Retrieves an instance of the `DotuContigFactory`. ### Method This documentation does not specify the HTTP method as it pertains to a C++ library function, not a web API endpoint. ### Endpoint N/A (C++ library function) ### Parameters This method does not appear to take any parameters. ### Request Example N/A (C++ library function) ### Response #### Success Response - **Instance** (dpnp::extensions::blas::DotuContigFactory< fnT, varT >) - An instance of the `DotuContigFactory`. #### Response Example N/A (C++ library function output) ``` -------------------------------- ### Get Upper Triangular Indices with Diagonal Offset using dpnp.triu_indices_from Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.triu_indices_from This example shows how to use the `k` parameter in `dpnp.triu_indices_from` to retrieve indices for the upper triangular array starting from a specified diagonal offset. It demonstrates slicing the array using these indices. ```python >>> import dpnp as np >>> a = np.arange(16).reshape(4, 4) >>> triuim1 = np.triu_indices_from(a, k=1) >>> a[triuim1] array([ 1, 2, 3, 6, 7, 11]) ``` -------------------------------- ### Create Array with Same Shape and Type (DPNP) Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_arraycreation Demonstrates creating an array with the same shape and data type as a given array 'a' using dpnp.empty_like. Shows default behavior and how to specify 'cpu' device and 'host' USM type. ```python >>> import dpnp >>> import numpy as np >>> a = np.array([1, 2, 3]) >>> x = np.empty_like(a) # default case >>> x.shape, x.device, x.usm_type ((3, ), Device(level_zero:gpu:0), 'device') >>> y = np.empty_like(a, device="cpu") >>> y.shape, y.device, y.usm_type ((3, ), Device(opencl:cpu:0), 'device') >>> z = np.empty_like(a, usm_type="host") >>> z.shape, z.device, z.usm_type ((3, ), Device(level_zero:gpu:0), 'host') ``` -------------------------------- ### Create Zero Array with dpnp.zeros_like Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_arraycreation Demonstrates how to create a new array filled with zeros, matching the shape and data type of an existing array using dpnp.zeros_like. It also shows how to specify the device and usm_type for the resulting array. ```python import dpnp as np x0 = np.arange(6) # Default case x = np.zeros_like(x0) print(f"Array: {x}, Device: {x.device}, USM Type: {x.usm_type}") # Specify CPU device y = np.zeros_like(x0, device="cpu") print(f"Array: {y}, Device: {y.device}, USM Type: {y.usm_type}") # Specify host usm_type z = np.zeros_like(x0, usm_type="host") print(f"Array: {z}, Device: {z.device}, USM Type: {z.usm_type}") ``` -------------------------------- ### Build dpnp for AMD Devices Source: https://intelpython.github.io/dpnp/_sources/quick_start_guide.rst Builds the dpnp library with support for AMD devices using the `--target-hip=` argument. The architecture must be specified, and only one can be provided at a time. The architecture code can be found using `rocminfo`. ```bash python scripts/build_locally.py --target-hip= python scripts/build_locally.py --target-hip=gfx90a ``` -------------------------------- ### dpnp.argsort Example Usage Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.argsort Demonstrates how to use dpnp.argsort to get the indices that sort a 1D array. This function is a direct equivalent to numpy.argsort. ```python >>> import dpnp as np >>> x = np.array([3, 1, 2]) >>> np.argsort(x) array([1, 2, 0]) ``` -------------------------------- ### dpnp.asanyarray Example Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_arraycreation Demonstrates the basic usage of dpnp.asanyarray to convert a list to a dpnp.ndarray. It also shows how to create an array on a different device or with a specified USM type. ```python >>> import dpnp as np >>> np.asanyarray([1, 2, 3]) array([1, 2, 3]) Creating an array on a different device or with a specified usm_type >>> x = np.asanyarray([1, 2, 3]) # default case >>> x, x.device, x.usm_type (array([1, 2, 3]), Device(level_zero:gpu:0), 'device') >>> y = np.asanyarray([1, 2, 3], device="cpu") >>> y, y.device, y.usm_type (array([1, 2, 3]), Device(opencl:cpu:0), 'device') >>> z = np.asanyarray([1, 2, 3], usm_type="host") >>> z, z.device, z.usm_type (array([1, 2, 3]), Device(level_zero:gpu:0), 'host') ``` -------------------------------- ### DPNP ndarray argsort Example Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.ndarray.argsort Demonstrates how to use the dpnp.ndarray.argsort method to get the indices that would sort an array. This method is useful for reordering array elements based on their sorted positions. ```python import dpnp as np a = np.array([3, 1, 2]) a.argsort() ``` ```python import dpnp as np a = np.array([[0, 3], [2, 2]]) a.argsort(axis=0) ``` -------------------------------- ### Get Array Data Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_array Retrieves the USM (Unified Shared Memory) object pointing to the start of the array's data allocation. This is useful for direct memory access or interoperability with other libraries that use USM. ```python return dpm.create_data(self._array_obj) ``` -------------------------------- ### dpnp.pad: Edge Padding Example Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_manipulation Illustrates using dpnp.pad with the 'edge' mode to pad an array by repeating the edge values. ```python import dpnp as np a = np.array([1, 2, 3, 4, 5]) print(np.pad(a, (2, 3), 'edge')) # Expected output: array([1, 1, 1, 2, 3, 4, 5, 5, 5, 5]) ``` -------------------------------- ### Extract Diagonals from 3D Array with dpnp.diagonal Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.diagonal Illustrates extracting diagonals from a 3D DPNP array by specifying axes. This example shows how to get diagonals by selecting specific axes for sub-array formation. ```python >>> a = np.arange(8).reshape(2, 2, 2) >>> a array([[[0, 1], [2, 3]], [[4, 5], [6, 7]]]) >>> a.diagonal(0, # Main diagonals of two arrays created by skipping ... 0, # across the outer(left)-most axis last and ... 1) # the "middle" (row) axis first. array([[0, 6], [1, 7]]) ``` -------------------------------- ### dpnp.pad: Constant Padding Example Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_manipulation Demonstrates how to use dpnp.pad with the 'constant' mode to pad an array with specific constant values at the beginning and end. ```python import dpnp as np a = np.array([1, 2, 3, 4, 5]) print(np.pad(a, (2, 3), 'constant', constant_values=(4, 6))) # Expected output: array([4, 4, 1, 2, 3, 4, 5, 6, 6, 6]) ``` -------------------------------- ### Partition Array (dpnp_partition_c) Source: https://intelpython.github.io/dpnp/backend_doc/group___b_a_c_k_e_n_d___a_p_i Returns a partitioned copy of an array based on a specified element index (kth). It takes SYCL queue reference, input arrays, an output array, the partitioning index, shape and dimension information, and dependency SYCL events. ```cpp template DPCTLSyclEventRef dpnp_partition_c | ( | DPCTLSyclQueueRef | _q_ref_ , | | void * | _array_ , | | void * | _array2_ , | | void * | _result_ , | | const size_t | _kth_ , | | const shape_elem_type * | _shape_ , | | const size_t | _ndim_ , | | const DPCTLEventVectorRef | _dep_event_vec_ref_ ) ``` -------------------------------- ### Create Array of Ones (dpnp_ones_like_c) Source: https://intelpython.github.io/dpnp/backend_doc/group___b_a_c_k_e_n_d___a_p_i Implements the ones_like function to create an output array filled with ones, matching the data type and size of an input. It requires a SYCL queue reference, an output buffer, the size of the output array, and a vector of dependency SYCL events. ```cpp template DPCTLSyclEventRef dpnp_ones_like_c | ( | DPCTLSyclQueueRef | _q_ref_ , | | void * | _result_ , | | size_t | _size_ , | | const DPCTLEventVectorRef | _dep_event_vec_ref_ ) ``` -------------------------------- ### dpnp.rollaxis Function Example Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.rollaxis Demonstrates how to use the dpnp.rollaxis function to change the position of an array axis. It takes an input array, the axis to roll, and an optional start position. The function returns an array with the specified axis moved. ```python import dpnp as np a = np.ones((3, 4, 5, 6)) print(np.rollaxis(a, 3, 1).shape) print(np.rollaxis(a, 2).shape) print(np.rollaxis(a, 1, 4).shape) ``` -------------------------------- ### Get dpnp.ndarray.size - Python Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.ndarray.size Demonstrates how to retrieve the total number of elements in a DPNP array using the `.size` property. This is useful for understanding the scale of operations or memory requirements. Requires the `dpnp` library to be installed. ```python >>> import dpnp as np >>> x = np.zeros((3, 5, 2), dtype=np.complex64) >>> x.size 30 ``` -------------------------------- ### DPNP arange Initialization and Device Info Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_arraycreation Demonstrates the initialization of an array using dpnp.arange with a specified USM type ('host') and retrieves the array, its associated device, and USM type. This showcases basic array creation and property inspection within DPNP. ```python >>> z = np.arange(3, usm_type="host") >>> z, z.device, z.usm_type (array([0, 1, 2]), Device(level_zero:gpu:0), 'host') ``` -------------------------------- ### Build dpnp Conda Package from Source Source: https://intelpython.github.io/dpnp/quick_start_guide Builds the dpnp package from its source code within a Conda environment. It specifies Intel's Conda channel and conda-forge for dependencies. ```bash conda build conda-recipe -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels ``` -------------------------------- ### RegistryWindow Class Documentation Source: https://intelpython.github.io/dpnp/backend_doc/structstatistics_1_1sliding__window1d_1_1_registry_window Documentation for the RegistryWindow class, including its template parameters and type aliases. ```APIDOC ## Type Alias: SizeT ### Description Alias for the size type of the registry data. ### Template Parameters * **T** - The data type. * **Size** - The window size. ### Definition `template using statistics::sliding_window1d::RegistryWindow< T, Size >::SizeT = typename RegistryData::SizeT;` ### File `sliding_window1d.hpp` ``` -------------------------------- ### Create Array with Full Value on Different Devices using dpnp.full_like Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.full_like Illustrates how to use dpnp.full_like to create an array filled with a specified value on different devices (e.g., CPU) or with specific USM (Unified Shared Memory) types. This showcases the flexibility in managing data placement and memory for parallel operations. ```python >>> import dpnp as np >>> a = np.arange(6) >>> x = np.full_like(a, 1) # default case >>> x, x.device, x.usm_type (array([1, 1, 1, 1, 1, 1]), Device(level_zero:gpu:0), 'device') >>> y = np.full_like(a, 1, device="cpu") >>> y, y.device, y.usm_type (array([1, 1, 1, 1, 1, 1]), Device(opencl:cpu:0), 'device') >>> z = np.full_like(a, 1, usm_type="host") >>> z, z.device, z.usm_type (array([1, 1, 1, 1, 1, 1]), Device(level_zero:gpu:0), 'host') ``` -------------------------------- ### Run dpnp Python Test Suites Source: https://intelpython.github.io/dpnp/quick_start_guide Executes the available Python test suites for dpnp using the pytest framework. The `-s` flag allows for stdout and stderr to be printed during test execution. ```bash pytest -s tests ``` -------------------------------- ### Linear Algebra (`dpnp.scipy.linalg`) Source: https://intelpython.github.io/dpnp/reference/scipy Documentation for linear algebra routines within the SciPy-compatible subset of DPNP. This includes various decomposition methods. ```APIDOC ## Linear algebra (`dpnp.scipy.linalg`) ### Description This subsection details the linear algebra routines available through `dpnp.scipy.linalg`. It includes support for various matrix decompositions. ### Method N/A (This is a documentation section, not an API endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Build dpnp for Multi-Target (CUDA and AMD) Source: https://intelpython.github.io/dpnp/quick_start_guide Enables support for both CUDA and AMD devices simultaneously when building dpnp. This is achieved by combining the `--target-cuda` and `--target-hip=` arguments in the build script. ```python python scripts/build_locally.py --target-cuda --target-hip=gfx90a ``` -------------------------------- ### Get Lower Triangular Indices with dpnp.tril_indices Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.tril_indices This snippet demonstrates how to use dpnp.tril_indices to obtain indices for the lower triangular part of a 4x4 array. It shows how to generate indices starting from the main diagonal and two diagonals to the right. The output indices can be used for array indexing and assignment. ```python import dpnp as np il1 = np.tril_indices(4) print(il1) a = np.arange(16).reshape(4, 4) print(a[il1]) a[il1] = -1 print(a) il2 = np.tril_indices(4, 2) a[il2] = -10 print(a) ``` -------------------------------- ### Create Array of Zeros Like (dpnp_zeros_like_c) Source: https://intelpython.github.io/dpnp/backend_doc/group___b_a_c_k_e_n_d___a_p_i Implements the zeros_like function to create an output array filled with zeros, matching the data type and size of an input. It requires a SYCL queue reference, an output buffer, the size of the output array, and a vector of dependency SYCL events. ```cpp template DPCTLSyclEventRef dpnp_zeros_like_c | ( | DPCTLSyclQueueRef | _q_ref_ , | | void * | _result_ , | | size_t | _size_ , | | const DPCTLEventVectorRef | _dep_event_vec_ref_ ) ``` -------------------------------- ### DPNP reduce_hypot Example Source: https://intelpython.github.io/dpnp/_modules/dpnp/dpnp_iface_trigonometric Demonstrates the usage of dpnp.reduce_hypot to compute the hypotenuse of elements in an array. It also shows an equivalent calculation using np.sqrt and np.sum. ```python import dpnp as np a = np.ones(10) print(np.reduce_hypot(a)) print(np.sqrt(np.sum(np.square(a)))) ``` -------------------------------- ### Create Conda Build Environment for scikit-build (Linux) Source: https://intelpython.github.io/dpnp/quick_start_guide Creates a Conda environment named 'build-env' on Linux with all necessary development packages for building dpnp using scikit-build, including DPC++ components and Intel libraries. ```bash conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel \ onedpl-devel cmake scikit-build ninja versioneer pytest intel-gpu-ocl-icd-system \ -c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels conda activate build-env ``` -------------------------------- ### Get Real Part of Array - dpnp Source: https://intelpython.github.io/dpnp/reference/generated/dpnp.ndarray.real This snippet demonstrates how to access the real part of a complex-valued array using the `.real` property in dpnp. It requires importing dpnp as np and creating a complex array, for example, by taking the square root of complex numbers. ```python import dpnp as np x = np.sqrt(np.array([1+0j, 0+1j])) x.real ```