Loading src/Benchmarks/Mesh/MemoryInfo.h +2 −2 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ getSelfPhysicalMemory() } #include <Benchmarks/Benchmarks.h> #include <TNL/Benchmarks/Benchmarks.h> #include <TNL/Config/ParameterContainer.h> #include <TNL/Containers/StaticVector.h> Loading src/Benchmarks/Mesh/MeshBenchmarks.h +24 −25 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /* See Copyright Notice in tnl/Copyright */ // Implemented by: Jakub Klinkovsky // Implemented by: Ján Bobot, Jakub Klinkovský #pragma once Loading @@ -22,7 +22,7 @@ #include <TNL/Meshes/TypeResolver/resolveMeshType.h> #include <TNL/Meshes/Readers/MeshReader.h> #include <TNL/Meshes/Topologies/IsDynamicTopology.h> #include <Benchmarks/Benchmarks.h> #include <TNL/Benchmarks/Benchmarks.h> #include "MeshConfigs.h" #include "MemoryInfo.h" Loading Loading @@ -56,9 +56,9 @@ struct MeshBenchmarks { static_assert( std::is_same< typename Mesh::DeviceType, Devices::Host >::value, "The mesh should be loaded on the host." ); static bool run( Benchmark & benchmark, const Config::ParameterContainer & parameters ) static bool run( Benchmark<> & benchmark, const Config::ParameterContainer & parameters ) { Benchmark::MetadataColumns metadataColumns = { Logging::MetadataColumns metadataColumns = { // {"mesh-file", meshFile}, {"config", Mesh::Config::getConfigType()}, //{"topology", removeNamespaces( getType< typename Mesh::Config::CellTopology >() ) }, Loading @@ -67,6 +67,7 @@ struct MeshBenchmarks //{"gid_t", getType< typename Mesh::GlobalIndexType >()}, //{"lid_t", getType< typename Mesh::LocalIndexType >()} }; benchmark.setMetadataColumns( metadataColumns ); const String & meshFile = parameters.getParameter< String >( "mesh-file" ); auto reader = getMeshReader( meshFile, "auto" ); Loading @@ -80,13 +81,12 @@ struct MeshBenchmarks return false; } benchmark.setMetadataColumns( metadataColumns ); dispatchTests( benchmark, parameters, mesh, reader ); return true; } static void dispatchTests( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh, std::shared_ptr< MeshReader > reader ) static void dispatchTests( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh, std::shared_ptr< MeshReader > reader ) { ReaderDispatch::exec( benchmark, parameters, reader ); InitDispatch::exec( benchmark, parameters, reader ); Loading @@ -99,7 +99,7 @@ struct MeshBenchmarks struct ReaderDispatch { static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { benchmark.setOperation( String( "Reader" ) ); benchmark_reader( benchmark, parameters, reader ); Loading @@ -108,7 +108,7 @@ struct MeshBenchmarks struct InitDispatch { static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { benchmark.setOperation( String( "Init" ) ); benchmark_init( benchmark, parameters, reader ); Loading @@ -120,7 +120,7 @@ struct MeshBenchmarks // Polygonal Mesh template< typename M, std::enable_if_t< std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value, bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { benchmark.setOperation( String( "Decomposition (c)" ) ); benchmark_decomposition< EntityDecomposerVersion::ConnectEdgesToCentroid >( benchmark, parameters, mesh_src ); Loading @@ -132,7 +132,7 @@ struct MeshBenchmarks // Polyhedral Mesh template< typename M, std::enable_if_t< std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value, bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { benchmark.setOperation( String( "Decomposition (cc)" ) ); benchmark_decomposition< EntityDecomposerVersion::ConnectEdgesToCentroid, Loading @@ -155,7 +155,7 @@ struct MeshBenchmarks template< typename M, std::enable_if_t< ! std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value && ! std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value, bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { } }; Loading @@ -166,7 +166,7 @@ struct MeshBenchmarks std::enable_if_t< M::Config::spaceDimension == 3 && (std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value || std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value ), bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { benchmark.setOperation( String( "Planar Correction (c)" ) ); benchmark_planar< EntityDecomposerVersion::ConnectEdgesToCentroid >( benchmark, parameters, mesh_src ); Loading @@ -179,7 +179,7 @@ struct MeshBenchmarks std::enable_if_t< M::Config::spaceDimension < 3 || (! std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value && ! std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value ), bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { } }; Loading @@ -187,7 +187,7 @@ struct MeshBenchmarks struct MeasuresDispatch { template< typename M > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { benchmark.setOperation( String("Measures") ); benchmark_measures< Devices::Host >( benchmark, parameters, mesh ); Loading @@ -200,7 +200,7 @@ struct MeshBenchmarks struct MemoryDispatch { template< typename M > static void exec( Benchmark& benchmark, const Config::ParameterContainer& parameters, const M& mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer& parameters, const M& mesh_src ) { benchmark.setOperation( String("Memory") ); benchmark_memory( benchmark, parameters, mesh_src ); Loading @@ -210,7 +210,7 @@ struct MeshBenchmarks struct CopyDispatch { template< typename M > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { #ifdef HAVE_CUDA benchmark.setOperation( String("Copy CPU->GPU") ); Loading @@ -221,7 +221,7 @@ struct MeshBenchmarks } }; static void benchmark_reader( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void benchmark_reader( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -239,7 +239,7 @@ struct MeshBenchmarks benchmark_func ); } static void benchmark_init( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void benchmark_init( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -261,7 +261,7 @@ struct MeshBenchmarks template< EntityDecomposerVersion DecomposerVersion, EntityDecomposerVersion SubDecomposerVersion = EntityDecomposerVersion::ConnectEdgesToPoint, typename M > static void benchmark_decomposition( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_decomposition( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { // skip benchmarks on devices which the user did not select if( ! checkDevice< Devices::Host >( parameters ) ) Loading @@ -280,7 +280,7 @@ struct MeshBenchmarks std::enable_if_t< M::Config::spaceDimension == 3 && (std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value || std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value ), bool > = true > static void benchmark_planar( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_planar( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -295,7 +295,7 @@ struct MeshBenchmarks template< typename Device, typename M > static void benchmark_measures( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_measures( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { using Real = typename M::RealType; using Index = typename M::GlobalIndexType; Loading Loading @@ -339,7 +339,7 @@ struct MeshBenchmarks } template< typename M > static void benchmark_memory( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_memory( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -352,7 +352,7 @@ struct MeshBenchmarks template< typename DeviceFrom, typename DeviceTo, typename M > static void benchmark_copy( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_copy( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { using MeshFrom = Meshes::Mesh< typename M::Config, DeviceFrom >; using MeshTo = Meshes::Mesh< typename M::Config, DeviceTo >; Loading Loading @@ -386,8 +386,7 @@ template< template< typename, int, typename, typename, typename > class ConfigTe struct MeshBenchmarksRunner { static bool run( Benchmark & benchmark, Benchmark::MetadataMap metadata, run( Benchmark<> & benchmark, const Config::ParameterContainer & parameters ) { using Config = ConfigTemplate< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >; Loading src/Benchmarks/Mesh/tnl-benchmark-mesh.h +12 −19 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /* See Copyright Notice in tnl/Copyright */ // Implemented by: Jakub Klinkovsky // Implemented by: Ján Bobot, Jakub Klinkovský #pragma once Loading Loading @@ -38,14 +38,11 @@ setMeshParameters( Params&&... params ) } bool resolveCellTopology( Benchmark& benchmark, Benchmark::MetadataMap metadata, resolveCellTopology( Benchmark<> & benchmark, const Config::ParameterContainer& parameters ) { const String & meshFile = parameters.getParameter< String >( "mesh-file" ); benchmark.newBenchmark( meshFile, metadata ); auto reader = getMeshReader( meshFile, "auto" ); try { Loading @@ -66,22 +63,22 @@ resolveCellTopology( Benchmark& benchmark, switch( reader->getCellShape() ) { case EntityShape::Triangle: return setMeshParameters< Topologies::Triangle >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Triangle >( benchmark, parameters ); case EntityShape::Tetra: return setMeshParameters< Topologies::Tetrahedron >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Tetrahedron >( benchmark, parameters ); case EntityShape::Polygon: switch( reader->getSpaceDimension() ) { case 2: return setMeshParameters< Topologies::Polygon, 2 >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Polygon, 2 >( benchmark, parameters ); case 3: return setMeshParameters< Topologies::Polygon, 3 >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Polygon, 3 >( benchmark, parameters ); default: std::cerr << "unsupported dimension for polygon mesh: " << reader->getSpaceDimension() << std::endl; return false; } case EntityShape::Polyhedron: return setMeshParameters< Topologies::Polyhedron >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Polyhedron >( benchmark, parameters ); default: std::cerr << "unsupported cell topology: " << getShapeName( reader->getCellShape() ) << std::endl; return false; Loading Loading @@ -138,18 +135,14 @@ main( int argc, char* argv[] ) std::ofstream logFile( logFileName.getString(), mode ); // init benchmark and common metadata Benchmark benchmark( loops, verbose ); // prepare global metadata Benchmark::MetadataMap metadata = getHardwareMetadata(); Benchmark<> benchmark( logFile, loops, verbose ); if( ! resolveCellTopology( benchmark, metadata, parameters ) ) return EXIT_FAILURE; // write global metadata into a separate file std::map< std::string, std::string > metadata = getHardwareMetadata(); writeMapAsJson( metadata, logFileName, ".metadata.json" ); if( ! benchmark.save( logFile ) ) { std::cerr << "Failed to write the benchmark results to file '" << parameters.getParameter< String >( "log-file" ) << "'." << std::endl; if( ! resolveCellTopology( benchmark, parameters ) ) return EXIT_FAILURE; } return EXIT_SUCCESS; } Loading
src/Benchmarks/Mesh/MemoryInfo.h +2 −2 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ getSelfPhysicalMemory() } #include <Benchmarks/Benchmarks.h> #include <TNL/Benchmarks/Benchmarks.h> #include <TNL/Config/ParameterContainer.h> #include <TNL/Containers/StaticVector.h> Loading
src/Benchmarks/Mesh/MeshBenchmarks.h +24 −25 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /* See Copyright Notice in tnl/Copyright */ // Implemented by: Jakub Klinkovsky // Implemented by: Ján Bobot, Jakub Klinkovský #pragma once Loading @@ -22,7 +22,7 @@ #include <TNL/Meshes/TypeResolver/resolveMeshType.h> #include <TNL/Meshes/Readers/MeshReader.h> #include <TNL/Meshes/Topologies/IsDynamicTopology.h> #include <Benchmarks/Benchmarks.h> #include <TNL/Benchmarks/Benchmarks.h> #include "MeshConfigs.h" #include "MemoryInfo.h" Loading Loading @@ -56,9 +56,9 @@ struct MeshBenchmarks { static_assert( std::is_same< typename Mesh::DeviceType, Devices::Host >::value, "The mesh should be loaded on the host." ); static bool run( Benchmark & benchmark, const Config::ParameterContainer & parameters ) static bool run( Benchmark<> & benchmark, const Config::ParameterContainer & parameters ) { Benchmark::MetadataColumns metadataColumns = { Logging::MetadataColumns metadataColumns = { // {"mesh-file", meshFile}, {"config", Mesh::Config::getConfigType()}, //{"topology", removeNamespaces( getType< typename Mesh::Config::CellTopology >() ) }, Loading @@ -67,6 +67,7 @@ struct MeshBenchmarks //{"gid_t", getType< typename Mesh::GlobalIndexType >()}, //{"lid_t", getType< typename Mesh::LocalIndexType >()} }; benchmark.setMetadataColumns( metadataColumns ); const String & meshFile = parameters.getParameter< String >( "mesh-file" ); auto reader = getMeshReader( meshFile, "auto" ); Loading @@ -80,13 +81,12 @@ struct MeshBenchmarks return false; } benchmark.setMetadataColumns( metadataColumns ); dispatchTests( benchmark, parameters, mesh, reader ); return true; } static void dispatchTests( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh, std::shared_ptr< MeshReader > reader ) static void dispatchTests( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh, std::shared_ptr< MeshReader > reader ) { ReaderDispatch::exec( benchmark, parameters, reader ); InitDispatch::exec( benchmark, parameters, reader ); Loading @@ -99,7 +99,7 @@ struct MeshBenchmarks struct ReaderDispatch { static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { benchmark.setOperation( String( "Reader" ) ); benchmark_reader( benchmark, parameters, reader ); Loading @@ -108,7 +108,7 @@ struct MeshBenchmarks struct InitDispatch { static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { benchmark.setOperation( String( "Init" ) ); benchmark_init( benchmark, parameters, reader ); Loading @@ -120,7 +120,7 @@ struct MeshBenchmarks // Polygonal Mesh template< typename M, std::enable_if_t< std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value, bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { benchmark.setOperation( String( "Decomposition (c)" ) ); benchmark_decomposition< EntityDecomposerVersion::ConnectEdgesToCentroid >( benchmark, parameters, mesh_src ); Loading @@ -132,7 +132,7 @@ struct MeshBenchmarks // Polyhedral Mesh template< typename M, std::enable_if_t< std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value, bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { benchmark.setOperation( String( "Decomposition (cc)" ) ); benchmark_decomposition< EntityDecomposerVersion::ConnectEdgesToCentroid, Loading @@ -155,7 +155,7 @@ struct MeshBenchmarks template< typename M, std::enable_if_t< ! std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value && ! std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value, bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { } }; Loading @@ -166,7 +166,7 @@ struct MeshBenchmarks std::enable_if_t< M::Config::spaceDimension == 3 && (std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value || std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value ), bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { benchmark.setOperation( String( "Planar Correction (c)" ) ); benchmark_planar< EntityDecomposerVersion::ConnectEdgesToCentroid >( benchmark, parameters, mesh_src ); Loading @@ -179,7 +179,7 @@ struct MeshBenchmarks std::enable_if_t< M::Config::spaceDimension < 3 || (! std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value && ! std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value ), bool > = true > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { } }; Loading @@ -187,7 +187,7 @@ struct MeshBenchmarks struct MeasuresDispatch { template< typename M > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { benchmark.setOperation( String("Measures") ); benchmark_measures< Devices::Host >( benchmark, parameters, mesh ); Loading @@ -200,7 +200,7 @@ struct MeshBenchmarks struct MemoryDispatch { template< typename M > static void exec( Benchmark& benchmark, const Config::ParameterContainer& parameters, const M& mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer& parameters, const M& mesh_src ) { benchmark.setOperation( String("Memory") ); benchmark_memory( benchmark, parameters, mesh_src ); Loading @@ -210,7 +210,7 @@ struct MeshBenchmarks struct CopyDispatch { template< typename M > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { #ifdef HAVE_CUDA benchmark.setOperation( String("Copy CPU->GPU") ); Loading @@ -221,7 +221,7 @@ struct MeshBenchmarks } }; static void benchmark_reader( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void benchmark_reader( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -239,7 +239,7 @@ struct MeshBenchmarks benchmark_func ); } static void benchmark_init( Benchmark & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) static void benchmark_init( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, std::shared_ptr< MeshReader > reader ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -261,7 +261,7 @@ struct MeshBenchmarks template< EntityDecomposerVersion DecomposerVersion, EntityDecomposerVersion SubDecomposerVersion = EntityDecomposerVersion::ConnectEdgesToPoint, typename M > static void benchmark_decomposition( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_decomposition( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { // skip benchmarks on devices which the user did not select if( ! checkDevice< Devices::Host >( parameters ) ) Loading @@ -280,7 +280,7 @@ struct MeshBenchmarks std::enable_if_t< M::Config::spaceDimension == 3 && (std::is_same< typename M::Config::CellTopology, Topologies::Polygon >::value || std::is_same< typename M::Config::CellTopology, Topologies::Polyhedron >::value ), bool > = true > static void benchmark_planar( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_planar( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -295,7 +295,7 @@ struct MeshBenchmarks template< typename Device, typename M > static void benchmark_measures( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_measures( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { using Real = typename M::RealType; using Index = typename M::GlobalIndexType; Loading Loading @@ -339,7 +339,7 @@ struct MeshBenchmarks } template< typename M > static void benchmark_memory( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_memory( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { if( ! checkDevice< Devices::Host >( parameters ) ) return; Loading @@ -352,7 +352,7 @@ struct MeshBenchmarks template< typename DeviceFrom, typename DeviceTo, typename M > static void benchmark_copy( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) static void benchmark_copy( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh_src ) { using MeshFrom = Meshes::Mesh< typename M::Config, DeviceFrom >; using MeshTo = Meshes::Mesh< typename M::Config, DeviceTo >; Loading Loading @@ -386,8 +386,7 @@ template< template< typename, int, typename, typename, typename > class ConfigTe struct MeshBenchmarksRunner { static bool run( Benchmark & benchmark, Benchmark::MetadataMap metadata, run( Benchmark<> & benchmark, const Config::ParameterContainer & parameters ) { using Config = ConfigTemplate< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >; Loading
src/Benchmarks/Mesh/tnl-benchmark-mesh.h +12 −19 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /* See Copyright Notice in tnl/Copyright */ // Implemented by: Jakub Klinkovsky // Implemented by: Ján Bobot, Jakub Klinkovský #pragma once Loading Loading @@ -38,14 +38,11 @@ setMeshParameters( Params&&... params ) } bool resolveCellTopology( Benchmark& benchmark, Benchmark::MetadataMap metadata, resolveCellTopology( Benchmark<> & benchmark, const Config::ParameterContainer& parameters ) { const String & meshFile = parameters.getParameter< String >( "mesh-file" ); benchmark.newBenchmark( meshFile, metadata ); auto reader = getMeshReader( meshFile, "auto" ); try { Loading @@ -66,22 +63,22 @@ resolveCellTopology( Benchmark& benchmark, switch( reader->getCellShape() ) { case EntityShape::Triangle: return setMeshParameters< Topologies::Triangle >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Triangle >( benchmark, parameters ); case EntityShape::Tetra: return setMeshParameters< Topologies::Tetrahedron >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Tetrahedron >( benchmark, parameters ); case EntityShape::Polygon: switch( reader->getSpaceDimension() ) { case 2: return setMeshParameters< Topologies::Polygon, 2 >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Polygon, 2 >( benchmark, parameters ); case 3: return setMeshParameters< Topologies::Polygon, 3 >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Polygon, 3 >( benchmark, parameters ); default: std::cerr << "unsupported dimension for polygon mesh: " << reader->getSpaceDimension() << std::endl; return false; } case EntityShape::Polyhedron: return setMeshParameters< Topologies::Polyhedron >( benchmark, metadata, parameters ); return setMeshParameters< Topologies::Polyhedron >( benchmark, parameters ); default: std::cerr << "unsupported cell topology: " << getShapeName( reader->getCellShape() ) << std::endl; return false; Loading Loading @@ -138,18 +135,14 @@ main( int argc, char* argv[] ) std::ofstream logFile( logFileName.getString(), mode ); // init benchmark and common metadata Benchmark benchmark( loops, verbose ); // prepare global metadata Benchmark::MetadataMap metadata = getHardwareMetadata(); Benchmark<> benchmark( logFile, loops, verbose ); if( ! resolveCellTopology( benchmark, metadata, parameters ) ) return EXIT_FAILURE; // write global metadata into a separate file std::map< std::string, std::string > metadata = getHardwareMetadata(); writeMapAsJson( metadata, logFileName, ".metadata.json" ); if( ! benchmark.save( logFile ) ) { std::cerr << "Failed to write the benchmark results to file '" << parameters.getParameter< String >( "log-file" ) << "'." << std::endl; if( ! resolveCellTopology( benchmark, parameters ) ) return EXIT_FAILURE; } return EXIT_SUCCESS; }