This project has moved and is read-only. For the latest updates, please go here.

ResourceLimits.Thread

May 9, 2016 at 10:02 AM
Edited May 9, 2016 at 10:03 AM
Hi,

The property ResourceLimits.Thread seems to be gone on the last version. (7.0.1.101)
How can I limit the amount of CPU used by Magick.Net on this version ?
I was used to limit to half the available cores - 1, is this still possible to achieve ?

Thanks in advance,
May 9, 2016 at 5:11 PM
Edited May 9, 2016 at 7:05 PM
The ResourceLimits.Thread property has been removed because I now statically link the Visual Studio C++ redistributable. I cannot enable OpenMP anymore and you don't need that property when OpenMP is disabled. The limit will always be '1'.
May 9, 2016 at 8:54 PM
Thanks,
So now the only way to have some kind of multi threaded processing is to parallelize multiple operations ?
May 10, 2016 at 6:15 AM
That is correct. But make sure you do those operations on different images. Running multiple operations on the same image will result in unknown behavior.
Jul 26, 2016 at 12:24 PM
dlemstra wrote:
The ResourceLimits.Thread property has been removed because I now statically link the Visual Studio C++ redistributable. I cannot enable OpenMP anymore and you don't need that property when OpenMP is disabled. The limit will always be '1'.
So does that mean that in order to use multi threading I will need to recompile Magick.NET against ImageMagick.Core lib's recompiled with OpenMP (and then copy&paste some code from older version to get Thread Limit) and it will work? For now I simply downgraded my project to Magick.NET 6.x and it works on multiple cores.

(On unrelated note, why libs are on dropbox, not in solution? o_O)
Jul 29, 2016 at 9:36 AM
You can still use Magick.NET in a multithreaded environment. The only difference is that you won't be able to use OpenMP that allows mulithreaded operations on a single image. If you are using Magick.NET in a multithreaded environment (e.g. WebServer) I would advise you to not enable OpenMP because I don' think it would benefit you.

If you still want make the changes then you need to rebuild the .lib files with OpenMP enabled and make sure you install the correct version of the C++ redistributable. And then you need to add the old code that allowed you to set the thread limit.

p.s. The libs are on DropBox because they change a lot and it would make the git repository big because they are binaries.