|
Peano
|
I've written this benchmark to reconstruct work done by Duo Li and Alice-Agnes Gabriel from LMU. Ensure you've set the Python path correct
export PYTHONPATH=../../../python
to Peano's Python directory before you invoke the notebook.
DaStGen 2 (C) www.peano-framework.org Peano 4 (C) www.peano-framework.org ExaHyPE 2 (C) www.peano-framework.org
The sympy submodule is not included by default. But we'll use the homogeneous BC implementation from this package, as I'm too lazy to implement it myself. Even though they are trivial.
Lets ensure that no left-over files stay in there. Lets in particular delete the executable and the output files.
We create a new simulation. At the moment I can't non-cubic domains. I mean: I haven't tested it. This is something I have to do.
I have a whole set of different solvers and will definitely create a few more over the next months. This guy is the most basic/primitive one. Lets ensure it works first. I work with patch-based AMR with patches of the size 5x5 volumes. This is, so far, also a regular grid setup.
no of unknowns: 27
Even this simple setup is quite compute-intensive, so it pays off to work with the parallel code base right from the start. If you have configured Peano with
--with-multithreading=omp
or even with
--with-multithreading=omp --with-mpi=mpiicpc
then the line below adds parallelisation:
The idea is that the ExaHyPE2 front-end generates a Peano Python project. We can then ask this Peano project to generate all C++ code that we need. As we don't want to type in all the different configuration parameters (which compiler is used, which environment variables are to be used on this machine, ...) we first tell the ExaHyPE project to parse the setups we've selected through the initial ./configure call. Ah, and we also commit to a build flavour.
parse configure outcome ../../../src/Makefile to extract compile settings used C++ compiler is g++ used Fortran compiler is gfortran
Next, we add all the Fortran routines that we need in our project. Peano 4/ExaHyPE 2 will automatically add it to the build environment later on.
I don't want to program all the constants manually in my C++ code later on, so I simply export them from the Python script into the C++ stuff. They will be found in a generated file called Constants.h.
OK, time to generate the actual C++ stuff. After that, we can compile. We can either use the Python front-end to compile (there's a build() command) or directly call make. Once Peano 4 has written the makefile and the C++ code, the code is stand-alone, i.e. doesn't need Python anymore. So a plain make does the job.
generate all code ... some artefacts have already been added to repository ... assume this is intentional (by higher abstraction layer, e.g.) generated gprdr-main.cpp write ./Makefile write ././AbstractGPRDR.h (generated from template /home/tobias/git/Peano/python/exahype2/solvers/fv/GenericRiemannFixedTimeStepSizeAbstract.template.h) write ././AbstractGPRDR.cpp (generated from template /home/tobias/git/Peano/python/exahype2/solvers/fv/GenericRiemannFixedTimeStepSizeAbstract.template.cpp) write ./observers/SolverRepository.h (generated from template /home/tobias/git/Peano/python/exahype2/ProjectSolverRepository.template.h) write ./observers/SolverRepository.cpp (generated from template /home/tobias/git/Peano/python/exahype2/ProjectSolverRepository.template.cpp) write ./celldata/GPRDRQ.h (generated from template /home/tobias/git/Peano/python/peano4/datamodel/PatchToDoubleArray.template.h) write ./celldata/GPRDRQ.cpp (generated from template /home/tobias/git/Peano/python/peano4/datamodel/PatchToDoubleArray.template.cpp) write ./facedata/GPRDRQ.h (generated from template /home/tobias/git/Peano/python/peano4/datamodel/PatchToDoubleArray.template.h) write ./facedata/GPRDRQ.cpp (generated from template /home/tobias/git/Peano/python/peano4/datamodel/PatchToDoubleArray.template.cpp) write ./facedata/GPRDRQNew.h (generated from template /home/tobias/git/Peano/python/peano4/datamodel/PatchToDoubleArray.template.h) write ./facedata/GPRDRQNew.cpp (generated from template /home/tobias/git/Peano/python/peano4/datamodel/PatchToDoubleArray.template.cpp) write ./observers/DataRepository.h write ./observers/DataRepository.cpp write ././observers/CreateGrid2exahype2_solvers_fv_FV0.h write ././observers/CreateGrid2exahype2_solvers_fv_FV0.cpp write ././observers/CreateGrid2exahype2_solvers_fv_FV1.h write ././observers/CreateGrid2exahype2_solvers_fv_FV1.cpp write ././observers/CreateGrid2exahype2_grid_SetLabels2.h write ././observers/CreateGrid2exahype2_grid_SetLabels2.cpp write ././observers/CreateGrid.h write ././observers/CreateGrid.cpp write ././observers/InitGrid2exahype2_solvers_fv_FV0.h write ././observers/InitGrid2exahype2_solvers_fv_FV0.cpp write ././observers/InitGrid2peano4_toolbox_blockstructured_ProjectPatchOntoFaces1.h write ././observers/InitGrid2peano4_toolbox_blockstructured_ProjectPatchOntoFaces1.cpp write ././observers/InitGrid2peano4_toolbox_blockstructured_BackupPatchOverlap2.h write ././observers/InitGrid2peano4_toolbox_blockstructured_BackupPatchOverlap2.cpp write ././observers/InitGrid2exahype2_grid_SetLabels3.h write ././observers/InitGrid2exahype2_grid_SetLabels3.cpp write ././observers/InitGrid.h write ././observers/InitGrid.cpp write ././observers/CreateGridButPostponeRefinement2exahype2_solvers_fv_FV0.h write ././observers/CreateGridButPostponeRefinement2exahype2_solvers_fv_FV0.cpp write ././observers/CreateGridButPostponeRefinement2exahype2_grid_SetLabels1.h write ././observers/CreateGridButPostponeRefinement2exahype2_grid_SetLabels1.cpp write ././observers/CreateGridButPostponeRefinement.h write ././observers/CreateGridButPostponeRefinement.cpp write ././observers/PlotSolution2peano4_toolbox_blockstructured_PlotPatchesInPeanoBlockFormat0.h write ././observers/PlotSolution2peano4_toolbox_blockstructured_PlotPatchesInPeanoBlockFormat0.cpp write ././observers/PlotSolution2exahype2_grid_SetLabels1.h write ././observers/PlotSolution2exahype2_grid_SetLabels1.cpp write ././observers/PlotSolution.h write ././observers/PlotSolution.cpp write ././observers/TimeStep2exahype2_solvers_fv_FV0.h write ././observers/TimeStep2exahype2_solvers_fv_FV0.cpp write ././observers/TimeStep2exahype2_solvers_fv_FV1.h write ././observers/TimeStep2exahype2_solvers_fv_FV1.cpp write ././observers/TimeStep2peano4_toolbox_blockstructured_ReconstructPatchAndApplyFunctor2.h write ././observers/TimeStep2peano4_toolbox_blockstructured_ReconstructPatchAndApplyFunctor2.cpp write ././observers/TimeStep2peano4_toolbox_blockstructured_ProjectPatchOntoFaces3.h write ././observers/TimeStep2peano4_toolbox_blockstructured_ProjectPatchOntoFaces3.cpp write ././observers/TimeStep2exahype2_solvers_fv_FV4.h write ././observers/TimeStep2exahype2_solvers_fv_FV4.cpp write ././observers/TimeStep2peano4_toolbox_blockstructured_BackupPatchOverlap5.h write ././observers/TimeStep2peano4_toolbox_blockstructured_BackupPatchOverlap5.cpp write ././observers/TimeStep2exahype2_grid_SetLabels6.h write ././observers/TimeStep2exahype2_grid_SetLabels6.cpp write ././observers/TimeStep.h write ././observers/TimeStep.cpp write ./observers/StepRepository.h write ./observers/StepRepository.cpp write ././gprdr-main.h write ././gprdr-main.cpp write ./Constants.h generation complete
g++ -std=c++0x -g -O2 -DPeanoDebug=2 -g -O2 -fopenmp -DDimensions=2 -I. -I../../../src -c -o AbstractGPRDR.o AbstractGPRDR.cpp g++ -std=c++0x -g -O2 -DPeanoDebug=2 -g -O2 -fopenmp -DDimensions=2 -I. -I../../../src -c -o observers/SolverRepository.o observers/SolverRepository.cpp ^C make: *** [Makefile:28: observers/SolverRepository.o] Interrupt
As the code is a stand-alone executable (once I generated the stuff, there's no need for the Python front-end anywmore, you can take the code and run it on a supercomputer, e.g.), we can just type in run. There's also a Python wrap-around in Peano 4, but I usually prefer the command line version. The one below should work, but very
/bin/bash: ./peano4: No such file or directory
The new version of Peano/ExaHyPE writes out so-called patch files. This is a bespoke file format. There multiple ways how to manipulate/read it. I prefer to do everything within Paraview via Paraview. For this, I ensure that the PYTHONPATH points to Peano's Python directory, start up Paraview and then open the Python terminal. From here:
import peano4.api.visualisation data = peano4.api.visualisation.Visualiser( "solution-GPRDR.peano-patch-file" ) data.append_filter(peano4.api.visualisation.ExtractFineGridFilter()) data.display()
From here, you can either use
data.select_dataset(any number)
to step through the time steps or you call
data.write_vtu_time_series()
which gives you a vtu file with all the snapshots which you can load in Paraview. The conversion itself can last for ages if you run it within Paraview. I do recommend that you use the Python environment
pvpython
to issue the conversion therein. With the pvpython environment, it is also possible to convert the data in the background while you open a separate Paraview instance to study the data already.
This is ExaHyPE 2, but on the user side it is almost 1:1 the same interface as the original ExaHyPE. All the knowledge can be found in the files GPRDR.h and GPRDR.cpp. These files have been generated by the Python notebook, as you have named the solver GPRPR above.