Fix a seg fault when ENABLE_MPI_CUDA is ON
Fix compile errors.