LXF173 CUDA article

Comments, suggestions and questions about Linux Format magazine and the coverdiscs

Moderators: ChrisThornett, LXF moderators

LXF173 CUDA article

Postby MarcRemillard » Mon Jun 24, 2013 12:33 pm

Hello all,
Despite having been a Linux user now for several years, and a magazine subscriber for about two years, this is my first post! (I did have some problems with a previous username not being activated several months ago, so set up another one).
I thought I would put my old 8800GTS graphics card to work properly, having heard of CUDA before, so was very interested in following Ben Everard's tutorial. Although I like to read through all the code examples properly first, it is very useful having the files available on the coverdisk. I had a number of problems following all the steps in the article though.
Firstly, I never was able to locate the test script 'benchmark.sh' referred to on p.80. This wasn't too important, as I got the next two examples to run correctly, but it did confuse me somewhat.
The trouble really started though when I tried to install pyCuda. I run several distros, including an old Ubuntu version (10.04) and Linux Mint 13 (based on Ubuntu 11.10 I believe), so I thought I'd try it on both and see what happened. I should mention that both of these are 32-bit, and I made sure to use the relevant files in the examples! Sure enough, as mentioned in the text, pyCuda was not in the package archives of either distro, so I had to install by hand, using the link provided - http://wiki.tiker.net/PyCuda/Installation/Linux
Having had some dependency problems in the past with Lucid, I wasn't hopeful, and indeed nothing seemed to work, from either the generic installation instructions or the Lucid-specific ones, producing various errors and warnings about files not being found, although I did manage to get further down the line with Mint.
While waiting for my account here to be approved, I did some more investigation, and finally came across this info:
Following the instructions carefully, I managed to get a successful pyCuda installation on Mint 13 (with the proviso that Mint's window manager is mdm rather than lightdm of course).
What it didn't say in the text, and what isn't obvious from some articles online, is that the procedure involves downloading the *entire* CUDA toolkit from the Nvidia website, version 5 of which is over 500MB in size! I know there are older versions available which are less weighty, but if someone has managed to get pyCuda working without the toolkit I would be very interested to know, as I could not find a way.
The other problem I encountered was running the optimized C-code on p.82/3. Using the values specified in the text (and provided in the coverdisk files) the step was failing with the following:
Code: Select all
Traceback (most recent call last):
  File "triangles.py", line 53, in <module>
    block=(1000,1,1), grid=(10000,1,1))
  File "/usr/local/lib/python2.7/dist-packages/pycuda-2012.1-py2.7-linux-i686.egg/pycuda/driver.py", line 354, in function_call
pycuda._driver.LogicError: cuFuncSetBlockShape failed: invalid value

Having tweaked the block and grid parameters, I discovered that I was using a block size which was not supported by the card - the 8800GTS only has 512 blocks. The error message was somewhat cryptic, and I think the text should have mentioned the likely result of using invalid parameters on p.83.
Particularly useful would have been a method for determining the max values for your graphics card. With the full CUDA toolkit installation, there is a file deviceQuery
(usually located in ~/NVIDIA_CUDA-5.0_Samples/bin/linux/) which shows all the relevant values, but even a link to a site with the specs of various cards would have been useful.....
As this is my first post, 'apologies for length' and any other errors, and I hope someone else finds the information here useful - it took me several hours of head scratching to obtain ;-)
Posts: 1
Joined: Sat Jun 22, 2013 7:45 pm

Return to Magazine and coverdiscs

Who is online

Users browsing this forum: No registered users and 1 guest