public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [libgomp, testsuite] Support parallel testing in libgomp (PR libgomp/66005)
@ 2015-05-07 11:27 Rainer Orth
  2015-05-07 11:39 ` Jakub Jelinek
  0 siblings, 1 reply; 12+ messages in thread
From: Rainer Orth @ 2015-05-07 11:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

As reported in the PR, with the addition of all those OpenACC tests,
libgomp make check times have skyrocketed since the testsuite is still
run sequentially.

Even on a reasonably fast x86 machine (4 x 2.0 Ghz Xeon E7450) the run
takes 4286 seconds.

On slower sparc boxes (1.2 GHz UltraSPARC-T2) we're at 29406 seconds,
compared to 7825 seconds on the 4.9 branch.

Thus, the libgomp tests massively slow down the whole testsuite run,
being the last part to finish.

Fixing this proved trivial: I managed to almost literally copy the
solution from libstdc++-v3/testsuite/Makefile.am, with a minimal change
to libgomp.exp so the generated libgomp-test-support.exp file is found
in both the sequential and parallel cases.  This isn't an issue in
libstdc++ since all necessary variables are stored in a single
site.exp.

Tested with make (1:13:53.80) and make -j128 (4:58.78) on
i386-pc-solaris2.11 (4 x 2.0 Ghz Xeon E7-4850), no differences in
results according to contrib/dg-cmp-results.sh.

Ok for mainline and gcc-5 branch after some soak time?

	Rainer


2015-05-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR libgomp/66005
	* testsuite/Makefile.am (PWD_COMMAND): New variable.
	(%/site.exp): New target.
	(check_p_numbers0, check_p_numbers1, check_p_numbers2)
	(check_p_numbers3, check_p_numbers4, check_p_numbers5)
	(check_p_numbers6, check_p_numbers, check_p_subdirs)
	(check_DEJAGNU_normal_targets): New variables.
	($(check_DEJAGNU_normal_targets)): New target.
	($(check_DEJAGNU_normal_targets)): New dependency.
	(check-DEJAGNU $(check_DEJAGNU_normal_targets)): New targets.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/lib/libgomp.exp: Also search in .. for
	libgomp-test-support.exp.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libgomp-testsuite-parallel.patch --]
[-- Type: text/x-patch, Size: 4130 bytes --]

# HG changeset patch
# Parent 56a827256364c7b567b751287defdb0c9eabc666
Support parallel testing in libgomp (PR libgomp/66005)

diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am
--- a/libgomp/testsuite/Makefile.am
+++ b/libgomp/testsuite/Makefile.am
@@ -12,6 +12,71 @@ EXPECT = $(shell if test -f $(top_buildd
 	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
 
+PWD_COMMAND = $${PWDCMD-pwd}
+
+%/site.exp: site.exp
+	-@test -d $* || mkdir $*
+	@srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
+	@objdir=`${PWD_COMMAND}`/$*; \
+	sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
+	    -e "s|^set objdir .*$$|set objdir $$objdir|" \
+	    site.exp > $*/site.exp.tmp
+	@-rm -f $*/site.bak
+	@test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
+	@mv $*/site.exp.tmp $*/site.exp
+
+check_p_numbers0:=1 2 3 4 5 6 7 8 9
+check_p_numbers1:=0 $(check_p_numbers0)
+check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
+check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
+check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
+check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
+check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
+check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
+check_p_subdirs=$(wordlist 1,$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128),$(check_p_numbers))
+check_DEJAGNU_normal_targets = $(addprefix check-DEJAGNUnormal,$(check_p_subdirs))
+$(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
+
+check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
+	$(if $*,@)AR="$(AR)"; export AR; \
+	RANLIB="$(RANLIB)"; export RANLIB; \
+	if [ -z "$*" ] && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
+	  rm -rf normal-parallel || true; \
+	  mkdir normal-parallel; \
+	  $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \
+	  rm -rf normal-parallel || true; \
+	  for idx in $(check_p_subdirs); do \
+	    if [ -d normal$$idx ]; then \
+	      mv -f normal$$idx/libgomp.sum normal$$idx/libgomp.sum.sep; \
+	      mv -f normal$$idx/libgomp.log normal$$idx/libgomp.log.sep; \
+	    fi; \
+	  done; \
+	  $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
+	    normal[0-9]*/libgomp.sum.sep > libgomp.sum; \
+	  $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
+	    normal[0-9]*/libgomp.log.sep > libgomp.log; \
+	  exit 0; \
+	fi; \
+	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+	EXPECT=$(EXPECT); export EXPECT; \
+	runtest=$(RUNTEST); \
+	if [ -z "$$runtest" ]; then runtest=runtest; fi; \
+	tool=libgomp; \
+	if [ -n "$*" ]; then \
+	  if [ -f normal-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \
+	  GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/normal-parallel; \
+	  export GCC_RUNTEST_PARALLELIZE_DIR; \
+	  cd "$*"; \
+	fi; \
+	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+	  $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
+		    $(RUNTESTFLAGS); \
+	  if [ -n "$*" ]; then \
+	    touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished; \
+	  fi; \
+	else \
+	  echo "WARNING: could not find \`runtest'" 1>&2; :;\
+	fi
 
 # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
 # following variables have to be "routed through" this Makefile, for expansion
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -33,7 +33,8 @@ load_gcc_lib torture-options.exp
 load_gcc_lib fortran-modules.exp
 
 # Try to load a test support file, built during libgomp configuration.
-load_file libgomp-test-support.exp
+# Search in both .. and . to support parallel and sequential testing.
+load_file -1 ../libgomp-test-support.exp libgomp-test-support.exp
 
 # Populate offload_targets_s (offloading targets separated by a space), and
 # offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-05-16 14:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07 11:27 [libgomp, testsuite] Support parallel testing in libgomp (PR libgomp/66005) Rainer Orth
2015-05-07 11:39 ` Jakub Jelinek
2015-05-07 18:07   ` Mike Stump
2015-05-08  8:40   ` Thomas Schwinge
2018-08-14  8:37     ` Martin Liška
2023-05-05  8:55     ` Support parallel testing in libgomp, part I [PR66005] Thomas Schwinge
2023-05-05  8:59       ` Support parallel testing in libgomp, part II [PR66005] Thomas Schwinge
2023-05-09 17:27         ` Bernhard Reutner-Fischer
2023-05-16 14:32         ` Support parallel testing in libgomp: fallback Perl 'flock' [PR66005] Thomas Schwinge
2023-05-06 14:15       ` Support parallel testing in libgomp, part I [PR66005] Bernhard Reutner-Fischer
2023-05-08 10:42         ` Thomas Schwinge
2023-05-08 17:52           ` Bernhard Reutner-Fischer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).