You limit number of used threads by environment variable. E.g. set before
running demo program this:

set OMP_NUM_THREADS=1

or use omp_set_num_threads[1] function within your program.

[1]
https://gcc.gnu.org/onlinedocs/libgomp/omp_005fset_005fnum_005fthreads.html



Zdenko


st 18. 12. 2024 o 9:50 Xingtong Chen <[email protected]> napísal(a):

> Apologize for my unclear expression. There are 2 tesseracts on my machine:
>
> 1. One is built from the github release (5.5.0). I use the
>  --disable-openmp  flag to conigure and I get a build without multithread.
>
> 2. I install libtesseract5 (5.3.0-2 amd64) from debian apt and the api
> head file is in my /usr/include folder. I compile a demo using g++ with
> version  “gcc version 12.2.0 (Debian 12.2.0-14)”.When I run the executable
> file, the process use 4 threads on my machine.
>
> I find it by checking htop command results.
>
> I just tried using OpenMP to perform multithreaded recognition operations
> with tesseract::TessBaseAPI* (using libtesseract5), but it seems the
> multithreading effect has disappeared.  That's weird to me.
>
> Thank you for your patience ;)
>
> 在2024年12月17日星期二 UTC-8 22:43:21<zdenop> 写道:
>
>> So you build the tesseract library without openmp, but when you use it
>> (by calling api) multithreading is there?
>> Do I understand you correctly? How did you find it out?
>>
>> Zdenko
>>
>>
>> st 18. 12. 2024 o 6:43 Xingtong Chen <[email protected]> napísal(a):
>>
>>> In tesseract document, I found that if I need to disable multithread, I
>>> need the configure option
>>>
>>> ../../configure --disable-openmp
>>>
>>> This works well on my machine.
>>>
>>> But I still cannot figure out how to disable multithread tesseract when
>>> using teseract api.
>>>
>>> I have tried -DOPENMP_SIMD_FALSE, but this didn't work. Is there any
>>> compile flag to disable openmp?
>>>
>>> I use g++ compiler with version "gcc version 12.2.0 (Debian 12.2.0-14)".
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "tesseract-ocr" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion visit
>>> https://groups.google.com/d/msgid/tesseract-ocr/554ec663-9411-4844-8fbf-8939c84fe594n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tesseract-ocr/554ec663-9411-4844-8fbf-8939c84fe594n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "tesseract-ocr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/tesseract-ocr/acc5239c-cd91-4110-9825-479467105598n%40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/acc5239c-cd91-4110-9825-479467105598n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8y%3DU0Lt-0kcaNkVj%3D4vak%2B5n7BPd0-HJcBht10MqN2xuw%40mail.gmail.com.

Reply via email to