The problem is nothing that you are doing -- it's just that we didn't
provide a fortran binding for lam_ksignal(). :-\
Note that you'll have to do a little work to make a real fortran
binding for lam_ksignal -- there are differences in how C and Fortran
process arguments and create symbols such that you'll have to write
your own signal dispatch function in C to convert parameters and call
back into Fortran.
If you're still interested, I can explain how to do this, but it's
probably far easier to setup lam_ksignal() and your callback function
from C. E.g., write a short C file something like this:
-----
/* list all possible fortran symbol names */
void SETUP_C_HANDLER(int *sig) {
setup_c_handler_real(*sig);
}
void setup_c_handler(int *sig) {
setup_c_handler_real(*sig);
}
void setup_c_handler_(int *sig) {
setup_c_handler_real(*sig);
}
void setup_c_handler__(int *sig) {
setup_c_handler_real(*sig);
}
static void callback(void) {
/* do whatever you want to do in your callback here */
}
/* invoke lam_ksignal */
static void setup_c_handler_real(int sig) {
lam_ksignal(sig, callback);
}
------
On Jan 10, 2005, at 4:26 AM, jls wrote:
>
> Hello,
> I am trying to use lam_ksignal on an FORTRAN MPI program, but i don't
> find
> how to compile with the lam_ksignal routine.
>
> I have written a very small code in F90 (intel) but I am unable to
> compile
> it with :mpif77 -o essaif essaimpi.f90
>
> /tmp/ifortj9cGx4.o: In function `MAIN__':
> /tmp/ifortj9cGx4.o(.text+0xe7): undefined reference to `lam_ksignal_'
>
>
> I am running the 7.1.1 version of LAM MPI
>
> mpif77 -showme answer :
>
> ifort -I/usr/local/mpif77/include -pthread -L/usr/local/mpif77/lib
> -llammpio -llamf77mpi -lmpi -llam -lutil -ldl
>
> and in /usr/local/mpif77/lib,
>
> nm libmpi.a | grep -i lam_ksignal
> answer :
> 0000029c T lam_ksignal
> U lam_ksignal
> so the routine is in !!!
>
> I have written a very similar code in C and it works exaclty as I want
>
> what am I doing wrong ?
>
> Thanks in advance for helping
>
> Luc Sauvageot
>
> essai.f :
> !
> =======================================================================
> ===
> Subroutine iSig_Handler(SigNum)
> write(*,*) 'Youpie in the FORTRAN sighandler'
> return
> end Subroutine iSig_Handler
> !
> =======================================================================
> ===
> Program Z
> ! implicit none
> include 'mpif.h'
> ! MPI initialization
> call MPI_INIT(ierr)
> call MPI_COMM_RANK(MPI_COMM_WORLD,myid,ierr)
> call MPI_COMM_SIZE(MPI_COMM_WORLD,ncpu,ierr)
> write(*,'(" Working with nproc = ",I4," for ndim = ",I1)')ncpu,ndim
> call LAM_KSIGNAL(7,iSig_Handler) ;
> do i=0,10000
> write(6,*) ' in the loop...',i
> do j=0,1e7
>
> q=float(I)*float(I)*float(I)/float(j)/float(j)/float(j)/float(j)
> enddo
> enddo
>
> call MPI_FINALIZE(info)
> stop
> end Program Z
> !
> =======================================================================
> ===
>
>
>
>
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|