Tested on: Julia v0.6.4, MacOS 10.12+
JuliaCon 2018 Presentation: "GPU-Accelerated Value Function Iteration in Julia: Faster Macroeconomic Modeling"
Ideas on using Julia to apply GPGPU computing to Economics:
Notebook | Description |
---|---|
GPU Computing for Value Function Iteration in OpenCL | Implementation of the basic RBC model in Julia and in pure OpenCL code. |
Value Function Iteration with GPUArray.jl | Solving the simple RBC model on the GPU, but by using higher-level Julia code using GPUArrays.jl and CLArrays.jl. |
GPU Value Function Iteration under Uncertainty | Introducing uncertainty in the RBC model through the mean of a simple Markov process for productivity, and solving it with the GPU. |
OLG Model with Individual Uncertainty | [!] Experimental [!] Usage of an OLG model similar to that developed by Huggett (1993) to show the computational advantages of using GPUs to run the VFI algorithm. |
Since this is supposed to work as a simple example, the model used is a simple Real Business Cycle model. The value function is:
For both the CPU and the GPU algorithm we employ a "brute force" algorithm:
- Start with a guess for the value function,
V0
; - Take the capital grid point
k
; - Iterate from
k_lower_bound
tok_u(k)
, wherek_u
is such that implied consumption is not negative; - Save the results in the new value function approxiamtion
V1
; - Iterate until convergence;
The main concepts behind this work are from "Tapping the Supercomputer under your Desk: Solving Dynamic Equilibrium Models with Graphics Processors" by Eric M. Aldrich, Jesús Fernández-Villaverde, A. Ronald Gallant and Juan F. Rubio-Ramírez.
I would like to thank Simon Danish, who develops GPUArrays.jl and CPUArrays.jl, for his great help on using said packages.
- The OpenCL.jl, GPUArrays.jl and CLArrays.jl packages are required to run the GPU code.
- The
IJulia
package is necessary to run the IJupyter notebook. - The OpenCL kernel used is available standalone in the repository.