misc

Microscope images of my eye (by request)

More microscope image of eyes were requested (by Benjie), trying to focus more on the detail of the eye by using external illumination. Unfortunately the camera has some colour problems when not using the built in LEDs, possibly because it attempts compensates for the lack of illumination. Hopefully I am not in danger of someone cloning my retinal scan to gain access to my confidential files.

Black and white microscope image of my eye

Black and white microscope image of my eye

Clear reflection of my laptop in a black and white microscope image of my eye

Clear reflection of my laptop in a black and white microscope image of my eye

Coloured illuminated microscope image of my eye

Coloured illuminated microscope image of my eye

Coloured illuminated microscope image of my eye (see the blood vessels)

Coloured illuminated microscope image of my eye (see the blood vessels)

Read More

Compiling and running CUDA 2.3 SDK and toolkit on ubuntu 9.10 x64 (64-bit)

I’ve heard a lot about CUDA, such as how it is 10,000% faster at cracking wireless passwords over a conventional program/hardware, but never really got around to testing it out before now. This post details the steps required to compile and setup CUDA 2.3 SDK and toolkit on ubuntu 9.10.

Downloads
You are required to have an Nvidia graphics driver (relatively new version) already installed. First download the CUDA toolkit and CUDA sdk from the Nvidia CUDA 2.3 download page.

Install the toolkit

# Make file executable
chmod +x cudatoolkit_2.3_linux_64_ubuntu9.04.run
# Run it as superuser
sudo ./cudatoolkit_2.3_linux_64_ubuntu9.04.run

You now need to edit your .bashrc file in your home directory to include the paths (so your CUDA binaries can be found by the system)

export PATH=${PATH}:/usr/local/cuda/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64

Note if you are using 32bit then “lib64” should be replaced with just “lib”

Install the SDK

# Make file executable
chmod +x cudasdk_2.3_linux.run
# Run it as normal user
./cudasdk_2.3_linux.run

You should now have a NVIDIA_GPU_Computing_SDK folder in your home directory. Change directory into the C folder inside this one.

cd NVIDIA_GPU_Computing_SDK/C

In this folder is a make file which will compile all the Nvidia SDK and all the demos, in order for this to work in ubuntu 9.10 (x64) you will need to install several dependencies. By installing these before attempting to make will save you a lot of time, if you are getting errors please scroll down to the problems section to see if they are already covered.

# Install the necessary libraries
sudo apt-get install freeglut3 freeglut3-dev libx11-dev mesa-common-dev libxmu6

Making and running demos

You can then run the make command, once this is ran all of the executables will be placed in NVIDIA_GPU_Computing_SDK/C/bin/linux/released . We can check that our computer has an useable CUDA device install by running the deviceQuery program:

cd ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/released
./deviceQuery

This should output something similar to the following:

# ./deviceQuery
CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA

Device 0: "GeForce GTX 260"
  CUDA Driver Version:                           2.30
  CUDA Runtime Version:                          2.30
  CUDA Capability Major revision number:         1
  CUDA Capability Minor revision number:         3
  Total amount of global memory:                 938803200 bytes
  Number of multiprocessors:                     27
  Number of cores:                               216
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 16384
  Warp size:                                     32
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          262144 bytes
  Texture alignment:                             256 bytes
  Clock rate:                                    1.47 GHz
  Concurrent copy and execution:                 Yes
  Run time limit on kernels:                     Yes
  Integrated:                                    No
  Support host page-locked memory mapping:       Yes
  Compute mode:                                  Default (multiple host threads can use this device simultaneously)

Test PASSED

Now that we can see CUDA is successfully installed and a suitable device is found we can run some of nvidia’s more ascetically pleasing demos:

./fluidsGL
CUDA SDK example fluidsGL on ubuntu 9.10 x64

CUDA SDK example fluidsGL on ubuntu 9.10 x64

./smokeParticles
CUDA SDK example smokeparticles on ubuntu 9.10 x64

CUDA SDK example smokeparticles on ubuntu 9.10 x64

./particles
CUDA SDK example particles on ubuntu 9.10 x64

CUDA SDK example particles on ubuntu 9.10 x64

./postProcessGL
CUDA SDK example postProcessGL on ubuntu 9.10 x64 (teapot)

CUDA SDK example postProcessGL on ubuntu 9.10 x64 (teapot)

Problems

libxi (Nvidia forum link)

make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common'
make[1]: Entering directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common'
In file included from ./../common/inc/paramgl.h:24,
                 from src/paramgl.cpp:19:
./../common/inc/GL/glut.h:60:20: error: GL/glu.h: No such file or directory
make[1]: *** [obj/release/paramgl.cpp.o] Error 1
make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common'
make: *** [lib/libparamgl.so] Error 2
sudo apt-get install freeglut3 freeglut3-dev libx11-dev mesa-common-dev
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathinline.h:36: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathinline.h:42: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathinline.h:48: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:442: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
make[1]: *** [obj/release/particleSystem.cu.o] Error 255
make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/src/particles'
make: *** [src/particles/Makefile.ph_build] Error 2

The problem is due to having gcc 4.4 installed rather than 4.3, it is possible to install the older version of this compiler but it is simpler to modify common/common.mk and add the following extra flag (Nvidia forum link):

# Change:
NVCCFLAGS += --compiler-options -fno-strict-aliasing
# To:
NVCCFLAGS += --compiler-options -fno-strict-aliasing --compiler-options -fno-inline

and change the -O2

# Change:
COMMONFLAGS += -O2
# To: 
COMMONFLAGS += -O0

The two remaining errors you may encounter are very similar and arrise from missing libraries:

libxi (Nvidia forum link)

/usr/bin/ld: cannot find -lXi
collect2: ld returned 1 exit status
make[1]: *** [../../bin/linux/release/particles] Error 1
sudo apt-get install libxi-dev

libxmu (Nvidia forum link)

/usr/bin/ld: cannot find -lXmu
collect2: ld returned 1 exit status
make[1]: *** [../../bin/linux/release/particles] Error 1
sudo apt-get install libxmu-dev libxmu6
Read More

Streaming media from Linux to PS3

I wanted to watch some of the videos that I have on my computer on my playstation 3, so that lead me to search for media server applications. I found out that you could set this up quite easily from within Windows Media Player, however as a linux user I knew there was probably a much better linux based solution available.

After a few minutes of googling, I found a program called Mediatomb. It is avaliable at mediatomb.cc

mediatomb is in the ubuntu repositories, so all that is needed to install it is:

sudo apt-get install mediatomb

All you need to do once it is setup is to open up the config file located at ~/.mediatomb/config.xml
and to add the following below the <server> line

<server>
<protocolInfo extend=”yes”/>

then in the mappings section, add any file formats that you want to be forwarded. In this example .avi and .divx files have been added

<mappings>
<extension-mimetype ignore-unknown=”no”>
<map from=”avi” to=”video/x-divx”/>
<map from=”divx” to=”video/x-divx”/>

Once this is all done, you can run mediatomb, and it will give you an output like the following:

MediaTomb UPnP Server version 0.11.0 – https://mediatomb.cc/

===============================================================================
Copyright 2005-2008 Gena Batsyan, Sergey Bostandzhyan, Leonhard Wimmer.
MediaTomb is free software, covered by the GNU General Public License version 2

2008-08-13 23:46:19 INFO: Loading configuration from: /home/mat/.mediatomb/config.xml
2008-08-13 23:46:19 INFO: Checking configuration…
2008-08-13 23:46:19 INFO: Setting filesystem import charset to UTF-8
2008-08-13 23:46:19 INFO: Setting metadata import charset to UTF-8
2008-08-13 23:46:19 INFO: Setting playlist charset to UTF-8
2008-08-13 23:46:19 INFO: Configuration check succeeded.
2008-08-13 23:46:19 INFO: Initialized port: 49152
2008-08-13 23:46:19 INFO: Server bound to: 192.168.0.4
2008-08-13 23:46:20 INFO: MediaTomb Web UI can be reached by following this link:
2008-08-13 23:46:20 INFO: https://192.168.0.4:49152/

The last line shows the information of use, using the ip address you can login to the web interface for the mediatomb server, from there you can add the folders you wish to be shared.

Then on the PS3 or whatever device you are using, you should be able to access the files that you have shared. My PS3 automatically found the server but also had the option to scan for media servers. The only problem with the playstation is that it will refuse to play some files, but most of the videos I tried worked.

Conclusion: Pretty dam cool

The following link is a slightly better guide, than my brief overview https://www.freesoftwaremagazine.com/columns/upnp_mediatomb_ps3_and_me
P.S. Media tomb also shares images and music files etc… forgot to mention it.

Read More