Re: [GM-help] libjpeg thread safe constraint is not must
Swiss army knife of image processing
Brought to you by:
bfriesen
From: yzh杨振宏 <zhyang@Ctrip.com> - 2017-08-02 11:50:22
|
>>it should be make more accessible (e.g. via a configure option or even somehow autodetected). Brilliant. I don't know GM has SETJMP_IS_THREAD_SAFE flag until I wrote an e-mail to GM-help and Glenn told me. To make full use of CPU, our solution is use multi-process structure, and process number is set to CPU core number. In our practice, this architecture is not friendly to Devops, and what's more, it put huge pressure on resources. For example, one hundred 8 core machines will establish at least 800 connections to database. This push us to look for multi-thread solution. Back to the point, when can this feature release? We will test it in the first time. -----邮件原件----- 发件人: Przemysław Sobala [mailto:prz...@gm...] 发送时间: 2017年8月2日 17:00 收件人: gra...@li... 主题: Re: [GM-help] libjpeg thread safe constraint is not must W dniu 01.08.2017 o 15:42, Bob Friesenhahn pisze: > On Tue, 1 Aug 2017, yzh杨振宏 wrote: > >> Since GM is running on centos 7 in our case, and man pages clearly >> document setjmp() and longjmp() are thread safety: >> >> │Interface │ Attribute │ Value │ >> ├────────────────────────┼───────────────┼─────────┤ >> │setjmp(), sigsetjmp() │ Thread safety │ MT-Safe │ >> ├────────────────────────┼───────────────┼─────────┤ >> │longjmp(), siglongjmp() │ Thread safety │ MT-Safe │ >> └────────────────────────┴───────────────┴─────────┘ >> http://man7.org/linux/man-pages/man3/setjmp.3.html >> >> Does this mean we can use multi-thread for JPEG images on centos 7? >> >> I also note that setjmp/longjmp are also used in PNG err handle, and >> GM let user confirm and define a SETJMP_IS_THREAD_SAFE flag to open >> multi-thread feature. If core of the problem is not libjpeg itself >> but thread safety of setjmp/longjpm as you said, could GM use the >> same flag for JPEG multi-thread? > > I just added support for SETJMP_IS_THREAD_SAFE in the JPEG coder in > Mercurial. Other formats which are declared unsafe are JPEG 2000 and > TIFF, but they are declared unsafe for other reasons. > > Bob > I've checked this flag with jpeg and png encoders and noticed a 3x speedup. Finally my CPU is being saturated when encoding as many files in parallel as I have cores. I think most API users will benefit from this change and it should be make more accessible (e.g. via a configure option or even somehow autodetected). -- Regards Przemysław Sobala ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Graphicsmagick-help mailing list Gra...@li... https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help |