<div dir="ltr"><div>Hi,</div><div><br></div><div>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()"?</div><div><br></div><div>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.</div><div><br></div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 20, 2020 at 6:11 PM 时光足迹 via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Oops, sorry for not explaining well. I used task parallism shown below: <br><a href="http://www.ncl.ucar.edu/Applications/task_parallelism.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/task_parallelism.shtml</a><br><div><div>Thereinto, <a href="http://www.ncl.ucar.edu/Applications/Scripts/task_parallelism_driver_3.ncl" target="_blank">task_parallelism_driver_3.ncl</a> is the 'driver script', where another script is the so-call 'drived script'.</div><div> 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.</div><div>;--------------------</div><div>So, in the <font style="display:inline;font-size:14px;font-family:Verdana;color:rgb(0,0,0);background-color:rgba(0,0,0,0);font-weight:400;font-style:normal">'driver </font>script',</div><div><pre>do i=0,numLevs-1<br>command = "ncl ***.ncl " + str_get_sq() + "level=" + i + str_get_sq() + " >/dev/null"<br>end do<br><br></pre><div>;--------------------</div><div>And, in the 'drived script',</div><pre>begin
print(level)<br> ...<br>end<br></pre><div>;--------------------</div><div><font style="display:inline;font-size:14px;font-family:Verdana;color:rgb(0,0,0);background-color:rgba(0,0,0,0);font-weight:400;font-style:normal">I won</font><font style="display:inline;font-size:14px;font-family:Verdana;color:rgb(0,0,0);background-color:rgba(0,0,0,0);font-weight:400;font-style:normal">der if I explained it clearly.</font></div><div>Best regrads.<br></div></div><div><br></div><div style="font-size:12px;font-family:Arial Narrow;padding:2px 0px">------------------ 原始邮件 ------------------</div><div style="font-size:12px;background:rgb(239,239,239) none repeat scroll 0% 0%;padding:8px"><div><b>发件人:</b> "Dennis Shea"<<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>>;</div><div><b>发送时间:</b> 2020年1月20日(星期一) 晚上11:41</div><div><b>收件人:</b> "时光足迹"<<a href="mailto:1072752133@qq.com" target="_blank">1072752133@qq.com</a>>;</div><div><b>抄送:</b> "ncl-talk"<<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>>;</div><div><b>主题:</b> Re: [ncl-talk] Question on parallelism</div></div><div><br></div><div dir="ltr"><div>It is not clear what you mean by "using parallelism in NCL"</div><div>What "driver script?"</div><div>What do you mean "output to files?"</div><div><br></div><div>You must be much clearer in what you have done and what you want as a result.<br></div><div><br></div><div>A simple test script</div><div><br></div><div> klev = 14<br> ntim = 120 ; example 120 months<br> nlat = 100<br> mlon = 200<br> u = random_normal( 20,10,(/klev,ntim,nlat,mlon/)) <br> t = random_normal(-10, 3,(/klev,ntim,nlat,mlon/))</div><div><br></div><div> U = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml" target="_blank"><b>dim_avg_n_Wrap</b></a>(u,1)<br> printVarSummary(U)<br> T = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml" target="_blank"><b>dim_avg_n_Wrap</b></a>(t,1)<br> printVarSummary(T)</div><div>====</div><div><br></div><div><br></div><div>Variable: U<br>Number of Dimensions: 3<br>Dimensions and sizes<b>: [14] x [100] x [200]</b><br><br><br>Variable: T<br>Type: float<br>Total Size: 1120000 bytes<br> 280000 values<br>Number of Dimensions: 3<br>Dimensions and sizes: <b>[14] x [100] x [200]</b></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 19, 2020 at 9:01 PM 时光足迹 via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hi adimistrator,</div><div> I am using parallelism in NCL, version 6.6.2. <br></div><div> 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. <br></div><div> Annually average and monthly average of every variables were calculated in the 'drived' script. However only few levels are output to files.</div><div> For example, it should get output files:</div><div> (1) Annual-Mean-Lev0.nc (2)Annual-Mean-Lev1.nc ... (14)Annual-Mean-Lev13.nc</div><div> But now i only get some of these:</div><div> (1)Annual-Mean-Lev1.nc (2)Annual-Mean-Lev3.nc ... <br></div><div> That means some levels are missing.</div><div><br></div><div> When I run the 'drived' script alone, I can get Annual-Mean-Lev2.nc successfully. <br></div><div><br></div><div> So I wonder why I can't get all files using parallelism(subprocess) ?</div><div>Yours,</div><div>HUNAG<br></div><div> <br></div>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>