Skip to content

Commit

Permalink
Environment instructions for Ubuntu 20.04 (#26)
Browse files Browse the repository at this point in the history
Mostly copy/pasted from previous iterations, but includes style
tweaks suggested by markdownlint
  • Loading branch information
cqcallaw authored Oct 29, 2020
1 parent d2e186b commit 7d423f7
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions docs/env/ubuntu/20.04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Ubuntu 20.04 Setup Instructions

## Verify Hardware Support

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).

## Build Dependencies

OCL Headers:

```bash
sudo apt install opencl-c-headers opencl-clhpp-headers
```

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/cl.hpp>`.

OCL ICD Loader:

```bash
sudo apt install ocl-icd-opencl-dev
```

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.

## Runtime Dependencies

OpenCL requires a compute runtime to manage the interaction between the OpenCL API and the GPU.

### OCL ICD Loader

```bash
sudo apt install ocl-icd-libopencl1
```

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.

### AMD Compute Runtime

TODO

### Intel Compute Runtime

Intel's OpenCL support is provided through the NEO compute runtime, available as a PPA.

```bash
sudo add-apt-repository ppa:intel-opencl/intel-opencl
sudo apt update
sudo apt install intel-opencl
```

### Nvidia Compute Runtime

Nvidia provides OpenCL support through their proprietary driver, available from the [graphics-drivers PPA](https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa).

```bash
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-graphics-drivers-<version>
```

### Configure Permissions

```bash
sudo usermod -a -G video $USER
sudo usermod -a -G render $USER
```

Users running OpenCL applications on a GPU require additional permissions granted by the groups above.

## Verification

The `clinfo` utility can be used to verify the environment has been properly configured.

```bash
$ sudo apt install clinfo
$ clinfo
<platform information should show here>
```

## Troubleshooting

If `clinfo` indicates there are 0 supported platforms:

1. Verify your host has OpenCL-capable hardware attached
2. Verify clinfo is running as a user with appropriate group membership
3. Verify new group membership has been applied (this may require logout or reboot)
4. Verify the correct compute runtime is installed
5. Check the kernel log (`sudo dmesg`) for related errors

0 comments on commit 7d423f7

Please sign in to comment.