In this post I will go over my latest PR on econ-ark/HARK. The goal of this PR is to create a mirror to ConsIndShockModel.py, but that implements faster solutions using numba just-in-time compiling and optimization.
Over the last few weeks I’ve worked on a numba version of ConsIndShockSolver in IndShockNumbaModel.py. For this, I created two numba helper functions, solveConsIndShockCubicNumba for solving using a cubic approximation for the consumption policy function, and addvFuncNumba for calculating the value function during the solution.
Since the last post I’ve worked on a numba version of IndShockConsumerType in IndShockNumbaModel.py. The class IndShockConsumerTypeNumba is the same as IndShockConsumerType, but now I use a “flat” numba optimized solvers called ConsIndShockNumbaSolverBasic and ConsIndSchockSolverNumba.
This week I worked on implementing a numba version of PerfForesightConsumerType in ConsIndShockNumba.py. The class PerfForesightConsumerTypeNumba is a child class of PerfForesightConsumerType, inheriting most of the existing structure but changing the solver to a numba implementation called ConsPerfForesightSolverNumba.
Today I started covering a tutorial on GPU computing. This repository contains a number of Jupyter notebooks with examples covering basic usage of numba and cupy on the gpu. Since I don’t have a GPU, I followed the following steps to run the examples: