Skip to content

Instantly share code, notes, and snippets.

@lambdaprime
Last active April 15, 2019 04:48
Show Gist options
  • Save lambdaprime/902fc94d21c43124d9de072ed7844b93 to your computer and use it in GitHub Desktop.
Save lambdaprime/902fc94d21c43124d9de072ed7844b93 to your computer and use it in GitHub Desktop.
How to run MXNET on GPU NVidia Fermi with Compute capability 2.1

How to run MXNET on GPU NVidia Fermi with Compute capability 2.1

MXNET dropped support of old GPU cards. The oldest version 0.11.0 available from here will not work on Fermi because it requires __shfl_xor and other instructions which became available only with next version of GPU arch. The only version of MXNET which I managed to run is v0.9.5 with following 3rdparty dependencies:

  • mshadow - commit ce8422ba98fca3b41d0d33b930995a6d54ded0ff
  • nnvm - commit b279286304ac954098d94a2695bca599e832effb

Prereq

  • cuda_8.0.61_375.26_linux.run
  • cuda_8.0.61.2_linux.run
  • gcc4.8
  • c++-4.8
  • openblas-dev
  • python3-pip

Set CUDA to use compilers of version 4.8:

sudo ln -s /usr/bin/g++-4.8 /media/x/cuda-80/bin/g++
sudo ln -s /usr/bin/gcc-4.8 /media/x/cuda-80/bin/gcc

Build

CC=gcc-4.8 CXX=g++-4.8 CUDACXX=/media/x/cuda-80/bin/nvcc cmake -DBLAS=open -DUSE_CUDA=1  -DUSE_CUDNN=0 -DCUDA_TOOLKIT_ROOT_DIR=/media/x/cuda-80 -DCUDA_NVCC_FLAGS=-DMSHADOW_OLD_CUDA=1  .

make -j4 VERBOSE=1

Install

sudo rm /usr/lib/python3/dist-packages/mxnet
sudo ln -s /media/x/apache-mxnet-0.9.5-incubating/python/mxnet /usr/lib/python3/dist-packages/mxnet

Verify

PATH=$PATH:/media/x/cuda-80/bin LD_LIBRARY_PATH=/media/x/cuda-80/lib64:/media/x/apache-mxnet-0.9.5-incubating python3

Then type:

import mxnet as mx
a = mx.nd.ones((2, 3), mx.gpu())

Run LeNet:

PATH=$PATH:/media/x/cuda-80/bin LD_LIBRARY_PATH=/media/x/cuda-80/lib64:/media/x/apache-mxnet-0.9.5-incubating python3 example/image-classification/train_mnist.py --network lenet --gpus 0
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment