Setup FastAI Ubuntu on Windows 10 (part 1)

GuruAtWork
6 min readApr 12, 2018

Ubuntu is available in the windows store.
in the absence of a human readable url, google.

windows store ubuntu

Install the ubuntu app, preferably use the windows store.

A bash shell will appear, giving access to ubuntu filesystem and various installed tools. setup your default user. (nominate username, password)

Once installed can close the terminal and reopen using the normal windows process to invoke a program. (make yourself a taskbar icon for example)

Check your disk capacity and spare space.

Follow the Anaconda install steps to install anaconda. I found the digitial ocean instructions easier to work with. We want the python 3.6 version.

https://www.anaconda.com/download/#linux
# or
https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-16-04
curl -O https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh#validate file is not corrupted using sha
sha256sum Anaconda3-5.0.1-Linux-x86_64.sh
bash Anaconda3-5.0.1-Linux-x86_64.sh#pick location for install etc.

after install verify

conda --version   #show conda version
source ~/.bashrc #
conda list

a search of available python versions in out anaconda reveals a large list.

conda search "^python$"

etc

http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html

We need to check if our graphics card is GPU capable and install the NVidia CUDA toolkit. From windows run window execute the device manager.

devmgmt.msc
# or
control /name Microsoft.DeviceManager

select graphics card, right click properties

Select Details panel and Hardware IDs from the dropdown box. Note these for later reference (copy/paste to text editor)

Check the Events tab

PCI\VEN_10DE&DEV_1C8D&SUBSYS_8259103C&REV_A1
PCI\VEN_10DE&DEV_1C8D&SUBSYS_8259103C
PCI\VEN_10DE&DEV_1C8D&CC_030200
PCI\VEN_10DE&DEV_1C8D&CC_0302

This tool is also useful.

https://www.techpowerup.com/gpuz/

after download, install. Use the dropdown bottom left corner to select graphics card. According to GPU-Z we have a CUDA compatible NVIDIA GeForce GTX 1050. (yay. POWER!!!).

Now check the nvidia developer page to see if our GPU is compatible.

https://developer.nvidia.com/cuda-gpus

Expanding the list we see GTX 1050 listed for desktop, not for laptop. ugh?

Now download the CUDA Toolkit

https://developer.nvidia.com/cuda-downloads
There are 3 patches available. These patches require the base installer to be installed first.
$ ls -la cuda*-rwxr-xr-x 1 bmt 197609 55311816 Apr 12 15:19 cuda_9.1.85.1_windows.exe*-rwxr-xr-x 1 bmt 197609 18061120 Apr 12 15:19 cuda_9.1.85.2_windows.exe*-rwxr-xr-x 1 bmt 197609 55971760 Apr 12 15:20 cuda_9.1.85.3_windows.exe*-rwxr-xr-x 1 bmt 197609 16243584 Apr 12 15:19 cuda_9.1.85_win10_network.exe*

verify checksums.

$ md5sum cuda*bde0af5e138c7fca1305dc2fd11d679c *cuda_9.1.85.1_windows.exe14532fd8d1c9d264e61afb21e3f25e04 *cuda_9.1.85.2_windows.exe921fbb1ca5a97cbeff8c0738037550da *cuda_9.1.85.3_windows.exeb25aff63be20ef65ff37dbcbff9e3914 *cuda_9.1.85_win10_network.execheck the checksums against values on link belowhttps://developer.download.nvidia.com/compute/cuda/9.1/Prod/docs/sidebar/md5sum-3.txt

installing cuda_9.1.85_win10_network.exe first

above windows take a few minutes to unzip & run checks.

Select express install.

This takes a few minutes.

ten minutes later….

then install
cuda_9.1.85.1_windows.exe

cuda_9.1.85.2_windows.exe

cuda_9.1.85.3_windows.exe

Similar screens as above. Each takes a few minutes to check hardware and unpack files etc.

http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/

Verify the drivers are installed correctly.

nvcc -V

The Nvidia instructions tell us this.
Sadly the compiled files are not included. Looking at nvidia chat forums, compiled files have not been included for a few years. Obviously for reasons.

CUDA Samples include sample programs in both source and compiled form. To verify a correct configuration of the hardware and software, it is highly recommended that you run the deviceQuery program located atC:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\bin\win64\ReleaseThis assumes that you used the default installation directory structure.

Some searching found the deviceQuery files here.

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\1_Utilities\deviceQuery
#useful reference for visual studio newbs.https://msdn.microsoft.com/en-us/library/5tdasz7h.aspx

opening visual studio and loading the directory. we want visual studio to build the vs2017 version of deviceQuery_vsXXXX.vcxproj ie

deviceQuery_vs2017.vcxproj

after building with visual studio and finding the .exe file generated

#in git bash shell
cd /c/ProgramData/NVIDIA Corporation/CUDA Samples/v9.1/bin/win64/Debug
./deviceQuery.exe

It’s worth keeping a screenshot of this as will reference later. Configuring CUDA in code requires knowledge of memory available etc.

Referring back to the nvidia install instructions.

The exact appearance and the output lines might be different on your system. The important outcomes are that a device was found, that the device(s) match what is installed in your system, and that the test passed.

searching for bandwidthTest I found.

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\1_Utilities\bandwidthTest

Same as before, use visual studio 2017 to build the 2017 version of bandwidthTest_vsXXXX.vcxproj

bandwidthTest_vs2017.vcxproj

VisualStudio2017 > Menu > File > Open > Project/Solution > (select bandwidthTest directory), then select ‘bandwidthTest_vs2017.vcxproj’

Menu > Build BandWidthTest

note the output directory

1>bandwidthTest_vs2017.vcxproj -> C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\1_Utilities\bandwidthTest\../../bin/win64/Debug/bandwidthTest.exe# which is really
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\bin\win64\Debug
#ins git bash shell
#from dir
#/c/ProgramData/NVIDIA Corporation/CUDA Samples/v9.1/bin/win64/Debug
./bandwidthTest.exe

again, referring to the nvidia install guide.

The device name (second line) and the bandwidth numbers vary from system to system. The important items are the second line, which confirms a CUDA device was found, and the second-to-last line, which confirms that all necessary tests passed.

Whew, that wasn’t so hard. And yes, we just installed a laptop GPU card that wasn’t on the ‘official’ supported list. YMMV. onto part two

--

--

GuruAtWork

Machine Learning, data analysis and Artificial Intelligence developer.