#include "magick/resample.h"
#include "magick/resource_.h"
#include "magick/string_.h"
+#include "magick/thread-private.h"
#include "magick/utility.h"
#include "magick/version.h"
\f
Tile texture onto the image background.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(status)
+ #pragma omp parallel for schedule(dynamic,4) shared(status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) texture->rows)
{
image_view=AcquireCacheView(image);
texture_view=AcquireCacheView(texture);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(status)
+ #pragma omp parallel for schedule(dynamic,4) shared(status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
#include "magick/monitor-private.h"
#include "magick/pixel-private.h"
#include "magick/quantum.h"
+#include "magick/thread-private.h"
#include "magick/transform.h"
\f
/*
Draw sides of ornamental border.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
exception=(&image->exception);
image_view=AcquireCacheView(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) raise_info->height; y++)
{
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
{
}
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
{
image_view=AcquireCacheView(image);
blur_view=AcquireCacheView(blur_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
random_info=AcquireRandomInfoThreadSet();
image_view=AcquireCacheView(spread_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) spread_image->rows; y++)
{
progress=0;
exception=destination->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
status=MagickTrue;
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
progress=0;
exception=destination->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(destination->number_threads)
#endif
for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++)
{
% %
% %
% %
+% S e t I m a g e V i e w T h r e a d s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% SetImageViewThreads() sets the number of threads in a thread team.
+%
+% The format of the SetImageViewDescription method is:
+%
+% void SetImageViewThreads(ImageView *image_view,
+% const size_t number_threads)
+%
+% A description of each parameter follows:
+%
+% o image_view: the image view.
+%
+% o number_threads: the number of threads in a thread team.
+%
+*/
+MagickExport void SetImageViewThreads(ImageView *image_view,
+ const size_t number_threads)
+{
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ image_view->number_threads=number_threads;
+ if (number_threads > GetOpenMPMaximumThreads())
+ image_view->number_threads=GetOpenMPMaximumThreads();
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% T r a n s f e r I m a g e V i e w I t e r a t o r %
% %
% %
progress=0;
exception=destination->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
progress=0;
exception=source->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
GetImageViewExtent(const ImageView *);
extern MagickExport void
- SetImageViewDescription(ImageView *,const char *);
+ SetImageViewDescription(ImageView *,const char *),
+ SetImageViewThreads(ImageView *,const size_t);
#if defined(__cplusplus) || defined(c_plusplus)
}
#include "magick/statistic.h"
#include "magick/string_.h"
#include "magick/string-private.h"
+#include "magick/thread-private.h"
#include "magick/threshold.h"
#include "magick/transform.h"
\f
*/
GetPixelCacheTileSize(image,&tile_width,&tile_height);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress, status)
+ #pragma omp parallel for schedule(static,1) shared(progress, status) om_throttle(1)
#endif
for (tile_y=0; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
{
Rotate 180 degrees.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,8) shared(progress,status)
+ #pragma omp parallel for schedule(static,8) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
*/
GetPixelCacheTileSize(image,&tile_width,&tile_height);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) omp_throttle(1)
#endif
for (tile_y=0; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
{
#include <magick/thread_.h>
+#define omp_throttle(factor) num_threads(omp_get_max_threads() >> (factor))
+
#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR > 10))
#define MagickCachePrefetch(address,mode,locality) \
__builtin_prefetch(address,mode,locality)
#include "magick/signature-private.h"
#include "magick/string_.h"
#include "magick/string-private.h"
-#include "magick/transform.h"
+#include "magick/thread-private.h"
#include "magick/threshold.h"
+#include "magick/transform.h"
#include "magick/xml-tree.h"
\f
/*
#include "magick/resize.h"
#include "magick/statistic.h"
#include "magick/string_.h"
+#include "magick/thread-private.h"
#include "magick/transform.h"
\f
/*
j=0;
image_view=AcquireCacheView(image);
chop_view=AcquireCacheView(chop_image);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(dynamic,4) shared(status) omp_throttle(1)
+#endif
for (y=0; y < (ssize_t) extent.y; y++)
{
register const PixelPacket
Extract chop image.
*/
i+=(ssize_t) extent.height;
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(dynamic,4) shared(status) omp_throttle(1)
+#endif
for (y=0; y < (ssize_t) (image->rows-(extent.y+extent.height)); y++)
{
register const PixelPacket
image_view=AcquireCacheView(image);
crop_view=AcquireCacheView(crop_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) crop_image->rows; y++)
{
image_view=AcquireCacheView(image);
flip_view=AcquireCacheView(flip_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) flip_image->rows; y++)
{
image_view=AcquireCacheView(image);
flop_view=AcquireCacheView(flop_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+ #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
for (y=0; y < (ssize_t) flop_image->rows; y++)
{
progress=0;
exception=destination->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
status=MagickTrue;
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
progress=0;
exception=destination->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(destination->number_threads)
#endif
for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++)
{
% %
% %
% %
+% S e t W a n d V i e w T h r e a d s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% SetWandViewThreads() sets the number of threads in a thread team.
+%
+% The format of the SetWandViewDescription method is:
+%
+% void SetWandViewThreads(WandView *image_view,
+% const size_t number_threads)
+%
+% A description of each parameter follows:
+%
+% o image_view: the image view.
+%
+% o number_threads: the number of threads in a thread team.
+%
+*/
+MagickExport void SetWandViewThreads(WandView *image_view,
+ const size_t number_threads)
+{
+ assert(image_view != (WandView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ image_view->number_threads=number_threads;
+ if (number_threads > GetOpenMPMaximumThreads())
+ image_view->number_threads=GetOpenMPMaximumThreads();
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% T r a n s f e r W a n d V i e w I t e r a t o r %
% %
% %
progress=0;
exception=destination->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
progress=0;
exception=source->exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,1) shared(progress,status)
+ #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
#endif
for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
GetWandViewExtent(const WandView *);
extern WandExport void
- SetWandViewDescription(WandView *,const char *);
+ SetWandViewDescription(WandView *,const char *),
+ SetWandViewThreads(WandView *,const size_t);
extern WandExport WandView
*CloneWandView(const WandView *),