Starting from version 3.5.0, OMPi officially supports the Raspberry Pi 4 and 5 boards, with their VideoCore VI and VII GPUs, respectively, through the Vulkan module. Setting up the compiler to work for these boards is not much different from deploying to any other system.
Minimum requirements
- Meson 0.58.0 — needed for building OMPi
- Raspberry Pi OS — needed for supporting OpenMP on the CPU
- Vulkan — additionally needed for OpenMP offloading to the VideoCore GPU
Installation
Set up OMPi as follows:
meson setup build --prefix=‹install-dir›
Then OMPi can be compiled and installed as usual:
cd build/ meson compile meson install
Note that the user does not need to provide any additional flags; the OpenMP vulkan module is installed by default.
Usage
Compilation
Compiling OpenMP applications with OMPi on a Raspberry Pi board is a quite straightforward process. Simply run:
ompicc --devs=vulkan app.c # or --devs=all
The compiler will produce the main application executable (a.out) and several kernel executables, specifically one for each OpenMP target construct existing in the application.
Testing the Vulkan module
The correct installation of OMPi along with its vulkan module, can be verified by running:
ompiconf --devvinfo
On a Raspberry Pi 5, this command must print out the following information, assuming that vulkan is the only module installed:
1 configured device module(s): vulkan
MODULE [vulkan]:
------
OMPi Vulkan device module.
Available devices : 1
device id < 1 > {
Name: VideoCore VII
API version: XYZ - Driver version: XYZ
Vendor ID: 5549
Maximum workgroup sizes: (2147483647, 65535, 65535)
Maximum invocations: 1024
4194304 Kbytes of memory
}
------
The programmer can moreover verify that the module is working properly by compiling the following sample application and running it:
Mini-tutorial: Writing OpenMP applications which exploit the GPU
Targeting the VideoCore GPU of a Raspberry Pi 4/5 board is made possible by using the OpenMP target-related constructs. With these constructs, the programmer indirectly launches a Vulkan grid, that consists of multiple Vulkan workgroups containing multiple Vulkan invocations. Below you can find information about the syntax and usage of the most popular constructs. For detailed information, please consult the official OpenMP specifications.