Loading MeshBenchmarks.h +31 −31 Original line number Diff line number Diff line Loading @@ -76,17 +76,17 @@ 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 ) { // initialization is done at compile-time! (we can't access Mesh::Config::worldDimension at run-time because of linker errors) // TODO: fix this! (e.g. make Mesh::getWorldDimension() method) // constexpr int worldDimension = Mesh::Config::worldDimension; // initialization is done at compile-time! (we can't access Mesh::Config::spaceDimension at run-time because of linker errors) // TODO: fix this! (e.g. make Mesh::getSpaceDimension() method) // constexpr int spaceDimension = Mesh::Config::spaceDimension; Benchmark::MetadataColumns metadataColumns = { Logging::MetadataColumns metadataColumns = { // {"mesh-file", meshFile}, {"config", Mesh::Config::getConfigType()}, {"topology", getType< typename Mesh::Config::CellTopology >().replace("Topologies::", "")}, // {"wrld dim", worldDimension}, // {"space dim", spaceDimension}, {"real", getType< typename Mesh::RealType >()}, {"gid_t", getType< typename Mesh::GlobalIndexType >()}, {"lid_t", getType< typename Mesh::LocalIndexType >()}, Loading Loading @@ -139,7 +139,7 @@ struct MeshBenchmarks return true; } static void dispatchAlgorithms( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh ) static void dispatchAlgorithms( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh ) { Algorithms::staticFor< int, 1, Mesh::getMeshDimension() + 1 >( [&] ( auto dim ) { Loading @@ -159,8 +159,8 @@ struct MeshBenchmarks struct CentersDispatch { template< typename M, typename = typename std::enable_if< M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) typename = typename std::enable_if< M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type > static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { benchmark.setOperation( String("Centers (d = ") + convertToString(EntityDimension) + ")" ); benchmark_centers< EntityDimension, Devices::Host >( benchmark, parameters, mesh ); Loading @@ -170,9 +170,9 @@ struct MeshBenchmarks } template< typename M, typename = typename std::enable_if< ! M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type, typename = typename std::enable_if< ! M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; Loading @@ -181,8 +181,8 @@ struct MeshBenchmarks struct MeasuresDispatch { template< typename M, typename = typename std::enable_if< M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) typename = typename std::enable_if< M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type > static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { benchmark.setOperation( String("Measures (d = ") + convertToString(EntityDimension) + ")" ); benchmark_measures< EntityDimension, Devices::Host >( benchmark, parameters, mesh ); Loading @@ -192,9 +192,9 @@ struct MeshBenchmarks } template< typename M, typename = typename std::enable_if< ! M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type, typename = typename std::enable_if< ! M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; Loading @@ -207,7 +207,7 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Triangle >::value || std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value >::type > 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( "Dual M" ); benchmark_dual_measures< Devices::Host >( benchmark, parameters, mesh ); Loading @@ -223,7 +223,7 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; Loading @@ -235,7 +235,7 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Triangle >::value || std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value >::type > 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( "Spheres" ); benchmark_spheres< Devices::Host >( benchmark, parameters, mesh ); Loading @@ -250,13 +250,13 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; template< int EntityDimension, typename Device > static void benchmark_centers( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_centers( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { using Real = typename Mesh::RealType; using Index = typename Mesh::GlobalIndexType; Loading Loading @@ -301,7 +301,7 @@ struct MeshBenchmarks } template< int EntityDimension, typename Device > static void benchmark_measures( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_measures( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { using Real = typename Mesh::RealType; using Index = typename Mesh::GlobalIndexType; Loading Loading @@ -345,7 +345,7 @@ struct MeshBenchmarks } template< typename Device > static void benchmark_dual_measures( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_dual_measures( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { static_assert( std::is_same< typename Mesh::Config::CellTopology, Topologies::Edge >::value || std::is_same< typename Mesh::Config::CellTopology, Topologies::Triangle >::value || Loading Loading @@ -416,7 +416,7 @@ struct MeshBenchmarks } template< typename Device > static void benchmark_spheres( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_spheres( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { static_assert( std::is_same< typename Mesh::Config::CellTopology, Topologies::Triangle >::value || std::is_same< typename Mesh::Config::CellTopology, Topologies::Tetrahedron >::value, Loading Loading @@ -495,7 +495,7 @@ struct MeshBenchmarks template< template< typename, int, typename, typename, typename > class ConfigTemplate, typename CellTopology, int WorldDimension, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex > Loading @@ -506,24 +506,24 @@ struct MeshBenchmarksRunner // otherwise the compiler would always do implicit instead of explicit // instantiation. static bool run( Benchmark & benchmark, Benchmark::MetadataMap metadata, run( Benchmark<> & benchmark, Benchmark<>::MetadataMap metadata, const Config::ParameterContainer & parameters ); }; template< template< typename, int, typename, typename, typename > class ConfigTemplate, typename CellTopology, int WorldDimension, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex > bool MeshBenchmarksRunner< ConfigTemplate, CellTopology, WorldDimension, Real, GlobalIndex, LocalIndex >:: run( Benchmark & benchmark, Benchmark::MetadataMap metadata, MeshBenchmarksRunner< ConfigTemplate, CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >:: run( Benchmark<> & benchmark, Benchmark<>::MetadataMap metadata, const Config::ParameterContainer & parameters ) { using Config = ConfigTemplate< CellTopology, WorldDimension, Real, GlobalIndex, LocalIndex >; using Config = ConfigTemplate< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >; using MeshType = Mesh< Config, Devices::Host >; return MeshBenchmarks< MeshType >::run( benchmark, parameters ); } Loading MeshConfigs.h +14 −41 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ #include <TNL/Meshes/Topologies/SubentityVertexMap.h> template< typename Cell, int WorldDimension = Cell::dimension, int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > Loading @@ -27,7 +27,7 @@ struct FullConfig using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; static constexpr int worldDimension = WorldDimension; static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; static TNL::String getConfigType() Loading @@ -38,27 +38,15 @@ struct FullConfig /**** * Storage of subentities of mesh entities. */ template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } /**** * Storage of subentity orientations of mesh entities. * It must be false for vertices and cells. */ template< typename EntityTopology > static constexpr bool subentityOrientationStorage( EntityTopology, int SubentityDimension ) { return false; } /**** * Storage of superentities of mesh entities. */ template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } Loading @@ -66,8 +54,7 @@ struct FullConfig /**** * Storage of mesh entity tags. Boundary tags are necessary for the mesh traverser. */ template< typename EntityTopology > static constexpr bool entityTagsStorage( EntityTopology ) static constexpr bool entityTagsStorage( int entityDimension ) { return true; } Loading @@ -90,7 +77,7 @@ struct FullConfig }; template< typename Cell, int WorldDimension = Cell::dimension, int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > Loading @@ -101,7 +88,7 @@ struct MinimalConfig using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; static constexpr int worldDimension = WorldDimension; static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; static TNL::String getConfigType() Loading @@ -112,42 +99,28 @@ struct MinimalConfig /**** * Storage of subentities of mesh entities. */ template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) { return SubentityDimension == 0 || ( SubentityDimension == meshDimension - 1 && EntityTopology::dimension == meshDimension ); } /**** * Storage of subentity orientations of mesh entities. * It must be false for vertices and cells. */ template< typename EntityTopology > static constexpr bool subentityOrientationStorage( EntityTopology, int SubentityDimension ) static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return false; return subentityDimension == 0 || ( subentityDimension == meshDimension - 1 && entityDimension == meshDimension ); } /**** * Storage of superentities of mesh entities. */ template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return ( EntityTopology::dimension == 0 || EntityTopology::dimension == meshDimension - 1 ) && SuperentityDimension == meshDimension; return ( entityDimension == 0 || entityDimension == meshDimension - 1 ) && superentityDimension == meshDimension; } /**** * Storage of mesh entity tags. Boundary tags are necessary for the mesh traverser. */ template< typename EntityTopology > static constexpr bool entityTagsStorage( EntityTopology ) static constexpr bool entityTagsStorage( int entityDimension ) { // return false; // NOTE: needed for reorderEntities (could be optimized) using FaceTopology = typename TNL::Meshes::Topologies::Subtopology< CellTopology, meshDimension - 1 >::Topology; return superentityStorage( FaceTopology(), meshDimension ) && ( EntityTopology::dimension >= meshDimension - 1 || subentityStorage( FaceTopology(), EntityTopology::dimension ) ); return superentityStorage( meshDimension - 1, meshDimension ) && ( entityDimension >= meshDimension - 1 || subentityStorage( meshDimension - 1, entityDimension ) ); } /**** Loading tnl @ 5bf2e24d Compare bc4c3e2f to 5bf2e24d Original line number Diff line number Diff line Subproject commit bc4c3e2f7e7d9ca3960037c272e4b5b11828fe6f Subproject commit 5bf2e24da5c24c7bb2aac59685b4916e4487657b tnl-benchmark-mesh.h +21 −21 Original line number Diff line number Diff line Loading @@ -24,33 +24,33 @@ using namespace TNL::Meshes; using namespace TNL::Benchmarks; template< typename CellTopology, int WorldDimension = CellTopology::dimension, int SpaceDimension = CellTopology::dimension, typename... Params > bool setMeshParameters( Params&&... params ) { bool status = MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, long int, int >::run( std::forward<Params>(params)... ); bool status = MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, long int, int >::run( std::forward<Params>(params)... ); return status; } bool resolveCellTopology( Benchmark & benchmark, Benchmark::MetadataMap metadata, resolveCellTopology( Benchmark<> & benchmark, Logging::MetadataMap metadata, const Config::ParameterContainer & parameters ) { const String & meshFile = parameters.getParameter< String >( "mesh-file" ); Loading Loading @@ -131,10 +131,10 @@ main( int argc, char* argv[] ) std::ofstream logFile( logFileName.getString(), mode ); // init benchmark and common metadata Benchmark benchmark( loops, verbose ); Benchmark<> benchmark( loops, verbose ); // prepare global metadata Benchmark::MetadataMap metadata = getHardwareMetadata(); Logging::MetadataMap metadata = getHardwareMetadata(); if( ! resolveCellTopology( benchmark, metadata, parameters ) ) return EXIT_FAILURE; Loading Loading
MeshBenchmarks.h +31 −31 Original line number Diff line number Diff line Loading @@ -76,17 +76,17 @@ 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 ) { // initialization is done at compile-time! (we can't access Mesh::Config::worldDimension at run-time because of linker errors) // TODO: fix this! (e.g. make Mesh::getWorldDimension() method) // constexpr int worldDimension = Mesh::Config::worldDimension; // initialization is done at compile-time! (we can't access Mesh::Config::spaceDimension at run-time because of linker errors) // TODO: fix this! (e.g. make Mesh::getSpaceDimension() method) // constexpr int spaceDimension = Mesh::Config::spaceDimension; Benchmark::MetadataColumns metadataColumns = { Logging::MetadataColumns metadataColumns = { // {"mesh-file", meshFile}, {"config", Mesh::Config::getConfigType()}, {"topology", getType< typename Mesh::Config::CellTopology >().replace("Topologies::", "")}, // {"wrld dim", worldDimension}, // {"space dim", spaceDimension}, {"real", getType< typename Mesh::RealType >()}, {"gid_t", getType< typename Mesh::GlobalIndexType >()}, {"lid_t", getType< typename Mesh::LocalIndexType >()}, Loading Loading @@ -139,7 +139,7 @@ struct MeshBenchmarks return true; } static void dispatchAlgorithms( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh ) static void dispatchAlgorithms( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh ) { Algorithms::staticFor< int, 1, Mesh::getMeshDimension() + 1 >( [&] ( auto dim ) { Loading @@ -159,8 +159,8 @@ struct MeshBenchmarks struct CentersDispatch { template< typename M, typename = typename std::enable_if< M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) typename = typename std::enable_if< M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type > static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { benchmark.setOperation( String("Centers (d = ") + convertToString(EntityDimension) + ")" ); benchmark_centers< EntityDimension, Devices::Host >( benchmark, parameters, mesh ); Loading @@ -170,9 +170,9 @@ struct MeshBenchmarks } template< typename M, typename = typename std::enable_if< ! M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type, typename = typename std::enable_if< ! M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; Loading @@ -181,8 +181,8 @@ struct MeshBenchmarks struct MeasuresDispatch { template< typename M, typename = typename std::enable_if< M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) typename = typename std::enable_if< M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type > static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { benchmark.setOperation( String("Measures (d = ") + convertToString(EntityDimension) + ")" ); benchmark_measures< EntityDimension, Devices::Host >( benchmark, parameters, mesh ); Loading @@ -192,9 +192,9 @@ struct MeshBenchmarks } template< typename M, typename = typename std::enable_if< ! M::Config::subentityStorage( typename M::Config::CellTopology{}, 0 ) >::type, typename = typename std::enable_if< ! M::Config::subentityStorage( M::getMeshDimension(), 0 ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; Loading @@ -207,7 +207,7 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Triangle >::value || std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value >::type > 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( "Dual M" ); benchmark_dual_measures< Devices::Host >( benchmark, parameters, mesh ); Loading @@ -223,7 +223,7 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; Loading @@ -235,7 +235,7 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Triangle >::value || std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value >::type > 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( "Spheres" ); benchmark_spheres< Devices::Host >( benchmark, parameters, mesh ); Loading @@ -250,13 +250,13 @@ struct MeshBenchmarks std::is_same< typename M::Config::CellTopology, Topologies::Tetrahedron >::value ) >::type, typename = void > static void exec( Benchmark & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) static void exec( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const M & mesh ) { } }; template< int EntityDimension, typename Device > static void benchmark_centers( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_centers( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { using Real = typename Mesh::RealType; using Index = typename Mesh::GlobalIndexType; Loading Loading @@ -301,7 +301,7 @@ struct MeshBenchmarks } template< int EntityDimension, typename Device > static void benchmark_measures( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_measures( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { using Real = typename Mesh::RealType; using Index = typename Mesh::GlobalIndexType; Loading Loading @@ -345,7 +345,7 @@ struct MeshBenchmarks } template< typename Device > static void benchmark_dual_measures( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_dual_measures( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { static_assert( std::is_same< typename Mesh::Config::CellTopology, Topologies::Edge >::value || std::is_same< typename Mesh::Config::CellTopology, Topologies::Triangle >::value || Loading Loading @@ -416,7 +416,7 @@ struct MeshBenchmarks } template< typename Device > static void benchmark_spheres( Benchmark & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) static void benchmark_spheres( Benchmark<> & benchmark, const Config::ParameterContainer & parameters, const Mesh & mesh_src ) { static_assert( std::is_same< typename Mesh::Config::CellTopology, Topologies::Triangle >::value || std::is_same< typename Mesh::Config::CellTopology, Topologies::Tetrahedron >::value, Loading Loading @@ -495,7 +495,7 @@ struct MeshBenchmarks template< template< typename, int, typename, typename, typename > class ConfigTemplate, typename CellTopology, int WorldDimension, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex > Loading @@ -506,24 +506,24 @@ struct MeshBenchmarksRunner // otherwise the compiler would always do implicit instead of explicit // instantiation. static bool run( Benchmark & benchmark, Benchmark::MetadataMap metadata, run( Benchmark<> & benchmark, Benchmark<>::MetadataMap metadata, const Config::ParameterContainer & parameters ); }; template< template< typename, int, typename, typename, typename > class ConfigTemplate, typename CellTopology, int WorldDimension, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex > bool MeshBenchmarksRunner< ConfigTemplate, CellTopology, WorldDimension, Real, GlobalIndex, LocalIndex >:: run( Benchmark & benchmark, Benchmark::MetadataMap metadata, MeshBenchmarksRunner< ConfigTemplate, CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >:: run( Benchmark<> & benchmark, Benchmark<>::MetadataMap metadata, const Config::ParameterContainer & parameters ) { using Config = ConfigTemplate< CellTopology, WorldDimension, Real, GlobalIndex, LocalIndex >; using Config = ConfigTemplate< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >; using MeshType = Mesh< Config, Devices::Host >; return MeshBenchmarks< MeshType >::run( benchmark, parameters ); } Loading
MeshConfigs.h +14 −41 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ #include <TNL/Meshes/Topologies/SubentityVertexMap.h> template< typename Cell, int WorldDimension = Cell::dimension, int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > Loading @@ -27,7 +27,7 @@ struct FullConfig using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; static constexpr int worldDimension = WorldDimension; static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; static TNL::String getConfigType() Loading @@ -38,27 +38,15 @@ struct FullConfig /**** * Storage of subentities of mesh entities. */ template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } /**** * Storage of subentity orientations of mesh entities. * It must be false for vertices and cells. */ template< typename EntityTopology > static constexpr bool subentityOrientationStorage( EntityTopology, int SubentityDimension ) { return false; } /**** * Storage of superentities of mesh entities. */ template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } Loading @@ -66,8 +54,7 @@ struct FullConfig /**** * Storage of mesh entity tags. Boundary tags are necessary for the mesh traverser. */ template< typename EntityTopology > static constexpr bool entityTagsStorage( EntityTopology ) static constexpr bool entityTagsStorage( int entityDimension ) { return true; } Loading @@ -90,7 +77,7 @@ struct FullConfig }; template< typename Cell, int WorldDimension = Cell::dimension, int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > Loading @@ -101,7 +88,7 @@ struct MinimalConfig using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; static constexpr int worldDimension = WorldDimension; static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; static TNL::String getConfigType() Loading @@ -112,42 +99,28 @@ struct MinimalConfig /**** * Storage of subentities of mesh entities. */ template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) { return SubentityDimension == 0 || ( SubentityDimension == meshDimension - 1 && EntityTopology::dimension == meshDimension ); } /**** * Storage of subentity orientations of mesh entities. * It must be false for vertices and cells. */ template< typename EntityTopology > static constexpr bool subentityOrientationStorage( EntityTopology, int SubentityDimension ) static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return false; return subentityDimension == 0 || ( subentityDimension == meshDimension - 1 && entityDimension == meshDimension ); } /**** * Storage of superentities of mesh entities. */ template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return ( EntityTopology::dimension == 0 || EntityTopology::dimension == meshDimension - 1 ) && SuperentityDimension == meshDimension; return ( entityDimension == 0 || entityDimension == meshDimension - 1 ) && superentityDimension == meshDimension; } /**** * Storage of mesh entity tags. Boundary tags are necessary for the mesh traverser. */ template< typename EntityTopology > static constexpr bool entityTagsStorage( EntityTopology ) static constexpr bool entityTagsStorage( int entityDimension ) { // return false; // NOTE: needed for reorderEntities (could be optimized) using FaceTopology = typename TNL::Meshes::Topologies::Subtopology< CellTopology, meshDimension - 1 >::Topology; return superentityStorage( FaceTopology(), meshDimension ) && ( EntityTopology::dimension >= meshDimension - 1 || subentityStorage( FaceTopology(), EntityTopology::dimension ) ); return superentityStorage( meshDimension - 1, meshDimension ) && ( entityDimension >= meshDimension - 1 || subentityStorage( meshDimension - 1, entityDimension ) ); } /**** Loading
tnl @ 5bf2e24d Compare bc4c3e2f to 5bf2e24d Original line number Diff line number Diff line Subproject commit bc4c3e2f7e7d9ca3960037c272e4b5b11828fe6f Subproject commit 5bf2e24da5c24c7bb2aac59685b4916e4487657b
tnl-benchmark-mesh.h +21 −21 Original line number Diff line number Diff line Loading @@ -24,33 +24,33 @@ using namespace TNL::Meshes; using namespace TNL::Benchmarks; template< typename CellTopology, int WorldDimension = CellTopology::dimension, int SpaceDimension = CellTopology::dimension, typename... Params > bool setMeshParameters( Params&&... params ) { bool status = MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, WorldDimension, double, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, WorldDimension, double, long int, int >::run( std::forward<Params>(params)... ); bool status = MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< MinimalConfig, CellTopology, SpaceDimension, double, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, float, long int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, int, int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, long int, short int >::run( std::forward<Params>(params)... ) && MeshBenchmarksRunner< FullConfig, CellTopology, SpaceDimension, double, long int, int >::run( std::forward<Params>(params)... ); return status; } bool resolveCellTopology( Benchmark & benchmark, Benchmark::MetadataMap metadata, resolveCellTopology( Benchmark<> & benchmark, Logging::MetadataMap metadata, const Config::ParameterContainer & parameters ) { const String & meshFile = parameters.getParameter< String >( "mesh-file" ); Loading Loading @@ -131,10 +131,10 @@ main( int argc, char* argv[] ) std::ofstream logFile( logFileName.getString(), mode ); // init benchmark and common metadata Benchmark benchmark( loops, verbose ); Benchmark<> benchmark( loops, verbose ); // prepare global metadata Benchmark::MetadataMap metadata = getHardwareMetadata(); Logging::MetadataMap metadata = getHardwareMetadata(); if( ! resolveCellTopology( benchmark, metadata, parameters ) ) return EXIT_FAILURE; Loading