NVIDIA CUDA under Fedora 21


As of May 2015, NVIDIA CUDA is not officially supported under Fedora 21. According to their website they plan to release CUDA 7 for FC21, but until then you can still install CUDA 6.5 using the official packages. If you are trying to install under Fedora 20 then follow this tutorial.

Install cuda-repo-fedora20-6.5-14.x86_64.rpm from the NVIDIA site.  This will add a new “cuda” repo from where you can install the cuda packages:

sudo yum install xorg-x11-drv-nvidia-cuda


The cuda codebase will not compile under GCC 5 (the default for Fedora 21) but you can just remove the warning and everything works fine (thanks to plebean_student on reddit for the tip).



and comment out the following line:

#error -- unsupported GNU version! gcc 4.9 and up are not supported!

Build the examples

Setup your environment to point to the installed CUDA libraries and binaries:

export CUDA_HOME=/usr/local/cuda-6.5 
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 
export PATH 

Create a new directory for the examples and build them:

cuda-install-samples-6.5.sh  ~ 
cd ~/NVIDIA_CUDA-6.5_Samples 
make -j10

Run some examples to check they work ok:


Jenkins and pep257 warnings

Want to get your Python pep257 docstring errors in a Jenkins job?  Then you can use the Jenkins Warnings plugin with a custom parser.  These can be added under “Manage Jenkins” > “Configure System” and in the “Compiler Warnings” section.

Add a new parser (I set “Name”, “Link name” and “Trend report name” to “pep257”) with the following settings:

Regular Expression


Mapping Script

import hudson.plugins.warnings.parser.Warning

String fileName = matcher.group(1);
String lineNumber = matcher.group(2);
String category = matcher.group(4);
String message = matcher.group(3) + ":" + matcher.group(5);

return new Warning(fileName, Integer.parseInt(lineNumber), "Dynamic Parser", category, message);

Example Log Message

test.py:18 in private nested class `meta`:
        D101: Docstring missing
test.py:22 in public method `method`:
        D102: Docstring missing

Jenkins job

Also worth remembering that pep257 returns an exit code of 1 if it finds any problems. This will cause the Jenkins job to be marked as failure. To avoid this change the exit code:

find . -name '*.py' | xargs pep257 || true

Fedora 21 PyYAML fails to update

Spotted some errors after upgrading to Fedora 21 with PyYAML failing when doing a yum update:

Error unpacking rpm package PyYAML-3.11-6.fc21.x86_64
error: unpacking of archive failed on file /usr/lib64/python2.7/site-packages/PyYAML-3.11-py2.7.egg-info: cpio: rename
error: PyYAML-3.11-6.fc21.x86_64: install failed
  PyYAML.x86_64 0:3.10-10.fc20                  PyYAML.x86_64 0:3.11-6.fc21

The fix for this is to remove the temporary installation files for version 3.11:

rm -rf /usr/lib64/python2.7/site-packages/PyYAML-3.11-py2.7.egg-info*

Then yum update will work correctly

pylint in Vim

I’m a big fan of Vim and I do lots of Python programming and I like to ensure my code passes static analysis (using pylint).  To hook these together I added the following to my .vimrc file.

autocmd FileType python set makeprg=pylint\ --reports=n\ --msg-template=\"{path}:{line}:\ {msg_id}\ {symbol},\ {obj}\ {msg}\"\ %:p
autocmd FileType python set errorformat=%f:%l:\ %m

When you have a python file open :make runs pylint and shows the results in the quickfix window so you can jump to the line with the problem.

Vim pylint integration

More CPAN issues in Fedora 20

Following on from may last post about CPAN in Fedora 20, I faced another problem on a machine I upgraded.  cpan would fail to load with the error:

Attempt to reload Scalar/Util.pm aborted.
Compilation failed in require at /usr/share/perl5/Safe.pm line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/Safe.pm line 4.
Compilation failed in require at /usr/share/perl5/CPAN.pm line 56.
BEGIN failed--compilation aborted at /usr/share/perl5/CPAN.pm line 56.
Compilation failed in require at /usr/share/perl5/App/Cpan.pm line 218.
BEGIN failed--compilation aborted at /usr/share/perl5/App/Cpan.pm line 218.
Compilation failed in require at /bin/cpan line 9.
BEGIN failed--compilation aborted at /bin/cpan line 9.

The problem I found was in the List::Util library, this library needs to removed and reinstalled.  But you have to use yum (as CPAN is broken!)  In order to force yum to do its job, you need to remove the offending files first:

find /usr/ -wholename "*/List/Util*" -delete

After this force a reinstall using yum:

yum reinstall perl-Scalar-List-Utils -y

CPAN should then start running at this point.

CPAN problems in Fedora 20

After a recent Fedora 20 update my Perl libraries are broken. This appears to be a common problem with Fedora updates.

When trying to use cpan it kept failing when building the database with error:

install_driver(SQLite) failed: Perl API version v5.16.0 of does not match v5.18.0 at /usr/lib64/perl5/DynaLoader.pm line 213, line 138944.
Compilation failed in require at (eval 45) line 3, line 138944. at /usr/local/share/perl5/CPAN/SQLite/DBI.pm line 78.

This is caused by some old files that have moved location (“yum provides” shows no Fedora package installs this any more). Just remove that directory:

rm -rf /usr/local/share/perl5/CPAN/SQLite

And it all works fine.

I had some other problems using other Perl libs due to C API mismatch problems:

Perl API version v5.16.0 of HTML::Parser does not match v5.18.0 at /usr/share/perl5/XSLoader.pm line 92.

This can simply be fixed by forcing a reinstall in cpan of the problem module:

force install HTML::Parser

NAT forwarding under Linux

Easy setup of NAT forwarding using iptables under Linux (this was only tested on Fedora 18):

sysctl -w net.ipv4.ip_forward=1
iptables -F

Branches on Github

A cheat sheet for using branches with Github and ensuring they keep in sync

Creating a new branch

git checkout -b your_branch
git push -u origin your_branch

Checkout an existing branch

git checkout --track -b your_branch origin/your_branch