This repository contains the source code referenced in the paper A Practical Guide to Parallel Computing in Macroeconomics by Jesús Fernández-Villaverde and David Zarruk Valencia.
Parallel computing opens the door to solving and estimating richer models in Economics. From dynamic optimization problems with high dimensionality to structural estimation with complex data, readily-available and economical parallel computing allows researchers to tackle problems in Economics that were beyond the realm of possibility just a decade ago. This paper describes the basics of parallel computing for economists, reviews widely-used implementation routines in
Julia
,Python
,R
,Matlab
,C++
(OpenMP
andMPI
) andCUDA
and compares performance gains using as a test bed a standard life-cycle problem such as those used in macro, labor, and other fields.
The file Makefile
contains the compilation flags used in Linux and can be used to execute the codes in every language.
Cpp_main.cpp
: C++ code for OpenMPCUDA_main.cu
: CUDA codeJulia_main_parallel.jl
: Julia codeJulia_main_pmap.jl
: Julia codeJulia_threads.jl
: Julia code with @threads parallelizationMatlab_main.m
: Matlab codeMPI_host_file
: MPI host fileMPI_main.cpp
: C++ code for MPIPython_main.py
: Python codePython_numba_main.py
: Python code with numba parallelizationRcpp_main.cpp
: C++ code for Rcpp package in RRcpp_main.R
: Rcpp codeR_main.R
: R codeMakefile
: Makefile to execute codes