7 fname2="REtestFEDyn.xml"
8 SALOMERuntime.RuntimeSALOME.setRuntime()
10 r=SALOMERuntime.getSALOMERuntime()
11 p=r.createProc("prTest1")
12 td=p.createType("double","double")
13 ti=p.createType("int","int")
14 cont=p.createContainer("gg","HPSalome")
15 cont.setProperty("nb_proc_per_node","1")
18 #pg.loadFromKernelCatalog()
19 pg.setData([("localhost",4)])
21 #cont.setSizeOfPool(4)
22 cont.setProperty("name","localhost")
23 cont.setProperty("hostname","localhost")
24 ti=p.createType("int","int")
25 tsi=p.createSequenceTc("seqint","seqint",ti)
27 n0=r.createScriptNode("","n0")
28 o0=n0.edAddOutputPort("o0",tsi)
29 n0.setScript("o0=[ elt for elt in range(8) ]")
31 n1=r.createForEachLoopDyn("n1",ti)#Dyn
32 #n1.getInputPort("nbBranches").edInitPy(2)
33 n10=r.createScriptNode("","n10")
34 n10.setExecutionMode("remote")
35 n10.setContainer(cont)
42 i1=n10.edAddInputPort("i1",ti)
43 o2=n10.edAddOutputPort("o2",ti)
45 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
46 p.edAddLink(n1.edGetSamplePort(),i1)
48 n2=r.createScriptNode("","n2")
50 i3=n2.edAddInputPort("i3",tsi)
51 i4=n2.edAddInputPort("i4",tsi)
52 o4=n2.edAddOutputPort("o4",tsi)
53 n2.setScript("o4=[a+b for a,b in zip(i3,i4)]")
57 # Second parallel foreach
58 n11=r.createForEachLoopDyn("n11",ti)
59 #n11.getInputPort("nbBranches").edInitPy(2)
60 n110=r.createScriptNode("","n110")
61 n110.setExecutionMode("remote")
62 n110.setContainer(cont)
69 i1_1=n110.edAddInputPort("i1",ti)
70 o2_1=n110.edAddOutputPort("o2",ti)
72 p.edAddLink(o0,n11.edGetSeqOfSamplesPort())
73 p.edAddLink(n11.edGetSamplePort(),i1_1)
82 p.propagePlayGround(pg)
83 ex=pilot.ExecutorSwig()
84 assert(p.getState()==pilot.READY)
85 stt = datetime.datetime.now()
87 print(str(datetime.datetime.now()-stt))
88 assert(p.getState()==pilot.DONE)
89 o4=p.getChildByName("n2").getOutputPort("o4")
90 assert(o4.getPyObj()==[0, 5, 10, 15, 20, 25, 30, 35])
91 # Ideal ForEachDyn time = 22 s
92 # ForEach time = 40 s"""