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

Interface class for all GPU based integrators. More...

#include <integrator.hpp>

Inheritance diagram for swarm::gpu::integrator:
swarm::integrator swarm::gpu::bppt::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)
 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.
 

Protected Attributes

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 Member Functions inherited from swarm::integrator
static shared_ptr< integratorcreate (const config &cfg)
 Loads an integrator using the plugin system. More...
 
- 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

Interface class for all GPU based integrators.

It is very similar to its base class integrator. But it is adapted for GPU integrators.

This class takes care of GPU logs, uploading and downloding ensemble from GPU. Derived instances need to override the pure virtual method launch_integrator with the CUDA kernel launch code.

Because CUDA is not capable of dereferencing virtual methods, this class cannot launch kernels. However, template classes for launching kernels are included in gpu/helpers.hpp.

Definition at line 178 of file integrator.hpp.

Member Function Documentation

virtual void swarm::gpu::integrator::core_integrate ( )
inlinevirtual

To integrate without any bookkeeping.

This function just executes the integration implementation The callee has to take care of systems running and stop conditions and memory management

Definition at line 214 of file integrator.hpp.

References swarm::integrator::flush_log(), and swarm::integrator::launch_integrator().

void swarm::gpu::integrator::integrate ( )
virtual

Interfaces function to integrate, for use by general user.

Launches the GPU integrator kernel several times up to the value specified in _max_attempts until all the systems are inactive. Each kernel call can go through at most a limited number of iterations specified in _max_iterations .

To set the parameters for integration use set_ensemble(ens), set_destination_time(t), set_log_manager(l)

Reimplemented from swarm::integrator.

Definition at line 102 of file integrator.cpp.

References swarm::number_of_active_systems().

void swarm::gpu::integrator::set_ensemble ( defaultEnsemble host_ens,
deviceEnsemble device_ens 
)
inline

Set two host and device ensembles, two ensembles should match.

Be careful: all data on device_ens will be overwritten when you call integrate(). Only use this function if you want to save memory when integrating the same ensemble on different integrators. Example:

i1->set_ensemble(hens,dens);
i2->set_ensemble(hens,dens);
i1->integrate();
i2->integrate();
i1->integrate();
.
.
.

Definition at line 260 of file integrator.hpp.

References _dens, and _hens.

Member Data Documentation


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