• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using OpenMP for Threading on Xcode 6.3 and Visual Studio 2013 Using Intel Compiler

Participant ,
Dec 10, 2015 Dec 10, 2015

Copy link to clipboard

Copied

Hello,

Has anyone managed to create a Plug In with OpenMP for Photoshop?

While we managed to do so on Windows, the thing doesn't work on OS X and we wondered if there are any one experienced with that here to assist.

Better yet if anyone managed doing so using Intel C++ Compiler.

Thank You.

TOPICS
SDK

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Explorer ,
Dec 16, 2015 Dec 16, 2015

Copy link to clipboard

Copied

Yes, I use OpenMP in my plugins. Works very well on both Windows and Mac platforms. ICC also works pretty nice.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 18, 2015 Dec 18, 2015

Copy link to clipboard

Copied

Hi,

Are you using Photoshop's OpenMP or deliver your own OpenMP Library?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 18, 2015 Dec 18, 2015

Copy link to clipboard

Copied

For Photoshop's prior to CC (CS5, CS6 for example) I place "libomp5md.dll" into Photoshop directory. For Photoshop's higher than CC I use "libomp5md.dll" that delivered with Photoshop.

Also I tried to compile "libomp" from scratch, but nothing changes in speed or other behavior.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 18, 2015 Dec 18, 2015

Copy link to clipboard

Copied

Do you do it in OS X as well?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 18, 2015 Dec 18, 2015

Copy link to clipboard

Copied

In case Mac OS X  I do nothing extra with OpenMP. It is itself works somehow. 😃

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 28, 2016 Oct 28, 2016

Copy link to clipboard

Copied

TRANTOR​, I have the strange case where I run 2 different plug in's of us which uses OpenMP (Static, Intel OpenMP) Photoshop crashes (On OS X only).
Have you ever encountered that?

Looking at the crash report it seems like though the first Plug In finished its task (Successfully) there are still threads under its name.

Any idea?

Thank You.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 28, 2016 Oct 28, 2016

Copy link to clipboard

Copied

Well, after some similar issues with OpenMP + Intel 2017 (not all loops serializes, strange crashes and so on) I completely moved into Thread Building Blocks. It looks like more comfortable solution for me.

You can download source and compile static libraries for Windows for example. In case of OS X you can use already compiled dylibs directly with static switch in Xcode.

Download | Threading Building Blocks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 29, 2016 Oct 29, 2016

Copy link to clipboard

Copied

I see...

Yet I would like to know how to use OpenMP properly in a Photoshop Plug In.

Because TBB means writing some part of the code again.

Tom Ruark​, ChrisCox​, Could you shed a light on using OpenMP in a plug in?

In my case it seems the threads aren't "Closing" after the Plug In finished.

Thank You.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Nov 01, 2016 Nov 01, 2016

Copy link to clipboard

Copied

I'm no threading expert so I asked our architect!

Unfortunately we don’t have a great story for how to do threading in third party plugins.  The best answers I have (in order) are:

  1. Use the platform tasking APIs (there are various people who’ve written little cross-platform shims around subsets of the platform threading) — GCD on Mac and the Windows Thread Pool on Windows.
  2. Create raw OS threads using the native OS calls and either use those directly or put a simple tasking system on top of it (this is what Mondo does). In this model the plug-in creates a thread pool when the plug-in starts up and/or creates threads as needed, and tears them all down when it exits.
  3. Use C++11 standard thread primitives. Safe on both Mac and Win, even for versions of Photoshop before we switched to the C++11 library. Drawback — their actual task creation behavior and performance are unpredictable and potentially suckful because “async” creates an OS thread per invocation on some platforms.
  4. Use tbb. Note, however, that this ties you to specific versions of Photohsop. Because tbb is built as headers plus a DLL, the plug-in has its own copy of the headers and it’s using the tbb DLL that Photoshop ships. If the version of the headers that the plugin is built with aren’t compatible with the version of the DLL shipped with a particular version of Photoshop… bad things happen. There’s no good way to check AFAIK, and any update to Photoshop may bring an update to the TBB DLL. The good news is that Photoshop updates don’t *usually* break compatibility. But they might, meaning that a Photoshop update may require the third party to ship a new version of their plugin.
  5. The behavior of all other thread/task packages (including OpenMP) invoked from plug-ins is unknown. Most of them have at least as bad an issue as TBB as described above, because thread / task packages all rely on a shared library to manage thread local storage and a single thread pool that’s shared across everything in a particular process. If the plug-in is shipping its own copy of a DLL that doesn’t come with Photoshop, it risks colliding with some other third party plug-in’s incompatible copy of that same DLL.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 08, 2016 Nov 08, 2016

Copy link to clipboard

Copied

LATEST

Hi Tom,

Great information.

I would add that in OS X it is better to lik for Dynamic Linked version of OpenMP and use Photoshop's 'libiomp5.dylab'.

In Windows things are much better (Works even in static linking) yet still just work against Photoshop's `libiomp5.dll`.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines