Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

OpenCL SDK on Ubuntu

Altera_Forum
Honored Contributor II
2,970 Views

Hi,The OpenCL SDK Release page says that Redhat EL 5.6 is the only supported Linux distribution. 

We have a server with 32G RAM running Ubuntu 12.04.I am just curious to know if OpenCL SDK will run fine on Ubuntu as well. (just that it may not be supported) 

Thanks, 

Best Regards, 

Snth
0 Kudos
19 Replies
Altera_Forum
Honored Contributor II
1,072 Views

Only RHEL 5.6 is officially supported. That said, the SDK should be able to be installed on any x86-64 Linux system. This of course will require Quartus II to be installed on the system as well as a prerequisite. The main barrier to this is using an actual board in an Ubuntu system. The PCIe driver is specific to the kernel version used by RHEL 5.6. So in theory you could use an Ubuntu machine to build/compile kernels, but the actual running of a program would need to occur on a system that has a working PCIe driver and board.

0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

Hi Swizzle, 

Thanks for the heads-up. It was very useful. 

I think we will go with RHEL to avoid any embarrassments. 

Best Regards, 

Snth
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

Swizzle feedback is correct. I've tried AOCL with Ubuntu, and the major problem is related with the driver compilation. After being able to compile the aclpci_drv driver, the build script must be changed to look for the proper path of the linux headers, and afterwards the compiled .ko module never loads. Stick with RHEL, the driver compilation and loading is smooth. 

 

The aclpci_drv while not reporting errors if loaded with modprobe is not loaded correctly. You should add a startup script that runs the aclpci_load script each time the system is booted up, for the driver to be correctly loaded. You can try aocl diagnostic to see if both driver and FPGA are up and running.
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

Thank you Andradx.. Given the complications, RHEL looks to be my best bet.

0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

One Last Question: 

 

Altera doc says Redhat EL5.6 is required. 

Will this work with Redhat EL 6 as well?  

OR  

Should I go for Redhat 5.6 version alone? 

 

I am planning a Virtual Machine (using KVM) - I hope the tools work on top of a VM....  

May be, I Should configure some PCIe Pass Through ? Any advice here?
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

I'm running CentOS 6.3. I matched only the kernel version and revision. 

 

Regarding virtualization with PCIe devices, I tried some years ago Citrix with CUDA devices and the PCIe passthrough was possible, but tricky. Should you succeed in enabling the passthrough it should work. Not really much of a help, though.
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

I have tried CentOS 6.4 x86_64 (installation on my PC is very exhausting), it works! FYI

0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

 

--- Quote Start ---  

I have tried CentOS 6.4 x86_64 (installation on my PC is very exhausting), it works! FYI 

--- Quote End ---  

 

 

Just so that anyone trying to install on Ubuntu may know. 

 

As a production machine, the one where kernels are compiled, synthesized and P&R, Ubuntu fits just fine. In fact, we've been running a Ubuntu workstation for a while now with the Altera AOCL 13.0sp1 and it works just fine. 

 

However, if you are looking for a machine where you can install the FPGA board and download an OpenCL bitstream, then CentOS 6.4 x86_64 is right for you. It just works (almost) out-of-the-box. 

 

 

Sorry about not mentioning this before.
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

On my CentOS 6.4 x86_64 machine I can compile with aoc but I can't run my host code without adding $ALTERAOCLSDKROOT/host/linux64/lib to the LD_LIBRARY_PATH. However, that directory has a version of libstdc++ that conflicts with the system version of libstdc++, so some other applications don't load for me while my library path includes the Altera library path. 

 

Does anyone else experience this or any other issues with CentOS 6.4 x86_64?
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

 

--- Quote Start ---  

On my CentOS 6.4 x86_64 machine I can compile with aoc but I can't run my host code without adding $ALTERAOCLSDKROOT/host/linux64/lib to the LD_LIBRARY_PATH. However, that directory has a version of libstdc++ that conflicts with the system version of libstdc++, so some other applications don't load for me while my library path includes the Altera library path. 

 

Does anyone else experience this or any other issues with CentOS 6.4 x86_64? 

--- Quote End ---  

 

 

Sure. For runtime you'll need the libstdc++ that is shipped with the AOCL. I'd say the best way to go around it is to call your executables from a script that exports $ALTERAOCLSDKROOT/host/linux64/lib to your LD_LIBRARY_PATH temporarily. Otherwise, it can be somewhat annoying if you try to run your OpenCL application also on a GPU and you constantly need to redefine LD_LIBRARY_PATH. 

 

 

You name the following as runAOCL 

# !/bin/bash 

 

ldBak=$LD_LIBRARY_PATH 

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ALTERAOCLSDKROOT/host/linux64/lib 

$1 

export LD_LIBRARY_PATH=ldBak 

 

and just call runAOCL <myexecutable> 

 

Although I'm not that sure about how to handle several arguments to your executable, something quite similar should work.
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

Thanks for adding that info andradx. Other than temporarily setting that LD_LIBRARY_PATH, everything seems to run and behave as expected for me on my CentOS 6.4 x86_64 machine.

0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

 

--- Quote Start ---  

Thanks for adding that info andradx. Other than temporarily setting that LD_LIBRARY_PATH, everything seems to run and behave as expected for me on my CentOS 6.4 x86_64 machine. 

--- Quote End ---  

 

 

 

There is just one thing last thing I'd add. For a production workstation you really need the minimum 24 GB of RAM. At least I tried several full compilations on 12GB RAM+ 12GB Swap and sometimes the compilation flow crashed unexpectedly. However, we took care of that when we moved to a 32GB RAM + 32GB Swap. 

 

For running the application itself it doesn't really matter, does it?
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

The memory requirements for a production machine depends on your application. Buffers get mirrored on the host so for every buffer you allocate in the FPGA there is a copy on the host as well.

0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

 

--- Quote Start ---  

The memory requirements for a production machine depends on your application. Buffers get mirrored on the host so for every buffer you allocate in the FPGA there is a copy on the host as well. 

--- Quote End ---  

 

 

 

Sure, but we decided to move our FPGA board to a Sandy Bridge host w/ 8GB. It wasn't worth spending much more RAM on it and definitely not worth keeping the FPGA on the same machine were synthesis were happening. 

 

 

What do you mean "buffers get mirrored"? Are you talking about the OpenCL host and device memory systems, were the mentioned causality is the other way around?
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

8GB should probably be fine unless your application requires a lot of memory. 

 

When you create a buffer using clCreateBuffer, memory is allocated in the FPGA and the host memory systems. This extra copy on the host is transparent to the user and is used any time the FPGA hardware gets swapped out because buffers in the FPGA have to be pulled up to the host then sent back down to the FPGA after the hardware has been replaced. So for example if I had 500MB worth of data to send down to the FPGA, my total system memory requirements would be 1.5GB: 500MB in the FPGA, 500MB mirrored on the host, 500MB user allocated memory containing the actual data.
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

Did not know that. Thank you for the information, BadOmen.

0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

Hi, 

 

I only have access to a machine running ubuntu (and windows). Not other versions of linux available. And i prefer using ubuntu over windows. But I am having problems with the aocl driver in ubuntu. The boards works perfectly fine in windows. In ubuntu the aocl diagnose command runs successfully but the aocl flash command fails. The error says that the hardware cable is not connected. The usb blaster cable is connected and the board is listed in the output of the 'lsusb' command. So can you please tell me how to solve this driver issues? 

 

output of aocl diagnose : 

 

aocl diagnose: Running diagnostic from /home/johnspaul92/altera/14.1/hld/board/terasic/de5net/linux64/libexec 

 

Verified that the kernel mode driver is installed on the host machine. 

 

Using platform: Altera SDK for OpenCL 

Using Device with name: de5net_a7 : Altera's Preferred Board 

Using Device from vendor: Altera Corporation 

clGetDeviceInfo CL_DEVICE_GLOBAL_MEM_SIZE = 4294967296 

clGetDeviceInfo CL_DEVICE_MAX_MEM_ALLOC_SIZE = 4293918720 

Memory consumed for internal use = 1048576 

Actual maximum buffer size = 4293918720 bytes 

Writing 4095 MB to global memory ... 

Write speed: 1975.88 MB/s [1959.28 -> 1990.31] 

Reading and verifying 4095 MB from global memory ... 

Read speed: 2813.43 MB/s [2798.11 -> 2827.39] 

Successfully wrote and readback 4095 MB buffer 

 

Transferring 8192 KBs in 16 512 KB blocks ... 2009.26 MB/s 

Transferring 8192 KBs in 8 1024 KB blocks ... 2546.06 MB/s 

Transferring 8192 KBs in 4 2048 KB blocks ... 2742.12 MB/s 

Transferring 8192 KBs in 2 4096 KB blocks ... 2580.77 MB/s 

Transferring 8192 KBs in 1 8192 KB blocks ... 2701.07 MB/s 

 

PCIe Gen2.0 peak speed: 500MB/s/lane 

 

Writing 8192 KBs with block size (in bytes) below: 

 

Block_Size Avg Max Min End-End (MB/s) 

524288 1276.34 1396.63 1201.31 1236.97 

1048576 1459.67 1780.07 1378.81 1441.02 

2097152 1941.49 2053.72 1825.71 1936.21 

4194304 1821.83 1883.68 1763.92 1819.59 

8388608 1941.08 1941.08 1941.08 1941.08 

 

Reading 8192 KBs with block size (in bytes) below: 

 

Block_Size Avg Max Min End-End (MB/s) 

524288 1744.30 2009.26 1588.37 1687.13 

1048576 2424.19 2546.06 2344.27 2403.30 

2097152 2693.70 2742.12 2656.59 2679.92 

4194304 2506.41 2580.77 2436.22 2496.38 

8388608 2701.07 2701.07 2701.07 2701.07 

 

Write top speed = 2053.72 MB/s 

Read top speed = 2742.12 MB/s 

Throughput = 2397.92 MB/s 

 

DIAGNOSTIC_PASSED 

 

output of aocl flash : 

 

aocl flash: Running flash from /home/johnspaul92/altera/14.1/hld/board/terasic/de5net/linux64/libexec 

========================= Page Selection ========================= 

Please select the flash page where to store your FPGA configure data: 

[0] Factory Image Location(Address 0x00040000), SW5.2 = "1" (Right Position) 

[1] User Image Location(Address 0x020C0000), SW5.2 = "0" (Left Position) 

Enter a digital number 0 or 1 (Or other values to exit the program) followed by pressing the "Enter" key: 

Flash Programming... 

Info: ******************************************************************* 

Info: Running Quartus II 64-Bit Convert_programming_file 

Info: Version 14.1.0 Build 186 12/03/2014 Patches 0.19 SJ Full Version 

Info: Copyright (C) 1991-2014 Altera Corporation. All rights reserved. 

Info: Your use of Altera Corporation's design tools, logic functions  

Info: and other software and tools, and its AMPP partner logic  

Info: functions, and any output files from any of the foregoing  

Info: (including device programming or simulation files), and any  

Info: associated documentation or information are expressly subject  

Info: to the terms and conditions of the Altera Program License  

Info: Subscription Agreement, the Altera Quartus II License Agreement, 

Info: the Altera MegaCore Function License Agreement, or other  

Info: applicable license agreement, including, without limitation,  

Info: that your use is for the sole purpose of programming logic  

Info: devices manufactured by Altera and sold by Altera or its  

Info: authorized distributors. Please refer to the applicable  

Info: agreement for further details. 

Info: Processing started: Tue Aug 25 11:07:47 2015 

Info: Command: quartus_cpf --convert flash.cof 

Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion `map->l_init_called' failed! 

Info (210033): Memory Map File flash.map contains memory usage information for file flash.pof 

Info: Quartus II 64-Bit Convert_programming_file was successful. 0 errors, 0 warnings 

Info: Peak virtual memory: 884 megabytes 

Info: Processing ended: Tue Aug 25 11:08:24 2015 

Info: Elapsed time: 00:00:37 

Info: Total CPU time (on all processors): 00:00:34 

Error (213013): Programming hardware cable not detected 

Error: quartus_pgm failed at /home/johnspaul92/altera/14.1/hld/board/terasic/de5net/linux64/libexec/flash.pl line 74, <STDIN> line 1. 

aocl flash: Program failed.
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

 

--- Quote Start ---  

 

[...] In ubuntu the aocl diagnose command runs successfully but the aocl flash command fails. The error says that the hardware cable is not connected. The usb blaster cable is connected and the board is listed in the output of the 'lsusb' command. 

[...] 

Error (213013): Programming hardware cable not detected 

Error: quartus_pgm failed at /home/johnspaul92/altera/14.1/hld/board/terasic/de5net/linux64/libexec/flash.pl line 74, <STDIN> line 1. 

aocl flash: Program failed. 

--- Quote End ---  

 

 

I'm experiencing the same here.  

My configuration is: 

Ubuntu 14.04 LTS 3.19.0-25-generic 

DE5-Net BSP/Driver: Modified v14.0 

AOCL Version: 15.0.2 

Quartus II: 15.0.2 

 

I saw that patch 0.19 for quartus ii 14.1 (https://www.altera.com/support/support-resources/knowledge-base/solutions/rd01272015_37.html) addressed this issue but in the web page of the patch it's also written that the problem is solved in Quartus 15.0 :confused: 

 

I tried to check the files inside the patch and some of them are actually the same files in my Quartus 15.0.2. I also tried to patch my Quartus 15.0.2 (even if the patch is not made for this version) but nothing changed; the problem is still there.  

 

The good news is that aocl program tool and API calls let me program the device anyway. 

 

If somebody could help here to solve the situation it would be nice anyway, 

Nicola.
0 Kudos
Altera_Forum
Honored Contributor II
1,072 Views

There is a nice set of instructions given in http://www.fpga-dev.com/altera-usb-blaster-with-ubuntu/ to solve the usb cable issue in ubuntu 14.04. These instructions along with an aocl install every time you boot the system can solve the issue. The steps involved are : 

 

1. verify usb connection and check product id 

 

At first, connect the cable and make sure the USB device is recognized. These are the commands I used and the output I got: 

$ dmesg|tail 

[...] 

[16059.962298] usb 2-2: New USB device found, idVendor=09fb, idProduct=6010 

[16059.962301] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 

[16059.962303] usb 2-2: Product: CV SoCKit 

[16059.962305] usb 2-2: Manufacturer: Altera 

[16059.962307] usb 2-2: SerialNumber: ARCVSC-123-457 

$ lsusb|grep Altera 

Bus 002 Device 007: ID 09fb:6010 Altera 

 

Take note of the Product ID listed - 6010 in the above example. 

2. fix usb driver permissions 

 

The Quartus software will use the Linux built-in usb_device drivers. By default, only root has access to these so we must make sure the user is allowed to access them as well. 

 

jtagd, part of the Quartus tools, is a deamon that provides the interface between the Altera tool accessing the JTAG chain and the USB driver. If not already running, jtagd will be startetd automatically when the Quartus software or jtagconfig is run. You'll usually run these as a user, which means jtagd will also run as a user. That is why edited permission for the usb_device is necessary. 

 

Create a file /etc/udev/rules.d/51-usbblaster.rules, make sure it has read permissions for root, and fill it with this content: 

# For Altera USB-Blaster permissions. 

SUBSYSTEM=="usb", 

ENV{DEVTYPE}=="usb_device", 

ATTR{idVendor}=="09fb", 

ATTR{idProduct}=="6010", 

MODE="0666", 

NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", 

RUN+="/bin/chmod 0666 %c" 

 

Edit the value for ATTR{idProduct} to match the Product ID determined before. 

 

If you have more than one Product ID you want this to work for, simply repeat the above lines in the same file and use the other Product IDs for ATTR{idProduct}. 

 

For the changes to take effect, reboot the machine or run: 

$ sudo udevadm control --reload 

 

3. copy devices data for jtagd 

 

Make sure jtagd has access to the list of devices: 

$ sudo cp /opt/altera/13.1/quartus/linux64/pgm_parts.txt /etc/jtagd/jtagd.pgm_parts 

 

Also make sure this file has read access for the user. 

 

This file allows Altera tools to translate Device IDs (left column of terminal listing below) to device names (right column) for found devices. 

Test that it's all working 

 

4. to test that the connection works, execute jtagconfig and hope for an output giving the board and the devices: 

$ jtagconfig 

1) CV SoCKit [2-2] 

02D020DD 5CSEBA6(.|ES)/5CSEMA6/.. 

4BA00477 SOCVHPS 

 

The cable should now be recognized as a valid hardware by the Quartus tools.  

 

5. this step needs to be repeated every time you reboot the device 

cd /home/<user_name>/altera/14.1/quartus/bin 

sudo killall -9 jtagd 

sudo killall -9 jtagd 

sudo ./jtagconfig 

 

aocl install 

the driver needs to be installed every time you reboot the system or the usb interface wont work properly 

 

I hope the above steps help 

 

Johns Paul
0 Kudos
Reply