Parallel PopGen Package
Simulation Models: Demography Group

Functions that model population size in number of individuals across populations and over time. More...

Classes

struct  Sim_Model::demography_constant
 functor: single, constant population size (N individuals) across populations and over time More...
 
struct  Sim_Model::demography_sine_wave
 functor: models population size (individuals) as a sine wave through time More...
 
struct  Sim_Model::demography_exponential_growth
 functor: models exponential growth of population size (individuals) over time More...
 
struct  Sim_Model::demography_logistic_growth
 functor: models logistic growth of population size (individuals) over time More...
 
struct  Sim_Model::demography_population_specific< Functor_d, Functor_d_pop >
 functor: one population, pop, has a different, demography function, d_pop, all others have function, d More...
 
struct  Sim_Model::demography_piecewise< Functor_d1, Functor_d2 >
 functor: demography function changes from d1 to d2 at generation inflection_point More...
 

Detailed Description

Functions that model population size in number of individuals across populations and over time.

If a population with a previously positive number of individuals hits 0 individuals over the course of a simulation, it will be declared extinct. If the population size of an extinct population becomes non-zero after the extinction, an error will be thrown. Populations that start the simulation at 0 individuals are not considered extinct. As population size is stored as an integer currently, the max population size is ~2x109 individuals.

The effective number of chromosomes, N_chromosome_e - which is the effective population size in the simulation - is defined as 2*N/(1+F). Thus to equate two populations with differing inbreeding coefficients, multiply the number of individuals, N, in each by the inbreeding coefficient in each, 1+F. Side note: if population size is set to N*(1+F) in the simulation, the effective population size will be invariant with respect to inbreeding.

Writing your own Demography functions

These can be functions or functors (or soon, with C++11 support, lambdas). However, the demographic function must be of the form:

__host__ __device__ int your_function(int population, int generation){ ... return number_of_individuals; }

This returns the number of individuals in population population at generation generation. The __host__ and __device__ flags are to ensure the nvcc compiler knows the function must be compiled for both the host (CPU) and device (GPU). Because of these flags, the function must be defined in CUDA source file (*.cu) or declared/defined header file (*.h, *.hpp, *.cuh, etc...) which is included in a CUDA source file. Since this code will be compiled on the GPU, do not use dynamically allocated arrays in your function (e.g. int * f = new int[5]) unless you know CUDA. And even then avoid them as they will slow the code down (parameters have to be pulled from the GPU's global memory (vRAM), which is slow). Statically allocated arrays (e.g. int f[5]) are fine.