Altera_Forum
Honored Contributor
8 years agoDE5_NET OpenCL support on Ubuntu 16.10
I'm trying to use the OpenCL SDK for the Terasic DE5_Net board.
I'm using the BSP provided by Terasic in their website. But I start having (at least) two differences with the expected setup. 1) I am using the latest Quartus and OpenCL SDK Versions (Version 17.0.2 Build 602). 2) I am using an Ubuntu 16.10 with a 4.8.0-59-generic kernel version Apparently the first point is not problematic. The second point is more troublesome. When you try to compile the board kernel driver (>aocl install) the compilation crashes because the get_user_pages function (from mm.h) has less parameters in newer kernels. I have tried to implement the missing function (with more parameters) getting inspiration from older kernel sources. See the implementation below // @author David Castells-Rufas // In new kernels (> 4.6) get_user_pages use current task info, // so go to the more complete function. I get some inspiration from // http://elixir.free-electrons.com/linux/v4.6/source/mm/nommu.c#l162 long get_user_pages_old_kernel(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, int write, int force, struct page **pages, struct vm_area_struct **vmas) { int flags = 0; if (write) flags |= FOLL_WRITE; if (force) flags |= FOLL_FORCE; return __get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas, NULL); } When I do this, the driver compiles but when I execute I get some errors and the system finally crash. With this [failing] driver you can still do >aocl diagnose (without parameters) but when you try ">aocl diagnose acl0" the system starts transferring memory, and the application detects a lot of memory errors... Transferring 8192 KBs in 16 512 KB blocks ... Error! Mismatch at element 1008: 3f0 != 1efbf0, xor = 001ef800 Error! Mismatch at element 1009: 55b1a2e9 != 1229541c, xor = 4798f6f5 ... To solve these issues I have looked for a debian package with a kernel having the get_user_pages function with the long list of parameters. I found it to be 4.4.0-24-generic. So I installed it and recompiled the driver against it. After rebooting my system using the 4.4.0 kernel the OpenCL driver works and ">aocl diagnose acl0" runs smoothly. However I would like to work with the newer kernel as it has other implications (for other drivers). Anyone knows whether there are drivers adapted to newer Linux Kernels? Or whether anyone has tried to do it or either Altera/Intel or Terasic have internal people working on that? Thanks !