Is otbcli_TrainVectorClassifier supporting multi-core processing?

Hi ,

Thank you for reading my post.

I am new to OTB and using it with my Master’s Thesis. It is really handy and good to use in processing remote sensing data. Thanks for the team of OTB and all people who have contribute to it.

Recently, I use the command otbcli_TrainVectorClassifier with the model of Shark Random Forest to training a RF model for classification. The training data is a 15GB sqlite file. The command is as following:

otbcli_TrainVectorClassifier -io.vd input.sqlite -io.out output_model.txt -feat band_field -cfield lc_id -classifier sharkrf -classifier.sharkrf.nbtrees 100 -classifier.sharkrf.nodesize 1 -classifier.sharkrf.mtry 0 -classifier.shark rf.oobr 1 -progress 1

When I launched the command, I found an issue is that it seems the training process only uses one core of my computer.

The environment of my computer is :

So, my question is: Is it possible to make use of all 12 cores of my computer when training with otbcli_TrainVectorClassifier?

Also, Jordi (Thank you for your reply, Jordi ) pointed out that it may be because the OMP is not enabled. I am not sure what OMP is. And the OTB was not installed by me, so I am not sure it is installed from packages or built by themselves.

Could someone help me out?

Steve Zehui

Hi Steve,
yes we can help you :slight_smile:
First thing first the answer: yes it is possible.
There are few things that you can do:

  • you re install OTB with superbuild (or not) but with OpenMP enabled (it is the library that will allow you to use your 12 cores)
  • download 6.6.1 binary packages

Depending on what you choose we can help you on the different steps to follow.
Do you have admin right on your computer?

Hi Antoine,

Thank you for your reply.

Unfortunately, I don’t have the admin right.

Someone told me that I can set the “ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS” to 12 if I would like to make use of 12 cores.

Is it possible?


You can try but I am not sure of the result without OpenMP activated.
If you do not have the admin right you can download the source and build the Superbuild with OpenMP activated. It should work smoothly.

Thanks Antoine. I will give a try with OpenMP. You are very helpful!


Hello Antoine
I have the same problem, but I have zero knowledge about the programming language to use the command line and I only use the graphic version of mapla in Windows. Please help solve this problem for Windows and graphic versions as well.
Thank you in advance