GraviDy  1.0
Gravitational Dynamics N-body integrator
Public Member Functions | Public Attributes | List of all members
Hermite4GPU Class Reference

Class which implements on the GPU the structure of the Hermite4 scheme. More...

Inheritance diagram for Hermite4GPU:
Inheritance graph
[legend]
Collaboration diagram for Hermite4GPU:
Collaboration graph
[legend]

Public Member Functions

 Hermite4GPU (NbodySystem *ns, Logger *logger, NbodyUtils *nu)
 Constructor that uses its parent one. More...
 
 ~Hermite4GPU ()
 Destructor in charge of memory deallocation. More...
 
void alloc_arrays_device ()
 Method in charge of allocating the data structures on the available GPUs, also initializing all the arrays to zero. More...
 
void free_arrays_device ()
 Method in charge of deallocating the data structures on the available GPUs. More...
 
void force_calculation (Predictor pi, Predictor pj, Forces &fi)
 Force virtual method to be implemented. More...
 
void init_acc_jrk ()
 Method in charge of the initialization of all the particle's acceleration and first derivative of the system, at the begining of the simulation. More...
 
void update_acc_jrk (int nact)
 Method in charge of the force interaction between $N_{act}$ and the whole system. More...
 
void predicted_pos_vel (double ITIME)
 Method in charge of the prediction step. More...
 
void correction_pos_vel (double ITIME, int nact)
 Method in charge of the corrector step. More...
 
void integration ()
 Integration virtual method to be implemented. More...
 
void get_kernel_error ()
 Method that get the last kernel error if the code is running with the DEBUG flag. More...
 
void gpu_timer_start ()
 Method to start the device timer. More...
 
float gpu_timer_stop (std::string f)
 Method that ends the device timer. More...
 
double get_energy_gpu ()
 Method in charge of calculating the potential and kinetic energy on the GPU devices. More...
 
- Public Member Functions inherited from Hermite4
 Hermite4 (NbodySystem *ns, Logger *logger, NbodyUtils *nu)
 Constructor in charge of calling the allocation and initialization methods. More...
 
 ~Hermite4 ()
 Destructor in charge of calling the method that free the memory. More...
 
unsigned int find_particles_to_move (double ITIME)
 Method in charge of finding all the particles that need to be updated on the following integration step. More...
 
void next_integration_time (double &ATIME)
 Methods that look for the next integration time, looking for the minimum combination of timestep and current time of all the particles of the system. More...
 
void init_dt (double &ATIME, float ETA, double ITIME)
 Initialization of the timesteps of the system. More...
 
void save_old_acc_jrk (unsigned int nact)
 Method in charge of saving the old values of the acceleration and its first derivative to be use in the Corrector integration step. More...
 
void alloc_arrays_host ()
 Method in charge of the memory allocation of all the data structures. More...
 
void free_arrays_host ()
 Method in charge of the memory deallocation of all the data structures. More...
 
void init_data ()
 Method that initialize all the data structures that will be used in the integration of hte system. More...
 
virtual void predicted_pos_vel (double itime, double *t, double4 *r, double4 *v, Forces *f, Predictor *p)
 Prediction virtual method to be implemented. More...
 
virtual void correction_pos_vel (double itime, unsigned int nact, double *dt, double *t, unsigned int *move, Predictor *p, Forces *f, Forces *old, double3 *a2, double3 *a3, double4 *r, double4 *v)
 Correction virtual method to be implemented. More...
 
virtual void init_acc_jrk (Predictor *p, Forces *f)
 Force initialization virtual method to be implemented. More...
 
virtual void update_acc_jrk (unsigned int nact, unsigned int *move, Predictor *p, Forces *f)
 Force update virtual method to be implemented. More...
 

Public Attributes

size_t nthreads
 
size_t nblocks
 
size_t smem
 
size_t smem_reduce
 
size_t i1_size
 
size_t d1_size
 
size_t d4_size
 
size_t ff_size
 
size_t pp_size
 
int gpus
 
int n_part [MAXGPUS]
 
cudaEvent_t start
 
cudaEvent_t stop
 
- Public Attributes inherited from Hermite4
NbodySystemns
 NbodySystem object reference. More...
 
Loggerlogger
 Logger object reference. More...
 
NbodyUtilsnu
 NbodyUtils object reference. More...
 

Detailed Description

Class which implements on the GPU the structure of the Hermite4 scheme.

This contains all the implementations of the requirements processes to perform the integration, like the initialization of the forces, the prediction, the correction, and the general integration of the system.

Constructor & Destructor Documentation

§ Hermite4GPU()

Hermite4GPU::Hermite4GPU ( NbodySystem ns,
Logger logger,
NbodyUtils nu 
)

Constructor that uses its parent one.

Additionally handles the split of the particles of the system among the available GPUs, allocation of the variables, and defining widely use sizes for arrays.

§ ~Hermite4GPU()

Hermite4GPU::~Hermite4GPU ( )

Destructor in charge of memory deallocation.

Member Function Documentation

§ alloc_arrays_device()

void Hermite4GPU::alloc_arrays_device ( )

Method in charge of allocating the data structures on the available GPUs, also initializing all the arrays to zero.

§ correction_pos_vel()

void Hermite4GPU::correction_pos_vel ( double  ITIME,
int  nact 
)

Method in charge of the corrector step.

This is not implemented on the GPU because the benefit was not much for small amount of particles.

§ force_calculation()

void Hermite4GPU::force_calculation ( Predictor  pi,
Predictor  pj,
Forces fi 
)
virtual

Force virtual method to be implemented.

Reimplemented from Hermite4.

§ free_arrays_device()

void Hermite4GPU::free_arrays_device ( )

Method in charge of deallocating the data structures on the available GPUs.

§ get_energy_gpu()

double Hermite4GPU::get_energy_gpu ( )

Method in charge of calculating the potential and kinetic energy on the GPU devices.

§ get_kernel_error()

void Hermite4GPU::get_kernel_error ( )

Method that get the last kernel error if the code is running with the DEBUG flag.

§ gpu_timer_start()

void Hermite4GPU::gpu_timer_start ( )

Method to start the device timer.

§ gpu_timer_stop()

float Hermite4GPU::gpu_timer_stop ( std::string  f)

Method that ends the device timer.

§ init_acc_jrk()

void Hermite4GPU::init_acc_jrk ( )

Method in charge of the initialization of all the particle's acceleration and first derivative of the system, at the begining of the simulation.

§ integration()

void Hermite4GPU::integration ( )
virtual

Integration virtual method to be implemented.

Reimplemented from Hermite4.

§ predicted_pos_vel()

void Hermite4GPU::predicted_pos_vel ( double  ITIME)

Method in charge of the prediction step.

This can be use on the CPU (commented section) or on the GPUs. The reason of having both reasons, is the improvement is not much for small amount of particles.

§ update_acc_jrk()

void Hermite4GPU::update_acc_jrk ( int  nact)

Method in charge of the force interaction between $N_{act}$ and the whole system.

First there is a tmp construction of predictors to be send to the GPUs. Then the data is copied to the devices. The first kernel perform the preliminary calculation of the forces in JPBLOCKS. The second kernel, reduction, is in charge of summing all the preliminary forces to the final value for all the active particles.

Member Data Documentation

§ d1_size

size_t Hermite4GPU::d1_size

§ d4_size

size_t Hermite4GPU::d4_size

§ ff_size

size_t Hermite4GPU::ff_size

§ gpus

int Hermite4GPU::gpus

§ i1_size

size_t Hermite4GPU::i1_size

§ n_part

int Hermite4GPU::n_part[MAXGPUS]

§ nblocks

size_t Hermite4GPU::nblocks

§ nthreads

size_t Hermite4GPU::nthreads

§ pp_size

size_t Hermite4GPU::pp_size

§ smem

size_t Hermite4GPU::smem

§ smem_reduce

size_t Hermite4GPU::smem_reduce

§ start

cudaEvent_t Hermite4GPU::start

§ stop

cudaEvent_t Hermite4GPU::stop

The documentation for this class was generated from the following files: