diff --git a/C/c_interface.c b/C/c_interface.c index 3bd4496ff..8049d5ff6 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -653,6 +653,11 @@ YapInit(yap_init_args *yap_init) yap_init->DelayedReleaseLoad ); InitYaamRegs(); + +#if HAVE_MPI + InitMPI (); +#endif + if (yap_init->YapPrologBootFile != NULL) { /* This must be done before restore, otherwise diff --git a/H/Yapproto.h b/H/Yapproto.h index 76a4e012a..1db59f501 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -10,7 +10,7 @@ * File: Yap.proto * * mods: * * comments: Function declarations for YAP * -* version: $Id: Yapproto.h,v 1.9 2002-02-04 16:12:54 vsc Exp $ * +* version: $Id: Yapproto.h,v 1.10 2002-02-11 20:46:41 stasinos Exp $ * *************************************************************************/ /* prototype file for Yap */ @@ -210,6 +210,11 @@ Term STD_PROTO(NewEmptyTimedVar,(void)); Term STD_PROTO(ReadTimedVar,(Term)); Term STD_PROTO(UpdateTimedVar,(Term, Term)); +#if HAVE_MPI +/* mpi.c */ +void STD_PROTO(InitMPI,(void)); +#endif + /* parser.c */ int STD_PROTO(IsPrefixOp,(Prop,int *,int *)); int STD_PROTO(IsInfixOp,(Prop,int *,int *,int *)); diff --git a/Makefile.in b/Makefile.in index 5b4e5bb65..553f37242 100644 --- a/Makefile.in +++ b/Makefile.in @@ -65,7 +65,7 @@ C_PARSER_FLAGS= @C_PARSER_FLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS) CPP=@CPP@ DEFS=@DEFS@ LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ +LDFLAGS=-Wl,-E @LDFLAGS@ LN_S=@LN_S@ M4=@M4@ GCC=@GCC@ @@ -145,7 +145,8 @@ C_SOURCES= \ $(srcdir)/OPTYap/opt.preds.c $(srcdir)/OPTYap/or.engine.c \ $(srcdir)/OPTYap/or.cowengine.c $(srcdir)/OPTYap/or.sbaengine.c \ $(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \ - $(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.suspend.c + $(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.suspend.c \ + $(srcdir)/library/mpi/mpi.c PL_SOURCES= \ $(srcdir)/pl/arith.yap $(srcdir)/pl/arrays.yap $(srcdir)/pl/boot.yap \ @@ -169,7 +170,7 @@ ENGINE_OBJECTS = \ cdmgr.o cmppreds.o compiler.o computils.o \ corout.o dbase.o errors.o eval.o bignum.o \ exec.o grow.o heapgc.o index.o init.o \ - iopreds.o depth_bound.o mavar.o modules.o other.o \ + iopreds.o depth_bound.o mavar.o modules.o mpi.o other.o \ parser.o save.o scanner.o sort.o stdpreds.o sysbits.o tracer.o \ unify.o userpreds.o utilpreds.o write.o ypsocks.o ypstdio.o @@ -430,6 +431,9 @@ tab.tries.o: $(srcdir)/OPTYap/tab.tries.c tab.suspend.o: $(srcdir)/OPTYap/tab.suspend.c $(CC) -c $(CFLAGS) $(srcdir)/OPTYap/tab.suspend.c -o $@ +mpi.o: $(srcdir)/library/mpi/mpi.c + $(CC) -c $(CFLAGS) $(srcdir)/library/mpi/mpi.c -o $@ + ## CPP'ed files (for macro debugging) diff --git a/config.h.in b/config.h.in index bed177372..37c28a69c 100644 --- a/config.h.in +++ b/config.h.in @@ -11,6 +11,16 @@ /* Should we use gmp ? */ #undef HAVE_LIBGMP +/* What MPI libraries are there? */ +#undef HAVE_LIBMPICH + +/* Should we use MPI ? */ +#if HAVE_LIBMPICH + #define HAVE_MPI 1 +#else + #define HAVE_MPI 0 +#endif + /* does the compiler support inline ? */ #undef inline diff --git a/configure.in b/configure.in index 11b2737ff..498cb7dae 100644 --- a/configure.in +++ b/configure.in @@ -69,6 +69,19 @@ AC_ARG_WITH(readline, fi, [yap_cv_readline=yes]) +AC_ARG_WITH(mpich, + [ --with-mpich[=DIR] use MPICH library in DIR], + if test $withval = yes; then + yap_cv_mpich=yes + elif test $withval = no; then + yap_cv_mpich=no + else + yap_cv_mpich=$with_mpich + LDFLAGS="$LDFLAGS -L${yap_cv_mpich}/lib" + CPPFLAGS="$CPPFLAGS -I${yap_cv_mpich}/include" + fi, + [yap_cv_mpich=yes]) + AC_ARG_WITH(heap-space, [ --with-heap-space[=space] default heap size in Kbytes], if test $withval = yes; then @@ -191,6 +204,7 @@ else CFLAGS="-Ae +O3 +Onolimit" fi fi +dnl LDFLAGS="+e UserCPredicate $LDFLAGS" ;; esac fi @@ -248,6 +262,14 @@ if test "$yap_cv_gmp" != "no" then AC_CHECK_LIB(gmp,main) fi +if test "$yap_cv_mpich" != "no" +then + AC_CHECK_LIB(mpich,MPI_Init) + if test "$ac_cv_lib_mpich_MPI_Init" = yes + then + LIBS="$LIBS -lpmpich" + fi +fi AC_PROG_CPP