diff --git a/qse/Makefile.in b/qse/Makefile.in index 2c61ba3b..4272a00f 100644 --- a/qse/Makefile.in +++ b/qse/Makefile.in @@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -155,6 +155,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/aclocal.m4 b/qse/aclocal.m4 index b32fd361..98d26f9a 100644 --- a/qse/aclocal.m4 +++ b/qse/aclocal.m4 @@ -956,3 +956,4 @@ m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) +m4_include([m4/lx_find_mpi.m4]) diff --git a/qse/cmd/Makefile.in b/qse/cmd/Makefile.in index 7b59f1f0..c52371e0 100644 --- a/qse/cmd/Makefile.in +++ b/qse/cmd/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -140,6 +140,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/cmd/awk/Makefile.am b/qse/cmd/awk/Makefile.am index baa2f42c..293b553a 100644 --- a/qse/cmd/awk/Makefile.am +++ b/qse/cmd/awk/Makefile.am @@ -5,6 +5,8 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(includedir) +#####################################################################3 + bin_PROGRAMS = qseawk qseawk_SOURCES = awk.c @@ -14,3 +16,19 @@ qseawk_LDADD = -lqseawk -lqsecmn $(LIBM) if WIN32 qseawk_LDADD += $(UNICOWS_LIBS) endif + +#####################################################################3 + +if HAVE_C_MPI +bin_PROGRAMS += qseawkp + +qseawkp_SOURCES = mpi.c +qseawkp_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS) +qseawkp_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir) $(MPI_CLDFLAGS) +qseawkp_LDADD = -lqseawkp -lqseawk -lqsecmn $(LIBM) + +if WIN32 +qseawkp_LDADD += $(UNICOWS_LIBS) +endif + +endif diff --git a/qse/cmd/awk/Makefile.in b/qse/cmd/awk/Makefile.in index d48772b0..079a119c 100644 --- a/qse/cmd/awk/Makefile.in +++ b/qse/cmd/awk/Makefile.in @@ -34,8 +34,12 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -bin_PROGRAMS = qseawk$(EXEEXT) +bin_PROGRAMS = qseawk$(EXEEXT) $(am__EXEEXT_1) @WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS) + +#####################################################################3 +@HAVE_C_MPI_TRUE@am__append_2 = qseawkp +@HAVE_C_MPI_TRUE@@WIN32_TRUE@am__append_3 = $(UNICOWS_LIBS) subdir = cmd/awk DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -43,13 +47,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/qse/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +@HAVE_C_MPI_TRUE@am__EXEEXT_1 = qseawkp$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_qseawk_OBJECTS = awk.$(OBJEXT) @@ -60,6 +65,16 @@ qseawk_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) qseawk_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(qseawk_LDFLAGS) \ $(LDFLAGS) -o $@ +am__qseawkp_SOURCES_DIST = mpi.c +@HAVE_C_MPI_TRUE@am_qseawkp_OBJECTS = qseawkp-mpi.$(OBJEXT) +qseawkp_OBJECTS = $(am_qseawkp_OBJECTS) +@HAVE_C_MPI_TRUE@@WIN32_TRUE@am__DEPENDENCIES_3 = \ +@HAVE_C_MPI_TRUE@@WIN32_TRUE@ $(am__DEPENDENCIES_1) +@HAVE_C_MPI_TRUE@qseawkp_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@HAVE_C_MPI_TRUE@ $(am__DEPENDENCIES_3) +qseawkp_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(qseawkp_LDFLAGS) \ + $(LDFLAGS) -o $@ DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/ac/depcomp am__depfiles_maybe = depfiles @@ -73,8 +88,8 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(qseawk_SOURCES) -DIST_SOURCES = $(qseawk_SOURCES) +SOURCES = $(qseawk_SOURCES) $(qseawkp_SOURCES) +DIST_SOURCES = $(qseawk_SOURCES) $(am__qseawkp_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -129,6 +144,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -233,6 +251,11 @@ AM_CPPFLAGS = \ qseawk_SOURCES = awk.c qseawk_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir) qseawk_LDADD = -lqseawk -lqsecmn $(LIBM) $(am__append_1) +@HAVE_C_MPI_TRUE@qseawkp_SOURCES = mpi.c +@HAVE_C_MPI_TRUE@qseawkp_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS) +@HAVE_C_MPI_TRUE@qseawkp_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir) $(MPI_CLDFLAGS) +@HAVE_C_MPI_TRUE@qseawkp_LDADD = -lqseawkp -lqseawk -lqsecmn $(LIBM) \ +@HAVE_C_MPI_TRUE@ $(am__append_3) all: all-am .SUFFIXES: @@ -313,6 +336,9 @@ clean-binPROGRAMS: qseawk$(EXEEXT): $(qseawk_OBJECTS) $(qseawk_DEPENDENCIES) @rm -f qseawk$(EXEEXT) $(qseawk_LINK) $(qseawk_OBJECTS) $(qseawk_LDADD) $(LIBS) +qseawkp$(EXEEXT): $(qseawkp_OBJECTS) $(qseawkp_DEPENDENCIES) + @rm -f qseawkp$(EXEEXT) + $(qseawkp_LINK) $(qseawkp_OBJECTS) $(qseawkp_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -321,6 +347,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qseawkp-mpi.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -343,6 +370,20 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +qseawkp-mpi.o: mpi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(qseawkp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT qseawkp-mpi.o -MD -MP -MF $(DEPDIR)/qseawkp-mpi.Tpo -c -o qseawkp-mpi.o `test -f 'mpi.c' || echo '$(srcdir)/'`mpi.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/qseawkp-mpi.Tpo $(DEPDIR)/qseawkp-mpi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpi.c' object='qseawkp-mpi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(qseawkp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o qseawkp-mpi.o `test -f 'mpi.c' || echo '$(srcdir)/'`mpi.c + +qseawkp-mpi.obj: mpi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(qseawkp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT qseawkp-mpi.obj -MD -MP -MF $(DEPDIR)/qseawkp-mpi.Tpo -c -o qseawkp-mpi.obj `if test -f 'mpi.c'; then $(CYGPATH_W) 'mpi.c'; else $(CYGPATH_W) '$(srcdir)/mpi.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/qseawkp-mpi.Tpo $(DEPDIR)/qseawkp-mpi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpi.c' object='qseawkp-mpi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(qseawkp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o qseawkp-mpi.obj `if test -f 'mpi.c'; then $(CYGPATH_W) 'mpi.c'; else $(CYGPATH_W) '$(srcdir)/mpi.c'; fi` + mostlyclean-libtool: -rm -f *.lo diff --git a/qse/cmd/awk/awk.c b/qse/cmd/awk/awk.c index 0ebecb98..b36e573a 100644 --- a/qse/cmd/awk/awk.c +++ b/qse/cmd/awk/awk.c @@ -55,6 +55,10 @@ # include #endif +#if defined(ENABLE_MPI) +# include +#endif + static qse_awk_rtx_t* app_rtx = QSE_NULL; static int app_debug = 0; @@ -206,6 +210,7 @@ static void set_intr_run (void) #else /*setsignal (SIGINT, stop_run, 1); TO BE MORE COMPATIBLE WITH WIN32*/ setsignal (SIGINT, stop_run, 0); + setsignal (SIGPIPE, SIG_IGN, 0); #endif } @@ -221,6 +226,7 @@ static void unset_intr_run (void) setsignal (SIGINT, SIG_DFL); #else setsignal (SIGINT, SIG_DFL, 1); + setsignal (SIGPIPE, SIG_DFL, 0); #endif } @@ -1095,8 +1101,16 @@ int qse_main (int argc, qse_achar_t* argv[]) qse_setdflcmgr (qse_slmbcmgr); #endif +#if defined(ENABLE_MPI) + MPI_Init (&argc, &argv); +#endif + ret = qse_runmain (argc, argv, awk_main); +#if defined(ENABLE_MPI) + MPI_Finalize (); +#endif + #if defined(_WIN32) WSACleanup (); #endif diff --git a/qse/cmd/awk/mpi.c b/qse/cmd/awk/mpi.c new file mode 100644 index 00000000..253a73d1 --- /dev/null +++ b/qse/cmd/awk/mpi.c @@ -0,0 +1,14 @@ + + +#define ENABLE_MPI + +#define qse_awk_openstd qse_awk_openmpi +#define qse_awk_openstdwithmmgr qse_awk_openmpiwithmmgr +#define qse_awk_getxtnstd qse_awk_getxtnmpi +#define qse_awk_parsestd qse_awk_parsempi +#define qse_awk_rtx_openstd qse_awk_rtx_openmpi +#define qse_awk_rtx_getxtnstd qse_awk_rtx_getxtnmpi +#define qse_awk_rtx_getcmgrstd qse_awk_rtx_getcmgrmpi + +#include "awk.c" + diff --git a/qse/cmd/cut/Makefile.in b/qse/cmd/cut/Makefile.in index 74915157..0f1f64bc 100644 --- a/qse/cmd/cut/Makefile.in +++ b/qse/cmd/cut/Makefile.in @@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -129,6 +129,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/cmd/sed/Makefile.in b/qse/cmd/sed/Makefile.in index 0eb6462a..59c055a4 100644 --- a/qse/cmd/sed/Makefile.in +++ b/qse/cmd/sed/Makefile.in @@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -129,6 +129,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/cmd/stx/Makefile.in b/qse/cmd/stx/Makefile.in index 6d39763f..a424e624 100644 --- a/qse/cmd/stx/Makefile.in +++ b/qse/cmd/stx/Makefile.in @@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -129,6 +129,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/configure b/qse/configure index f76f6abc..ec7330d4 100755 --- a/qse/configure +++ b/qse/configure @@ -635,6 +635,11 @@ ENABLE_CXX_FALSE ENABLE_CXX_TRUE BUILD_MODE CHAR_MODE +HAVE_C_MPI_FALSE +HAVE_C_MPI_TRUE +MPI_CLDFLAGS +MPI_CFLAGS +MPICC UNICOWS_LIBS SENDFILE_LIBS SOCKET_LIBS @@ -16665,6 +16670,317 @@ fi + + + + if [ ! -z "$MPICC" ]; then + + # Try to find a working MPI compiler from the supplied names + for ac_prog in $MPICC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MPICC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MPICC in + [\\/]* | ?:[\\/]*) + ac_cv_path_MPICC="$MPICC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_MPICC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +MPICC=$ac_cv_path_MPICC +if test -n "$MPICC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5 +$as_echo "$MPICC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$MPICC" && break +done +test -n "$MPICC" || MPICC="not-found" + + + # Figure out what the compiler responds to to get it to show us the compile + # and link lines. After this part of the macro, we'll have a valid + # lx_mpi_command_line + echo -n "Checking whether $MPICC responds to '-showme:compile'... " + lx_mpi_compile_line=`$MPICC -showme:compile 2>/dev/null` + if [ "$?" -eq 0 ]; then + echo yes + lx_mpi_link_line=`$MPICC -showme:link 2>/dev/null` + else + echo no + echo -n "Checking whether $MPICC responds to '-showme'... " + lx_mpi_command_line=`$MPICC -showme 2>/dev/null` + if [ "$?" -ne 0 ]; then + echo no + echo -n "Checking whether $MPICC responds to '-compile-info'... " + lx_mpi_compile_line=`$MPICC -compile-info 2>/dev/null` + if [ "$?" -eq 0 ]; then + echo yes + lx_mpi_link_line=`$MPICC -link-info 2>/dev/null` + else + echo no + echo -n "Checking whether $MPICC responds to '-show'... " + lx_mpi_command_line=`$MPICC -show 2>/dev/null` + if [ "$?" -eq 0 ]; then + echo yes + else + echo no + fi + fi + else + echo yes + fi + fi + + if [ ! -z "$lx_mpi_compile_line" -a ! -z "$lx_mpi_link_line" ]; then + lx_mpi_command_line="$lx_mpi_compile_line $lx_mpi_link_line" + fi + + if [ ! -z "$lx_mpi_command_line" ]; then + # Now extract the different parts of the MPI command line. Do these separately in case we need to + # parse them all out in future versions of this macro. + lx_mpi_defines=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-D\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_includes=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-I\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_link_paths=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-L\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_libs=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-l\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_link_args=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-Wl,\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + + # Create variables and clean up newlines and multiple spaces + MPI_CFLAGS="$lx_mpi_defines $lx_mpi_includes" + MPI_CLDFLAGS="$lx_mpi_link_paths $lx_mpi_libs $lx_mpi_link_args" + MPI_CFLAGS=` echo "$MPI_CFLAGS" | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//' | sed 's/ +/ /g'` + MPI_CLDFLAGS=`echo "$MPI_CLDFLAGS" | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//' | sed 's/ +/ /g'` + + OLD_CPPFLAGS=$CPPFLAGS + OLD_LIBS=$LIBS + CPPFLAGS=$MPI_CFLAGS + LIBS=$MPI_CLDFLAGS + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int rank, size; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + # Add a define for testing at compile time. + +$as_echo "#define HAVE_MPI 1" >>confdefs.h + + have_C_mpi='yes' +else + # zero out mpi flags so we don't link against the faulty library. + MPI_CFLAGS="" + MPI_CLDFLAGS="" + have_C_mpi='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + # AC_SUBST everything. + + + + + LIBS=$OLD_LIBS + CPPFLAGS=$OLD_CPPFLAGS + else + Echo Unable to find suitable MPI Compiler. Try setting MPICC. + have_C_mpi='no' + fi + + else + + # Try to find a working MPI compiler from the supplied names + for ac_prog in mpicc mpiicc mpixlc mpipgcc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MPICC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MPICC in + [\\/]* | ?:[\\/]*) + ac_cv_path_MPICC="$MPICC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_MPICC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +MPICC=$ac_cv_path_MPICC +if test -n "$MPICC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5 +$as_echo "$MPICC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$MPICC" && break +done +test -n "$MPICC" || MPICC="not-found" + + + # Figure out what the compiler responds to to get it to show us the compile + # and link lines. After this part of the macro, we'll have a valid + # lx_mpi_command_line + echo -n "Checking whether $MPICC responds to '-showme:compile'... " + lx_mpi_compile_line=`$MPICC -showme:compile 2>/dev/null` + if [ "$?" -eq 0 ]; then + echo yes + lx_mpi_link_line=`$MPICC -showme:link 2>/dev/null` + else + echo no + echo -n "Checking whether $MPICC responds to '-showme'... " + lx_mpi_command_line=`$MPICC -showme 2>/dev/null` + if [ "$?" -ne 0 ]; then + echo no + echo -n "Checking whether $MPICC responds to '-compile-info'... " + lx_mpi_compile_line=`$MPICC -compile-info 2>/dev/null` + if [ "$?" -eq 0 ]; then + echo yes + lx_mpi_link_line=`$MPICC -link-info 2>/dev/null` + else + echo no + echo -n "Checking whether $MPICC responds to '-show'... " + lx_mpi_command_line=`$MPICC -show 2>/dev/null` + if [ "$?" -eq 0 ]; then + echo yes + else + echo no + fi + fi + else + echo yes + fi + fi + + if [ ! -z "$lx_mpi_compile_line" -a ! -z "$lx_mpi_link_line" ]; then + lx_mpi_command_line="$lx_mpi_compile_line $lx_mpi_link_line" + fi + + if [ ! -z "$lx_mpi_command_line" ]; then + # Now extract the different parts of the MPI command line. Do these separately in case we need to + # parse them all out in future versions of this macro. + lx_mpi_defines=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-D\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_includes=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-I\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_link_paths=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-L\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_libs=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-l\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + lx_mpi_link_args=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-Wl,\([^\"[:space:]]\+\|\"[^\"[:space:]]\+\"\)'` + + # Create variables and clean up newlines and multiple spaces + MPI_CFLAGS="$lx_mpi_defines $lx_mpi_includes" + MPI_CLDFLAGS="$lx_mpi_link_paths $lx_mpi_libs $lx_mpi_link_args" + MPI_CFLAGS=` echo "$MPI_CFLAGS" | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//' | sed 's/ +/ /g'` + MPI_CLDFLAGS=`echo "$MPI_CLDFLAGS" | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//' | sed 's/ +/ /g'` + + OLD_CPPFLAGS=$CPPFLAGS + OLD_LIBS=$LIBS + CPPFLAGS=$MPI_CFLAGS + LIBS=$MPI_CLDFLAGS + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int rank, size; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + # Add a define for testing at compile time. + +$as_echo "#define HAVE_MPI 1" >>confdefs.h + + have_C_mpi='yes' +else + # zero out mpi flags so we don't link against the faulty library. + MPI_CFLAGS="" + MPI_CLDFLAGS="" + have_C_mpi='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + # AC_SUBST everything. + + + + + LIBS=$OLD_LIBS + CPPFLAGS=$OLD_CPPFLAGS + else + Echo Unable to find suitable MPI Compiler. Try setting MPICC. + have_C_mpi='no' + fi + + fi + + + if test "${have_C_mpi}" = "yes" ; then + HAVE_C_MPI_TRUE= + HAVE_C_MPI_FALSE='#' +else + HAVE_C_MPI_TRUE='#' + HAVE_C_MPI_FALSE= +fi + + ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` @@ -18787,6 +19103,10 @@ if test -z "${WIN32_TRUE}" && test -z "${WIN32_FALSE}"; then as_fn_error $? "conditional \"WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_C_MPI_TRUE}" && test -z "${HAVE_C_MPI_FALSE}"; then + as_fn_error $? "conditional \"HAVE_C_MPI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_CXX_TRUE}" && test -z "${ENABLE_CXX_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CXX\" was never defined. diff --git a/qse/configure.ac b/qse/configure.ac index cae8f4e9..00a14ee5 100644 --- a/qse/configure.ac +++ b/qse/configure.ac @@ -192,6 +192,11 @@ dnl the existence of the libaray. AC_CHECK_LIB([unicows], [main], [UNICOWS_LIBS="-lunicows"]) AC_SUBST(UNICOWS_LIBS) +dnl MPI +LX_FIND_MPI(C) +AM_CONDITIONAL(HAVE_C_MPI, test "${have_C_mpi}" = "yes" ) +dnl AM_CONDITIONAL(HAVE_CXX_MPI, test "${have_CXX_mpi}" = "yes" ) + AC_STRUCT_DIRENT_D_TYPE AC_CHECK_MEMBERS([struct stat.st_birthtime]) AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) diff --git a/qse/doc/Makefile.in b/qse/doc/Makefile.in index 6a37e479..bd7a0417 100644 --- a/qse/doc/Makefile.in +++ b/qse/doc/Makefile.in @@ -41,7 +41,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -144,6 +144,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/doc/image/Makefile.in b/qse/doc/image/Makefile.in index e5adb1d3..2907e4cf 100644 --- a/qse/doc/image/Makefile.in +++ b/qse/doc/image/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -103,6 +103,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/doc/page/Makefile.in b/qse/doc/page/Makefile.in index 98ae8f04..5b002e25 100644 --- a/qse/doc/page/Makefile.in +++ b/qse/doc/page/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -103,6 +103,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/include/Makefile.in b/qse/include/Makefile.in index b171995a..8c6125bf 100644 --- a/qse/include/Makefile.in +++ b/qse/include/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -141,6 +141,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/include/qse/Makefile.in b/qse/include/qse/Makefile.in index e6b091e5..08d1763e 100644 --- a/qse/include/qse/Makefile.in +++ b/qse/include/qse/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -169,6 +169,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/include/qse/awk/Makefile.am b/qse/include/qse/awk/Makefile.am index 05533cfd..f15436dc 100644 --- a/qse/include/qse/awk/Makefile.am +++ b/qse/include/qse/awk/Makefile.am @@ -1,6 +1,6 @@ pkgincludedir = $(includedir)/qse/awk -pkginclude_HEADERS = awk.h std.h +pkginclude_HEADERS = awk.h std.h mpi.h if ENABLE_CXX pkginclude_HEADERS += Awk.hpp StdAwk.hpp diff --git a/qse/include/qse/awk/Makefile.in b/qse/include/qse/awk/Makefile.in index 6318e015..8f56d72f 100644 --- a/qse/include/qse/awk/Makefile.in +++ b/qse/include/qse/awk/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -51,7 +51,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = -am__pkginclude_HEADERS_DIST = awk.h std.h Awk.hpp StdAwk.hpp +am__pkginclude_HEADERS_DIST = awk.h std.h mpi.h Awk.hpp StdAwk.hpp am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -130,6 +130,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -225,7 +228,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -pkginclude_HEADERS = awk.h std.h $(am__append_1) +pkginclude_HEADERS = awk.h std.h mpi.h $(am__append_1) all: all-am .SUFFIXES: diff --git a/qse/include/qse/awk/mpi.h b/qse/include/qse/awk/mpi.h new file mode 100644 index 00000000..4d51347d --- /dev/null +++ b/qse/include/qse/awk/mpi.h @@ -0,0 +1,140 @@ +/* + * $Id$ + * + Copyright 2006-2012 Chung, Hyung-Hwan. + This file is part of QSE. + + QSE is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + QSE is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with QSE. If not, see . + */ + +#ifndef _QSE_AWK_MPI_H_ +#define _QSE_AWK_MPI_H_ + +#include + +/** @file + * This file defines functions and data types for parallel processing. + */ + +enum qse_awk_parsempi_type_t +{ + QSE_AWK_PARSEMPI_NULL = QSE_AWK_PARSESTD_NULL, + QSE_AWK_PARSEMPI_FILE = QSE_AWK_PARSESTD_FILE, + QSE_AWK_PARSEMPI_STR = QSE_AWK_PARSESTD_STR +}; + +typedef enum qse_awk_parsempi_type_t qse_awk_parsempi_type_t; + +typedef qse_awk_parsestd_t qse_awk_parsempi_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The qse_awk_openmpi() function creates an awk object using the default + * memory manager and primitive functions. Besides, it adds a set of + * standard intrinsic functions like atan, system, etc. Use this function + * over qse_awk_open() if you don't need finer-grained customization. + */ +qse_awk_t* qse_awk_openmpi ( + qse_size_t xtnsize /**< extension size in bytes */ +); + +/** + * The qse_awk_openmpiwithmmgr() function creates an awk object with a + * user-defined memory manager. It is equivalent to qse_awk_openmpi(), + * except that you can specify your own memory manager. + */ +qse_awk_t* qse_awk_openmpiwithmmgr ( + qse_mmgr_t* mmgr, /**< memory manager */ + qse_size_t xtnsize /**< extension size in bytes */ +); + +/** + * The qse_awk_getxtnmpi() gets the pointer to extension space. + * Note that you must not call qse_awk_getxtn() for an awk object + * created with qse_awk_openmpi() and qse_awk_openmpiwithmmgr(). + */ +void* qse_awk_getxtnmpi ( + qse_awk_t* awk +); + +/** + * The qse_awk_parsempi() functions parses source script. + * The code below shows how to parse a literal string 'BEGIN { print 10; }' + * and deparses it out to a buffer 'buf'. + * @code + * int n; + * qse_awk_parsempi_t in; + * qse_awk_parsempi_t out; + * + * in.type = QSE_AWK_PARSESTD_STR; + * in.u.str.ptr = QSE_T("BEGIN { print 10; }"); + * in.u.str.len = qse_strlen(in.u.str.ptr); + * out.type = QSE_AWK_PARSESTD_STR; + * n = qse_awk_parsempi (awk, &in, &out); + * if (n >= 0) + * { + * qse_printf (QSE_T("%s\n"), out.u.str.ptr); + * QSE_MMGR_FREE (out.u.str.ptr); + * } + * @endcode + */ +int qse_awk_parsempi ( + qse_awk_t* awk, + qse_awk_parsempi_t* in, + qse_awk_parsempi_t* out +); + +/** + * The qse_awk_rtx_openmpi() function creates a standard runtime context. + * The caller should keep the contents of @a icf and @a ocf valid throughout + * the lifetime of the runtime context created. The @a cmgr is set to the + * streams created with @a icf and @a ocf if it is not #QSE_NULL. + */ +qse_awk_rtx_t* qse_awk_rtx_openmpi ( + qse_awk_t* awk, + qse_size_t xtn, + const qse_char_t* id, + const qse_char_t*const icf[], + const qse_char_t*const ocf[], + qse_cmgr_t* cmgr +); + +/** + * The qse_awk_rtx_getxtnmpi() function gets the pointer to extension space. + */ +void* qse_awk_rtx_getxtnmpi ( + qse_awk_rtx_t* rtx +); + + +/** + * The qse_awk_rtx_getcmgrmpi() function gets the current character + * manager associated with a particular I/O target indicated by the name + * @a ioname if #QSE_CHAR_IS_WCHAR is defined. It always returns #QSE_NULL + * if #QSE_CHAR_IS_MCHAR is defined. + */ +qse_cmgr_t* qse_awk_rtx_getcmgrmpi ( + qse_awk_rtx_t* rtx, + const qse_char_t* ioname +); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/qse/include/qse/cmn/Makefile.in b/qse/include/qse/cmn/Makefile.in index ce829a7d..de6ab9e7 100644 --- a/qse/include/qse/cmn/Makefile.in +++ b/qse/include/qse/cmn/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -134,6 +134,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/include/qse/config.h.in b/qse/include/qse/config.h.in index cb545f8e..59585f10 100644 --- a/qse/include/qse/config.h.in +++ b/qse/include/qse/config.h.in @@ -175,6 +175,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have MPI libs and headers. */ +#undef HAVE_MPI + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H diff --git a/qse/include/qse/cut/Makefile.in b/qse/include/qse/cut/Makefile.in index 7e42d78a..fabda160 100644 --- a/qse/include/qse/cut/Makefile.in +++ b/qse/include/qse/cut/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -130,6 +130,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/include/qse/net/Makefile.in b/qse/include/qse/net/Makefile.in index e413fcdb..fe967d08 100644 --- a/qse/include/qse/net/Makefile.in +++ b/qse/include/qse/net/Makefile.in @@ -41,7 +41,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -128,6 +128,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/include/qse/sed/Makefile.in b/qse/include/qse/sed/Makefile.in index ceb947b1..d269fcab 100644 --- a/qse/include/qse/sed/Makefile.in +++ b/qse/include/qse/sed/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -130,6 +130,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/include/qse/stx/Makefile.in b/qse/include/qse/stx/Makefile.in index 169f977a..2291ff0f 100644 --- a/qse/include/qse/stx/Makefile.in +++ b/qse/include/qse/stx/Makefile.in @@ -41,7 +41,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -128,6 +128,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/lib/Makefile.in b/qse/lib/Makefile.in index d385e452..faec0b03 100644 --- a/qse/lib/Makefile.in +++ b/qse/lib/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -140,6 +140,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/lib/awk/Makefile.am b/qse/lib/awk/Makefile.am index 59c9d9da..4f4b45b0 100644 --- a/qse/lib/awk/Makefile.am +++ b/qse/lib/awk/Makefile.am @@ -1,4 +1,3 @@ - AUTOMAKE_OPTIONS = nostdinc AM_CPPFLAGS = \ @@ -17,3 +16,11 @@ libqseawkxx_la_SOURCES = Awk.cpp StdAwk.cpp libqseawkxx_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined libqseawkxx_la_LIBADD = -lqseawk -lqsecmn $(LIBM) endif + +if HAVE_C_MPI +lib_LTLIBRARIES += libqseawkp.la +libqseawkp_la_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS) +libqseawkp_la_SOURCES = mpi.c +libqseawkp_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined $(MPI_CLDFLAGS) +libqseawkp_la_LIBADD = -lqseawk -lqsecmn $(LIBM) +endif diff --git a/qse/lib/awk/Makefile.in b/qse/lib/awk/Makefile.in index b4a6e9c9..27adda07 100644 --- a/qse/lib/awk/Makefile.in +++ b/qse/lib/awk/Makefile.in @@ -35,6 +35,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_CXX_TRUE@am__append_1 = libqseawkxx.la +@HAVE_C_MPI_TRUE@am__append_2 = libqseawkp.la subdir = lib/awk DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -42,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -80,6 +81,14 @@ libqseawk_la_OBJECTS = $(am_libqseawk_la_OBJECTS) libqseawk_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libqseawk_la_LDFLAGS) $(LDFLAGS) -o $@ +@HAVE_C_MPI_TRUE@libqseawkp_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__libqseawkp_la_SOURCES_DIST = mpi.c +@HAVE_C_MPI_TRUE@am_libqseawkp_la_OBJECTS = libqseawkp_la-mpi.lo +libqseawkp_la_OBJECTS = $(am_libqseawkp_la_OBJECTS) +libqseawkp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libqseawkp_la_LDFLAGS) $(LDFLAGS) -o $@ +@HAVE_C_MPI_TRUE@am_libqseawkp_la_rpath = -rpath $(libdir) @ENABLE_CXX_TRUE@libqseawkxx_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libqseawkxx_la_SOURCES_DIST = Awk.cpp StdAwk.cpp @ENABLE_CXX_TRUE@am_libqseawkxx_la_OBJECTS = Awk.lo StdAwk.lo @@ -110,8 +119,10 @@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libqseawk_la_SOURCES) $(libqseawkxx_la_SOURCES) +SOURCES = $(libqseawk_la_SOURCES) $(libqseawkp_la_SOURCES) \ + $(libqseawkxx_la_SOURCES) DIST_SOURCES = $(libqseawk_la_SOURCES) \ + $(am__libqseawkp_la_SOURCES_DIST) \ $(am__libqseawkxx_la_SOURCES_DIST) ETAGS = etags CTAGS = ctags @@ -167,6 +178,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -268,13 +282,17 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(includedir) -lib_LTLIBRARIES = libqseawk.la $(am__append_1) +lib_LTLIBRARIES = libqseawk.la $(am__append_1) $(am__append_2) libqseawk_la_SOURCES = awk.c err.c tree.c parse.c run.c rec.c val.c fnc.c misc.c rio.c std.c awk.h err.h rio.h val.h fnc.h misc.h parse.h run.h tree.h libqseawk_la_LDFLAGS = -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined libqseawk_la_LIBADD = -lqsecmn $(LIBM) @ENABLE_CXX_TRUE@libqseawkxx_la_SOURCES = Awk.cpp StdAwk.cpp @ENABLE_CXX_TRUE@libqseawkxx_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined @ENABLE_CXX_TRUE@libqseawkxx_la_LIBADD = -lqseawk -lqsecmn $(LIBM) +@HAVE_C_MPI_TRUE@libqseawkp_la_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS) +@HAVE_C_MPI_TRUE@libqseawkp_la_SOURCES = mpi.c +@HAVE_C_MPI_TRUE@libqseawkp_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined $(MPI_CLDFLAGS) +@HAVE_C_MPI_TRUE@libqseawkp_la_LIBADD = -lqseawk -lqsecmn $(LIBM) all: all-am .SUFFIXES: @@ -342,6 +360,8 @@ clean-libLTLIBRARIES: done libqseawk.la: $(libqseawk_la_OBJECTS) $(libqseawk_la_DEPENDENCIES) $(libqseawk_la_LINK) -rpath $(libdir) $(libqseawk_la_OBJECTS) $(libqseawk_la_LIBADD) $(LIBS) +libqseawkp.la: $(libqseawkp_la_OBJECTS) $(libqseawkp_la_DEPENDENCIES) + $(libqseawkp_la_LINK) $(am_libqseawkp_la_rpath) $(libqseawkp_la_OBJECTS) $(libqseawkp_la_LIBADD) $(LIBS) libqseawkxx.la: $(libqseawkxx_la_OBJECTS) $(libqseawkxx_la_DEPENDENCIES) $(libqseawkxx_la_LINK) $(am_libqseawkxx_la_rpath) $(libqseawkxx_la_OBJECTS) $(libqseawkxx_la_LIBADD) $(LIBS) @@ -356,6 +376,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqseawkp_la-mpi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rec.Plo@am__quote@ @@ -386,6 +407,13 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +libqseawkp_la-mpi.lo: mpi.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libqseawkp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libqseawkp_la-mpi.lo -MD -MP -MF $(DEPDIR)/libqseawkp_la-mpi.Tpo -c -o libqseawkp_la-mpi.lo `test -f 'mpi.c' || echo '$(srcdir)/'`mpi.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libqseawkp_la-mpi.Tpo $(DEPDIR)/libqseawkp_la-mpi.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpi.c' object='libqseawkp_la-mpi.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libqseawkp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libqseawkp_la-mpi.lo `test -f 'mpi.c' || echo '$(srcdir)/'`mpi.c + .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po diff --git a/qse/lib/awk/mpi.c b/qse/lib/awk/mpi.c new file mode 100644 index 00000000..98259b10 --- /dev/null +++ b/qse/lib/awk/mpi.c @@ -0,0 +1,145 @@ +/* + * $Id$ + * + Copyright 2006-2012 Chung, Hyung-Hwan. + This file is part of QSE. + + QSE is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + QSE is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with QSE. If not, see . + */ + +#include +#include "../cmn/mem.h" +#include + +typedef struct xtn_t xtn_t; + +struct xtn_t +{ + int gbl_mpi_rank; + int gbl_mpi_size; +}; + +typedef struct rxtn_t rxtn_t; +struct rxtn_t +{ + int dummy; +}; + +qse_awk_t* qse_awk_openmpi (qse_size_t xtnsize) +{ + return qse_awk_openmpiwithmmgr (QSE_MMGR_GETDFL(), xtnsize); +} + +qse_awk_t* qse_awk_openmpiwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize) +{ + qse_awk_t* awk; + + awk = qse_awk_openstdwithmmgr ( + QSE_MMGR_GETDFL(), QSE_SIZEOF(xtn_t) + xtnsize); + + if (awk) + { + xtn_t* xtn; + + xtn = (xtn_t*) qse_awk_getxtnstd (awk); + QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn)); + + xtn->gbl_mpi_rank = qse_awk_addgbl (awk, QSE_T("MPI_RANK"), 8); + xtn->gbl_mpi_size = qse_awk_addgbl (awk, QSE_T("MPI_SIZE"), 8); + if (xtn->gbl_mpi_rank <= -1 || xtn->gbl_mpi_size <= -1) + { + qse_awk_close (awk); + return QSE_NULL; + } + } + + return awk; +} + +void* qse_awk_getxtnmpi (qse_awk_t* awk) +{ + return (void*)((xtn_t*)qse_awk_getxtnstd(awk) + 1); +} + +int qse_awk_parsempi ( + qse_awk_t* awk, qse_awk_parsempi_t* in, qse_awk_parsempi_t* out) +{ + return qse_awk_parsestd (awk, in, out); +} + +qse_awk_rtx_t* qse_awk_rtx_openmpi ( + qse_awk_t* awk, + qse_size_t xtnsize, + const qse_char_t* id, + const qse_char_t*const icf[], + const qse_char_t*const ocf[], + qse_cmgr_t* cmgr) +{ + qse_awk_rtx_t* rtx; + + rtx = qse_awk_rtx_openstd ( + awk, QSE_SIZEOF(rxtn_t) + xtnsize, id, icf, ocf, cmgr); + if (rtx) + { + int rank, size; + + xtn_t* xtn; + rxtn_t* rxtn; + qse_awk_val_t* v_tmp; + + xtn = (xtn_t*) qse_awk_getxtnstd (awk); + rxtn = (rxtn_t*) qse_awk_rtx_getxtnstd (rtx); + + QSE_MEMSET (rxtn, 0, QSE_SIZEOF(*rxtn)); + + MPI_Comm_rank (MPI_COMM_WORLD, &rank); + MPI_Comm_size (MPI_COMM_WORLD, &size); + + v_tmp = qse_awk_rtx_makeintval (rtx, rank); + if (v_tmp == QSE_NULL) + { + qse_awk_rtx_close (rtx); + return QSE_NULL; + } + + qse_awk_rtx_refupval (rtx, v_tmp); + qse_awk_rtx_setgbl (rtx, xtn->gbl_mpi_rank, v_tmp); + qse_awk_rtx_refdownval (rtx, v_tmp); + + v_tmp = qse_awk_rtx_makeintval (rtx, size); + if (v_tmp == QSE_NULL) + { + qse_awk_rtx_close (rtx); + return QSE_NULL; + } + + qse_awk_rtx_refupval (rtx, v_tmp); + qse_awk_rtx_setgbl (rtx, xtn->gbl_mpi_size, v_tmp); + qse_awk_rtx_refdownval (rtx, v_tmp); + } + + return rtx; +} + +void* qse_awk_rtx_getxtnmpi (qse_awk_rtx_t* rtx) +{ + return (void*)((rxtn_t*)qse_awk_rtx_getxtnstd(rtx) + 1); +} + +qse_cmgr_t* qse_awk_rtx_getcmgrmpi ( + qse_awk_rtx_t* rtx, const qse_char_t* ioname) +{ + return qse_awk_rtx_getcmgrstd (rtx, ioname); +} + diff --git a/qse/lib/awk/run.c b/qse/lib/awk/run.c index 092d0bcb..f5aa90d9 100644 --- a/qse/lib/awk/run.c +++ b/qse/lib/awk/run.c @@ -2813,8 +2813,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde) QSE_STR_LEN(&rtx->inrec.line)); if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/) { - if (out != QSE_NULL) - QSE_AWK_FREE (rtx->awk, out); + if (out) QSE_AWK_FREE (rtx->awk, out); ADJERR_LOC (rtx, &nde->loc); return -1; } @@ -2843,8 +2842,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde) rtx->gbl.ofs.len); if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/) { - if (out != QSE_NULL) - QSE_AWK_FREE (rtx->awk, out); + if (out) QSE_AWK_FREE (rtx->awk, out); ADJERR_LOC (rtx, &nde->loc); return -1; } @@ -2853,8 +2851,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde) v = eval_expression (rtx, np); if (v == QSE_NULL) { - if (out != QSE_NULL) - QSE_AWK_FREE (rtx->awk, out); + if (out) QSE_AWK_FREE (rtx->awk, out); return -1; } qse_awk_rtx_refupval (rtx, v); @@ -2863,9 +2860,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde) rtx, nde->out_type, dst, v); if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/) { - if (out != QSE_NULL) - QSE_AWK_FREE (rtx->awk, out); - + if (out) QSE_AWK_FREE (rtx->awk, out); qse_awk_rtx_refdownval (rtx, v); ADJERR_LOC (rtx, &nde->loc); return -1; @@ -2881,7 +2876,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde) rtx->gbl.ors.ptr, rtx->gbl.ors.len); if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/) { - if (out != QSE_NULL) QSE_AWK_FREE (rtx->awk, out); + if (out) QSE_AWK_FREE (rtx->awk, out); ADJERR_LOC (rtx, &nde->loc); return -1; } @@ -2889,7 +2884,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde) /* unlike printf, flushio() is not needed here as print * inserts that triggers auto-flush */ - if (out != QSE_NULL) QSE_AWK_FREE (rtx->awk, out); + if (out) QSE_AWK_FREE (rtx->awk, out); /*skip_write:*/ return 0; diff --git a/qse/lib/cmn/Makefile.in b/qse/lib/cmn/Makefile.in index 621d5263..be2bcec4 100644 --- a/qse/lib/cmn/Makefile.in +++ b/qse/lib/cmn/Makefile.in @@ -44,7 +44,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -182,6 +182,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/lib/cut/Makefile.in b/qse/lib/cut/Makefile.in index 9ecfaeda..e61a8521 100644 --- a/qse/lib/cut/Makefile.in +++ b/qse/lib/cut/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -165,6 +165,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/lib/net/Makefile.in b/qse/lib/net/Makefile.in index 7a14120a..5e94087d 100644 --- a/qse/lib/net/Makefile.in +++ b/qse/lib/net/Makefile.in @@ -41,7 +41,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -148,6 +148,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/lib/sed/Makefile.in b/qse/lib/sed/Makefile.in index 65917872..c9876c77 100644 --- a/qse/lib/sed/Makefile.in +++ b/qse/lib/sed/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -165,6 +165,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/lib/stx/Makefile.in b/qse/lib/stx/Makefile.in index e171e4b4..4c894b8a 100644 --- a/qse/lib/stx/Makefile.in +++ b/qse/lib/stx/Makefile.in @@ -41,7 +41,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -147,6 +147,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/m4/lx_find_mpi.m4 b/qse/m4/lx_find_mpi.m4 new file mode 100644 index 00000000..f86c43b3 --- /dev/null +++ b/qse/m4/lx_find_mpi.m4 @@ -0,0 +1,205 @@ +################################################################################################# +# Copyright (c) 2010, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory +# Written by Todd Gamblin, tgamblin@llnl.gov. +# LLNL-CODE-417602 +# All rights reserved. +# +# This file is part of Libra. For details, see http://github.com/tgamblin/libra. +# Please also read the LICENSE file for further information. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this list of +# conditions and the disclaimer below. +# * Redistributions in binary form must reproduce the above copyright notice, this list of +# conditions and the disclaimer (as noted below) in the documentation and/or other materials +# provided with the distribution. +# * Neither the name of the LLNS/LLNL nor the names of its contributors may be used to endorse +# or promote products derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +################################################################################################# + +# +# LX_FIND_MPI() +# ------------------------------------------------------------------------ +# This macro finds an MPI compiler and extracts includes and libraries from +# it for use in automake projects. The script exports the following variables: +# +# AC_DEFINE variables: +# HAVE_MPI AC_DEFINE'd to 1 if we found MPI +# +# AC_SUBST variables: +# MPICC Name of MPI compiler +# MPI_CFLAGS Includes and defines for MPI C compilation +# MPI_CLDFLAGS Libraries and library paths for linking MPI C programs +# +# MPICXX Name of MPI C++ compiler +# MPI_CXXFLAGS Includes and defines for MPI C++ compilation +# MPI_CXXLDFLAGS Libraries and library paths for linking MPI C++ programs +# +# MPIF77 Name of MPI Fortran 77 compiler +# MPI_F77FLAGS Includes and defines for MPI Fortran 77 compilation +# MPI_F77LDFLAGS Libraries and library paths for linking MPI Fortran 77 programs +# +# MPIFC Name of MPI Fortran compiler +# MPI_FFLAGS Includes and defines for MPI Fortran compilation +# MPI_FLDFLAGS Libraries and library paths for linking MPI Fortran programs +# +# Shell variables output by this macro: +# have_C_mpi 'yes' if we found MPI for C, 'no' otherwise +# have_CXX_mpi 'yes' if we found MPI for C++, 'no' otherwise +# have_F77_mpi 'yes' if we found MPI for F77, 'no' otherwise +# have_F_mpi 'yes' if we found MPI for Fortran, 'no' otherwise +# +AC_DEFUN([LX_FIND_MPI], +[ + AC_LANG_CASE( + [C], [ + AC_REQUIRE([AC_PROG_CC]) + if [[ ! -z "$MPICC" ]]; then + LX_QUERY_MPI_COMPILER(MPICC, [$MPICC], C) + else + LX_QUERY_MPI_COMPILER(MPICC, [mpicc mpiicc mpixlc mpipgcc], C) + fi + ], + [C++], [ + AC_REQUIRE([AC_PROG_CXX]) + if [[ ! -z "$MPICXX" ]]; then + LX_QUERY_MPI_COMPILER(MPICXX, [$MPICXX], CXX) + else + LX_QUERY_MPI_COMPILER(MPICXX, [mpicxx mpiCC mpic++ mpig++ mpiicpc mpipgCC mpixlC], CXX) + fi + ], + [F77], [ + AC_REQUIRE([AC_PROG_F77]) + if [[ ! -z "$MPIF77" ]]; then + LX_QUERY_MPI_COMPILER(MPIF77, [$MPIF77], F77) + else + LX_QUERY_MPI_COMPILER(MPIF77, [mpif77 mpiifort mpixlf77 mpixlf77_r], F77) + fi + ], + [Fortran], [ + AC_REQUIRE([AC_PROG_FC]) + if [[ ! -z "$MPIFC" ]]; then + LX_QUERY_MPI_COMPILER(MPIFC, [$MPIFC], F) + else + mpi_default_fc="mpif95 mpif90 mpigfortran mpif2003" + mpi_intel_fc="mpiifort" + mpi_xl_fc="mpixlf95 mpixlf95_r mpixlf90 mpixlf90_r mpixlf2003 mpixlf2003_r" + mpi_pg_fc="mpipgf95 mpipgf90" + LX_QUERY_MPI_COMPILER(MPIFC, [$mpi_default_fc $mpi_intel_fc $mpi_xl_fc $mpi_pg_fc], F) + fi + ]) +]) + + +# +# LX_QUERY_MPI_COMPILER([compiler-var-name], [compiler-names], [output-var-prefix]) +# ------------------------------------------------------------------------ +# AC_SUBST variables: +# MPI_FLAGS Includes and defines for MPI compilation +# MPI_LDFLAGS Libraries and library paths for linking MPI C programs +# +# Shell variables output by this macro: +# found_mpi_flags 'yes' if we were able to get flags, 'no' otherwise +# +AC_DEFUN([LX_QUERY_MPI_COMPILER], +[ + # Try to find a working MPI compiler from the supplied names + AC_PATH_PROGS($1, [$2], [not-found]) + + # Figure out what the compiler responds to to get it to show us the compile + # and link lines. After this part of the macro, we'll have a valid + # lx_mpi_command_line + echo -n "Checking whether $$1 responds to '-showme:compile'... " + lx_mpi_compile_line=`$$1 -showme:compile 2>/dev/null` + if [[ "$?" -eq 0 ]]; then + echo yes + lx_mpi_link_line=`$$1 -showme:link 2>/dev/null` + else + echo no + echo -n "Checking whether $$1 responds to '-showme'... " + lx_mpi_command_line=`$$1 -showme 2>/dev/null` + if [[ "$?" -ne 0 ]]; then + echo no + echo -n "Checking whether $$1 responds to '-compile-info'... " + lx_mpi_compile_line=`$$1 -compile-info 2>/dev/null` + if [[ "$?" -eq 0 ]]; then + echo yes + lx_mpi_link_line=`$$1 -link-info 2>/dev/null` + else + echo no + echo -n "Checking whether $$1 responds to '-show'... " + lx_mpi_command_line=`$$1 -show 2>/dev/null` + if [[ "$?" -eq 0 ]]; then + echo yes + else + echo no + fi + fi + else + echo yes + fi + fi + + if [[ ! -z "$lx_mpi_compile_line" -a ! -z "$lx_mpi_link_line" ]]; then + lx_mpi_command_line="$lx_mpi_compile_line $lx_mpi_link_line" + fi + + if [[ ! -z "$lx_mpi_command_line" ]]; then + # Now extract the different parts of the MPI command line. Do these separately in case we need to + # parse them all out in future versions of this macro. + lx_mpi_defines=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-D\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'` + lx_mpi_includes=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-I\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'` + lx_mpi_link_paths=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-L\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'` + lx_mpi_libs=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-l\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'` + lx_mpi_link_args=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-Wl,\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'` + + # Create variables and clean up newlines and multiple spaces + MPI_$3FLAGS="$lx_mpi_defines $lx_mpi_includes" + MPI_$3LDFLAGS="$lx_mpi_link_paths $lx_mpi_libs $lx_mpi_link_args" + MPI_$3FLAGS=` echo "$MPI_$3FLAGS" | tr '\n' ' ' | sed 's/^[[ \t]]*//;s/[[ \t]]*$//' | sed 's/ +/ /g'` + MPI_$3LDFLAGS=`echo "$MPI_$3LDFLAGS" | tr '\n' ' ' | sed 's/^[[ \t]]*//;s/[[ \t]]*$//' | sed 's/ +/ /g'` + + OLD_CPPFLAGS=$CPPFLAGS + OLD_LIBS=$LIBS + CPPFLAGS=$MPI_$3FLAGS + LIBS=$MPI_$3LDFLAGS + + AC_TRY_LINK([#include ], + [int rank, size; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size);], + [# Add a define for testing at compile time. + AC_DEFINE([HAVE_MPI], [1], [Define to 1 if you have MPI libs and headers.]) + have_$3_mpi='yes'], + [# zero out mpi flags so we don't link against the faulty library. + MPI_$3FLAGS="" + MPI_$3LDFLAGS="" + have_$3_mpi='no']) + + # AC_SUBST everything. + AC_SUBST($1) + AC_SUBST(MPI_$3FLAGS) + AC_SUBST(MPI_$3LDFLAGS) + + LIBS=$OLD_LIBS + CPPFLAGS=$OLD_CPPFLAGS + else + Echo Unable to find suitable MPI Compiler. Try setting $1. + have_$3_mpi='no' + fi +]) + + diff --git a/qse/regress/Makefile.in b/qse/regress/Makefile.in index f1b8e7a8..bf0fb125 100644 --- a/qse/regress/Makefile.in +++ b/qse/regress/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -141,6 +141,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/regress/awk/Makefile.in b/qse/regress/awk/Makefile.in index e11283ff..13649ef3 100644 --- a/qse/regress/awk/Makefile.in +++ b/qse/regress/awk/Makefile.in @@ -41,7 +41,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -104,6 +104,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/regress/sed/Makefile.in b/qse/regress/sed/Makefile.in index 6ef0c0bc..181cb33f 100644 --- a/qse/regress/sed/Makefile.in +++ b/qse/regress/sed/Makefile.in @@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -106,6 +106,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/samples/Makefile.in b/qse/samples/Makefile.in index 707d3a5e..841a71f6 100644 --- a/qse/samples/Makefile.in +++ b/qse/samples/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -141,6 +141,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/samples/awk/Makefile.in b/qse/samples/awk/Makefile.in index f722701c..caef5dc9 100644 --- a/qse/samples/awk/Makefile.in +++ b/qse/samples/awk/Makefile.in @@ -46,7 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -211,6 +211,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/samples/cmn/Makefile.in b/qse/samples/cmn/Makefile.in index fd6cd449..0321a3d5 100644 --- a/qse/samples/cmn/Makefile.in +++ b/qse/samples/cmn/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -279,6 +279,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/samples/cut/Makefile.in b/qse/samples/cut/Makefile.in index 7ee604f2..55821201 100644 --- a/qse/samples/cut/Makefile.in +++ b/qse/samples/cut/Makefile.in @@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -127,6 +127,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/samples/net/Makefile.in b/qse/samples/net/Makefile.in index 8ec438c8..63f84d5d 100644 --- a/qse/samples/net/Makefile.in +++ b/qse/samples/net/Makefile.in @@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -133,6 +133,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/samples/sed/Makefile.in b/qse/samples/sed/Makefile.in index bc62a387..fae079f9 100644 --- a/qse/samples/sed/Makefile.in +++ b/qse/samples/sed/Makefile.in @@ -44,7 +44,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -149,6 +149,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/qse/tools/Makefile.in b/qse/tools/Makefile.in index b8af3081..937714a1 100644 --- a/qse/tools/Makefile.in +++ b/qse/tools/Makefile.in @@ -40,7 +40,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -103,6 +103,9 @@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MPICC = @MPICC@ +MPI_CFLAGS = @MPI_CFLAGS@ +MPI_CLDFLAGS = @MPI_CLDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@