Open MPI with c++ kubuntu
Hello.
I am a newbie and i am having problems with Open MPI.
My apt-get cannot install the openmpi listed with apt-cache so i installed a downloaded version from openmpi.org .
I managed to compile with mpiCC and a simple hello world like program crashes with sigsegv when i execute it.
Here is what i have at the moment. Please help me for I am due to finish a homework using MPI in a few days and I feel lost already !
The source file:
#include <stdio.h>
#include <mpi.h>
int main(int argc, char *argv[]) {
int numprocs, rank, namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
printf("unu\n");
MPI_Init(&argc, &argv);
printf("doi\n");
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(processor_name, &namelen);
printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);
MPI_Finalize();
}
From gdb debugging:
[...]
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) start
Breakpoint 1 at 0x804f666: file mpitut.cpp, line 4.
Starting program: /home/mihai/junk/C/mpitut
[Thread debugging using libthread_db enabled]
[New Thread -1213872432 (LWP 8593)]
[Switching to Thread -1213872432 (LWP 8593)]
main (argc=1, argv=0xbfbddbb4) at mpitut.cpp:4
4 int main(int argc, char *argv[]) {
(gdb) break main
Breakpoint 2 at 0x804f666: file mpitut.cpp, line 4.
(gdb) step
7 printf("unu\n");
(gdb) step
unu
8 MPI_Init(&argc, &argv);
(gdb) ni
0x0804f683 8 MPI_Init(&argc, &argv);
(gdb) ni
0x0804f687 8 MPI_Init(&argc, &argv);
(gdb) ni
0x0804f68a 8 MPI_Init(&argc, &argv);
(gdb) ni
Program received signal SIGSEGV, Segmentation fault.
0x006f732e in ?? ()
(gdb) step
Cannot find bounds of current function
(gdb) ni
0xb7d20a80 in opal_show_stackframe () from /usr/lib/libopen-pal.so.0
[...]
|