GTAP Resource 3405

Download Report

Transcript GTAP Resource 3405

Using GEMPACK
effectively with GTAP
Michael Jerie
Centre of Policy Studies, Monash University.
Presented at the GTAP 13th annual conference,
Penang, Malaysia, June 9-11, 2010.
1
Faster GTAP with GEMPACK 10.0
Example: Solving standard GTAP, 30 regions and 30 sectors, Gragg 3-57 solution method (on a PC with an Intel Q9550 – 2.83 GHz CPU).
Using GEMPACK Release 9.0-003 (August 2006) with Lahey Fortran
LF95, solution time is 322 seconds.
Using GEMPACK Release 10.0-001 (April 2009) with Intel Fortran,
solution time is 101 seconds (less than 1/3 of the 2006 time)
Time saving improvements come from
- more effective pivot reuse
- Intel Fortran optimized GP libraries and model exe
Using parallelization introduced with GEMPACK 10.0 [servants=1],
solution time is 78 seconds (less than 1/4 of the 2006 time).
2
64-bit computing with GEMPACK
64-bit operating systems and cheap memory allow desktop
computing with large amounts of available RAM.
(Modellers are freed from the old limits: maximum 4 GB memory for
32-bit Windows, and, maximum 2 GB limit for a single program.)
Since GEMPACK 10.0 (May 2008), the Intel Visual Fortran compiler
can be used with Source-code GP.
On 64-bit Windows, using GEMPACK and the Intel Fortran compiler
you can
• make and run 64-bit models, or,
• make and run 32-bit models.
Both have greater memory access compared to the 32-bit Windows
environment.
Note: 64-bit programs are not ‘faster’ than 32-bit programs.
3
64-bit computing with GEMPACK
Using 64-bit Windows and GEMPACK 10.0 (May 2008) or later
• A 64-bit Tablo-generated program allows use of up to about
(24+8) = 32 GB of memory. Fully disaggregated GTAP can be
solved (6 GB).
Using 64-bit Windows and GEMPACK 10.0-002 (April 2010)
• A 32-bit Tablo-generated program allows use of up to 4 GB of
memory (using large address aware exe’s).
• ViewHAR, ViewSOL and AnalysGE can use up to 4 GB
memory. This allows large data or solution files to be opened.
4
LTG Optimization with Intel Fortran
Since GEMPACK 10.0 compiling with fast /O1 Intel Fortran optimization
has been available during the LTG step (after TABLO code generation).
Since GEMPACK 10.0-001 fast /O1 compiler optimization is used by
default when you run LTG. The effect of this is
• LTG takes longer, but
• Model exe runs faster
During model development, the LTG – run – debug – LTG cycle can mean
frequent LTG’ing. We provide BAT files to change LTG optimization level.
Run LTGfigo0.BAT to use no optimization during LTG, then
• LTG is faster, but
• Model exe runs slower
Run LTGfigo1.BAT to use /O1 optimization during LTG, to return to the
new default.
5
Condensation
! tms(i,r,s) # source-spec. change in tax on imports of i from r into s #!
Set NONAGR = TRAD_COMM - AGRCOM;
Equation
E_tmsA (all,i,AGRCOM)(all,r,REG)(all,s,REG) tms(i,r,s) = tmA(i,r);
E_tmsB (all,i,NONAGR)(all,r,REG)(all,s,REG) tms(i,r,s) = tmB(r);
! problem: tms can NOT be substituted out !
Coefficient (all,i,TRAD_COMM) ISAGR(i);
Formula
(all,i,TRAD_COMM) ISAGR(i)=0;
Formula
(all,i,AGRCOM)
ISAGR(i)=1;
Equation ! Now tms CAN be substituted out !
E_tms3 (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)
tms(i,r,s) = ISAGR(i)*tmA(i,r) + [1-ISAGR(i)]*tmB(r);
Equation ! Now tms CAN be substituted out !
E_tms (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)
tms(i,r,s) = sum{ii,AGRCOM:ii=i, tmA(ii,r)}
+ sum{j,NONAGR:j=i,
tmB(r)};
Equation ! Coming soon .. GEMPACK 11 !
E_tms2 (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)
tms(i,r,s) = if{i in AGRCOM, tmA(i,r)} + if{i in NONAGR, tmB(r)};
6
Shock from Coefficient
New in GEMPACK 10.0-002 (April 2010)
TAB (TABLO INPUT) FILE
Coefficient
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG) TMS0(i,r,s) # initial power #;
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG) TMS1(i,r,s) # new power #;
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG) shkTMS(i,r,s) # % change in tms #;
Zerodivide default 1;
Formula
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)
TMS0(i,r,s) = VIMS(i,r,s)/VIWS(i,r,s);
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)
TMS1(i,r,s) = min[1.5,TMS0(i,r,s)]; ! cap at 50% ad valorem rate !
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)
shkTMS(i,r,s) = 100*[TMS1(i,r,s)-TMS0(i,r,s)]/TMS0(i,r,s);
CMF (SIMULATION COMMAND) FILE
! CMF: shock tms from coefficient shkTMS;!
shock tms(AGRCOM,LDCREG,DEVREG) = select from coefficient shkTMS;
7
Set Expressions
New in GEMPACK 10.0-002 (April 2010)
Set ! From gtapsam.tab !
SAMAC1 # dummy set # = MCOM union DCOM ;
SAMAC2 # dummy set # = SAMAC1 union ACT ;
SAMAC3 # dummy set # = SAMAC2 union ENDW_COMM ;
SAMAC4 # dummy set # = SAMAC3 union TMM ;
SAMAC5 # dummy set # = SAMAC4 union TEE ;
SAMAC6 # dummy set # = SAMAC5 union TSSM ;
SAMAC7 # dummy set # = SAMAC6 union TSSD ;
SAMAC8 # dummy set # = SAMAC7 union TFF ;
SAMAC9 # dummy set # = SAMAC8 union TRMM ;
SAMAC10 # dummy set # = SAMAC9 union TRXM ;
SAMAC11 # dummy set # = SAMAC10 union WW ;
SAMAC12 # dummy set # = SAMAC11 union REGHOUS ;
SAMAC13 # dummy set # = SAMAC12 union HOUS ;
SAMAC14 # dummy set # = SAMAC13 union PRODTAX ;
SAMAC15 # dummy set # = SAMAC14 union DIRTAX ;
SAMAC16 # dummy set # = SAMAC15 union GOVT ;
SAMAC # Social Accounting Matrix Accounts # = SAMAC16 union CGDS_COMM ;
! (GP 10.0-002) Now
Set SAMAC # Social
+ ENDW_COMM + TMM
+ HOUS + PRODTAX +
8
becomes !
Accounting Matrix Accounts # = MCOM + DCOM + ACT
+ TEE + TSSM + TSSD + TFF + TRMM + TRXM + WW + REGHOUS
"DIRTAX" + GOVT + CGDS_COMM;
ViewHAR can display solution
(SL4) files
• Since Nov 2009, ViewHAR now displays SL4 solution files in a more
user-friendly way. Unlike in ViewSOL, you can see values for variables
with 4 or more dimensions.
• Since Nov 2009, ViewHAR is 'Large-Address-Aware' – it can use up to
4GB of memory, if run under 64-bit Windows. Under 32-bit Windows, it
can still use only 2GB.
RunDynam
Now improved (Feb 2010): “Save ingredients, except Model files, as Zip
archive”. RunDynam zip archives need not include model.exe file
• reduces Zip file size
• easier to email
• anyone with Source-code GEMPACK can rebuild the model.exe, and
run your simulations
9
Sparse storage in HAR files
• By default, GEMPACK programs when writing HAR files now store
mainly-zero real arrays in sparse form. This can save considerable
hard disk space.
All GEMPACK programs released since 2006 can read the sparse
format: older programs might complain.
• Can dramatically reduce size of very sparse huge arrays.
• Not much effect on zipped HAR size.
• Programs from GEMPACK version 9.0 (2005) or earlier cannot read
sparse format HAR files (see online help for workarounds).
10