import tempfile
from . import salome_proxy
from . import configuration
+import copy
class Parameters:
def __init__(self, resource="localhost",
job_params.work_directory = configuration.defaultWorkingDir(resource)
if nb_branches is None:
nb_branches = configuration.defaultNbBranches(resource)
- job_params.resource_required.nb_proc = nb_branches
self.nb_branches = nb_branches
self.salome_parameters = job_params
else:
if nb_branches is None:
- nb_branches = salome_parameters.resource_required.nb_proc
+ nb_branches = 1
self.nb_branches = nb_branches
self.salome_parameters = salome_parameters
self.salome_parameters.work_directory = configuration.defaultWorkingDir(
resource)
nb_branches = configuration.defaultNbBranches(resource)
- self.salome_parameters.resource_required.nb_proc = nb_branches
self.nb_branches = nb_branches
self.salome_parameters.wckey = configuration.defaultWckey(resource)
newobj.salome_parameters.wckey = self.salome_parameters.wckey
newobj.salome_parameters.extra_params = self.salome_parameters.extra_params
#newobj.salome_parameters.specific_parameters = self.salome_parameters.specific_parameters
- newobj.salome_parameters.resource_required.name = self.salome_parameters.resource_required.name
- newobj.salome_parameters.resource_required.hostname = self.salome_parameters.resource_required.hostname
- newobj.salome_parameters.resource_required.OS = self.salome_parameters.resource_required.OS
- newobj.salome_parameters.resource_required.nb_proc = self.salome_parameters.resource_required.nb_proc
- newobj.salome_parameters.resource_required.mem_mb = self.salome_parameters.resource_required.mem_mb
- newobj.salome_parameters.resource_required.cpu_clock = self.salome_parameters.resource_required.cpu_clock
- newobj.salome_parameters.resource_required.nb_node = self.salome_parameters.resource_required.nb_node
- newobj.salome_parameters.resource_required.nb_proc_per_node = self.salome_parameters.resource_required.nb_proc_per_node
+ newobj.salome_parameters.resource_required = copy.deepcopy(self.salome_parameters.resource_required)
return newobj
"resource_required" : {
"name" : self.salome_parameters.resource_required.name,
"hostname" : self.salome_parameters.resource_required.hostname,
- "OS" : self.salome_parameters.resource_required.OS,
- "nb_proc" : self.salome_parameters.resource_required.nb_proc,
- "mem_mb" : self.salome_parameters.resource_required.mem_mb,
- "cpu_clock" : self.salome_parameters.resource_required.cpu_clock,
- "nb_node" : self.salome_parameters.resource_required.nb_node,
- "nb_proc_per_node" : self.salome_parameters.resource_required.nb_proc_per_node
}
}
}
self.salome_parameters.extra_params = dico["salome_parameters"]["extra_params"]
self.salome_parameters.resource_required.name = dico["salome_parameters"]["resource_required"]["name"]
self.salome_parameters.resource_required.hostname = dico["salome_parameters"]["resource_required"]["hostname"]
- self.salome_parameters.resource_required.OS = dico["salome_parameters"]["resource_required"]["OS"]
- self.salome_parameters.resource_required.nb_proc = dico["salome_parameters"]["resource_required"]["nb_proc"]
- self.salome_parameters.resource_required.mem_mb = dico["salome_parameters"]["resource_required"]["mem_mb"]
- self.salome_parameters.resource_required.cpu_clock = dico["salome_parameters"]["resource_required"]["cpu_clock"]
- self.salome_parameters.resource_required.nb_node = dico["salome_parameters"]["resource_required"]["nb_node"]
- self.salome_parameters.resource_required.nb_proc_per_node = dico["salome_parameters"]["resource_required"]["nb_proc_per_node"]
_default()
if _use_salome_servers:
result = salome.JobParameters()
- result.resource_required = salome.ResourceParametersContainer()
+ result.resource_required = salome.ResourceParametersJob()
else:
result = pylauncher.JobParameters_cpp()
return result
dicconfig["studymodule"] = "idefixstudy"
dicconfig["sampleIterator"] = self.sampleManager.getModuleName()
dicconfig["plugin"] = self.schemaBuilder.getPluginName()
- nbproc = self.params.salome_parameters.resource_required.nb_proc
- dicconfig["tasksPerEval"] = nbproc // self.params.nb_branches
configpath = configuration.exportConfig(dicconfig, result_directory)
studypath = os.path.join(result_directory, "idefixstudy.py")
with open(studypath, "w") as f:
print("ressource de calcul:", myParams.salome_parameters.resource_required.name)
print("nombre d'évaluations parallèles:", myParams.nb_branches)
-print("nombre de coeurs demandés:",
- myParams.salome_parameters.resource_required.nb_proc)
-print("nombre de noeuds demandés:",
- myParams.salome_parameters.resource_required.nb_node)
print("répertoire de travail:", myParams.salome_parameters.work_directory)
print("répertoire local de gestion:",
myParams.salome_parameters.result_directory)
myParams.configureResource("eole")
#myParams.createResultDirectory("/tmp")
myParams.nb_branches = 4
-myParams.salome_parameters.resource_required.nb_proc = 4
myParams.salome_parameters.result_directory=os.path.join(os.getcwd(),"rundir")
myParams.salome_parameters.work_directory="/scratch/I35256/workingdir/testjob/"
myParams.salome_parameters.local_directory = os.getcwd()
myParams = pydefx.Parameters()
myParams.configureResource("localhost")
myParams.nb_branches = 4
-myParams.salome_parameters.resource_required.nb_proc = 1
myParams.salome_parameters.work_directory=os.path.join(os.getcwd(),"runbasic")
myParams.salome_parameters.local_directory = os.getcwd()
myParams.nb_branches = 4
myParams.salome_parameters.work_directory=os.path.join(os.getcwd(),"runbasic")
myParams.salome_parameters.local_directory = os.getcwd()
-myParams.salome_parameters.resource_required.nb_proc = 1
myParams.salome_parameters.job_name = "basic_job"
myParams.salome_parameters.job_type = "command"
myParams.salome_parameters.job_file = os.path.join(os.getcwd(), "simple_command.sh")
myParams.configureResource("gaia")
#myParams.createResultDirectory("/tmp")
myParams.nb_branches = 4
-myParams.salome_parameters.resource_required.nb_proc = 1
myParams.salome_parameters.result_directory=os.path.join(os.getcwd(),"runmulti")
myParams.salome_parameters.work_directory="/scratch/I35256/workingdir/test_multijob/"
myParams.salome_parameters.local_directory = os.getcwd()
myParams = pydefx.Parameters()
myParams.configureResource("gaia")
myParams.nb_branches = 4
-myParams.salome_parameters.resource_required.nb_proc = 4
myParams.salome_parameters.result_directory=os.path.join(os.getcwd(),"lightsrun")
myParams.salome_parameters.work_directory="/scratch/I35256/workingdir/test_srunjob/"
myParams.salome_parameters.local_directory = os.getcwd()
myParams.configureResource("eole")
#myParams.createResultDirectory("/tmp")
myParams.nb_branches = 4
-myParams.salome_parameters.resource_required.nb_proc = 4
myParams.salome_parameters.result_directory=os.path.join(os.getcwd(),"runsrun")
myParams.salome_parameters.work_directory="/scratch/I35256/workingdir/test_srunjob/"
myParams.salome_parameters.local_directory = os.getcwd()
myParams.salome_parameters.local_directory = STUDY_DIR
myParams.salome_parameters.in_files = ["brique_ech.syd", "Makefile", "Mesh",
"run.sh", "syrthes.py", "user_cond.c"]
-#myParams.salome_parameters.resource_required.nb_node = 2
myScript = pydefix.PyScript()
myScript.loadFile(os.path.join(STUDY_DIR, "etude.py"))
Override default # of parallel evaluation :
myParams.nb_branches
- Override number of cores requested by the job when job resource is a cluster (for job scheduler query) :
- myParams.salome_parameters.resource_required.nb_proc
-
- Override number of computationnal nodes on cluster to be allocated when job resource is a cluster (for job scheduler query) :
- myParams.salome_parameters.resource_required.nb_node
-
Override working directory :
myParams.salome_parameters.work_directory