Swarm-NG  1.1
swarm Namespace Reference

Swarm-NG library. More...

Namespaces

 gpu
 GPU-based integrators and other GPU tools.
 
 log
 The event/data logging system for swarm
 
 monitors
 Namespace for monitors (i.e., stoppers & loggers) and their associated classes.
 
 query
 This namespace contains routines for opening and querying a swarm log file.
 
 snapshot
 Static class containing methods to load/save ensembles to file.
 

Classes

struct  EnsembleAlloc
 Allocator based version of ensemble containing memory management routines It takes an allocator as a parameter and uses the allocator for allocate, deallocate and copying the ensemble. More...
 
struct  compile_time_params_t
 This is a wrapper for a compile time integere value. Because CUDA chokes when encountered with integer template values. More...
 
struct  launch_template_choose
 structure crafted to be used with choose template. More...
 
class  integrator
 Interface class for all integrators. More...
 
struct  plugin
 Abstract interface class for all plugins. More...
 
struct  basic_plugin
 Template class for easy plugin development. More...
 
struct  plugin_initializer
 Template class to add your plugin to the list of plugins. More...
 
struct  basic_plugin_initializer
 Template class for easy plugin development and management. More...
 
struct  integrator_plugin_initializer
 Template to add a new integrator to swarm. More...
 
struct  writer_plugin_initializer
 Template to add a new writer plugin to swarm. More...
 
struct  plugin_not_found
 Thrown when a nonexisting plugin is requested. More...
 
class  runtime_error
 Unrecoverable error exception. More...
 
struct  CoalescedStructArray
 Array of structures with coalecsed access. More...
 
struct  DoubleCoalescedStruct
 CoalescedStruct for double data type. More...
 
struct  key_not_found
 Raised when a key not found in the configuration. More...
 
class  config
 Basic dictionary like data structure to hold configuration. More...
 
struct  CoalescedMemberArray
 To use as an array for members of Body and Sys. More...
 
class  EnsembleBase
 ensemble data structure containing nbody systems. More...
 

Typedefs

typedef EnsembleAlloc
< ENSEMBLE_CHUNK_SIZE,
DefaultAllocator
defaultEnsemble
 Default ensemble class for most of uses.
 
typedef EnsembleAlloc
< ENSEMBLE_CHUNK_SIZE,
DefaultAllocator
hostEnsemble
 Ensemble allocated on host memory.
 
typedef EnsembleAlloc
< ENSEMBLE_CHUNK_SIZE,
DeviceAllocator
deviceEnsemble
 Ensemble allocated on [GPU] device memory.
 
typedef hostEnsemble cpu_ensemble
 Provided for backward compatibility.
 
typedef deviceEnsemble gpu_ensemble
 Provided for backward compatibility.
 
typedef EnsembleBase
< ENSEMBLE_CHUNK_SIZE > 
ensemble
 Base class of all ensembles.
 

Functions

template<class implementation , class T >
__global__ void generic_kernel (implementation *integ, T compile_time_param)
 Implementation of the generic_kernel. This is used so we can have arbitrary kernels that are template based and member functions of some class.
 
template<class implementation >
void launch_templatized_integrator (implementation *integ)
 Global interface for launching a templatized integrator. More...
 
int number_of_active_systems (ensemble ens)
 Count the number of active systems on GPU without downloading the ensemble. More...
 
bool configure_grid (dim3 &gridDim, int threadsPerBlock, int nthreads, int dynShmemPerThread, int staticShmemPerBlock)
 Configur grid. More...
 
void find_best_factorization (unsigned int &bx, unsigned int &by, int nblocks)
 Find best factorization. More...
 
int number_of_active_systems (defaultEnsemble ens)
 Helper function to calculate number of systems with SYSTEM_ACTIVE flag.
 
struct ALIGN (16) swarm_header
 Define swarm header. The header MUST be padded to 16-byte boundary. More...
 
ostream & operator<< (std::ostream &, const plugin::help_t &)
 Helper function to print out the plugin help message. More...
 
void init (const config &cfg)
 Initialize the swarm library. More...
 
template<class N >
GENERICsquare (const N &x)
 

Variables

struct ALIGN(16)
swarm_index_header uint64_t 
datafile_size
 Define swarm index header. It MUST be padded to 16-byte boundary.
 

Detailed Description

Swarm-NG library.

Function Documentation

struct swarm::ALIGN ( 16  )

Define swarm header. The header MUST be padded to 16-byte boundary.

< Magic string to quickly verify this is a swarm file (== 'SWARM\0')

< File format version

< user-defined file content ID/description

< user-defined flags

< length of data in the file (0xFFFFFFFFFFFFFFFF for unknown)

Constructor for swarm_header

Determine the string type

Check the data type is compatible

Definition at line 30 of file fileformat.hpp.

References peyton::constants::c, and peyton::util::trim().

bool swarm::configure_grid ( dim3 &  gridDim,
int  threadsPerBlock,
int  nthreads,
int  dynShmemPerThread,
int  staticShmemPerBlock 
)

Configur grid.

Given a total number of threads, their memory requirements, and the number of threadsPerBlock, compute the optimal allowable grid dimensions. Returns false if the requested number of threads are impossible to fit to shared memory.

Parameters
[out]gridDim
[in]threadsPerBlock
[in]nthreads
[in]dynShmemPerThread
[in]staticShmemPerBlcok
Returns
boolean

Definition at line 66 of file utilities.cu.

References find_best_factorization().

void swarm::find_best_factorization ( unsigned int &  bx,
unsigned int &  by,
int  nblocks 
)

Find best factorization.

Find the dimensions (bx,by) of a 2D grid of blocks that has as close to nblocks blocks as possible

Parameters
[out]bx
[out]by
[in]nblocks

Definition at line 92 of file utilities.cu.

Referenced by configure_grid(), and number_of_active_systems().

void swarm::init ( const config &  cfg)
inline

Initialize the swarm library.

This function is included for compatibility. It is not mandatory to call this functions but it is encouraged for forward compatibility.

Select the proper device

Device present or not

Select cuda device

initialize the config

Definition at line 49 of file swarm.h.

References swarm::log::manager::default_log(), swarm::config::optional(), print_device_information(), select_cuda_device(), and set_more_cache().

Referenced by main().

template<class implementation >
void swarm::launch_templatized_integrator ( implementation *  integ)

Global interface for launching a templatized integrator.

The passed pointer is expected to be a gpu::integrator. The function inspects the ensemble of the integrator and launches the templatized version of the integrator that matches the number of bodies.

The templates are intantiated for number of bodies ranging from 3 to MAX_NBODIES (defined in config.h.in and adjustable using CMake configurations). If the number of bodies is not in range, then an error is raised.

Definition at line 217 of file helpers.hpp.

References peyton::constants::c, and cudaErrCheck.

Referenced by swarm::gpu::bppt::hermite< Monitor, Gravitation >::launch_integrator(), swarm::gpu::bppt::hermite_adap< Monitor, Gravitation >::launch_integrator(), swarm::gpu::bppt::rkck< AdaptationStyle, Monitor, Gravitation >::launch_integrator(), TutorialIntegrator< Monitor, Gravitation >::launch_integrator(), and swarm::gpu::bppt::generic< Propagator, Monitor, Gravitation >::launch_integrator().

int swarm::number_of_active_systems ( ensemble  ens)

Count the number of active systems on GPU without downloading the ensemble.

It is a very small kernel that iterates through all systems and counts The number of active ones. One can optimize the performance of this using Prefix-sum algorithm.

But this is such a small kernel and it is not very frequently used.

Definition at line 44 of file utilities.cu.

References cudaErrCheck, find_best_factorization(), and swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::nsys().

Referenced by swarm::integrator::integrate(), swarm::gpu::integrator::integrate(), and main().

std::ostream & swarm::operator<< ( std::ostream &  ,
const plugin::help_t &   
)

Helper function to print out the plugin help message.

Prints out a list of all registered plugins in swarmng library. To use:

std::cout << plugin::help << std::endl;

Definition at line 66 of file plugin.cpp.