[MPICH] C++ 64 bit problem

Rajeev Thakur thakur at mcs.anl.gov
Wed May 16 14:18:34 CDT 2007


Do you mean mpicxx? I just ran your code with mpicxx on a 64-bit machine
without any problem. Can you send us the output of the configure step when
you built MPICH2?

Rajeev 

> -----Original Message-----
> From: owner-mpich-discuss at mcs.anl.gov 
> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Andrew Hakman
> Sent: Wednesday, May 16, 2007 1:48 PM
> To: mpich-discuss at mcs.anl.gov
> Subject: [MPICH] C++ 64 bit problem
> 
> Hi
> 
> I'm trying to compile a simple test C++ MPI program using mpic++
> (which is calling g++). The machine is a 64 bit machine, but I'm not
> compiling my program with any flags to indicate 64 bit. The test
> program does not require C++, but the real code I'm working on does.
> All the test program does is call MPI_Init, MPI_Comm_rank, and
> MPI_Comm_size, then MPI_Finalize. If I compile the program with mpicc
> (gcc), it runs just fine. If I compile it with mpic++ (g++), it
> segfaults on MPI_Comm_rank. From what I have found, it seems to be a
> 64 bit pointer issue, but I'm not sure how to fix it.
> 
> Here's some output
> 
> $ mpiexec -n 1 ./HIS3DT_master
> MPI process rank 0 (n0, p6573) caught a SIGSEGV in MPI_Comm_rank.
> got to 1
> got to 1a
> Rank (0, MPI_COMM_WORLD): Call stack within LAM:
> Rank (0, MPI_COMM_WORLD):  - MPI_Comm_rank()
> Rank (0, MPI_COMM_WORLD):  - main()
> 
> And this is the code
> #include <stdio.h>
> 
> //MPI C++ workaround
> #undef SEEK_SET
> #undef SEEK_CUR
> #undef SEEK_END
> 
> //mpi
> #include <mpi.h>
> 
> int main(int argc, char **argv)
> {
>     int my_rank;
>     int com_size;
> 
>     printf("got to 1\n");
>     //start MPI
>     MPI_Init(&argc, &argv);
>     printf("got to 1a\n");
>     MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
>     printf("got to 1b\n");
>     MPI_Comm_size(MPI_COMM_WORLD, &com_size);
>     printf("got to 2\n");
>     MPI_Finalize();
>     return 0;
> }
> 
> Any help on how to fix this issue would be greatly appreciated. Just
> to re-iterate, the very same code works fine when compiled using gcc
> not g++.
> 
> Thanks
> Andrew Hakman
> 
> 




More information about the mpich-discuss mailing list