Hello all, hi Ralf and Jorge,
The attached patch causes libgfortran/ also to build
libgfortran/caf/single.c, which will be installed as
$PREFIX/.../target-triplet/gcc-version/libcaf_single.a.
Build and tested on x86-64-linux.
OK for the trunk?
* * *
As a possible enhancement, one could also automatically build mpi.c
using AX_MPI. However, one needs to think about whether one should - and
if so, when the build should be enabled. (Cf.
http://www.gnu.org/software/autoconf-archive/ax_mpi.html and
http://gcc.gnu.org/ml/fortran/2011-03/msg00004.html) -- One issue I see
is that one might end up using the wrong libcaf_mpi if one automatically
compiles mpi.c and places it into the lib*/gcc/<triplet>/<version>
directory.
* * *
Regarding the test suite: I think I will add an extra directory - such
as gfortran.dg/coarray -, in which by default the files are compiled/run
with the flag -fcoarray=single and -fcoarray=lib -lcaf_single.
Optionally, one additionally tests -fcoarray=lib with some
parallelization library (e.g. libcaf_mpi.a). That will happen if some
variable is set; the setting happens via site.exp and can be overridden
by some environment variables.
* * *
Regarding the comments by Ralf and Jorge/Lisandro:
My idea was to either not build libcaf_mpi - or only with the default
MPI compiler (cf. AX_MPI above) and only statically. The current plan is
to make building libcaf_mpi simple such that an interested (Linux)
distributor or a system admin or a user can simply compile it with their
favourite compiler - cf. http://gcc.gnu.org/wiki/CoarrayLib. If a system
admin or user prefers it, they can also build a shared library (.so, .dll).
The reason that a static libcaf_mpi is should be sufficient is that
there is typically only a single MPI installed on a system; if one wants
to use a different one - e.g. on a different system - one can simply
relink. Only for the special case that one wants to easily switch the
MPI library, one needs a dynamic library. However, that's a very special
case - thus the burden of creating a shared library can be put on the admin.
Regarding Ralf's "I think one of the most important things is that you
allow to override both the running of mpif90 and the mpiexec commands":
I think your comment that's with regards to the test suite and I concur.
I am not sure whether one should have a default value. While "mpiexec -n
2" will usually work, compiling is more difficult: Calling "mpif90" will
usually invoke the compiler specified when building mpif90 - and not the
just build gfortran/f951; but the latter should be tested when making
"make check-gfortran". Thus, I think one probably should add a
$FCFLAGS/$LDFLAGS options which contains the value of "mpif90 -show" (or
however it is called in your MPI implementation). I therefore think one
should have two or three site.exp/environment settings: The compile/link
flags and the run command.
Regarding "qsub", "msub" or "llrun": I assume most testers will use
mpiexec directly, which will then typcially use 2 to 4 local processes
(shared-memory MPI). Using a queuing system is more complicated as the
submit commands will typically return before the completion of the job
and the output will typically be written into a file. I think one could
work around that by writing a mpiexec replacement wrapper which submits
the job and cats the output to stdout/stderr. One also might need to
adjust the timeout settings. Hence, I think queued processing will
probably not be done for "make check-gfortran" but only manually - using
either the dg-run programs or some other test or real-world coarray
program. But with a wrapper, it should work.
Ralf: "The MPI implementations I know all have pairwise incompatible ABIs"
Well, as written above, the ABI of the coarray program is defined and
independent from the MPI ABI - thus the difference is only in libcaf.
Therefore, if libcaf is dynamically linked, switching the MPI
implementation and simultaneously libcaf_mpi.so should work. But as
written above, I think that is something the distributor/admin/user
should do and not GCC itself.
(Lisandro/George:) 'A dynamic library "libcaf_mpi.so" is not linked with
MPI, but uses the dlopen() and dlsym(), to load and access the contents
of a specific "MPI-linked" dynamic library
"libcaf_mpi_{mpich2|openmpi|other}.so". This way "libcaf_mpi.so" does
not depend on any MPI implementation'
I think that's overengineered. Having a simple libcaf_mpi.a in the path
- e.g. in the $MPI/lib directory - should be the best for most typical
usage. Having at the same location a libcaf_mpi.so will even allow
dynamic switching. I think the main usage for a dynamically linked
version is for closed-source software.
(Side note: I have never switched the MPI implementation on the same
system and I have simply recompiled the whole program on different systems.)
Tobias
2011-04-13 Tobias Burnus <bur...@net-b.de>
PR fortran/18918
* Makefile.am: Build and install caf/single.c as
libcaf_single.a.
* Makefile.in: Regenerate.
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index c38e330..ce0d725 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -45,6 +45,13 @@ libgfortranbegin_la_SOURCES = fmain.c
libgfortranbegin_la_LDFLAGS = -static
libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS)
+cafexeclib_LTLIBRARIES = libcaf_single.la
+cafexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
+libcaf_single_la_SOURCES = caf/single.c
+libcaf_single_la_LDFLAGS = -static
+libcaf_single_la_DEPENDENCIES = caf/libcaf.h
+libcaf_single_la_LINK = $(LINK) $(libcaf_single_la_LDFLAGS)
+
## io.h conflicts with a system header on some platforms, so
## use -iquote
AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index fae00d4..d41b7bb 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -85,9 +85,14 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(myexeclibdir)" \
- "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"
-LTLIBRARIES = $(myexeclib_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(cafexeclibdir)" \
+ "$(DESTDIR)$(myexeclibdir)" "$(DESTDIR)$(toolexeclibdir)" \
+ "$(DESTDIR)$(toolexeclibdir)"
+LTLIBRARIES = $(cafexeclib_LTLIBRARIES) $(myexeclib_LTLIBRARIES) \
+ $(toolexeclib_LTLIBRARIES)
+libcaf_single_la_LIBADD =
+am_libcaf_single_la_OBJECTS = single.lo
+libcaf_single_la_OBJECTS = $(am_libcaf_single_la_OBJECTS)
libgfortran_la_LIBADD =
am__objects_1 = backtrace.lo bounds.lo compile_options.lo \
convert_char.lo environ.lo error.lo fpu.lo main.lo memory.lo \
@@ -314,7 +319,8 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
LTFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-SOURCES = $(libgfortran_la_SOURCES) $(libgfortranbegin_la_SOURCES)
+SOURCES = $(libcaf_single_la_SOURCES) $(libgfortran_la_SOURCES) \
+ $(libgfortranbegin_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
@@ -492,6 +498,12 @@ myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
libgfortranbegin_la_SOURCES = fmain.c
libgfortranbegin_la_LDFLAGS = -static
libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS)
+cafexeclib_LTLIBRARIES = libcaf_single.la
+cafexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
+libcaf_single_la_SOURCES = caf/single.c
+libcaf_single_la_LDFLAGS = -static
+libcaf_single_la_DEPENDENCIES = caf/libcaf.h
+libcaf_single_la_LINK = $(LINK) $(libcaf_single_la_LDFLAGS)
AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config $(LIBQUADINCLUDE) \
-I$(MULTIBUILDTOP)../../$(host_subdir)/gcc
@@ -1309,6 +1321,37 @@ distclean-hdr:
-rm -f config.h stamp-h1
libgfortran.spec: $(top_builddir)/config.status $(srcdir)/libgfortran.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+install-cafexeclibLTLIBRARIES: $(cafexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(cafexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(cafexeclibdir)"
+ @list='$(cafexeclib_LTLIBRARIES)'; test -n "$(cafexeclibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(cafexeclibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(cafexeclibdir)"; \
+ }
+
+uninstall-cafexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(cafexeclib_LTLIBRARIES)'; test -n "$(cafexeclibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(cafexeclibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(cafexeclibdir)/$$f"; \
+ done
+
+clean-cafexeclibLTLIBRARIES:
+ -test -z "$(cafexeclib_LTLIBRARIES)" || rm -f $(cafexeclib_LTLIBRARIES)
+ @list='$(cafexeclib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
install-myexeclibLTLIBRARIES: $(myexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(myexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(myexeclibdir)"
@@ -1371,6 +1414,8 @@ clean-toolexeclibLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
+libcaf_single.la: $(libcaf_single_la_OBJECTS) $(libcaf_single_la_DEPENDENCIES)
+ $(libcaf_single_la_LINK) -rpath $(cafexeclibdir) $(libcaf_single_la_OBJECTS) $(libcaf_single_la_LIBADD) $(LIBS)
libgfortran.la: $(libgfortran_la_OBJECTS) $(libgfortran_la_DEPENDENCIES)
$(libgfortran_la_LINK) -rpath $(toolexeclibdir) $(libgfortran_la_OBJECTS) $(libgfortran_la_LIBADD) $(LIBS)
libgfortranbegin.la: $(libgfortranbegin_la_OBJECTS) $(libgfortranbegin_la_DEPENDENCIES)
@@ -1776,6 +1821,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/size.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/size_from_kind.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sleep.Plo@am__quote@
@@ -2296,6 +2342,13 @@ f2c_specifics.lo: intrinsics/f2c_specifics.F90
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+single.lo: caf/single.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT single.lo -MD -MP -MF $(DEPDIR)/single.Tpo -c -o single.lo `test -f 'caf/single.c' || echo '$(srcdir)/'`caf/single.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/single.Tpo $(DEPDIR)/single.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='caf/single.c' object='single.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o single.lo `test -f 'caf/single.c' || echo '$(srcdir)/'`caf/single.c
+
backtrace.lo: runtime/backtrace.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT backtrace.lo -MD -MP -MF $(DEPDIR)/backtrace.Tpo -c -o backtrace.lo `test -f 'runtime/backtrace.c' || echo '$(srcdir)/'`runtime/backtrace.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/backtrace.Tpo $(DEPDIR)/backtrace.Plo
@@ -5685,7 +5738,7 @@ check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) all-multi $(DATA) config.h
installdirs:
- for dir in "$(DESTDIR)$(myexeclibdir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; do \
+ for dir in "$(DESTDIR)$(cafexeclibdir)" "$(DESTDIR)$(myexeclibdir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -5717,8 +5770,9 @@ maintainer-clean-generic:
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am clean-multi
-clean-am: clean-generic clean-libtool clean-myexeclibLTLIBRARIES \
- clean-toolexeclibLTLIBRARIES mostlyclean-am
+clean-am: clean-cafexeclibLTLIBRARIES clean-generic clean-libtool \
+ clean-myexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \
+ mostlyclean-am
distclean: distclean-am distclean-multi
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -5745,8 +5799,9 @@ install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-multi install-myexeclibLTLIBRARIES \
- install-toolexeclibDATA install-toolexeclibLTLIBRARIES
+install-exec-am: install-cafexeclibLTLIBRARIES install-multi \
+ install-myexeclibLTLIBRARIES install-toolexeclibDATA \
+ install-toolexeclibLTLIBRARIES
install-html: install-html-am
@@ -5788,7 +5843,8 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-myexeclibLTLIBRARIES uninstall-toolexeclibDATA \
+uninstall-am: uninstall-cafexeclibLTLIBRARIES \
+ uninstall-myexeclibLTLIBRARIES uninstall-toolexeclibDATA \
uninstall-toolexeclibLTLIBRARIES
.MAKE: all all-multi check clean-multi distclean-multi install \
@@ -5796,14 +5852,15 @@ uninstall-am: uninstall-myexeclibLTLIBRARIES uninstall-toolexeclibDATA \
mostlyclean-multi
.PHONY: CTAGS GTAGS all all-am all-multi am--refresh check check-am \
- clean clean-generic clean-libtool clean-multi \
- clean-myexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES ctags \
- distclean distclean-compile distclean-generic distclean-hdr \
- distclean-libtool distclean-multi distclean-tags dvi dvi-am \
- html html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-multi \
+ clean clean-cafexeclibLTLIBRARIES clean-generic clean-libtool \
+ clean-multi clean-myexeclibLTLIBRARIES \
+ clean-toolexeclibLTLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-multi distclean-tags dvi dvi-am html html-am info \
+ info-am install install-am install-cafexeclibLTLIBRARIES \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-multi \
install-myexeclibLTLIBRARIES install-pdf install-pdf-am \
install-ps install-ps-am install-strip install-toolexeclibDATA \
install-toolexeclibLTLIBRARIES installcheck installcheck-am \
@@ -5811,8 +5868,8 @@ uninstall-am: uninstall-myexeclibLTLIBRARIES uninstall-toolexeclibDATA \
maintainer-clean-multi mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-multi pdf \
pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-myexeclibLTLIBRARIES uninstall-toolexeclibDATA \
- uninstall-toolexeclibLTLIBRARIES
+ uninstall-cafexeclibLTLIBRARIES uninstall-myexeclibLTLIBRARIES \
+ uninstall-toolexeclibDATA uninstall-toolexeclibLTLIBRARIES
@LIBGFOR_USE_SYMVER_SUN_TRUE@@libgfor_use_symver_t...@gfortran.map-sun : $(srcdir)/gfortran.map \
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@ $(top_srcdir)/../contrib/make_sunver.pl \