How to find version of CUDA

Users of CUDA usually know its major.minor version.

If you want to know the full major.minor.patch version of CUDA you are using:

$ cat /usr/local/cuda/version.txt

For example, when I tried on my CUDA 9.2 installation:

$ cat /usr/local/cuda-9.2/version.txt                                                                                                                                                                        
CUDA Version 9.2.148

Invalid version number error with Python

Problem

I tried to import a Python package that I had installed from source. The import failed with this error:

File "/usr/lib/python2.7/distutils/version.py", line 40, in __init__
  self.parse(vstring)
File "/usr/lib/python2.7/distutils/version.py", line 107, in parse
  raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '2.7.0rc3'

Solution

It turns out that package version number has to be in the x.y.z format. Else Python throws this error.

Since I had the source code of this package, I found all instances of 2.7.0rc3 and changed it to 2.7.0. Typically, this will be in the setup.py and version.py files. I removed the previously installed package and reinstalled this changed source code. I was able to import after this successfully.

Tried with: Ubuntu 14.04

How to find version of XFree86

XFree86 is an implementation of the X Window System. You may need to know which version of XFree86 is running on your computer.

Finding this is easy:

$ X -version

For information about other options:

$ X -help

The X man page does not list any of the options and is not useful for this purpose.

Tried with: X 1.17.1 and Ubuntu 14.04

Unsupported major.minor version error

Problem

I executed a Java program downloaded from the web and got this error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: net/filebot/Main : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

Solution

This error from the Java virtual machine (VM) executing the Java class file indicates that the version 52.0 is not supported by it. This is usually means that the Java program requires a newer version of Java VM for its execution.

The mysterious part is the number 52, which is much higher than any Java version we know. This is a Java class file format version number. The Java version that maps to 52 can be found from the table of class file format version to Java version mapping. For 52.0, it is Java 8. So, this error means that I need to have Java 8 VM to execute this class file. That was correct since I had Java 7 on this computer.

Major.Minor version of Java class file

A Java class file holds the Java bytecode for a Java class that can be executed on a Java virtual machine (VM). Encoded at the beginning of a class file is a major and minor version number of the class file format that is used in it. This major.minor number indicates which Java VM can execute this class file. The class file format is typically changed with a new release of Java.

The mapping from Java version to the major number is as follows:

J2SE 8 = 52
J2SE 7 = 51
J2SE 6.0 = 50
J2SE 5.0 = 49
JDK 1.4 = 48
JDK 1.3 = 47
JDK 1.2 = 46
JDK 1.1 = 45

Reference: Wikipedia page on Java class file

How to find version of Debian or Raspbian

Raspbian is based on Debian, so the distribution version information for both is stored in the same file: /etc/os-release.

Here is what I got on my Raspbian 9 (Stretch):

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Visual Studio versions

Visual Studio has a branded name with a year (like Visual Studio 2013), but also an internal version number. Visual Studio supports a C++ compiler, a C# compiler, the .Net Framework and many other internal tools. Each of these also have their own version names and numbers. Confusingly, either the year-version or version-number is used at several places in Windows.

Here is some information I note down and update as I use these software:

Visual Studio 2015

  • Visual Studio: 14
  • Visual C++ compiler: 19.0.23026.0
  • Visual C compiler: 19.0.23026.0

Visual Studio Professional 2013

  • Visual Studio: 12.0
  • Visual C++ compiler: 18.0.21005.1
  • Visual C compiler: 18.0.21005.1
  • Microsoft .Net Framework: 4.5.50938

Visual Studio Professional 2012

  • Visual Studio: 11.0
  • Visual C++ compiler: 17.00.50727.1
  • Visual C compiler: 17.00.50727.1