I write two codes,for simplicity, they are named “MPI.c” and “CUDA.cu” here, and a header file, “cufunction.h” including the function name in Cuda.cu. The layouts are below.
extern “C” void cufunction1()
extern “C” void cufunction2()
When I call cufunction1 in MPI main function, the host_temp1 comes right, it is equal the value of host.
But when I call cufunction 2 in MPI main function, the host_temp2 comes wrong and it is the initialized value of 0. I think the cudaMemCpy does not work in cufunction2 but there is not anything when running the program.
I hope someone could give me some tips on this one and I will be really grateful!!!