├── .astylerc ├── .dir-locals.el ├── .gitignore ├── .mailmap ├── .travis.yml ├── 3rdparty └── CMakeLists.txt ├── CHANGELOG.md ├── CMakeLists.txt ├── Doxyfile ├── LICENSE ├── README.md ├── cmake ├── FindEigen3.cmake ├── FindFFTW.cmake ├── FindGMock.cmake ├── FindMPIP.cmake ├── cc_wrapper.sh.in ├── cxx_wrapper.sh.in ├── site_config.hpp.in ├── toolchain_juqueen.cmake └── utility_functions.cmake ├── doc └── source │ ├── .placeholder │ ├── contributing.md │ ├── customized │ ├── custom.css │ ├── custom_tweaks.js │ ├── default.css │ ├── footer.html │ └── header.html │ ├── installing.md │ ├── literature.bib │ ├── scorep.md │ ├── style_guide.md │ ├── supercomputers.md │ └── troubleshooting.md ├── examples ├── CMakeLists.txt ├── advection_diffusion │ ├── CMakeLists.txt │ ├── Makefile │ ├── Makefile.edison │ ├── advection_diffusion_sweeper.hpp │ ├── fft_manager.hpp │ ├── fft_manager_impl.hpp │ ├── fftw_workspace_dft1d.hpp │ ├── fftw_workspace_dft1d_impl.hpp │ ├── mpi_pfasst.cpp │ ├── serial_mlsdc.cpp │ ├── spectral_transfer_1d.hpp │ └── vanilla_sdc.cpp ├── scalar │ ├── CMakeLists.txt │ ├── scalar_sdc.cpp │ └── scalar_sweeper.hpp └── vanderpol │ ├── CMakeLists.txt │ ├── plot.py │ ├── vdp_sdc.cpp │ └── vdp_sweeper.hpp ├── include ├── CMakeLists.txt ├── pfasst.hpp └── pfasst │ ├── config.hpp │ ├── controller │ ├── interface.hpp │ ├── interface_impl.hpp │ ├── mlsdc.hpp │ ├── mlsdc_impl.hpp │ ├── pfasst.hpp │ ├── pfasst_impl.hpp │ ├── sdc.hpp │ └── sdc_impl.hpp │ ├── easylogging++.h │ ├── encap │ ├── encap_sweeper.hpp │ ├── encap_sweeper_impl.hpp │ ├── encapsulation.hpp │ ├── encapsulation_impl.hpp │ ├── imex_sweeper.hpp │ ├── imex_sweeper_impl.hpp │ ├── implicit_sweeper.hpp │ ├── implicit_sweeper_impl.hpp │ ├── poly_interp.hpp │ ├── poly_interp_impl.hpp │ ├── vector.hpp │ └── vector_impl.hpp │ ├── globals.hpp │ ├── interfaces.hpp │ ├── interfaces_impl.hpp │ ├── logging.hpp │ ├── mpi_communicator.hpp │ ├── mpi_communicator_impl.hpp │ ├── quadrature.hpp │ ├── quadrature │ ├── clenshaw_curtis.hpp │ ├── clenshaw_curtis_impl.hpp │ ├── gauss_legendre.hpp │ ├── gauss_legendre_impl.hpp │ ├── gauss_lobatto.hpp │ ├── gauss_lobatto_impl.hpp │ ├── gauss_radau.hpp │ ├── gauss_radau_impl.hpp │ ├── interface.hpp │ ├── interface_impl.hpp │ ├── polynomial.hpp │ ├── polynomial_impl.hpp │ ├── uniform.hpp │ └── uniform_impl.hpp │ └── version.hpp ├── tests ├── CMakeLists.txt ├── examples │ ├── CMakeLists.txt │ ├── advection_diffusion │ │ ├── CMakeLists.txt │ │ ├── test_advection_diffusion.cpp │ │ ├── test_advection_diffusion_conv.cpp │ │ ├── test_mpi_advection_diffusion.cpp │ │ └── test_mpi_advection_diffusion_conv.cpp │ ├── boris │ │ ├── CMakeLists.txt │ │ ├── mocks.hpp │ │ ├── test_boris_particle_util.cpp │ │ ├── test_boris_physics.cpp │ │ └── test_boris_sweeper.cpp │ ├── scalar │ │ ├── CMakeLists.txt │ │ ├── test_scalar_conv.cpp │ │ └── test_scalar_highprec.cpp │ └── vanderpol │ │ ├── CMakeLists.txt │ │ └── test_vdp_zeronu_conv.cpp ├── fixtures │ └── concepts.hpp ├── test_polynomial.cpp └── test_quadrature.cpp ├── tools ├── generate_coverage.py ├── get_pfasst_version.py └── hashdist │ ├── fftw-nompi.yaml │ ├── pfasst-stack.debian.yaml │ └── pfasst-stack.edison.gnu.yaml ├── travis_deploy_rsa.enc └── travis_deploy_rsa.pub /.astylerc: -------------------------------------------------------------------------------- 1 | --add-brackets 2 | --add-one-line-brackets 3 | --align-pointer=type 4 | --align-reference=type 5 | --close-templates 6 | --convert-tabs 7 | --indent-cases 8 | --indent-classes 9 | --indent-col1-comments 10 | --indent-labels 11 | --indent-modifiers 12 | --indent-namespaces 13 | --indent-preproc-define 14 | --indent-preproc-cond 15 | --indent=spaces=2 16 | --indent-switches 17 | --keep-one-line-statements 18 | --lineend=linux 19 | --max-code-length=100 20 | --max-instatement-indent=40 21 | --min-conditional-indent=2 22 | --mode=c 23 | --pad-oper 24 | --pad-header 25 | --unpad-paren 26 | --style=1tbs 27 | --suffix=none 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # other stuff 2 | /doc/build 3 | /build* 4 | /coverage 5 | *.info 6 | /include/pfasst/site_config.hpp 7 | travis_deploy_rsa 8 | d[0-9a-f]/ 9 | search/ 10 | 11 | .python-version 12 | __pycache__ 13 | .ipynb_checkpoints 14 | /run 15 | 16 | # Created by http://www.gitignore.io 17 | 18 | ### C ### 19 | # Object files 20 | *.o 21 | *.ko 22 | *.obj 23 | *.elf 24 | 25 | # Libraries 26 | *.lib 27 | *.a 28 | 29 | # Shared objects (inc. Windows DLLs) 30 | *.dll 31 | *.so 32 | *.so.* 33 | *.dylib 34 | 35 | # Executables 36 | *.exe 37 | *.out 38 | *.app 39 | *.i*86 40 | *.x86_64 41 | *.hex 42 | 43 | 44 | ### C++ ### 45 | # Compiled Object files 46 | *.slo 47 | *.lo 48 | 49 | # Compiled Dynamic libraries 50 | 51 | # Compiled Static libraries 52 | *.lai 53 | *.la 54 | 55 | # Executables 56 | 57 | 58 | ### Eclipse ### 59 | *.pydevproject 60 | .metadata 61 | .gradle 62 | bin/ 63 | tmp/ 64 | *.tmp 65 | *.bak 66 | *.swp 67 | *~.nib 68 | local.properties 69 | .settings/ 70 | .loadpath 71 | 72 | # External tool builders 73 | .externalToolBuilders/ 74 | 75 | # Locally stored "Eclipse launch configurations" 76 | *.launch 77 | 78 | # CDT-specific 79 | .cproject 80 | 81 | # PDT-specific 82 | .buildpath 83 | 84 | # sbteclipse plugin 85 | .target 86 | 87 | # TeXlipse plugin 88 | .texlipse 89 | 90 | 91 | ### Emacs ### 92 | # -*- mode: gitignore; -*- 93 | *~ 94 | \#*\# 95 | /.emacs.desktop 96 | /.emacs.desktop.lock 97 | *.elc 98 | auto-save-list 99 | tramp 100 | .\#* 101 | 102 | # Org-mode 103 | .org-id-locations 104 | *_archive 105 | 106 | # flymake-mode 107 | *_flymake.* 108 | 109 | # eshell files 110 | /eshell/history 111 | /eshell/lastdir 112 | 113 | # elpa packages 114 | /elpa/ 115 | 116 | # reftex files 117 | *.rel 118 | 119 | # AUCTeX auto folder 120 | /auto/ 121 | 122 | 123 | ### Linux ### 124 | 125 | # KDE directory preferences 126 | .directory 127 | 128 | # KDevelop 129 | *.kdev4 130 | .kdev4/ 131 | 132 | 133 | ### OSX ### 134 | .DS_Store 135 | .AppleDouble 136 | .LSOverride 137 | 138 | # Icon must end with two \r 139 | Icon 140 | 141 | 142 | # Thumbnails 143 | ._* 144 | 145 | # Files that might appear on external disk 146 | .Spotlight-V100 147 | .Trashes 148 | 149 | # Directories potentially created on remote AFP share 150 | .AppleDB 151 | .AppleDesktop 152 | Network Trash Folder 153 | Temporary Items 154 | .apdisk 155 | 156 | # Created by https://www.gitignore.io 157 | 158 | ### Intellij ### 159 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 160 | 161 | /*.iml 162 | 163 | ## Directory-based project format: 164 | .idea/ 165 | # if you remove the above rule, at least ignore the follwing: 166 | 167 | # User-specific stuff: 168 | # .idea/workspace.xml 169 | # .idea/tasks.xml 170 | # .idea/dictionaries 171 | 172 | # Sensitive or high-churn files: 173 | # .idea/dataSources.ids 174 | # .idea/dataSources.xml 175 | # .idea/sqlDataSources.xml 176 | # .idea/dynamic.xml 177 | # .idea/uiDesigner.xml 178 | 179 | # Gradle: 180 | # .idea/gradle.xml 181 | # .idea/libraries 182 | 183 | # Mongo Explorer plugin: 184 | # .idea/mongoSettings.xml 185 | 186 | ## File-based project format: 187 | *.ipr 188 | *.iws 189 | 190 | ## Plugin-specific files: 191 | 192 | # IntelliJ 193 | out/ 194 | 195 | # mpeltonen/sbt-idea plugin 196 | .idea_modules/ 197 | 198 | # JIRA plugin 199 | atlassian-ide-plugin.xml 200 | 201 | # Crashlytics plugin (for Android Studio and IntelliJ) 202 | com_crashlytics_export_strings.xml 203 | 204 | # Created by https://www.gitignore.io 205 | 206 | ### Python ### 207 | # Byte-compiled / optimized / DLL files 208 | __pycache__/ 209 | *.py[cod] 210 | 211 | # C extensions 212 | *.so 213 | 214 | # Distribution / packaging 215 | .Python 216 | env/ 217 | build/ 218 | develop-eggs/ 219 | dist/ 220 | downloads/ 221 | eggs/ 222 | lib/ 223 | lib64/ 224 | parts/ 225 | sdist/ 226 | var/ 227 | *.egg-info/ 228 | .installed.cfg 229 | *.egg 230 | 231 | # PyInstaller 232 | # Usually these files are written by a python script from a template 233 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 234 | *.manifest 235 | *.spec 236 | 237 | # Installer logs 238 | pip-log.txt 239 | pip-delete-this-directory.txt 240 | 241 | # Unit test / coverage reports 242 | htmlcov/ 243 | .tox/ 244 | .coverage 245 | .cache 246 | nosetests.xml 247 | coverage.xml 248 | cppcheck.xml 249 | /cppcheck 250 | 251 | # Translations 252 | *.mo 253 | *.pot 254 | 255 | # Django stuff: 256 | *.log 257 | 258 | # Sphinx documentation 259 | docs/_build/ 260 | 261 | # PyBuilder 262 | target/ 263 | 264 | # IPython 265 | *.ipynb_checkpoints/ 266 | 267 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Torbjörn Klatt 2 | Matthew Emmett 3 | Matthew Emmett 4 | Daniel Ruprecht danielru 5 | Daniel Ruprecht Daniel 6 | Daniel Ruprecht Daniel 7 | Selman Terzi 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | dist: precise 3 | 4 | language: 5 | - cpp 6 | 7 | cache: 8 | - apt 9 | 10 | addons: 11 | apt: 12 | sources: 13 | - boost-latest 14 | - ubuntu-toolchain-r-test 15 | - llvm-toolchain-precise-3.6 16 | packages: 17 | - clang-3.6 18 | - doxygen 19 | - gcc-5 20 | - g++-5 21 | - graphviz 22 | - libfftw3-3 23 | - libfftw3-dev 24 | - libeigen3-dev 25 | - libboost1.55-dev 26 | - libboost-math1.55-dev 27 | - libboost-program-options1.55-dev 28 | - libopenmpi-dev 29 | - openmpi-bin 30 | - openmpi-common 31 | 32 | compiler: 33 | - gcc 34 | - clang 35 | 36 | env: 37 | global: 38 | - BUILD_TASK=cmake 39 | - WITH_MPI=OFF 40 | matrix: 41 | - CMAKE_BUILD_TYPE=Release 42 | - CMAKE_BUILD_TYPE=Debug 43 | 44 | matrix: 45 | include: 46 | - compiler: gcc 47 | env: WITH_MPI=ON CMAKE_BUILD_TYPE=Debug 48 | - env: BUILD_TASK=docu 49 | 50 | install: 51 | - if [ "${CXX}" == "g++" ]; then 52 | echo "Using GCC 5" && 53 | export CXX="g++-5" CC="gcc-5"; 54 | else 55 | echo "Using Clang 3.6" && 56 | export CXX="clang-3.6" CC="clang-3.6"; 57 | fi 58 | - if [ "${WITH_MPI}" == "ON" ]; then 59 | echo "Using OpenMPI" && 60 | mkdir -p $HOME/bin && 61 | ln -s /usr/bin/g++-5 $HOME/bin/g++ && 62 | ln -s /usr/bin/gcc-5 $HOME/bin/gcc && 63 | ln -s $HOME/bin/g++ $HOME/bin/c++ && 64 | ln -s $HOME/bin/gcc $HOME/bin/cc && 65 | export CXX="mpicxx" CC="mpicc"; 66 | fi 67 | 68 | before_script: 69 | - printenv | sort -u 70 | - which ${CXX} 71 | - which ${CC} 72 | 73 | script: 74 | - case "${BUILD_TASK}" in 75 | "docu" ) 76 | doxygen --version && doxygen 77 | ;; 78 | "cmake" ) 79 | mkdir build && cd build && 80 | cmake -DCMAKE_INSTALL_PREFIX=${HOME} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -Dpfasst_WITH_MPI=${WITH_MPI} -Dpfasst_BUILD_TESTS=ON -Dpfasst_BUILD_EXAMPLES=ON -DCMAKE_VERBOSE_MAKEFILE=ON .. && 81 | make -j2 && 82 | make test 83 | ;; 84 | esac 85 | 86 | after_success: 87 | - if [ "${BUILD_TASK}" == "docu" && "${TRAVIS_BRANCH}" == "master" && "${TRAVIS_PULL_REQUEST}" == "false"]; then 88 | openssl aes-256-cbc -K $encrypted_5c8922bb07ee_key -iv $encrypted_5c8922bb07ee_iv -in travis_deploy_rsa.enc -out travis_deploy_rsa -d; 89 | chmod 0600 travis_deploy_rsa; 90 | eval "$(ssh-agent -s)"; 91 | ssh-add travis_deploy_rsa; 92 | git config --global user.email "travis+pfasst@parallel-in-time.github.io"; 93 | git config --global user.name "Travis CI Deployment"; 94 | git checkout gh-pages; 95 | git rm -r d[0-9a-f] search *.html *.png *.js *.css *.map *.md5 *.svg; 96 | mv doc/build/html/* .; 97 | git add -A; 98 | git commit -m"docu generated $(date)" -m"commit ${TRAVIS_COMMIT}\njob ${TRAVIS_JOB_NUMBER}" --allow-empty; 99 | git push origin gh-pages; 100 | fi 101 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | PFASST 2 | ====== 3 | 4 | Copyright (c) 2014, Matthew Emmett, Torbjörn Klatt, Daniel Ruprecht, and Robert Speck 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | 29 | Dependencies 30 | ============ 31 | 32 | Easylogging 33 | ----------- 34 | 35 | Easylogging is released under the MIT Licence. Please see http://www.easylogging.org/licence.php 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PFASST {#mainpage} 2 | ====== 3 | 4 | master: ![travis_master_img][] 5 | development: ![travis_dev_img][] 6 | 7 | The PFASST project is a C++ implementation of the *parallel full approximation scheme in space and 8 | time* (PFASST) algorithm, which in turn is a time-parallel algorithm for solving ODEs and PDEs. It 9 | also contains basic implementations of the *spectral deferred correction* (SDC) and *multi-level 10 | spectral deferred correction* (MLSDC) algorithms. 11 | 12 | [travis_master_img]: https://travis-ci.org/Parallel-in-Time/PFASST.svg?branch=master 13 | [travis_dev_img]: https://travis-ci.org/Parallel-in-Time/PFASST.svg?branch=development 14 | 15 | 16 | News 17 | ---- 18 | 19 | * June 01, 2015: PFASST v0.5.0 release. Please see the [release notes](#releases) for more 20 | information. 21 | 22 | * April 17, 2015: PFASST v0.4.0 release. Please see the [release notes](#releases) for more 23 | information. 24 | 25 | * December 12, 2014: PFASST v0.3.0 release. Please see the [release notes](#releases) for more 26 | information. 27 | 28 | * August 29, 2014: PFASST v0.2.0 release. Please see the [release notes](#releases) for more 29 | information. 30 | 31 | * July 25, 2014: PFASST v0.1.0 released. Please see the [release notes](#releases) for more 32 | information. 33 | 34 | 35 | References 36 | ---------- 37 | 38 | See \subpage #citelist . 39 | 40 | 41 | Documentation 42 | ------------- 43 | 44 | Doxygen generated documentation can be found [on _GitHub_ pages][documentation]. 45 | Currently, it features the following content: 46 | 47 | * \subpage #page_building_installing 48 | * \ref Examples 49 | * \subpage #page_contributing 50 | * \subpage #page_style_guide 51 | * \subpage #page_troubleshooting 52 | 53 | [documentation]: https://parallel-in-time.github.io/PFASST/ 54 | 55 | 56 | Releases 57 | -------- 58 | 59 | * **v0.5.0** The MPI Bugfix Release (2015/06/01) 60 | 61 | A few important fixes to MPI behaviour. 62 | DOI: [10.6084/m9.figshare.1431794][DOI_v050]. 63 | See [the Changelog](#page_changelog) for details. 64 | 65 | * **v0.4.0** The Big Improvement (2015/04/17) 66 | 67 | A bunch of improvements and usability enhancements. 68 | DOI: [10.6084/m9.figshare.1381721][DOI_v040]. 69 | See [the Changelog](#page_changelog) for details. 70 | 71 | * **v0.3.0** The Big Cleanup Release (2014/12/12) 72 | 73 | A lot of internal cleanup and usability enhancements. 74 | DOI: [10.5281/zenodo.13221][DOI_v030]. 75 | See [the Changelog](#page_changelog) for details. 76 | 77 | * **v0.2.0** MPI-PFASST Release (2014/08/29) 78 | 79 | Implementation of PFASST with MPI. 80 | DOI: [10.5281/zenodo.11517][DOI_v020]. 81 | See [the Changelog](#page_changelog) for details. 82 | 83 | * **v0.1.0** First Release (2014/07/25) 84 | 85 | Initial release with basic implementations of SDC and MLSDC. 86 | DOI: [10.5281/zenodo.11047][DOI_v010]. 87 | See [the Changelog](#page_changelog) for details. 88 | 89 | [DOI_v010]: http://dx.doi.org/10.5281/zenodo.11047 90 | [DOI_v020]: http://dx.doi.org/10.5281/zenodo.11517 91 | [DOI_v030]: http://dx.doi.org/10.5281/zenodo.13221 92 | [DOI_v040]: http://dx.doi.org/10.6084/m9.figshare.1381721 93 | [DOI_v050]: http://dx.doi.org/10.6084/m9.figshare.1431794 94 | 95 | Release tags will be signed by one of the following PGP keys: 96 | 97 | 0xAD9F8DC6 2014-12-12 Torbjörn Klatt 98 | Fingerprint 6277 E9D9 7AA2 DBBE 5DE7 7498 756B F4D7 AD9F 8DC6 99 | 100 | 1024D/9950EF2E 2001-11-22 Matthew Emmett 101 | Fingerprint B09C 1425 1C47 B58E B3AC 2E74 6F22 8460 9950 EF2E 102 | -------------------------------------------------------------------------------- /cmake/FindEigen3.cmake: -------------------------------------------------------------------------------- 1 | # - Find Eigen3 2 | # Find the native Eigen3 includes 3 | # 4 | # Eigen3_INCLUDE_PATH - where to find signature_of_eigen3_matrix_library 5 | # Eigen3_FOUND - True if Eigen3 found. 6 | 7 | if(Eigen3_INCLUDE_PATH) 8 | # Already in cache, be silent 9 | set(Eigen3_FIND_QUIETLY TRUE) 10 | endif(Eigen3_INCLUDE_PATH) 11 | 12 | find_path(Eigen3_INCLUDE_PATH 13 | signature_of_eigen3_matrix_library 14 | PATH_SUFFIXES eigen3 Eigen3 Eigen 15 | HINTS $ENV{EIGEN3_DIR}/include/eigen3 # Edison 16 | ) 17 | 18 | # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if 19 | # all listed variables are TRUE 20 | include(FindPackageHandleStandardArgs) 21 | find_package_handle_standard_args(Eigen3 DEFAULT_MSG Eigen3_INCLUDE_PATH) 22 | 23 | mark_as_advanced(Eigen3_INCLUDE_PATH) 24 | -------------------------------------------------------------------------------- /cmake/FindFFTW.cmake: -------------------------------------------------------------------------------- 1 | # - Find FFTW 2 | # Find the native FFTW3 includes and library 3 | # 4 | # FFTW_INCLUDE_PATH - where to find fftw3.h 5 | # FFTW_LIBRARIES - List of libraries when using FFTW. 6 | # FFTW_FOUND - True if FFTW found. 7 | 8 | if(FFTW_INCLUDE_PATH) 9 | # Already in cache, be silent 10 | set(FFTW_FIND_QUIETLY TRUE) 11 | endif(FFTW_INCLUDE_PATH) 12 | 13 | find_path(FFTW_INCLUDE_PATH fftw3.h 14 | HINTS ${FFTW3_INCLUDE} 15 | ${FFTW3_INC} 16 | ${FFTW3_ROOT}/include 17 | $ENV{FFTW3_INCLUDE} 18 | $ENV{FFTW3_INC} 19 | $ENV{FFTW_INC} # Edison 20 | $ENV{FFTW3_ROOT}/include 21 | ) 22 | 23 | find_library(FFTW_LIBRARIES NAMES fftw3 fftw3l fftw3_mpi fftw3l_mpi fftw3_omp fftw3l_omp 24 | HINTS ${FFTW3_LIB} 25 | ${FFTW3_ROOT}/lib64 26 | ${FFTW3_ROOT}/lib 27 | $ENV{FFTW3_LIB} 28 | $ENV{FFTW_DIR} # Edison 29 | $ENV{FFTW3_ROOT}/lib64 30 | $ENV{FFTW3_ROOT}/lib 31 | ) 32 | 33 | # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if 34 | # all listed variables are TRUE 35 | include(FindPackageHandleStandardArgs) 36 | find_package_handle_standard_args(FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDE_PATH) 37 | 38 | mark_as_advanced(FFTW_LIBRARIES FFTW_INCLUDE_PATH) 39 | -------------------------------------------------------------------------------- /cmake/FindGMock.cmake: -------------------------------------------------------------------------------- 1 | # Locate the Google C++ Mocking Framework. 2 | # (This file is almost an identical copy of the original FindGTest.cmake file, 3 | # feel free to use it as it is or modify it for your own needs.) 4 | # 5 | # 6 | # Defines the following variables: 7 | # 8 | # GMOCK_FOUND - Found the Google Testing framework 9 | # GMOCK_INCLUDE_DIRS - Include directories 10 | # 11 | # Also defines the library variables below as normal 12 | # variables. These contain debug/optimized keywords when 13 | # a debugging library is found. 14 | # 15 | # GMOCK_BOTH_LIBRARIES - Both libgmock & libgmock-main 16 | # GMOCK_LIBRARIES - libgmock 17 | # GMOCK_MAIN_LIBRARIES - libgmock-main 18 | # 19 | # Accepts the following variables as input: 20 | # 21 | # GMOCK_ROOT - (as a CMake or environment variable) 22 | # The root directory of the gmock install prefix 23 | # 24 | # GMOCK_MSVC_SEARCH - If compiling with MSVC, this variable can be set to 25 | # "MD" or "MT" to enable searching a gmock build tree 26 | # (defaults: "MD") 27 | # 28 | #----------------------- 29 | # Example Usage: 30 | # 31 | # find_package(GMock REQUIRED) 32 | # include_directories(${GMOCK_INCLUDE_DIRS}) 33 | # 34 | # add_executable(foo foo.cc) 35 | # target_link_libraries(foo ${GMOCK_BOTH_LIBRARIES}) 36 | # 37 | #============================================================================= 38 | # This file is released under the MIT licence: 39 | # 40 | # Copyright (c) 2011 Matej Svec 41 | # 42 | # Permission is hereby granted, free of charge, to any person obtaining a copy 43 | # of this software and associated documentation files (the "Software"), to 44 | # deal in the Software without restriction, including without limitation the 45 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 46 | # sell copies of the Software, and to permit persons to whom the Software is 47 | # furnished to do so, subject to the following conditions: 48 | # 49 | # The above copyright notice and this permission notice shall be included in 50 | # all copies or substantial portions of the Software. 51 | # 52 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 53 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 54 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 55 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 56 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 57 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 58 | # IN THE SOFTWARE. 59 | #============================================================================= 60 | 61 | 62 | function(_gmock_append_debugs _endvar _library) 63 | if(${_library} AND ${_library}_DEBUG) 64 | set(_output optimized ${${_library}} debug ${${_library}_DEBUG}) 65 | else() 66 | set(_output ${${_library}}) 67 | endif() 68 | set(${_endvar} ${_output} PARENT_SCOPE) 69 | endfunction() 70 | 71 | function(_gmock_find_library _name) 72 | find_library(${_name} 73 | NAMES ${ARGN} 74 | HINTS 75 | $ENV{GMOCK_ROOT} 76 | ${GMOCK_ROOT} 77 | PATH_SUFFIXES ${_gmock_libpath_suffixes} 78 | ) 79 | mark_as_advanced(${_name}) 80 | endfunction() 81 | 82 | 83 | if(NOT DEFINED GMOCK_MSVC_SEARCH) 84 | set(GMOCK_MSVC_SEARCH MD) 85 | endif() 86 | 87 | set(_gmock_libpath_suffixes lib) 88 | if(MSVC) 89 | if(GMOCK_MSVC_SEARCH STREQUAL "MD") 90 | list(APPEND _gmock_libpath_suffixes 91 | msvc/gmock-md/Debug 92 | msvc/gmock-md/Release) 93 | elseif(GMOCK_MSVC_SEARCH STREQUAL "MT") 94 | list(APPEND _gmock_libpath_suffixes 95 | msvc/gmock/Debug 96 | msvc/gmock/Release) 97 | endif() 98 | endif() 99 | 100 | find_path(GMOCK_INCLUDE_DIR gmock/gmock.h 101 | HINTS 102 | $ENV{GMOCK_ROOT}/include 103 | ${GMOCK_ROOT}/include 104 | ) 105 | mark_as_advanced(GMOCK_INCLUDE_DIR) 106 | 107 | if(MSVC AND GMOCK_MSVC_SEARCH STREQUAL "MD") 108 | # The provided /MD project files for Google Mock add -md suffixes to the 109 | # library names. 110 | _gmock_find_library(GMOCK_LIBRARY gmock-md gmock) 111 | _gmock_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd) 112 | _gmock_find_library(GMOCK_MAIN_LIBRARY gmock_main-md gmock_main) 113 | _gmock_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_main-mdd gmock_maind) 114 | else() 115 | _gmock_find_library(GMOCK_LIBRARY gmock) 116 | _gmock_find_library(GMOCK_LIBRARY_DEBUG gmockd) 117 | _gmock_find_library(GMOCK_MAIN_LIBRARY gmock_main) 118 | _gmock_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_maind) 119 | endif() 120 | 121 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR GMOCK_MAIN_LIBRARY) 122 | 123 | if(GMOCK_FOUND) 124 | set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR}) 125 | _gmock_append_debugs(GMOCK_LIBRARIES GMOCK_LIBRARY) 126 | _gmock_append_debugs(GMOCK_MAIN_LIBRARIES GMOCK_MAIN_LIBRARY) 127 | 128 | set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES}) 129 | endif() 130 | 131 | -------------------------------------------------------------------------------- /cmake/FindMPIP.cmake: -------------------------------------------------------------------------------- 1 | # - Find MPIP 2 | # Find the mpiP library 3 | # 4 | # MPIP_LIBRARIES - List of libraries when using MPIP. 5 | # MPIP_FOUND - True if mpiP was found. 6 | 7 | if(MPIP_LIBRARIES) 8 | # Already in cache, be silent 9 | set(MPIP_FIND_QUIETLY TRUE) 10 | endif(MPIP_LIBRARIES) 11 | 12 | find_library(MPIP_LIBRARIES NAMES mpiP mpip 13 | HINTS ${MPIP_ROOT}/lib 14 | ${MPIP_ROOT}/lib64 15 | $ENV{MPIP_LIB} 16 | $ENV{MPIP_ROOT}/lib 17 | $ENV{MPIP_ROOT}/lib64 18 | $ENV{MPIP_DIR}/lib 19 | $ENV{MPIP_DIR}/lib64 20 | ) 21 | list(APPEND MPIP_LIBRARIES m bfd iberty unwind) 22 | 23 | # handle the QUIETLY and REQUIRED arguments and set MPIP_FOUND to TRUE if 24 | # all listed variables are TRUE 25 | include(FindPackageHandleStandardArgs) 26 | find_package_handle_standard_args(MPIP DEFAULT_MSG MPIP_LIBRARIES) 27 | 28 | mark_as_advanced(MPIP_LIBRARIES) 29 | -------------------------------------------------------------------------------- /cmake/cc_wrapper.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | C_COMPILER=@CMAKE_C_COMPILER@ 4 | 5 | $PREP $C_COMPILER $@ 6 | -------------------------------------------------------------------------------- /cmake/cxx_wrapper.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CXX_COMPILER=@CMAKE_CXX_COMPILER@ 4 | 5 | $PREP $CXX_COMPILER $@ 6 | -------------------------------------------------------------------------------- /cmake/site_config.hpp.in: -------------------------------------------------------------------------------- 1 | @WARNING_COMMENT@ 2 | 3 | #ifndef _PFASST__SITE_CONFIG_HPP 4 | #define _PFASST__SITE_CONFIG_HPP 5 | 6 | #include 7 | using namespace std; 8 | 9 | namespace pfasst 10 | { 11 | static constexpr const char* VERSION = "@pfasst_VERSION@"; 12 | } // ::pfasst 13 | 14 | #endif // _PFASST__SITE_CONFIG_HPP 15 | -------------------------------------------------------------------------------- /cmake/toolchain_juqueen.cmake: -------------------------------------------------------------------------------- 1 | # Toolchain File for JUQUEEN @ Juelich Supercomputing Center 2 | # BG/Q system 3 | # 4 | # Remark: IBM XL/C++ compiler is not supported by PFASST++ due to lack of C++11 support 5 | # 6 | # IMPORTANT!! 7 | # Make sure you have loaded only the following modules: 8 | # - gcc/4.8.1 9 | # - fftw3/3.3.3 10 | # - python3/3.4.2 11 | # 12 | 13 | message(STATUS "Please make sure you have loaded at least gcc/4.8.1") 14 | 15 | set(CMAKE_C_COMPILER /bgsys/local/gcc/4.8.1/bin/mpigcc) 16 | set(CMAKE_CXX_COMPILER /bgsys/local/gcc/4.8.1/bin/mpig++) 17 | set(CMAKE_Fortran_COMPILER /bgsys/local/gcc/4.8.1/bin/mpigfortran) 18 | 19 | set(MPI_ROOT /bgsys/local/gcc/4.8.1) 20 | set(MPI_C_COMPILER ${MPI_ROOT}/bin/mpigcc) 21 | set(MPI_CXX_COMPILER ${MPI_ROOT}/bin/mpig++) 22 | set(MPI_Fortran_COMPILER ${MPI_ROOT}/bin/mpigfortran) 23 | 24 | set(PYTHON_EXECUTABLE /bgsys/local/python3/3.4.2/bin/python3) 25 | -------------------------------------------------------------------------------- /cmake/utility_functions.cmake: -------------------------------------------------------------------------------- 1 | function(add_to_string_list in_string out_string) 2 | # message(STATUS "Adding '${ARGN}' to '${in_string}'") 3 | foreach(element ${ARGN}) 4 | # message(STATUS " processing: '${element}'") 5 | if(NOT "${element}" STREQUAL "") 6 | # escape regex commands in new element 7 | string(REPLACE "\\" "\\\\" elem_escaped "${element}") 8 | string(REGEX REPLACE "([][.?*+|()$^-])" "\\\\\\1" elem_escaped "${elem_escaped}") 9 | 10 | # only append if not already in string 11 | if("${in_string}" MATCHES "${elem_escaped}") 12 | # message(STATUS " '${element}' found as '${elem_escaped}'") 13 | else() 14 | set(in_string "${in_string} ${element}") 15 | # message(STATUS " '${element}' appended") 16 | endif() 17 | endif() 18 | endforeach(element) 19 | # message(STATUS "Full string is now: '${in_string}'") 20 | set(${out_string} ${in_string} PARENT_SCOPE) 21 | endfunction(add_to_string_list) 22 | 23 | macro(msg_not_installed dependency_name) 24 | message("!!!!") 25 | message("! ${dependency_name} will not be installed with PFASST++.") 26 | message("! When using PFASST++ with your own code, please make sure to also add") 27 | message("! ${dependency_name} manually to your project.") 28 | message("!!!!") 29 | endmacro(msg_not_installed) 30 | 31 | macro(update_site_config) 32 | set(WARNING_COMMENT "/*\n * DO NOT ALTER THIS FILE\n *\n * It will get rewritten on CMake's next run\n */") 33 | execute_process(COMMAND git describe --dirty 34 | OUTPUT_VARIABLE pfasst_VERSION 35 | OUTPUT_STRIP_TRAILING_WHITESPACE) 36 | configure_file( 37 | "${pfasst_SOURCE_DIR}/cmake/site_config.hpp.in" 38 | "${CMAKE_CURRENT_SOURCE_DIR}/include/pfasst/site_config.hpp" 39 | ) 40 | add_definitions(-DPFASST_USE_LOCAL_CONFIG) 41 | endmacro(update_site_config) 42 | -------------------------------------------------------------------------------- /doc/source/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Parallel-in-Time/PFASST/655085fae12b7cce8558484baefdac1bf3d84c2c/doc/source/.placeholder -------------------------------------------------------------------------------- /doc/source/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing {#page_contributing} 2 | 3 | ## Branching and Tagging Model 4 | 5 | We use the [git-flow] workflow to that extend, that branch 6 | names(paces) have a certain meaing: 7 | 8 | Branch Name Pattern | Description 9 | --------------------|------------ 10 | `master` | tip of the `master` branch is always the latest stable release 11 | `development` | tip of the `development` branch is the current state of development and not expected to be stable or even usable 12 | `feature/*` | various feature branches are used to implement new features and should be based off the `development` branch 13 | `release/*` | a release branch is created from the `development` branch and used to prepare a new release and will be merged into `master` 14 | `hotfix/*` | hotfix branches are based off `master` or `development` to fix important and severe bugs and should be merged into `development` and `master` as soon as possible 15 | 16 | Releases and release candidates are tagged in the form 17 | `release-X.Y.Z(-RCa)`, where `X`, `Y`, and `Z` specify the version 18 | with respect to [semantic versioning] and `a` the number of the 19 | release candidate of that version. 20 | 21 | 22 | ## Commit Messages 23 | 24 | To ease browsing the proejct's history, we try to keep our commit 25 | messages clean and descriptive. Please try to follow the following 26 | rules as best as possible: 27 | 28 | * Commit Title must not be longer than 50 characters 29 | 30 | If applicable, the title should start with a category name (such as 31 | `docu`, `tests`, ...) followed by a colon (e.g. `"docu: add usage 32 | examples for plain SDC"` ). 33 | 34 | * Commit Description must have line wraps at 72 characters 35 | 36 | * Please *sign* your commits (i.e. use `git commit -s`) 37 | 38 | This automatically appends a line of the form `"Signed-off-by: 39 | Torbjörn Klatt "` to the end of the commit 40 | message. 41 | 42 | 43 | ## How to Implement a New Feature? 44 | 45 | -# create a fork/clone 46 | -# switch to the `development` branch and pull in the latest changes 47 | -# create a new branch `feature/XYZ` where `XYZ` is a short title of 48 | your planned feature (word seperation should be done with 49 | underscores, e.g. `feature/my_awesome_feature`) 50 | -# hack and write Unit Tests 51 | -# commit 52 | -# repeat steps 4 and 5 until you feel your feature is in an almost 53 | usable state and most of the unit tests pass 54 | -# write documentation for your feature 55 | -# push your feature branch 56 | -# stay tuned on reviews, remarks and suggestions by the other 57 | developers 58 | 59 | 60 | [git-flow]: http://nvie.com/posts/a-successful-git-branching-model/ 61 | [semantic versioning]: http://semver.org/ 62 | -------------------------------------------------------------------------------- /doc/source/customized/custom.css: -------------------------------------------------------------------------------- 1 | #nav-tree img { 2 | box-sizing: content-box; 3 | } 4 | 5 | ul.meta-info-block { 6 | font-size: 0.8em; 7 | color: gray; 8 | padding: 0; 9 | } 10 | 11 | ul.meta-info-block > li { 12 | display: block; 13 | margin: -3px; 14 | } 15 | 16 | p.lead { 17 | font-size: 1.15em; 18 | font-style: italic; 19 | } 20 | 21 | code { 22 | border: 1px solid #C4CFE5; 23 | background-color: #FBFCFD; 24 | padding: 1px; 25 | } 26 | 27 | .memdoc .panel { 28 | margin-bottom: 5px !important; 29 | } 30 | 31 | .memdoc .panel .panel-heading, 32 | .memdoc .panel .panel-body, 33 | .memdoc .panel .list-group-item, 34 | .reflist .panel .panel-heading, 35 | .reflist .panel .panel-body, 36 | .textblock .panel .panel-heading, 37 | .textblock .panel .panel-body { 38 | padding: 5px; 39 | padding-left: 10px; 40 | } 41 | .memdoc .section.see { 42 | font-size: 90%; 43 | } 44 | 45 | .panel-footer ul { 46 | margin-top: 0; 47 | margin-bottom: 0; 48 | } 49 | 50 | /* width of all text blocks */ 51 | .textblock, 52 | .memdoc.panel-body > *, 53 | .memdoc > .panel, 54 | .memdoc > .panel > .panel-body > *, 55 | .memitem > .panel, 56 | .memitem > .panel > .panel-body > * { 57 | width: 750px; 58 | } 59 | 60 | 61 | table.directory .badge { 62 | margin-right: 3px; 63 | } 64 | 65 | dl.citelist > dd > p { 66 | padding-left: 50px; 67 | } 68 | -------------------------------------------------------------------------------- /doc/source/customized/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /doc/source/customized/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | $projectname: $title 10 | $title 11 | 12 | 13 | 14 | $treeview 15 | $search 16 | $mathjax 17 | 18 | 19 | 20 | $extrastylesheet 21 | 22 | 23 |
24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
35 |
$projectname 36 |  $projectnumber 37 |
38 |
$projectbrief
39 |
44 |
$projectbrief
45 |
$searchbox
56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /doc/source/literature.bib: -------------------------------------------------------------------------------- 1 | @article{emmett_pfasst_2012, 2 | author="Matthew Emmett and Michael L. Minion", 3 | title="Toward an Efficient Parallel in Time Method for Partial Differential Equations", 4 | journal="Communications in Applied Mathematics and Computational Science", 5 | volume="7", 6 | pages="105--132", 7 | year="2012", 8 | url={http://dx.doi.org/10.2140/camcos.2012.7.105} 9 | } 10 | 11 | @unpublished{winkel_boris_2014, 12 | title={A high-order {B}oris integrator}, 13 | author={Winkel, Mathias and Speck, Robert and Ruprecht, Daniel}, 14 | note={Submitted to Journal of Computational Physics}, 15 | year={2014}, 16 | url={http://arxiv.org/abs/1409.5677} 17 | } 18 | -------------------------------------------------------------------------------- /doc/source/scorep.md: -------------------------------------------------------------------------------- 1 | # Instrumentation with Score-P and usage of extra compiler wrappers {#page_scorep} 2 | 3 | The _CMake_ build system of _PFASST++_ offers the option `pfasst_WITH_EXTRA_WRAPPER` that if enabled will create to shell scripts called `cc_wrapper.sh` and `cxx_wrapper.sh` in the build directory.These can be used to specify a compiler wrapper. Therefore the environment variable `PREP` is used. All compiler calls of the build system will result in calls to `$PREP `. This will be demonstrated with the example of Score-P a scalable performance and communication analysis tool. 4 | 5 | 1. Call cmake as usual but pass the argument `-Dpfasst_WITH_EXTRA_WRAPPER=ON` option. There should now be two shell scripts in the build directory. 6 | 7 | 2. When compiling use `PREP=scorep make` instead of `make` otherwise you will compile as usual. The binaries are now instrumented using Score-P. 8 | 9 | Note on linking: On some architectures you only want to add Score-P during the link step. Therefore first compile without setting `PREP` which will result in an unistrumented object and binary. Than delete the binary and compile with `PREP=scorep`. Because the object files have not been deleted only the binaries will be linked (now with Score-P support). 10 | -------------------------------------------------------------------------------- /doc/source/style_guide.md: -------------------------------------------------------------------------------- 1 | # Style Guide {#page_style_guide} 2 | 3 | ## Naming Convention 4 | 5 | In general, abbreviations should only be used if they are absolutely 6 | unambigious and would save a lot of horizontal space. 7 | 8 | Always use underscores (`_`) to separate words. 9 | 10 | * __Files__ 11 | 12 | To accomodate systems which do not distinguish between upper and 13 | lower case in file and path names, always use lowercase for file 14 | names and directories. 15 | 16 | Header files should be named after the main/central class that they 17 | contain. For example, a class `MyClass` should be in a header file 18 | called `my_header.hpp`. Separate words by underscores. 19 | 20 | * __Namespaces__ 21 | 22 | Should always be lowercase and not too long. 23 | 24 | * __Class Names__ 25 | 26 | Should start with a capital letter and use _CamelCase_. 27 | 28 | Abstract classes should start with a capital `I` denoting an 29 | _interface_. For example, `ISweeper`. 30 | 31 | * __Function Names__ 32 | 33 | Should always be lowercase. 34 | 35 | * __Variable Names__ 36 | 37 | Should always be lowercase. Constants should all be uppercase with 38 | undersocres as word separation. 39 | 40 | * __Template Parameters__ 41 | 42 | When template parameters refer to a type name, append a capital `T` 43 | to the name of the template parameter. For example 44 | ~~~{.cpp} 45 | template 46 | int my_func(std::vector &vec); 47 | ~~~ 48 | 49 | Acceptable exceptions to this rule are `scalar` (which denotes a 50 | spatial type, e.g. `complex`) and `time` (which denotes a 51 | temporal type, e.g. `double`). 52 | 53 | 54 | ## Techniques 55 | 56 | ### Includes 57 | 58 | System headers and those from third party libraries should be included 59 | using angular brackets. Headers from our library should be included 60 | using double quotes. 61 | 62 | ### Define Guards 63 | 64 | Use `#%define` guards in header files to prevent multiple inclusion. 65 | The variable defined should be derived from the header file name 66 | itself. For example, a header file `my_header.hpp` in the folder 67 | `PFASST/include/subfolder` should have the following define guard: 68 | 69 | ~~~{.cpp} 70 | #ifndef PFASST__SUBFOLDER__MY_HEADER_HPP 71 | #define PFASST__SUBFOLDER__MY_HEADER_HPP 72 | // file content 73 | #endif // PFASST__SUBFOLDER__MY_HEADER_HPP 74 | ~~~ 75 | 76 | Always include the library name and at least one subfolder (if 77 | applicable) to prevent multiple defines in files with the same name 78 | but in different folders. 79 | 80 | ### Encapsulation / Clean API 81 | 82 | We want to provide a clean API, thus we use encapsulation wherever 83 | possible. For classes, we prefer private member/data variables and 84 | provide access to them via getter/setter methods. 85 | 86 | ### C++ Feature Set 87 | 88 | We agreed on using the "most common" C++11 features. These are: 89 | 90 | * `auto` keyword 91 | * `shared_ptr` and `unique_ptr` 92 | * type traits 93 | * static asserts 94 | * Rvalue references and move semantics 95 | * `decltype` 96 | * delegating constructor 97 | * `constexpr` 98 | * right angle bracket (`vector >` vs. `>`) 99 | 100 | @todo Check the list of used/required C++11 features and possibly extend it by a list of minimum 101 | compiler versions supporting the features. 102 | 103 | 104 | ## Documentation 105 | 106 | Document your code. 107 | 108 | We use [Doxygen] for generating the documentation webpage. You can use pretty much all the features, 109 | Doxygen provides, including [MathJAX] for formulas and [Markdown] for easy text formatting. 110 | 111 | It is advised to use Doxygen's special commands wherever possible to aid readability of the 112 | generated documentation. 113 | Especially, one should use `@tparam `, `@param[,] `, 114 | `@returns `, `@throws `. 115 | 116 | There is an additional custom defined block available to mark documentation of internals. 117 | Therefore, sourround the respective block with `internals` and `endinternals` (as Doxygen commands). 118 | 119 | 120 | ## Formatting 121 | 122 | In short: no tabs, 2 spaces, sane indent-continuation. 123 | 124 | We provide a configuration file for the code beautifier [uncrustify] 125 | which does a pretty good job to ensure consistent formatting of the 126 | source files. 127 | 128 | 129 | [Doxygen]: http://www.stack.nl/~dimitri/doxygen/index.html 130 | [MathJAX]: http://www.stack.nl/~dimitri/doxygen/manual/formulas.html 131 | [Markdown]: http://www.stack.nl/~dimitri/doxygen/manual/markdown.html 132 | [uncrustify]: http://uncrustify.sourceforge.net/ 133 | -------------------------------------------------------------------------------- /doc/source/supercomputers.md: -------------------------------------------------------------------------------- 1 | # Usage on Supercomputers {#page_supercomputers} 2 | 3 | ## JUQUEEN 4 | 5 | There are a few steps one has to complete before using _PFASST++_ on _JUQUEEN_. 6 | 7 | 1. make sure the only modules loaded are `gcc/4.8.1` and `fftw3/3.3.3` 8 | 9 | 2. prepare a custom installation of _Boost_ 10 | 11 | Because at time of writing only 1.47.0 is available compiled with _XL/C++_, which does not 12 | support the C++11 features we learned to love. 13 | 14 | 1. download a recent version of _Boost_ (i.e. 1.57.0) 15 | 16 | 2. extract the archive and `cd` into it 17 | 18 | 3. run 19 | 20 | CXX=`which mpig++` CC=`which mpigcc` ./bootstrap.sh \ 21 | --with-libraries=program_options --prefix= 22 | 23 | where `INSTALL_PLACE` is something like `$HOME/progs/juqueen` 24 | 25 | 4. create file called `user-config.jam` with the following content: 26 | 27 | using gcc : 4.8.1 : mpig++ ; 28 | 29 | 5. now compile 30 | 31 | CXX=`which mpig++` CC=`which mpigcc` ./b2 --prefix= \ 32 | --reconfigure link=static stage 33 | 34 | and install 35 | 36 | CXX=`which mpig++` CC=`which mpigcc` ./b2 --prefix= \ 37 | link=static install 38 | 39 | 3. go to the sources of _PFASST++_, create a build folder and step into it 40 | 41 | 4. run _CMake_ 42 | 43 | cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain_juqueen.cmake \ 44 | -DCMAKE_CXX_COMPILER=`which mpig++` -DCMAKE_C_COMPILER=`which mpigcc` \ 45 | -DBOOST_ROOT= -Dpfasst_WITH_MPI=ON \ 46 | -Dpfasst_BUILD_TESTS=OFF -Dpfasst_BUILD_SHARED_LIBS=OFF .. 47 | 48 | 5. run make 49 | 50 | make 51 | 52 | 6. write your _LLSubmit_ configuration file 53 | 54 | for example for the Advection-Diffusion example: 55 | 56 | #@job_name = MPI_PFASST_test 57 | #@comment = "a little test of PFASST with MPI" 58 | #@output = mpi_pfasst_test_$(jobid)_$(stepid).out 59 | #@error = mpi_pfasst_test_$(jobid)_$(stepid).err 60 | #@environment = COPY_ALL 61 | #@job_type = bluegene 62 | #@notification = never 63 | #@wall_clock_limit = 00:10:00 64 | #@bg_size = 1 65 | #@bg_connectivity = TORUS 66 | #@queue 67 | runjob --np 32 --ranks-per-node 32 : \ 68 | /examples/advection_diffusion/mpi_pfasst \ 69 | -q --tend 0.64 --dt 0.01 --num_iter 8 70 | 71 | ## Edison 72 | 73 | There are a few steps one has to complete before using _PFASST++_ on 74 | _Edison_. These steps have been tested with the GNU programming 75 | environment (that is, with the `PrgEnv-gnu` module). 76 | 77 | 1. Load the following modules: 78 | 79 | module load cmake python fftw eigen3 boost 80 | 81 | 2. Go to the sources of _PFASST++_, create a `build` folder and step into it: 82 | 83 | cd PFASST 84 | mkdir build 85 | cd build 86 | 87 | 3. Run _CMake_ 88 | 89 | cmake -Dpfasst_BUILD_TESTS=OFF -Dpfasst_BUILD_SHARED_LIBS=OFF .. 90 | 91 | 4. Run _make_ 92 | 93 | make -j 4 94 | 95 | 5. Run an example in an interactive job: 96 | 97 | qsub -I -q debug -l mppwidth=4 98 | cd PFASST/build/examples/advection_diffusion 99 | aprun -n 4 ./mpi_pfasst -c 100 | 101 | -------------------------------------------------------------------------------- /doc/source/troubleshooting.md: -------------------------------------------------------------------------------- 1 | # Trouble Shooting {#page_troubleshooting} 2 | 3 | ## I'm getting SEGFAULTs, how do I track them down? 4 | 5 | Please try running your program through GDB and/or valgrind. 6 | 7 | ## How do I run my MPI program through GDB? 8 | 9 | To run your MPI program through GDB: 10 | 11 | mpirun -n 4 xterm -e gdb -x my-gdb-commands my-pfasst-program 12 | 13 | where `my-gdb-commands` is a plain text file containing GDB commands 14 | to run your program, and `my-pfasst-program` is your executable. A 15 | very simple set of GDB commands for the `my-gdb-commands` is: 16 | 17 | catch throw 18 | run 19 | 20 | The result is: `mpirun` will launch 4 `xterm` windows, each of which 21 | will immediately run your program through `gdb`, which subsequently 22 | runs your program. Hopefully GDB will catch the SEGFAULT. 23 | 24 | ## How do I run my MPI program through valgrind? 25 | 26 | To run your MPI program through valgrind: 27 | 28 | mpirun -n 4 xterm -e valgrind my-pfasst-program 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(examples_to_install ${examples_to_install}) 2 | 3 | add_subdirectory(advection_diffusion) 4 | add_subdirectory(scalar) 5 | add_subdirectory(vanderpol) 6 | 7 | set(examples_to_install ${examples_to_install} PARENT_SCOPE) 8 | -------------------------------------------------------------------------------- /examples/advection_diffusion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(examples_to_install ${examples_to_install}) 2 | 3 | message(STATUS " advection_diffusion") 4 | include_directories( 5 | ${3rdparty_INCLUDES} 6 | ${FFTW_INCLUDE_PATH} 7 | ${pfasst_INCLUDES} 8 | ) 9 | 10 | set(advec_examples 11 | vanilla_sdc 12 | serial_mlsdc 13 | ) 14 | 15 | set(advec_mpi_examples) 16 | 17 | if(${pfasst_WITH_MPI}) 18 | set(advec_mpi_examples 19 | mpi_pfasst 20 | ) 21 | set(all_advec_examples ${advec_examples} ${advec_mpi_examples}) 22 | else() 23 | set(all_advec_examples ${advec_examples}) 24 | endif() 25 | 26 | foreach(example ${all_advec_examples}) 27 | add_executable(${example} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.cpp) 28 | if(NOT FFTW_FOUND) 29 | add_dependencies(${example} fftw3) 30 | endif() 31 | if(${pfasst_NUM_DEPENDEND_TARGETS} GREATER 0) 32 | add_dependencies(${example} ${pfasst_DEPENDEND_TARGETS}) 33 | endif() 34 | target_link_libraries(${example} 35 | ${pfasst_DEPENDEND_LIBS} 36 | ${3rdparty_DEPENDEND_LIBS} 37 | ${FFTW_LIBRARIES} 38 | ) 39 | if(pfasst_INSTALL_EXAMPLES) 40 | install(TARGETS ${example} RUNTIME DESTINATION bin) 41 | endif() 42 | endforeach(example) 43 | 44 | set(examples_to_install ${examples_to_install} ${all_advec_examples} PARENT_SCOPE) 45 | -------------------------------------------------------------------------------- /examples/advection_diffusion/Makefile: -------------------------------------------------------------------------------- 1 | PFASST := $(abspath ../..) 2 | CXX := mpic++ 3 | CXXFLAGS ?= -std=c++11 -g -I$(PFASST)/include -I/usr/include/eigen3 4 | LDFLAGS ?= -lfftw3 5 | 6 | all: vanilla_sdc mpi_pfasst serial_mlsdc 7 | 8 | vanilla_sdc: vanilla_sdc.cpp 9 | $(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) 10 | 11 | serial_mlsdc: serial_mlsdc.cpp 12 | $(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) 13 | 14 | mpi_pfasst: mpi_pfasst.cpp 15 | $(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) 16 | -------------------------------------------------------------------------------- /examples/advection_diffusion/Makefile.edison: -------------------------------------------------------------------------------- 1 | # 2 | # Simple Makefile for Edison. 3 | # 4 | # Make sure the following modules have been loaded: fftw, eigen3. 5 | # 6 | # This has been tested with the PrgEnv-gnu module. 7 | # 8 | 9 | PFASST := $(abspath ../..) 10 | CXX := CC 11 | 12 | CXXFLAGS ?= -std=c++11 13 | CXXFLAGS += -I$(PFASST)/include -I$(PFASST)/src 14 | CXXFLAGS += -I$(EIGEN3_DIR)/include/eigen3 15 | CXXFLAGS += -I$(FFTW_INC) 16 | 17 | LDFLAGS += -L$(FFTW_DIR) 18 | LDFLAGS += -lfftw3 19 | 20 | all: vanilla_sdc mpi_pfasst serial_mlsdc 21 | 22 | vanilla_sdc: vanilla_sdc.cpp 23 | $(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) 24 | 25 | serial_mlsdc: serial_mlsdc.cpp 26 | $(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) 27 | 28 | mpi_pfasst: mpi_pfasst.cpp 29 | $(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) 30 | -------------------------------------------------------------------------------- /examples/advection_diffusion/fft_manager.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @ingroup AdvectionDiffusionFiles 3 | * @file examples/advection_diffusion/fft_manager.hpp 4 | * @since v0.6.0 5 | */ 6 | #ifndef _EXAMPLES__ADVEC_DIFF__FFT_MANAGER_HPP_ 7 | #define _EXAMPLES__ADVEC_DIFF__FFT_MANAGER_HPP_ 8 | 9 | #include 10 | #include 11 | using std::map; 12 | using std::shared_ptr; 13 | 14 | 15 | namespace pfasst 16 | { 17 | namespace examples 18 | { 19 | namespace advection_diffusion 20 | { 21 | /** 22 | * Container to hold and query for FFTW workspaces. 23 | * 24 | * The @ref FFTManager holds all instances of @ref FFTWorkspace once queried through 25 | * FFTManager::get_workspace(). 26 | * 27 | * @tparam WorkspaceT type of the @ref FFTWorkspace the manager instance is for 28 | */ 29 | template 30 | class FFTManager 31 | { 32 | public: 33 | //! @{ 34 | using workspace_t = WorkspaceT; 35 | //! @} 36 | 37 | protected: 38 | //! @{ 39 | //! Storage of workspaces mapped to their number of DOFs 40 | map> _workspaces; 41 | //! @} 42 | 43 | public: 44 | //! @{ 45 | FFTManager() = default; 46 | FFTManager(const FFTManager&) = default; 47 | FFTManager(FFTManager&&) = default; 48 | virtual ~FFTManager() = default; 49 | //! @} 50 | 51 | //! @{ 52 | FFTManager& operator=(const FFTManager&) = default; 53 | FFTManager& operator=(FFTManager&&) = default; 54 | //! @} 55 | 56 | //! @{ 57 | /** 58 | * Get the one @ref FFTWorkspace for given number of DOFs 59 | * 60 | * @param[in] ndofs number of degrees of freedom of FFTW workspace 61 | * @return shared pointer to the only workspace with given number of DOFs 62 | */ 63 | shared_ptr get_workspace(const size_t ndofs); 64 | //! @} 65 | 66 | //! @{ 67 | /** 68 | * Finalizes cleanup of FFT resources 69 | * 70 | * Calls `WorkspaceT::finalize_cleanup()`. 71 | */ 72 | static void finalize_cleanup(); 73 | //! @} 74 | }; 75 | 76 | /** 77 | * @class pfasst::examples::advection_diffusion::FFTWorkspace 78 | * @brief Concept of a FFT workspace 79 | * 80 | * A FFT workspace, manageable by @ref FFTManager, provides a wrapper around calls to FFT 81 | * and persists variables and memory between calls to FFT. 82 | * 83 | * A @ref FFTWorkspace is expected to conform to the RAII principle. 84 | * 85 | * Usually, the initial setup of FFT for a given number of degrees of freedom is done on 86 | * construction of a @ref FFTWorkspace, e.g. allocating memory for transformed values and 87 | * creating _plans_. 88 | * 89 | * Cleanup and freeing of this setup should be done on destruction. 90 | * 91 | * A FFTWorkspace has the following member functions implemented: 92 | * 93 | * * `complex* FFTWorkspace::forward(const DataT&)` 94 | * 95 | * Transforms given data encapsulation to Fourier space and returns pointer to transformed 96 | * values. 97 | * `DataT` is the encapsulation type, e.g. pfasst::encap::VectorEncapsulation, 98 | * and `DataT::value_type` the type of the data at a single point in space, e.g. `double`. 99 | * 100 | * * `void FFTWorkspace::backward(DataT&)` 101 | * 102 | * Transformed values in Fourier space stored in `z_ptr()` back to problem space and stores 103 | * them in given `DataT` object, overwriting existing data. 104 | * `DataT` is the encapsulation type. 105 | * 106 | * * `size_t size() const` 107 | * 108 | * Returns number of degrees of freedom of this workspace. 109 | * 110 | * * `complex* z_ptr()` 111 | * 112 | * Returns a pointer to the values in Fourier space for computations in Fourier space. 113 | * 114 | * * `static void finalize_cleanup()` 115 | * 116 | * Routine to do static cleanup after freeing all other workspaces. 117 | * Some FFT implementations require to call a cleanup function before program exit, e.g. 118 | * `fftw_cleanup()`. 119 | * 120 | * @note This is only the specification of a concept and not available as code. 121 | * @ingroup Concepts 122 | */ 123 | } // ::pfasst::examples::advection_diffusion 124 | } // ::pfasst::examples 125 | } // ::pfasst 126 | 127 | #include "fft_manager_impl.hpp" 128 | 129 | #endif // _EXAMPLES__ADVEC_DIFF__FFT_MANAGER_HPP_ 130 | -------------------------------------------------------------------------------- /examples/advection_diffusion/fft_manager_impl.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @ingroup AdvectionDiffusionFiles 3 | * @file examples/advection_diffusion/fft_manager_impl.hpp 4 | * @since v0.6.0 5 | */ 6 | #include "fft_manager.hpp" 7 | 8 | #include 9 | using std::pair; 10 | 11 | 12 | namespace pfasst 13 | { 14 | namespace examples 15 | { 16 | namespace advection_diffusion 17 | { 18 | template 19 | shared_ptr FFTManager::get_workspace(const size_t ndofs) 20 | { 21 | if (this->_workspaces.find(ndofs) == this->_workspaces.end()) { 22 | auto ws = make_shared(ndofs); 23 | this->_workspaces.insert(pair>(ndofs, ws)); 24 | } 25 | 26 | return this->_workspaces[ndofs]; 27 | } 28 | 29 | template 30 | void FFTManager::finalize_cleanup() 31 | { 32 | WorkspaceT::finalize_cleanup(); 33 | } 34 | } // ::pfasst::examples::advection_diffusion 35 | } // ::pfasst::examples 36 | } // ::pfasst 37 | -------------------------------------------------------------------------------- /examples/advection_diffusion/fftw_workspace_dft1d.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @ingroup AdvectionDiffusionFiles 3 | * @file examples/advection_diffusion/fftw_workspace_dft1d.hpp 4 | * @since v0.6.0 5 | */ 6 | #ifndef _EXAMPLES__ADVEC_DIFF__FFTW_WORKSPACE_HPP_ 7 | #define _EXAMPLES__ADVEC_DIFF__FFTW_WORKSPACE_HPP_ 8 | 9 | #include 10 | using std::complex; 11 | 12 | #include 13 | 14 | 15 | namespace pfasst 16 | { 17 | namespace examples 18 | { 19 | namespace advection_diffusion 20 | { 21 | /** 22 | * Workspace for DFT in 1D 23 | * 24 | * @tparam DataT type of the encapsulation in the problem space; must provide public member 25 | * `value_type` providing the type of single data points, public member 26 | * function `size()` returning number of elements and public member subscript 27 | * operator. 28 | * @implements FFTWWorkspace 29 | */ 30 | template 31 | class FFTWWorkspaceDFT1D 32 | { 33 | public: 34 | using data_type = DataT; 35 | 36 | protected: 37 | //! @{ 38 | size_t _size; 39 | fftw_plan _ffft; 40 | fftw_plan _ifft; 41 | fftw_complex* _wk_ptr; 42 | complex* _z_ptr; 43 | //! @} 44 | 45 | public: 46 | //! @{ 47 | /** 48 | * @param[in] ndofs number of DOFs of this FFTWWorkspace 49 | */ 50 | explicit FFTWWorkspaceDFT1D(const size_t ndofs); 51 | FFTWWorkspaceDFT1D(const FFTWWorkspaceDFT1D& other) = delete; 52 | FFTWWorkspaceDFT1D(FFTWWorkspaceDFT1D&& other) = delete; 53 | virtual ~FFTWWorkspaceDFT1D(); 54 | //! @} 55 | 56 | //! @{ 57 | FFTWWorkspaceDFT1D& operator=(const FFTWWorkspaceDFT1D& other) = delete; 58 | FFTWWorkspaceDFT1D& operator=(FFTWWorkspaceDFT1D&& other) = delete; 59 | //! @} 60 | 61 | //! @{ 62 | /** 63 | * Calls final cleanup routine of FFTW. 64 | */ 65 | static void finalize_cleanup(); 66 | //! @} 67 | 68 | //! @{ 69 | /** 70 | * Get number of DOFs 71 | * 72 | * @return number of degrees of freedom 73 | */ 74 | size_t size() const; 75 | 76 | /** 77 | * Access values in Fourier space 78 | * 79 | * @return pointer to values in Fourier space 80 | */ 81 | complex* z_ptr(); 82 | //! @} 83 | 84 | //! @{ 85 | /** 86 | * Transforms problem data into Fourier space 87 | * 88 | * @param[in] x encapsulation holding data in problem space 89 | * @return pointer to values in Fourier space 90 | */ 91 | complex* forward(const DataT& x); 92 | 93 | /** 94 | * Back-transforms Fourier space data (z_ptr()) into problem space 95 | * 96 | * @param[in,out] x encapsulation to hold back-transformed data; existing data will get 97 | * overwritten 98 | */ 99 | void backward(DataT& x); 100 | //! @} 101 | }; 102 | } // ::pfasst::examples::advection_diffusion 103 | } // ::pfasst::examples 104 | } // ::pfasst 105 | 106 | #include "fftw_workspace_dft1d_impl.hpp" 107 | 108 | #endif // _EXAMPLES__ADVEC_DIFF__FFTW_WORKSPACE_HPP_ 109 | -------------------------------------------------------------------------------- /examples/advection_diffusion/fftw_workspace_dft1d_impl.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @ingroup AdvectionDiffusionFiles 3 | * @file examples/advection_diffusion/fftw_workspace_dft1d_impl.hpp 4 | * @since v0.6.0 5 | */ 6 | #include "fftw_workspace_dft1d.hpp" 7 | 8 | #include 9 | #include 10 | using std::real; 11 | 12 | 13 | namespace pfasst 14 | { 15 | namespace examples 16 | { 17 | namespace advection_diffusion 18 | { 19 | template 20 | FFTWWorkspaceDFT1D::FFTWWorkspaceDFT1D(const size_t ndofs) 21 | : _size(ndofs) 22 | , _wk_ptr(fftw_alloc_complex(ndofs)) 23 | , _z_ptr(reinterpret_cast*>(_wk_ptr)) 24 | { 25 | this->_ffft = fftw_plan_dft_1d(ndofs, this->_wk_ptr, this->_wk_ptr, 26 | FFTW_FORWARD, FFTW_ESTIMATE); 27 | this->_ifft = fftw_plan_dft_1d(ndofs, this->_wk_ptr, this->_wk_ptr, 28 | FFTW_BACKWARD, FFTW_ESTIMATE); 29 | } 30 | 31 | template 32 | FFTWWorkspaceDFT1D::~FFTWWorkspaceDFT1D() 33 | { 34 | fftw_free(this->_wk_ptr); 35 | fftw_destroy_plan(this->_ffft); 36 | fftw_destroy_plan(this->_ifft); 37 | this->_z_ptr = nullptr; 38 | } 39 | 40 | template 41 | void FFTWWorkspaceDFT1D::finalize_cleanup() 42 | { 43 | fftw_cleanup(); 44 | } 45 | 46 | template 47 | size_t FFTWWorkspaceDFT1D::size() const 48 | { 49 | return this->_size; 50 | } 51 | 52 | template 53 | complex* FFTWWorkspaceDFT1D::z_ptr() 54 | { 55 | return this->_z_ptr; 56 | } 57 | 58 | template 59 | complex* FFTWWorkspaceDFT1D::forward(const DataT& x) 60 | { 61 | assert(this->size() == x.size()); 62 | 63 | for (size_t i = 0; i < this->size(); ++i) { 64 | this->_z_ptr[i] = x[i]; 65 | } 66 | 67 | fftw_execute_dft(this->_ffft, this->_wk_ptr, this->_wk_ptr); 68 | 69 | return this->_z_ptr; 70 | } 71 | 72 | template 73 | void FFTWWorkspaceDFT1D::backward(DataT& x) 74 | { 75 | assert(this->size() == x.size()); 76 | 77 | fftw_execute_dft(this->_ifft, this->_wk_ptr, this->_wk_ptr); 78 | 79 | for (size_t i = 0; i < this->size(); ++i) { 80 | x[i] = real(this->_z_ptr[i]); 81 | } 82 | } 83 | } // ::pfasst::examples::advection_diffusion 84 | } // ::pfasst::examples 85 | } // ::pfasst 86 | -------------------------------------------------------------------------------- /examples/advection_diffusion/mpi_pfasst.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Advection-Diffusion with MPI-enabled PFASST. 3 | * 4 | * @ingroup AdvectionDiffusionFiles 5 | * @file examples/advection_diffusion/mpi_pfasst.cpp 6 | * @since v0.2.0 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | using namespace std; 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "advection_diffusion_sweeper.hpp" 24 | #include "spectral_transfer_1d.hpp" 25 | 26 | using namespace pfasst::encap; 27 | using namespace pfasst::mpi; 28 | 29 | namespace pfasst 30 | { 31 | namespace examples 32 | { 33 | namespace advection_diffusion 34 | { 35 | /** 36 | * Advection/diffusion example using an encapsulated IMEX sweeper. 37 | * 38 | * This example uses MPI PFASST. 39 | * 40 | * @ingroup AdvectionDiffusion 41 | */ 42 | error_map run_mpi_pfasst(const double abs_res_tol, const double rel_res_tol, 43 | const size_t niters, const size_t nsteps, const double dt, 44 | const size_t ndofs_f, const size_t ndofs_c, 45 | const size_t nnodes_f, const size_t nnodes_c) 46 | { 47 | ML_CLOG(INFO, "Advec", "abs_res_tol: " << abs_res_tol << ", " 48 | << "rel_res_tol: " << rel_res_tol << ", " 49 | << "niter: " << niters << ", " 50 | << "nsteps: " << nsteps << ", " 51 | << "dt: " << dt << ", " 52 | << "ndofs (f-c): " << ndofs_f << "-" << ndofs_c << ", " 53 | << "nnodes (f-c): " << nnodes_f << "-" << nnodes_c); 54 | 55 | MPICommunicator comm(MPI_COMM_WORLD); 56 | PFASST<> pf; 57 | 58 | auto quad_c = quadrature::quadrature_factory(nnodes_c, quadrature::QuadratureType::GaussLobatto); 59 | auto factory_c = make_shared>(ndofs_c); 60 | auto sweeper_c = make_shared>(ndofs_c); 61 | auto transfer_c = make_shared>(); 62 | 63 | sweeper_c->set_quadrature(quad_c); 64 | sweeper_c->set_factory(factory_c); 65 | sweeper_c->set_residual_tolerances(abs_res_tol, rel_res_tol); 66 | 67 | auto quad_f = quadrature::quadrature_factory(nnodes_f, quadrature::QuadratureType::GaussLobatto); 68 | auto factory_f = make_shared>(ndofs_f); 69 | auto sweeper_f = make_shared>(ndofs_f); 70 | auto transfer_f = make_shared>(); 71 | 72 | sweeper_f->set_quadrature(quad_f); 73 | sweeper_f->set_factory(factory_f); 74 | sweeper_f->set_residual_tolerances(abs_res_tol, rel_res_tol); 75 | 76 | ML_LOG(INFO, "expected quadrature error: " << quad_c->expected_error() << " (" << nnodes_c << ")"); 77 | ML_LOG(INFO, "expected quadrature error: " << quad_f->expected_error() << " (" << nnodes_f << ")"); 78 | 79 | pf.add_level(sweeper_f, transfer_f); 80 | pf.add_level(sweeper_c, transfer_c); 81 | pf.setup(); 82 | 83 | auto q0 = sweeper_f->get_start_state(); 84 | sweeper_f->exact(q0, 0.0); 85 | 86 | pf.set_comm(&comm); 87 | pf.set_duration(0.0, nsteps * dt, dt, niters); 88 | pf.set_nsweeps({2, 1}); 89 | pf.get_finest>()->set_residual_tolerances(abs_res_tol, rel_res_tol); 90 | pf.run(); 91 | 92 | auto fine = pf.get_finest>(); 93 | return fine->get_errors(); 94 | } 95 | } // ::pfasst::examples::advection_diffusion 96 | } // ::pfasst::examples 97 | } // ::pfasst 98 | 99 | 100 | 101 | #ifndef PFASST_UNIT_TESTING 102 | int main(int argc, char** argv) 103 | { 104 | MPI_Init(&argc, &argv); 105 | pfasst::init(argc, argv, 106 | pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_logs); 107 | 108 | const double tend = pfasst::config::get_value("tend", 0.04); 109 | const double dt = pfasst::config::get_value("dt", 0.01); 110 | const size_t nnodes_f = pfasst::config::get_value("num_nodes", 5); 111 | const size_t ndofs_f = pfasst::config::get_value("spatial_dofs", 128); 112 | const size_t niters = pfasst::config::get_value("num_iter", 4); 113 | const double abs_res_tol = pfasst::config::get_value("abs_res_tol", 0.0); 114 | const double rel_res_tol = pfasst::config::get_value("rel_res_tol", 0.0); 115 | 116 | const size_t nsteps = tend / dt; 117 | const size_t nnodes_c = (nnodes_f + 1) / 2; 118 | const size_t ndofs_c = ndofs_f / 2; 119 | 120 | pfasst::examples::advection_diffusion::run_mpi_pfasst(abs_res_tol, rel_res_tol, 121 | niters, nsteps, dt, 122 | ndofs_f, ndofs_c, nnodes_f, nnodes_c); 123 | MPI_Finalize(); 124 | } 125 | #endif 126 | -------------------------------------------------------------------------------- /examples/advection_diffusion/serial_mlsdc.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Advection-Diffusion with serial MLSDC. 3 | * 4 | * @ingroup AdvectionDiffusionFiles 5 | * @file examples/advection_diffusion/serial_mlsdc.cpp 6 | * @since v0.1.0 7 | */ 8 | #include 9 | using namespace std; 10 | 11 | #include 12 | #include 13 | #include 14 | using namespace pfasst::encap; 15 | 16 | #include "advection_diffusion_sweeper.hpp" 17 | #include "spectral_transfer_1d.hpp" 18 | 19 | 20 | namespace pfasst 21 | { 22 | namespace examples 23 | { 24 | namespace advection_diffusion 25 | { 26 | /** 27 | * Advection/diffusion example using an encapsulated IMEX sweeper. 28 | * 29 | * This example uses a (serial) multi-level SDC sweeper. 30 | * 31 | * @ingroup AdvectionDiffusion 32 | */ 33 | tuple run_serial_mlsdc(size_t nlevs, 34 | size_t nsteps_in=4, 35 | double step_size_in=0.01, 36 | size_t num_iter_in=8, 37 | size_t nnodes_in=5, 38 | size_t ndofs_in=128) 39 | { 40 | MLSDC<> mlsdc; 41 | 42 | const size_t nsteps = config::get_value("num_steps", nsteps_in); 43 | const double dt = config::get_value("step_size", step_size_in); 44 | const size_t niters = config::get_value("num_iter", num_iter_in); 45 | const int xrat = 2; 46 | const int trat = 2; 47 | 48 | size_t nnodes = config::get_value("num_nodes", nnodes_in); 49 | size_t ndofs = config::get_value("spatial_dofs", ndofs_in); 50 | 51 | const double abs_res_tol = pfasst::config::get_value("abs_res_tol", 0.0); 52 | const double rel_res_tol = pfasst::config::get_value("rel_res_tol", 0.0); 53 | 54 | /* 55 | * build space/time discretisation levels and add them to mlsdc 56 | * controller. this loop adds the finest level first, and 57 | * subsequently refines in time (accoring to 'trat') and space 58 | * (according to 'xrat'). 59 | */ 60 | for (size_t l = 0; l < nlevs; l++) { 61 | auto quad = quadrature::quadrature_factory(nnodes, quadrature::QuadratureType::GaussLobatto); 62 | auto factory = make_shared>(ndofs); 63 | auto sweeper = make_shared>(ndofs); 64 | auto transfer = make_shared>(); 65 | 66 | ML_LOG(INFO, "expected quadrature error: " << quad->expected_error() << " (" << nnodes << ")"); 67 | 68 | sweeper->set_quadrature(quad); 69 | sweeper->set_factory(factory); 70 | sweeper->set_residual_tolerances(abs_res_tol, rel_res_tol); 71 | 72 | mlsdc.add_level(sweeper, transfer); 73 | 74 | ndofs = ndofs / xrat; 75 | nnodes = (nnodes - 1) / trat + 1; 76 | } 77 | 78 | /* 79 | * set up the mlsdc controller (which in turn calls 'setup' on the 80 | * sweepers that were added above). this stage typically 81 | * preallocates various buffers that the sweepers need. 82 | */ 83 | mlsdc.setup(); 84 | 85 | /* 86 | * set initial conditions on each level 87 | */ 88 | auto sweeper = mlsdc.get_finest>(); 89 | auto q0 = sweeper->get_start_state(); 90 | sweeper->exact(q0, 0.0); 91 | // sweeper->set_residual_tolerances(1e-5, 0.0); 92 | 93 | /* 94 | * run mlsdc! 95 | */ 96 | mlsdc.set_duration(0.0, nsteps*dt, dt, niters); 97 | mlsdc.run(); 98 | 99 | tuple rinfo; 100 | get<0>(rinfo) = mlsdc.get_finest>()->get_errors(); 101 | for (auto l = mlsdc.coarsest(); l <= mlsdc.finest(); ++l) { 102 | get<1>(rinfo).insert(pair(l.level, l.current>()->get_residuals())); 103 | } 104 | return rinfo; 105 | } 106 | } // ::pfasst::examples::advection_diffusion 107 | } // ::pfasst::examples 108 | } // ::pfasst 109 | 110 | #ifndef PFASST_UNIT_TESTING 111 | int main(int argc, char** argv) 112 | { 113 | pfasst::init(argc, argv, 114 | pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_logs); 115 | pfasst::examples::advection_diffusion::run_serial_mlsdc(3); 116 | } 117 | #endif 118 | -------------------------------------------------------------------------------- /examples/advection_diffusion/spectral_transfer_1d.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @ingroup AdvectionDiffusionFiles 3 | * @file examples/advection_diffusion/spectral_transfer_1d.hpp 4 | * @since v0.1.0 5 | */ 6 | #ifndef _EXAMPLES__ADVEC_DIFF__SPECTRAL_TRANSFER_1D_HPP_ 7 | #define _EXAMPLES__ADVEC_DIFF__SPECTRAL_TRANSFER_1D_HPP_ 8 | 9 | #include 10 | #include 11 | #include 12 | using namespace std; 13 | 14 | #include 15 | #include 16 | 17 | #include "fft_manager.hpp" 18 | #include "fftw_workspace_dft1d.hpp" 19 | 20 | 21 | namespace pfasst 22 | { 23 | namespace examples 24 | { 25 | namespace advection_diffusion 26 | { 27 | /** 28 | * Spectral (FFT) transfer routines. 29 | * 30 | * @ingroup AdvectionDiffusion 31 | */ 32 | template 33 | class SpectralTransfer1D 34 | : public encap::PolyInterpMixin