modified cuda_main