-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added submodule google/benchmark added first benchmark for feel++ on mesh (loadmesh and updateForUse)
- Loading branch information
Showing
8 changed files
with
297 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
### CMakeLists.txt; coding: utf-8 --- | ||
|
||
# Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org> | ||
# Date: 07 Apr 2019 | ||
# | ||
# Copyright (C) 2019 Feel++ Consortium | ||
# | ||
# Distributed under the GPL(GNU Public License): | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
# | ||
# | ||
|
||
|
||
cmake_minimum_required(VERSION 3.7.2) | ||
|
||
project(benchmarks) | ||
set(PROJECT_SHORTNAME "bench") | ||
|
||
# with this it is possible to compile applications/models from an installed | ||
# version of feel++. This is useful also for staged compilation for docker | ||
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} ) | ||
find_package(Feel++ PATHS ${FEELPP_DIR}/share/feelpp/feel/cmake/modules $ENV{FEELPP_DIR}/share/feelpp/feel/cmake/modules /usr/share/feelpp/feel/cmake/modules /usr/local/share/feelpp/feel/cmake/modules ) | ||
if(NOT FEELPP_FOUND) | ||
message(FATAL_ERROR "Feel++ was not found on your system. Make sure to install it and specify the FEELPP_DIR to reference the installation directory.") | ||
endif() | ||
else() | ||
feelpp_get_environment() | ||
# usefull for pyfeelpp-toolboxes | ||
set(FEELPP_DIR ${CMAKE_INSTALL_PREFIX}) | ||
endif() | ||
|
||
feelppGitSubmodulePrepare( benchmark ) | ||
include_directories(${CMAKE_SOURCE_DIR}/benchmarks/benchmark/include) | ||
set( BENCHMARK_ENABLE_GTEST_TESTS OFF) | ||
add_subdirectory(benchmark) | ||
add_subdirectory(feelpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
### CMakeLists.txt; coding: utf-8 --- | ||
|
||
# Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org> | ||
# Date: 07 Apr 2019 | ||
# | ||
# Copyright (C) 2019 Feel++ Consortium | ||
# | ||
# Distributed under the GPL(GNU Public License): | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
# | ||
# | ||
|
||
feelpp_add_application( env SRCS env.cpp LINK_LIBRARIES benchmark ) | ||
feelpp_add_application( mesh SRCS mesh.cpp LINK_LIBRARIES benchmark ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//! -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=cpp:et:sw=4:ts=4:sts=4 | ||
//! | ||
//! This file is part of the Feel++ library | ||
//! | ||
//! This library is free software; you can redistribute it and/or | ||
//! modify it under the terms of the GNU Lesser General Public | ||
//! License as published by the Free Software Foundation; either | ||
//! version 2.1 of the License, or (at your option) any later version. | ||
//! | ||
//! This library is distributed in the hope that it will be useful, | ||
//! but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
//! Lesser General Public License for more details. | ||
//! | ||
//! You should have received a copy of the GNU Lesser General Public | ||
//! License along with this library; if not, write to the Free Software | ||
//! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
//! | ||
//! @file | ||
//! @author Christophe Prud'homme <christophe.prudhomme@feelpp.org> | ||
//! @date 07 Apr 2019 | ||
//! @copyright 2019 Feel++ Consortium | ||
//! | ||
|
||
#include <benchmark/benchmark.h> | ||
#include <feel/feelcore/environment.hpp> | ||
|
||
// loadmesh | ||
|
||
static void BM_env(benchmark::State& st) | ||
{ | ||
using namespace Feel; | ||
for (auto _ : st) | ||
{ | ||
} | ||
}; | ||
BENCHMARK(BM_env)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10); | ||
//benchmark::internal::Benchmark* dummy1 = benchmark::RegisterBenchmark( | ||
// "BM_env_registration", BM_env); | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
benchmark::Initialize(&argc, argv); | ||
benchmark::RunSpecifiedBenchmarks(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
//! -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=cpp:et:sw=4:ts=4:sts=4 | ||
//! | ||
//! This file is part of the Feel++ library | ||
//! | ||
//! This library is free software; you can redistribute it and/or | ||
//! modify it under the terms of the GNU Lesser General Public | ||
//! License as published by the Free Software Foundation; either | ||
//! version 2.1 of the License, or (at your option) any later version. | ||
//! | ||
//! This library is distributed in the hope that it will be useful, | ||
//! but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
//! Lesser General Public License for more details. | ||
//! | ||
//! You should have received a copy of the GNU Lesser General Public | ||
//! License along with this library; if not, write to the Free Software | ||
//! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
//! | ||
//! @file | ||
//! @author Christophe Prud'homme <christophe.prudhomme@feelpp.org> | ||
//! @date 07 Apr 2019 | ||
//! @copyright 2019 Feel++ Consortium | ||
//! | ||
|
||
#include <benchmark/benchmark.h> | ||
#include <feel/feelfilters/loadmesh.hpp> | ||
|
||
using namespace Feel; | ||
// loadmesh | ||
void BM_Loadmesh3D( benchmark::State& state ) | ||
{ | ||
using namespace Feel; | ||
size_type nitems; | ||
for (auto _ : state) | ||
{ | ||
using mesh_t = Mesh<Simplex<3>>; | ||
auto m = loadMesh( _mesh=new mesh_t, | ||
_filename="hypercube-"+std::to_string(state.range(0))+".msh", | ||
_savehdf5=false,_verbose=false, | ||
_update=0, _h=1./state.range(0) ); | ||
nitems=m->numElements(); | ||
} | ||
state.SetItemsProcessed( nitems ); | ||
} | ||
BENCHMARK(BM_Loadmesh3D)->Unit(benchmark::kMillisecond)->Arg(4)->Arg(8)->Arg(16);//->Arg(32); | ||
|
||
// loadmesh | ||
template<typename MeshT> | ||
void BM_updateForUse( benchmark::State& state ) | ||
{ | ||
using namespace Feel; | ||
using mesh_t = MeshT; | ||
const int nDim = mesh_t::nDim; | ||
|
||
size_type nitems; | ||
for (auto _ : state) | ||
{ | ||
state.PauseTiming(); | ||
auto m = loadMesh( _mesh=new mesh_t, | ||
_filename="feel-"+std::to_string(nDim)+"d-"+std::to_string(state.range(0))+".msh", | ||
_savehdf5=false,_verbose=false, | ||
_update=0, _h=1./state.range(0) ); | ||
state.ResumeTiming(); | ||
m->components().reset(); | ||
m->components().set( state.range(1) ); | ||
m->updateForUse(); | ||
nitems=m->numElements(); | ||
} | ||
state.SetItemsProcessed( state.iterations()*nitems ); | ||
state.SetLabel( std::to_string(nDim)+"D h=1/"+std::to_string(state.range(0))+" update="+std::to_string(state.range(1)) + " nelts=" + std::to_string(nitems) ); | ||
} | ||
BENCHMARK_TEMPLATE(BM_updateForUse,Mesh<Simplex<2>>)->Unit(benchmark::kMillisecond) | ||
->Args({4,0}) | ||
->Args({4,MESH_NO_UPDATE_MEASURES}) | ||
->Args({4,MESH_UPDATE_FACES}) | ||
->Args({4,MESH_UPDATE_EDGES}) | ||
->Args({4,MESH_UPDATE_ELEMENTS_ADJACENCY}) | ||
->Args({4,MESH_UPDATE_FACES_MINIMAL}) | ||
->Args({8,0}) | ||
->Args({8,MESH_NO_UPDATE_MEASURES}) | ||
->Args({8,MESH_UPDATE_FACES}) | ||
->Args({8,MESH_UPDATE_EDGES}) | ||
->Args({8,MESH_UPDATE_ELEMENTS_ADJACENCY}) | ||
->Args({8,MESH_UPDATE_FACES_MINIMAL}) | ||
->Args({16,0}) | ||
->Args({16,MESH_NO_UPDATE_MEASURES}) | ||
->Args({16,MESH_UPDATE_FACES}) | ||
->Args({16,MESH_UPDATE_EDGES}) | ||
->Args({16,MESH_UPDATE_ELEMENTS_ADJACENCY}) | ||
->Args({16,MESH_UPDATE_FACES_MINIMAL}) | ||
->Args({32,0}) | ||
->Args({32,MESH_NO_UPDATE_MEASURES}) | ||
->Args({32,MESH_UPDATE_FACES}) | ||
->Args({32,MESH_UPDATE_EDGES}) | ||
->Args({32,MESH_UPDATE_ELEMENTS_ADJACENCY}) | ||
->Args({32,MESH_UPDATE_FACES_MINIMAL}); | ||
BENCHMARK_TEMPLATE(BM_updateForUse,Mesh<Simplex<3>>)->Unit(benchmark::kMillisecond) | ||
->Args({4,0}) | ||
->Args({4,MESH_NO_UPDATE_MEASURES}) | ||
->Args({4,MESH_UPDATE_FACES}) | ||
->Args({4,MESH_UPDATE_EDGES}) | ||
->Args({4,MESH_UPDATE_ELEMENTS_ADJACENCY}) | ||
->Args({4,MESH_UPDATE_FACES_MINIMAL}) | ||
->Args({8,0}) | ||
->Args({8,MESH_NO_UPDATE_MEASURES}) | ||
->Args({8,MESH_UPDATE_FACES}) | ||
->Args({8,MESH_UPDATE_EDGES}) | ||
->Args({8,MESH_UPDATE_ELEMENTS_ADJACENCY}) | ||
->Args({8,MESH_UPDATE_FACES_MINIMAL}) | ||
->Args({16,0}) | ||
->Args({16,MESH_NO_UPDATE_MEASURES}) | ||
->Args({16,MESH_UPDATE_FACES}) | ||
->Args({16,MESH_UPDATE_EDGES}) | ||
->Args({16,MESH_UPDATE_ELEMENTS_ADJACENCY}) | ||
->Args({16,MESH_UPDATE_FACES_MINIMAL}); | ||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
using namespace Feel; | ||
Environment env( _argc=argc, _argv=argv, | ||
_about=about(_name="feelpp_bench_mesh", | ||
_author="Feel++ Consortium", | ||
_email="feelpp-devel@feelpp.org")); | ||
|
||
//benchmark::FLAGS_benchmark_out = "feelpp_bench_mesh.json"; | ||
benchmark::Initialize(&argc, argv); | ||
//benchmark::ConsoleReporter cr; | ||
//benchmark::JSONReporter jr; | ||
benchmark::RunSpecifiedBenchmarks(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters