Hi all, today I've been playing around with the shell trying to run several gretl instances parallel. In a thread at the beginning of the year, Sven already came up with such an idea. This culminated in some nice example script by Allin, gathering information in a bundle if I understood this correctly. This is very nice but was too complicated for my rather simple tasks ;-)
Actually, for a project I am just using a dataset comprising information for several countries, and I just need to re-run certain (intense) calculations for each country separately to create some measures which I want to plot later. So, I don't need to merge certain output files or -- even so this could also be handled, I guess. This works nicely on linux using "gnu-parallel" (https://www.gnu.org/software/parallel/) which does all the job for you. Simply save both the attached *.sh and the *.inp file in the same folder. The shell-script calls the SB()'s function package sample script, and runs the example for different numbers of bootstrap iterations. "parallel" does all the stuff, and automatically takes into account the machine's number of cores available (I am sure one could set the max. number of cores to use) and waits before starting the next queuing job to do... <SHELL> sh gretl_parallel_ex.sh </SHELL> I really love this, and it's going to save sooo much time for several applications! Artur
gretl_parallel_ex.sh
Description: application/shellscript
set verbose off
include SB.gfn
open denmark.gdt --quiet --preserve
scalar nboot = scriptopt
print nboot
scalar b = 0 # use rule-of-thumb value
list lx=LRY IBO
ols LRM 0 lx --quiet
bhat=$coeff
lrmh=$yhat
uh={$uhat}
matrix bb=zeros(nboot,$ncoeff)
loop boot=1..nboot --quiet
matrix ub=SB(uh,b) # resample
series ubs=ub
series lrmb=lrmh+ubs
ols lrmb 0 lx --quiet
bb[boot,]=$coeff'
endloop
matrix bb05=quantile(bb,0.05)
matrix bb95=quantile(bb,0.95)
printf "\nUSING %d bootstrap iteration", nboot
print ""
printf "estimated coefficients %10.2f", bhat'
print ""
print "95% bootstrap confidence intervals"
print ""
printf "Lower limits %15.2f", bb05
printf "Upper limits %15.2f", bb95
