[Dune] [Dune-Commit] dune-grid r8493 - trunk/dune/grid/test

Martin Nolte nolte at mathematik.uni-freiburg.de
Fri Oct 5 13:14:40 CEST 2012


Hi Christian,

this GCC pool allocator looks interesting. What's the difference between this 
pool allocator and ours?

Best,

Martin

On 10/05/2012 12:05 PM, christi at dune-project.org wrote:
> Author: christi
> Date: 2012-10-05 12:05:45 +0200 (Fri, 05 Oct 2012)
> New Revision: 8493
>
> Modified:
>     trunk/dune/grid/test/test-geogrid.cc
> Log:
> test geometry grid with different allocators
>
> Modified: trunk/dune/grid/test/test-geogrid.cc
> ===================================================================
> --- trunk/dune/grid/test/test-geogrid.cc	2012-10-04 09:44:42 UTC (rev 8492)
> +++ trunk/dune/grid/test/test-geogrid.cc	2012-10-05 10:05:45 UTC (rev 8493)
> @@ -1,8 +1,21 @@
> +#ifdef HAVE_CONFIG_H
>   #include <config.h>
> +#endif
>
>   #ifdef COORDFUNCTION
>
> +#if defined __GNUC__ and not defined __clang__ and not defined __ICC
> +  #define GCCPOOL
> +#endif
> +
> +#include <dune/common/timer.hh>
> +
>   #include <dune/common/poolallocator.hh>
> +#include <dune/common/debugallocator.hh>
> +#ifdef GCCPOOL
> +#include <ext/pool_allocator.h>
> +#endif
> +
>   #include <dune/grid/geometrygrid.hh>
>   #include <dune/grid/geometrygrid/cachedcoordfunction.hh>
>   #include <dune/grid/io/file/dgfparser/dgfgeogrid.hh>
> @@ -17,7 +30,6 @@
>   #include "checkpartition.cc"
>   #include "checkgeometry.cc"
>
> -
>   namespace Dune
>   {
>
> @@ -52,8 +64,11 @@
>
>   typedef Dune::GeometryGrid< Grid, CoordFunction > GeometryGrid;
>   typedef Dune::GeometryGrid< Grid, CoordFunction, Dune::PoolAllocator< char, 16384 > > GeometryGridWithPoolAllocator;
> +#ifdef GCCPOOL
> +typedef Dune::GeometryGrid< Grid, CoordFunction, __gnu_cxx::__pool_alloc<char> > GeometryGridWithGCCPoolAllocator;
> +#endif
> +typedef Dune::GeometryGrid< Grid, CoordFunction, Dune::DebugAllocator<char> > GeometryGridWithDebugAllocator;
>
> -
>   template <class GeometryGridType>
>   void test(const std::string& gridfile)
>   {
> @@ -108,12 +123,30 @@
>         gridfile = argv[1];
>     }
>
> +  Dune::Timer watch;
> +
> +  watch.reset();
>     test<GeometryGrid>(gridfile);
> +  std::cout << "=== GeometryGrid took " << watch.elapsed() << " seconds\n";
>
>     // compile, but do not actually call, because it is not working yet
>     if (false)
> +  {
> +    watch.reset();
>       test<GeometryGridWithPoolAllocator>(gridfile);
> -
> +    std::cout << "=== GeometryGridWithPoolAllocator took " << watch.elapsed() << " seconds\n";
> +  }
> +
> +#ifdef GCCPOOL
> +  watch.reset();
> +  test<GeometryGridWithGCCPoolAllocator>(gridfile);
> +  std::cout << "=== GeometryGridWithGCCPoolAllocator took " << watch.elapsed() << " seconds\n";
> +#endif
> +
> +  watch.reset();
> +  test<GeometryGridWithDebugAllocator>(gridfile);
> +  std::cout << "=== GeometryGridWithDebugAllocator took " << watch.elapsed() << " seconds\n";
> +
>     return 0;
>   }
>   catch( const Dune::Exception &e )
> @@ -121,6 +154,11 @@
>     std::cerr << e << std::endl;
>     return 1;
>   }
> +catch( const std::exception &e )
> +{
> +  std::cerr << e.what() << std::endl;
> +  return 1;
> +}
>   catch( ... )
>   {
>     std::cerr << "Unknown exception raised." << std::endl;
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
>

-- 
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5630
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list