Blog posts

Cuda debug problems on Ubuntu 13.04

Hi there,

Today, I am going to discuss cuda-gdb problems. Almost a month ago, I have faced a problem which cuda-gdb wasn't able to execute debug operations for kernel functions.

I have compiled my application according to the manual of cuda-gdb;

nvcc -g -G -o main

Here "-g" option is for debug instructions of CPU code and "-G" option is for debug instructions of GPU code. As you can see that I am compiling our application according to rules.

Still, I was unable to debug my application. I have done some research and found out that many other have faced with the same problem. Here is an example;

Cuda-gdb doesn't break and/or step into Kernels

I have continued my research and discovered something extraordinary. I don't know who but packager of the nvdia driver (experimental-310 in repository) has removed the debug libraries from the driver while packing it. That was really surprising. My first reaction was that to visit Nvidia download page and download latest Nvidia driver. There is no need to download driver separately. I will explain this further.

I have installed the driver according to instructions in here and I was very excited. I have tested debugging immediately. Unfortunately, it didn't work and I got fallowing error;

Cuda ELF image contains unknown ABI version: 7
/home/buildmeister/build/rel/gpgpu/toolkit/r4.1/debugger/cuda-gdb/7.2/gdb/cuda-tdep.c:1203: internal-error: cuda_get_bfd_abi_version: Assertion `CUDA_ELFOSABIV_16BIT <= abiv && abiv <= CUDA_ELFOSABIV_LATEST' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

Again, I have started to do some research and I have read somewhere that I have to recompile my CUDA Toolkit. I have installed downloaded and installed CUDA Toolkit according to STEP II instructions in here.

Actually, this only worked for once and again I have the same problem. I've done some research and reached this link. It says that, my driver version is too new for the toolkit :)

Now, I am downloading Cuda Toolkit 5.5 (which is a release candidate). and after I test it, I will post the results here. I have downloaded and installed the deb package. Unfortunately, it didn't work. I've got following error;

libkmod: ERROR ../libkmod/libkmod-module.c:791 kmod_module_insert_module: could not find module by name='nvidia_current'
ERROR: could not insert 'nvidia_current': Function not implemented

Now, I am downloading self-extracting installer. I will post the results. I have downloaded self-extractor package and installed both cuda-5.5 toolkit and display driver. I have compiled my cuda code, than run cuda-gdb application to debug my code. Finally, I haven't experience any more problems and debug was successful.

Have a nice day.

by zgrw on 2013-06-25 12:33:23

Installing Cuda on Ubuntu 12.04

Here is the original entry:

STEP I – Driver installation

Download the Nvidia drivers for Linux from their website, making sure to select 32 or 64-bit Linux based on your system.

Install fallowing;

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

Next, blacklist the required modules;

sudo nano /etc/modprobe.d/blacklist.conf

Add the following lines to the end of the file, one per line, and save it when done;

blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

In order to get rid of any nVidia residuals, run the following command in a terminal;

sudo apt-get remove --purge nvidia*

This may take a while, so be patient. Once it’s done, reboot your machine. At the login screen, don’t login just yet. Press Ctrl+Alt+F1 to switch to a text-based login, and switch to the directory which contains the downloaded driver. Run the following commands;

sudo service lightdm stop
chmod +x NVIDIA*.run

where NVIDIA*.run is the full name of your driver. Next, start the installation with;

sudo ./NVIDIA*.run

Follow the onscreen instructions. If the installer throws up an error about nouveau still running, allow it to create a blacklist for nouveau, quit the installation and reboot. In that case, run the following commands again;

sudo service lightdm stop
sudo ./NVIDIA*.run

The installation should now proceed smoothly. When it asks you if you want the 32-bit libraries and if you want it to edit xorg.conf to use these drivers by default, allow both.

Reboot once the installation completes.

STEP II – CUDA toolkit installation

Download the CUDA toolkit (I used the Ubuntu 11.10 64-bit version). Navigate to the directory that contains the downloaded CUDA toolkit package, and run the following command;

chmod +x cuda*.run
sudo ./cuda*.run

where cuda*.run is the full name of the downloaded CUDA toolkit. Accept the license that appears. Next, choose to install the driver if you’ve not done so already (this is the development version). Installation of the driver will require switching to a text-based shell (Ctrl+Alt+F1), stopping lightdm as detailed in the previous step and running the toolkit installer as superuser. The CUDA 5.0 toolkit installation is compulsory, while that of the included samples isn’t. Allow the installer to proceed with default locations unless you have specific reasons for not doing so. This makes for easier troubleshooting in the future.

This process might take a while depending upon your system config. Once it’s done, double check the summary screen to make sure everything is in place. If the installation of the samples fails (which it does more often than not), it’s probably due to one or more missing libraries. In that case, install the required libraries and rerun the installer, choosing to install the samples alone.

To make sure the necessary environment variables (PATH and LD_LIBRARY_PATH) are modified every time you access a terminal, add the requisite lines (from the summary screen) to the end of ~/.bashrc as follows;

32 bit systems -
export PATH=$PATH:/usr/local/cuda-5.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib

64 bit systems -
export PATH=$PATH:/usr/local/cuda-5.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:/lib

The paths used above will vary based on the install directory you choose for the toolkit. This wraps up the arguably simpler setup (compared to CUDA 4.x for Linux users), although the samples’ installation still suffers from dependency hell.

STEP III – CUDA samples installation and troubleshooting

While the installation of the samples should be straightforward (simply run the all in one toolkit installer), it’s often not all that easy. If you’re getting an error similar to “Samples installation failed due to missing libraries – not found”, it’s typically because the installer looks for and not variants (like To fix this, we’ll have to create softlinks so the installer can track down these files.

Determine if variants of are present as follows;

sudo find /usr -name libglut*

On my 64-bit installation of Ubuntu 12.04, this output the following text;


Now that a variant of (that is, has been found, we can create a softlink to it;

sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/

Next, rerun the all in one installer choosing to install only the samples this time around. That should fix the “Missing libraries” error that cropped up previously.

Further reading resources can be found here if you’re looking for books on CUDA and GPGPU programming in general.

Credit for STEP III goes to these release notes (refer section III b – Known issues on CUDA Samples for Linux).

by zgrw on 2013-06-22 11:13:17

Parallelism of AES Algorithm via MPI

Yesterday (2013-04-25) I have presented my work at 6th MTS seminar in Cankaya University. You can find the details from this link

Here is the abstract part of the paper;

Nowadays, information security has the major interest of academia because everything is online (money transactions, accessing information, paying bills etc) and information change on online environments vulnerable to attacks. Also, most of the governments
keep their data in cyber systems. Some of these data also include sensitive information such as personal information or top secret government documents.
It is important to protect these fragile data against unauthorized people. This is where encryption comes in. Cryptography is the study of mathematical techniques which aims to solve the information security aspects such as confidentiality, data integrity, entity authentication, and data origin authentication cite. Advanced Encryption Standard (AES) is the national standard which is accepted by U.S. government to protect their fragile data cite cite.
Encryption is a good way to protect data but in order to encrypt a data, if it is over 1 GB, it could take more than 10 minutes. According to today's standards, it is very long time and time is an important resource.
Computers are not expensive anymore and they come with multiple processors. If we could get advantage of these processors or have multiple computers, we may be able to make algorithm parallel and observe some speed up. OpenMPI library allows to developer take advantage of the every CPU in the environment. These CPUs can be distributed over network or they can be put together as a multi-core CPU.
With this approach we can manage the time effectively. This study is focusing on the parallelism of AES algorithm and observation of the changes of the encryption time. The result of this study indicate that increasing the number of processors boosts up the performance of computing.
As a result, two processors consume almost half of the computing time according to one processor.

Here is the rest of the paper.

You can find all papers presented on conference in this file.

by zgrw on 2013-04-26 14:44:36

University Interview


Today, Computer Engineering department of Cankaya University has published an interview with me on their website.

Interview is about my ideas of the department and its education.

Unfortunately, page is in Turkish but you may reach it through fallowing link;

Edit reason: updated the link

Edited on: 2015-11-07 20:49:54
by zgrw on 2013-03-20 00:05:41

1 2 3 4 5