Moved c code to a cpp file for GPU version and updated Makefile.