fix build on ubuntu 12.04
move functions depending on ostream to separate file

these should not be used from .cu code, as this makes it impossible to compile on OS X