TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.85k stars 1.84k forks source link

how to limit the number of cores used ? #760

Open Lhemamou opened 5 years ago

Lhemamou commented 5 years ago

Hi Tadas,

First I would congratulate you for this toolbox really useful for all the affective computing community !

Secondly, I am trying to run simultaneously multiple instances of OpenFace. However, I can't limit the number of cores used by one instance and it's just using all the resources of the distant server which is not fair for other researchers ;)

Do you have any cue to limit it ?

PS : Before I was just giving a list of files for one instance of OpenFace but when a file was corrupted , the whole process was finishing without process the following files returning segmentation fault. That's why I decided to move to multiples instances :)

Thanks in advance for any advice you could provide !

Léo

TadasBaltrusaitis commented 5 years ago

Hi Léo,

Glad you're finding OpenFace to be useful.

There is no explicit limit on cores or parallelism. OpenFace uses OpenCVs parallelism, you can try the following line of code: https://docs.opencv.org/2.4/modules/core/doc/utility_and_system_functions_and_macros.html#void%20setNumThreads(int%20nthreads)

Just add it to the .cpp file you are using as the main entry to the code.

Good suggestion about skipping corrupt files instead of crashing the application, I will add it to next release of OpenFace.

Thanks, Tadas