Skip to content

Instantly share code, notes, and snippets.

@Brainiarc7
Last active April 30, 2024 21:43
Show Gist options
  • Save Brainiarc7/1d13c7f432ba03a8e38720c83cd973d5 to your computer and use it in GitHub Desktop.
Save Brainiarc7/1d13c7f432ba03a8e38720c83cd973d5 to your computer and use it in GitHub Desktop.
Build Intel's Neo OpenCL platform on Ubuntu 18.04LTS

Intel OpenCL stack enablement on Ubuntu 18.04LTS.

Here's how to build and install Intel's new OpenCL enablement stack, Neo, which replaces the legacy Beignet ICD.

Install the dependencies:

Build dependencies:

sudo apt-get install ccache flex bison clang-4.0 cmake g++ git patch zlib1g-dev autoconf xutils-dev libtool pkg-config libpciaccess-dev

Create the project structure:

mkdir -p ~/intel-compute-runtime/workspace

Within this workspace directory, fetch the sources for the required dependencies:

cd ~/intel-compute-runtime/workspace

git clone -b release_40 https://github.com/llvm-mirror/clang clang_source

git clone https://github.com/intel/opencl-clang common_clang

git clone https://github.com/intel/llvm-patches llvm_patches

git clone -b release_40 https://github.com/llvm-mirror/llvm llvm_source

git clone -b release_70 https://github.com/llvm-mirror/llvm llvm7.0.0_source

git clone https://github.com/intel/gmmlib gmmlib

git clone https://github.com/intel/intel-graphics-compiler igc

git clone https://github.com/KhronosGroup/OpenCL-Headers khronos

git clone https://github.com/intel/compute-runtime neo

ln -s khronos opencl_headers

Create a build directory for the Intel Graphics Compiler under the workspace:

mkdir -p ~/intel-compute-runtime/workspace/build_igc

Then build:

cd ~/intel-compute-runtime/workspace/build_igc

cmake -DIGC_OPTION__OUTPUT_DIR=../igc-install/Release ../igc/IGC

time make -j$(nproc) VERBOSE=1

Recommended: Generate Debian archives for installation:

time make -j$(nproc) package VERBOSE=1

Install:

sudo dpkg -i *.deb

(Ran in the build directory) will suffice.

On NVIDIA Optimus systems where CUDA is present and LLVM 4.0 coexist:

Append /usr/local/cuda/bin:/usr/lib/llvm-4.0/bin at the end of the PATH variable in /etc/environment and source the file:

source /etc/environment

Important: Either way, make sure that LLVM 4.0 is in your path, as its' required by Intel's OCL runtime.

Next, build and install the compute runtime project. Start by creating a separate build directory for it:

mkdir -p ~/intel-compute-runtime/workspace/build_icr

cd ~/intel-compute-runtime/workspace/build_icr

cmake -DBUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release ../neo

time make -j$(nproc) package VERBOSE=1

Then install the deb archives:

  sudo dpkg -i *.deb 

From the build directory.

Testing:

Use clinfo and confirm that the ICD is detected.

Next, run luxmark and confirm that Intel Neo's OpenCL platform is detected and usable.

Be aware that Luxmark, among others, require freeglut, which you can install by running:

sudo apt install freeglut3*

Post with benchmarks for the Eurocom Q6: http://forum.notebookreview.com/threads/opencl-benchmarks-on-windows-10-build-1803-vs-ubuntu-linux-18-04lts.818024/

@Odianosen25
Copy link

Any luck for Alpine?

@khaled-rahman
Copy link

Hi,
I followed the instruction.
When I type cmake -DIGC_OPTION__OUTPUT_DIR=../igc-install/Release ../igc/IGC, it shows me the following error message. What might be the possible reason for this?

 [LLVM_PATCHER] : Copying stock LLVM sources to .../workspace/build_igc/llvm/build/../src
Error copying directory from ".../workspace/llvm_patches/../../../../llvm-project_7.0.0/llvm" to ".../workspace/build_igc/llvm/build/../src".
-- [LLVM_PATCHER] : Applying patches for LLVM from version 7.0.0
-- [LLVM_PATCHER] : Apply .../workspace/llvm_patches/releases/7.0.0/patches_external/BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch file
/usr/bin/patch: **** Can't change to directory .../workspace/build_igc/llvm/build/../src : No such file or directory
CMake Error at .../workspace/llvm_patches/CMakeLists.txt:245 (message):
  [LLVM_PATCHER] : error: applying patch
  '.../workspace/llvm_patches/releases/7.0.0/patches_external/BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch'
  failed


-- Configuring incomplete, errors occurred!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment