On Sat, 7 Jan 2017, Sven Schreiber wrote:
Am 06.01.2017 um 23:23 schrieb Riccardo (Jack) Lucchetti:
> On Fri, 6 Jan 2017, Sven Schreiber wrote:
>
>> When I do "! gretlcli.exe -b testscript.inp > testout.out",
>> (that's on Windows obviously) I get the expected testout.out file. But
>> when I instead use "launch", the output file doesn't seem to get
>> created anywhere.
>> I'll test with the next snapshot.
>
> Of course your request makes sense, but just out of curiosity: why would
> one run gretlcli from inside gretl?
>
I had an idea last night for a little function that could make it a little
easier to run the same script in parallel with different parameter values.
That's why I need "launch" instead of "!", because as per the doc
"!" would
mean that the main gretl process would wait each time, destroying the
parallelism.
So this is an "embarassingly trivial" type of parallelism, where each worker
gets its own gretlcli instance/process.
"launch" is really intended for opening GUI applications from within
gretl.
It sounds as if MPI can do what you want here. Something like the
following:
<hansl>
# common setup, if applicable
scalar T = 100
scalar k = 3
matrix X
# set variant parameters here
if $mpirank == 0
X = mnormal(T, k)
elif $mpirank == 1
X = muniform(T, k)
endif
# do some work
matrix XXi = inv(X'X)
# write output
string outname = sprintf("output%d.txt", $mpirank)
outfile @outname --write
print XXi
outfile --close
</hansl>
<shell>
mpiexec -n 2 gretlmpi parallel.inp
</shell>
Allin