If you are like most developers, you don’t want to wade through descriptions about new features and capabilities written by someone trying to sell you something. Instead, you would like to see code that works and use the working code to help solve specific problems.
Once you’ve seen the code work, you are willing to spend time reading a description of the code. We’ve all been there.
Unfortunately, it is not easy to find reliable or useful sample code or good documentation of the examples when you do find it.
Intel is solving that problem by making available high-quality, ready-to-use code samples to develop, offload, and optimize multiarchitecture applications. In this blog, I’ll introduce them and then offer three ways to easily access them.
Solve Problems with Code Samples
The samples demonstrate how to solve problems in high-performance computing, code and performance optimization, artificial intelligence and machine learning, and scientific or general graphics rendering.
In fact, the samples are intended to help any developer at any level understand concepts and techniques for adapting parallel programming methods to heterogenous programming for CPUs, GPUs, and FPGAs.
As a new developer just starting out with C++, Fortran, and/or Python* or new to these programming domains, you will find getting-started samples and tutorial samples that walk through the basic concepts to help you orient yourself quickly.
As an experienced developer, you will find many samples to ramp on new techniques quickly, particularly if you are attempting to adapt existing code from vendor-specific C++ code to its SYCL*-compliant equivalent.
For example, you’ll find:
- Working versions of guided samples that walk you through the process of migrating CUDA code to equivalent SYCL code.
- The end-to-end process of training models and performing inference using optimizations for PyTorch* and TensorFlow* or performance increases on various CPUs and GPUs.
- FPGA reference designs that you can use to implement nearly complete solutions quickly and tutorials to help you understand FPGA programming.
- Over a hundred samples allowing you to run the code inside Jupyter* Notebooks while reading about the code run in the cell.
Regardless of your experience level, you will find a variety of useful samples—all resident in the GitHub repository—with helpful instructions and commented code.
Ready to dive in? Here are three ways to do it.
1: Sample Browsers Plug-Ins
If you have used the Intel® oneAPI & AI Tools, you might already know that Intel offers sample browsers that plug into Microsoft Visual Studio Code* (see the Visual Studio Marketplace for information), Microsoft Visual Studio*, and Eclipse* for the current versions of those popular Integrated Development Environments (IDEs) for Linux* and Windows*.
Intel also provides a command-line version of the code sample browser. While you can search for and download the samples from within an IDE, that approach doesn’t help much if you are trying to find relevant samples quickly.
Figure 1. Visual Studio Code oneAPI Samples Browser Plugin
2: Go to GitHub
We have two ways to navigate the samples in GitHub. First, just by browsing the oneAPI-samples GitHub repository. Second, and for a more dynamic and filterable approach, by visiting the new Sample Catalog where you can:
- search the sample names and descriptions
- filter by experience level, programming language, or device type to find samples relevant to your CPU, GPU, and FPGA development needs
Since the samples are in GitHub, you can download or clone them directly to your system.
Figure 2. oneAPI-Samples GitHub
Figure 3. Code Samples Catalog
3: Code Samples Page
As part of a commitment to help developers get to working code as quickly as possible, Intel recently launched a Code Samples page to highlight samples that might be interesting to developers who are solving problems in ...
- AI and analytics or machine learning
- code or performance optimization for CPUs and GPUs
- rendering and ray tracing
- guidance on how to troubleshoot issues in complex development environments
The new page highlights specific samples in the oneAPI-samples GitHub repository and includes a direct link to the Samples Catalog. You can use the Code Sample page or the Sample Catalog to find interesting solutions to your development problems.
Figure 4. Code Samples Overview Page
Browse the Samples Repository Today
We want to invite you to check out the oneAPI code samples today if you ...
- are you looking for references to implement a specific use case relevant to your domain
- want to find out how to apply heterogenous cross-architecture programming approaches like SYCL and OpenMP* more effectively to your workload
- are interested in how to best take advantage of oneAPI components and the oneAPI performance library APIs for the libraries you are using in the context of heterogeneous compute
We have many resources available and are continuing to add more code samples in the future aligned to features and capabilities in future Intel oneAPI and AI tools.
- Intel oneAPI Toolkits
- Visual Studios Marketplace
- Code Samples Overview page
- oneAPI-samples GitHub repository
- Sample Catalog on GitHub
Get the Software
Develop high-performance, data-centric applications for CPUs, GPUs, and FPGAs with this core set of tools, libraries, and frameworks including LLVM-based compilers.