# Does TMVA support multi-core or cluster mode?

**URL:** <https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155>\
**Category:** TMVA\
**Created:** [September 8, 2017, 11:56am UTC](https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155 "2017-09-08T11:56:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![QinGang](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/c89c15/32.png) [@QinGang](https://root-forum.cern.ch/u/QinGang)\
**Post date:** [September 8, 2017, 11:56am UTC](https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155/1 "2017-09-08T11:56:08Z")

</div>

Dear Expert:

Running TMVA DNN costs too long time, just wondering if TMVA supports multi-core or cluster mode?

Cheers, Gang

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [September 8, 2017, 2:31pm UTC](https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155/2 "2017-09-08T14:31:23Z")

</div>

Hi,

There is a multi-threaded implementation of the DNN available using the configuration option `"Architechture=CPU"`. If you have a GPU available you can also run the DNN using it. This should be the fastest option (use `"Architecture=GPU"`).

Running the DNN on a cluster is unfortunately not possible currently.

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![QinGang](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/c89c15/32.png) [@QinGang](https://root-forum.cern.ch/u/QinGang)\
**Post date:** [September 9, 2017, 10:08am UTC](https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155/3 "2017-09-09T10:08:19Z")

</div>

Hi, Kim:

I am using DNN\_CPU which has “Multithreading=True” as default for each layer, but when I run the training, top shows that it’s still 1 core being used, although the “%CPU” could reach 130%. So TMVA runs multi-threads on only 1 core?

Cheers, Gang

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [September 9, 2017, 12:23pm UTC](https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155/4 "2017-09-09T12:23:56Z")

</div>

Using multithreading should utilise all available cores for the computationally expensive operations.

What is your configuration? If your network/input data is too small the serial part of the calculation will dominate. You can try increasing the batch size and see if you see an improvement 🙂

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![QinGang](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/c89c15/32.png) [@QinGang](https://root-forum.cern.ch/u/QinGang)\
**Post date:** [September 11, 2017, 1:31am UTC](https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155/5 "2017-09-11T01:31:29Z")

</div>

It still use only 200% of a single core while there are 8 cores on that machine, here is the configuration:

Use[“DNN\_CPU”] = 1; // Multi-core accelerated DNN.  
dataloader-\>AddVariable( “var1 := L\_RRC\_ConnReq\_Att - L\_RRC\_ConnReq\_Succ”, ‘F’ );  
dataloader-\>AddVariable( “var2 := L\_RRC\_ConnReq\_Att + L\_RRC\_ConnReq\_Succ”, ‘F’ );  
dataloader-\>AddVariable( “var3 := L\_RRC\_ConnReq\_Att \* L\_RRC\_ConnReq\_Succ”, ‘F’ );  
dataloader-\>AddVariable( “var4 := L\_RRC\_ConnReq\_Att / L\_RRC\_ConnReq\_Succ”, ‘F’ );

dataloader-\>PrepareTrainingAndTestTree( mycuts, mycutb,  
“nTrain\_Signal=10000:nTrain\_Background=10000:SplitMode=Random:NormMode=NumEvents:!V” );

if (Use[“DNN\_CPU”] or Use[“DNN\_GPU”]) {  
// General layout.  
TString layoutString (“Layout=TANH|128,TANH|128,TANH|128,LINEAR”);  
//TString layoutString (“Layout=TANH|128,TANH|128,TANH|128,LINEAR”);

```
  // Training strategies.
  TString training0("LearningRate=1e-1,Momentum=0.9,Repetitions=1,"
                    "ConvergenceSteps=20,BatchSize=2560,TestRepetitions=10,"
                    "WeightDecay=1e-4,Regularization=L2,"
                    "DropConfig=0.0+0.5+0.5+0.5, Multithreading=True");
  TString training1("LearningRate=1e-2,Momentum=0.9,Repetitions=1,"
                    "ConvergenceSteps=20,BatchSize=2560,TestRepetitions=10,"
                    "WeightDecay=1e-4,Regularization=L2,"
                    "DropConfig=0.0+0.0+0.0+0.0, Multithreading=True");
  TString training2("LearningRate=1e-3,Momentum=0.0,Repetitions=1,"
                    "ConvergenceSteps=20,BatchSize=2560,TestRepetitions=10,"
                    "WeightDecay=1e-4,Regularization=L2,"
                    "DropConfig=0.0+0.0+0.0+0.0, Multithreading=True");
  TString trainingStrategyString ("TrainingStrategy=");
  trainingStrategyString += training0 + "|" + training1 + "|" + training2;

```

Any idea?

Cheers, Gang

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [September 14, 2017, 9:05am UTC](https://root-forum.cern.ch/t/does-tmva-support-multi-core-or-cluster-mode/26155/6 "2017-09-14T09:05:59Z")

</div>

Sorry I haven’t been able to get back to you yet. Will do asap.

Cheers,  
Kim
