KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVXtermBatch.cpp
1#include "KVDataSetAnalyser.h"
2#include "KVXtermBatch.h"
3#include <cassert>
4
5
9
11{
12 //Processes the job requests for the batch system.
13 //In multijobs mode, this submits one job for each run in the runlist associated to fAnalyser
14
15 if (!CheckJobParameters()) return;
16
17 //submit jobs for every GetRunsPerJob() runs in runlist
18 KVDataSetAnalyser* ana = dynamic_cast<KVDataSetAnalyser*>(fAnalyser);
19 assert(ana);
20 KVNumberList runs = ana->GetRunList();
21 Int_t remaining_runs = runs.GetNValues();
22
23 // to optimize use of CPUs, some jobs will have multiple runs
24 std::vector<int> runs_per_job(max_num_cpus);
25 int job_index = 0;
26 runs.Begin();
27 while (!runs.End()) {
28 runs.Next();
29 ++runs_per_job[job_index++];
30 if (job_index == max_num_cpus) job_index = 0;
31 }
32
34 runs.Begin();
35 job_index = 0;
36 while (remaining_runs && !runs.End()) {
37 Int_t run = runs.Next();
38 remaining_runs--;
40 if ((fCurrJobRunList.GetNValues() == runs_per_job[job_index]) || runs.End()) {
41 // submit job for run
43 ana->SetFullRunList(runs);
44 std::cout << "Submitting job " << job_index + 1 << " for runs:" << fCurrJobRunList.AsString() << std::endl;
45 SubmitJob();
47 ++job_index;
48 }
49 }
50 ana->SetRuns(runs, kFALSE);
51}
52
53
55
56
57
58
62
63void KVXtermBatch::GetBatchSystemParameterList(KVNameValueList& nl)
64{
65 // Add to batch parameters the number of CPUs to use
66 //
67 // By default, it is the number of CPUs on the machine
68
70 nl.SetValue("MaxNumCPUs", max_num_cpus);
71}
72
73
74
79
81{
82 // Add to batch parameters the number of CPUs to use
83 //
84 // By default, it is the number of CPUs on the machine
85
87 max_num_cpus = nl.GetIntValue("MaxNumCPUs");
88}
89
90
91
92
int Int_t
constexpr Bool_t kFALSE
virtual void SubmitJob()
virtual void SetBatchSystemParameters(const KVNameValueList &)
Use the parameters in the list to set all relevant parameters for batch system.
KVDataAnalyser * fAnalyser
the analyser object which requests job submission, it has all details on the job
virtual void GetBatchSystemParameterList(KVNameValueList &)
KVNumberList fCurrJobRunList
runlist for (multi job mode) job being submitted
virtual Bool_t CheckJobParameters()
Checks the job and ask for the job name if needed.
Pilots user analysis of experimental data.
void SetFullRunList(const KVNumberList &nl)
const KVNumberList & GetRunList() const
void SetRuns(const KVNumberList &nl, Bool_t check=kTRUE)
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Int_t GetIntValue(const Char_t *name) const
Strings used to represent a set of ranges of values.
const Char_t * AsString(Int_t maxchars=0) const
Bool_t End(void) const
Int_t GetNValues() const
void Begin(void) const
void Add(Int_t)
Add value 'n' to the list.
void Clear(Option_t *="")
Empty number list, reset it to initial state.
Int_t Next(void) const
Run analysis in multiple xterm windows.
void SetBatchSystemParameters(const KVNameValueList &nl)
ClassImp(TPyArg)