milupHPC documentation
  • include
miluphpc.h
Go to the documentation of this file.
1
21#ifndef MILUPHPC_MILUPHPC_H
22#define MILUPHPC_MILUPHPC_H
23
24#include "particle_handler.h"
25#include "subdomain_key_tree/tree_handler.h"
26#include "subdomain_key_tree/subdomain_handler.h"
27#include "device_rhs.cuh"
28#include "cuda_utils/cuda_utilities.cuh"
29#include "utils/logger.h"
30#include "utils/timer.h"
31#include "materials/material_handler.h"
32#include "helper_handler.h"
33#include "gravity/gravity.cuh"
34#include "sph/sph.cuh"
35#include "cuda_utils/cuda_runtime.h"
36#include "utils/cxxopts.h"
37#include "utils/h5profiler.h"
38#include "sph/kernel.cuh"
39#include "sph/kernel_handler.cuh"
40#include "sph/density.cuh"
41#include "sph/pressure.cuh"
42#include "sph/internal_forces.cuh"
43#include "sph/soundspeed.cuh"
44#include "simulation_time_handler.h"
45
46#include "processing/kernels.cuh"
47
48#include <iostream>
49#include <stdio.h>
50#include <cuda.h>
51#include <cuda_runtime.h>
52#include <climits> // for ulong_max
53#include <algorithm>
54#include <cmath>
55#include <utility>
56#include <set>
57#include <fstream>
58#include <iomanip>
59#include <random>
60#include <fstream>
61
62#include <boost/mpi/collectives/all_gatherv.hpp>
63
64#include <highfive/H5File.hpp>
65#include <highfive/H5DataSpace.hpp>
66#include <highfive/H5DataSet.hpp>
67
74class Miluphpc {
75
76private:
77
78 // @todo implement serial versions in order to reduce overhead due to parallelization
79 //real serial_tree();
80 //real serial_pseudoParticles();
81 //real serial_gravity();
82 //real serial_sph();
83
100 real reset();
101
111 real boundingBox();
112
118 real parallel_tree();
119
125 real parallel_pseudoParticles();
126
132 real parallel_gravity();
133
139 real parallel_sph();
140
141 // @todo possible to combine sendPartclesEntry and sendParticles
153 template <typename T>
154 integer sendParticlesEntry(integer *sendLengths, integer *receiveLengths, T *entry, T *entryBuffer, T *copyBuffer);
155 //void exchangeParticleEntry(integer *sendLengths, integer *receiveLengths, real *entry);
156
167 template <typename T>
168 integer sendParticles(T *sendBuffer, T *receiveBuffer, integer *sendLengths, integer *receiveLengths);
169
181 template <typename U, typename T>
182 real arrangeParticleEntries(U *sortArray, U *sortedArray, T *entry, T *temp);
183
193 real assignParticles();
194
200 real angularMomentum();
201
207 real energy();
208
209public:
210
212 int subStep;
213
215 real h_searchRadius;
216
218 real totalEnergy;
219
221 real totalAngularMomentum;
222
233 real removeParticles();
234
238 void fixedLoadBalancing();
239
248 void dynamicLoadBalancing(int bins=5000);
249
260 void updateRangeApproximately(int aimedParticlesPerProcess, int bins=5000);
261
271 void updateRange(int aimedParticlesPerProcess);
272
274 H5Profiler &profiler = H5Profiler::getInstance("log/performance.h5");
275
277 Curve::Type curveType;
278
280 SPH::KernelHandler kernelHandler;
282 SimulationTimeHandler *simulationTimeHandler;
283
285 integer numParticles;
287 integer sumParticles;
294 integer numParticlesLocal;
296 integer numNodes;
297
305 IntegratedParticleHandler *integratedParticles;
306
307 integer *d_mutex;
309 ParticleHandler *particleHandler;
311 SubDomainKeyTreeHandler *subDomainKeyTreeHandler;
313 TreeHandler *treeHandler;
315 DomainListHandler *domainListHandler;
317 DomainListHandler *lowestDomainListHandler;
319 MaterialHandler *materialHandler;
320
323 //HelperHandler *helperHandler;
325 HelperHandler *buffer;
326
327 // testing
329 //integer *d_particles2SendIndices;
331 //integer *d_pseudoParticles2SendIndices;
333 //integer *d_pseudoParticles2SendLevels;
335 //integer *d_pseudoParticles2ReceiveLevels;
337 //integer *d_particles2SendCount;
339 //integer *d_pseudoParticles2SendCount;
341 //int *d_particles2removeBuffer;
343 //int *d_particles2removeVal;
345 //idInteger *d_idIntegerBuffer;
347 //idInteger *d_idIntegerCopyBuffer;
348 // end: testing
349
351 SimulationParameters simulationParameters;
352
358 Miluphpc(SimulationParameters simulationParameters);
359
363 ~Miluphpc();
364
373 void prepareSimulation();
374
385 void numParticlesFromFile(const std::string& filename);
386
392 void distributionFromFile(const std::string& filename);
393
404 real tree();
405
418 real pseudoParticles();
419
436 real gravity();
437
457 real sph();
458
477 real rhs(int step, bool selfGravity=true, bool assignParticlesToProcess=true);
478
484 virtual void integrate(int step = 0) = 0;
485
489 void afterIntegrationStep();
490
497 real particles2file(int step);
498
508 real particles2file(const std::string& filename, int *particleIndices, int length);
509
510 real configParameters2file(HighFive::File &h5file);
511
512 void getMemoryInfo();
513
514};
515
516#endif //MILUPHPC_MILUPHPC_H
DomainListHandler
Definition: subdomain_handler.h:81
H5Profiler
Singleton class for HDF5 profiler.
Definition: h5profiler.h:118
H5Profiler::getInstance
static H5Profiler & getInstance(const std::string &outfile="")
Constructor/Instance getter for HDF5 profiler.
Definition: h5profiler.h:130
HelperHandler
Definition: helper_handler.h:9
IntegratedParticleHandler
Definition: particle_handler.h:425
MaterialHandler
Material class handler.
Definition: material_handler.h:53
Miluphpc
MilupHPC class.
Definition: miluphpc.h:74
Miluphpc::d_mutex
integer * d_mutex
Definition: miluphpc.h:307
Miluphpc::domainListHandler
DomainListHandler * domainListHandler
Instance to handle the DomainList instance on device and host.
Definition: miluphpc.h:315
Miluphpc::totalEnergy
real totalEnergy
total energy
Definition: miluphpc.h:218
Miluphpc::afterIntegrationStep
void afterIntegrationStep()
Definition: miluphpc.cpp:471
Miluphpc::parallel_sph
real parallel_sph()
Parallel version regarding computation of SPH-stuff.
Definition: miluphpc.cpp:2216
Miluphpc::parallel_pseudoParticles
real parallel_pseudoParticles()
Parallel version regarding computation of pseudo-particles.
Definition: miluphpc.cpp:1061
Miluphpc::particleHandler
ParticleHandler * particleHandler
Instance to handle the Particles instance on device and host.
Definition: miluphpc.h:309
Miluphpc::tree
real tree()
Wrapper function for building the tree (and domain tree).
Definition: miluphpc.cpp:951
Miluphpc::updateRangeApproximately
void updateRangeApproximately(int aimedParticlesPerProcess, int bins=5000)
Update the ranges (approximately and dynamically).
Definition: miluphpc.cpp:2988
Miluphpc::rhs
real rhs(int step, bool selfGravity=true, bool assignParticlesToProcess=true)
Definition: miluphpc.cpp:294
Miluphpc::reset
real reset()
Reset arrays, values, ...
Definition: miluphpc.cpp:586
Miluphpc::parallel_tree
real parallel_tree()
Parallel version regarding tree-stuff.
Definition: miluphpc.cpp:958
Miluphpc::angularMomentum
real angularMomentum()
Calculate the angular momentum for all particles.
Definition: miluphpc.cpp:484
Miluphpc::curveType
Curve::Type curveType
Space-filling curve type to be used (Lebesgue or Hilbert)
Definition: miluphpc.h:277
Miluphpc::assignParticles
real assignParticles()
Assign particles to correct process in dependence of particle key and ranges.
Definition: miluphpc.cpp:700
Miluphpc::profiler
H5Profiler & profiler
H5 profiler instance.
Definition: miluphpc.h:274
Miluphpc::fixedLoadBalancing
void fixedLoadBalancing()
Load balancing via equidistant ranges.
Definition: miluphpc.cpp:2839
Miluphpc::numNodes
integer numNodes
number of nodes (to be allocated)
Definition: miluphpc.h:296
Miluphpc::dynamicLoadBalancing
void dynamicLoadBalancing(int bins=5000)
Pre-calculations for updateRangeApproximately.
Definition: miluphpc.cpp:2885
Miluphpc::Miluphpc
Miluphpc(SimulationParameters simulationParameters)
Constructor to set up simulation.
Definition: miluphpc.cpp:3
Miluphpc::~Miluphpc
~Miluphpc()
Destructor freeing class instances.
Definition: miluphpc.cpp:97
Miluphpc::materialHandler
MaterialHandler * materialHandler
Instance to handle Materials instances on device and host.
Definition: miluphpc.h:319
Miluphpc::subDomainKeyTreeHandler
SubDomainKeyTreeHandler * subDomainKeyTreeHandler
Instance to handle the SubDomainKeyTree instance on device and host.
Definition: miluphpc.h:311
Miluphpc::numParticles
integer numParticles
number of particles (to be allocated)
Definition: miluphpc.h:285
Miluphpc::energy
real energy()
Calculate the total amount of energy.
Definition: miluphpc.cpp:538
Miluphpc::subStep
int subStep
current sub-step (there are possibly more sub-steps within a step!)
Definition: miluphpc.h:212
Miluphpc::treeHandler
TreeHandler * treeHandler
Instance to handle the Tree instance on device and host.
Definition: miluphpc.h:313
Miluphpc::sendParticles
integer sendParticles(T *sendBuffer, T *receiveBuffer, integer *sendLengths, integer *receiveLengths)
Send particles/Exchange particles among MPI processes.
Definition: miluphpc.cpp:3174
Miluphpc::integrate
virtual void integrate(int step=0)=0
Miluphpc::lowestDomainListHandler
DomainListHandler * lowestDomainListHandler
Instance to handle the (lowest) DomainList instance on device and host.
Definition: miluphpc.h:317
Miluphpc::arrangeParticleEntries
real arrangeParticleEntries(U *sortArray, U *sortedArray, T *entry, T *temp)
Function to sort an array entry in dependence of another array sortArray
Definition: miluphpc.cpp:944
Miluphpc::integratedParticles
IntegratedParticleHandler * integratedParticles
Definition: miluphpc.h:305
Miluphpc::removeParticles
real removeParticles()
Remove particles in dependence of some criterion.
Definition: miluphpc.cpp:3040
Miluphpc::sph
real sph()
Definition: miluphpc.cpp:2207
Miluphpc::gravity
real gravity()
Wrapper function for Gravity-related stuff.
Definition: miluphpc.cpp:1241
Miluphpc::simulationParameters
SimulationParameters simulationParameters
buffer (need for revising)
Definition: miluphpc.h:351
Miluphpc::configParameters2file
real configParameters2file(HighFive::File &h5file)
Definition: miluphpc.cpp:3736
Miluphpc::prepareSimulation
void prepareSimulation()
Prepare the simulation, including.
Definition: miluphpc.cpp:235
Miluphpc::distributionFromFile
void distributionFromFile(const std::string &filename)
Read initial/particle distribution file (in parallel)
Definition: miluphpc.cpp:161
Miluphpc::sendParticlesEntry
integer sendParticlesEntry(integer *sendLengths, integer *receiveLengths, T *entry, T *entryBuffer, T *copyBuffer)
Send particles/Exchange particles among MPI processes.
Definition: miluphpc.cpp:3327
Miluphpc::numParticlesLocal
integer numParticlesLocal
Definition: miluphpc.h:294
Miluphpc::kernelHandler
SPH::KernelHandler kernelHandler
Instance to handle the SPH Kernel instance on device and host.
Definition: miluphpc.h:280
Miluphpc::pseudoParticles
real pseudoParticles()
Wrapper function for calculating pseudo-particles.
Definition: miluphpc.cpp:1054
Miluphpc::numParticlesFromFile
void numParticlesFromFile(const std::string &filename)
Determine amount of particles (numParticles and numParticlesLocal) from initial file/particle distrib...
Definition: miluphpc.cpp:123
Miluphpc::h_searchRadius
real h_searchRadius
search radius for SPH (MPI-process overarching) neighbor search
Definition: miluphpc.h:215
Miluphpc::updateRange
void updateRange(int aimedParticlesPerProcess)
Update the range in dependence on number of (MPI) processes and aimed particles per process.
Definition: miluphpc.cpp:2912
Miluphpc::parallel_gravity
real parallel_gravity()
Parallel version regarding computation of gravitational stuff.
Definition: miluphpc.cpp:1248
Miluphpc::buffer
HelperHandler * buffer
buffer instance
Definition: miluphpc.h:325
Miluphpc::sumParticles
integer sumParticles
(real) number of particles on all processes
Definition: miluphpc.h:287
Miluphpc::simulationTimeHandler
SimulationTimeHandler * simulationTimeHandler
Instance to handle the SimulationTime instances on device and host.
Definition: miluphpc.h:282
Miluphpc::totalAngularMomentum
real totalAngularMomentum
total angular momentum
Definition: miluphpc.h:221
Miluphpc::getMemoryInfo
void getMemoryInfo()
Definition: miluphpc.cpp:3760
Miluphpc::boundingBox
real boundingBox()
Calculate bounding boxes/simulation domain.
Definition: miluphpc.cpp:643
Miluphpc::particles2file
real particles2file(int step)
Definition: miluphpc.cpp:3409
ParticleHandler
Definition: particle_handler.h:16
SPH::KernelHandler
SPH smoothing kernel handler.
Definition: kernel_handler.cuh:19
SimulationTimeHandler
Definition: simulation_time_handler.h:15
SubDomainKeyTreeHandler
Definition: subdomain_handler.h:23
TreeHandler
Definition: tree_handler.h:22
cuda_runtime.h
CUDA runtime functionalities and wrappers.
cuda_utilities.cuh
CUDA utilities.
density.cuh
SPH density calculation.
device_rhs.cuh
gravity.cuh
Gravitational force computation functions and CUDA kernels.
h5profiler.h
profiler based on (parallel) HDF5
helper_handler.h
internal_forces.cuh
SPH internal forces.
kernel.cuh
kernel_handler.cuh
kernels.cuh
...
logger.h
C++ style logger.
material_handler.h
Handler for material parameters and settings.
HelperNS::sortArray
real sortArray(A *arrayToSort, A *sortedArray, B *keyIn, B *keyOut, integer n)
Definition: helper.cu:151
real
double real
Definition: parameter.h:15
integer
int integer
Definition: parameter.h:17
particle_handler.h
pressure.cuh
Pressure calculation in dependence of the equation of states.
simulation_time_handler.h
Handler for SimulationTime class.
soundspeed.cuh
Calculating and initializing the speed of sound in dependence of the used equation of state.
sph.cuh
SPH related functionalities and kernels.
Curve::Type
Type
Definition: parameter.h:206
SimulationParameters
Definition: parameter.h:122
subdomain_handler.h
Classes and Kernels handling subdomains that distribute the workload among the MPI processes.
timer.h
C++ timer based on boost::mpi::timer.
tree_handler.h
Tree class handler.

milupHPC - include/miluphpc.h Source File
Generated on Wed Aug 31 2022 12:16:52 by Doxygen 1.9.3