1 # Copyright (C) 2015-2020 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # first test using cluster
24 CatalogResources="""<?xml version="1.0"?>
26 <machine name="localhost" hostname="dsp0698184" type="single_machine" appliPath="" batchQueue="" userCommands="" protocol="ssh" iprotocol="ssh" workingDirectory="" canLaunchBatchJobs="false" canRunContainers="true" batch="none" mpi="no mpi" userName="" OS="" memInMB="0" CPUFreqMHz="0" nbOfNodes="1" nbOfProcPerNode="4"/>
27 <machine name="athos" hostname="athos" type="cluster" appliPath="/home/H87074/ATHOS_V830/appli_V8_3_0" batchQueue="" userCommands="" protocol="ssh" iprotocol="ssh" workingDirectory="" canLaunchBatchJobs="true" canRunContainers="false" batch="slurm" mpi="no mpi" userName="" OS="" memInMB="0" CPUFreqMHz="0" nbOfNodes="250" nbOfProcPerNode="28"/>
30 def buildScheme(fname):
33 SALOMERuntime.RuntimeSALOME.setRuntime()
34 r=SALOMERuntime.getSALOMERuntime()
35 p0=r.createProc("run")
37 p=r.createBloc("toto")
40 cont=p0.createContainer("MyWonderfulContainer","Salome")
41 td=p0.createType("double","double")
42 n0=r.createScriptNode("Salome","PyScript0")
44 q=n0.edAddInputPort("q",td)
45 ep=n0.edAddOutputPort("ep",td)
46 #n0.setScript("ep=1./(4.-q)") # <- force division by 0
47 n0.setScript("ep=2.*float(___idx___)")
48 n0.setExecutionMode("remote")
55 session=evalyfx.YACSEvalSession()
58 efx=evalyfx.YACSEvalYFX.BuildFromFile(fname)
59 efx.getParams().setStopASAPAfterErrorStatus(False)
60 inps=efx.getFreeInputPorts()
62 outps=efx.getFreeOutputPorts()
63 inps[0].setSequenceOfValuesToEval([-7.,2.,3.,5.,6.])
64 efx.lockPortsForEvaluation(inps,outps)
66 rss=efx.giveResources()
67 rss[0][0].setWantedMachine("athos")
68 cp=rss.getAddParamsForCluster() ; cp.setRemoteWorkingDir(os.path.join("/scratch",getpass.getuser(),"TMP3")) ; cp.setLocalWorkingDir(os.path.join(os.path.expanduser("~"),"TMP52"))
69 cp.setWCKey("P11U5:CARBONES") ; cp.setNbProcs(5) ; cp.setMaxDuration("00:05")
70 assert(not rss.isInteractive())
72 print(("************",a,b))
73 print(efx.getResults())