[WIP] fix instantiation per C++ standard

TL;DR: multiple explicit instantiation is not allowed per C++ standard 14.7.5. This PR fixes the issue by only instantiating the class in the .cpp code, and gpu-specific functions in the .cu code.

I believe this is the root cause for issues like #669. There we mentioned that gcc has issues with explicit instantiation. The cute fact is that, the "buggy" gcc is actually strictly enforcing the standard while the current working gcc versions are not enforcing it (which is also allowed by the standard).

This is a WIP and I haven't verified if it runs on ARM. Will report back, but please take a look to verify if it makes sense.

The draft of the C++ standard can be checked out here:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf