Guetzli cuda support
Moderators: XnTriq, helmut, xnview
-
- Posts: 53
- Joined: Sat May 12, 2018 7:38 am
Guetzli cuda support
Hello,
the "save as guetzli jpg" option is extremely slow on almost each computer. 20 Mpix files need about 20 minutes. This is anything but practical in everyday use.
There is a cuda version of guetzli available with is way faster (25-40x acording to the developers) than the original one:
https://github.com/doterax/guetzli-cuda-opencl
However, even this exe file needs the --cuda parameter in order to use cuda. I would recommend to introduce CUDA support.
Maybe introducing a dropdown menu in the settings where the user can choose between these switches would make sense:
standard guetzli settings (no parameter)
optimized settings (--c as parameter); about 2x faster
OpenCL (--opencl as parameter); about 10x faster
CUDA (--cuda as parameter); about 20x faster
This would be GREAT!!
Jens
the "save as guetzli jpg" option is extremely slow on almost each computer. 20 Mpix files need about 20 minutes. This is anything but practical in everyday use.
There is a cuda version of guetzli available with is way faster (25-40x acording to the developers) than the original one:
https://github.com/doterax/guetzli-cuda-opencl
However, even this exe file needs the --cuda parameter in order to use cuda. I would recommend to introduce CUDA support.
Maybe introducing a dropdown menu in the settings where the user can choose between these switches would make sense:
standard guetzli settings (no parameter)
optimized settings (--c as parameter); about 2x faster
OpenCL (--opencl as parameter); about 10x faster
CUDA (--cuda as parameter); about 20x faster
This would be GREAT!!
Jens
Olympus OMD E-M1, BS Kinetics underwater housing, 2xSubtronic pro 160 flashes. Zuiko mFT lenses: 60 macro, 7-14, 8 mm fisheye, 12-100, PanaLeica 100-400.
My Homepage | My book at Amazon
My Homepage | My book at Amazon
-
- XnThusiast
- Posts: 1676
- Joined: Wed Aug 16, 2006 6:31 am
Re: Guetzli cuda support
Interesting! It seems that it has autodetection so it can switch automatically to the best engine available (if it was compiled correctly).
Do you have practical experience with Guetzli? Which is the compression ratio compared with „normal” JPEG?
Do you have practical experience with Guetzli? Which is the compression ratio compared with „normal” JPEG?
m. Th.
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
-
- Posts: 53
- Joined: Sat May 12, 2018 7:38 am
Re: Guetzli cuda support
Just started to play around with guetzli a few days ago. The jpg files created by guetzli are quite small.
The normal version is by far too slow, see my previous post.
Currently, I use CUDA-guetzli the following way for batch-conversion of 1 or more than 1 files:
1) Download the cuda-version of guetzli and put it in an extra folder, name the exe file guetzli.exe
2) Creat a batch file, for example guetzli.bat, with the following content:
for %%i in (*.jpg) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
Now copy all jpg files you want to compress into this folder and execute the batch file. Keep in mind: These jpg files will be overwritten by the compressed ones.
The "normal" usage (one file only) of the cuda version of guetzli would be
guetzli.exe --cuda input.jpg output.jpg
Where input.jpg is the name of the file you want to compress and output.jpg is the output file. Feel free to change the --quality 85 setting to anything between 84 and 100. This will only convert the ONE file named input.jpg.
Guetzli also works with TIF files (tif -> jpg) and with png files (png->jpg), so if you want a quite flexible batch file for converting jpg, tif and png files, just add 2 more lines to the first bat file which should look like this (the line for jpg to jpg conversion should be the first one, otherwise the already compressed jpg files (from tif->jpg and png->jpg) will be compresses a second time :
for %%i in (*.jpg) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
for %%i in (*.tif) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
for %%i in (*.png) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
With htis extended batch file, all file names you start with HAVE TO BE DIFFERENT! Dont start with myfile.tif and myfile.jpg, since both will be compressed to myfile.jpg. (the second result overwrites the first one in this case).
Have fun.
Jens
The normal version is by far too slow, see my previous post.
Currently, I use CUDA-guetzli the following way for batch-conversion of 1 or more than 1 files:
1) Download the cuda-version of guetzli and put it in an extra folder, name the exe file guetzli.exe
2) Creat a batch file, for example guetzli.bat, with the following content:
for %%i in (*.jpg) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
Now copy all jpg files you want to compress into this folder and execute the batch file. Keep in mind: These jpg files will be overwritten by the compressed ones.
The "normal" usage (one file only) of the cuda version of guetzli would be
guetzli.exe --cuda input.jpg output.jpg
Where input.jpg is the name of the file you want to compress and output.jpg is the output file. Feel free to change the --quality 85 setting to anything between 84 and 100. This will only convert the ONE file named input.jpg.
Guetzli also works with TIF files (tif -> jpg) and with png files (png->jpg), so if you want a quite flexible batch file for converting jpg, tif and png files, just add 2 more lines to the first bat file which should look like this (the line for jpg to jpg conversion should be the first one, otherwise the already compressed jpg files (from tif->jpg and png->jpg) will be compresses a second time :
for %%i in (*.jpg) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
for %%i in (*.tif) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
for %%i in (*.png) do guetzli.exe --verbose --cuda --quality 85 "%%i" "%%~ni.jpg
With htis extended batch file, all file names you start with HAVE TO BE DIFFERENT! Dont start with myfile.tif and myfile.jpg, since both will be compressed to myfile.jpg. (the second result overwrites the first one in this case).
Have fun.
Jens
Olympus OMD E-M1, BS Kinetics underwater housing, 2xSubtronic pro 160 flashes. Zuiko mFT lenses: 60 macro, 7-14, 8 mm fisheye, 12-100, PanaLeica 100-400.
My Homepage | My book at Amazon
My Homepage | My book at Amazon
-
- Posts: 53
- Joined: Sat May 12, 2018 7:38 am
Re: Guetzli cuda support
Some more info, also for the development team from XNView MP:
I just contacted one of the developers with the question how to introduce the CUDA-guetzli into XNView as a plugin instead of the normal (slow) guetzli. The issue is that CUDA-guetzli needs the extra command "--cuda" in order to activate the cuda function of the exe file. This means you cannot just take the cuda version of the exe file, name it "guetzli_windows_x86-64.exe" and overwrite the normal guetzli version in the plugin folder of XNView. He provided 2 ideas:
1) do it via a batch file
Maybe I was not able to follow the process, however, it did not work for me
2) Compile a exe which uses the CUDA function without needing the "--cuda" parameter.
Although the author gave the detailed description (just a minor change in the program code), I am not aware how to self-compile the exe since this seems to be a quite complex procedure.
Maybe there is someone out there who is willing to help?
Jens
I just contacted one of the developers with the question how to introduce the CUDA-guetzli into XNView as a plugin instead of the normal (slow) guetzli. The issue is that CUDA-guetzli needs the extra command "--cuda" in order to activate the cuda function of the exe file. This means you cannot just take the cuda version of the exe file, name it "guetzli_windows_x86-64.exe" and overwrite the normal guetzli version in the plugin folder of XNView. He provided 2 ideas:
1) do it via a batch file
Maybe I was not able to follow the process, however, it did not work for me
2) Compile a exe which uses the CUDA function without needing the "--cuda" parameter.
Although the author gave the detailed description (just a minor change in the program code), I am not aware how to self-compile the exe since this seems to be a quite complex procedure.
Maybe there is someone out there who is willing to help?
Jens
Olympus OMD E-M1, BS Kinetics underwater housing, 2xSubtronic pro 160 flashes. Zuiko mFT lenses: 60 macro, 7-14, 8 mm fisheye, 12-100, PanaLeica 100-400.
My Homepage | My book at Amazon
My Homepage | My book at Amazon
-
- XnThusiast
- Posts: 1676
- Joined: Wed Aug 16, 2006 6:31 am
Re: Guetzli cuda support
Got it. AFAIS it has a switch to autodetect the best acceleration (--c).
Is it true?
Note: The solution should work also for ATI/AMD VGA cards which support only OpenCL.
Is it true?
Note: The solution should work also for ATI/AMD VGA cards which support only OpenCL.
m. Th.
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
-
- Posts: 53
- Joined: Sat May 12, 2018 7:38 am
Re: Guetzli cuda support
--c ist just the „optimised“ procedure which speeds up about 2x. Check the table here:
https://github.com/doterax/guetzli-cuda-opencl
I think --auto is the switch for autodetection. This does not help for the use in XNview, since it is not possible to use any switch.
https://github.com/doterax/guetzli-cuda-opencl
I think --auto is the switch for autodetection. This does not help for the use in XNview, since it is not possible to use any switch.
Olympus OMD E-M1, BS Kinetics underwater housing, 2xSubtronic pro 160 flashes. Zuiko mFT lenses: 60 macro, 7-14, 8 mm fisheye, 12-100, PanaLeica 100-400.
My Homepage | My book at Amazon
My Homepage | My book at Amazon
-
- Posts: 2
- Joined: Fri Nov 24, 2023 6:19 am
Re: Guetzli cuda support
clguetzli support these special mode
--c do not use any hardware accelerated but CPU
--opencl use opencl compute platform
--cuda use cuda compute platform
if don't give any mode to it, there will be no optimize(as same as guetzli)
-
- Posts: 2
- Joined: Fri Nov 24, 2023 6:19 am
Re: Guetzli cuda support
no --auto mode in clguetzliTschens wrote: ↑Thu Nov 23, 2023 5:40 pm --c ist just the „optimised“ procedure which speeds up about 2x. Check the table here:
https://github.com/doterax/guetzli-cuda-opencl
I think --auto is the switch for autodetection. This does not help for the use in XNview, since it is not possible to use any switch.
-
- XnThusiast
- Posts: 1676
- Joined: Wed Aug 16, 2006 6:31 am
Re: Guetzli cuda support
A, ok. It is easy then. The autodetection code exists, and this is important.strongtu wrote: ↑Fri Nov 24, 2023 6:29 amno --auto mode in clguetzliTschens wrote: ↑Thu Nov 23, 2023 5:40 pm --c ist just the „optimised“ procedure which speeds up about 2x. Check the table here:
https://github.com/doterax/guetzli-cuda-opencl
I think --auto is the switch for autodetection. This does not help for the use in XNview, since it is not possible to use any switch.
m. Th.
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
-
- Posts: 53
- Joined: Sat May 12, 2018 7:38 am
Re: Guetzli cuda support
In fact, ther IS --auto mode in cl_guetzli, I just checked it and it works, see here:m.Th. wrote: ↑Fri Nov 24, 2023 8:30 amA, ok. It is easy then. The autodetection code exists, and this is important.strongtu wrote: ↑Fri Nov 24, 2023 6:29 amno --auto mode in clguetzliTschens wrote: ↑Thu Nov 23, 2023 5:40 pm --c ist just the „optimised“ procedure which speeds up about 2x. Check the table here:
https://github.com/doterax/guetzli-cuda-opencl
I think --auto is the switch for autodetection. This does not help for the use in XNview, since it is not possible to use any switch.
https://github.com/doterax/guetzli-cuda-opencl/releases
Olympus OMD E-M1, BS Kinetics underwater housing, 2xSubtronic pro 160 flashes. Zuiko mFT lenses: 60 macro, 7-14, 8 mm fisheye, 12-100, PanaLeica 100-400.
My Homepage | My book at Amazon
My Homepage | My book at Amazon
-
- Posts: 53
- Joined: Sat May 12, 2018 7:38 am
Re: Guetzli cuda support
The solution would be (citation from author):
if you can clone&rebuild the source, you can change the default parameter of g_mathMode which is in the file clguetzli.cpp, change it to MODE_CUDA and rebuild it. (End of citation).
Unfortunately, I did not manage to compile it after 2 days of hard work. Lots of errors during the compiling process. Hoping for help now.
if you can clone&rebuild the source, you can change the default parameter of g_mathMode which is in the file clguetzli.cpp, change it to MODE_CUDA and rebuild it. (End of citation).
Unfortunately, I did not manage to compile it after 2 days of hard work. Lots of errors during the compiling process. Hoping for help now.
You do not have the required permissions to view the files attached to this post.
Olympus OMD E-M1, BS Kinetics underwater housing, 2xSubtronic pro 160 flashes. Zuiko mFT lenses: 60 macro, 7-14, 8 mm fisheye, 12-100, PanaLeica 100-400.
My Homepage | My book at Amazon
My Homepage | My book at Amazon
-
- Posts: 53
- Joined: Sat May 12, 2018 7:38 am
Re: Guetzli cuda support
Finally, I did it. I got a working „auto“ as well as a „CUDA“ exe which is dependent from 5 dll files (don’t know why visual studio does not merge, I have chosen static exe). However, it does not work with XNview since I get an error message. Obviously, XNview sends some additional parameters to the guetzli exe which might not work with this forked version.
I think the „auto“ version could be very interesting as a plugin instead of the normal, slow guetzli exe. I hope the dev team is reading here.
I think the „auto“ version could be very interesting as a plugin instead of the normal, slow guetzli exe. I hope the dev team is reading here.
Olympus OMD E-M1, BS Kinetics underwater housing, 2xSubtronic pro 160 flashes. Zuiko mFT lenses: 60 macro, 7-14, 8 mm fisheye, 12-100, PanaLeica 100-400.
My Homepage | My book at Amazon
My Homepage | My book at Amazon
-
- Posts: 6
- Joined: Sat Nov 25, 2023 1:01 pm
Re: Guetzli cuda support
I have built guetzli with autodetection of best mode from the start.
You can download it from here https://github.com/doterax/guetzli-cuda ... /issues/11
If you experience some problems with it, you can write it in this issue.
Enjoy.
You can download it from here https://github.com/doterax/guetzli-cuda ... /issues/11
If you experience some problems with it, you can write it in this issue.
Enjoy.
-
- XnThusiast
- Posts: 1676
- Joined: Wed Aug 16, 2006 6:31 am
Re: Guetzli cuda support
Yes, „the dev team” is reading.Tschens wrote: ↑Sat Nov 25, 2023 9:13 am Finally, I did it. I got a working „auto“ as well as a „CUDA“ exe which is dependent from 5 dll files (don’t know why visual studio does not merge, I have chosen static exe). However, it does not work with XNview since I get an error message. Obviously, XNview sends some additional parameters to the guetzli exe which might not work with this forked version.
I think the „auto“ version could be very interesting as a plugin instead of the normal, slow guetzli exe. I hope the dev team is reading here.
m. Th.
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
-
- XnThusiast
- Posts: 1676
- Joined: Wed Aug 16, 2006 6:31 am
Re: Guetzli cuda support
Thanks a lot!doterax wrote: ↑Sat Nov 25, 2023 1:04 pm I have built guetzli with autodetection of best mode from the start.
You can download it from here https://github.com/doterax/guetzli-cuda ... /issues/11
If you experience some problems with it, you can write it in this issue.
Enjoy.
First problem:
I cannot download it because the latest Windows 11 with the latest MS Edge and latest MS Defender Antivirus finds a virus!
See below:
This is it: https://www.microsoft.com/en-us/wdsi/th ... ik.FL.B!ml
You do not have the required permissions to view the files attached to this post.
m. Th.
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -