Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenMP support #29

Open
BenMorel opened this issue Feb 5, 2016 · 4 comments
Open

OpenMP support #29

BenMorel opened this issue Feb 5, 2016 · 4 comments

Comments

@BenMorel
Copy link
Contributor

BenMorel commented Feb 5, 2016

Hi,

I've noticed that all my Gmagick code runs on a single CPU core, which is a pity on servers with 8 cores or more, given that GraphicsMagick supports OpenMP.

Is there a reason for this? Imagick leaves the choice to enable OpenMP, can we do the same for Gmagick?

@Danack
Copy link
Contributor

Danack commented Feb 16, 2016

Gmagick does not do any processing itself - it passes all image processing to GraphicsMagick

If you have compiled GraphicsMagick with OpenMP enabled, probably with the --enable-openmp flag set, and with a suitable version of OpenMP installed, it should 'just work'.

However.....you really ought to test it. I am not convinced OpenMP is stable either with ImageMagick or GraphicsMagick. At least for me I was seeing weird shutdown errors in PHP when OpenMP was enabled.

@BenMorel
Copy link
Contributor Author

As mentioned in greater details in my question on StackOverflow, I did compile GraphicsMagick with OpenMP (configure --enable-openmp --enable-shared, make, make install, and then Gmagick against it (phpize, configure, make), but Gmagick was still using a single core, as far as I could see!

@Danack
Copy link
Contributor

Danack commented Feb 17, 2016

To be clear, Gmagick doesn't really touch the threads. If you've compiled with OpenMP enabled for GraphicsMagick, then it should 'just work' for Gmagick.

There is a function to set the resource limit, what happens when you call it?

$gmagick->setResourceLimit(\Gmagick::RESOURCETYPE_THREADS, 4);

not saying it will work - it should be working by default.

Actually, the result of getResultLimit would be interesting as well.

@BenMorel
Copy link
Contributor Author

Hi, sorry I'm a bit (18 months) late. Coming back to this. I tried:

$gmagick->getResourceLimit(Gmagick::RESOURCETYPE_THREADS);

But I get an error:

Undefined class constant 'RESOURCETYPE_THREADS'

Could this be why OpenMP is not used in Gmagick?

Looking at the source code, this constant is available when ThreadsResource is defined. How does it get defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants