Skip to content

Repository files navigation

Intel oneAPI Toolkit Samples

The oneAPI-samples repository provides code samples for Intel oneAPI toolkits.

We recommend checking out a specific release version of the repository. View available releases.

The latest versions of code samples on the master branch are not guaranteed to be stable.

Code Samples

Code SampleSupported Intel® Architecture(s)Description
../AI-and-Analytics/End-to-end-Workloads/
../CensusGPU, CPUThis sample code demonstrates how to seamlessly run the end-to-end census workload using the AI Analytics toolkit without any external dependencies.
../LidarObjectDetection-PointPillarsGPU, CPUHow to combine Intel® Distribution of OpenVINO™ toolkit and Intel® oneAPI to offload the computation of a complex workload to one of Intel's supported accelerators
../AI-and-Analytics/Features-and-Functionality/
../IntelPyTorch_Extensions_AutoMixedPrecisionCPUYou will learn how to download, compile, and get started with Intel Extension for PyTorch from this sample code.
../IntelPyTorch_TorchCCL_Multinode_TrainingCPUHow to perform distributed training with oneCCL in PyTorch
../IntelPython_XGBoost_PerformanceCPUHow to analyze the performance benefit from using Intel optimizations upstreamed by Intel to the latest XGBoost compared to un-optimized XGBoost 0.81
../IntelPython_XGBoost_daal4pyPredictionCPUHow to analyze the performance benefit of minimal code changes to port pre-trained XGBoost model to daal4py prediction for much faster prediction than XGBoost prediction
../IntelPython_daal4py_DistributedKMeansCPUDistributed oneDAL K-Means programming model for Intel CPU
../IntelPython_daal4py_DistributedLinearRegressionCPUDistributed oneDAL Linear Regression programming model for Intel CPU
../IntelTensorFlow_Horovod_Multinode_TrainingCPUShows how to get started with scaling out a neural network's training in TensorFlow on multiple compute nodes in a cluster.
../IntelTensorFlow_InferenceOptimizationCPUOptimize a pre-trained model for a better inference performance
../IntelTensorFlow_ModelZoo_Inference_with_FP32_Int8CPUShow how to efficiently execute, train, and deploy Intel-optimized models
../IntelTensorFlow_PerformanceAnalysisCPUContains two Jupyter notebooks from Intel Model Zoo to help users analyze the performance difference between Stock Tensorflow and Intel Tensorflow.
DirectPrograming/C++/
../CombinationalLogic/MandelbrotCPUDemonstrates how to accelerate Mandelbrot performance with SIMD and parallelization using OpenMP*.
../CompilerInfrastructure/IntrinsicsCPUShows how to utilize the intrinsics supported by C++ compiler in a variety of applications.
../GraphTraversal/MergesortCPUShows how to accelerate scalar merge sort program using OpenMP tasks
../Jupyter/OpenMP-offload-trainingCPUHow to offload the computation to GPU using OpenMP with the Intel® C++ Compiler
../ParallelPatterns/openmp_reductionGPU, CPUHow to run openMP on cpu as well as GPU offload
../StructuredGrids/iso3dfd_omp_offloadCPUHow to offload the computation to GPU using Intel® oneAPI DPC++/C++ Compiler
DirectPrograming/DPC++/
../CombinationalLogic/mandelbrotGPU, CPUExample of a fractal in mathematics
../CombinationalLogic/sepia-filterGPU, CPUColor image conversion using 1D range
../DenseLinearAlgebra/complex_multGPU, CPUComplex number Multiplication
../DenseLinearAlgebra/matrix_mulGPU, CPUSimple program that multiplies two large matrices in parallel using DPC++, OpenMP and MKL
../DenseLinearAlgebra/simple-addFPGA, GPU, CPUSimple Add program
../DenseLinearAlgebra/vector-addFPGA, GPU, CPUSimple Vector add program
../GraphAlgorithms/all-pairs-shortest-pathsGPU, CPUThe All Pairs Shortest Paths sample demonstrates the following using the Intel® oneAPI DPC++/C++ Compiler
../GraphTraversal/bitonic-sortGPU, CPUImplementation of bitonic sort using DPC++.
../Jupyter/oneapi-essentials-trainingGPU, CPUCollection of Notebooks used ine the oneAPI Essentials training course
../MapReduce/MonteCarloPiGPU, CPUHow to utilize the DPC++ reduction extension
../N-BodyMethods/NbodyGPU, CPUAn N-body simulation is a simulation of a dynamical system of particles, usually under the influence of physical forces, such as gravity. This nbody sample code is implemented using C++ and DPC++ language for Intel CPU and GPU.
../ParallelPatterns/PreFixSumGPU, CPUImplement bitonic sort using Intel DPC++ compiler
../ParallelPatterns/dpc_reduceGPU, CPUA simple program that calculates pi, implemented using C++ and DPC++.
../ParallelPatterns/histogramGPU, CPUThis sample demonstrates a histogram that groups numbers together and provides the count of a particular number in the input
../ParallelPatterns/loop-unrollGPU, CPUThe Loop Unroll demonstrates a simple example of unrolling loops to improve the throughput of a DPC++ program for GPU offload.
../ProjectTemplatesmakefile-gpuGPUA "Hello, world" Linux Makefile project for GPU
../ProjectTemplatesmakefile-fpgaFPGAA "Hello, world" Linux Makefile project for FPGA
../ProjectTemplatescmake-gpuGPUA "Hello, world" Linux CMake project for GPU
../ProjectTemplatescmake-fpgaFPGAA "Hello, world" Linux CMake project for FPGA
../ProjectTemplatesHello_World_GPUGPUA "Hello, world" Windows Visual Studio project for GPU
../SparseLinearAlgebra/merge-spmvGPU, CPUSparse Matrix Vector sample provides a parallel implementation of a merge based sparse matrix and vector multiplication algorithm using DPC++.
../SpectralMethods/Discrete-cosine-transformGPU, CPUImage processing algorithm used in JPEG compression
../StructuredGrids/1d_HeatTransferGPU, CPUA simulation of one dimensional heat transfer process using DPC++.
../StructuredGrids/ISO2DFD_DPCPPGPU, CPUA simple finite difference stencil kernel for solving 2D acoustic isotropic wave equation using DPC++
../StructuredGrids/ISO3DFD_DPCPPGPU, CPUA finite difference stencil kernel for solving 3D acoustic isotropic wave equation using DPC++
../StructuredGrids/Particle-diffusionGPU, CPUA simple implementation of a Monte Carlo simulation of the diffusion of water molecules in tissue
DirectPrograming/DPC++FPGA/ReferenceDesigns/
../crrFPGAHigh-performance CRR binomial tree option pricing model using DPC++ on FPGA
../dbFPGAHigh-performance database query acceleration for FPGA-attached memory using DPC++
../gzipFPGAHigh-performance GZIP compression using DPC++ on FPGA
../mvdr_beamformingFPGAHigh-performance radar beamforming for streaming data using DPC++ on FPGA
../qrdFPGAHigh-performance QR decomposition of matrices using DPC++ on FPGA
DirectPrograming/DPC++FPGA/Tutorials/Design Patterns/
../buffered_host_streamingFPGATutorial demonstrating how to create a high-performance full system CPU-FPGA design using SYCL USM.
../DesignPatterns/compute_unitsFPGATutorial showing how to efficiently make multiple copies of a kernel, called compute units
../compute_unitsFPGATtutorial showcases a design pattern that allows you to make multiple copies of a kernel, called compute units. }
../double_bufferingFPGATutorial demonstrating how to overlap kernel execution with buffer transfers and host processing
../explicit_data_movementFPGATutorial showing an alternative coding (explicit USM) in which data movement between host and device is controlled explicitly in code
../io_streamingFPGATutorial describing how to use DPC++ IO pipes to stream data through the FPGA's IO
../loop_carried_dependencyFPGATutorial demonstrating how to remove a loop-carried dependency to improve the performance of the FPGA device code
../n_way_bufferingFPGATutorial demonstrating how to extend double buffering to n-way buffering
../onchip_memory_cacheFPGATutorial explaining the caching of on-chip memory to reduce loop initiation interval on FPGA
../optimize_inner_loopFPGATutorial explaining how to optimize the throughput of an inner loop with a low trip count
../pipe_arrayFPGATutorial showing how to create an array of pipes
../shannonizationFPGATutorial explaining an optimization for removing computation from the critical path
../simple_host_streamingFPGATutorial showing how to use SYCL Universal Shared Memory (USM) to stream data between the host and FPGA device and achieve low latency while maintaining throughput.
../triangular_loopFPGATutorial explaining an advanced FPGA optimization technique for triangular loops
../zero_copy_data_transferFPGATutorial demonstrating how to use zero-copy host-device memory transfer for FPGA kernels with no temporal data reuse
DirectPrograming//DPC++FPGA/Tutorials/Features/
../fpga_regFPGATutorial demonstrating the use of the DPC++ FPGA power user extension intel::fpga_reg
../kernel_args_restrictFPGATutorial demonstrating how to avoid performance penalties due to kernel argument aliasing
../loop_coalesceFPGATutorial demonstrating the DPC++ FPGA loop_coalesce attribute
../loop_initiation_intervalFPGATutorial demonstrating the use of the intel::initiation_interval attribute to improve performance
../loop_ivdepFPGATutorial demonstrating the use of the loop ivdep attribute
../loop_unrollFPGATutorial demonstrating the DPC++ unroll pragma and its performance trade-offs on FPGA
../lsu_controlFPGATutorial demonstrating how to configure the load-store units (LSUs) in your DPC++ program for FPGA
../max_concurrencyFPGATutorial demonstrating the DPC++ FPGA max_concurrency attribute
../max_interleavingFPGATutorial demonstrating the DPC++ FPGA max_interleaving attribute
../memory_attributesFPGATutorial demonstrating how to use DPC++ FPGA memory attributes
../pipesFPGATutorial demonstrating the DPC++ FPGA pipes extension to transfer data between kernels
../speculated_iterationsFPGATutorial demonstrating the DPC++ FPGA speculated_iterations attribute
DirectPrograming/DPC++FPGA/Tutorials/GettingStarted/
../fast_recompileFPGATutorial introducing host-only recompile to save DPC++ development time on FPGA
../fpga_compileFPGATutorial introducing how to compile DPC++ for FPGA
DirectPrograming/DPC++FPGA/Tutorials/tools/
../dynamic_profilerFPGATutorial showing how to use the Intel® FPGA Dynamic Profiler for DPC++ for detailed FPGA kernel profiling
../system_profilingFPGATutorial showing how to use the OpenCL Intercept Layer to profile DPC++ designs running on FPGA at the system level
../use_libraryFPGATutorial showing how to use cross-language libraries in DPC++ on FPGA
DirectProgramming/Fortran/
../CombinationalLogic/openmp-primes/GPU, CPU
../DenseLinearAlgebra/optimize-integral/GPU, CPUOptimization using the Intel® Fortran compiler
../DenseLinearAlgebra/vectorize-vecmatmult/GPU, CPUVectorization using Intel Fortran compiler
../Jupyter/OpenMP-offload-training/GPU, CPUCollection of Jupyter notebooks that were developed to teach OpenMP Offload.
Libraries/oneCCL/
../tutorials/oneCCL_Getting_StartedGPU, CPUport an Intel® oneAPI Collective Communications Library (oneCCL) sample from CPU to GPU
Libraries/oneDAL/
../IntelPython_daal4py_Distributed_Kmeans/CPUshows how to train and predict with a distributed k-means model using the python API package daal4py for oneAPI Data Analytics Library.
../IntelPython_daal4py_Distributed_LinearRegressionCPUdaal4py is a simplified API to Intel® DAAL that allows for fast usage of the framework suited for Data Scientists or Machine Learning users
../IntelPython_daal4py_Getting_StartedCPUhow how to do batch linear regression using the python API package daal4py from oneDAL.
Libraries/oneDNN/
../dpcpp_interoperabilityGPU, CPUemonstrates programming for Intel® Processor Graphics with SYCL extensions API in oneDNN
../getting_startedGPU, CPURunning a simple convolutional model on Intel CPU or Intel GPU
../simple_modelGPU, CPURunning a simple convolutional model on Intel CPU or Intel GPU
../TutorialsGPU, CPUSeries of Jupyer notebook tutorials on oneDNN
Libraries/oneDPL/
../Gamma-correctionGPU, CPUgamma correction using Parallel STL
../Stable_sort_by_keyGPU, CPUstable sort by key using counting_iterator and zip_iterator
Libraries/oneMKL/
../black_scholesGPU, CPUShows how to use oneMKL's Vector Math (VM) and Random Number Generator (RNG) functionality to calculate the prices of options using the Black-Scholes formula for suitable randomly-generated portfolios.
../block_cholesky_decompositionGPU, CPUShows how to use the oneMKL library's BLAS and LAPACK functionality to solve a symmetric, positive-definite block tridiagonal linear equation.
../block_lu_decompositionGPU, CPUShows how to use the oneMKL library's BLAS and LAPACK functionality to solve a block tridiagonal linear equation.
../computed_tomographyGPU, CPUShows how to use the oneMKL library's DFT functionality to simulate computed tomography (CT) imaging.
../fourier_correlationGPU, CPUShows how to implement a 1D Fourier correlation using oneMKL kernel functions.
../matrix_mul_mklGPU, CPUShows how to use the oneMKL's optimized matrix multiplication routines.
../monte_carlo_european_optGPU, CPUShows how to use the oneMKL library's random number generation (RNG) functionality to compute European option prices.
../monte_carlo_piGPU, CPUShows how to use the oneMKL library's random number generation (RNG) functionality to estimate the value of π.
../random_sampling_without_replacementGPU, CPUhows how to use the oneMKL library's random number generation (RNG) functionality to generate K>>1 simple random length-M samples without replacement
../sparse_conjugate_gradientGPU, CPUShows how to use the oneMKL library's sparse linear algebra functionality to solve a sparse, symmetric linear system using the (preconditioned) conjugate gradient method.
../student_t_testGPU, CPUShows how to use the oneMKL library's Vector Statistics functionality to decide if the null hypothesis should be accepted or rejected.
Libraries/oneTBB/
../tbb-async-syclGPU, CPUShow the computational kernel can be split for execution between CPU and GPU using TBB Flow Graph asynchronous node and functional node.
../tbb-resumable-tasks-syclGPU, CPUShow the computational kernel can be split for execution between CPU and GPU using TBB resumable task and parallel_for.
../tbb-task-syclGPU, CPUShow two TBB tasks can execute similar computational kernels, with one task executing the SYCL code and the other task executing the TBB code.
Libraries//oneVPL/
../dpcpp-blurCPUHow to use oneVPL and DPC++ to convert I420 raw video files into BGRA and blur each frame
../hello-decodeCPUshows how to use oneVPL to perform a simple video decode
../hello-encodeCPUshows how to use oneVPL to perform a simple video encode
../oneVPL/hello-vppCPUHow to use oneVPL to resize an I420 raw video file
Tools/ApplicationDebugger/
../Debugger/array-transformGPU, CPUArray transform
Tools/IoTConnectionTools/
../Analog-inCPUAnalog pin input example using Eclipse* MRAA
../aws-pub-subCPUA sample that could be used for a quick test of Amazon cloud libraries.
../azure-iothub-telemetryCPUA sample demonstrating how to send messages from a single device to Microsoft Azure IoT Hub via a selected protocol.
../digital-inCPUGPIO pin input example using Eclipse* MRAA
../digital-outCPUGPIO pin output example using Eclipse* MRAA
../hello-iot-worldCPUBasic example that prints the compiler used during build
../ibm-deviceCPUCPU
../InterruptCPUInterrupt Service Routine example using Eclipse* MRAA
../Onboard-BlinkCPUBuilt-in LED blink for common IoT boards using Eclipse* MRAA
../PWMCPUPulse Width Modulation pin output using Eclipse* MRAA
../Up2 LEDsCPUBuilt-in LED example for UP* Squared using Eclipse* MRAA
Tools/Migration/
../folder-options-dpctCPUHow to migrate more complex projects and use options for DPC++ Compatibility Tool (dpct)
../rodinia-nw-dpctCPUHow to migrate a Make/CMake project from CUDA to Data Parallel C++ using the Intel DPC++ Compatibility Tool.
../vector-add-dpctCPUhow to migrate a simple program from CUDA to Data Parallel C++ using the Intel DPC++ Compatibility Tool.
Tools/VTuneProfiler/
../matrix_multiply_vtuneCPUA sample containing multiple implementations of matrix multiplication. This sample code is implemented using DPC++ language for CPU and GPU.

License

Code samples are licensed under the MIT license. See License.txt for details.

Third party program Licenses can be found here: third-party-programs.txt

Known Issues or Limitations

On Windows Platform

  • If you are using Visual Studio 2019, Visual Studio 2019 version 16.4.0 or newer is required.
  • Windows support for the FPGA code samples is limited to the FPGA emulator and optimization reports. Compile targets for FPGA hardware are provided on Linux only. See any FPGA code sample for more details.
  • If you encounter a compilation error when building a sample program, such as the example error below, the directory path of the sample may be too long. The work around is to move the sample to a directory such as "c:\temp\sample_name".
    • Example error: Error MSB6003 The specified task executable "dpcpp.exe" could not be run .......

Contribute

See CONTRIBUTING for more information.

About

Samples for Intel oneAPI toolkits

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages