I wrote a simple program in C++ using file extension as .cu and used MPI libraries.
My program is as follows; #include #include #include
#include<unistd.h>
#include<cuda.h> #include"mpi.h"
using namespace std;
int main(int argc, char *argv)
{
int MyRank, NumberOfProcessors, Root = 0;
I am compiling with the following command
nvcc -I/usr/local/mpich2-1.0.7/include -L/usr/local/mpich2-1.0.7/lib -lmpich -DMPICH_IGNORE_CXX_SEEK --host-compilation=C++ -o Sample_Program Sample_Programm_C++.cu
And the error is
/tmp/tmpxft_00001609_00000000-11_Sample_Programm_C++.o: In function main': tmpxft_00001609_00000000-10_Sample_Programm_C++.ii:(.text+0x12f): undefined reference to MPI::Init(int&, char**&)’
tmpxft_00001609_00000000-10_Sample_Programm_C++.ii:(.text+0x134): undefined reference to MPI::COMM_WORLD' tmpxft_00001609_00000000-10_Sample_Programm_C++.ii:(.text+0x141): undefined reference to MPI::COMM_WORLD’
tmpxft_00001609_00000000-10_Sample_Programm_C++.ii:(.text+0x165): undefined reference to `MPI::Finalize()’