|
| 1 | +# Ubuntu 24.04 Setup Instructions |
| 2 | + |
| 3 | +## Verify Hardware Support |
| 4 | + |
| 5 | +Most modern GPUs support OpenCL. For integrated graphics devices (iGPUs), use `lscpu` to get the processor SKU. Detailed information for Intel SKUs is available from [ark.intel.com](ark.intel.com). Detailed information for AMD processors is available from [AMD's product page](https://www.amd.com/en/products/specifications/processors). |
| 6 | + |
| 7 | +## Build Dependencies |
| 8 | + |
| 9 | +OCL Headers: |
| 10 | + |
| 11 | +```bash |
| 12 | +sudo apt install opencl-c-headers opencl-clhpp-headers |
| 13 | +``` |
| 14 | + |
| 15 | +The OpenCL API has its own set of header files; the above command installs both C and C++ headers files. The C header can be found in `<CL/cl.h>`; the C++ header is in `<CL/opencl.hpp>`. |
| 16 | + |
| 17 | +OCL ICD Loader: |
| 18 | + |
| 19 | +```bash |
| 20 | +sudo apt install ocl-icd-opencl-dev |
| 21 | +``` |
| 22 | + |
| 23 | +OpenCL applications generally link against an OpenCL Installable Compute Device (ICD) loader instead of a specific OpenCL implementation; see [https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc](https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc) for more information about this system. |
| 24 | + |
| 25 | +## Runtime Dependencies |
| 26 | + |
| 27 | +OpenCL requires a compute runtime to manage the interaction between the OpenCL API and the GPU. |
| 28 | + |
| 29 | +### OCL ICD Loader |
| 30 | + |
| 31 | +```bash |
| 32 | +sudo apt install ocl-icd-libopencl1 |
| 33 | +``` |
| 34 | + |
| 35 | +OpenCL applications generally link against an OpenCL Installable Compute Device (ICD) loader instead of a specific OpenCL implementation; see [https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc](https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc) for more information about this system. |
| 36 | + |
| 37 | +### AMD Compute Runtime |
| 38 | + |
| 39 | +AMD supports OpenCL through their ROCm platform. Installation instructions are [here](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html#ubuntu). |
| 40 | + |
| 41 | +### Intel Compute Runtime |
| 42 | + |
| 43 | +Intel's OpenCL support is provided through the NEO compute runtime. Download packages from the project's [GitHub releases page](https://github.com/intel/compute-runtime/releases). |
| 44 | + |
| 45 | +### Nvidia Compute Runtime |
| 46 | + |
| 47 | +Nvidia provides OpenCL support through their proprietary driver, available from the [graphics-drivers PPA](https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa). |
| 48 | + |
| 49 | +```bash |
| 50 | +sudo add-apt-repository ppa:graphics-drivers/ppa |
| 51 | +sudo apt update |
| 52 | +sudo apt install nvidia-graphics-drivers-<version> |
| 53 | +``` |
| 54 | + |
| 55 | +### Configure Permissions |
| 56 | + |
| 57 | +```bash |
| 58 | +sudo usermod -a -G video $USER |
| 59 | +sudo usermod -a -G render $USER |
| 60 | +``` |
| 61 | + |
| 62 | +Users running OpenCL applications on a GPU require additional permissions granted by the groups above. |
| 63 | + |
| 64 | +## Verification |
| 65 | + |
| 66 | +The `clinfo` utility can be used to verify the environment has been properly configured. |
| 67 | + |
| 68 | +```bash |
| 69 | +$ sudo apt install clinfo |
| 70 | +$ clinfo |
| 71 | +<platform information should show here> |
| 72 | +``` |
| 73 | + |
| 74 | +## Troubleshooting |
| 75 | + |
| 76 | +If `clinfo` indicates there are 0 supported platforms: |
| 77 | + |
| 78 | +1. Verify your host has OpenCL-capable hardware attached |
| 79 | +2. Verify clinfo is running as a user with appropriate group membership |
| 80 | +3. Verify new group membership has been applied (this may require logout or reboot) |
| 81 | +4. Verify the correct compute runtime is installed |
| 82 | +5. Check the kernel log (`sudo dmesg`) for related errors |
0 commit comments