-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcvmpi.C
37 lines (28 loc) · 1.04 KB
/
cvmpi.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <TMVA/ParallelExecutorMpi.h>
#include <TMVA/DataLoader.h>
#include <TMVA/Tools.h>
#include <TMVA/CrossValidation.h>
#include <TMessage.h>
void cvmpi()
{
TMVA::DataLoader *dataloader=nullptr;
TMVA::ParallelExecutorMpi executor;
//setting up the dataloader in the main process
if(executor.IsMainProcess()){
TFile file("dataset.root");
dataloader=(TMVA::DataLoader *)file.Get("dataset");
file.Close();
}else dataloader=new TMVA::DataLoader("dataset");
//if it is the main process dataloader will be send else dataloader will be reciev
executor.SharedDataLoader(dataloader);
TMVA::CrossValidation *cv=new TMVA::CrossValidation(dataloader);
cv->BookMethod(TMVA::Types::kBDT, "BDT",
"!H:!V:NTrees=850:MinNodeSize=2.5%:MaxDepth=3:BoostType=AdaBoost:nCuts=20");
cv->SetNumFolds(8);
auto results=executor.Execute(cv);
if(executor.IsMainProcess()){
TMVA::MsgLogger::EnableOutput();
TMVA::gConfig().SetSilent(kFALSE);
results.Print();
}
}