Skip to content

Implementation of a Gibbs-Metropolis sampling algorithm in CUDA

Notifications You must be signed in to change notification settings

arendsee/cuda-gibbs-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

This program implements a MCMC algorithm for the following hierarchical
model:

y_k     ~ Poisson(n_k * theta_k)
theta_k ~ Gamma(a, b)
a       ~ Unif(0, a0)
b       ~ Unif(0, b0) 

I let a0 and b0 be arbitrarily large.

Arguments:
    1) input file name
        With two space delimited columns holding integer values for
        y and float values for n.
    2) number of trials (1000 by default)

Output: A comma delimited file containing a column for a, b, and each
theta. All output is written to standard out.

Example:

$ head -3 mydata.txt
 4 0.91643
 23 3.23709
 7 0.40103

$ a.out mydata.txt 2500 > output.csv

This code borrows from the nVidia developer zone documentation, 
specifically http://docs.nvidia.com/cuda/curand/index.html#topic_1_2_1

About

Implementation of a Gibbs-Metropolis sampling algorithm in CUDA

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages