[Piglit] [PATCH] profile: Fix mixed concurrency runs
Dylan Baker
baker.dylan.c at gmail.com
Thu Apr 24 15:33:37 PDT 2014
On Friday, April 25, 2014 00:24:47 Marek Olšák wrote:
> I'm not sure I undertand this. I think the limitation for
> non-concurrent tests is that they cannot be concurrently, because they
> do front buffer rendering and other things. That doesn't mean all the
> off-screen tests cannot be run with the non-concurrent tests
> simultaneously.
>
> Marek
So the bug was that with no -c or -1 option both pools were executed
simultaneously, so a normal run ended up being concurrent with n+1
threads.
>
> On Thu, Apr 17, 2014 at 10:59 PM, Dylan Baker
<baker.dylan.c at gmail.com> wrote:
> > Currently we call join after initializing both of the pools, which means
> > that they run simultaneously. This patch fixes that by creating a helper
> > function which sets off the pool, closes it, and then joins it. This
> > fixes the problem by forcing each pool to run in series.
> >
> > Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> > ---
> >
> > framework/profile.py | 29 ++++++++++++++---------------
> > 1 file changed, 14 insertions(+), 15 deletions(-)
> >
> > diff --git a/framework/profile.py b/framework/profile.py
> > index 2e160e3..3def3e0 100644
> > --- a/framework/profile.py
> > +++ b/framework/profile.py
> >
> > @@ -119,6 +119,8 @@ class TestProfile(object):
> > self.prepare_test_list(env)
> > log = Log(len(self.test_list), env.verbose)
> >
> > + chunksize = 1
> > +
> >
> > def test(pair):
> > """ Function to call test.execute from .map
> >
> > @@ -128,33 +130,30 @@ class TestProfile(object):
> > name, test = pair
> > test.execute(name, log, json_writer, self.dmesg)
> >
> > + def run_threads(pool, testlist):
> > + """ Open a pool, close it, and join it """
> > + pool.imap(test, testlist, chunksize)
> > + pool.close()
> > + pool.join()
> > +
> >
> > # Multiprocessing.dummy is a wrapper around Threading that
> > provides a
> > # multiprocessing compatible API
> > #
> > # The default value of pool is the number of virtual processor
> > cores
> > single = multiprocessing.dummy.Pool(1)
> > multi = multiprocessing.dummy.Pool()
> >
> > - chunksize = 1
> >
> > if env.concurrent == "all":
> > - multi.imap(test, self.test_list.iteritems(), chunksize)
> > + run_threads(multi, self.test_list.iteritems())
> >
> > elif env.concurrent == "none":
> > - single.imap(test, self.test_list.iteritems(), chunksize)
> > + run_threads(single, self.test_list.iteritems())
> >
> > else:
> > # Filter and return only thread safe tests to the threaded
> > pool
> >
> > - multi.imap(test, (x for x in self.test_list.iteritems() if
> > - x[1].run_concurrent), chunksize)
> > + run_threads(multi, (x for x in self.test_list.iteritems() if
> > + x[1].run_concurrent))
> >
> > # Filter and return the non thread safe tests to the single
> > pool
> >
> > - single.imap(test, (x for x in self.test_list.iteritems() if
> > not - x[1].run_concurrent), chunksize)
> > -
> > - # Close and join the pools
> > - # If we don't close and the join the pools the script will exit
> > before - # the pools finish running
> > - multi.close()
> > - single.close()
> > - multi.join()
> > - single.join()
> > + run_threads(multi, (x for x in self.test_list.iteritems() if
> > not + x[1].run_concurrent))
> >
> > log.summary()
> >
> > --
> > 1.9.2
> >
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140424/3c62d33d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140424/3c62d33d/attachment-0001.sig>
More information about the Piglit
mailing list