Swarm-NG  1.1
swarm::gpu::bppt::integrator Class Reference

Common functionality and skeleton for body-pair-per-thread integrators Common tasks include: More...

#include <bppt.hpp>

Inheritance diagram for swarm::gpu::bppt::integrator:
swarm::gpu::integrator swarm::integrator swarm::gpu::bppt::generic< Propagator, Monitor, Gravitation > swarm::gpu::bppt::hermite< Monitor, Gravitation > swarm::gpu::bppt::hermite_adap< Monitor, Gravitation > swarm::gpu::bppt::rkck< AdaptationStyle, Monitor, Gravitation > TutorialIntegrator< Monitor, Gravitation >

Public Member Functions

 integrator (const config &cfg)
 Constructor.
 
const int & override_system_per_block () const
 User specified value of system_per_block. More...
 
- Public Member Functions inherited from swarm::gpu::integrator
 integrator (const config &cfg)
 Pass on constructor.
 
virtual void integrate ()
 Interfaces function to integrate, for use by general user. More...
 
virtual void core_integrate ()
 To integrate without any bookkeeping. More...
 
virtual void set_log_manager (log::Pmanager &l)
 Read the GPU log object from log manager and set it.
 
void set_log (gpulog::device_log *log)
 Set the GPU log object used for loggin output.
 
gpulog::device_log * get_device_log ()
 Get the GPU log object used for logging output.
 
void set_ensemble (defaultEnsemble &ens)
 Set the ensemble, only provide an ensemble on host. This cals automatically creates a copy of ensemble on GPU and keeps it in sync. Refer to set_ensemble(host_ens,device_ens) if you wish to manage the GPU memory allocation.
 
void set_ensemble (defaultEnsemble &host_ens, deviceEnsemble &device_ens)
 Set two host and device ensembles, two ensembles should match. More...
 
void upload_ensemble ()
 Synchronize device ensemble with host ensemble.
 
void download_ensemble ()
 Synchronize host ensemble with device ensemble.
 
- Public Member Functions inherited from swarm::integrator
 integrator (const config &cfg)
 Inetgrator class should be configurable. Derived instances should also have a constructor with similar signature and pass on the config parameter.
 
virtual void flush_log ()
 Flush the host log.
 
virtual defaultEnsembleget_ensemble ()
 Access the ensemble subject to integration.
 
virtual void set_destination_time (const double &destination_time)
 Set the time marker to end the integration.
 

Static Public Member Functions

template<class T >
static GENERIC int thread_per_system (T compile_time_param)
 Calculate number of worker threads needed for each system. More...
 
template<class T >
static GENERIC int shmem_per_system (T compile_time_param)
 Helper Function: Logical amount of shared memory needed for force calculations per thread This value is calculated from number of bodies, if this is used in a kernel, the actual amount of shared memory allocated might be different. More...
 

Protected Attributes

int _override_system_per_block
 Number of systems allocated in a block. Should be a multiple of SHMEM_CHUNK_SIZE for better coalescing.
 
- Protected Attributes inherited from swarm::gpu::integrator
hostEnsemble_hens
 Copy of ensemble on host (kept in sync with _dens).
 
deviceEnsemble _dens
 Copy of ensemble on [GPU] device (kept in sync with _hens). More...
 
gpulog::device_log * _log
 GPU log object obtained from log manager.
 
- Protected Attributes inherited from swarm::integrator
defaultEnsemble _ens
 ensemble to be integrated
 
double _destination_time
 the timestamp at which the integration should finish
 
log::Pmanager _logman
 log manager for log output, set to manager::default() by default
 
gpulog::host_log * _log
 log object, obtained from log manager
 
int _max_iterations
 Maximum number of iterations per each integration step. c.f. integrate for usage.
 
int _max_attempts
 Maximum number of attempts to complete the integration. c.f. integrate for usage.
 

Additional Inherited Members

- Static Public Attributes inherited from swarm::integrator
static const int _default_max_iterations = 10000000
 Default value for maximum number of iterations. c.f. _max_iterations.
 
static const int _default_max_attempts = 1000000
 Default value for maximum number of attempts. c.f. _max_attempts.
 
- Protected Member Functions inherited from swarm::integrator
virtual void launch_integrator ()=0
 Integrater implementation provided by derived instance.
 

Detailed Description

Common functionality and skeleton for body-pair-per-thread integrators Common tasks include:

  • Setting up the CUDA grid and block values.
  • Calculating the amount of shared memory.

Definition at line 140 of file bppt.hpp.

Member Function Documentation

const int& swarm::gpu::bppt::integrator::override_system_per_block ( ) const
inline

User specified value of system_per_block.

It can return a positive value to override the automaticly calculated system_per_block. or return 0 to indicate that automatic system_per_block should be used.

Definition at line 162 of file bppt.hpp.

References _override_system_per_block.

template<class T >
static GENERIC int swarm::gpu::bppt::integrator::shmem_per_system ( compile_time_param)
inlinestatic

Helper Function: Logical amount of shared memory needed for force calculations per thread This value is calculated from number of bodies, if this is used in a kernel, the actual amount of shared memory allocated might be different.

Todo:
This assumes one particular implementation of Gravitation class. Rewrite so that different gravitaiton classes (and different integrators) can request different ammounts of shared memory

Definition at line 195 of file bppt.hpp.

template<class T >
static GENERIC int swarm::gpu::bppt::integrator::thread_per_system ( compile_time_param)
inlinestatic

Calculate number of worker threads needed for each system.

This is set to number of greater value between number of pairs and number of coordinate components total. For example if nbod is 4 then there are 6 pairs of bodies, but there are 4x3=12 components per thread.

This function is used by other helper functions to determine block size and to decompose the thread ID value inside the kernel.

Definition at line 178 of file bppt.hpp.


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