From fa82db44c879de81bb7b5057fe6d65dc9624cf17 Mon Sep 17 00:00:00 2001 From: Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz> Date: Wed, 6 May 2015 21:01:13 +0200 Subject: [PATCH] New tool tnl-quickstart was added. --- src/solvers/tnlIterativeSolver_impl.h | 6 +++--- .../tnl-matrix-solvers-benchmark.cfg.desc | 19 ------------------ .../tnl-sparse-matrix-benchmark.cfg.desc | 12 ----------- tools/CMakeLists.txt | 5 +++-- tools/tnl-compile.in | 13 +++++++++++- tools/tnl-link.in | 11 +++++++++- tools/tnl-quickstart/CMakeLists.txt | 4 ++++ tools/tnl-quickstart/tnl-quickstart | 3 +++ tools/tnl-quickstart/tnl-quickstart.py | 20 +++++++++++++++++++ 9 files changed, 55 insertions(+), 38 deletions(-) delete mode 100644 tests/benchmarks/share/tnl-matrix-solvers-benchmark.cfg.desc delete mode 100644 tests/benchmarks/share/tnl-sparse-matrix-benchmark.cfg.desc create mode 100644 tools/tnl-quickstart/CMakeLists.txt create mode 100644 tools/tnl-quickstart/tnl-quickstart create mode 100644 tools/tnl-quickstart/tnl-quickstart.py diff --git a/src/solvers/tnlIterativeSolver_impl.h b/src/solvers/tnlIterativeSolver_impl.h index 670565d23f..f6503520c3 100644 --- a/src/solvers/tnlIterativeSolver_impl.h +++ b/src/solvers/tnlIterativeSolver_impl.h @@ -101,10 +101,10 @@ bool tnlIterativeSolver< Real, Index> :: nextIteration() solverMonitor->refresh(); } - if( std::isnan( this->getResidue() || + if( std::isnan( this->getResidue() ) || this->getIterations() > this->getMaxIterations() || - ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() > this->minIterations ) ) || - ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() > this->minIterations ) ) + ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() > this->minIterations ) || + ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() > this->minIterations ) ) return false; return true; } diff --git a/tests/benchmarks/share/tnl-matrix-solvers-benchmark.cfg.desc b/tests/benchmarks/share/tnl-matrix-solvers-benchmark.cfg.desc deleted file mode 100644 index 8e82805744..0000000000 --- a/tests/benchmarks/share/tnl-matrix-solvers-benchmark.cfg.desc +++ /dev/null @@ -1,19 +0,0 @@ -group IO -{ - string input-file(!) [Input binary file name.]; - string input-mtx-file("") [Input mtx file name.]; - string log-file("") [Log file name.]; - string matrix-stats-file("") [File for matrix statistics like size number of non-zero elements.]; - real stop-time(3.0) [How many seconds shell we iterate SpMV.]; - integer verbose(1) [Verbose mode.]; -},[Arguments describing input and output data.]; - -group solver -{ - string device("host") [On what device the solver will run. Can be host or cuda.]; - string solver-name(!) [Set matrix solver for benchmarking. It can be sor, cg, bicgstab, tfqmr, gmres. ]; - string solver-class("tnl") [Choose other library of solvers. It can be tnl or petsc.]; - real max-residue(1.0e-6) [Set what residue we want to achieve.]; - integer gmres-restarting(20) [Set restarting for GMRES method.]; - real sor-omega(1.0) [Omega parameter for the SOR method. Can be 0--2.]; -},[Arguments describing the solver.]; \ No newline at end of file diff --git a/tests/benchmarks/share/tnl-sparse-matrix-benchmark.cfg.desc b/tests/benchmarks/share/tnl-sparse-matrix-benchmark.cfg.desc deleted file mode 100644 index 9a3bde6ec2..0000000000 --- a/tests/benchmarks/share/tnl-sparse-matrix-benchmark.cfg.desc +++ /dev/null @@ -1,12 +0,0 @@ -group IO -{ - string input-mtx-file(!) [Input mtx file name.]; - string input-file("") [Input binary file name.]; - string pdf-file("") [PDF file with matrix pattern.]; - string log-file("") [Log file name.]; - string precision("double") [Precision of the arithmetics.]; - real stop-time(3.0) [How many seconds shell we iterate SpMV.]; - integer max-iterations(100) [Maximum number of SpMV repetitions.]; - bool format-test( no ) [Turn on/off test of matrix formats.]; - integer verbose(1) [Verbose mode.]; -},[Arguments describing input and output data.]; \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 77a12ce7e2..8e955822b3 100755 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,8 +1,9 @@ add_subdirectory (src) add_subdirectory (share) +add_subdirectory (tnl-quickstart) -CONFIGURE_FILE( "tnl-compile.in" "${PROJECT_TOOLS_PATH}/tnl-compile" ) -CONFIGURE_FILE( "tnl-link.in" "${PROJECT_TOOLS_PATH}/tnl-link" ) +CONFIGURE_FILE( "tnl-compile.in" "${PROJECT_TOOLS_PATH}/tnl-compile" @ONLY ) +CONFIGURE_FILE( "tnl-link.in" "${PROJECT_TOOLS_PATH}/tnl-link" @ONLY ) INSTALL( FILES ${PROJECT_TOOLS_PATH}/tnl-compile ${PROJECT_TOOLS_PATH}/tnl-link diff --git a/tools/tnl-compile.in b/tools/tnl-compile.in index fd1f1fb36a..bfd09cca6d 100644 --- a/tools/tnl-compile.in +++ b/tools/tnl-compile.in @@ -1,3 +1,14 @@ #!/usr/bin/env bash -echo -I@CMAKE_INSTALL_PREFIX@/include/tnl-@tnlVersion@ \ No newline at end of file +DEBUG_FLAGS = "-DNDEBUG -march=native" +CUDA_FLAGS = "" + +for option in "$@" +do + case $option in + --cuda ) CUDA_FLAGS="-DHAVE_CUDA -DHAVE_NOT_CXX11 `tnl-cuda-arch`" ;; + --debug ) DEBUG_FLAGS="-g -O0" + esac +done + +echo -I@CMAKE_INSTALL_PREFIX@/include/tnl-@tnlVersion@ ${CUDA_FLAGS} \ No newline at end of file diff --git a/tools/tnl-link.in b/tools/tnl-link.in index 5f389a560d..52806a77bd 100644 --- a/tools/tnl-link.in +++ b/tools/tnl-link.in @@ -1,3 +1,12 @@ #!/usr/bin/env bash -echo -L@CMAKE_INSTALL_PREFIX@/lib -ltnl-@tnlVersion@ \ No newline at end of file +DEBUG="" + +for option in "$@" +do + case $option in + --debug ) DEBUG="-dbg" + esac +done + +echo -L@CMAKE_INSTALL_PREFIX@/lib -ltnl${DEBUG}-@tnlVersion@ \ No newline at end of file diff --git a/tools/tnl-quickstart/CMakeLists.txt b/tools/tnl-quickstart/CMakeLists.txt new file mode 100644 index 0000000000..1a403b4bcf --- /dev/null +++ b/tools/tnl-quickstart/CMakeLists.txt @@ -0,0 +1,4 @@ +INSTALL( FILES tnl-quickstart + tnl-quickstart.py + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) \ No newline at end of file diff --git a/tools/tnl-quickstart/tnl-quickstart b/tools/tnl-quickstart/tnl-quickstart new file mode 100644 index 0000000000..4b720a11dd --- /dev/null +++ b/tools/tnl-quickstart/tnl-quickstart @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +tnl-quickstart.py \ No newline at end of file diff --git a/tools/tnl-quickstart/tnl-quickstart.py b/tools/tnl-quickstart/tnl-quickstart.py new file mode 100644 index 0000000000..e67080d028 --- /dev/null +++ b/tools/tnl-quickstart/tnl-quickstart.py @@ -0,0 +1,20 @@ +#! /usr/bin/python + +# To change this license header, choose License Headers in Project Properties. +# To change this template file, choose Tools | Templates +# and open the template in the editor. + +__author__ = "oberhuber" +__date__ = "$May 6, 2015 8:40:59 PM$" + + +def generateMakefile( solverName ): + file = open( "Makefile", "w" ) + file.write( "") + file.close() + +print( "TNL Quickstart -- solver generator") +print( "----------------------------------") +projectName = input( "Project name: (whitespace characters are allowed)" ) +solverName = input( "Solver name: (whitespace characters are NOT allowed)" ) +generateMakefile( solverName ) \ No newline at end of file -- GitLab