← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/main] Rev 5458: Update parallel benchmark script to get test name and time as a tuple.

 

On Tue, Jan 4, 2011 at 8:37 PM,  <noreply@xxxxxxxxxxxxx> wrote:
> ------------------------------------------------------------
> revno: 5458
> committer: Garth N. Wells <gnw20@xxxxxxxxx>
> branch nick: dolfin-all
> timestamp: Tue 2011-01-04 19:27:33 +0000
> message:
>  Update parallel benchmark script to get test name and time as a tuple.
>
>  Fix solver choice in parallel benchmark.
> modified:
>  bench/fem/speedup/cpp/assemble-poisson.cpp
>  bench/fem/speedup/cpp/bench
>  bench/fem/speedup/cpp/solve-poisson.cpp
>
>
> --
> lp:dolfin
> https://code.launchpad.net/~dolfin-core/dolfin/main
>
> Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
> To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
>
> === modified file 'bench/fem/speedup/cpp/assemble-poisson.cpp'
> --- bench/fem/speedup/cpp/assemble-poisson.cpp  2010-09-09 11:12:20 +0000
> +++ bench/fem/speedup/cpp/assemble-poisson.cpp  2011-01-04 19:27:33 +0000
> @@ -37,7 +37,18 @@
>
>   // Report timing
>   if (dolfin::MPI::process_number() == 0)
> -    info("TIME: %.5g", t);
> +    info("TIME (first assembly): %.5g", t);
> +
> +  // Re-assemble matrix
> +  dolfin::MPI::barrier();
> +  t = time();
> +  assemble(A, a, false);
> +  dolfin::MPI::barrier();
> +  t = time() - t;
> +
> +  // Report timing
> +  if (dolfin::MPI::process_number() == 0)
> +    info("TIME (second assembly): %.5g", t);
>
>   return 0;
>  }
>
> === modified file 'bench/fem/speedup/cpp/bench'
> --- bench/fem/speedup/cpp/bench 2010-06-04 07:46:26 +0000
> +++ bench/fem/speedup/cpp/bench 2011-01-04 19:27:33 +0000
> @@ -5,21 +5,25 @@
>  __copyright__ = "Copyright (C) 2010 " + __author__
>  __license__  = "GNU LGPL Version 2.1"
>
> +# Modified by Garth N. Wells, 2011.
> +
>  import commands
>
> -print "Assembly/solve speedup running on 4 processors"
> -
>  # Parameters for benchmark
>  SIZE = 64
>  NUM_PROCS = 4
>
> -# Function for extracting time from benchmark
> +print "Assembly/solve speedup running on %s processors" % NUM_PROCS
> +
> +# Function for extracting test name and time from benchmark
>  def get_time(output):
> -    lines = [line for line in output.split("\n") if "TIME:" in line]
> -    if not len(lines) == 1:
> -        print output
> -        raise RuntimeError, "Not exactly one timing in benchmark."
> -    return float(lines[0].split("TIME:")[1])
> +    lines = [line for line in output.split("\n") if "TIME" in line]
> +    timing = []
> +    for line in lines:
> +        time = float(line.split(":")[-1])
> +        name = line.split(":")[-2].strip("TIME").strip(None).replace("(", "").replace(")", "")
> +        timing.append( (name, time) )
> +    return timing
>
>  # Serial assembly
>  output = commands.getoutput("./assemble-poisson %d" % SIZE)
> @@ -41,6 +45,10 @@
>  solve_t2 = get_time(output)
>  print "Parallel solve:", solve_t2
>
> -# Report results
> -print "BENCH assembly", assembly_t1 / assembly_t2
> -print "BENCH solve", solve_t1 / solve_t2
> +print "BENCH assembly"
> +for test1, test2  in zip(assembly_t1, assembly_t2):
> +    print "  ", test1[0] + ":", test1[1]/test2[1]
> +
> +print "BENCH solve"
> +for test1, test2  in zip(solve_t1, solve_t2):
> +    print "  ", test1[0] + ":", test1[1]/test2[1]

I think this change has broken the benchbot. This is what I get when I
run the main bench.py script:

Running benchmark fem-speedup-cpp...
Completed in 356.134 seconds

Traceback (most recent call last):
  File "bench.py", line 87, in <module>
    os.path.walk(".", run_bench, None)
  File "/usr/lib/python2.6/posixpath.py", line 233, in walk
    walk(name, func, arg)
  File "/usr/lib/python2.6/posixpath.py", line 233, in walk
    walk(name, func, arg)
  File "/usr/lib/python2.6/posixpath.py", line 233, in walk
    walk(name, func, arg)
  File "/usr/lib/python2.6/posixpath.py", line 225, in walk
    func(arg, top, names)
  File "bench.py", line 65, in run_bench
    timings[0] = ("", float(words[1]))
ValueError: invalid literal for float(): assembly


Johannes

> === modified file 'bench/fem/speedup/cpp/solve-poisson.cpp'
> --- bench/fem/speedup/cpp/solve-poisson.cpp     2010-09-09 11:12:20 +0000
> +++ bench/fem/speedup/cpp/solve-poisson.cpp     2011-01-04 19:27:33 +0000
> @@ -38,7 +38,7 @@
>   L.f = f;
>   VariationalProblem problem(a, L, bc);
>   info(problem.parameters, true);
> -  problem.parameters["linear_solver"] = "cg";
> +  problem.parameters["linear_solver"] = "gmres";
>   problem.parameters["preconditioner"] = "amg_hypre";
>   Function u(V);
>
>
>
>