Coder Social home page Coder Social logo

sohamm17 / beignet Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3.95 MB

beignet is the old Intel OpenCL runtime. This repo ports it for Yocto Linux 32-bits for embedded systems.

License: GNU Lesser General Public License v2.1

Makefile 0.36% C++ 51.55% CMake 2.42% Shell 0.35% C 44.26% Python 0.81% LLVM 0.23% Common Lisp 0.01%

beignet's Introduction

Beignet - For Intel 32-bits OpenCL Runtime

This package is forked from the official source code of the beignet debian repository beignet debian repository. I have already applied the patches from the debian repo. I have fixed a few bugs so that beignet can run in latest Coffe Lake processors in Linux 32-bits. However, please remember the project is almost dead.

How beignet works

Beignet is the OpenCL runtime for Intel graphics cards. Beignet provides libcl.so, libgbeinterp.so, libgbe.so, gbe_bin_generater, beignet.bc, beignet.local.pch, beignet.pch. gbe_bin_generater is the OpenCL kernel code compiler, which depends on libgbe.so. gbe_bin_generater depends on LLVM and Clang development files.

Once gbe_bin_generater is compiled, this compiler compiles different library kernels of the beignet itself and generates libcl.so, libgbeinterp.so, etc.

Instructions to run beignet in Yocto Linux 32 bits

If you have a 32-bits build host for Yocto then, you can build beignet in the build host and deploy. However, I did not have a 32 bits build host, then it is hard to cross-compile beignet for 32 bits Yocto Linux. I decided to build beignet partially in a 32bits Ubuntu and partially in the Yocto target on board.

As gbe_bin_generater depends on LLVM, if you want to build the whole beignet in Yocto target, then you need LLVM and Clang development files on board. I did not deploy all the LLVM and Clang files on board but I do have Clang and GCC in on board Yocto. I use them.

My approach is to build gbe_bin_generator and related files in a 32 bit Ubuntu Linux, and then take the repo and build libcl.so, libgbeinterp.so in Yocto Linux target board.

Steps

In a Ubuntu Linux 32 bits:

  1. Clone this repo in a Ubuntu or Debian-based system.
  2. Go to the repository.
  3. mkdir build && cd build
  4. For coffee lake the PCI_ID for my machine was 0x3e92. Check your iGPU PCI ID and put in the -DGEN_PCI_ID.
cmake ../ -DCOMPILER=GCC -DBUILD_STANDALONE_GBE_COMPILER=true -DGEN_PCI_ID=0x3e92 \
-DBEIGNET_INSTALL_DIR=/usr/lib/beignet -DCMAKE_BUILD_TYPE=RELEASE
  1. make

In Yocto Linux 32 bits target:

  1. Create a directory /usr/lib/beignet/.
  2. Copy compiled beignet files to the above directory:
beignet/build/backend/src/libgbe.so
beignet/build/backend/src/gbe_bin_generater
beignet/build/backend/src/libocl/usr/lib/beignet/beignet.bc
beignet/build/backend/src/libocl/usr/lib/beignet/beignet.pch
beignet/build/backend/src/libocl/usr/lib/beignet/beignet.local.pch
  1. Go to the beignet directory. Save the following script in utests/setenv.sh.bak
#!/bin/sh
#
export OCL_BITCODE_LIB_PATH=/usr/lib/beignet/beignet.bc
export OCL_HEADER_FILE_DIR=/usr/lib/beignet/include/
export OCL_BITCODE_LIB_20_PATH=
export OCL_PCH_PATH=/usr/lib/beignet/beignet.local.pch
export OCL_PCH_20_PATH=
export OCL_KERNEL_PATH=beignet-debian/beignet/utests/../kernels
export OCL_GBE_PATH=/usr/lib/beignet/libgbe.so
export OCL_INTERP_PATH=/usr/lib/beignet/libgbeinterp.so
#disable self-test so we can get something more precise than "doesn't work"
export OCL_IGNORE_SELF_TEST=1
  1. chmod +x ./utests/setenv.sh.bak && . ./utests/setenv.sh.bak
  2. mkdir build2 && cd build2
cmake ../ -DUSE_STANDALONE_GBE_COMPILER=true -DSTANDALONE_GBE_COMPILER_DIR=/usr/lib/beignet/ -DCMAKE_BUILD_TYPE=RELEASE -DKERNEL_DIR_SOHAM=<beignet top directory absolute path>/kernels/ -DNOT_BUILD_STAND_ALONE_UTEST=TRUE -DGEN_PCI_ID=0x3e92 -DBEIGNET_INSTALL_DIR=/usr/lib/beignet/ -DCMAKE_C_FLAGS=-std=c99 -D_POSIX_SOURCE -DCMAKE_CXX_FLAGS=-std=c++0x -DCOMPILER=GCC
  1. make && make install

Run the tests

  1. cd build2/utests
  2. ./utest_run -a

For Ubuntu or debian-based systems

Download from the official sources.

beignet's People

Contributors

anbe42 avatar gyrosgeier avatar juw avatar rebecca-palmer avatar sohamm17 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.