Monday, 20 July 2015

How to install OpenCL for Nvidia GPUs on Ubuntu

These instructions are for installing the Ubuntu packages that contain the necessary drivers and libraries for Nvidia and OpenCL. I prefer doing it this way over the ones provided by Nvidia because it makes installation and/or cleanup a lot easier. However, you won't end up with the latest driver and toolkit. For reference I did this with Ubuntu server release14.04 LTS and an Nvidia GTX 780.

Step 1: Get the Nvidia driver

Use the following command to have the packaged driver for your GPU listed. Use the non-updates versions.
sudo ubuntu-drivers devices
Then install the driver:
sudo apt-get install nvidia-<version here>
 It should look like this for example. Reference
sudo apt-get install nvidia-331

Step 2: Get more Nvidia driver packages

Not quite sure what the following packages are for,  but you need them for this to work. Reference
sudo apt-get install nvidia-<version here>-uvm nvidia-opencl-dev nvidia-modprobe

Step 3: Get the toolkit

Easiest step here. I know it says cuda, but it includes OpenCL libraries too:
sudo apt-get install nvidia-cuda-toolkit

getPlatformIDs returns -1001

For me this was resolved by applying step 2, but I saw people getting this error for other reasons. See here and here

Next steps

Run nvidia-smi to confirm that the driver was installed correctly. Next build and run the deviceQuery sample to ensure you can build and run OpenCL programs successfully.

Sunday, 9 November 2014

Subtitle button doesn't work in XBMC when using the re-touched skin

The button no longer works after upgrading to Gotham.

On Windows go to C:\Users\<Name>\AppData\Roaming\XBMC\addons\skin.re-touched and in the folders 16x9 and 4x3Hirez rename DialogSubtitles.xml.xml to DialogSubtitles.xml (remove the extra .xml at the end).

Source: http://forum.kodi.tv/showthread.php?tid=196110

Thursday, 7 August 2014

Chromium doesn't launch

The profile appears to be in use by another Chromium process (19846) on another computer. Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.



Run rm -f ~/.config/chromium/SingletonLock. This will delete the singleton lock for chromium. The lock was left after chromium wasn't shut down properly last time.

Saturday, 26 July 2014

SSH: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

 You get an error like this:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!       @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
[MAC Address]
Please contact your system administrator.
Add correct host key in [known_hosts folder] to get rid of this message.
Offending key in [line number in known_hosts folder]
RSA host key for [host you were trying to connect to] has changed and you have requested strict checking.
Host key verification failed.


There are two solutions (both are easy):
  1. Run ssh-keygen -R hostname. According to the man page this: "Removes all keys belonging to hostname from a known_hosts file."
  2. Manually delete the entry on the provided line number in your known_hosts folder. You can find known_hosts/ in .ssh/

For more details see here

Thursday, 8 May 2014

Sunday, 13 April 2014

Problem #6: iframe.contentDocument is null

Normally to access the contents of an iframe you've created you use iframe.contentDocument. However, sometimes it turns up null, even if there are clearly elements within the iframe. This is because of the Same-origin policy. In a nutshell, you're not allowed to access the contents of the iframe through js if it's from a different origin.

I feel that an more explicit warning would have saved me a lot of time. Although this is a fair policy, it's not always at the top of my mind while writing code.