This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Tweak libgomp env vars in parallel make check (take 2)


On Fri, Nov 23, 2018 at 03:09:49PM +0100, Jakub Jelinek wrote:
> On Fri, Nov 23, 2018 at 02:57:44PM +0100, Martin Liška wrote:
> > > Unfortunately, haven't figured out how to convince automake that I want to
> > > write my own check-am goal, so had to drop dejagnu automake option and
> > > add all the dejagnu stuff manually.
> > 
> > Do it (at least partially) address https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66005 ?
> 
> That PR doesn't contain details (how many CPUs did the machines have, was it
> parallel make check and with what -jN), so hard to guess.
> 
> The patch certainly doesn't try to parallelize libgomp testsuite (i.e. run
> more than one libgomp test at the same time).
> 
> I'll see how much does it help in real-world testing later tonight.
> 
> All I can say from my logs is that on a quiet machine the patched libgomp
> make check-target-libgomp -j2 took 648s,
> make check-target-libgomp took 618s.
> Last night (nonpatched libgomp) and make -j32 -k check of everything
> libgomp took 1912s.  And two days ago, concurrent x86_64-linux and i686-linux
> make -j32 -k check of everything libgomp took 2626s (x86_64) and 3300s (i686).
> All times are wall clock in between the timestamps at the beginning and end
> of testsuite/libgomp.log.

In one of the several bootstraps on i686-linux, I got a couple of timeouts
with the GOMP_SPINCOUNT=1000 stuff, but never got any with those tweaks
removed.
So, I've committed this version for now, please let me know if there are any
issues with it:

2018-11-26  Jakub Jelinek  <jakub@redhat.com>

	* testsuite/Makefile.am (AUTOMAKE_OPTIONS): Drop dejagnu.
	(RUNTEST): Don't define.
	(RUNTESTDEFAULTFLAGS): Add.
	(check-DEJAGNU, site.exp, distclean-DEJAGNU): New goals.
	(distclean-am): Depend on distclean-DEJAGNU.
	(check-am): If -j% option is present in MFLAGS and if
	`getconf _NPROCESSORS_ONLN` is more than 8, export OMP_NUM_THREADS=8.
	(.PHONY): Add check-DEJAGNU and distclean-DEJAGNU.
	* testsuite/Makefile.in: Regenerated.

--- libgomp/testsuite/Makefile.am.jj	2018-11-01 12:06:00.933664590 +0100
+++ libgomp/testsuite/Makefile.am	2018-11-23 13:31:55.455302410 +0100
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in.
 
-AUTOMAKE_OPTIONS = foreign dejagnu
+AUTOMAKE_OPTIONS = foreign
 
 # May be used by various substitution variables.
 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@@ -10,8 +10,7 @@ EXPECT = $(shell if test -f $(top_buildd
 
 _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
 	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
-RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
-
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
 
 # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
 # following variables have to be "routed through" this Makefile, for expansion
@@ -24,4 +23,65 @@ libgomp-test-support.exp: libgomp-test-s
 	  'set offload_additional_lib_paths "$(offload_additional_lib_paths)"'
 	mv $@.tmp $@
 
+check-DEJAGNU: site.exp
+	srcdir='$(srcdir)'; export srcdir; \
+	EXPECT=$(EXPECT); export EXPECT; \
+	if $(SHELL) -c "$(_RUNTEST) --version" > /dev/null 2>&1; then \
+	  exit_status=0; l='$(PACKAGE)'; for tool in $$l; do \
+	    if $(_RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+	    then :; else exit_status=1; fi; \
+	  done; \
+	else echo "WARNING: could not find '$(_RUNTEST)'" 1>&2; :;\
+	fi; \
+	exit $$exit_status
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
+	@echo 'Making a new site.exp file ...'
+	@echo '## these variables are automatically generated by make ##' >site.tmp
+	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
+	@echo '# edit the last section' >>site.tmp
+	@echo 'set srcdir "$(srcdir)"' >>site.tmp
+	@echo "set objdir `pwd`" >>site.tmp
+	@echo 'set build_alias "$(build_alias)"' >>site.tmp
+	@echo 'set build_triplet $(build_triplet)' >>site.tmp
+	@echo 'set host_alias "$(host_alias)"' >>site.tmp
+	@echo 'set host_triplet $(host_triplet)' >>site.tmp
+	@echo 'set target_alias "$(target_alias)"' >>site.tmp
+	@echo 'set target_triplet $(target_triplet)' >>site.tmp
+	@list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+	  echo "## Begin content included from file $$f.  Do not modify. ##" \
+	   && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+	   && echo "## End content included from file $$f. ##" \
+	   || exit 1; \
+	 done >> site.tmp
+	@echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
+	@if test -f site.exp; then \
+	   sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
+	 fi
+	@-rm -f site.bak
+	@test ! -f site.exp || mv site.exp site.bak
+	@mv site.tmp site.exp
+
+distclean-DEJAGNU:
+	-rm -f site.exp site.bak
+	-l='$(PACKAGE)'; for tool in $$l; do \
+	  rm -f $$tool.sum $$tool.log; \
+	done
+distclean-am: distclean-DEJAGNU
+check-am:
+	@if test -n "$(filter -j%, $(MFLAGS))"; then \
+	  num_cpus=1; \
+	  if type -p getconf 2>/dev/null >/dev/null; then \
+	    num_cpus=`getconf _NPROCESSORS_ONLN 2>/dev/null`; \
+	    case "$$num_cpus" in \
+	      '' | 0* | *[!0-9]*) num_cpus=1;; \
+	    esac; \
+	  fi; \
+	  if test $$num_cpus -gt 8 && test -z "$$OMP_NUM_THREADS"; then \
+	    OMP_NUM_THREADS=8; export OMP_NUM_THREADS; \
+	    echo @@@ libgomp OMP_NUM_THREADS adjusted to 8 because of parallel make check and too many CPUs; \
+	  fi; \
+	fi; \
+	$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
 all-local: libgomp-test-support.exp
+
+.PHONY: check-DEJAGNU distclean-DEJAGNU
--- libgomp/testsuite/Makefile.in.jj	2018-11-01 12:06:00.933664590 +0100
+++ libgomp/testsuite/Makefile.in	2018-11-23 13:31:59.213239641 +0100
@@ -130,8 +130,6 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-DEJATOOL = $(PACKAGE)
-RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@@ -293,7 +291,7 @@ toolexeclibdir = @toolexeclibdir@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AUTOMAKE_OPTIONS = foreign dejagnu
+AUTOMAKE_OPTIONS = foreign
 
 # May be used by various substitution variables.
 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@@ -303,7 +301,7 @@ EXPECT = $(shell if test -f $(top_buildd
 _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
 	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 
-RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
 all: all-am
 
 .SUFFIXES:
@@ -350,52 +348,7 @@ ctags CTAGS:
 
 cscope cscopelist:
 
-
-check-DEJAGNU: site.exp
-	srcdir='$(srcdir)'; export srcdir; \
-	EXPECT=$(EXPECT); export EXPECT; \
-	if $(SHELL) -c "$(RUNTEST) --version" > /dev/null 2>&1; then \
-	  exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
-	    if $(RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
-	    then :; else exit_status=1; fi; \
-	  done; \
-	else echo "WARNING: could not find '$(RUNTEST)'" 1>&2; :;\
-	fi; \
-	exit $$exit_status
-site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
-	@echo 'Making a new site.exp file ...'
-	@echo '## these variables are automatically generated by make ##' >site.tmp
-	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
-	@echo '# edit the last section' >>site.tmp
-	@echo 'set srcdir "$(srcdir)"' >>site.tmp
-	@echo "set objdir `pwd`" >>site.tmp
-	@echo 'set build_alias "$(build_alias)"' >>site.tmp
-	@echo 'set build_triplet $(build_triplet)' >>site.tmp
-	@echo 'set host_alias "$(host_alias)"' >>site.tmp
-	@echo 'set host_triplet $(host_triplet)' >>site.tmp
-	@echo 'set target_alias "$(target_alias)"' >>site.tmp
-	@echo 'set target_triplet $(target_triplet)' >>site.tmp
-	@list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
-	  echo "## Begin content included from file $$f.  Do not modify. ##" \
-	   && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
-	   && echo "## End content included from file $$f. ##" \
-	   || exit 1; \
-	 done >> site.tmp
-	@echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
-	@if test -f site.exp; then \
-	   sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
-	 fi
-	@-rm -f site.bak
-	@test ! -f site.exp || mv site.exp site.bak
-	@mv site.tmp site.exp
-
-distclean-DEJAGNU:
-	-rm -f site.exp site.bak
-	-l='$(DEJATOOL)'; for tool in $$l; do \
-	  rm -f $$tool.sum $$tool.log; \
-	done
 check-am: all-am
-	$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
 check: check-am
 all-am: Makefile all-local
 installdirs:
@@ -435,8 +388,6 @@ clean-am: clean-generic clean-libtool mo
 
 distclean: distclean-am
 	-rm -f Makefile
-distclean-am: clean-am distclean-DEJAGNU distclean-generic
-
 dvi: dvi-am
 
 dvi-am:
@@ -495,20 +446,19 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: check-am install-am install-strip
+.MAKE: install-am install-strip
 
-.PHONY: all all-am all-local check check-DEJAGNU check-am clean \
-	clean-generic clean-libtool cscopelist-am ctags-am distclean \
-	distclean-DEJAGNU distclean-generic distclean-libtool 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-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
-	uninstall-am
+.PHONY: all all-am all-local check check-am clean clean-generic \
+	clean-libtool cscopelist-am ctags-am distclean \
+	distclean-generic distclean-libtool 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-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags-am uninstall uninstall-am
 
 .PRECIOUS: Makefile
 
@@ -524,8 +474,69 @@ libgomp-test-support.exp: libgomp-test-s
 	  'set offload_additional_lib_paths "$(offload_additional_lib_paths)"'
 	mv $@.tmp $@
 
+check-DEJAGNU: site.exp
+	srcdir='$(srcdir)'; export srcdir; \
+	EXPECT=$(EXPECT); export EXPECT; \
+	if $(SHELL) -c "$(_RUNTEST) --version" > /dev/null 2>&1; then \
+	  exit_status=0; l='$(PACKAGE)'; for tool in $$l; do \
+	    if $(_RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+	    then :; else exit_status=1; fi; \
+	  done; \
+	else echo "WARNING: could not find '$(_RUNTEST)'" 1>&2; :;\
+	fi; \
+	exit $$exit_status
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
+	@echo 'Making a new site.exp file ...'
+	@echo '## these variables are automatically generated by make ##' >site.tmp
+	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
+	@echo '# edit the last section' >>site.tmp
+	@echo 'set srcdir "$(srcdir)"' >>site.tmp
+	@echo "set objdir `pwd`" >>site.tmp
+	@echo 'set build_alias "$(build_alias)"' >>site.tmp
+	@echo 'set build_triplet $(build_triplet)' >>site.tmp
+	@echo 'set host_alias "$(host_alias)"' >>site.tmp
+	@echo 'set host_triplet $(host_triplet)' >>site.tmp
+	@echo 'set target_alias "$(target_alias)"' >>site.tmp
+	@echo 'set target_triplet $(target_triplet)' >>site.tmp
+	@list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+	  echo "## Begin content included from file $$f.  Do not modify. ##" \
+	   && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+	   && echo "## End content included from file $$f. ##" \
+	   || exit 1; \
+	 done >> site.tmp
+	@echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
+	@if test -f site.exp; then \
+	   sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
+	 fi
+	@-rm -f site.bak
+	@test ! -f site.exp || mv site.exp site.bak
+	@mv site.tmp site.exp
+
+distclean-DEJAGNU:
+	-rm -f site.exp site.bak
+	-l='$(PACKAGE)'; for tool in $$l; do \
+	  rm -f $$tool.sum $$tool.log; \
+	done
+distclean-am: distclean-DEJAGNU
+check-am:
+	@if test -n "$(filter -j%, $(MFLAGS))"; then \
+	  num_cpus=1; \
+	  if type -p getconf 2>/dev/null >/dev/null; then \
+	    num_cpus=`getconf _NPROCESSORS_ONLN 2>/dev/null`; \
+	    case "$$num_cpus" in \
+	      '' | 0* | *[!0-9]*) num_cpus=1;; \
+	    esac; \
+	  fi; \
+	  if test $$num_cpus -gt 8 && test -z "$$OMP_NUM_THREADS"; then \
+	    OMP_NUM_THREADS=8; export OMP_NUM_THREADS; \
+	    echo @@@ libgomp OMP_NUM_THREADS adjusted to 8 because of parallel make check and too many CPUs; \
+	  fi; \
+	fi; \
+	$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
 all-local: libgomp-test-support.exp
 
+.PHONY: check-DEJAGNU distclean-DEJAGNU
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]