Skip to content
/ VFI Public

Solution Code for Basic Dynamic Programming Problem via Value Function Iteration

License

Notifications You must be signed in to change notification settings

ealdrich/VFI

Repository files navigation

//////////////////////////////////////////////////////////////////////////////
///
/// @mainpage Value Function Iteration Code Comparison
///
/// @section intro Introduction
///
/// The software in this archive solves a basic neoclassical growth model
/// using value function iteration, as outlined in Aldrich, Eric M.,
/// Jesus Fernandez-Villaverde, A. Ronald Gallant and Juan F. Rubio-Ramirez
/// (2011), "Tapping the supercomputer under your desk: Solving dynamic
/// equilibrium models with graphics processors", Journal of Economic
/// Dynamics & Control, 35, 386-393. Multiple parallel implementations
/// are included for the purpose of comparison, including massively parallel
/// GPU software (CUDA C and Thrust), multi-core CPU C++ software (Thrust
/// OpenMP), as well as single-core C++ and Matlab software.
///
/// @section use Use
///
/// @subsection param-file Parameter File
///
/// The file `parameters.txt' contains the software inputs. The file must
/// contain 13 lines, each line beginning with a parameter value, followed
/// by a comma, follow by a line of text describing the parameter. The order
/// of the parameters can be found in the `parameters' class description in
/// CPP/global.h.
///
/// @subsection ind-imp Individual Implementation
///
/// Except for the Matlab code, individual software implementations can be run
/// from individual directories by typing `make; ./main' at the command line.
/// The Matlab code can be run via `main.m' either interactively or in batch.
///
/// The `Thrust' directory contains two makefiles, one corresponding to a
/// GPU implementation (makefile_gpu) and one corresponding to an OpenMP
/// CPU implementation (makefile_omp). When using the OpenMP implementation
/// it is important to set the environment variable `OMP_NUM_THREADS=N',
/// where `N' is the number of CPU cores available on the system.
///
/// @subsection output Output
///
/// When each software implementation is run, it loads the parameter values
/// in `parameters.txt' and returns the value function, policy function and
/// total solution time in files `valFunMethod.dat', `polFunMethod.dat'
/// and `solTimeMethod.dat', respectively, where `Method' is a string that
/// corresponds to the implementation, and which is equivalent to one of
/// the command line arguments described in the next section.
///
/// @subsection comp Comparison
///
/// To run multiple software implementations in sequence and compare their
/// results, simply run the shell script `compareMethods.sh'. The script
/// takes potentially multiple arguments, which must correspond to one of
/// software directory names, or alternatively `ThrustGPU' or `ThrustOMP'.
/// The first argument serves as the baseline implementation against which
/// other methods are compared. The script utilizes either `solutionDiff.m'
/// or `solutionDiff.R' to compare the output reported in the data files
/// described above - the user must comment the appropriate line to choose
/// among the Matlab or R scripts.
///
/// @section depend Dependencies
///
/// The Thrust and CUDA-C implementations have been successfully built and
/// run under CUDA Toolkits 4.2 and 5.0 on a CentOS 6 Linux operating system.
/// The C++ implementation utilizes the GNU g++ compiler and the Eigen
/// template library for linear algebra (eigen.tuxfamily.org). The
/// makefiles in the respective directories point to headers and libraries
/// for CUDA and Eigen - these directory paths may need to be changed
/// when running on different systems.
///
/// @subsection env-file Environment File
///
/// On many systems, such as a Linux OS, it is necessary to create or modify
/// an environment file such as .bashrc or .bash_profile which information
/// regarding paths to libraries (specified above in dependencies). For
/// example, in a linux Bash shell, one would create a .bashrc file and
/// write commands that add the Eigen and CUDA libraries to the system path:
///
/// export PATH=$HOME/bin:/usr/local/Eigen:/usr/local/cuda-5.0/bin:$PATH
/// export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:/lib
///
/// where $HOME is an environment variable pointing to the user's home
/// directory, and where the directory names may need to be changed
/// for different systems.
///
/// @author Eric M. Aldrich \n
///         ealdrich@ucsc.edu
///
/// @version 1.0
///
/// @date 23 Oct 2012
///
/// @copyright Copyright Eric M. Aldrich 2012 \n
///            Distributed under the Boost Software License, Version 1.0
///            (See accompanying file LICENSE_1_0.txt or copy at \n
///            http://www.boost.org/LICENSE_1_0.txt)
///
//////////////////////////////////////////////////////////////////////////////

About

Solution Code for Basic Dynamic Programming Problem via Value Function Iteration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published