[ncl-talk] 回复: Question on parallelism

Rick Brownrigg brownrig at ucar.edu
Tue Jan 21 09:24:32 MST 2020


Hi,

If I understand correctly, the "drived" script (let's call it "worker"
script) runs fine if run sequentially, but not when launched in parallel
via "subprocess()"?

You have "print(level)" as the first line in the worker -- do you see all
14 levels get printed?  Something in the worker must be stepping on the
state of the other runs. Without seeing that script, it's hard to say what.
Perhaps  look carefully at that script to make sure each invocation of it
is truly independent of any other.

Rick


On Mon, Jan 20, 2020 at 6:11 PM 时光足迹 via ncl-talk <ncl-talk at ucar.edu> wrote:

> Oops, sorry for not explaining well. I used task parallism shown below:
> http://www.ncl.ucar.edu/Applications/task_parallelism.shtml
> Thereinto, task_parallelism_driver_3.ncl
> <http://www.ncl.ucar.edu/Applications/Scripts/task_parallelism_driver_3.ncl>
> is the 'driver script', where another script is the so-call 'drived script'.
> Generally speaking, do-loop of different levels can be used directly in
> the 'drived script', and run this script only is OK. However, there are
> already too much do-loop inside the 'drived script', so I tried to use the
> parallism to run the script.
> ;--------------------
> So, in the 'driver script',
>
> do i=0,numLevs-1
> command = "ncl ***.ncl " + str_get_sq() + "level=" + i + str_get_sq() + " >/dev/null"
> end do
>
> ;--------------------
> And, in the 'drived script',
>
> begin
>   print(level)
>   ...
> end
>
> ;--------------------
> I wonder if I explained it clearly.
> Best regrads.
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Dennis Shea"<shea at ucar.edu>;
> *发送时间:* 2020年1月20日(星期一) 晚上11:41
> *收件人:* "时光足迹"<1072752133 at qq.com>;
> *抄送:* "ncl-talk"<ncl-talk at ucar.edu>;
> *主题:* Re: [ncl-talk] Question on parallelism
>
> It is not clear what you mean by "using parallelism in NCL"
> What "driver script?"
> What do you mean "output to files?"
>
> You must be much clearer in what you have done and what you want as a
> result.
>
> A simple test script
>
>    klev = 14
>    ntim = 120   ; example 120 months
>    nlat = 100
>    mlon = 200
>    u    = random_normal( 20,10,(/klev,ntim,nlat,mlon/))
>    t     = random_normal(-10, 3,(/klev,ntim,nlat,mlon/))
>
>    U    = *dim_avg_n_Wrap*
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml>
> (u,1)
>    printVarSummary(U)
>    T    = *dim_avg_n_Wrap*
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml>
> (t,1)
>    printVarSummary(T)
> ====
>
>
> Variable: U
> Number of Dimensions: 3
> Dimensions and sizes*: [14] x [100] x [200]*
>
>
> Variable: T
> Type: float
> Total Size: 1120000 bytes
>             280000 values
> Number of Dimensions: 3
> Dimensions and sizes: *[14] x [100] x [200]*
>
>
> On Sun, Jan 19, 2020 at 9:01 PM 时光足迹 via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Hi adimistrator,
>>    I am using parallelism in NCL, version 6.6.2.
>>    Fourteen levels of different variables, such as
>> u(nlev,ntime,nlat,nlon), are processed, by using do-loop (do i=0,14-1) in
>> the 'driver' script.
>>    Annually average and monthly average of every variables were
>> calculated in the 'drived' script. However only few levels are output to
>> files.
>>    For example, it should get output files:
>>   (1) Annual-Mean-Lev0.nc  (2)Annual-Mean-Lev1.nc ...
>> (14)Annual-Mean-Lev13.nc
>>    But now i only get some of these:
>>   (1)Annual-Mean-Lev1.nc   (2)Annual-Mean-Lev3.nc ...
>>    That means some levels are missing.
>>
>>    When I run the 'drived' script alone, I can get Annual-Mean-Lev2.nc
>> successfully.
>>
>>    So I wonder why I can't get all files using parallelism(subprocess) ?
>> Yours,
>> HUNAG
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200121/c140548a/attachment.html>


More information about the ncl-talk mailing list