Press "Enter" to skip to content

Category: BlackBox

Help yourself exploring the mechanism of dynamics.

Hackintosh Logs: Lazy Steps & Picking-Ups

Q1: What’s wrooong with you recently?

Well, I’ve been wondering what desktop environment can meet all of my following three requirements:

  1. Programming Friendly;
  2. UI & UE Friendly;
  3. Budget Friendly.

“Do you want to train a LSTM structured prediction task while having some tea with the soup on the other screen?”

“Yes, I do. And I may have to switch to another desktop to debug if the program crashes…”

So, Let’s run a survey to narrow down the choices. Basically because I’m so lazy that I don’t know how to properly tune OS like Solaris, IBM-AIX or even Chrome OS, I believe the CUDA official website has helped me boiled them down to three alternatives: Windows, Linux and macOS.

So, from the perspective of a lazy person, I choose macOS because the CUDA related configuration is the easiest (you’ll see below) with the first two requirements met comfortably. But in fact I can’t afford a Mac Pro… and what’s more, the latest Mac Pro or other Macs use AMD graphic cards (yes, AMD…).

What about a PC with a macOS installed? That’s called a hackintosh and I guess that fits all the three requirements!

multiple experiences
multiple experiences on a Hackintosh

Q2: Is it even practical to configure a hackintosh?

Continue reading Hackintosh Logs: Lazy Steps & Picking-Ups

Theano: Playing with GPU on Ubuntu 16.04

It’s been several days since the release of Ubuntu 16.04, and since I’ve bought a new graphic card, I think it’s necessary to have some fun with it. Obviously I underestimated the difficulty of adapting the Keras with a Theano backend on the new system. It took me a day to figure out what went wrong and searching for any solution, for I am so green on the practical mechanism behind the library (I only know how to use it).

Generally, the problem I met is like:

ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -m64 -Xcompiler -DCUDA_NDARRAY_CUH=c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden -Xlinker -rpath,/home/joseph/.theano/compiledir_Linux-4.4--generic-x86_64-with-Ubuntu-16.04-xenial-x86_64-2.7.11+-64/cuda_ndarray -I/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/theano/gof -o /home/joseph/.theano/compiledir_Linux-4.4--generic-x86_64-with-Ubuntu-16.04-xenial-x86_64-2.7.11+-64/cuda_ndarray/cuda_ndarray.so mod.cu -L/usr/lib -lcublas -lpython2.7 -lcudart')
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available  (error: cuda unavailable)

when I launched theano on some tasks with GPU enabled and specified.

If you are in a hurry, click here to jump directly to the solution.

Continue reading Theano: Playing with GPU on Ubuntu 16.04

Julia: Piled-Like Matrix Multiplication on Memory-Limited GPUs Using MXNet

2D Matrix Multiplication on GPUs with Limited Memories

There was a time when I imagined feeding my big big data to the graphics cards smoothly, but Mom told me that is impossible because my data stream is much too big and the memory of  the graphics cards is limited. The memory is to a graphics card what capacity to a human brain.

But we have hard drives and CPU memories which are a lot larger than GPU memories. Using CUDA one can perform such operations like slicing matrices into different parts then calculating sub-matrices multiplications once at a time on GPU and composing the little matrices into the final result, so as to ease the burden when the matrices are too big to load on the GPU memory at a time, which is just what this article introduced.

The so-called "piling" operation in 2D matrix multiplication.
The so-called “piling” operation in 2D matrix multiplication.

Continue reading Julia: Piled-Like Matrix Multiplication on Memory-Limited GPUs Using MXNet

Julia: Solving A Package Related LoadError

I was determined to use Julia on some bigger and more interesting coding missions several days ago. While the official Package Manager seems not always satisfying, and there are some little obstacles when adding a package. Wherever the problems come from, some confusions must be resolved before the next step.

LoadError When using A Package

Yes, it’s the NeareastNeighbors.jl. Normally you just need to type

julia> Pkg.add("NearestNeighbors")

And the package will automatically be added and all the “dependencies” will be solved.

Yes, of course it did. But when you are actually using it, the problem occurred.

julia> using NearestNeighbors
WARNING: could not import Distances.eval_reduce into NearestNeighbors
WARNING: could not import Distances.eval_end into NearestNeighbors
WARNING: could not import Distances.eval_op into NearestNeighbors
WARNING: could not import Distances.eval_start into NearestNeighbors
ERROR: LoadError: LoadError: UndefVarError: UnionMetrics not defined
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 in require at ./loading.jl:243
while loading /home/joseph/.julia/v0.4/NearestNeighbors/src/evaluation.jl, in expression starting on line 11
while loading /home/joseph/.julia/v0.4/NearestNeighbors/src/NearestNeighbors.jl, in expression starting on line 33

Well, it seems there’s something wrong with the package. It said it needs the latest Distances.jl package on its site, and it suggest us to checkout the latest version of Distances.jl. It’s not new enough!

julia> Pkg.checkout("Distances")

And nothing changes. I tried again and it still failed with the same error. After some analysis and experiment I found the problem lies in the version of the Distances.jl package.

How to Make It “Right”

Continue reading Julia: Solving A Package Related LoadError