omp_set_num_threads(1) in demo main function doesn't seem to work, but I think using omp to multithread running tesseract works.
Thanks. ;) 在2024年12月18日星期三 UTC-8 02:19:55<zdenop> 写道: > 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 <chenxt...@gmail.com> 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 <chenxt...@gmail.com> 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 tesseract-oc...@googlegroups.com. >>>> 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 tesseract-oc...@googlegroups.com. >> > 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 tesseract-ocr+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/tesseract-ocr/7dd6de55-3b41-4515-9f75-c22067868757n%40googlegroups.com.