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/

@Brainiarc7
Copy link
Author

Done.

@ikarishinj98
Copy link

hello,

install the compute runtime project gave an error :

`blm@blm-Aspire-E1-531:~/intel-compute-runtime/workspace/build_icr$ sudo dpkg -i *.deb
[sudo] Mot de passe de blm :
Sélection du paquet intel-opencl précédemment désélectionné.
(Lecture de la base de données... 204329 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de intel-opencl_18.44.0-1_amd64.deb ...
Dépaquetage de intel-opencl (18.44.0) ...
dpkg: des problèmes de dépendances empêchent la configuration de intel-opencl :
intel-opencl dépend de intel-gmmlib ; cependant :
Le paquet intel-gmmlib n'est pas installé.

dpkg: erreur de traitement du paquet intel-opencl (--install) :
problèmes de dépendances - laissé non configuré
Des erreurs ont été rencontrées pendant l'exécution :
intel-opencl`

So i try :

`blm@blm-Aspire-E1-531:~/intel-compute-runtime/workspace/build_icr$ sudo apt install intel-gmmlib
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Aucune version du paquet intel-gmmlib n'est disponible, mais il existe dans la base
de données. Cela signifie en général que le paquet est manquant, qu'il est devenu obsolète
ou qu'il n'est disponible que sur une autre source

E: Le paquet « intel-gmmlib » n'a pas de version susceptible d'être installée
`
but don't work...

@Brainiarc7
Copy link
Author

So its' complaining about intel's gmmlib.

Ensure that the packages generated under ~/intel-compute-runtime/workspace/build_igc have been installed:

sudo dpkg -i *.deb

Then retry.

@masyoii
Copy link

masyoii commented Nov 7, 2018

same problem with intel-gmmlib dependences

in ~/intel-compute-runtime/workspace/build_igc$ there are only these .deb files:
ls -l | grep deb
intel-igc-core_0.1-0_amd64.deb
intel-igc-media_0.1-0_amd64.deb
intel-igc-opencl_0.1-0_amd64.deb
intel-igc-opencl-devel_0.1-0_amd64.deb

there is no intel-gmmlib in .deb files

please help us. thanks

@ganxiao2008
Copy link

same problem with gmmlib dependences, already got intel-graphics-compiler .deb installed,
From intel/compute-runtime#61 (comment) we might use media-driver 18.3.pre2 pre-release instead.

@EricTheMagician
Copy link

For those who would prefer to not compile it, there this here too:
https://launchpad.net/~intel-opencl/+archive/ubuntu/intel-opencl

@tonyburanzon
Copy link

tonyburanzon commented Nov 25, 2018

When trying to run clinfo I get this error

Abort was called at 22 line in file:
~/intel-compute-runtime/workspace/neo/runtime/gmm_helper/gmm_interface.cpp
Aborted (core dumped)

Which is:

22 UNRECOVERABLE_IF(!gmmLib);

@mattmon
Copy link

mattmon commented Nov 28, 2018

you also need to run 'make package' in the gmmlib build dir

@roboticsai
Copy link

Hello sir, can u please tell me where is the opencl library files so that i can link them in my cmake file? For header files im using opencl_headers/cl/ folder, but i'm little confused about the library files.

@Brainiarc7
Copy link
Author

Hello @roboticsai,

Only link to ocl-icd, and not to a given vendor specific CL implementation.

@hsntgm
Copy link

hsntgm commented May 24, 2019

@ikarishinj98 @ganxiao2008

Checking for module 'igdgmm'
--   Package 'igdgmm', required by 'virtual:world', not found
CMake Error at CMakeLists.txt:326 (message):
  GmmLib not found!

*Before compiling neo first compile and install gmmlib.
*After you installed gmmlib the default installation location is /usr/local
*If you have prefered to install gmmlib with make install instead of making deb archives and sudo dpkg -i *.deb cmake can't find gmmlib path so you can copy igdgmm.pc file manually from
/usr/local/lib/pkgconfig to /usr/lib/pkgconfig/

My solution:
cp /usr/local/lib/pkgconfig/{igdgmm.pc,igc-opencl.pc} /usr/lib/pkgconfig/

@bsed
Copy link

bsed commented Jul 12, 2019

  • [LLVM] Restoring build system compilation flags
    -- [IGC] Link against LLVM static or shared component libs
    CMake Error at BiFModule/CMakeLists.txt:95 (message):
    [IGC\BiFModule] : Cannot find opencl-clang tool-chain, please provide
    sources or install it on system.

-- Configuring incomplete, errors occurred!
See also "/home/kelvin/opt/intel-compute-runtime/workspace/build_igc/CMakeFiles/CMakeOutput.log".
See also "/home/kelvin/opt/intel-compute-runtime/workspace/build_igc/CMakeFiles/CMakeError.log".

@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