oneAPI — What is It?

Demystifying oneAPI for Developers

Get the Latest on All Things CODE

author-image

作者

September 9, 2022 – As an Intel Technical Evangelist, one of the most common questions I get is, “What is oneAPI?” I hope many of you have heard about oneAPI, but what it is and, most importantly, why it matters to developers may not be obvious. If you have those types of questions, let’s clear those up.

What is oneAPI?

The Specification

oneAPI is a specification that is open and standards-based, supporting multiple architecture types including but not limited to GPU, CPU, and FPGA. The spec has both direct programming and API-based programming paradigms.

"

The direct programming model, C++ with SYCL* (pronounced “sickle”), comes from The Khronos Group. This organization provides open software standards for a variety of use cases including well-known standards OpenGL, WebGL, OpenCL™, and more. The direct programming model provides a flexible, modern C++ language that allows developers to write parallel algorithms and integrate them into existing C++ codebases. Compilers can then take this expressed parallelism and target CPUs, GPUs, FPGAs, and other hardware .

The specification defines a set of library interfaces that are commonly used in a variety of workflows. For example, the oneAPI Math Kernel Library (oneMKL) specification is an open, stable API that enables users to leverage common, parallelizable, mathematical operations. The oneAPI Deep Neural Network Library (oneDNN) API specification exposes the basic building blocks used in deep-learning applications.

As you can see below, the spec has a variety of library interfaces for several industry-standard workloads.

Another important aspect of oneAPI is that it can coexist with other compute-based open specifications like OpenMP. This interoperability is important for developers taking advantage of existing parallelism who are looking to migrate into a more flexible, accelerator-based approach.

The Implementation

While having an open specification sounds great, in practice developers need strong implementations built on top of specifications. Fortunately, a variety of efforts have stepped up to meet that need.

There are several compilers that work with C++ with SYCL, including implementations from Codeplay, Huawei, Intel, and Heidelberg University. These implementations can take C++ with SYCL code and target a variety of backends including CPUs and AMD/Intel/NVIDIA GPUs.

"

Image from khronos.org

Image courtesy of khronos.org

Many of the API-based library specifications have open source implementations that support x86 CPUs and Intel GPUs. Intel provides implementations of the specification that use both CPU and GPU hardware. Some of the library API specifications, particularly the oneDNN library, were implemented by Fujitsu/RIKEN to enable ARM CPU platforms. The oneMKL library has had portions of the specification implemented by Codeplay to support the oneMKL Basic Linear Algebra Subprograms (BLAS) library on NVIDIA GPUs.

Supporting oneAPI Developers

The oneAPI Community

As with many open source initiatives, an important aspect of oneAPI is community participation, and  there are industry players like Codeplay (an Intel subsidiary) and Fujitsu/RIKEN who are leveraging the specification to enable different architectures. In addition to industry users, the oneAPI Centers of Excellence program partners with various universities and labs to deliver open source solutions enabled by oneAPI.

Here are a few examples:

Outside of Centers of Excellence, oneAPI and SYCL are being used for other important projects around the world. CERN uses them to advance research around the Large Hadron Collider. Several groups are doing the same for healthcare research, including work to battle the COVID-19 pandemic. And animation studios are using the Intel® oneAPI Rendering Toolkit for ray tracing and rendering in their motion pictures.

oneAPI Support and Tools

For developers, good documentation, samples, and tools are critical. SYCLomatic is an open source tool that supports efforts to migrate code from CUDA to SYCL. The oneAPI samples repository is filled with examples of how to access and take advantage of SYCL and oneAPI libraries.

Intel also develops a variety of toolkits that provide Intel-optimized implementations of the specification, as well as tools that may be useful to developers using oneAPI. For example, the Intel® oneAPI Base Toolkit includes Intel® VTuneᵀᴹ Profiler and Intel® Advisor to support performance optimization and the Intel® Distribution for GDB* to support debugging.

Takeaway: Hardware and Vendor Choice

oneAPI is an open source specification that aims to simplify the life of developers looking to create accelerator-based applications and who want to support a variety of hardware architectures and hardware vendors. As a major supporter of this effort, Intel has provided implementations of the specification and tooling to support developers writing oneAPI applications. However, this is not a unilateral effort. The implementation of this specification is supported by various software and hardware companies and this number will grow over time.

"

Want to Connect? If you want to see what random tech news I’m reading, you can follow me on Twitter.

Tony is a Software Architect and Technical Evangelist at Intel. He has worked on several software developer tools and most recently led the software engineering team that built the data center platform which enabled Habana’s scalable MLPerf solution.

"