LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Qiang Xu (Qiang.Xu_at_[hidden])
Date: 2005-12-12 21:20:37


Hi, here is a response for 2005-12-05 mail. (Jeff and Anthony)

In that email ( link profiling lib with NAS bechmark (Fortran)" ), I mentioned the linking problem.
Actually, it is running in MPICH. Following is what happened in MPICH
===============================================================================================
I write a profiling lib (libmyprof.a)with PMPI, and use it to profile the NAS bechmark (NPB2.3).
For IS which is in C, everything works fine. Just recompile it with -lmyprof, and I could get the profile.
But for other bechmarks, which is in Fortran. I could not link with my profiling lib (libmyprof.a) even I
use the -lmyprof option during compilation.
And I figure out two methods to make it work.
1. Just write a dummy function in my libmyprof.a say
int sample
{
   return 0
} and write a "interface" fortan file which just call this function. then compile this "interface" fortran file with those fortran bechmark.
This time my profiling lib is linked with the bechmarks.
2. It is the problem of fortran call c function, because PMPI is written in C.
So I just write a "interface" file in C, someone say I need to wrap all the function in the profiling lib this way, but seems to me one function
the MPI_init_ is good enough.

int MPI_Init_( argc, argv )
int * argc;
char *** argv;
{
  MPI_Init(argc, argv);
}
My question is that those method seems a little bit awkward, anyone could give me a decent solution?
=================================================================================

After got the email from Jeff and Anthony, I think LAM may work. But after install LAM-7.1.1, the profiling lib will not work even for IS.

m is just a matrix program in fortran.
[qiang_lam_at_compute-0-1 mympiProftest]$ mpif77 -o m m.o
[qiang_lam_at_compute-0-1 mympiProftest]$ mpirun -np 4 ./m
 The matrix is:
       0 0 0
       0 0 0
       0 0 0
 Sending it out
 waiting to receive...
 Recombining data...
       1 2 3
       2 4 6
       3 6 9

W.O profiling library it works.

[qiang_lam_at_compute-0-1 mympiProftest]$ mpicc -c testProf.c
[qiang_lam_at_compute-0-1 mympiProftest]$ ar -rc ~/lam-7.1.1/lib/libmyprof.a testProf.o
[qiang_lam_at_compute-0-1 mympiProftest]$ mpif77 -o m m.o b.o -L ~/lam-7.1.1/lib/ -llamf77mpi -lmyprof
[qiang_lam_at_compute-0-1 mympiProftest]$ mpirun -np 2 m

LAM_MPI_Fortran_program#
 breakpoint1

LAM_MPI_Fortran_program#
 breakpoint1
-----------------------------------------------------------------------------
One of the processes started by mpirun has exited with a nonzero exit
code. This typically indicates that the process finished in error.
If your process did not finish in error, be sure to include a "return
0" or "exit(0)" in your C code before exiting the application.

PID 28533 failed on node n0 (192.168.1.253) due to signal 11.
-----------------------------------------------------------------------------

But after link with the profiling lib, which works fine with MPICH, did not work with LAM.

And the MPI_Init( ) in the profiling lib is as following
int MPI_Init( argc, argv )
int * argc;
char *** argv;
{ .......
 printf("\n");
 for (i=0;i<(*argc);i++)
 {printf("%s#",(*argv)[i]);}

 startTick=times(NULL);
 printf("\n breakpoint1 \n");
 returnVal = PMPI_Init( argc, argv );
 printf("\n breakpoint2 \n");
 stopTick=times(NULL);
..........
}

PMPI_Init(argc, argv) is the problem, why? And why argv[ ] only contain one element "LAM_MPI_Fortran_program"?

Thanks.

Qiang