diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 00000000..ba8984af --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,101 @@ +; Adapted from PETSc + +((nil . ((indent-tabs-mode . nil) + (show-trailing-whitespace . t))) + + (c++-mode . ((c-tab-always-indent . t) + (fill-column . 100) + (c-basic-offset . 2) + (c-comment-only-line-offset . 0) + (c-hanging-braces-alist . ((substatement-open after) + (brace-list-open after) + (brace-entry-open) + (defun-open after) + (class-open after) + (inline-open after) + (block-open after) + (block-close . c-snug-do-while) + (statement-case-open after) + (substatement after))) + (c-hanging-colons-alist . ((member-init-intro before) + (inher-intro) + (case-label after) + (label after) + (access-label after))) + (c-cleanup-list . (scope-operator + brace-else-brace + brace-elseif-brace + brace-catch-brace + empty-defun-braces + list-close-comma + defun-close-semi)) + (c-offsets-alist . ((inexpr-class . +) + (inexpr-statement . +) + (lambda-intro-cont . +) + (inlambda . c-lineup-inexpr-block) + (template-args-cont c-lineup-template-args +) + (incomposition . +) + (inmodule . +) + (innamespace . +) + (inextern-lang . +) + (composition-close . 0) + (module-close . 0) + (namespace-close . 0) + (extern-lang-close . 0) + (composition-open . 0) + (module-open . 0) + (namespace-open . 0) + (extern-lang-open . 0) + (friend . 0) + (cpp-define-intro c-lineup-cpp-define +) + (cpp-macro-cont . +) + (cpp-macro . [0]) + (inclass . ++) + (stream-op . c-lineup-streamop) + (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist) + (arglist-cont c-lineup-gcc-asm-reg 0) + (arglist-intro . +) + (catch-clause . 0) + (else-clause . 0) + (do-while-closure . 0) + (label . 2) + (access-label . -) + (substatement-label . 2) + (substatement . +) + (statement-case-open . 0) + (statement-case-intro . +) + (statement-block-intro . +) + (statement-cont . +) + (statement . 0) + (brace-entry-open . 0) + (brace-list-entry . 0) + (brace-list-intro . +) + (brace-list-close . 0) + (brace-list-open . 0) + (block-close . 0) + (inher-cont . c-lineup-multi-inher) + (inher-intro . +) + (member-init-cont . c-lineup-multi-inher) + (member-init-intro . +) + (annotation-var-cont . +) + (annotation-top-cont . 0) + (topmost-intro-cont . c-lineup-topmost-intro-cont) + (topmost-intro . 0) + (knr-argdecl . 0) + (func-decl-cont . +) + (inline-close . 0) + (inline-open . 0) + (class-close . 0) + (class-open . 0) + (defun-block-intro . +) + (defun-close . 0) + (defun-open . 0) + (string . c-lineup-dont-change) + (arglist-close . c-lineup-arglist) + (substatement-open . 0) + (case-label . 0) + (block-open . 0) + (c . 1) + (comment-intro . 0) + (knr-argdecl-intro . -))) + ))) diff --git a/.gitignore b/.gitignore index 9e4a6fe9..3ae541f8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ /doc/build /build* /dist +/coverage +*.info # Created by http://www.gitignore.io diff --git a/.travis.yml b/.travis.yml index 6cd61e9d..e6b26514 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,46 @@ language: - cpp -compiler: - - gcc - - clang +cache: apt +notifications: + email: + on_success: change # default: change + on_failure: always # default: always + +# why does Travis not allow for multi-dimensional build matrices?!? +# -> https://github.com/travis-ci/travis-ci/issues/1519 env: - - CMAKE_BUILD_TYPE="Release" - - CMAKE_BUILD_TYPE="Debug" + matrix: + - CMAKE_BUILD_TYPE="Release" WITH_MPI=OFF CXX=clang++ BOOST_VERSION=1.53 + - CMAKE_BUILD_TYPE="Release" WITH_MPI=OFF CXX=g++ BOOST_VERSION=1.53 + - CMAKE_BUILD_TYPE="Release" WITH_MPI=ON CXX=g++ BOOST_VERSION=1.53 + - CMAKE_BUILD_TYPE="Debug" WITH_MPI=OFF CXX=clang++ BOOST_VERSION=1.53 + - CMAKE_BUILD_TYPE="Debug" WITH_MPI=OFF CXX=g++ BOOST_VERSION=1.53 + - CMAKE_BUILD_TYPE="Debug" WITH_MPI=ON CXX=g++ BOOST_VERSION=1.53 + - CMAKE_BUILD_TYPE="Release" WITH_MPI=OFF CXX=clang++ BOOST_VERSION=1.55 + - CMAKE_BUILD_TYPE="Release" WITH_MPI=OFF CXX=g++ BOOST_VERSION=1.55 + - CMAKE_BUILD_TYPE="Release" WITH_MPI=ON CXX=g++ BOOST_VERSION=1.55 + - CMAKE_BUILD_TYPE="Debug" WITH_MPI=OFF CXX=clang++ BOOST_VERSION=1.55 + - CMAKE_BUILD_TYPE="Debug" WITH_MPI=OFF CXX=g++ BOOST_VERSION=1.55 + - CMAKE_BUILD_TYPE="Debug" WITH_MPI=ON CXX=g++ BOOST_VERSION=1.55 before_install: - - sudo add-apt-repository ppa:apokluda/boost1.53 --yes - - sudo add-apt-repository ppa:ubuntu-toolchain-r/test --yes # libstdc++-4.8 - - if [ "${CXX}" == "clang++" ]; then sudo add-apt-repository --yes ppa:h-rayflood/llvm; fi # clang++-3.2 + # boost packages + - if [ "${BOOST_VERSION}" == "1.53" ]; then sudo add-apt-repository ppa:apokluda/boost1.53 --yes; fi + - if [ "${BOOST_VERSION}" == "1.55" ]; then sudo add-apt-repository ppa:boost-latest/ppa --yes; fi + # libstdc++-4.8 + - sudo add-apt-repository ppa:ubuntu-toolchain-r/test --yes + # clang++-3.2 + - if [ "${CXX}" == "clang++" ]; then sudo add-apt-repository --yes ppa:h-rayflood/llvm; fi - sudo apt-get update install: + # note: clang needs g++-4.8 it for libstdc++ update - if [ "${CXX}" == "clang++" ]; then sudo apt-get -qq install clang-3.2; fi - - sudo apt-get install g++-4.8 # clang need it for libstdc++ update - - sudo apt-get install libboost1.53-all-dev + - if [ "${WITH_MPI}" == "ON" ]; then sudo apt-get -qq install mpich2 libmpich2-dev; fi + - sudo apt-get install g++-4.8 + - sudo apt-get install "libboost${BOOST_VERSION}-all-dev" libfftw3-3 libfftw3-dev before_script: # update compilers @@ -28,7 +50,7 @@ before_script: script: - mkdir build - cd build - - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -Dpfasst_DISABLE_LIBCXX=ON -Dpfasst_BUILD_TESTS=ON -Dpfasst_BUILD_EXAMPLES=ON .. + - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -Dpfasst_WITH_MPI=${WITH_MPI} -Dpfasst_DISABLE_LIBCXX=ON -Dpfasst_BUILD_TESTS=ON -Dpfasst_BUILD_EXAMPLES=ON .. - make - - make test - + - make test ARGS="-V" + - make run_example_all diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 3edacc88..3592cb77 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -21,31 +21,40 @@ list(APPEND 3rdparty_INCLUDES ${Boost_INCLUDE_DIRS}) if(pfasst_BUILD_EXAMPLES) - message(STATUS "FFTW3") - set(fftw3_SOURCE_DIR "${pfasst_BINARY_DIR}/3rdparty/src/fftw3") - set(fftw3_INSTALL_DIR "${pfasst_BINARY_DIR}/3rdparty/src/fftw3-install") + find_package(FFTW) - ExternalProject_Add( - fftw3 - LIST_SEPARATOR " " - URL http://fftw.org/fftw-3.3.4.tar.gz - URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3 - TIMEOUT 30 - UPDATE_COMMAND "" - PATCH_COMMAND "" - BUILD_IN_SOURCE ON - CONFIGURE_COMMAND ${fftw3_SOURCE_DIR}/configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=${CMAKE_CXX_FLAGS} --prefix=${fftw3_INSTALL_DIR} --libdir=${fftw3_INSTALL_DIR}/lib - BUILD_COMMAND make - TEST_COMMAND "" - INSTALL_DIR ${fftw3_SOURCE_DIR}-install - INSTALL_COMMAND make install - LOG_DOWNLOAD ON - LOG_CONFIGURE ON - LOG_BUILD ON - ) - # Specify include dir - set(fftw3_INCLUDES ${fftw3_INSTALL_DIR}/include PARENT_SCOPE) - set(fftw3_LIBS ${fftw3_INSTALL_DIR}/lib/libfftw3.a PARENT_SCOPE) + if(NOT FFTW_FOUND) + message(STATUS "FFTW3 not found on your system.") + message(STATUS "Going to download and compile it automatically.") + set(fftw3_SOURCE_DIR "${pfasst_BINARY_DIR}/3rdparty/src/fftw3") + set(fftw3_INSTALL_DIR "${pfasst_BINARY_DIR}/3rdparty/src/fftw3-install") + + ExternalProject_Add( + fftw3 + LIST_SEPARATOR " " + URL http://fftw.org/fftw-3.3.4.tar.gz + URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3 + TIMEOUT 30 + UPDATE_COMMAND "" + PATCH_COMMAND "" + BUILD_IN_SOURCE ON + CONFIGURE_COMMAND ${fftw3_SOURCE_DIR}/configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=${CMAKE_CXX_FLAGS} --prefix=${fftw3_INSTALL_DIR} --libdir=${fftw3_INSTALL_DIR}/lib + BUILD_COMMAND make + TEST_COMMAND "" + INSTALL_DIR ${fftw3_SOURCE_DIR}-install + INSTALL_COMMAND make install + LOG_DOWNLOAD ON + LOG_CONFIGURE ON + LOG_BUILD ON + ) + # Specify include dir + set(FFTW_INCLUDE_PATH ${fftw3_INSTALL_DIR}/include PARENT_SCOPE) + set(FFTW_LIBRARIES ${fftw3_INSTALL_DIR}/lib/libfftw3.a PARENT_SCOPE) + else() + set(FFTW_INCLUDE_PATH ${FFTW_INCLUDE_PATH} PARENT_SCOPE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} PARENT_SCOPE) + endif() + set(FFTW_FOUND ${FFTW_FOUND} PARENT_SCOPE) if(pfasst_BUILD_TESTS) message(STATUS "--------------------------------------------------------------------------------") @@ -58,10 +67,9 @@ if(pfasst_BUILD_TESTS) # Add gmock ExternalProject_Add( googlemock - SVN_REPOSITORY http://googlemock.googlecode.com/svn/trunk/ - SVN_REVISION -r 449 # release 1.7.0 - TIMEOUT 10 - # Disable SVN update + URL http://googlemock.googlecode.com/files/gmock-1.7.0.zip + URL_MD5 073b984d8798ea1594f5e44d85b20d66 + TIMEOUT 30 UPDATE_COMMAND "" PATCH_COMMAND "" CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release diff --git a/CHANGELOG.md b/CHANGELOG.md index 133f05db..7c0d9b8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,62 @@ # Changelog {#page_changelog} +## v0.2.0 -- MPI PFASST (2014/08/XX) + +DOI: [10.5281/zenodo.11047](http://dx.doi.org/10.5281/zenodo.11047) + +### Notable Features + +* Addition of MPI based PFASST. + +### Details + +* Addition of MPI based PFASST algorithm using the standard predictor stage in a block mode with + fixed iterations. + ([#46][], [#57][], [#59][]) + +* Addition of a simple scalar example and appropriate tests. + ([#61][], [#63][], [#76][], [#81][]) + +* Further tests on proper calculation of quadrature nodes and weights + ([#74][]) + +* Better handling of 3rd-party dependencies + ([#53][], [#55][]) + +* Various tidying + ([#56][], [#60][], [#77][]) + +* Basic Profiling support and test coverage report + ([#78][]) + +[#46]: https://github.com/Parallel-in-Time/PFASST/pull/46 +[#57]: https://github.com/Parallel-in-Time/PFASST/pull/56 +[#59]: https://github.com/Parallel-in-Time/PFASST/pull/59 +[#53]: https://github.com/Parallel-in-Time/PFASST/pull/53 +[#55]: https://github.com/Parallel-in-Time/PFASST/pull/55 +[#56]: https://github.com/Parallel-in-Time/PFASST/pull/56 +[#60]: https://github.com/Parallel-in-Time/PFASST/pull/60 +[#61]: https://github.com/Parallel-in-Time/PFASST/pull/61 +[#63]: https://github.com/Parallel-in-Time/PFASST/pull/63 +[#74]: https://github.com/Parallel-in-Time/PFASST/pull/74 +[#76]: https://github.com/Parallel-in-Time/PFASST/pull/76 +[#77]: https://github.com/Parallel-in-Time/PFASST/pull/77 +[#78]: https://github.com/Parallel-in-Time/PFASST/pull/78 +[#78]: https://github.com/Parallel-in-Time/PFASST/pull/81 + +### Contributors + +* Matthew Emmett, Lawrence Berkeley National Laboratory ([memmett][]) +* Torbjörn Klatt, Jülich Supercomputing Centre ([torbjoernk][]) +* Daniel Ruprecht, Institute of Computational Science, University of Lugano ([danielru][]) +* Robert Speck, Jülich Supercomputing Centre ([pancetta][]) + +[memmett]: https://github.com/memmett +[torbjoernk]: https://github.com/torbjoernk +[danielru]: https://github.com/danielru +[pancetta]: https://github.com/pancetta + + ## v0.1.0 -- First Release (2014/07/25) DOI: [10.5281/zenodo.11047](http://dx.doi.org/10.5281/zenodo.11047) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e923660..8b8aed5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,25 +1,31 @@ cmake_minimum_required(VERSION 2.8) - -set(CMAKE_VERBOSE_MAKEFILE ON) - project(pfasst) +list(APPEND CMAKE_MODULE_PATH ${pfasst_SOURCE_DIR}/cmake) include(cmake/utility_functions.cmake) include(CheckCXXCompilerFlag) include(ExternalProject) + # Set default ExternalProject root directory set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/3rdparty) -option(pfasst_DISABLE_LIBCXX "Disable use of LLVM's libc++ when compiling with Clang." ON) -option(pfasst_BUILD_EXAMPLES "Build example programs." ON) -option(pfasst_BUILD_TESTS "Build test suite for PFASST." ON) +option(pfasst_DISABLE_LIBCXX "Disable use of LLVM's libc++ when compiling with Clang." ON ) +option(pfasst_BUILD_EXAMPLES "Build example programs." ON ) +option(pfasst_BUILD_TESTS "Build test suite for PFASST." ON ) +option(pfasst_WITH_MPI "Build with MPI enabled." OFF) +option(pfasst_WITH_GCC_PROF "Enable excessive debugging & profiling output with GCC." OFF) -# output directories +# Set output directories set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${pfasst_SOURCE_DIR}/dist/bin") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${pfasst_SOURCE_DIR}/dist/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${pfasst_SOURCE_DIR}/dist/lib") -# check for C++11 support +if(${pfasst_WITH_MPI}) + find_package(MPI REQUIRED) + message(STATUS "Using MPI C++ Compiler: ${MPI_CXX_COMPILER}") +endif() + +# Check for C++11 support if(${CMAKE_CXX_COMPILER_ID} MATCHES GNU) check_cxx_compiler_flag(-std=c++11 HAVE_STD11) if(HAVE_STD11) @@ -27,6 +33,9 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES GNU) else() message(FATAL_ERROR "No advanced standard C++ support of your GCC (-std=c++11 not defined).") endif() + if(pfasst_WITH_GCC_PROF) + add_to_string_list("${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS "-ggdb3 -pg") + endif(pfasst_WITH_GCC_PROF) elseif(${CMAKE_CXX_COMPILER_ID} MATCHES Clang) check_cxx_compiler_flag(-std=c++11 HAVE_STD11) if(HAVE_STD11) @@ -57,7 +66,7 @@ else() endif() message(STATUS "Your compiler has C++11 support. Hurray!") -# enable all compiler warnings +# Enable all compiler warnings add_to_string_list("${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic") set(3rdparty_INCLUDES) @@ -69,13 +78,14 @@ if(pfasst_BUILD_TESTS) enable_testing() endif(pfasst_BUILD_TESTS) -# adding / including 3rd-party libraries +# Add / include 3rd-party libraries message(STATUS "********************************************************************************") message(STATUS "Configuring 3rd party libraries") # makes available: -# - fftw3_INCLUDES (if pfasst_BUILD_EXAMPLES) -# - fftw3_LIBS (if pfasst_BUILD_EXAMPLES) -# and Boost headers in 3rdparty_INCLUDES +# - Boost headers in 3rdparty_INCLUDES +# - Google test and mock headers in 3rdparty_INCLUDES (if pfasst_BUILD_TESTS) +# - FFTW_INCLUDE_PATH (if pfasst_BUILD_EXAMPLES) +# - FFTW_LIBRARIES (if pfasst_BUILD_EXAMPLES) add_subdirectory(3rdparty) message(STATUS "********************************************************************************") @@ -95,6 +105,9 @@ if(pfasst_BUILD_TESTS) endif() message(STATUS "********************************************************************************") +message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}") message(STATUS "C++ Compiler ID: ${CMAKE_CXX_COMPILER_ID}") +message(STATUS "C++ Compiler Names: ${CMAKE_CXX_COMPILER_NAMES}") +message(STATUS "C++ Compiler Version: ${CMAKE_CXX_COMPILER_VERSION}") message(STATUS "C++ Flags: ${CMAKE_CXX_FLAGS}") message(STATUS "C++ link flags: ${CMAKE_CXX_LINK_FLAGS}") diff --git a/README.md b/README.md index d5a8dcf3..8b7bb05a 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,19 @@ PFASST {#mainpage} ====== -The PFASST algorithm is a time-parallel algorithm for solving ODEs and PDEs. - -The PFASST project is a C++ implementation of the *parallel full approximation scheme in space and -time* (PFASST) algorithm. -It also contains basic implementations of the *spectral deferred correction* (SDC) and -*multi-level spectral deferred correction* (MLSDC) algorithms. +The PFASST project is a C++ implementation of the *parallel full approximation scheme in space and +time* (PFASST) algorithm, which in turn is a time-parallel algorithm for solving ODEs and PDEs. It +also contains basic implementations of the *spectral deferred correction* (SDC) and *multi-level +spectral deferred correction* (MLSDC) algorithms. News ---- -* July 25, 2014: PFASST v0.1.0 released. Please see the [release notes](#releases) for more +* August 29, 2014: PFASST v0.2.0 release. Please sse the [release notes](#releases) for more + information. + +* July 25, 2014: PFASST v0.1.0 released. Please see the [release notes](#releases) for more information. @@ -32,15 +33,22 @@ Currently, it features the following content: * \subpage #page_examples * \subpage #page_contributing * \subpage #page_style_guide +* \subpage #page_troubleshooting Releases -------- +* **v0.2.0** MPI-PFASST Release (2014/08/29) + + Implementation of PFASST with MPI. + DOI: [10.5281/zenodo.11047][DOI_v010] + See \subpage #page_changelog "the Changelog" for details. + * **v0.1.0** First Release (2014/07/25) - Initial release with basic implementations of SDC and MLSDC. - DOI: [10.5281/zenodo.11047][DOI_v010] + Initial release with basic implementations of SDC and MLSDC. + DOI: [10.5281/zenodo.11047][DOI_v010] See \subpage #page_changelog "the Changelog" for details. [DOI_v010]: http://dx.doi.org/10.5281/zenodo.11047 @@ -60,8 +68,11 @@ Build status For details see [Travis][pfasst-travis]. +A test coverage report is generated and published by [Jenkins][coverage-report]. + -[documentation]: https://pint.fz-juelich.de/ci/view/PFASST/job/PFASST%20%28Docu%29/doxygen/ -[pfasst-travis]: https://travis-ci.org/Parallel-in-Time/PFASST -[master-status]: https://travis-ci.org/Parallel-in-Time/PFASST.svg?branch=master -[dev-status]: https://travis-ci.org/Parallel-in-Time/PFASST.svg?branch=development +[documentation]: https://pint.fz-juelich.de/ci/view/PFASST/job/PFASST%20%28Docu%29/doxygen/ +[pfasst-travis]: https://travis-ci.org/Parallel-in-Time/PFASST +[master-status]: https://travis-ci.org/Parallel-in-Time/PFASST.svg?branch=master +[dev-status]: https://travis-ci.org/Parallel-in-Time/PFASST.svg?branch=development +[coverage-report]: https://pint.fz-juelich.de/ci/job/PFASST_GCC_4-8_Coverage/Test_Coverage diff --git a/cmake/FindFFTW.cmake b/cmake/FindFFTW.cmake new file mode 100644 index 00000000..03969b53 --- /dev/null +++ b/cmake/FindFFTW.cmake @@ -0,0 +1,22 @@ +# - Find FFTW +# Find the native FFTW3 includes and library +# +# FFTW_INCLUDE_PATH - where to find fftw3.h +# FFTW_LIBRARIES - List of libraries when using FFTW. +# FFTW_FOUND - True if FFTW found. + +if(FFTW_INCLUDE_PATH) + # Already in cache, be silent + set(FFTW_FIND_QUIETLY TRUE) +endif(FFTW_INCLUDE_PATH) + +find_path(FFTW_INCLUDE_PATH fftw3.h) + +find_library(FFTW_LIBRARIES NAMES fftw3) + +# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDE_PATH) + +mark_as_advanced(FFTW_LIBRARIES FFTW_INCLUDE_PATH) diff --git a/doc/source/examples.md b/doc/source/examples.md index b7e70c78..f68f5970 100644 --- a/doc/source/examples.md +++ b/doc/source/examples.md @@ -3,3 +3,8 @@ ## Simple Advection Diffusion See \subpage page_examples_advection_diffusion. + + +## Scalar + +See \subpage page_examples_scalar. diff --git a/doc/source/installing.md b/doc/source/installing.md index b3c23337..e02d5d52 100644 --- a/doc/source/installing.md +++ b/doc/source/installing.md @@ -20,27 +20,27 @@ Just use _Git_ to clone the repository. * By default everything gets built, i.e. tests and examples. - * To deactivate the tests, pass `-Dpfasst_BUILD_TESTS=OFF` to the - _CMake_ command line. + * To deactivate the tests, pass `-Dpfasst_BUILD_TESTS=OFF` to the _CMake_ command line. - * To deactivate the examples, pass `-Dpfasst_BUILD_EXAMPLES=OFF` to - the _CMake_ command line. + * To deactivate the examples, pass `-Dpfasst_BUILD_EXAMPLES=OFF` to the _CMake_ command line. - * If you are not on a _Darvin_ system (i.e. MacOS, OSX, ...) and - you are using _Clang_ as the compiler, you want to deactivate the - use of LLVM's libc++ by passing `-Dpfasst_DISABLE_LIBCXX=ON` to - the _CMake_ command line. + * To enable profiling support, you need to specify `-Dpfasst_WITH_GCC_PROF` and have the GNU + compiler selected. - * For example, to build with _Clang_ on a Linux system without the - examples, the call to _CMake_ looks like: + * If you are not on a _Darvin_ system (i.e. MacOS, OSX, ...) and you are using _Clang_ as the + compiler, you want to deactivate the use of LLVM's libc++ by passing + `-Dpfasst_DISABLE_LIBCXX=ON` to the _CMake_ command line. (this is the default) - cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -Dpfasst_DISABLE_LIBCXX=ON -Dpfasst_BUILD_EXAMPLES=OFF .. + * For example, to build with _Clang_ on a Linux system without the examples, the call to + _CMake_ looks like: - The [Google Testing] and [Mocking Framework] are required for the - unit tests, and are automatically downloaded and built. + cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ [-Dpfasst_DISABLE_LIBCXX=ON] -Dpfasst_BUILD_EXAMPLES=OFF .. - The [FFTW3] library is required for (some) of the examples, and it - automatically downloaded and built as well. + The [Google Testing] and [Mocking Framework] are required for the unit tests, and are + automatically downloaded and built. + + The [FFTW3] library is required for (some) of the examples. It will be automatically downloaded + and built as well if it is not found on the system. 3. Run the unit tests (if unit tests have been built): @@ -48,7 +48,9 @@ Just use _Git_ to clone the repository. 4. Run the examples (if they have been built): - ./examples/advection + make run_example_all + + Or go to `./dist/examples` and look for the exetuable you want to run. [Google Testing]: https://code.google.com/p/googletest/ [Mocking Framework]: https://code.google.com/p/googlemock/ diff --git a/doc/source/troubleshooting.md b/doc/source/troubleshooting.md new file mode 100644 index 00000000..ebeb4f64 --- /dev/null +++ b/doc/source/troubleshooting.md @@ -0,0 +1,35 @@ +# Trouble Shooting {#page_troubleshooting} + +## I'm getting SEGFAULTs, how do I track them down? + +Please try running your program through GDB and/or valgrind. + +## How do I run my MPI program through GDB? + +To run your MPI program through GDB: + + mpirun -n 4 xterm -e gdb -x my-gdb-commands my-pfasst-program + +where `my-gdb-commands` is a plain text file containing GDB commands +to run your program, and `my-pfasst-program` is your executable. A +very simple set of GDB commands for the `my-gdb-commands` is: + + catch throw + run + +The result is: `mpirun` will launch 4 `xterm` windows, each of which +will immediately run your program through `gdb`, which subsequently +runs your program. Hopefully GDB will catch the SEGFAULT. + +## How do I run my MPI program through valgrind? + +To run your MPI program through valgrind: + + mpirun -n 4 xterm -e valgrind my-pfasst-program + + + + + + + diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b79278b1..5ae8e0d3 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1 +1,10 @@ +set(all_example_runs) + add_subdirectory(advection_diffusion) +add_subdirectory(scalar) + +add_custom_target(run_example_all + DEPENDS ${all_example_runs} + COMMENT "Running all examples" VERBATIM +) +message(STATUS " - run_example_all") diff --git a/examples/advection_diffusion/CMakeLists.txt b/examples/advection_diffusion/CMakeLists.txt index ffa92cbc..f4d2c046 100644 --- a/examples/advection_diffusion/CMakeLists.txt +++ b/examples/advection_diffusion/CMakeLists.txt @@ -1,7 +1,10 @@ +set(all_example_runs ${all_example_runs}) +set(all_advec_example_runs) + message(STATUS " advection_diffusion") include_directories( ${3rdparty_INCLUDES} - ${fftw3_INCLUDES} + ${FFTW_INCLUDE_PATH} ${pfasst_INCLUDES} ) @@ -11,13 +14,72 @@ set(advec_examples serial_mlsdc_autobuild ) -foreach(example ${advec_examples}) +set(advec_mpi_examples) + +if(${pfasst_WITH_MPI}) + set(advec_mpi_examples + mpi_pfasst + ) +endif() + +set(all_advec_examples + ${advec_examples} + ${advec_mpi_examples} +) + +foreach(example ${all_advec_examples}) add_executable(${example} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.cpp) - add_dependencies(${example} fftw3) + if(NOT FFTW_FOUND) + add_dependencies(${example} fftw3) + endif() target_link_libraries(${example} - ${fftw3_LIBS} + ${FFTW_LIBRARIES} ) set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/advection_diffusion ) endforeach(example) + +message(STATUS " creating make targets to run examples") +foreach(example ${advec_examples}) + add_custom_target(run_example_advec_${example} + COMMAND ${example} + DEPENDS ${example} + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/advection_diffusion + COMMENT "Running Advection-Diffusion example: ${example}" VERBATIM + ) + list(APPEND all_advec_example_runs run_example_advec_${example}) + message(STATUS " - run_example_advec_${example}") +endforeach(example) + +if(${pfasst_WITH_MPI}) + include_directories(${MPI_CXX_INCLUDE_PATH}) + foreach(example ${advec_mpi_examples}) + if(MPI_COMPILE_FLAGS) + set_target_properties(${example} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}") + endif() + if(MPI_LINK_FLAGS) + set_target_properties(${example} PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}") + endif() + target_link_libraries(${example} ${MPI_CXX_LIBRARIES}) + endforeach(example) + message(STATUS " creating make targets to run MPI examples") + foreach(example ${advec_mpi_examples}) + add_custom_target(run_example_advec_${example} + COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/advection_diffusion/${example} ${MPIEXEC_POSTFLAGS} + DEPENDS ${example} + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples/advection_diffusion + COMMENT "Running Advection-Diffusion example: ${example}" VERBATIM + ) + list(APPEND all_advec_example_runs run_example_advec_${example}) + message(STATUS " - run_example_advec_${example}") + endforeach(example) +endif() + +add_custom_target(run_example_advec_all + DEPENDS ${all_advec_example_runs} + COMMENT "Running all Advection-Diffusion examples" VERBATIM +) +message(STATUS " - run_example_advec_all") + +set(all_example_runs ${all_example_runs} ${all_advec_example_runs} PARENT_SCOPE) diff --git a/examples/advection_diffusion/advection_diffusion_sweeper.hpp b/examples/advection_diffusion/advection_diffusion_sweeper.hpp index dbdc39a1..f4dc3d97 100644 --- a/examples/advection_diffusion/advection_diffusion_sweeper.hpp +++ b/examples/advection_diffusion/advection_diffusion_sweeper.hpp @@ -5,12 +5,15 @@ #ifndef _ADVECTION_DIFFUSION_SWEEPER_HPP_ #define _ADVECTION_DIFFUSION_SWEEPER_HPP_ +#include #include #include #include #include #include +#include +#include #include #include "fft.hpp" @@ -24,42 +27,150 @@ using pfasst::encap::Encapsulation; using pfasst::encap::as_vector; +/** + * errors at different iterations and time nodes + * + * Mapping a pair of step/iteration indices onto the error of the solution. + */ typedef map, double> error_map; template class AdvectionDiffusionSweeper : public pfasst::encap::IMEXSweeper