OpenMP, studio.h, direct.h
Posted: 2017-09-02T04:02:44-07:00
Tested with IM 6.9.3-7 on Windows 8.1, with Cygwin.
To get parallel processing with OpenMP in programs that use ImageMagick, the program needs to contain ...
... because that contains includes for omp.h and pthread.h. However, I'm on Windows, building with Cygwin, and building with studio.h fails, "can't find direct.h". studio.h contains:
I have direct.h, but it's in a mingw directory, and contains stuff I don't need for a build.
My workaround is to copy-paste the bits I do need from studio.h into my program, which is just this:
(I've commented-out lines that I don't need, though they are harmless.)
This works, and my program has OpenMP. But it seems to be a kludge. Perhaps IM can be smarter in distinguishing between Mingw and Cygwin.
To get parallel processing with OpenMP in programs that use ImageMagick, the program needs to contain ...
Code: Select all
#include "studio.h"
Code: Select all
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# include <io.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
# endif
#endif
My workaround is to copy-paste the bits I do need from studio.h into my program, which is just this:
Code: Select all
#if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
# include <omp.h>
# define MAGICKCORE_OPENMP_SUPPORT 1
#endif
#if defined(MAGICKCORE_THREAD_SUPPORT)
# include <pthread.h>
//#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
//#include <winsock2.h>
//#include <ws2tcpip.h>
//#include <windows.h>
//#pragma comment (lib, "ws2_32.lib")
#endif
This works, and my program has OpenMP. But it seems to be a kludge. Perhaps IM can be smarter in distinguishing between Mingw and Cygwin.