Nearly working cuda example