Other articles

  1. Comparing CPU/GPU memory bandwidth on shared-memory systems

    Did you know that you could enable tons of examples in pocl?


    Intallation of pocl on Ubuntu 16.04 with AMDSDK2.9 examples:

    apt install build-essential cmake git pkg-config make ocl-icd-libopencl1 ocl-icd-dev ocl-icd-opencl-dev libhwloc-dev zlib1g zlib1g-dev clinfo
    apt install libclang-5.0-dev clang-5.0 llvm-5.0
    mkdir pocl
    cd pocl …
    read more
  2. Webcam setup


    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


    allow-hotplug wlan0
    iface wlan0 inet manual
            wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


            -d /dev/video0          the video device
            -r 960x720              the webcam is 720p
            -s 100 …
    read more
  3. How to make my array

    Let's make a friendly array for CPU/GPU processing

    (A) Very well-supported, but impractical to use and error prone.
    (B) Cannot be memcpy'ed. Contains a pointer. Indexing is indirect.
    (C) Perfect if the array does not change.
    (D) Need to unpack. No direct indexing possible.

    (C) is memcpy-able, does no …

    read more
  4. OpenCL zerocopy


    This is both CPU and GPU main memory. How to avoid copying buffers from and to the same memory?

    Allocate aligned memory

    // note: buffer_size is re-written in place
    void *zerocopy_alloc(size_t &buffer_size)
        // OpenCL zero-copy buffers need to be aligned on a page size (i.e., 4KB),
        // and the allocated …
    read more
  5. OpenCL with pocl

    pocl will convert your opencl kernels into AVX-vectorized CPU binaries

    pocl stands for portable compute language [1].

    Building pocl

    For sweet and crispy pocl, you'll need:

    • warm up your favorite C++ compiler
    • prepare the follow baking packages (if you have an Ubuntu 16.04 kitchen)
    # llvm clang 5.0 or …
    read more
  6. OpenCL 2.0 overview

    What's possible with OpenCL 2.0 today?


    AMDGPU-PRO is the closed-source implementation of OpenCL 2.x for AMD. It only targets AMD GPU. AMD used to provided a CPU target, but it is OpenCL 1.2 only.

    rocm is the heterogeneous computing effort of AMD, and is open-source. It …

    read more
  7. Building lldb

    Trying to build the latest lldb.

    A good introduction about lldb is this presentation at the Apple developper conference [1]. For something more focused on ARM, see [2], and for something more focused on FreeBSD, see [3] and [4].

    Building from svn

    The official build guide is [5]. There are …

    read more
  8. Build all-target gdb on ARM

    Trying to build the latest GNU gdb on Scaleway ARM instance.

    Build command:

    apt install bison flex
    configure --with-python --without-ncurses --enable-targets=all --prefix=/opt/gdb
    make -j4

    Neither the version 7.12 nor 8.1 (or even the git sources [1]) build out-of-the-box, while there are no issues on x86_64 …

    read more
  9. Day 9: Week summary

    In the "thesis reboot" post, I brought back from the dead the dusty implementation of my master thesis. Seeing that it was still (almost) working, a week off work was planned to prepare its adaptation to the almighty OpenCL. This post summarizes what this week was all about.

    TL; DR …

    read more
  10. Day 9: OpenCL target debugging with gdb-igfx

    How to use Intel gdb-igfx to debug Intel GPU.

    Everything starts with this article: Getting Started with Debugging with Intel® Parallel Studio XE 2016 [1]. unfortunately, the article is quite old now ("Last updated on August 25, 2015") and not really up-to-date anymore.

    No, wait, there is a newer version …

    read more
  11. Day 8: OpenCL blocks

    How to have a function taking a callback as parameter?

    You cannot use function pointers in OpenCL, even if they can be resolved during compilation.

    It is not possible to write this (while it works in CUDA since the beginning):

    void do_operation(const int* A, const int* B, int* C …
    read more
  12. Day 6: OpenCL malloc

    How to make OpenCL memory allocation functions more like normal malloc/memcpy?

    The problem

    There is a problem with clCreateBuffer [1] is that it returns an opaque cl_mem object, rather than a good old pointer to the allocated memory.

    cl_mem clCreateBuffer (
        cl_context context,
        cl_mem_flags flags,
        size_t size,
        void *host_ptr,
        cl_int …
    read more
  13. Day 7: OpenCL on ARM Mali

    Surprisingly, ARM Mali and Intel HD Graphics GPUs are similar in their design, in comparison to NVidia and AMD's designs.

    Intel and ARM are friendlier to divergent threads

    On the left, ARM Mali [ARM], on the right Intel IGP [INTEL].

    The similarity seems to stem from the two companies having …

    read more
  14. Day 5: OpenCL basics

    What is a device, a compute unit (CU), a work-group, a work-item, a command-queue?

    Work-group vs Work-item

    From [1]:
    A multi-core CPU or multiple CPUs (in a multi-socket machine) constitute a single OpenCL device. Separate cores are compute units. Work-group [is a ] a collection of related work-items that execute on …
    read more
  15. Day 4: v_mem_manager and spinlock

    The simple memory manager of v_array [V_ARRAY] needs a lock on the bitfield which keeps the state of the memory chunks (i.e., allocated or free).

    How to implement this lock on CPU and on GPU? [1].

    Bonus question: in an unified memory environment, how to make it so that …

    read more
  16. Thesis reboot: project setup

    Easy start: let us do CPU-only first

    gputwigstack [1] is the result of a Master research about XML query processing on GPGPU [2].

    Image source: [3] [4].

    Three steps:

    1. metadata generation from parsing XML file
    2. database creation
    3. query processing

    What you will need to build


    • scons software construction tool …
    read more
  17. Intel NUC6i7KYK "Skull Canyon"

    Nuc! Nuc! Nûûûûc!


    Japanese review with nice pictures of the internals [1].

    For example, the CPU:

    Source: [2]

    The long silicon die on the left is the 4-core CPU and the 72-execution-unit GPU. The smaller silicon die on the right is the 128MB eDRAM [3] L4 cache shared by …

    read more
  18. The return of the forgotten Master thesis

    The Master thesis returns after seven years!

    Seven years ago...

    Seven years ago, I wrote my Master thesis [1] about using GPGPU for processing queries on XML trees.

    Unfortunately, the result was not impressive. There were two major drawbacks:

    • It was required to first copy XML metadata to the GPU …
    read more
  19. Intel IGP, OpenCL, and GDB

    So nice!

    Just discovered that Intel provides a special version of GDB for debugging OpenCL kernels on their GPU [1]. What a great move!

    Knowing Intel, I was already imagining that they would have a fully proprietary solution like the Intel debugger [2]. Fortunately, they deprecated it in 2013 in …

    read more
  20. Intel IGP, OpenCL compute units, and divergent threads

    How many OpenCL compute unit has an Intel integrated graphic processor? aka How many divergent threads can be run in parallel?

    On the quest to finding the OpenCL-compatible device having the largest amount of compute units (CU), it seems that around 30 CU, latest nVIDIA achitectures tend to feature a …

    read more
  21. Using Fetch and WebSocket as promised

    read more
  22. Raspberry Pi 3 Ethernet over serial

    Old school internet!

    There is some trickery because of the Raspberry 3 bluetooth feature. See [1].

    By default, the nice hardware serial port /dev/ttyAMA0 is dedicated to the bluetooth connection.

    Disable bluetooth in /boot/config.txt:


    Disable kernel use of the serial port by removing from /boot …

    read more
  23. How to build a safe demo with admin access on Linux hosts?

    Wouldn't it be nice to let people play with gdb and inapp from the internet?

    Yeah, but wait a minute, people would take control of the host computer and use its network connectivity of other and unintended purposes. Especially since the demo gives you access to a working gdb session …

    read more
  24. Web Fetch API

    Howto download a binary as a stream using javascript?

    It may look easy to do with good old XMLHttpRequest, but actually, it is not as obvious. In binary mode, the response object returned by XMLHttpRequest is always complete. Chunked responses are only possible using non-standard moz-chunked-arraybuffer transfer mode (only support …

    read more
  25. How to use radare2 with large binaries

    radare2 looks all fancy and nice, but it is difficult to use with real binaries.

    Ever tried to this:

    ~$ time rabin2 -rs myLargeBinary > rabin_dump.txt
    real        9m59.718s
    user        9m58.644s
    sys 0m0.792s
    ~$ wc -l rabin_dump.txt
    153965 rabin_dump.txt

    I tried with a 50MB binary. Takes almost 10 …

    read more
  26. Readline menu-complete

    Activate readline menu-complete, back-menu-complete, and keep normal 'tab' completion.

    About completion styles

    Normal complete style is the one expected to happen when hitting Tab on any Linux distribution.

    menu-complete style is the one expected to happen on MS-DOS. This one is more convenient when using a gamepad as input, since …

    read more
  27. FriendlyARM NanoPi NEO Mainline and docker

    FriendlyARM has an image for the NanoPi NEO with mainline linux kernel.


    Look! There is a 4.11 kernel image packed with Ubuntu 16.04 (see [1]).

    Unfortunately, the image does not support docker out-of-the-box, because the kernel was not built with the required options.

    Initial error

    The flag …

    read more
  28. DTS and DTB files

    The conversion from DTS to DTB and back to DTS.


    In the Linux kernel source tree, there are .dts (i.e., device tree source) and .dtsi (i.e., device tree source include).

    .dtb is the binary form of the .dts in a similar sense what a binary exectuable is …

    read more
  29. Super Nintendo gamepad to keyboard adapter

    Convert a Super Nintendo gamepad to an USB keyboard.

    Ever wondered if you could type using a gamepad? On one side, a standard keyboard with its 100+ keys gives you direct access to most characters, but is not very confortable to use since you have to move your hands. On …

    read more
  30. qemu + freedos + novnc

    Back to DOS!


    Did you know that:
    • qemu [1] can use vnc as display output?
    • FreeDOS [2] can replace MSDOS?
    • novnc [3] is a vnc client which only need HTML5 and WebSocket?

    Let's mix everything together~


    Install qemu:

    apt install qemu
    qemu-img create -f raw freedos.img 100M …
    read more
  31. NanoPi Neo USB OTG with Armbian mainline 4.x kernel

    The long awaited quest of the USB On-the-Go with mainline Linux kernel 4.x.


    As already documented here before, it is possible to configure FriendlyARM's NanoPi Neo to behave as an USB Ethernet/RNDIS gadget device. Unfortunately this functionality relied on legacy/hacked sunxi kernel. This kernel (3.x …

    read more
  32. gdb - frame decorator example

    The FrameDecorator example given in the documentation does not work?

    If you naïvely try the implement your own MyFrameFilter following the example of the InlineFilter given in the gdb (holy?) documentation [1], you may face the following python errors.

    Import issue

      class MyFrameDecorator(FrameDecorator):
    TypeError: Error when calling the metaclass …
    read more
  33. Starting with nginx

    How to begin with nginx?

    First steps

    Easy, just start at the beginners' guide [1].

    user www-data;
    pid /run/nginx.pid;
    http {
            # Basic Settings
            sendfile on;
            tcp_nopush on;
            tcp_nodelay on;
            keepalive_timeout 65;
            include /etc/nginx/mime.types;
            default_type application/octet-stream;
            # Logging Settings
            access_log /var/log/nginx/access.log;
            error_log /var …
    read more
  34. Jenkins start parameterized task with curl

    How to start a parameterized task on a jenkins server with curl?

    Start a task

    The answer to this question seems simple at first after seen this page [1]. Unfortunately, it does not work as described:

    vjp@inabox:~$ curl -i -X POST http://localhost:8080/job/inapp_GenerateDocs/build --form file0 …
    read more
  35. Control docker from the inside

    How to run a docker container from another docker container?

    Create a docker image which runs jenkins. A jenkins task will prepare a data folder to be used along with another docker container. At the end the two containers will run side by side. The container spawned by the jenkins …

    read more
  36. firefox in docker and ssh tunnel

    How to run firefox inside a docker container?

    firefox in docker

    Adapted from [1] for debian:jessie-slim:

    FROM debian:jessie-slim
    RUN apt-get update && \
            apt-get install -y firefox-esr && \
            apt-get clean
    RUN groupadd --gid 1000 user && \
            useradd --uid 1000 --gid 1000 --create-home user
    USER user
    CMD /usr/bin/firefox-esr

    Build the image …

    read more
  37. jenkins logo

    You have your shinny new Jenkins installation, but how to make it more personal? How to change the logo of Jenkins?

    The Problem

    The butler face is nice, but what if I wanted to add something to the logo?

    In <jenkins_home>, there is an interesting file named title.png coming …

    read more
  38. docker image from usb

    Store and load a docker image from USB storage.

    # docker save -o /mnt/docker/inapp-v0.1-armhf.tar inapp
    # ls -l /mnt/docker/inapp-v0.1-armhf.tar
    -rwxr-xr-x 1 root root 212420096 Mar 28 19:27 /mnt/docker/inapp-v0.1-armhf.tar
    # docker load -i /mnt/docker/inapp-v0.1-armhf.tar
    Loaded image: inapp …
    read more
  39. inapp docker container

    Build a docker container for inapp.

    Stage 1: Build manually on x86

    Run a Debian image for tests:

    sudo docker run -ti --rm debian:jessie-slim bash

    ...and validate the build sequence:

    apt-get update
    apt-get install make
    apt-get install g++
    apt-get install qtbase5-dev
    apt-get install libqt5websockets5-dev
    apt-get install liblttng-ust-dev
    apt-get install …
    read more
  40. NanoPi NEO docker with armbian

    Is it possible to run docker containers on NanoPi NEO?

    Your Linux kernel version 3.4.113-sun8i is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer.

    Unfortuntely no, it does not work with the default legacy kernel 3.4.113-sun8i.

    Embrace your dark …

    read more
  41. Howto clone an SD-card

    How to clone an SD-card?

    ~$ sudo dd if=/dev/mmcblk0 of=image.img bs=4M status=progress
    5783945216 bytes (5,8 GB, 5,4 GiB) copied, 81,031 s, 71,4 MB/s
    3835+1 records in
    3835+1 records out
    16088301568 bytes (16 GB, 15 GiB) copied, 247,23 …
    read more
  42. Docker and Jenkins with chroot-based SDK

    How to run Jenkins via docker and build a project chrooting in a SDK?


    docker is easy to install on Ubuntu [1].

    Starting a Jenkins container with a persistent volume is just as easy [2]:

    sudo docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v /var/jenkins_home …
    read more
  43. JSON command-line operations

    Preparing JSON files from command-line using Python base library.

    Python has a library to process JSON by default. See [1].

    Using Python on command-line, simple scripts can be written for preparing JSON configurations (e.g., with a Makefile).


    Want to stringify a JSON file in order to embedded it …

    read more
  44. inapp software

    Installing inapp on Armbian.

    Update everything after the fresh installation to get the latest kernel and packages:

    apt-get update
    apt-get upgrade

    Disable the NetworkManager deamon and save ~6MB of RAM:

    root@nanopineo:~# systemctl disable NetworkManager
    Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
    Removed symlink /etc/systemd/system/multi-user …
    read more
  45. inapp OTG ethernet

    Setting-up the USB OTG port as an Ethernet 'gadget' device.

    About "sunxi"

    sunxi is the community working on the open-source environment for Allwinner chips... but it has to be kept in mind, and they write it right on the top of the front page [1], that:

    Allwinner [...] is violating the …
    read more

Page 1 / 4 »