STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Concurrency Namespace Reference

The Concurrency namespace provides classes and functions that provide access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime. More...

Namespaces

 details
 
 direct3d
 
 extensibility
 
 fast_math
 Functions in the fast_math namespace have lower accuracy, and support only single-precision float.
 
 graphics
 
 precise_math
 Functions in the precise_math namespace have higher accuracy, but require double-precision support, which not all accelerators do.
 

Classes

class  _AllocatedBufferHolder
 
struct  _Binary_transform_impl_helper
 
struct  _Binary_transform_impl_helper< std::random_access_iterator_tag, std::random_access_iterator_tag, std::random_access_iterator_tag >
 
class  _Continuation_func_transformer
 A helper class template that transforms a continuation lambda that either takes or returns void, or both, into a lambda that takes and returns a non-void type (details::_Unit_type is used to substitute for void). This is to minimize the special handling required for 'void'. More...
 
class  _Continuation_func_transformer< _InType, void >
 
class  _Continuation_func_transformer< void, _OutType >
 
class  _Continuation_func_transformer< void, void >
 
class  _Greedy_node
 Helper class used in multi-type greedy join blocks Ordered node is a single-target, single-source ordered propagator block More...
 
class  _Init_func_transformer
 
class  _Init_func_transformer< void >
 
class  _Iterator_helper
 
class  _Iterator_helper< _Random_iterator, std::random_access_iterator_tag >
 
class  _Join_node
 Defines a block allowing sources of distinct types to be joined. Join node is a single-target, multi-source ordered propagator block More...
 
class  _Network_link_iterator
 Const iterator for network link registry. Message blocks should use the link_registry::iterator type for iteration. More...
 
class  _Non_greedy_node
 Helper class used in multi-type non-greedy join blocks Ordered node is a single-target, single-source ordered propagator block More...
 
class  _Order_combinable
 
class  _Order_node_base
 Base class for Helper node used in multi-type join and choice blocks Order node is a single-target, single-source ordered propagator block The main property of an order node is that it accepts a message of _Type and outputs a message of int, with some unique assigned index number. More...
 
class  _Parallel_chunk_helper
 
class  _Parallel_chunk_helper_invoke
 
class  _Parallel_chunk_helper_invoke< _Random_iterator, _Index_type, _Function, false >
 
class  _Parallel_fixed_chunk_helper
 
class  _Parallel_for_each_helper
 
class  _Parallel_localized_chunk_helper
 
class  _Parallel_reduce_fixed_worker
 
struct  _Parallel_reduce_forward_executor_helper
 
class  _Parallel_transform_binary_helper
 
class  _Parallel_transform_unary_helper
 
struct  _Radix_sort_default_function
 
class  _Range
 
struct  _Reduce_functor_helper
 
class  _Reserving_node
 Helper class used in multi-type choice blocks Ordered node is a single-target, single-source ordered propagator block More...
 
class  _Source_link_iterator
 Const Iterator for referenced link manager. More...
 
class  _Tiled_index_base
 A _Tiled_index_base is the base class of all three kinds of tiled_index to share the common code. More...
 
struct  _Unary_transform_impl_helper
 
struct  _Unary_transform_impl_helper< std::random_access_iterator_tag, std::random_access_iterator_tag >
 
struct  _Unwrap
 
struct  _Unwrap< std::tuple< _Types...> >
 Template specialization used to unwrap the types from within a tuple. More...
 
class  _Worker_proxy
 
class  accelerator
 Class represents a accelerator abstraction for C++ AMP data-parallel devices More...
 
class  accelerator_view
 Class represents a virtual device abstraction on a C++ AMP data-parallel accelerator More...
 
class  accelerator_view_removed
 Exception thrown when an underlying DirectX call fails due to the Windows timeout detection and recovery mechanism More...
 
class  affinity_partitioner
 The affinity_partitioner class is similar to the static_partitioner class, but it improves cache affinity by its choice of mapping subranges to worker threads. It can improve performance significantly when a loop is re-executed over the same data set, and the data fits in cache. Note that the same affinity_partitioner object must be used with subsequent iterations of a parallel loop that is executed over a particular data set, to benefit from data locality. More...
 
class  agent
 A class intended to be used as a base class for all independent agents. It is used to hide state from other agents and interact using message-passing. More...
 
class  array
 An array is a multi-dimensional data aggregate on a accelerator_view. More...
 
class  array_view
 An array_view is an N-dimensional view over data held in another container (such as array<T,N> or other container. It exposes an indexing interface congruent to that of array<T,N>). More...
 
class  array_view< const _Value_type, _Rank >
 
class  auto_partitioner
 The auto_partitioner class represents the default method parallel_for, parallel_for_each and parallel_transform use to partition the range they iterates over. This method of partitioning employes range stealing for load balancing as well as per-iterate cancellation. More...
 
class  bad_target
 This class describes an exception thrown when a messaging block is given a pointer to a target which is invalid for the operation being performed. More...
 
class  call
 A call messaging block is a multi-source, ordered target_block that invokes a specified function when receiving a message. More...
 
class  cancellation_token
 The cancellation_token class represents the ability to determine whether some operation has been requested to cancel. A given token can be associated with a task_group, structured_task_group, or task to provide implicit cancellation. It can also be polled for cancellation or have a callback registered for if and when the associated cancellation_token_source is canceled. More...
 
class  cancellation_token_registration
 The cancellation_token_registration class represents a callback notification from a cancellation_token. When the register method on a cancellation_token is used to receive notification of when cancellation occurs, a cancellation_token_registration object is returned as a handle to the callback so that the caller can request a specific callback no longer be made through use of the deregister method. More...
 
class  cancellation_token_source
 The cancellation_token_source class represents the ability to cancel some cancelable operation. More...
 
class  choice
 A choice messaging block is a multi-source, single-target block that represents a control-flow interaction with a set of sources. The choice block will wait for any one of multiple sources to produce a message and will propagate the index of the source that produced the message. More...
 
class  combinable
 The combinable<T> object is intended to provide thread-private copies of data, to perform lock-free thread-local sub-computations during parallel algorithms. At the end of the parallel operation, the thread-private sub-computations can then be merged into a final result. This class can be used instead of a shared variable, and can result in a performance improvement if there would otherwise be a lot of contention on that shared variable. More...
 
class  completion_future
 Class represents a future corresponding to a C++ AMP asynchronous operation More...
 
class  concurrent_priority_queue
 The concurrent_priority_queue class is a container that allows multiple threads to concurrently push and pop items. Items are popped in priority order where priority is determined by a functor supplied as a template argument. More...
 
class  concurrent_queue
 The concurrent_queue class is a sequence container class that allows first-in, first-out access to its elements. It enables a limited set of concurrency-safe operations, such as push and try_pop. More...
 
class  concurrent_unordered_map
 The concurrent_unordered_map class is a concurrency-safe container that controls a varying-length sequence of elements of type std::pair<const _Key_type, _Element_type>. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access, and iterator traversal operations. More...
 
class  concurrent_unordered_multimap
 The concurrent_unordered_multimap class is an concurrency-safe container that controls a varying-length sequence of elements of type std::pair<const _Key_type, _Element_type>. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access and iterator traversal operations. More...
 
class  concurrent_unordered_multiset
 The concurrent_unordered_multiset class is an concurrency-safe container that controls a varying-length sequence of elements of type _Key_type. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access and iterator traversal operations. More...
 
class  concurrent_unordered_set
 The concurrent_unordered_set class is an concurrency-safe container that controls a varying-length sequence of elements of type _Key_type. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access and iterator traversal operations. More...
 
class  concurrent_vector
 The concurrent_vector class is a sequence container class that allows random access to any element. It enables concurrency-safe append, element access, iterator access, and iterator traversal operations. More...
 
class  context_self_unblock
 This class describes an exception thrown when the Unblock method of a Context object is called from the same context. This would indicate an attempt by a given context to unblock itself. More...
 
class  context_unblock_unbalanced
 This class describes an exception thrown when calls to the Block and Unblock methods of a Context object are not properly paired. More...
 
class  critical_section
 A non-reentrant mutex which is explicitly aware of the Concurrency Runtime. More...
 
class  default_scheduler_exists
 This class describes an exception thrown when the Scheduler::SetDefaultSchedulerPolicy method is called when a default scheduler already exists within the process. More...
 
class  event
 A manual reset event which is explicitly aware of the Concurrency Runtime. More...
 
class  extent
 The extent<N> type represents an N-dimensional vector of int which specifies the bounds of an N-dimensional space with an origin of 0. The values in the coordinate vector are ordered from most-significant to least-significant. Thus, in 2-dimensional space, the extent vector (5,3) represents a space with 5 rows and 3 columns. More...
 
class  improper_lock
 This class describes an exception thrown when a lock is acquired improperly. More...
 
class  improper_scheduler_attach
 This class describes an exception thrown when the Attach method is called on a Scheduler object which is already attached to the current context. More...
 
class  improper_scheduler_detach
 This class describes an exception thrown when the CurrentScheduler::Detach method is called on a context which has not been attached to any scheduler using the Attach method of a Scheduler object. More...
 
class  improper_scheduler_reference
 This class describes an exception thrown when the Reference method is called on a Scheduler object that is shutting down, from a context that is not part of that scheduler. More...
 
class  index
 Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-space. More...
 
class  invalid_compute_domain
 Exception thrown when the runtime fails to launch a kernel using the compute domain specified at the parallel_for_each call site. More...
 
class  invalid_link_target
 This class describes an exception thrown when the link_target method of a messaging block is called and the messaging block is unable to link to the target. This can be the result of exceeding the number of links the messaging block is allowed or attempting to link a specific target twice to the same source. More...
 
class  invalid_multiple_scheduling
 This class describes an exception thrown when a task_handle object is scheduled multiple times using the run method of a task_group or structured_task_group object without an intervening call to either the wait or run_and_wait methods. More...
 
class  invalid_operation
 This class describes an exception thrown when an invalid operation is performed that is not more accurately described by another exception type thrown by the Concurrency Runtime. More...
 
class  invalid_oversubscribe_operation
 This class describes an exception thrown when the Context::Oversubscribe method is called with the _BeginOversubscription parameter set to false without a prior call to the Context::Oversubscribe method with the _BeginOversubscription parameter set to true. More...
 
class  invalid_scheduler_policy_key
 This class describes an exception thrown when an invalid or unknown key is passed to a SchedulerPolicy object constructor, or the SetPolicyValue method of a SchedulerPolicy object is passed a key that must be changed using other means such as the SetConcurrencyLimits method. More...
 
class  invalid_scheduler_policy_thread_specification
 This class describes an exception thrown when an attempt is made to set the concurrency limits of a SchedulerPolicy object such that the value of the MinConcurrency key is less than the value of the MaxConcurrency key. More...
 
class  invalid_scheduler_policy_value
 This class describes an exception thrown when a policy key of a SchedulerPolicy object is set to an invalid value for that key. More...
 
class  ISource
 The ISource class is the interface for all source blocks. Source blocks propagate messages to ITarget blocks. More...
 
class  ITarget
 The ITarget class is the interface for all target blocks. Target blocks consume messages offered to them by ISource blocks. More...
 
class  join
 A join messaging block is a single-target, multi-source, ordered propagator_block which combines together messages of type _Type from each of its sources. More...
 
class  location
 An abstraction of a physical location on hardware. More...
 
class  message
 The basic message envelope containing the data payload being passed between messaging blocks. More...
 
class  message_not_found
 This class describes an exception thrown when a messaging block is unable to find a requested message. More...
 
class  message_processor
 The message_processor class is the abstract base class for processing of message objects. There is no guarantee on the ordering of the messages. More...
 
class  missing_wait
 This class describes an exception thrown when there are tasks still scheduled to a task_group or structured_task_group object at the time that object's destructor executes. This exception will never be thrown if the destructor is reached because of a stack unwinding as the result of an exception. More...
 
class  multi_link_registry
 The multi_link_registry object is a network_link_registry that manages multiple source blocks or multiple target blocks. More...
 
class  multitype_join
 A multitype_join messaging block is a multi-source, single-target messaging block that combines together messages of different types from each of its sources and offers a tuple of the combined messages to its targets. More...
 
class  nested_scheduler_missing_detach
 This class describes an exception thrown when the Concurrency Runtime detects that you neglected to call the CurrentScheduler::Detach method on a context that attached to a second scheduler using the Attach method of the Scheduler object. More...
 
class  network_link_registry
 The network_link_registry abstract base class manages the links between source and target blocks. More...
 
class  operation_timed_out
 This class describes an exception thrown when an operation has timed out. More...
 
class  ordered_message_processor
 An ordered_message_processor is a message_processor that allows message blocks to process messages in the order they were received. More...
 
class  out_of_memory
 Exception thrown when an underlying OS/DirectX call fails due to lack of system or device memory More...
 
class  overwrite_buffer
 An overwrite_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable of storing a single message at a time. New messages overwrite previously held ones. More...
 
class  propagator_block
 The propagator_block class is an abstract base class for message blocks that are both a source and target. It combines the functionality of both the source_block and target_block classes. More...
 
class  reader_writer_lock
 A writer-preference queue-based reader-writer lock with local only spinning. The lock grants first in - first out (FIFO) access to writers and starves readers under a continuous load of writers. More...
 
class  runtime_exception
 Exception thrown due to a C++ AMP runtime_exception. This is the base type for all C++ AMP exception types. More...
 
class  scheduler_not_attached
 This class describes an exception thrown when an operation is performed which requires a scheduler to be attached to the current context and one is not. More...
 
struct  scheduler_ptr
 Represents a pointer to a scheduler. This class exists to allow the the specification of a shared lifetime by using shared_ptr or just a plain reference by using raw pointer. More...
 
class  scheduler_resource_allocation_error
 This class describes an exception thrown because of a failure to acquire a critical resource in the Concurrency Runtime. More...
 
class  scheduler_worker_creation_error
 This class describes an exception thrown because of a failure to create a worker execution context in the Concurrency Runtime. More...
 
class  simple_partitioner
 The simple_partitioner class represents a static partitioning of the range iterated over by parallel_for. The partitioner divides the range into chunks such that each chunk has at least the number of iterations specified by the chunk size. More...
 
class  single_assignment
 A single_assignment messaging block is a multi-target, multi-source, ordered propagator_block capable of storing a single, write-once message. More...
 
class  single_link_registry
 The single_link_registry object is a network_link_registry that manages only a single source or target block. More...
 
class  source_block
 The source_block class is an abstract base class for source-only blocks. The class provides basic link management functionality as well as common error checks. More...
 
class  source_link_manager
 The source_link_manager object manages messaging block network links to ISource blocks. More...
 
class  static_partitioner
 The static_partitioner class represents a static partitioning of the range iterated over by parallel_for. The partitioner divides the range into as many chunks as there are workers available to the underyling scheduler. More...
 
class  structured_task_group
 The structured_task_group class represents a highly structured collection of parallel work. You can queue individual parallel tasks to a structured_task_group using task_handle objects, and wait for them to complete, or cancel the task group before they have finished executing, which will abort any tasks that have not begun execution. More...
 
class  target_block
 The target_block class is an abstract base class that provides basic link management functionality and error checking for target only blocks. More...
 
class  task
 The Parallel Patterns Library (PPL) task class. A task object represents work that can be executed asynchronously, and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type _ResultType on successful completion. Tasks of type task<void> produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations(then), and join(when_all) and choice(when_any) patterns. More...
 
class  task< void >
 The Parallel Patterns Library (PPL) task class. A task object represents work that can be executed asynchronously, and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type _ResultType on successful completion. Tasks of type task<void> produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations(then), and join(when_all) and choice(when_any) patterns. More...
 
class  task_canceled
 This class describes an exception thrown by the PPL tasks layer in order to force the current task to cancel. It is also thrown by the get() method on task, for a canceled task. More...
 
class  task_completion_event
 The task_completion_event class allows you to delay the execution of a task until a condition is satisfied, or start a task in response to an external event. More...
 
class  task_completion_event< void >
 The task_completion_event class allows you to delay the execution of a task until a condition is satisfied, or start a task in response to an external event. More...
 
class  task_continuation_context
 The task_continuation_context class allows you to specify where you would like a continuation to be executed. It is only useful to use this class from a Windows Store app. For non-Windows Store apps, the task continuation's execution context is determined by the runtime, and not configurable. More...
 
class  task_group
 The task_group class represents a collection of parallel work which can be waited on or canceled. More...
 
class  task_handle
 The task_handle class represents an individual parallel work item. It encapsulates the instructions and the data required to execute a piece of work. More...
 
class  task_options
 Represents the allowed options for creating a task More...
 
class  tile_barrier
 The tile_barrier class is a capability class that is only creatable by the system, and passed to a tiled parallel_for_each lambda as part of the tiled_index parameter. It provides wait methods whose purpose is to synchronize execution of threads running within the thread group (tile). More...
 
class  tiled_extent
 A tiled_extent is an extent of 1 to 3 dimensions which also subdivides the extent space into 1-, 2-, or 3-dimensional tiles. It has three specialized forms: tiled_extent<_Dim0>, tiled_extent<_Dim0,_Dim1>, and tiled_extent<_Dim0,_Dim1,_Dim2>, where _Dim0-2 specify the length of the tile along each dimension, with _Dim0 being the most-significant dimension and _Dim2 being the least-significant. More...
 
class  tiled_extent< _Dim0, 0, 0 >
 
class  tiled_extent< _Dim0, _Dim1, 0 >
 
class  tiled_index
 A tiled_index is a set of indices of 1 to 3 dimensions which have been subdivided into 1-, 2-, or 3-dimensional tiles in a tiled_extent. It has three specialized forms: tiled_index<_Dim0>, tiled_index<_Dim0, _Dim1>, and tiled_index<_Dim0, _Dim1, _Dim2>, where _Dim0-2 specify the length of the tile along the each dimension, with _Dim0 being the most-significant dimension and _Dim2 being the least-significant. More...
 
class  tiled_index< _Dim0, 0, 0 >
 
class  tiled_index< _Dim0, _Dim1, 0 >
 
class  timer
 A timer messaging block is a single-target source_block capable of sending a message to its target after a specified time period has elapsed or at specific intervals. More...
 
class  transformer
 A transformer messaging block is a single-target, multi-source, ordered propagator_block which can accept messages of one type and is capable of storing an unbounded number of messages of a different type. More...
 
class  unbounded_buffer
 An unbounded_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable of storing an unbounded number of messages. More...
 
class  unsupported_feature
 Exception thrown when an unsupported feature is used More...
 
class  unsupported_os
 This class describes an exception thrown when an unsupported operating system is used. More...
 

Typedefs

typedef __int32 runtime_object_identity
 Each message instance has an identity that follows it as it is cloned and passed between messaging components. This cannot be the address of the message object. More...
 
typedef ::Concurrency::details::_NonReentrantPPLLock::_Scoped_lock _NR_lock
 A lock holder that acquires a non-reentrant lock on instantiation and releases it on destruction. More...
 
typedef ::Concurrency::details::_ReentrantPPLLock::_Scoped_lock _R_lock
 A lock holder that acquires a reentrant lock on instantiation and releases it on destruction More...
 
typedef details::_Reference_counted_obj_ptr< details::_Accelerator_view_impl > _Accelerator_view_impl_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Accelerator_impl > _Accelerator_impl_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Buffer_Buffer_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Texture_Texture_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Sampler_Sampler_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Ubiquitous_buffer_Ubiquitous_buffer_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Event_impl > _Event_impl_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_View_shape_View_shape_ptr
 
typedef void(__cdecl * TaskProc) (void *)
 Concurrency::details contains definitions of support routines in the public namespaces and one or more macros. Users should not directly interact with this internal namespace. More...
 
typedef void(__cdecl * TaskProc_t) (void *)
 An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *). A TaskProc is called to invoke the body of a task. More...
 
typedef task_group_status task_status
 A type that represents the terminal state of a task. Valid values are completed and canceled. More...
 

Enumerations

enum  message_status { accepted, declined, postponed, missed }
 The valid responses for an offer of a message object to a block. More...
 
enum  join_type { greedy = 0, non_greedy = 1 }
 The type of a join messaging block. More...
 
enum  agent_status {
  agent_created, agent_runnable, agent_started, agent_done,
  agent_canceled
}
 The valid states for an agent. More...
 
enum  access_type {
  access_type_none = 0, access_type_read = (1 << 0), access_type_write = (1 << 1), access_type_read_write = access_type_read | access_type_write,
  access_type_auto = (1 << 31)
}
 Enumeration type used to denote the various types of access to data. More...
 
enum  queuing_mode { queuing_mode_immediate, queuing_mode_automatic }
 Queuing modes supported for accelerator views More...
 
enum  ConcRT_EventType {
  CONCRT_EVENT_GENERIC = 0, CONCRT_EVENT_START = 1, CONCRT_EVENT_END = 2, CONCRT_EVENT_BLOCK = 3,
  CONCRT_EVENT_UNBLOCK = 4, CONCRT_EVENT_YIELD = 5, CONCRT_EVENT_IDLE = 6, CONCRT_EVENT_ATTACH = 7,
  CONCRT_EVENT_DETACH = 8
}
 The types of events that can be traced using the tracing functionality offered by the Concurrency Runtime. More...
 
enum  Concrt_TraceFlags {
  SchedulerEventFlag = 0x1, ContextEventFlag = 0x2, VirtualProcessorEventFlag = 0x4, ResourceManagerEventFlag = 0x8,
  PPLEventFlag = 0x10, AgentEventFlag = 0x20, AllEventsFlag = 0xFFFFFFFF
}
 Trace flags for the event types More...
 
enum  Agents_EventType {
  AGENTS_EVENT_CREATE = 0, AGENTS_EVENT_START = 1, AGENTS_EVENT_END = 2, AGENTS_EVENT_DESTROY = 3,
  AGENTS_EVENT_SCHEDULE = 4, AGENTS_EVENT_LINK = 5, AGENTS_EVENT_UNLINK = 6, AGENTS_EVENT_NAME = 7
}
 The types of events that can be traced using the tracing functionality offered by the Agents Library More...
 
enum  task_group_status { not_complete, completed, canceled }
 Describes the execution status of a task_group or structured_task_group object. A value of this type is returned by numerous methods that wait on tasks scheduled to a task group to complete. More...
 

Functions

template<typename _Type1 , typename _Type2 , typename... _Types>
choice< std::tuple< _Type1, _Type2, _Types...> > make_choice (_Type1 _Item1, _Type2 _Item2, _Types..._Items)
 Constructs a choice messaging block from an optional Scheduler or ScheduleGroup and two or more input sources. More...
 
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join< std::tuple< _Type1, _Type2, _Types...> > make_join (_Type1 _Item1, _Type2 _Item2, _Types..._Items)
 Constructs a non_greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources. More...
 
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join< std::tuple< _Type1, _Type2, _Types...>, greedymake_greedy_join (_Type1 _Item1, _Type2 _Item2, _Types..._Items)
 Constructs a greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources. More...
 
template<class _Type >
_Type _Receive_impl (ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. If the specified timeout is not COOPERATIVE_TIMEOUT_INFINITE, an exception (operation_timed_out) will be thrown if the specified amount of time expires before a message is received. Note that zero length timeouts should likely use try_receive as opposed to receive with a timeout of zero as it is more efficient and does not throw exceptions on timeouts. More...
 
template<class _Type >
_Type receive (_Inout_ ISource< _Type > *_Src, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
_Type receive (_Inout_ ISource< _Type > *_Src, typename ITarget< _Type >::filter_method const &_Filter_proc, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
_Type receive (ISource< _Type > &_Src, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
_Type receive (ISource< _Type > &_Src, typename ITarget< _Type >::filter_method const &_Filter_proc, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
bool _Try_receive_impl (ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
 Helper function that implements try_receive A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, try_receive will return false. More...
 
template<class _Type >
bool try_receive (_Inout_ ISource< _Type > *_Src, _Type &_value)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool try_receive (_Inout_ ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const &_Filter_proc)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool try_receive (ISource< _Type > &_Src, _Type &_value)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool try_receive (ISource< _Type > &_Src, _Type &_value, typename ITarget< _Type >::filter_method const &_Filter_proc)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool send (_Inout_ ITarget< _Type > *_Trg, const _Type &_Data)
 A synchronous send operation, which waits until the target either accepts or declines the message. More...
 
template<class _Type >
bool send (ITarget< _Type > &_Trg, const _Type &_Data)
 A synchronous send operation, which waits until the target either accepts or declines the message. More...
 
template<class _Type >
bool asend (_Inout_ ITarget< _Type > *_Trg, const _Type &_Data)
 An asynchronous send operation, which schedules a task to propagate the data to the target block. More...
 
template<class _Type >
bool asend (ITarget< _Type > &_Trg, const _Type &_Data)
 An asynchronous send operation, which schedules a task to propagate the value to the target block. More...
 
template<class _Type >
void Trace_agents_register_name (_Inout_ _Type *_PObject, _In_z_ const wchar_t *_Name)
 Associates the given name to the message block or agent in the ETW trace. More...
 
template<int _Rank, template< int > class _Tuple_type>
bool operator== (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
bool operator!= (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator+ (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator- (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator+ (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator+ (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator- (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator- (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator* (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator* (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator/ (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator/ (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator% (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type< _Rank > operator% (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array into the destination array. More...
 
template<typename _Value_type , int _Rank>
void copy (const array< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, InputIterator _SrcLast, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, InputIterator _SrcLast, array< _Value_type, _Rank > &_Dest)
 Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements beginning at _SrcFirst into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, array< _Value_type, _Rank > &_Dest)
 Copies the elements beginning at _SrcFirst into the destination array. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Asynchronously copies the contents of the array into the destination beginning at _DestIter. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
void copy (const array< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Copies the contents of the array into the destination beginning at _DestIter. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
void copy (const array< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< const _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< const _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< const _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< const _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, InputIterator _SrcLast, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements beginning at _SrcFirst into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, InputIterator _SrcLast, const array_view< _Value_type, _Rank > &_Dest)
 Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of an STL container into the destination array_view. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Asynchronously copies the contents of the array_view into the destination beginning at _DestIter. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
void copy (const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Copies the contents of the array_view into the destination beginning at _DestIter. More...
 
int atomic_fetch_add (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic addition of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_add (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic addition of _Value to the memory location pointed to by _Dest More...
 
int atomic_fetch_sub (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic subtraction of _Value from the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_sub (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic subtraction of _Value from the memory location pointed to by _Dest More...
 
int atomic_fetch_inc (_Inout_ int *_Dest) __GPU_ONLY
 Performs an atomic increment to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_inc (_Inout_ unsigned int *_Dest) __GPU_ONLY
 Performs an atomic increment to the memory location pointed to by _Dest More...
 
int atomic_fetch_dec (_Inout_ int *_Dest) __GPU_ONLY
 Performs an atomic decrement to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_dec (_Inout_ unsigned int *_Dest) __GPU_ONLY
 Performs an atomic decrement to the memory location pointed to by _Dest More...
 
int atomic_exchange (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Sets the value of location pointed to by _Dest to _Value as an atomic operation More...
 
unsigned int atomic_exchange (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Sets the value of location pointed to by _Dest to _Value as an atomic operation More...
 
float atomic_exchange (_Inout_ float *_Dest, float _Value) __GPU_ONLY
 Sets the value of location pointed to by _Dest to _Value as an atomic operation More...
 
bool atomic_compare_exchange (_Inout_ int *_Dest, _Inout_ int *_Expected_value, int _Value) __GPU_ONLY
 Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest More...
 
bool atomic_compare_exchange (_Inout_ unsigned int *_Dest, _Inout_ unsigned int *_Expected_value, unsigned int _Value) __GPU_ONLY
 Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest More...
 
int atomic_fetch_max (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location More...
 
unsigned int atomic_fetch_max (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location More...
 
int atomic_fetch_min (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location More...
 
unsigned int atomic_fetch_min (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location More...
 
int atomic_fetch_and (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_and (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest More...
 
int atomic_fetch_or (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_or (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest More...
 
int atomic_fetch_xor (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_xor (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest More...
 
template<int _Rank, typename _Kernel_type >
void parallel_for_each (const extent< _Rank > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain on an accelerator_view. The accelerator_view is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator_view can be derived, the default is chosen. More...
 
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void parallel_for_each (const tiled_extent< _Dim0, _Dim1, _Dim2 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen. More...
 
template<int _Dim0, int _Dim1, typename _Kernel_type >
void parallel_for_each (const tiled_extent< _Dim0, _Dim1 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen. More...
 
template<int _Dim0, typename _Kernel_type >
void parallel_for_each (const tiled_extent< _Dim0 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen. More...
 
template<int _Rank, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const extent< _Rank > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain on an accelerator. More...
 
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const tiled_extent< _Dim0, _Dim1, _Dim2 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions. More...
 
template<int _Dim0, int _Dim1, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const tiled_extent< _Dim0, _Dim1 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions. More...
 
template<int _Dim0, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const tiled_extent< _Dim0 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions. More...
 
void direct3d_abort () __GPU_ONLY
 
void direct3d_errorf (const char *,...) __GPU_ONLY
 
void direct3d_printf (const char *,...) __GPU_ONLY
 
void all_memory_fence (const tile_barrier &_Barrier) __GPU_ONLY
 Memory fences and tile barriers. More...
 
void global_memory_fence (const tile_barrier &_Barrier) __GPU_ONLY
 Ensures that global memory accesses are visible to other threads in the thread tile, and are executed according to program order More...
 
void tile_static_memory_fence (const tile_barrier &_Barrier) __GPU_ONLY
 Ensures that tile_static memory accesses are visible to other threads in the thread tile, and are executed according to program order More...
 
_AMPIMP void __cdecl amp_uninitialize ()
 Uninitializes the C++ AMP runtime. It is legal to call this function multiple times during an applications lifetime. Calling any C++ AMP API afer calling this function will reinitialize the C++ AMP runtime. Note that it is illegal to use C++ AMP objects across calls to this function and doing so will result in undefined behavior. Also, concurrently calling this function and any other AMP APIs is illegal and would result in undefined behavior. More...
 
_CRTIMP void __cdecl wait (unsigned int _Milliseconds)
 Pauses the current context for a specified amount of time. More...
 
_CRTIMP void *__cdecl Alloc (size_t _NumBytes)
 Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator. More...
 
_CRTIMP void __cdecl Free (_Pre_maybenull_ _Post_invalid_ void *_PAllocation)
 Releases a block of memory previously allocated by the Alloc method to the Concurrency Runtime Caching Suballocator. More...
 
 __declspec (deprecated("Concurrency::EnableTracing is a deprecated function.")) _CRTIMP HRESULT __cdecl EnableTracing()
 Enables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is now on by default. More...
 
 __declspec (deprecated("Concurrency::DisableTracing is a deprecated function.")) _CRTIMP HRESULT __cdecl DisableTracing()
 Disables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is unregistered by default. More...
 
const __declspec (selectany) GUID ConcRT_ProviderGuid = { 0x72B14A7D, 0x704C, 0x423e, { 0x92, 0xF8, 0x7E, 0x6D, 0x64, 0xBC, 0xB9, 0x2A } }
 The ETW provider GUID for the Concurrency Runtime. More...
 
_CRTIMP void __cdecl _Trace_ppl_function (const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
 
_CRTIMP void __cdecl _Trace_agents (Agents_EventType _Type, __int64 agentId,...)
 
template<typename _Ty , class A1 , class A2 >
bool operator== (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator!= (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is not equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator< (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is less than the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator> (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is greater than the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator<= (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is less than or equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator>= (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is greater than or equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class _Ax >
void swap (concurrent_vector< _Ty, _Ax > &_A, concurrent_vector< _Ty, _Ax > &_B)
 Exchanges the elements of two concurrent_vector objects. More...
 
template<class _Function >
task_handle< _Function > make_task (const _Function &_Func)
 A factory method for creating a task_handle object. More...
 
template<typename _Function >
void run_with_cancellation_token (const _Function &_Func, cancellation_token _Ct)
 Executes a function object immediately and synchronously in the context of a given cancellation token. More...
 
void interruption_point ()
 Creates an interruption point for cancellation. If a cancellation is in progress in the context where this function is called, this will throw an internal exception that aborts the execution of the currently executing parallel work. If cancellation is not in progress, the function does nothing. More...
 
_CRTIMP2 bool __cdecl is_current_task_group_canceling ()
 Returns an indication of whether the task group which is currently executing inline on the current context is in the midst of an active cancellation (or will be shortly). Note that if there is no task group currently executing inline on the current context, false will be returned. More...
 
template<typename _Function1 , typename _Function2 >
void _Parallel_invoke_impl (const _Function1 &_Func1, const _Function2 &_Func2)
 
template<typename _Function1 , typename _Function2 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7, const _Function8 &_Func8)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7, const _Function8 &_Func8, const _Function9 &_Func9)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 , typename _Function10 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7, const _Function8 &_Func8, const _Function9 &_Func9, const _Function10 &_Func10)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Worker_class , typename _Index_type , typename Partitioner >
void _Parallel_chunk_task_group_run (structured_task_group &_Task_group, task_handle< _Worker_class > *_Chunk_helpers, const Partitioner &, _Index_type _I)
 
template<typename _Worker_class , typename _Index_type >
void _Parallel_chunk_task_group_run (structured_task_group &_Task_group, task_handle< _Worker_class > *_Chunk_helpers, affinity_partitioner &_Part, _Index_type _I)
 
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function , typename _Partitioner >
void _Parallel_chunk_impl (const _Random_iterator &_First, _Index_type _Range_arg, const _Index_type &_Step, const _Function &_Func, _Partitioner &&_Part)
 
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_chunk_impl (const _Random_iterator &_First, _Index_type _Range_arg, const _Index_type &_Step, const _Function &_Func)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, const auto_partitioner &_Part)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, const static_partitioner &_Part)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, const simple_partitioner &_Part)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, affinity_partitioner &_Part)
 
template<typename _Index_type , typename _Function , typename _Partitioner >
void _Parallel_for_impl (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func, _Partitioner &&_Part)
 
template<typename _Index_type , typename _Function >
void _Parallel_for_impl (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
 
template<typename _Index_type , typename _Function , typename _Partitioner >
void parallel_for (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func, _Partitioner &&_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, const auto_partitioner &_Part=auto_partitioner())
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, const static_partitioner &_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, const simple_partitioner &_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_for_each_chunk (_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_for_each_forward_impl (_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_for_each_impl (_Forward_iterator _First, const _Forward_iterator &_Last, const _Function &_Func, const auto_partitioner &, std::forward_iterator_tag)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, const auto_partitioner &_Part)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, const static_partitioner &_Part)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, const simple_partitioner &_Part)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, affinity_partitioner &_Part)
 
template<typename _Random_iterator , typename _Function , typename _Partitioner >
void _Parallel_for_each_impl (const _Random_iterator &_First, const _Random_iterator &_Last, const _Function &_Func, _Partitioner &&_Part, std::random_access_iterator_tag)
 
template<typename _Iterator , typename _Function >
void parallel_for_each (_Iterator _First, _Iterator _Last, const _Function &_Func)
 parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over. More...
 
template<typename _Iterator , typename _Function , typename _Partitioner >
void parallel_for_each (_Iterator _First, _Iterator _Last, const _Function &_Func, _Partitioner &&_Part)
 parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over. More...
 
template<typename _Forward_iterator >
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce (_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity)
 Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value. More...
 
template<typename _Forward_iterator , typename _Sym_reduce_fun >
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce (_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity, _Sym_reduce_fun _Sym_fun)
 Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value. More...
 
template<typename _Reduce_type , typename _Forward_iterator , typename _Range_reduce_fun , typename _Sym_reduce_fun >
_Reduce_type parallel_reduce (_Forward_iterator _Begin, _Forward_iterator _End, const _Reduce_type &_Identity, const _Range_reduce_fun &_Range_fun, const _Sym_reduce_fun &_Sym_fun)
 Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value. More...
 
template<typename _Forward_iterator , typename _Function >
_Function::_Reduce_type _Parallel_reduce_impl (_Forward_iterator _First, const _Forward_iterator &_Last, const _Function &_Func, std::forward_iterator_tag)
 
template<typename _Worker , typename _Random_iterator , typename _Function >
void _Parallel_reduce_random_executor (_Random_iterator _Begin, _Random_iterator _End, const _Function &_Fun)
 
template<typename _Random_iterator , typename _Function >
_Function::_Reduce_type _Parallel_reduce_impl (_Random_iterator _First, _Random_iterator _Last, const _Function &_Func, std::random_access_iterator_tag)
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_reduce_forward_executor (_Forward_iterator _First, _Forward_iterator _Last, const _Function &_Func, task_group &_Task_group)
 
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
void _Parallel_transform_binary_impl2 (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator &_Result, const _Binary_operator&_Binary_op, task_group &_Tg)
 
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator >
void _Parallel_transform_unary_impl2 (_Input_iterator _First, _Input_iterator _Last, _Output_iterator &_Result, const _Unary_operator&_Unary_op, task_group &_Tg)
 
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator , typename _Partitioner >
_Output_iterator _Parallel_transform_unary_impl (_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, const auto_partitioner &_Part=auto_partitioner())
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, const static_partitioner &_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, const simple_partitioner &_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, affinity_partitioner &_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator , typename _Partitioner >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator _Result, const _Binary_operator&_Binary_op, _Partitioner &&_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator _Result, const _Binary_operator&_Binary_op)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Random_iterator , typename _Function >
size_t _Median_of_three (const _Random_iterator &_Begin, size_t _A, size_t _B, size_t _C, const _Function &_Func, bool &_Potentially_equal)
 
template<typename _Random_iterator , typename _Function >
size_t _Median_of_nine (const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, bool &_Potentially_equal)
 
template<typename _Random_iterator , typename _Function >
size_t _Select_median_pivot (const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, const size_t _Chunk_size, bool &_Potentially_equal)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
size_t _Search_mid_point (const _Random_iterator &_Begin1, size_t &_Len1, const _Random_buffer_iterator &_Begin2, size_t &_Len2, const _Function &_Func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void _Merge_chunks (_Random_iterator _Begin1, const _Random_iterator &_End1, _Random_buffer_iterator _Begin2, const _Random_buffer_iterator &_End2, _Random_output_iterator _Output, const _Function &_Func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void _Parallel_merge (_Random_iterator _Begin1, size_t _Len1, _Random_buffer_iterator _Begin2, size_t _Len2, _Random_output_iterator _Output, const _Function &_Func, size_t _Div_num)
 
template<typename _Ty , typename _Function >
size_t _Radix_key (const _Ty &_Val, size_t _Radix, _Function _Proj_func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Integer_radix_pass (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Integer_radix_sort (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, size_t _Deep=0)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Parallel_integer_radix_sort (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, const size_t _Chunk_size, size_t _Deep=0)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Parallel_integer_sort_asc (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, _Function _Proj_func, const size_t _Chunk_size)
 
template<typename _Random_iterator , typename _Function >
void _Parallel_quicksort_impl (const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
bool _Parallel_buffered_sort_impl (const _Random_iterator &_Begin, size_t _Size, _Random_buffer_iterator _Output, const _Function &_Func, int _Div_num, const size_t _Chunk_size)
 
template<typename _Allocator >
_Allocator::pointer _Construct_buffer (size_t _N, _Allocator &_Alloc)
 
template<typename _Allocator >
void _Destroy_buffer (typename _Allocator::pointer _P, size_t _N, _Allocator &_Alloc)
 
template<typename _Random_iterator >
void parallel_sort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort. More...
 
template<typename _Random_iterator , typename _Function >
void parallel_sort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort. More...
 
template<typename _Random_iterator >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_buffered_sort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Random_iterator , typename _Function >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_buffered_sort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Random_iterator >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_radixsort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Random_iterator , typename _Function >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Proj_func, const size_t _Chunk_size=256 *256)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Proj_func, const size_t _Chunk_size=256 *256)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_radixsort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Proj_func, const size_t _Chunk_size=256 *256)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
std::shared_ptr< ::Concurrency::scheduler_interface > get_ambient_scheduler ()
 
void set_ambient_scheduler (std::shared_ptr< ::Concurrency::scheduler_interface > _Scheduler)
 
struct __declspec (novtable) scheduler_interface
 Scheduler Interface More...
 
bool __cdecl is_task_cancellation_requested ()
 Returns an indication of whether the task that is currently executing has received a request to cancel its execution. Cancellation is requested on a task if the task was created with a cancellation token, and the token source associated with that token is canceled. More...
 
 __declspec (noreturn) void __cdecl cancel_current_task()
 Cancels the currently executing task. This function can be called from within the body of a task to abort the task's execution and cause it to enter the canceled state. While it may be used in response to the is_task_cancellation_requested function, you may also use it by itself, to initiate cancellation of the task that is currently executing. More...
 
template<typename _Ty >
 __declspec (noinline) auto create_task(_Ty _Param
 Creates a PPL task object. create_task can be used anywhere you would have used a task constructor. It is provided mainly for convenience, because it allows use of the auto keyword while creating tasks. More...
 

Variables

const size_t COOPERATIVE_WAIT_TIMEOUT = SIZE_MAX
 Value indicating that a wait timed out. More...
 
const unsigned int COOPERATIVE_TIMEOUT_INFINITE = (unsigned int)-1
 Value indicating that a wait should never time out. More...
 

Detailed Description

The Concurrency namespace provides classes and functions that provide access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

The concurrency namespace provides classes and functions that give you access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

The Concurrency namespace provides classes and functions that give you access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

The Concurrency namespace provides classes and functions that access the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

Typedef Documentation

A lock holder that acquires a non-reentrant lock on instantiation and releases it on destruction.

A lock holder that acquires a reentrant lock on instantiation and releases it on destruction

Each message instance has an identity that follows it as it is cloned and passed between messaging components. This cannot be the address of the message object.

A type that represents the terminal state of a task. Valid values are completed and canceled.

See also
task Class
typedef void(__cdecl * Concurrency::TaskProc) (void *)

Concurrency::details contains definitions of support routines in the public namespaces and one or more macros. Users should not directly interact with this internal namespace.

An elementary abstraction for a task, defined as void (__cdecl * TaskProc)(void *). A TaskProc is called to invoke the body of a task.

typedef void(__cdecl * Concurrency::TaskProc_t) (void *)

An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *). A TaskProc is called to invoke the body of a task.

Enumeration Type Documentation

Enumeration type used to denote the various types of access to data.

Enumerator
access_type_none 
access_type_read 
access_type_write 
access_type_read_write 
access_type_auto 
98  {
99  access_type_none = 0,
100  access_type_read = (1 << 0),
101  access_type_write = (1 << 1),
103  access_type_auto = (1 << 31),
104  };
Definition: amprt.h:101
Definition: amprt.h:103
Definition: amprt.h:99
Definition: amprt.h:100

The valid states for an agent.

For more information, see Asynchronous Agents.

Enumerator
agent_created 

The agent has been created but not started.

agent_runnable 

The agent has been started, but not entered its run method.

agent_started 

The agent has started.

agent_done 

The agent finished without being canceled.

agent_canceled 

The agent was canceled.

11500  {
11504 
11505  agent_created,
11509 
11514 
11515  agent_started,
11519 
11520  agent_done,
11524 
11526 };
The agent has been started, but not entered its run method.
Definition: agents.h:11510
The agent finished without being canceled.
Definition: agents.h:11520
The agent has been created but not started.
Definition: agents.h:11505
The agent has started.
Definition: agents.h:11515
The agent was canceled.
Definition: agents.h:11525

The types of events that can be traced using the tracing functionality offered by the Agents Library

Enumerator
AGENTS_EVENT_CREATE 

An event type that represents the creation of an object

AGENTS_EVENT_START 

An event type that represents the initiation of some processing

AGENTS_EVENT_END 

An event type that represents the conclusion of some processing

AGENTS_EVENT_DESTROY 

An event type that represents the deletion of an object

AGENTS_EVENT_SCHEDULE 

An event type that represents the scheduling of a process

AGENTS_EVENT_LINK 

An event type that represents the linking of message blocks

AGENTS_EVENT_UNLINK 

An event type that represents the unlinking of message blocks

AGENTS_EVENT_NAME 

An event type that represents the name for an object

5790 {
5794 
5795  AGENTS_EVENT_CREATE = 0,
5796 
5800 
5801  AGENTS_EVENT_START = 1,
5802 
5806 
5807  AGENTS_EVENT_END = 2,
5808 
5812 
5814 
5818 
5820 
5824 
5825  AGENTS_EVENT_LINK = 5,
5826 
5830 
5831  AGENTS_EVENT_UNLINK = 6,
5832 
5836 
5837  AGENTS_EVENT_NAME = 7
5838 
5839 };
An event type that represents the linking of message blocks
Definition: concrt.h:5825
An event type that represents the unlinking of message blocks
Definition: concrt.h:5831
An event type that represents the creation of an object
Definition: concrt.h:5795
An event type that represents the name for an object
Definition: concrt.h:5837
An event type that represents the conclusion of some processing
Definition: concrt.h:5807
An event type that represents the scheduling of a process
Definition: concrt.h:5819
An event type that represents the initiation of some processing
Definition: concrt.h:5801
An event type that represents the deletion of an object
Definition: concrt.h:5813

The types of events that can be traced using the tracing functionality offered by the Concurrency Runtime.

Enumerator
CONCRT_EVENT_GENERIC 

An event type used for miscellaneous events.

CONCRT_EVENT_START 

An event type that marks the beginning of a start/end event pair.

CONCRT_EVENT_END 

An event type that marks the beginning of a start/end event pair.

CONCRT_EVENT_BLOCK 

An event type that represents the act of a context blocking.

CONCRT_EVENT_UNBLOCK 

An event type that represents the act of unblocking a context.

CONCRT_EVENT_YIELD 

An event type that represents the act of a context yielding.

CONCRT_EVENT_IDLE 

An event type that represents the act of a context becoming idle.

CONCRT_EVENT_ATTACH 

An event type that represents the act of a attaching to a scheduler.

CONCRT_EVENT_DETACH 

An event type that represents the act of a detaching from a scheduler.

5596 {
5600 
5605 
5606  CONCRT_EVENT_START = 1,
5610 
5611  CONCRT_EVENT_END = 2,
5615 
5616  CONCRT_EVENT_BLOCK = 3,
5620 
5625 
5626  CONCRT_EVENT_YIELD = 5,
5630 
5631  CONCRT_EVENT_IDLE = 6,
5635 
5636  CONCRT_EVENT_ATTACH = 7,
5640 
5641  CONCRT_EVENT_DETACH = 8,
5642 };
An event type used for miscellaneous events.
Definition: concrt.h:5601
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
An event type that represents the act of a attaching to a scheduler.
Definition: concrt.h:5636
An event type that represents the act of unblocking a context.
Definition: concrt.h:5621
An event type that represents the act of a detaching from a scheduler.
Definition: concrt.h:5641
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
An event type that represents the act of a context becoming idle.
Definition: concrt.h:5631
An event type that represents the act of a context yielding.
Definition: concrt.h:5626
An event type that represents the act of a context blocking.
Definition: concrt.h:5616

Trace flags for the event types

Enumerator
SchedulerEventFlag 
ContextEventFlag 
VirtualProcessorEventFlag 
ResourceManagerEventFlag 
PPLEventFlag 
AgentEventFlag 
AllEventsFlag 
5774 {
5775  SchedulerEventFlag = 0x1,
5776  ContextEventFlag = 0x2,
5779  PPLEventFlag = 0x10,
5780  AgentEventFlag = 0x20,
5781 
5782  AllEventsFlag = 0xFFFFFFFF
5783 };
Definition: concrt.h:5779
Definition: concrt.h:5778
Definition: concrt.h:5775
Definition: concrt.h:5780
Definition: concrt.h:5782
Definition: concrt.h:5776

The type of a join messaging block.

Enumerator
greedy 

Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient, but has the possibility for live-lock, depending on the network configuration.

non_greedy 

Non-greedy join messaging blocks postpone messages and try and consume them after all have arrived. These are guaranteed to work, but slower.

7427  {
7432 
7433  greedy = 0,
7438 
7439  non_greedy = 1
7440 };
Non-greedy join messaging blocks postpone messages and try and consume them after all have arrived...
Definition: agents.h:7439
Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient...
Definition: agents.h:7433

The valid responses for an offer of a message object to a block.

Enumerator
accepted 

The target accepted the message.

declined 

The target did not accept the message.

postponed 

The target postponed the message.

missed 

The target tried to accept the message, but it was no longer available.

1740 {
1744 
1745  accepted,
1749 
1750  declined,
1754 
1755  postponed,
1759 
1760  missed
1761 };
The target did not accept the message.
Definition: agents.h:1750
The target postponed the message.
Definition: agents.h:1755
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1760
The target accepted the message.
Definition: agents.h:1745

Queuing modes supported for accelerator views

Enumerator
queuing_mode_immediate 
queuing_mode_automatic 
826  {
829 };

Describes the execution status of a task_group or structured_task_group object. A value of this type is returned by numerous methods that wait on tasks scheduled to a task group to complete.

See also
task_group Class, task_group::wait Method, task_group::run_and_wait Method, structured_task_group Class, structured_task_group::wait Method, structured_task_group::run_and_wait Method
Enumerator
not_complete 

The tasks queued to the task_group object have not completed. Note that this value is not presently returned by the Concurrency Runtime.

completed 

The tasks queued to the task_group or structured_task_group object completed successfully.

canceled 

The task_group or structured_task_group object was canceled. One or more tasks may not have executed.

115 {
120 
121  not_complete,
122 
126 
127  completed,
128 
132 
133  canceled
134 };
The tasks queued to the task_group object have not completed. Note that this value is not presently r...
Definition: pplinterface.h:121
The tasks queued to the task_group or structured_task_group object completed successfully.
Definition: pplinterface.h:127
The task_group or structured_task_group object was canceled. One or more tasks may not have executed...
Definition: pplinterface.h:133

Function Documentation

struct Concurrency::__declspec ( novtable  )

Scheduler Interface

49 {
50  virtual void schedule( TaskProc_t, void* ) = 0;
51 };
void(__cdecl * TaskProc_t)(void *)
An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *)...
Definition: pplinterface.h:43
Concurrency::__declspec ( noreturn  )
inline

Cancels the currently executing task. This function can be called from within the body of a task to abort the task's execution and cause it to enter the canceled state. While it may be used in response to the is_task_cancellation_requested function, you may also use it by itself, to initiate cancellation of the task that is currently executing.

It is not a supported scenario to call this function if you are not within the body of a task. Doing so will result in undefined behavior such as a crash or a hang in your application.

See also
task Class
204 {
205  throw task_canceled();
206 }
template<typename _Ty >
Concurrency::__declspec ( noinline  )

Creates a PPL task object. create_task can be used anywhere you would have used a task constructor. It is provided mainly for convenience, because it allows use of the auto keyword while creating tasks.

Template Parameters
_TyThe type of the parameter from which the task is to be constructed.
Parameters
_ParamThe parameter from which the task is to be constructed. This could be a lambda or function object, a task_completion_event object, a different task object, or a Windows::Foundation::IAsyncInfo interface if you are using tasks in your Windows Store app.
Returns
A new task of type T, that is inferred from _Param .

The first overload behaves like a task constructor that takes a single parameter.

The second overload associates the cancellation token provided with the newly created task. If you use this overload you are not allowed to pass in a different task object as the first parameter.

The type of the returned task is inferred from the first parameter to the function. If _Param is a task_completion_event<T>, a task<T>, or a functor that returns either type T or task<T>, the type of the created task is task<T>.

In a Windows Store app, if _Param is of type Windows::Foundation::IAsyncOperation<T>^ or Windows::Foundation::IAsyncOperationWithProgress<T,P>^, or a functor that returns either of those types, the created task will be of type task<T>. If _Param is of type Windows::Foundation::IAsyncAction^ or Windows::Foundation::IAsyncActionWithProgress<P>^, or a functor that returns either of those types, the created task will have type task<void>.

See also
task Class, Task Parallelism (Concurrency Runtime)
Concurrency::__declspec ( deprecated("Concurrency::EnableTracing is a deprecated function.")  )

Enables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is now on by default.

Returns
If tracing was correctly initiated, S_OK is returned; otherwise, E_NOT_STARTED is returned.
Concurrency::__declspec ( deprecated("Concurrency::DisableTracing is a deprecated function.")  )

Disables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is unregistered by default.

Returns
If tracing was correctly disabled, S_OK is returned. If tracing was not previously initiated, E_NOT_STARTED is returned
const Concurrency::__declspec ( selectany  ) = { 0x72B14A7D, 0x704C, 0x423e, { 0x92, 0xF8, 0x7E, 0x6D, 0x64, 0xBC, 0xB9, 0x2A } }

The ETW provider GUID for the Concurrency Runtime.

A category GUID ({B9B5B78C-0713-4898-A21A-C67949DCED07}) describing ETW events fired by the Agents library in the Concurrency Runtime.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_for_each function.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_for function.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_invoke function.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to the resource manager.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to locks.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to virtual processors.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to chores or tasks.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to contexts.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to schedule groups.

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to scheduler activity.

A category GUID describing ETW events fired by the Concurrency Runtime that are not more specifically described by another category.

This category of events is not currently fired by the Concurrency Runtime.

See also
CurrentScheduler Class, Scheduler Class

This category of events is not currently fired by the Concurrency Runtime.

See also
ScheduleGroup Class
See also
Context Class

This category of events is not currently fired by the Concurrency Runtime.

See also
task_group Class, structured_task_group Class

This category of events is not currently fired by the Concurrency Runtime.

See also
critical_section Class, reader_writer_lock Class

This category of events is not currently fired by the Concurrency Runtime.

See also
IResourceManager Structure
See also
parallel_invoke Function
See also
parallel_for Function
See also
parallel_for_each Function
template<typename _Allocator >
_Allocator::pointer Concurrency::_Construct_buffer ( size_t  _N,
_Allocator &  _Alloc 
)
inline
5182 {
5183  typename _Allocator::pointer _P = _Alloc.allocate(_N);
5184 
5185  // If the objects being sorted have trivial default constructors, they do not need to be
5186  // constructed here. This can benefit performance.
5187  if (!std::has_trivial_default_constructor<typename _Allocator::value_type>::value)
5188  {
5189  for (size_t _I = 0; _I < _N; _I++)
5190  {
5191  // Objects being sorted must have a default constructor
5192  typename _Allocator::value_type _T;
5193  _Alloc.construct(_P + _I, std::forward<typename _Allocator::value_type>(_T));
5194  }
5195  }
5196 
5197  return _P;
5198 }
_N
Definition: wchar.h:1269
#define _T(x)
Definition: tchar.h:2498
template<typename _Allocator >
void Concurrency::_Destroy_buffer ( typename _Allocator::pointer  _P,
size_t  _N,
_Allocator &  _Alloc 
)
inline
5203 {
5204  // If the objects being sorted have trivial default destructors, they do not need to be
5205  // destructed here. This can benefit performance.
5206  if (!std::has_trivial_destructor<typename _Allocator::value_type>::value)
5207  {
5208  for (size_t _I = 0; _I < _N; _I++)
5209  {
5210  _Alloc.destroy(_P + _I);
5211  }
5212  }
5213 
5214  _Alloc.deallocate(_P, _N);
5215 }
_N
Definition: wchar.h:1269
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Integer_radix_pass ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
size_t  _Radix,
_Function  _Proj_func 
)
4739 {
4740  if (!_Size)
4741  {
4742  return;
4743  }
4744 
4745  size_t _Pos[256] = {0};
4746 
4747  for (size_t _I = 0; _I < _Size; _I++)
4748  {
4749  ++_Pos[_Radix_key(_Begin[_I], _Radix, _Proj_func)];
4750  }
4751 
4752  for (size_t _I = 1; _I < 256; _I++)
4753  {
4754  _Pos[_I] += _Pos[_I - 1];
4755  }
4756 
4757  // _Size > 0
4758  for (size_t _I = _Size - 1; _I != 0; _I--)
4759  {
4760  _Output[--_Pos[_Radix_key(_Begin[_I], _Radix, _Proj_func)]] = std::move(_Begin[_I]);
4761  }
4762 
4763  _Output[--_Pos[_Radix_key(_Begin[0], _Radix, _Proj_func)]] = std::move(_Begin[0]);
4764 }
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
size_t _Radix_key(const _Ty &_Val, size_t _Radix, _Function _Proj_func)
Definition: ppl.h:4731
_Check_return_ _In_ long _Size
Definition: io.h:325
_CRTIMP _Pre_notnull_ _Post_z_ char _In_ int _Radix
Definition: stdlib.h:483
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Integer_radix_sort ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
size_t  _Radix,
_Function  _Proj_func,
size_t  _Deep = 0 
)
4770 {
4771  size_t _Cur_radix = 0;
4772  if (_Size == 0)
4773  {
4774  return;
4775  }
4776 
4777  while (_Cur_radix < _Radix)
4778  {
4779  _Integer_radix_pass(_Begin, _Size, _Output, _Cur_radix++, _Proj_func);
4780  _Integer_radix_pass(_Output, _Size, _Begin, _Cur_radix++, _Proj_func);
4781  }
4782 
4783  if (_Cur_radix == _Radix)
4784  {
4785  _Integer_radix_pass(_Begin, _Size, _Output, _Cur_radix++, _Proj_func);
4786  }
4787 
4788  // if odd round is passed, then move result back to input buffer
4789  if (_Deep + _Radix + 1 & 1)
4790  {
4791  if (_Radix + 1 & 1)
4792  {
4793  std::_Move(_Output, _Output + _Size, _Begin);
4794  }
4795  else
4796  {
4797  std::_Move(_Begin, _Begin + _Size, _Output);
4798  }
4799  }
4800 }
void _Integer_radix_pass(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func)
Definition: ppl.h:4738
_OutIt _Move(_InIt _First, _InIt _Last, _OutIt _Dest, _Nonscalar_ptr_iterator_tag)
Definition: xutility:2416
_Check_return_ _In_ long _Size
Definition: io.h:325
_CRTIMP _Pre_notnull_ _Post_z_ char _In_ int _Radix
Definition: stdlib.h:483
template<typename _Random_iterator , typename _Function >
size_t Concurrency::_Median_of_nine ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Function &  _Func,
bool _Potentially_equal 
)
inline
4596 {
4597  size_t _Offset = _Size / 8;
4598  size_t _A = _Median_of_three(_Begin, 0, _Offset, _Offset * 2, _Func, _Potentially_equal),
4599  _B = _Median_of_three(_Begin, _Offset * 3, _Offset * 4, _Offset * 5, _Func, _Potentially_equal),
4600  _C = _Median_of_three(_Begin, _Offset * 6, _Offset * 7, _Size - 1, _Func, _Potentially_equal);
4601  _B = _Median_of_three(_Begin, _A, _B, _C, _Func, _Potentially_equal);
4602 
4603  if (_Potentially_equal)
4604  {
4605  _Potentially_equal = !_Func(_Begin[_C], _Begin[_A]);
4606  }
4607 
4608  return _B;
4609 }
_Check_return_opt_ _In_ long _Offset
Definition: io.h:334
_In_ wchar_t _C
Definition: wchar.h:1295
size_t _Median_of_three(const _Random_iterator &_Begin, size_t _A, size_t _B, size_t _C, const _Function &_Func, bool &_Potentially_equal)
Definition: ppl.h:4566
_Check_return_ _In_ long _Size
Definition: io.h:325
template<typename _Random_iterator , typename _Function >
size_t Concurrency::_Median_of_three ( const _Random_iterator &  _Begin,
size_t  _A,
size_t  _B,
size_t  _C,
const _Function &  _Func,
bool _Potentially_equal 
)
inline
4567 {
4568  _Potentially_equal = false;
4569  if (_Func(_Begin[_A], _Begin[_B]))
4570  {
4571  if (_Func(_Begin[_A], _Begin[_C]))
4572  {
4573  return _Func(_Begin[_B], _Begin[_C]) ? _B : _C;
4574  }
4575  else
4576  {
4577  return _A;
4578  }
4579  }
4580  else
4581  {
4582  if (_Func(_Begin[_B], _Begin[_C]))
4583  {
4584  return _Func(_Begin[_A], _Begin[_C]) ? _A : _C;
4585  }
4586  else
4587  {
4588  _Potentially_equal = true;
4589  return _B;
4590  }
4591  }
4592 }
_In_ wchar_t _C
Definition: wchar.h:1295
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void Concurrency::_Merge_chunks ( _Random_iterator  _Begin1,
const _Random_iterator &  _End1,
_Random_buffer_iterator  _Begin2,
const _Random_buffer_iterator &  _End2,
_Random_output_iterator  _Output,
const _Function &  _Func 
)
4677 {
4678  while (_Begin1 != _End1 && _Begin2 != _End2)
4679  {
4680  if (_Func(*_Begin1, *_Begin2))
4681  {
4682  *_Output++ = std::move(*_Begin1++);
4683  }
4684  else
4685  {
4686  *_Output++ = std::move(*_Begin2++);
4687  }
4688  }
4689 
4690  if (_Begin1 != _End1)
4691  {
4692  std::_Move(_Begin1, _End1, _Output);
4693  }
4694  else if (_Begin2 != _End2)
4695  {
4696  std::_Move(_Begin2, _End2, _Output);
4697  }
4698 }
_OutIt _Move(_InIt _First, _InIt _Last, _OutIt _Dest, _Nonscalar_ptr_iterator_tag)
Definition: xutility:2416
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
bool Concurrency::_Parallel_buffered_sort_impl ( const _Random_iterator &  _Begin,
size_t  _Size,
_Random_buffer_iterator  _Output,
const _Function &  _Func,
int  _Div_num,
const size_t  _Chunk_size 
)
inline
5119 {
5120  static_assert(std::is_same<typename std::iterator_traits<_Random_iterator>::value_type, typename std::iterator_traits<_Random_buffer_iterator>::value_type>::value,
5121  "same value type expected");
5122 
5123  if (_Div_num <= 1 || _Size <= _Chunk_size)
5124  {
5125  _Parallel_quicksort_impl(_Begin, _Size, _Func, _MAX_NUM_TASKS_PER_CORE, _Chunk_size, 0);
5126 
5127  // In case _Size <= _Chunk_size happened BEFORE the planned stop time (when _Div_num == 1) we need to calculate how many turns of
5128  // binary divisions are left. If there are an odd number of turns left, then the buffer move is necessary to make sure the final
5129  // merge result will be in the original input array.
5130  int _Left_div_turns = 0;
5131  while (_Div_num >>= 1)
5132  {
5133  _Left_div_turns++;
5134  }
5135 
5136  if (_Left_div_turns & 1)
5137  {
5138  std::move(_Begin, _Begin + _Size, _Output);
5139  return true;
5140  }
5141  else
5142  {
5143  return false;
5144  }
5145  }
5146  else
5147  {
5148  size_t _Mid = _Size / 2;
5149  structured_task_group _Tg;
5150 
5151  auto _Handle = make_task([&, _Chunk_size]
5152  {
5153  _Parallel_buffered_sort_impl(_Begin, _Mid, _Output, _Func, _Div_num / 2, _Chunk_size);
5154  });
5155  _Tg.run(_Handle);
5156 
5157  bool _Is_buffer_swap = _Parallel_buffered_sort_impl(_Begin + _Mid, _Size - _Mid, _Output + _Mid, _Func, _Div_num / 2, _Chunk_size);
5158 
5159  _Tg.wait();
5160 
5161  if (_Is_buffer_swap)
5162  {
5163  _Parallel_merge(_Output, _Mid, _Output + _Mid, _Size - _Mid, _Begin, _Func, _Div_num);
5164  }
5165  else
5166  {
5167  _Parallel_merge(_Begin, _Mid, _Begin + _Mid, _Size - _Mid, _Output, _Func, _Div_num);
5168  }
5169 
5170  return !_Is_buffer_swap;
5171  }
5172 }
void _Parallel_quicksort_impl(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
Definition: ppl.h:5006
task_handle< _Function > make_task(const _Function &_Func)
A factory method for creating a task_handle object.
Definition: ppl.h:164
void _Parallel_merge(_Random_iterator _Begin1, size_t _Len1, _Random_buffer_iterator _Begin2, size_t _Len2, _Random_output_iterator _Output, const _Function &_Func, size_t _Div_num)
Definition: ppl.h:4703
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
bool _Parallel_buffered_sort_impl(const _Random_iterator &_Begin, size_t _Size, _Random_buffer_iterator _Output, const _Function &_Func, int _Div_num, const size_t _Chunk_size)
Definition: ppl.h:5117
#define _MAX_NUM_TASKS_PER_CORE
Definition: ppl.h:4554
_Check_return_ _In_ long _Size
Definition: io.h:325
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function , typename _Partitioner >
void Concurrency::_Parallel_chunk_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
const _Index_type &  _Step,
const _Function &  _Func,
_Partitioner &&  _Part 
)
2371 {
2372  _CONCRT_ASSERT(_Range_arg > 1);
2373  _CONCRT_ASSERT(_Step > 0);
2374 
2375  _Index_type _Num_iterations = (_Step == 1) ? _Range_arg : (((_Range_arg - 1) / _Step) + 1);
2376  _CONCRT_ASSERT(_Num_iterations > 1);
2377 
2378  _Index_type _Num_chunks = _Part._Get_num_chunks(_Num_iterations);
2379  _CONCRT_ASSERT(_Num_chunks > 0);
2380 
2381  // Allocate memory on the stack for task_handles to ensure everything is properly structured.
2383  task_handle<_Worker_class> * _Chunk_helpers = _Holder._InitOnRawMalloca(_malloca(sizeof(task_handle<_Worker_class>) * static_cast<size_t>(_Num_chunks)));
2384 
2385  structured_task_group _Task_group;
2386 
2387  _Index_type _Iterations_per_chunk = _Num_iterations / _Num_chunks;
2388  _Index_type _Remaining_iterations = _Num_iterations % _Num_chunks;
2389 
2390  // If there are less iterations than desired chunks, set the chunk number
2391  // to be the number of iterations.
2392  if (_Iterations_per_chunk == 0)
2393  {
2394  _Num_chunks = _Remaining_iterations;
2395  }
2396 
2397  _Index_type _Work_size = 0;
2398  _Index_type _Start_iteration = 0;
2399  _Index_type _I;
2400 
2401  // Split the available work in chunks
2402  for (_I = 0; _I < _Num_chunks - 1; _I++)
2403  {
2404  if (_Remaining_iterations > 0)
2405  {
2406  // Iterations are not divided evenly, so add 1 remainder iteration each time
2407  _Work_size = _Iterations_per_chunk + 1;
2408  _Remaining_iterations--;
2409  }
2410  else
2411  {
2412  _Work_size = _Iterations_per_chunk;
2413  }
2414 
2415  // New up a task_handle "in-place", in the array preallocated on the stack
2416  new(&_Chunk_helpers[_I]) task_handle<_Worker_class>(_Worker_class(_I, _First, _Start_iteration, _Start_iteration + _Work_size, _Step, _Func, std::forward<_Partitioner>(_Part)));
2418 
2419  // Run each of the chunk tasks in parallel
2420  _Parallel_chunk_task_group_run(_Task_group, _Chunk_helpers, std::forward<_Partitioner>(_Part), _I);
2421 
2422  // Prepare for the next iteration
2423  _Start_iteration += _Work_size;
2424  }
2425 
2426  // Because this is the last iteration, then work size might be different
2427  _CONCRT_ASSERT((_Remaining_iterations == 0) || ((_Iterations_per_chunk == 0) && (_Remaining_iterations == 1)));
2428  _Work_size = _Num_iterations - _Start_iteration;
2429 
2430  // New up a task_handle "in-place", in the array preallocated on the stack
2431  new(&_Chunk_helpers[_I]) task_handle<_Worker_class>(_Worker_class(_I, _First, _Start_iteration, _Start_iteration + _Work_size, _Step, _Func, std::forward<_Partitioner>(_Part)));
2433 
2434  _Task_group.run_and_wait(_Chunk_helpers[_I]);
2435 }
void _Parallel_chunk_task_group_run(structured_task_group &_Task_group, task_handle< _Worker_class > *_Chunk_helpers, affinity_partitioner &_Part, _Index_type _I)
Definition: ppl.h:2358
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
void _IncrementConstructedElemsCount()
Definition: concrt.h:1095
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1085
#define _malloca(size)
Definition: malloc.h:228
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_chunk_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
const _Index_type &  _Step,
const _Function &  _Func 
)
2439 {
2440  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, auto_partitioner());
2441 }
template<typename _Worker_class , typename _Index_type , typename Partitioner >
void Concurrency::_Parallel_chunk_task_group_run ( structured_task_group &  _Task_group,
task_handle< _Worker_class > *  _Chunk_helpers,
const Partitioner &  ,
_Index_type  _I 
)
2353 {
2354  _Task_group.run(_Chunk_helpers[_I]);
2355 }
template<typename _Worker_class , typename _Index_type >
void Concurrency::_Parallel_chunk_task_group_run ( structured_task_group &  _Task_group,
task_handle< _Worker_class > *  _Chunk_helpers,
affinity_partitioner &  _Part,
_Index_type  _I 
)
2362 {
2363  _Task_group.run(_Chunk_helpers[_I], _Part._Get_chunk_location(static_cast<unsigned int>(_I)));
2364 }
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_for_each_chunk ( _Forward_iterator &  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
task_group &  _Task_group 
)
2813 {
2814  // The chunk size selection depends more on the internal implementation of parallel_for than
2815  // on the actual input. Also, it does not have to be dynamically computed, but it helps
2816  // parallel_for if it is a power of 2 (easy to divide).
2817  const unsigned int _Chunk_size = 1024;
2818 
2819  // This functor will be copied on the heap and will execute the chunk in parallel
2820  _Parallel_for_each_helper<_Forward_iterator, _Function, _Chunk_size> _Functor(_First, _Last, _Func);
2821 
2822  // Because this is an unstructured task group, running the task will make a copy of the necessary data
2823  // on the heap, ensuring that it is available at the time of execution.
2824  _Task_group.run(_Functor);
2825 }
_FwdIt _Last
Definition: algorithm:1936
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_for_each_forward_impl ( _Forward_iterator &  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
task_group &  _Task_group 
)
2829 {
2830  _Parallel_for_each_chunk(_First, _Last, _Func, _Task_group);
2831 
2832  // If there is a tail, push the tail
2833  if (_First != _Last)
2834  {
2835  _Task_group.run(
2836  [&_First, &_Last, &_Func, &_Task_group]
2837  {
2838  Concurrency::_Parallel_for_each_forward_impl(_First, _Last, _Func, _Task_group);
2839  }
2840  );
2841  }
2842 }
void _Parallel_for_each_chunk(_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:2812
void _Parallel_for_each_forward_impl(_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:2828
_FwdIt _Last
Definition: algorithm:1936
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_for_each_impl ( _Forward_iterator  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
const auto_partitioner &  ,
std::forward_iterator_tag   
)
2846 {
2847  // Because this is a forward iterator, it is difficult to validate that _First comes before _Last, so
2848  // it is up to the user to provide valid range.
2849  if (_First != _Last)
2850  {
2851  task_group _Task_group;
2852 
2853  _Parallel_for_each_forward_impl(_First, _Last, _Func, _Task_group);
2854 
2855  _Task_group.wait();
2856  }
2857 }
void _Parallel_for_each_forward_impl(_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:2828
_FwdIt _Last
Definition: algorithm:1936
template<typename _Random_iterator , typename _Function , typename _Partitioner >
void Concurrency::_Parallel_for_each_impl ( const _Random_iterator &  _First,
const _Random_iterator &  _Last,
const _Function &  _Func,
_Partitioner &&  _Part,
std::random_access_iterator_tag   
)
2893 {
2894  typedef typename std::iterator_traits<_Random_iterator>::difference_type _Index_type;
2895 
2896  // Exit early if there is nothing in the collection
2897  if (_First >= _Last)
2898  {
2899  return;
2900  }
2901 
2902  _Index_type _Range_size = _Last - _First;
2903 
2904  if (_Range_size == 1)
2905  {
2906  _Func(*_First);
2907  }
2908  else
2909  {
2910  _Index_type _Step = 1;
2911 
2912  _Parallel_for_each_partitioned_impl(_First, _Range_size, _Step, _Func, std::forward<_Partitioner>(_Part));
2913  }
2914 }
void _Parallel_for_each_partitioned_impl(const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, affinity_partitioner &_Part)
Definition: ppl.h:2884
_FwdIt _Last
Definition: algorithm:1936
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
const auto_partitioner &  _Part 
)
2861 {
2862  typedef _Parallel_chunk_helper<_Random_iterator, _Index_type, _Function, auto_partitioner, true> _Worker_class;
2863  // Use the same function that schedules work for parallel for
2864  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2865 }
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
const static_partitioner &  _Part 
)
2869 {
2870  typedef _Parallel_fixed_chunk_helper<_Random_iterator, _Index_type, _Function, static_partitioner, true> _Worker_class;
2871  // Use the same function that schedules work for parallel for
2872  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2873 }
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
const simple_partitioner &  _Part 
)
2877 {
2878  typedef _Parallel_fixed_chunk_helper<_Random_iterator, _Index_type, _Function, simple_partitioner, true> _Worker_class;
2879  // Use the same function that schedules work for parallel for
2880  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2881 }
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
affinity_partitioner &  _Part 
)
2885 {
2886  typedef _Parallel_localized_chunk_helper<_Random_iterator, _Index_type, _Function, true> _Worker_class;
2887  // Use the same function that schedules work for parallel for
2888  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2889 }
template<typename _Index_type , typename _Function , typename _Partitioner >
void Concurrency::_Parallel_for_impl ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func,
_Partitioner &&  _Part 
)
2478 {
2479  // The step argument must be 1 or greater; otherwise it is an invalid argument
2480  if (_Step < 1)
2481  {
2482  throw std::invalid_argument("_Step");
2483  }
2484 
2485  // If there are no elements in this range we just return
2486  if (_First >= _Last)
2487  {
2488  return;
2489  }
2490 
2491  // Compute the difference type based on the arguments and avoid signed overflow for int, long, and long long
2492  typedef typename std::tr1::conditional<std::tr1::is_same<_Index_type, int>::value, unsigned int,
2493  typename std::tr1::conditional<std::tr1::is_same<_Index_type, long>::value, unsigned long,
2494  typename std::tr1::conditional<std::tr1::is_same<_Index_type, long long>::value, unsigned long long, decltype(_Last - _First)
2495  >::type
2496  >::type
2497  >::type _Diff_type;
2498 
2499  _Diff_type _Range_size = _Diff_type(_Last) - _Diff_type(_First);
2500  _Diff_type _Diff_step = _Step;
2501 
2502  if (_Range_size <= _Diff_step)
2503  {
2504  _Func(_First);
2505  }
2506  else
2507  {
2508  _Parallel_for_partitioned_impl<_Index_type, _Diff_type, _Function>(_First, _Range_size, _Step, _Func, std::forward<_Partitioner>(_Part));
2509  }
2510 }
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
_FwdIt _Last
Definition: algorithm:1936
template<typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_impl ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func 
)
2514 {
2515  _Parallel_for_impl(_First, _Last, _Step, _Func, auto_partitioner());
2516 }
void _Parallel_for_impl(_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
Definition: ppl.h:2513
_FwdIt _Last
Definition: algorithm:1936
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
const auto_partitioner &  _Part 
)
2446 {
2447  typedef _Parallel_chunk_helper<_Index_type, _Diff_type, _Function, auto_partitioner, false> _Worker_class;
2448  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2449 }
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
const static_partitioner &  _Part 
)
2454 {
2455  typedef _Parallel_fixed_chunk_helper<_Index_type, _Diff_type, _Function, static_partitioner, false> _Worker_class;
2456  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2457 }
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
const simple_partitioner &  _Part 
)
2462 {
2463  typedef _Parallel_fixed_chunk_helper<_Index_type, _Diff_type, _Function, simple_partitioner, false> _Worker_class;
2464  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2465 }
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
affinity_partitioner &  _Part 
)
2471 {
2472  typedef _Parallel_localized_chunk_helper<_Index_type, _Diff_type, _Function, false> _Worker_class;
2473  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2474 }
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Parallel_integer_radix_sort ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
size_t  _Radix,
_Function  _Proj_func,
const size_t  _Chunk_size,
size_t  _Deep = 0 
)
4807 {
4808  // If the chunk _Size is too small, then turn to serial least-significant-byte radix sort
4809  if (_Size <= _Chunk_size || _Radix < 1)
4810  {
4811  return _Integer_radix_sort(_Begin, _Size, _Output, _Radix, _Proj_func, _Deep);
4812  }
4813 
4815  size_t _Buffer_size = sizeof(size_t) * 256 * _Threads_num;
4816  size_t _Step = _Size / _Threads_num;
4817  size_t _Remain = _Size % _Threads_num;
4818 
4820  size_t (*_Chunks)[256] = _Holder._InitOnRawMalloca(_malloca(_Buffer_size));
4821 
4822  memset(_Chunks, 0, _Buffer_size);
4823 
4824  // Our purpose is to map unsorted data in buffer "_Begin" to buffer "_Output" so that all elements who have the same
4825  // byte value in the "_Radix" position will be grouped together in the buffer "_Output"
4826  //
4827  // Serial version:
4828  // To understand this algorithm, first consider a serial version. In following example, we treat 1 digit as 1 byte, so we have a
4829  // total of 10 elements for each digit instead of 256 elements in each byte. Let's suppose "_Radix" == 1 (right most is 0), and:
4830  //
4831  // begin: [ 32 | 62 | 21 | 43 | 55 | 43 | 23 | 44 ]
4832  //
4833  // We want to divide the output buffer "_Output" into 10 chunks, and each the element in the "_Begin" buffer should be mapped into
4834  // the proper destination chunk based on its current digit (byte) indicated by "_Radix"
4835  //
4836  // Because "_Radix" == 1, after a pass of this function, the chunks in the "_Output" should look like:
4837  //
4838  // buffer: [ | | 21 23 | 32 | 43 43 44 | 55 | 62 | | | ]
4839  // 0 1 2 3 4 5 6 7 8 9
4840  //
4841  // The difficulty is determining where to insert values into the "_Output" to get the above result. The way to get the
4842  // start position of each chunk of the buffer is:
4843  // 1. Count the number of elements for each chunk (in above example, chunk0 is 0, chunk1 is 0, chunk2 is 2, chunk3 is 1 ...
4844  // 2. Make a partial sum for these chunks( in above example, we will get chunk0=chunk0=0, chunk1=chunk0+chunk1=0,
4845  // chunk2=chunk0+chunk1+chunk2=2, chunk3=chunk0+chunk1+chunk2+chunk3=3
4846  //
4847  // After these steps, we will get the end position of each chunk in the "_Output". The begin position of each chunk will be the end
4848  // point of last chunk (begin point is close but the end point is open). After that, we can scan the original array again and directly
4849  // put elements from original buffer "_Begin" into specified chunk on buffer "_Output".
4850  // Finally, we invoke _parallel_integer_radix_sort in parallel for each chunk and sort them in parallel based on the next digit (byte).
4851  // Because this is a STABLE sort algorithm, if two numbers has same key value on this byte (digit), their original order should be kept.
4852  //
4853  // Parallel version:
4854  // Almost the same as the serial version, the differences are:
4855  // 1. The count for each chunk is executed in parallel, and each thread will count one segment of the input buffer "_Begin".
4856  // The count result will be separately stored in their own chunk size counting arrays so we have a total of threads-number
4857  // of chunk count arrays.
4858  // For example, we may have chunk00, chunk01, ..., chunk09 for first thread, chunk10, chunk11, ..., chunk19 for second thread, ...
4859  // 2. The partial sum should be executed across these chunk counting arrays that belong to different threads, instead of just
4860  // making a partial sum in one counting array.
4861  // This is because we need to put values from different segments into one final buffer, and the absolute buffer position for
4862  // each chunkXX is needed.
4863  // 3. Make a parallel scan for original buffer again, and move numbers in parallel into the corresponding chunk on each buffer based
4864  // on these threads' chunk size counters.
4865 
4866  // Count in parallel and separately save their local results without reducing
4867  Concurrency::parallel_for(static_cast<size_t>(0), _Threads_num, [=](size_t _Index)
4868  {
4869  size_t _Beg_index, _End_index;
4870 
4871  // Calculate the segment position
4872  if (_Index < _Remain)
4873  {
4874  _Beg_index = _Index * (_Step + 1);
4875  _End_index = _Beg_index + (_Step + 1);
4876  }
4877  else
4878  {
4879  _Beg_index = _Remain * (_Step + 1) + (_Index - _Remain) * _Step;
4880  _End_index = _Beg_index + _Step;
4881  }
4882 
4883  // Do a counting
4884  while (_Beg_index != _End_index)
4885  {
4886  ++_Chunks[_Index][_Radix_key(_Begin[_Beg_index++], _Radix, _Proj_func)];
4887  }
4888  });
4889 
4890  int _Index = -1, _Count = 0;
4891 
4892  // Partial sum cross different threads' chunk counters
4893  for (int _I = 0; _I < 256; _I++)
4894  {
4895  size_t _Last = _I ? _Chunks[_Threads_num - 1][_I - 1] : 0;
4896  _Chunks[0][_I] += _Last;
4897 
4898  for (size_t _J = 1; _J < _Threads_num; _J++)
4899  {
4900  _Chunks[_J][_I] += _Chunks[_J - 1][_I];
4901  }
4902 
4903  // "_Chunks[_Threads_num - 1][_I] - _Last" will get the global _Size for chunk _I(including all threads local _Size for chunk _I)
4904  // this will chunk whether the chunk _I is empty or not. If it's not empty, it will be recorded.
4905  if (_Chunks[_Threads_num - 1][_I] - _Last)
4906  {
4907  ++_Count;
4908  _Index = _I;
4909  }
4910  }
4911 
4912  // If there is more than 1 chunk that has content, then continue the original algorithm
4913  if (_Count > 1)
4914  {
4915  // Move the elements in parallel into each chunk
4916  Concurrency::parallel_for(static_cast<size_t>(0), _Threads_num, [=](size_t _Index)
4917  {
4918  size_t _Beg_index, _End_index;
4919 
4920  // Calculate the segment position
4921  if (_Index < _Remain)
4922  {
4923  _Beg_index = _Index * (_Step + 1);
4924  _End_index = _Beg_index + (_Step + 1);
4925  }
4926  else
4927  {
4928  _Beg_index = _Remain * (_Step + 1) + (_Index - _Remain) * _Step;
4929  _End_index = _Beg_index + _Step;
4930  }
4931 
4932  // Do a move operation to directly put each value into its destination chunk
4933  // Chunk pointer is moved after each put operation.
4934  if (_Beg_index != _End_index--)
4935  {
4936  while (_Beg_index != _End_index)
4937  {
4938  _Output[--_Chunks[_Index][_Radix_key(_Begin[_End_index], _Radix, _Proj_func)]] = std::move(_Begin[_End_index]);
4939  --_End_index;
4940  }
4941  _Output[--_Chunks[_Index][_Radix_key(_Begin[_End_index], _Radix, _Proj_func)]] = std::move(_Begin[_End_index]);
4942  }
4943  });
4944 
4945  // Invoke _parallel_integer_radix_sort in parallel for each chunk
4946  Concurrency::parallel_for(static_cast<size_t>(0), static_cast<size_t>(256), [=](size_t _Index)
4947  {
4948  if (_Index < 256 - 1)
4949  {
4950  _Parallel_integer_radix_sort(_Output + _Chunks[0][_Index], _Chunks[0][_Index + 1] - _Chunks[0][_Index],
4951  _Begin + _Chunks[0][_Index], _Radix - 1, _Proj_func, _Chunk_size, _Deep + 1);
4952  }
4953  else
4954  {
4955  _Parallel_integer_radix_sort(_Output + _Chunks[0][_Index], _Size - _Chunks[0][_Index],
4956  _Begin + _Chunks[0][_Index], _Radix - 1, _Proj_func, _Chunk_size, _Deep + 1);
4957  }
4958  });
4959  }
4960  else
4961  {
4962  // Only one chunk has content
4963  // A special optimization is applied because one chunk means all numbers have a same value on this particular byte (digit).
4964  // Because we cannot sort them at all (they are all equal at this point), directly call _parallel_integer_radix_sort to
4965  // sort next byte (digit)
4966  _Parallel_integer_radix_sort(_Begin, _Size, _Output, _Radix - 1, _Proj_func, _Chunk_size, _Deep);
4967  }
4968 }
_W64 unsigned int size_t
Definition: crtdefs.h:496
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Parallel_integer_radix_sort(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, const size_t _Chunk_size, size_t _Deep=0)
Definition: ppl.h:4805
void _Integer_radix_sort(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, size_t _Deep=0)
Definition: ppl.h:4768
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1085
#define _malloca(size)
Definition: malloc.h:228
void parallel_for(_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func, _Partitioner &&_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2559
size_t _Radix_key(const _Ty &_Val, size_t _Radix, _Function _Proj_func)
Definition: ppl.h:4731
_Diff _Count
Definition: algorithm:1941
_Check_return_ _In_ long _Size
Definition: io.h:325
_CRTIMP _Pre_notnull_ _Post_z_ char _In_ int _Radix
Definition: stdlib.h:483
_FwdIt _Last
Definition: algorithm:1936
static _CRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Parallel_integer_sort_asc ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
_Function  _Proj_func,
const size_t  _Chunk_size 
)
4973 {
4974  typedef typename std::iterator_traits<_Random_iterator>::value_type _Value_type;
4975  // The key type of the radix sort, this must be an "unsigned integer-like" type, that is, it needs support:
4976  // operator>> (int), operator>>= (int), operator& (int), operator <, operator size_t ()
4977  typedef typename std::remove_const<typename std::remove_reference<decltype(_Proj_func(*_Begin))>::type>::type _Integer_type;
4978 
4979  // Find out the max value, which will be used to determine the highest differing byte (the radix position)
4980  _Integer_type _Max_val = Concurrency::parallel_reduce(_Begin, _Begin + _Size, _Proj_func(*_Begin),
4981  [=](_Random_iterator _Begin, _Random_iterator _End, _Integer_type _Init) -> _Integer_type
4982  {
4983  while (_Begin != _End)
4984  {
4985  _Integer_type _Ret = _Proj_func(*_Begin++);
4986  if (_Init < _Ret)
4987  {
4988  _Init = _Ret;
4989  }
4990  }
4991 
4992  return _Init;
4993  }, [](const _Integer_type &a, const _Integer_type &b) -> const _Integer_type& {return (a < b)? b : a;});
4994  size_t _Radix = 0;
4995 
4996  // Find out highest differing byte
4997  while (_Max_val >>= 8)
4998  {
4999  ++_Radix;
5000  }
5001 
5002  _Parallel_integer_radix_sort(_Begin, _Size, _Output, _Radix, _Proj_func, _Chunk_size);
5003 }
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce(_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity)
Computes the sum of all elements in a specified range by computing successive partial sums...
Definition: ppl.h:3040
void _Parallel_integer_radix_sort(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, const size_t _Chunk_size, size_t _Deep=0)
Definition: ppl.h:4805
_Check_return_ _In_ long _Size
Definition: io.h:325
_CRTIMP _Pre_notnull_ _Post_z_ char _In_ int _Radix
Definition: stdlib.h:483
template<typename _Function1 , typename _Function2 >
void Concurrency::_Parallel_invoke_impl ( const _Function1 &  _Func1,
const _Function2 &  _Func2 
)
908 {
909  structured_task_group _Task_group;
910 
911  task_handle<_Function1> _Task_handle1(_Func1);
912  _Task_group.run(_Task_handle1);
913 
914  // We inline the last item to prevent the unnecessary push/pop on the work queue.
915  task_handle<_Function2> _Task_handle2(_Func2);
916  _Task_group.run_and_wait(_Task_handle2);
917 }
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void Concurrency::_Parallel_merge ( _Random_iterator  _Begin1,
size_t  _Len1,
_Random_buffer_iterator  _Begin2,
size_t  _Len2,
_Random_output_iterator  _Output,
const _Function &  _Func,
size_t  _Div_num 
)
4705 {
4706  // Turn to serial merge or continue splitting chunks base on "_Div_num"
4707  if (_Div_num <= 1 || (_Len1 <= 1 && _Len2 <= 1))
4708  {
4709  _Merge_chunks(_Begin1, _Begin1 + _Len1, _Begin2, _Begin2 + _Len2, _Output, _Func);
4710  }
4711  else
4712  {
4713  size_t _Mid_len1 = _Len1, _Mid_len2 = _Len2;
4714  size_t _Mid = _Search_mid_point(_Begin1, _Mid_len1, _Begin2, _Mid_len2, _Func);
4715 
4716  structured_task_group _Tg;
4717  auto _Handle = make_task([&]
4718  {
4719  _Parallel_merge(_Begin1, _Mid_len1, _Begin2, _Mid_len2, _Output, _Func, _Div_num / 2);
4720  });
4721  _Tg.run(_Handle);
4722 
4723  _Parallel_merge(_Begin1 + _Mid_len1, _Len1 - _Mid_len1, _Begin2 + _Mid_len2, _Len2 - _Mid_len2, _Output + _Mid, _Func, _Div_num / 2);
4724 
4725  _Tg.wait();
4726  }
4727 }
task_handle< _Function > make_task(const _Function &_Func)
A factory method for creating a task_handle object.
Definition: ppl.h:164
void _Parallel_merge(_Random_iterator _Begin1, size_t _Len1, _Random_buffer_iterator _Begin2, size_t _Len2, _Random_output_iterator _Output, const _Function &_Func, size_t _Div_num)
Definition: ppl.h:4703
size_t _Search_mid_point(const _Random_iterator &_Begin1, size_t &_Len1, const _Random_buffer_iterator &_Begin2, size_t &_Len2, const _Function &_Func)
Definition: ppl.h:4630
void _Merge_chunks(_Random_iterator _Begin1, const _Random_iterator &_End1, _Random_buffer_iterator _Begin2, const _Random_buffer_iterator &_End2, _Random_output_iterator _Output, const _Function &_Func)
Definition: ppl.h:4675
template<typename _Random_iterator , typename _Function >
void Concurrency::_Parallel_quicksort_impl ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Function &  _Func,
size_t  _Div_num,
const size_t  _Chunk_size,
int  _Depth 
)
5007 {
5008  if (_Depth >= _SORT_MAX_RECURSION_DEPTH || _Size <= _Chunk_size || _Size <= static_cast<size_t>(3) || _Chunk_size >= _FINE_GRAIN_CHUNK_SIZE && _Div_num <= 1)
5009  {
5010  return std::sort(_Begin, _Begin + _Size, _Func);
5011  }
5012 
5013  // Determine whether we need to do a three-way quick sort
5014  // We benefit from three-way merge if there are a lot of elements that are EQUAL to the median value,
5015  // _Select_median_pivot function will test redundant density by sampling
5016  bool _Is_three_way_split = false;
5017  size_t _Mid_index = _Select_median_pivot(_Begin, _Size, _Func, _Chunk_size, _Is_three_way_split);
5018 
5019  // Move the median value to the _Begin position.
5020  if (_Mid_index)
5021  {
5022  std::swap(*_Begin, _Begin[_Mid_index]);
5023  }
5024  size_t _I = 1, _J = _Size - 1;
5025 
5026  // Three-way or two-way partition
5027  // _Div_num < _MAX_NUM_TASKS_PER_CORE is checked to make sure it will never do three-way split before splitting enough tasks
5028  if (_Is_three_way_split && _Div_num < _MAX_NUM_TASKS_PER_CORE)
5029  {
5030  while (_Func(*_Begin, _Begin[_J]))
5031  {
5032  --_J;
5033  }
5034 
5035  while (_Func(_Begin[_I], *_Begin))
5036  {
5037  ++_I;
5038  }
5039 
5040  // Starting from this point, left side of _I will less than median value, right side of _J will be greater than median value,
5041  // and the middle part will be equal to median. _K is used to scan between _I and _J
5042  size_t _K = _J;
5043  while (_I <= _K)
5044  {
5045  if (_Func(_Begin[_K], *_Begin))
5046  {
5047  std::swap(_Begin[_I++], _Begin[_K]);
5048  }
5049  else
5050  {
5051  --_K;
5052  }
5053 
5054  while (_Func(*_Begin, _Begin[_K]))
5055  {
5056  std::swap(_Begin[_K--], _Begin[_J--]);
5057  }
5058  }
5059 
5060  ++_J;
5061  }
5062  else
5063  {
5064  while (_I <= _J)
5065  {
5066  // Will stop before _Begin
5067  while (_Func(*_Begin, _Begin[_J]))
5068  {
5069  --_J;
5070  }
5071 
5072  // There must be another element equal or greater than *_Begin
5073  while (_Func(_Begin[_I], *_Begin))
5074  {
5075  ++_I;
5076  }
5077 
5078  if (_I < _J)
5079  {
5080  std::swap(_Begin[_I++], _Begin[_J--]);
5081  }
5082  else
5083  {
5084  break;
5085  }
5086  }
5087 
5088  _I = ++_J;
5089  }
5090 
5091  std::swap(*_Begin, _Begin[--_I]);
5092 
5093  structured_task_group _Tg;
5094  volatile size_t _Next_div = _Div_num / 2;
5095  auto _Handle = make_task([&]
5096  {
5097  _Parallel_quicksort_impl(_Begin + _J, _Size - _J, _Func, _Next_div, _Chunk_size, _Depth+1);
5098  });
5099  _Tg.run(_Handle);
5100 
5101  _Parallel_quicksort_impl(_Begin, _I, _Func, _Next_div, _Chunk_size, _Depth+1);
5102 
5103  // If at this point, the work hasn't been scheduled, then slow down creating new tasks
5104  if (_Div_num < _MAX_NUM_TASKS_PER_CORE)
5105  {
5106  _Next_div /= 2;
5107  }
5108 
5109  _Tg.wait();
5110 }
void _Parallel_quicksort_impl(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
Definition: ppl.h:5006
size_t _Select_median_pivot(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, const size_t _Chunk_size, bool &_Potentially_equal)
Definition: ppl.h:4613
task_handle< _Function > make_task(const _Function &_Func)
A factory method for creating a task_handle object.
Definition: ppl.h:164
#define _FINE_GRAIN_CHUNK_SIZE
Definition: ppl.h:4560
#define _SORT_MAX_RECURSION_DEPTH
Definition: ppl.h:4563
#define _MAX_NUM_TASKS_PER_CORE
Definition: ppl.h:4554
void swap(array< _Ty, _Size > &_Left, array< _Ty, _Size > &_Right) _NOEXCEPT_OP(_NOEXCEPT_OP(_Left.swap(_Right)))
Definition: array:429
_Check_return_ _In_ long _Size
Definition: io.h:325
void sort(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:3153
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_reduce_forward_executor ( _Forward_iterator  _First,
_Forward_iterator  _Last,
const _Function &  _Func,
task_group &  _Task_group 
)
3476 {
3477  const static int _Internal_worker_number = 1024, _Default_chunk_size = 512;
3478  typedef _Parallel_reduce_fixed_worker<_Forward_iterator, _Function> _Worker_class;
3479 
3480  structured_task_group _Worker_group;
3482  task_handle<_Worker_class>* _Workers = _Holder._InitOnRawMalloca(_malloca(_Internal_worker_number * sizeof(task_handle<_Worker_class>)));
3483 
3484  // Start execution first
3485  int _Index = 0;
3486  while (_Index < _Internal_worker_number && _First != _Last)
3487  {
3488  // Copy the range _Head
3489  _Forward_iterator _Head = _First;
3490 
3491  // Read from forward iterator
3492  for (size_t _I = 0; _I < _Default_chunk_size && _First != _Last; ++_I, ++_First)
3493  {
3494  // Body is empty
3495  };
3496 
3497  // Create a new task, _First is range _End
3498  new (_Workers + _Index) task_handle<_Worker_class>(_Worker_class(_Head, _First, _Func));
3500  _Worker_group.run(_Workers[_Index]);
3501  ++_Index;
3502  }
3503 
3504  // Divide and append the left
3505  while (_First != _Last)
3506  {
3507  _Task_group.run(_Parallel_reduce_forward_executor_helper<_Forward_iterator, _Function, _Internal_worker_number, _Default_chunk_size>(_First, _Last, _Func));
3508  }
3509 
3510  _Worker_group.wait();
3511 }
void _IncrementConstructedElemsCount()
Definition: concrt.h:1095
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1085
#define _malloca(size)
Definition: malloc.h:228
_FwdIt _Last
Definition: algorithm:1936
template<typename _Forward_iterator , typename _Function >
_Function::_Reduce_type Concurrency::_Parallel_reduce_impl ( _Forward_iterator  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
std::forward_iterator_tag   
)
3286 {
3287  // Because this is a forward iterator, it is difficult to validate that _First comes before _Last, so
3288  // it is up to the user to provide valid range.
3289  if (_First != _Last)
3290  {
3291  task_group _Task_group;
3292  _Parallel_reduce_forward_executor(_First, _Last, _Func, _Task_group);
3293  _Task_group.wait();
3294  return _Func._Combinable._Serial_combine_release();
3295  }
3296  else
3297  {
3298  return _Func._Identity_value;
3299  }
3300 }
_FwdIt _Last
Definition: algorithm:1936
void _Parallel_reduce_forward_executor(_Forward_iterator _First, _Forward_iterator _Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:3475
template<typename _Random_iterator , typename _Function >
_Function::_Reduce_type Concurrency::_Parallel_reduce_impl ( _Random_iterator  _First,
_Random_iterator  _Last,
const _Function &  _Func,
std::random_access_iterator_tag   
)
3311 {
3312  typedef _Parallel_reduce_fixed_worker<_Random_iterator, _Function> _Worker_class;
3313 
3314  // Special case for 0, 1 element
3315  if (_First >= _Last)
3316  {
3317  return _Func._Identity_value;
3318  }
3319  // Directly compute if size is too small
3320  else if (_Last - _First <= 1)
3321  {
3322  _Worker_class(_First, _Last, _Func)();
3323  return _Func._Combinable._Serial_combine_release();
3324  }
3325  else
3326  {
3327  // Use fixed ordered chunk partition to schedule works
3328  _Parallel_reduce_random_executor<_Worker_class>(_First, _Last, _Func);
3329  return _Func._Combinable._Serial_combine_release();
3330  }
3331 }
_FwdIt _Last
Definition: algorithm:1936
template<typename _Worker , typename _Random_iterator , typename _Function >
void Concurrency::_Parallel_reduce_random_executor ( _Random_iterator  _Begin,
_Random_iterator  _End,
const _Function &  _Fun 
)
3382 {
3383  size_t _Cpu_num = static_cast<size_t>(Concurrency::details::_CurrentScheduler::_GetNumberOfVirtualProcessors()), _Size = _End - _Begin;
3384 
3385  structured_task_group _Tg;
3387  task_handle<_Worker> *_Tasks = _Holder._InitOnRawMalloca(_malloca(sizeof(task_handle<_Worker>) * (_Cpu_num - 1)));
3388 
3389  size_t _Begin_index = 0;
3390  size_t _Step = _Size / _Cpu_num;
3391  size_t _NumRemaining = _Size - _Step * _Cpu_num;
3392 
3393  for(size_t _I = 0; _I < _Cpu_num - 1; _I++)
3394  {
3395  size_t _Next = _Begin_index + _Step;
3396 
3397  // Add remaining to each chunk
3398  if (_NumRemaining)
3399  {
3400  --_NumRemaining;
3401  ++_Next;
3402  }
3403 
3404  // New up a task_handle "in-place", in the array preallocated on the stack
3405  new (_Tasks + _I) task_handle<_Worker>(_Worker(_Begin + _Begin_index, _Begin + _Next, _Fun));
3407 
3408  // Run each of the chunk _Tasks in parallel
3409  _Tg.run(_Tasks[_I]);
3410  _Begin_index = _Next;
3411  }
3412 
3413  task_handle<_Worker> _Tail(_Worker(_Begin + _Begin_index, _End, _Fun));
3414  _Tg.run_and_wait(_Tail);
3415 }
void _IncrementConstructedElemsCount()
Definition: concrt.h:1095
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1085
#define _malloca(size)
Definition: malloc.h:228
_Check_return_ _In_ long _Size
Definition: io.h:325
static _CRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
void Concurrency::_Parallel_transform_binary_impl2 ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Input_iterator2  _First2,
_Output_iterator &  _Result,
const _Binary_operator&  _Binary_op,
task_group &  _Tg 
)
3730 {
3731  // This functor will be copied on the heap and will execute the chunk in parallel
3732  {
3733  _Parallel_transform_binary_helper<_Input_iterator1, _Input_iterator2, _Output_iterator, _Binary_operator> functor(_First1, _Last1, _First2, _Result, _Binary_op);
3734  _Tg.run(functor);
3735  }
3736 
3737  // If there is a tail, push the tail
3738  if (_First1 != _Last1)
3739  {
3740  _Tg.run(
3741  [=, &_Result, &_Binary_op, &_Tg]
3742  {
3743  _Parallel_transform_binary_impl2(_First1, _Last1, _First2, _Result, _Binary_op, _Tg);
3744  });
3745  }
3746 }
void _Parallel_transform_binary_impl2(_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator &_Result, const _Binary_operator&_Binary_op, task_group &_Tg)
Definition: ppl.h:3728
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator , typename _Partitioner >
_Output_iterator Concurrency::_Parallel_transform_unary_impl ( _Input_iterator  _First,
_Input_iterator  _Last,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
_Partitioner &&  _Part 
)
3802 {
3803  typedef typename std::iterator_traits<_Input_iterator>::iterator_category _Input_iterator_type;
3804  typedef typename std::iterator_traits<_Output_iterator>::iterator_category _Output_iterator_type;
3805 
3806  if (_First != _Last)
3807  {
3809  ::_Parallel_transform_unary_impl(_First, _Last, _Result, _Unary_op, std::forward<_Partitioner>(_Part));
3810  }
3811 
3812  return _Result;
3813 }
_FwdIt _Last
Definition: algorithm:1936
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3801
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator >
void Concurrency::_Parallel_transform_unary_impl2 ( _Input_iterator  _First,
_Input_iterator  _Last,
_Output_iterator &  _Result,
const _Unary_operator&  _Unary_op,
task_group &  _Tg 
)
3782 {
3783  // This functor will be copied on the heap and will execute the chunk in parallel
3784  {
3785  _Parallel_transform_unary_helper<_Input_iterator, _Output_iterator, _Unary_operator> functor(_First, _Last, _Result, _Unary_op);
3786  _Tg.run(functor);
3787  }
3788 
3789  // If there is a tail, push the tail
3790  if (_First != _Last)
3791  {
3792  _Tg.run(
3793  [=, &_Result, &_Unary_op, &_Tg]
3794  {
3795  _Parallel_transform_unary_impl2(_First, _Last, _Result, _Unary_op, _Tg);
3796  });
3797  }
3798 }
_FwdIt _Last
Definition: algorithm:1936
void _Parallel_transform_unary_impl2(_Input_iterator _First, _Input_iterator _Last, _Output_iterator &_Result, const _Unary_operator&_Unary_op, task_group &_Tg)
Definition: ppl.h:3780
template<typename _Ty , typename _Function >
size_t Concurrency::_Radix_key ( const _Ty &  _Val,
size_t  _Radix,
_Function  _Proj_func 
)
inline
4732 {
4733  return static_cast<size_t>(_Proj_func(_Val) >> static_cast<int>(8 * _Radix) & 255);
4734 }
_FwdIt const _Ty _Val
Definition: algorithm:1938
_CRTIMP _Pre_notnull_ _Post_z_ char _In_ int _Radix
Definition: stdlib.h:483
template<class _Type >
_Type Concurrency::_Receive_impl ( ISource< _Type > *  _Src,
unsigned int  _Timeout,
typename ITarget< _Type >::filter_method const *  _Filter_proc 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. If the specified timeout is not COOPERATIVE_TIMEOUT_INFINITE, an exception (operation_timed_out) will be thrown if the specified amount of time expires before a message is received. Note that zero length timeouts should likely use try_receive as opposed to receive with a timeout of zero as it is more efficient and does not throw exceptions on timeouts.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer to the source from which data is expected.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
_Filter_procA pointer to a filter which will indicate whether to accept the data or not.
Returns
A value from the source, of the payload type.
11814 {
11815  // The Blocking Recipient messaging block class is internal to the receive function
11816  class _Blocking_recipient : public ITarget<_Type>
11817  {
11818  public:
11819  // Create an Blocking Recipient
11820  _Blocking_recipient(ISource<_Type> * _PSource,
11821  unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE) :
11822  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
11823  {
11824  _Connect(_PSource);
11825  }
11826 
11827  // Create an Blocking Recipient
11828  _Blocking_recipient(ISource<_Type> * _PSource,
11829  filter_method const& _Filter,
11830  unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE) :
11831  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
11832  {
11833  if (_Filter != NULL)
11834  {
11835  _M_pFilter = new filter_method(_Filter);
11836  }
11837 
11838  _Connect(_PSource);
11839  }
11840 
11841  // Cleans up any resources that may have been created by the BlockingRecipient.
11842  ~_Blocking_recipient()
11843  {
11844  _Disconnect();
11845 
11846  delete _M_pFilter;
11847  delete _M_pMessage;
11848  }
11849 
11850  // Gets the value of the message sent to this BlockingRecipient. Blocks by
11851  // spinning until a message has arrived.
11852  _Type _Value()
11853  {
11854  _Wait_for_message();
11855 
11856  return _M_pMessage->payload;
11857  }
11858 
11859  // The main propagation function for ITarget blocks. Called by a source
11860  // block, generally within an asynchronous task to send messages to its targets.
11861  virtual message_status propagate(message<_Type> * _PMessage, ISource<_Type> * _PSource)
11862  {
11863  // Throw exception if the message being propagated to this block is NULL
11864  if (_PMessage == NULL)
11865  {
11866  throw std::invalid_argument("_PMessage");
11867  }
11868 
11869  if (_PSource == NULL)
11870  {
11871  throw std::invalid_argument("_PSource");
11872  }
11873 
11874  // Reject if the recipient has already received a message
11875  if (_M_fState == _Initialized)
11876  {
11877  return declined;
11878  }
11879 
11880  // Reject if the message does not meet the filter requirements
11881  if (_M_pFilter != NULL && !(*_M_pFilter)(_PMessage->payload))
11882  {
11883  return declined;
11884  }
11885 
11886  // Accept the message
11887  _CONCRT_ASSERT(_PSource != NULL);
11888  _M_pMessage = _PSource->accept(_PMessage->msg_id(), this);
11889 
11890  if (_M_pMessage != NULL)
11891  {
11892  // Set the initialized flag on this block
11893  if (_InterlockedExchange(&_M_fState, _Initialized) == _Blocked)
11894  {
11895  _M_ev.set();
11896  }
11897 
11898  return accepted;
11899  }
11900 
11901  return missed;
11902  }
11903 
11904  // Synchronously sends a message to this block. When this function completes the message will
11905  // already have propagated into the block.
11906  virtual message_status send(message<_Type> * _PMessage, ISource<_Type> * _PSource)
11907  {
11908  if (_PMessage == NULL)
11909  {
11910  throw std::invalid_argument("_PMessage");
11911  }
11912 
11913  if (_PSource == NULL)
11914  {
11915  throw std::invalid_argument("_PSource");
11916  }
11917 
11918  // Only the connected source is allowed to send messages
11919  // to the blocking recepient. Decline messages without
11920  // a source.
11921 
11922  return declined;
11923  }
11924 
11925  private:
11926 
11927  // Link a source block
11928  virtual void link_source(ISource<_Type> * _PSrc)
11929  {
11930  _M_pConnectedTo = _PSrc;
11931  _PSrc->acquire_ref(this);
11932  }
11933 
11934  // Remove a source messaging block for this BlockingRecipient
11935  virtual void unlink_source(ISource<_Type> * _PSource)
11936  {
11937  if (_InterlockedCompareExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL, _PSource) == _PSource)
11938  {
11939  _PSource->release_ref(this);
11940  }
11941  }
11942 
11943  // Remove the source messaging block for this BlockingRecipient
11944  virtual void unlink_sources()
11945  {
11946  ISource<_Type> * _PSource = reinterpret_cast<ISource<_Type> *>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL));
11947  if (_PSource != NULL)
11948  {
11949  _PSource->unlink_target(this);
11950  _PSource->release_ref(this);
11951  }
11952  }
11953 
11954 
11955  // Connect the blocking recipient to the source
11956  void _Connect(ISource<_Type> * _PSource)
11957  {
11958  if (_PSource == NULL)
11959  {
11960  throw std::invalid_argument("_PSource");
11961  }
11962 
11963  _PSource->link_target(this);
11964  }
11965 
11966  // Cleanup the connection to the blocking recipient's source. There is no need
11967  // to do anything about the associated context.
11968  void _Disconnect()
11969  {
11970  unlink_sources();
11971  }
11972 
11973  // Internal function used to block while waiting for a message to arrive
11974  // at this BlockingRecipient
11975  void _Wait_for_message()
11976  {
11977  bool _Timeout = false;
11978 
11979  // If we haven't received a message yet, cooperatively block.
11980  if (_InterlockedCompareExchange(&_M_fState, _Blocked, _NotInitialized) == _NotInitialized)
11981  {
11982  if (_M_ev.wait(_M_timeout) == COOPERATIVE_WAIT_TIMEOUT)
11983  {
11984  _Timeout = true;
11985  }
11986  }
11987 
11988  // Unlinking from our source guarantees that there are no threads in propagate
11989  _Disconnect();
11990 
11991  if (_M_fState != _Initialized)
11992  {
11993  // We had to have timed out if we came out of the wait
11994  // without being initialized.
11995  _CONCRT_ASSERT(_Timeout);
11996 
11997  throw operation_timed_out();
11998  }
11999  }
12000 
12001  // States for this block
12002  enum
12003  {
12004  _NotInitialized,
12005  _Blocked,
12006  _Initialized
12007  };
12008 
12009  volatile long _M_fState;
12010 
12011  // The source messaging block connected to this Recipient
12012  ISource<_Type> * _M_pConnectedTo;
12013 
12014  // The message that was received
12015  message<_Type> * volatile _M_pMessage;
12016 
12017  // The timeout.
12018  unsigned int _M_timeout;
12019 
12020  // The event we wait upon
12021  event _M_ev;
12022 
12023  // The filter that is called on this block before accepting a message
12024  filter_method * _M_pFilter;
12025  };
12026 
12027  if (_Filter_proc != NULL)
12028  {
12029  _Blocking_recipient _Recipient(_Src, *_Filter_proc, _Timeout);
12030  return _Recipient._Value();
12031  }
12032  else
12033  {
12034  _Blocking_recipient _Recipient(_Src, _Timeout);
12035  return _Recipient._Value();
12036  }
12037 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
The target did not accept the message.
Definition: agents.h:1750
#define NULL
Definition: crtdbg.h:30
bool send(ITarget< _Type > &_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:13371
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1739
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1760
The target accepted the message.
Definition: agents.h:1745
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
const unsigned int COOPERATIVE_TIMEOUT_INFINITE
Value indicating that a wait should never time out.
Definition: concrt.h:3538
_In_ wctype_t _Type
Definition: ctype.h:205
const size_t COOPERATIVE_WAIT_TIMEOUT
Value indicating that a wait timed out.
Definition: concrt.h:3529
long __cdecl _InterlockedCompareExchange(long volatile *, long, long)
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
size_t Concurrency::_Search_mid_point ( const _Random_iterator &  _Begin1,
size_t _Len1,
const _Random_buffer_iterator &  _Begin2,
size_t _Len2,
const _Function &  _Func 
)
4631 {
4632  size_t _Len = (_Len1 + _Len2) / 2, _Index1 = 0, _Index2 = 0;
4633 
4634  while (_Index1 < _Len1 && _Index2 < _Len2)
4635  {
4636  size_t _Mid1 = (_Index1 + _Len1) / 2, _Mid2 = (_Index2 + _Len2) / 2;
4637  if (_Func(_Begin1[_Mid1], _Begin2[_Mid2]))
4638  {
4639  if (_Mid1 + _Mid2 < _Len)
4640  {
4641  _Index1 = _Mid1 + 1;
4642  }
4643  else
4644  {
4645  _Len2 = _Mid2;
4646  }
4647  }
4648  else
4649  {
4650  if (_Mid1 + _Mid2 < _Len)
4651  {
4652  _Index2 = _Mid2 + 1;
4653  }
4654  else
4655  {
4656  _Len1 = _Mid1;
4657  }
4658  }
4659  }
4660 
4661  if (_Index1 == _Len1)
4662  {
4663  _Len2 = _Len - _Len1;
4664  }
4665  else
4666  {
4667  _Len1 = _Len - _Len2;
4668  }
4669 
4670  return _Len;
4671 }
template<typename _Random_iterator , typename _Function >
size_t Concurrency::_Select_median_pivot ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Function &  _Func,
const size_t  _Chunk_size,
bool _Potentially_equal 
)
inline
4614 {
4615  // Base on different chunk size, apply different sampling optimization
4616  if (_Chunk_size < _FINE_GRAIN_CHUNK_SIZE && _Size <= std::max<size_t>(_Chunk_size * 4, static_cast<size_t>(15)))
4617  {
4618  bool _Never_care_equal;
4619  return _Median_of_three(_Begin, 0, _Size / 2, _Size - 1, _Func, _Never_care_equal);
4620  }
4621  else
4622  {
4623  return _Median_of_nine(_Begin, _Size, _Func, _Potentially_equal);
4624  }
4625 }
#define _FINE_GRAIN_CHUNK_SIZE
Definition: ppl.h:4560
size_t _Median_of_nine(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, bool &_Potentially_equal)
Definition: ppl.h:4595
size_t _Median_of_three(const _Random_iterator &_Begin, size_t _A, size_t _B, size_t _C, const _Function &_Func, bool &_Potentially_equal)
Definition: ppl.h:4566
_Check_return_ _In_ long _Size
Definition: io.h:325
_CRTIMP void __cdecl Concurrency::_Trace_agents ( Agents_EventType  _Type,
__int64  agentId,
  ... 
)
_CRTIMP void __cdecl Concurrency::_Trace_ppl_function ( const GUID &  _Guid,
unsigned char  _Level,
ConcRT_EventType  _Type 
)
template<class _Type >
bool Concurrency::_Try_receive_impl ( ISource< _Type > *  _Src,
_Type _value,
typename ITarget< _Type >::filter_method const *  _Filter_proc 
)

Helper function that implements try_receive A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, try_receive will return false.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer to the source from which data is expected.
_valueA reference to a location where the result will be placed.
_Filter_procA pointer to a filter which will indicate whether to accept the data or not.
Returns
A bool indicating whether a payload was placed in _value or not.
12205 {
12206  // The Immediate Recipient messaging block class is internal to the receive function
12207  class _Immediate_recipient : public ITarget<_Type>
12208  {
12209  public:
12210  // Create an Immediate Recipient
12211  _Immediate_recipient(ISource<_Type> * _PSource) :
12212  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_isInitialized(0)
12213  {
12214  _Connect(_PSource);
12215  }
12216 
12217  // Create an Immediate Recipient
12218  _Immediate_recipient(ISource<_Type> * _PSource,
12219  filter_method const& _Filter) :
12220  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_isInitialized(0)
12221  {
12222  if (_Filter != NULL)
12223  {
12224  _M_pFilter = new filter_method(_Filter);
12225  }
12226 
12227  _Connect(_PSource);
12228  }
12229 
12230  // Cleans up any resources that may have been created by the ImmediateRecipient.
12231  ~_Immediate_recipient()
12232  {
12233  _Disconnect();
12234 
12235  delete _M_pFilter;
12236  delete _M_pMessage;
12237  }
12238 
12239  // Gets the value of the message sent to this ImmediateRecipient.
12240  bool _Value(_Type & _value)
12241  {
12242  // Unlinking from our source guarantees that there are no threads in propagate
12243  _Disconnect();
12244 
12245  if (_M_pMessage != NULL)
12246  {
12247  _value = _M_pMessage->payload;
12248  return true;
12249  }
12250 
12251  return false;
12252  }
12253 
12254  // The main propagation function for ITarget blocks. Called by a source
12255  // block, generally within an asynchronous task to send messages to its targets.
12256  virtual message_status propagate(message<_Type> * _PMessage, ISource<_Type> * _PSource)
12257  {
12258  message_status _Result = accepted;
12259 
12260  // Throw exception if the message being propagated to this block is NULL
12261  if (_PMessage == NULL)
12262  {
12263  throw std::invalid_argument("_PMessage");
12264  }
12265 
12266  if (_PSource == NULL)
12267  {
12268  throw std::invalid_argument("_PSource");
12269  }
12270 
12271  // Reject if the recipient has already received a message
12272  if (_M_isInitialized == 1)
12273  {
12274  return declined;
12275  }
12276 
12277  // Reject if the message does not meet the filter requirements
12278  if (_M_pFilter != NULL && !(*_M_pFilter)(_PMessage->payload))
12279  {
12280  return declined;
12281  }
12282 
12283  // Accept the message
12284  _CONCRT_ASSERT(_PSource != NULL);
12285  _M_pMessage = _PSource->accept(_PMessage->msg_id(), this);
12286 
12287  // Set the initialized flag on this block
12288 
12289  if (_M_pMessage != NULL)
12290  {
12291  // Fence to ensure that the above update to _M_pMessage is visible
12292  _InterlockedExchange(&_M_isInitialized, 1);
12293  _Result = accepted;
12294  }
12295  else
12296  {
12297  _Result = missed;
12298  }
12299 
12300  return _Result;
12301  }
12302 
12303 
12304  // Synchronously sends a message to this block. When this function completes the message will
12305  // already have propagated into the block.
12306  virtual message_status send(message<_Type> * _PMessage, ISource<_Type> * _PSource)
12307  {
12308  if (_PMessage == NULL)
12309  {
12310  throw std::invalid_argument("_PMessage");
12311  }
12312 
12313  if (_PSource == NULL)
12314  {
12315  throw std::invalid_argument("_PSource");
12316  }
12317 
12318  // Only the connected source is allowed to send messages
12319  // to the blocking recepient. Decline messages without
12320  // a source.
12321 
12322  return declined;
12323  }
12324 
12325  private:
12326 
12327  // Add a source messaging block
12328  virtual void link_source(ISource<_Type> * _PSrc)
12329  {
12330  _M_pConnectedTo = _PSrc;
12331  _PSrc->acquire_ref(this);
12332  }
12333 
12334  // Remove a source messaging block for this BlockingRecipient
12335  virtual void unlink_source(ISource<_Type> * _PSource)
12336  {
12337  if (_InterlockedCompareExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL, _PSource) == _PSource)
12338  {
12339  _PSource->release_ref(this);
12340  }
12341  }
12342 
12343  // Remove the source messaging block for this BlockingRecipient
12344  virtual void unlink_sources()
12345  {
12346  ISource<_Type> * _PSource = reinterpret_cast<ISource<_Type> *>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL));
12347  if (_PSource != NULL)
12348  {
12349  _PSource->unlink_target(this);
12350  _PSource->release_ref(this);
12351  }
12352  }
12353 
12354  // Connect to a source block
12355  void _Connect(ISource<_Type> * _PSource)
12356  {
12357  if (_PSource == NULL)
12358  {
12359  throw std::invalid_argument("_PSource");
12360  }
12361 
12362  _CONCRT_ASSERT(_M_isInitialized == 0);
12363 
12364  _PSource->link_target(this);
12365  }
12366 
12367  //
12368  // Cleanup the connection to the trigger's source. There is no need
12369  // to do anything about the associated context.
12370  //
12371  void _Disconnect()
12372  {
12373  unlink_sources();
12374  }
12375 
12376  // The source messaging block connected to this Recipient
12377  ISource<_Type> * _M_pConnectedTo;
12378 
12379  // The message that was received
12380  message<_Type> * volatile _M_pMessage;
12381 
12382  // A flag for whether or not this block has been initialized with a value
12383  volatile long _M_isInitialized;
12384 
12385  // The filter that is called on this block before accepting a message
12386  filter_method * _M_pFilter;
12387  };
12388 
12389  if (_Filter_proc != NULL)
12390  {
12391  _Immediate_recipient _Recipient(_Src, *_Filter_proc);
12392  return _Recipient._Value(_value);
12393  }
12394  else
12395  {
12396  _Immediate_recipient _Recipient(_Src);
12397  return _Recipient._Value(_value);
12398  }
12399 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
The target did not accept the message.
Definition: agents.h:1750
#define NULL
Definition: crtdbg.h:30
bool send(ITarget< _Type > &_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:13371
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1739
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1760
The target accepted the message.
Definition: agents.h:1745
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
_In_ wctype_t _Type
Definition: ctype.h:205
void Concurrency::all_memory_fence ( const tile_barrier &  _Barrier)
inline

Memory fences and tile barriers.

Ensures that memory accesses are visible to other threads in the thread tile, and are executed according to program order

Parameters
_BarrierA tile_barrier object
7147 {
7149 }
void __dp_d3d_all_memory_fence() __GPU_ONLY
_CRTIMP void* __cdecl Concurrency::Alloc ( size_t  _NumBytes)

Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator.

Parameters
_NumBytesThe number of bytes of memory to allocate.
Returns
A pointer to newly allocated memory.

For more information about which scenarios in your application could benefit from using the Caching Suballocator, see Task Scheduler (Concurrency Runtime).

See also
Concurrency::Free Function
_AMPIMP void __cdecl Concurrency::amp_uninitialize ( )

Uninitializes the C++ AMP runtime. It is legal to call this function multiple times during an applications lifetime. Calling any C++ AMP API afer calling this function will reinitialize the C++ AMP runtime. Note that it is illegal to use C++ AMP objects across calls to this function and doing so will result in undefined behavior. Also, concurrently calling this function and any other AMP APIs is illegal and would result in undefined behavior.

template<class _Type >
bool Concurrency::asend ( _Inout_ ITarget< _Type > *  _Trg,
const _Type _Data 
)

An asynchronous send operation, which schedules a task to propagate the data to the target block.

Template Parameters
_TypeThe type of the data to be sent.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted before the method returned, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, send Function
13400 {
13401  return details::_Originator::_asend(_Trg, _Data);
13402 }
template<class _Type >
bool Concurrency::asend ( ITarget< _Type > &  _Trg,
const _Type _Data 
)

An asynchronous send operation, which schedules a task to propagate the value to the target block.

Template Parameters
_TypeThe type of the data to be sent.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, send Function
13429 {
13430  return asend(&_Trg, _Data);
13431 }
bool asend(ITarget< _Type > &_Trg, const _Type &_Data)
An asynchronous send operation, which schedules a task to propagate the value to the target block...
Definition: agents.h:13428
bool Concurrency::atomic_compare_exchange ( _Inout_ int _Dest,
_Inout_ int _Expected_value,
int  _Value 
)
inline

Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest

Parameters
_DestPointer to the destination location
_Expected_valuePointer to the the value being compared to the value pointed to by _Dest. If the comparison is unsuccessful, the value is updated with the value pointed to by _Dest
_ValueThe value to be stored to the location pointed to by _Dest if the comparison is successful
Returns
If the operation is successful, return true. Otherwise, false
6744 {
6745  int _Old = *_Expected_value;
6746  unsigned int _Ret = __dp_d3d_interlocked_compare_exchange(AS_UINT_PTR(_Dest), AS_UINT(_Value), AS_UINT(_Old));
6747  if (_Ret == AS_UINT(_Old))
6748  {
6749  return true;
6750  }
6751  else
6752  {
6753  *_Expected_value = AS_INT(_Ret);
6754  return false;
6755  }
6756 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define AS_UINT(v)
Definition: amp.h:6515
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int __dp_d3d_interlocked_compare_exchange(_Inout_ unsigned int *, unsigned int, unsigned int) __GPU_ONLY
bool Concurrency::atomic_compare_exchange ( _Inout_ unsigned int _Dest,
_Inout_ unsigned int _Expected_value,
unsigned int  _Value 
)
inline

Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest

Parameters
_DestPointer to the destination location
_Expected_valuePointer to the the value being compared to the value pointed to by _Dest. If the comparison is unsuccessful, the value is updated with the value pointed to by _Dest
_ValueThe value to be stored to the location pointed to by _Dest if the comparison is successful
Returns
If the operation is successful, return true. Otherwise, false
6777 {
6778  unsigned int _Old = *_Expected_value;
6779  unsigned int _Ret = __dp_d3d_interlocked_compare_exchange(_Dest, _Value, _Old);
6780  if (_Ret == _Old)
6781  {
6782  return true;
6783  }
6784  else
6785  {
6786  *_Expected_value = _Ret;
6787  return false;
6788  }
6789 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_compare_exchange(_Inout_ unsigned int *, unsigned int, unsigned int) __GPU_ONLY
int Concurrency::atomic_exchange ( _Inout_ int _Dest,
int  _Value 
)
inline

Sets the value of location pointed to by _Dest to _Value as an atomic operation

Parameters
_DestPointer to the destination location
_ValueThe value to be set to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6685 {
6686  unsigned int _Ret = __dp_d3d_interlocked_exchange(AS_UINT_PTR(_Dest), AS_UINT(_Value));
6687  return AS_INT(_Ret);
6688 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define AS_UINT(v)
Definition: amp.h:6515
#define AS_INT(v)
Definition: amp.h:6516
unsigned int __dp_d3d_interlocked_exchange(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_exchange ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Sets the value of location pointed to by _Dest to _Value as an atomic operation

Parameters
_DestPointer to the destination location
_ValueThe value to be set to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6703 {
6704  return __dp_d3d_interlocked_exchange(_Dest, _Value);
6705 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_exchange(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
float Concurrency::atomic_exchange ( _Inout_ float *  _Dest,
float  _Value 
)
inline

Sets the value of location pointed to by _Dest to _Value as an atomic operation

Parameters
_DestPointer to the destination location
_ValueThe value to be set to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6720 {
6721  unsigned int _Ret = __dp_d3d_interlocked_exchange(AS_UINT_PTR(_Dest), AS_UINT(_Value));
6722  return AS_FLOAT(_Ret);
6723 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define AS_UINT(v)
Definition: amp.h:6515
unsigned int __dp_d3d_interlocked_exchange(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT_PTR(p)
Definition: amp.h:6514
#define AS_FLOAT(v)
Definition: amp.h:6517
int Concurrency::atomic_fetch_add ( _Inout_ int _Dest,
int  _Value 
)
inline

Performs an atomic addition of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be added to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6532 {
6533  unsigned int _Ret;
6535  return AS_INT(_Ret);
6536 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6515
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_fetch_add ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Performs an atomic addition of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be added to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6551 {
6552  return __dp_d3d_interlocked_add(_Dest, _Value);
6553 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_and ( _Inout_ int _Dest,
int  _Value 
)
inline

Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise and to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6877 {
6878  unsigned int _Ret;
6880  return AS_INT(_Ret);
6881 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define AS_UINT(v)
Definition: amp.h:6515
unsigned int __dp_d3d_interlocked_and(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_fetch_and ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise and to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6896 {
6897  return __dp_d3d_interlocked_and(_Dest, _Value);
6898 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_and(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_dec ( _Inout_ int _Dest)
inline

Performs an atomic decrement to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6642 {
6643 #pragma warning( push )
6644 #pragma warning( disable : 4146 )
6645  // Warning 4146: unary minus operator applied to unsigned type, result
6646  // still unsigned.
6647  unsigned int _Ret;
6648  _Ret = __dp_d3d_interlocked_add(AS_UINT_PTR(_Dest), (-(1U)));
6649  return AS_INT(_Ret);
6650 #pragma warning( pop )
6651 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_fetch_dec ( _Inout_ unsigned int _Dest)
inline

Performs an atomic decrement to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6663 {
6664 #pragma warning( push )
6665 #pragma warning( disable : 4146 )
6666  // Warning 4146: unary minus operator applied to unsigned type, result
6667  // still unsigned.
6668  return __dp_d3d_interlocked_add(_Dest, (-(1U)));
6669 #pragma warning( pop )
6670 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_inc ( _Inout_ int _Dest)
inline

Performs an atomic increment to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6612 {
6613  unsigned int _Ret;
6614  _Ret = __dp_d3d_interlocked_add(AS_UINT_PTR(_Dest), 1U);
6615  return AS_INT(_Ret);
6616 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_fetch_inc ( _Inout_ unsigned int _Dest)
inline

Performs an atomic increment to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6628 {
6629  return __dp_d3d_interlocked_add(_Dest, 1U);
6630 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_max ( _Inout_ int _Dest,
int  _Value 
)
inline

Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6805 {
6806  return __dp_d3d_interlocked_max_int(_Dest, _Value);
6807 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
int __dp_d3d_interlocked_max_int(_Inout_ int *, int) __GPU_ONLY
unsigned int Concurrency::atomic_fetch_max ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6823 {
6824  return __dp_d3d_interlocked_max_uint(_Dest, _Value);
6825 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_max_uint(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_min ( _Inout_ int _Dest,
int  _Value 
)
inline

Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6842 {
6843  return __dp_d3d_interlocked_min_int(_Dest, _Value);
6844 }
int __dp_d3d_interlocked_min_int(_Inout_ int *, int) __GPU_ONLY
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int Concurrency::atomic_fetch_min ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6860 {
6861  return __dp_d3d_interlocked_min_uint(_Dest, _Value);
6862 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_min_uint(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_or ( _Inout_ int _Dest,
int  _Value 
)
inline

Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise or to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6914 {
6915  unsigned int _Ret;
6917  return AS_INT(_Ret);
6918 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_or(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6515
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_fetch_or ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise or to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6933 {
6934  return __dp_d3d_interlocked_or(_Dest, _Value);
6935 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_or(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_sub ( _Inout_ int _Dest,
int  _Value 
)
inline

Performs an atomic subtraction of _Value from the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be subtracted from the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6568 {
6569  unsigned int _Ret;
6570  int _Neg = -_Value;
6571  _Ret = __dp_d3d_interlocked_add(AS_UINT_PTR(_Dest), AS_UINT(_Neg));
6572  return AS_INT(_Ret);
6573 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6515
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_fetch_sub ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Performs an atomic subtraction of _Value from the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be subtracted from the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6589 {
6590 #pragma warning( push )
6591 #pragma warning( disable : 4146 )
6592  // Warning 4146: unary minus operator applied to unsigned type, result
6593  // still unsigned.
6594  //
6595  // This is what we want here. The resulted unsigned value have the
6596  // right binary representation for achieving subtraction
6597  return __dp_d3d_interlocked_add(_Dest, (-_Value));
6598 #pragma warning( pop )
6599 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_xor ( _Inout_ int _Dest,
int  _Value 
)
inline

Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise xor to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6950 {
6951  unsigned int _Ret;
6953  return AS_INT(_Ret);
6954 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_xor(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6515
#define AS_INT(v)
Definition: amp.h:6516
#define AS_UINT_PTR(p)
Definition: amp.h:6514
unsigned int Concurrency::atomic_fetch_xor ( _Inout_ unsigned int _Dest,
unsigned int  _Value 
)
inline

Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise xor to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6969 {
6970  return __dp_d3d_interlocked_xor(_Dest, _Value);
6971 }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
unsigned int __dp_d3d_interlocked_xor(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array into the destination array.

Parameters
_SrcThe source array.
_DestThe destination array.
5977 {
5980  sizeof(_Value_type) * _Src.extent.size());
5981 
5982  _Copy_async_impl(_Src, _Dest)._Get();
5983 
5985 }
size_type size() const _NOEXCEPT
Definition: array:116
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
array< _Value_type, _Rank > &  _Dest 
)

Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array.
6026 {
6027  auto _Span_id = details::_Get_amp_trace()->_Start_copy_event_helper(nullptr,
6029  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6030 
6031  _Copy_async_impl(_SrcFirst, _SrcLast, _Dest)._Get();
6032 
6034 }
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
array< _Value_type, _Rank > &  _Dest 
)

Copies the elements beginning at _SrcFirst into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array.
6067 {
6068  InputIterator _SrcLast = _SrcFirst;
6069  std::advance(_SrcLast, _Dest.extent.size());
6070  copy(_SrcFirst, _SrcLast, _Dest);
6071 }
_OutIt copy(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2072
size_type size() const _NOEXCEPT
Definition: array:116
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:695
template<typename OutputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( const array< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Copies the contents of the array into the destination beginning at _DestIter.

Parameters
_SrcThe source array.
_DestIterAn output iterator to the beginning position at destination.
6107 {
6108  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6109 
6111  nullptr,
6112  sizeof(_Value_type) * _Src.extent.size());
6113 
6114  _Copy_async_impl(_Src, _DestIter)._Get();
6115 
6117 }
size_type size() const _NOEXCEPT
Definition: array:116
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array into the destination array_view.

Parameters
_SrcThe source array.
_DestThe destination array_view.
6152 {
6155  sizeof(_Value_type) * _Src.extent.size());
6156 
6157  _Copy_async_impl(_Src, _Dest)._Get();
6158 
6160 }
size_type size() const _NOEXCEPT
Definition: array:116
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< const _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
6195 {
6198  sizeof(_Value_type) * _Src.extent.size());
6199 
6200  _Copy_async_impl(_Src, _Dest)._Get();
6201 
6203 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
6232 {
6233  copy<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6234 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< const _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
6269 {
6272  sizeof(_Value_type) * _Src.extent.size());
6273 
6274  _Copy_async_impl(_Src, _Dest)._Get();
6275 
6277 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
6306 {
6307  copy<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6308 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array_view.
6369 {
6370  auto _Span_id = details::_Get_amp_trace()->_Start_copy_event_helper(nullptr,
6372  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6373 
6374  _Copy_async_impl(_SrcFirst, _SrcLast, _Dest)._Get();
6375 
6377 }
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of an STL container into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array_view.
6390 {
6391  InputIterator _SrcLast = _SrcFirst;
6392  std::advance(_SrcLast, _Dest.extent.size());
6393  copy(_SrcFirst, _SrcLast, _Dest);
6394 }
_OutIt copy(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2072
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:695
template<typename OutputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Copies the contents of the array_view into the destination beginning at _DestIter.

Parameters
_SrcThe source array_view.
_DestIterAn output iterator to the beginning position at destination.
6432 {
6433  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6434 
6436  nullptr,
6437  sizeof(_Value_type) * _Src.extent.size());
6438 
6439  _Copy_async_impl(_Src, _DestIter)._Get();
6440 
6442 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array into the destination array.

Parameters
_SrcThe source array.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
5957 {
5960  sizeof(_Value_type) * _Src.extent.size());
5961 
5962  auto _Ev = _Copy_async_impl(_Src, _Dest);
5963 
5964  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
5965 }
size_type size() const _NOEXCEPT
Definition: array:116
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6003 {
6004  auto _Async_op_id = details::_Get_amp_trace()->_Launch_async_copy_event_helper(nullptr,
6006  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6007 
6008  _Event _Ev = _Copy_async_impl(_SrcFirst, _SrcLast, _Dest);
6009 
6010  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6011 }
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
Definition: amprt.h:312
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements beginning at _SrcFirst into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6050 {
6051  InputIterator _SrcLast = _SrcFirst;
6052  std::advance(_SrcLast, _Dest.extent.size());
6053  return copy_async(_SrcFirst, _SrcLast, _Dest);
6054 }
size_type size() const _NOEXCEPT
Definition: array:116
concurrency::completion_future copy_async(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Asynchronously copies the contents of the array_view into the destination beginning at _DestIter...
Definition: amp.h:6408
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:695
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Asynchronously copies the contents of the array into the destination beginning at _DestIter.

Parameters
_SrcThe source array.
_DestIterAn output iterator to the beginning position at destination.
Returns
A future upon which to wait for the operation to complete.
6086 {
6087  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6088 
6090  nullptr,
6091  sizeof(_Value_type) * _Src.extent.size());
6092  _Event _Ev = _Copy_async_impl(_Src, _DestIter);
6093 
6094  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6095 }
size_type size() const _NOEXCEPT
Definition: array:116
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
Definition: amprt.h:312
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array into the destination array_view.

Parameters
_SrcThe source array.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6132 {
6135  sizeof(_Value_type) * _Src.extent.size());
6136 
6137  _Event _Ev = _Copy_async_impl(_Src, _Dest);
6138 
6139  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6140 }
size_type size() const _NOEXCEPT
Definition: array:116
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
Definition: amprt.h:312
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< const _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6175 {
6178  sizeof(_Value_type) * _Src.extent.size());
6179 
6180  _Event _Ev = _Copy_async_impl(_Src, _Dest);
6181 
6182  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6183 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
Definition: amprt.h:312
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6218 {
6219  return copy_async<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6220 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< const _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6249 {
6252  sizeof(_Value_type) * _Src.extent.size());
6253 
6254  _Event _Ev = _Copy_async_impl(_Src, _Dest);
6255 
6256  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6257 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
Definition: amprt.h:312
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6292 {
6293  return copy_async<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6294 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6326 {
6327  auto _Async_op_id = details::_Get_amp_trace()->_Launch_async_copy_event_helper(nullptr,
6329  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6330 
6331  _Event _Ev = _Copy_async_impl(_SrcFirst, _SrcLast, _Dest);
6332 
6333  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6334 }
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
Definition: amprt.h:312
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements beginning at _SrcFirst into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6350 {
6351  InputIterator _SrcLast = _SrcFirst;
6352  std::advance(_SrcLast, _Dest.extent.size());
6353  return copy_async(_SrcFirst, _SrcLast, _Dest);
6354 }
concurrency::completion_future copy_async(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Asynchronously copies the contents of the array_view into the destination beginning at _DestIter...
Definition: amp.h:6408
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:695
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Asynchronously copies the contents of the array_view into the destination beginning at _DestIter.

Parameters
_SrcThe source array_view.
_DestIterAn output iterator to the beginning position at destination.
Returns
A future upon which to wait for the operation to complete.
6409 {
6410  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6411 
6412  // Caller is responsible for passing valid _DestIter
6414  nullptr,
6415  sizeof(_Value_type) * _Src.extent.size());
6416 
6417  _Event _Ev = _Copy_async_impl(_Src, _DestIter);
6418 
6419  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6420 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5901
Definition: amprt.h:312
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
void Concurrency::direct3d_abort ( )
void Concurrency::direct3d_errorf ( const char *  ,
  ... 
)
void Concurrency::direct3d_printf ( const char *  ,
  ... 
)
_CRTIMP void __cdecl Concurrency::Free ( _Pre_maybenull_ _Post_invalid_ void _PAllocation)

Releases a block of memory previously allocated by the Alloc method to the Concurrency Runtime Caching Suballocator.

Parameters
_PAllocationA pointer to memory previously allocated by the Alloc method which is to be freed. If the parameter _PAllocation is set to the value NULL, this method will ignore it and return immediately.

For more information about which scenarios in your application could benefit from using the Caching Suballocator, see Task Scheduler (Concurrency Runtime).

See also
Concurrency::Alloc Function
std::shared_ptr< ::Concurrency::scheduler_interface> Concurrency::get_ambient_scheduler ( )
inline
65 {
66  return nullptr;
67 }
void Concurrency::global_memory_fence ( const tile_barrier &  _Barrier)
inline

Ensures that global memory accesses are visible to other threads in the thread tile, and are executed according to program order

Parameters
_BarrierA tile_barrier object
7158 {
7160 }
void __dp_d3d_device_memory_fence() __GPU_ONLY
void Concurrency::interruption_point ( )
inline

Creates an interruption point for cancellation. If a cancellation is in progress in the context where this function is called, this will throw an internal exception that aborts the execution of the currently executing parallel work. If cancellation is not in progress, the function does nothing.

You should not catch the internal cancellation exception thrown by the interruption_point() function. The exception will be caught and handled by the runtime, and catching it may cause your program to behave abnormally.

880 {
881  structured_task_group _Stg;
882  _Stg.wait();
883 }
_CRTIMP2 bool __cdecl Concurrency::is_current_task_group_canceling ( )

Returns an indication of whether the task group which is currently executing inline on the current context is in the midst of an active cancellation (or will be shortly). Note that if there is no task group currently executing inline on the current context, false will be returned.

Returns
true if the task group which is currently executing is canceling, false otherwise.

For more information, see Cancellation in the PPL.

See also
task_group Class, structured_task_group Class
bool __cdecl Concurrency::is_task_cancellation_requested ( )
inline

Returns an indication of whether the task that is currently executing has received a request to cancel its execution. Cancellation is requested on a task if the task was created with a cancellation token, and the token source associated with that token is canceled.

Returns
true if the currently executing task has received a request for cancellation, false otherwise.

If you call this method in the body of a task and it returns true, you must respond with a call to cancel_current_task to acknowledge the cancellation request, after performing any cleanup you need. This will abort the execution of the task and cause it to enter into the canceled state. If you do not respond and continue execution, or return instead of calling cancel_current_task, the task will enter the completed state when it is done. state.

A task is not cancellable if it was created without a cancellation token.

See also
task Class, cancellation_token_source Class, cancellation_token Class, cancel_current_task Function
189 {
190  return ::Concurrency::details::_TaskCollection_t::_Is_cancellation_requested();
191 }
template<typename _Type1 , typename _Type2 , typename... _Types>
choice<std::tuple<_Type1, _Type2, _Types...> > Concurrency::make_choice ( _Type1  _Item1,
_Type2  _Item2,
_Types...  _Items 
)

Constructs a choice messaging block from an optional Scheduler or ScheduleGroup and two or more input sources.

Template Parameters
_Type1The message block type of the first source.
_Type2The message block type of the second source.
_TypesThe message block types of additional sources.
Parameters
_Item1The first source.
_Item2The second source.
_ItemsAdditional sources.
Returns
A choice message block with two or more input sources.
See also
choice Class
10245 {
10246  return choice<std::tuple<_Type1, _Type2, _Types...>>(std::make_tuple(_Item1, _Item2, _Items...));
10247 }
tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:607
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join<std::tuple<_Type1, _Type2, _Types...>, greedy> Concurrency::make_greedy_join ( _Type1  _Item1,
_Type2  _Item2,
_Types...  _Items 
)

Constructs a greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources.

Template Parameters
_Type1The message block type of the first source.
_Type2The message block type of the second source.
_TypesThe message block types of additional sources.
Parameters
_Item1The first source.
_Item2The second source.
_ItemsAdditional sources.
Returns
A greedy multitype_join message block with two or more input sources.
See also
multitype_join Class
11485 {
11486  return multitype_join<std::tuple<_Type1, _Type2, _Types...>, greedy>(std::make_tuple(_Item1, _Item2, _Items...));
11487 }
tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:607
Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient...
Definition: agents.h:7433
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join<std::tuple<_Type1, _Type2, _Types...> > Concurrency::make_join ( _Type1  _Item1,
_Type2  _Item2,
_Types...  _Items 
)

Constructs a non_greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources.

Template Parameters
_Type1The message block type of the first source.
_Type2The message block type of the second source.
_TypesThe message block types of additional sources.
Parameters
_Item1The first source.
_Item2The second source.
_ItemsAdditional sources.
Returns
A non_greedy multitype_join message block with two or more input sources.
See also
multitype_join Class
11369 {
11370  return multitype_join<std::tuple<_Type1, _Type2, _Types...>>(std::make_tuple(_Item1, _Item2, _Items...));
11371 }
tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:607
template<class _Function >
task_handle<_Function> Concurrency::make_task ( const _Function &  _Func)

A factory method for creating a task_handle object.

Template Parameters
_FunctionThe type of the function object that will be invoked to execute the work represented by the task_handle object.
Parameters
_FuncThe function that will be invoked to execute the work represented by the task_handle object. This may be a lambda functor, a pointer to a function, or any object that supports a version of the function call operator with the signature void operator()().
Returns
A task_handle object.

This function is useful when you need to create a task_handle object with a lambda expression, because it allows you to create the object without knowing the true type of the lambda functor.

See also
task_handle Class, task_group Class, structured_task_group Class
165 {
166  return task_handle<_Function>(_Func);
167 }
template<int _Rank, template< int > class _Tuple_type>
bool Concurrency::operator!= ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
817 {
818  return !details::_cmp_op_loop_helper<_Tuple_type<_Rank>, details::opEq>::func(_Lhs, _Rhs);
819 }
Definition: xxamp.h:228
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator!= ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is not equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vectors are not equal; false if the concurrent vectors are equal.

Two concurrent vectors are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1768 {
1769  return !(_A == _B);
1770 }
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator% ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
903 {
904  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
905  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMod>::func(new_Tuple, _Lhs, _Rhs);
906  return new_Tuple;
907 }
Definition: xxamp.h:244
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator% ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
911 {
912  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
913  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMod>::func(new_Tuple, _Lhs, _Rhs);
914  return new_Tuple;
915 }
Definition: xxamp.h:244
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator* ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
871 {
872  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
873  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMul>::func(new_Tuple, _Lhs, _Rhs);
874  return new_Tuple;
875 }
Definition: xxamp.h:242
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator* ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
879 {
880  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
881  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMul>::func(new_Tuple, _Lhs, _Rhs);
882  return new_Tuple;
883 }
Definition: xxamp.h:242
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator+ ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
823 {
824  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
825  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opAdd>::func(new_Tuple, _Lhs, _Rhs);
826  return new_Tuple;
827 }
Definition: xxamp.h:240
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator+ ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
839 {
840  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
841  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opAdd>::func(new_Tuple, _Lhs, _Rhs);
842  return new_Tuple;
843 }
Definition: xxamp.h:240
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator+ ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
847 {
848  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
849  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opAdd>::func(new_Tuple, _Lhs, _Rhs);
850  return new_Tuple;
851 }
Definition: xxamp.h:240
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator- ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
831 {
832  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
833  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opSub>::func(new_Tuple, _Lhs, _Rhs);
834  return new_Tuple;
835 }
Definition: xxamp.h:241
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator- ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
855 {
856  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
857  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opSub>::func(new_Tuple, _Lhs, _Rhs);
858  return new_Tuple;
859 }
Definition: xxamp.h:241
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator- ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
863 {
864  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
865  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opSub>::func(new_Tuple, _Lhs, _Rhs);
866  return new_Tuple;
867 }
Definition: xxamp.h:241
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator/ ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
887 {
888  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
889  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opDiv>::func(new_Tuple, _Lhs, _Rhs);
890  return new_Tuple;
891 }
Definition: xxamp.h:243
template<int _Rank, template< int > class _Tuple_type>
_Tuple_type<_Rank> Concurrency::operator/ ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
895 {
896  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
897  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opDiv>::func(new_Tuple, _Lhs, _Rhs);
898  return new_Tuple;
899 }
Definition: xxamp.h:243
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator< ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is less than the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is less than the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1806 {
1807  return (std::lexicographical_compare(_A.begin(), _A.end(), _B.begin(), _B.end()));
1808 }
bool lexicographical_compare(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2)
Definition: memory:830
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator<= ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is less than or equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is less than or equal to the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1882 {
1883  return !(_B < _A);
1884 }
template<int _Rank, template< int > class _Tuple_type>
bool Concurrency::operator== ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
811 {
812  return details::_cmp_op_loop_helper<_Tuple_type<_Rank>, details::opEq>::func(_Lhs, _Rhs);
813 }
Definition: xxamp.h:228
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator== ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is equal to the concurrent vector on the right side of the operator; otherwise false.

Two concurrent vectors are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1721 {
1722  // Simply: return _A.size() == _B.size() && std::equal(_A.begin(), _A.end(), _B.begin());
1723  if(_A.size() != _B.size())
1724  return false;
1725  typename concurrent_vector<_Ty, A1>::const_iterator _I(_A.begin());
1726  typename concurrent_vector<_Ty, A2>::const_iterator _J(_B.begin());
1727  for(; _I != _A.end(); ++_I, ++_J)
1728  {
1729  if( !(*_I == *_J) )
1730  return false;
1731  }
1732  return true;
1733 }
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator> ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is greater than the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is greater than the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1844 {
1845  return _B < _A;
1846 }
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator>= ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is greater than or equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is greater than or equal to the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1920 {
1921  return !(_A < _B);
1922 }
template<typename _Random_iterator >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5358 {
5359  parallel_buffered_sort<std::allocator<typename std::iterator_traits<_Random_iterator>::value_type>>(_Begin, _End,
5360  std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5361 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5394 {
5395  parallel_buffered_sort<_Allocator>(_Begin, _End,
5396  std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5397 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_buffered_sort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5433 {
5434  parallel_buffered_sort<_Allocator>(_Alloc, _Begin, _End, std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5435 }
template<typename _Random_iterator , typename _Function >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparator.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe mimimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5476 {
5477  parallel_buffered_sort<std::allocator<typename std::iterator_traits<_Random_iterator>::value_type>>(_Begin, _End, _Func, _Chunk_size);
5478 }
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparator.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe mimimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5522 {
5523  _Allocator _Alloc;
5524  return parallel_buffered_sort<_Allocator, _Random_iterator, _Function>(_Alloc, _Begin, _End, _Func, _Chunk_size);
5525 }
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_buffered_sort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparator.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe mimimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5572 {
5573  _CONCRT_ASSERT(_Chunk_size > 0);
5574 
5575  // Check cancellation before the algorithm starts.
5577 
5578  size_t _Size = _End - _Begin;
5580 
5581  if (_Size <= _Chunk_size || _Core_num < 2)
5582  {
5583  return std::sort(_Begin, _End, _Func);
5584  }
5585  const static size_t CORE_NUM_MASK = 0x55555555;
5586 
5587  _AllocatedBufferHolder<_Allocator> _Holder(_Size, _Alloc);
5588 
5589  // Prevent cancellation from happening during the algorithm in case it leaves buffers in unknown state.
5591  // This buffered sort algorithm will divide chunks and apply parallel quicksort on each chunk. In the end, it will
5592  // apply parallel merge to these sorted chunks.
5593  //
5594  // We need to decide on the number of chunks to divide the input buffer into. If we divide it into n chunks, log(n)
5595  // merges will be needed to get the final sorted result. In this algorithm, we have two buffers for each merge
5596  // operation, let's say buffer A and B. Buffer A is the original input array, buffer B is the additional allocated
5597  // buffer. Each turn's merge will put the merge result into the other buffer; for example, if we decided to split
5598  // into 8 chunks in buffer A at very beginning, after one pass of merging, there will be 4 chunks in buffer B.
5599  // If we apply one more pass of merging, there will be 2 chunks in buffer A again.
5600  //
5601  // The problem is we want to the final merge pass to put the result back in buffer A, so that we don't need
5602  // one extra copy to put the sorted data back to buffer A.
5603  // To make sure the final result is in buffer A (original input array), we need an even number of merge passes,
5604  // which means log(n) must be an even number. Thus n must be a number power(2, even number). For example, when the
5605  // even number is 2, n is power(2, 2) = 4, when even number is 4, n is power(2, 4) = 16. When we divide chunks
5606  // into these numbers, the final merge result will be in the original input array. Now we need to decide the chunk(split)
5607  // number based on this property and the number of cores.
5608  //
5609  // We want to get a chunk (split) number close to the core number (or a little more than the number of cores),
5610  // and it also needs to satisfy above property. For a 8 core machine, the best chunk number should be 16, because it's
5611  // the smallest number that satisfies the above property and is bigger than the core number (so that we can utilize all
5612  // cores, a little more than core number is OK, we need to split more tasks anyway).
5613  //
5614  // In this algorithm, we will make this alignment by bit operations (it's easy and clear). For a binary representation,
5615  // all the numbers that satisfy power(2, even number) will be 1, 100, 10000, 1000000, 100000000 ...
5616  // After OR-ing these numbers together, we will get a mask (... 0101 0101 0101) which is all possible combinations of
5617  // power(2, even number). We use _Core_num & CORE_NUM_MASK | _Core_num << 1 & CORE_NUM_MASK, a bit-wise operation to align
5618  // _Core_num's highest bit into a power(2, even number).
5619  //
5620  // It means if _Core_num = 8, the highest bit in binary is bin(1000) which is not power(2, even number). After this
5621  // bit-wise operation, it will align to bin(10000) = 16 which is power(2, even number). If the _Core_num = 16, after
5622  // alignment it still returns 16. The trick is to make sure the highest bit of _Core_num will align to the "1" bit of the
5623  // mask bin(... 0101 0101 0101) We don't care about the other bits on the aligned result except the highest bit, because they
5624  // will be ignored in the function.
5625  _Parallel_buffered_sort_impl(_Begin, _Size, stdext::make_unchecked_array_iterator(_Holder._Get_buffer()),
5626  _Func, _Core_num & CORE_NUM_MASK | _Core_num << 1 & CORE_NUM_MASK, _Chunk_size);
5627  }, cancellation_token::none());
5628 
5629 }
unchecked_array_iterator< _Iterator > make_unchecked_array_iterator(_Iterator _Ptr)
Definition: iterator:729
void run_with_cancellation_token(const _Function &_Func, cancellation_token _Ct)
Executes a function object immediately and synchronously in the context of a given cancellation token...
Definition: ppl.h:864
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
void interruption_point()
Creates an interruption point for cancellation. If a cancellation is in progress in the context where...
Definition: ppl.h:879
bool _Parallel_buffered_sort_impl(const _Random_iterator &_Begin, size_t _Size, _Random_buffer_iterator _Output, const _Function &_Func, int _Div_num, const size_t _Chunk_size)
Definition: ppl.h:5117
_Check_return_ _In_ long _Size
Definition: io.h:325
void sort(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:3153
static _CRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
template<typename _Index_type , typename _Function , typename _Partitioner >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func,
_Partitioner &&  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
_PartitionerThe type of the partitioner that is used to partition the supplied range.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_StepThe value by which to step when iterating from _First to _Last . The step must be positive. invalid_argument is thrown if the step is less than 1.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2560 {
2562  _Parallel_for_impl(_First, _Last, _Step, _Func, std::forward<_Partitioner>(_Part));
2564 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
void _Parallel_for_impl(_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
Definition: ppl.h:2513
_FwdIt _Last
Definition: algorithm:1936
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration. _Index_type must be an integral type.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_StepThe value by which to step when iterating from _First to _Last . The step must be positive. invalid_argument is thrown if the step is less than 1.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).

For more information, see Parallel Algorithms.

2596 {
2597  parallel_for(_First, _Last, _Step, _Func, auto_partitioner());
2598 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2751
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
const auto_partitioner &  _Part = auto_partitioner() 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2635 {
2636  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2637 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2751
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
const static_partitioner &  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2674 {
2675  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2676 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2751
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
const simple_partitioner &  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2713 {
2714  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2715 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2751
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
affinity_partitioner &  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2752 {
2753  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2754 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2751
template<typename _Iterator , typename _Function >
void Concurrency::parallel_for_each ( _Iterator  _First,
_Iterator  _Last,
const _Function &  _Func 
)

parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over.

Template Parameters
_IteratorThe type of the iterator being used to iterate over the container.
_FunctionThe type of the function that will be applied to each element within the range.
Parameters
_FirstAn iterator addressing the position of the first element to be included in parallel iteration.
_LastAn iterator addressing the position one past the final element to be included in parallel iteration.
_FuncA user-defined function object that is applied to each element in the range.

auto_partitioner

will be used for the overload without an explicit partitioner.

For iterators that do not support random access, only auto_partitioner

is supported.

For more information, see Parallel Algorithms.

2946 {
2947  parallel_for_each(_First, _Last, _Func, auto_partitioner());
2948 }
void parallel_for_each(_Iterator _First, _Iterator _Last, const _Function &_Func, _Partitioner &&_Part)
parallel_for_each applies a specified function to each element within a range, in parallel...
Definition: ppl.h:2988
_FwdIt _Last
Definition: algorithm:1936
template<typename _Iterator , typename _Function , typename _Partitioner >
void Concurrency::parallel_for_each ( _Iterator  _First,
_Iterator  _Last,
const _Function &  _Func,
_Partitioner &&  _Part 
)

parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over.

Template Parameters
_IteratorThe type of the iterator being used to iterate over the container.
_FunctionThe type of the function that will be applied to each element within the range.
Parameters
_FirstAn iterator addressing the position of the first element to be included in parallel iteration.
_LastAn iterator addressing the position one past the final element to be included in parallel iteration.
_FuncA user-defined function object that is applied to each element in the range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

auto_partitioner

will be used for the overload without an explicit partitioner.

For iterators that do not support random access, only auto_partitioner

is supported.

For more information, see Parallel Algorithms.

2989 {
2990  _Trace_ppl_function(PPLParallelForeachEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
2991  _Parallel_for_each_impl(_First, _Last, _Func, std::forward<_Partitioner>(_Part), std::_Iter_cat(_First));
2992  _Trace_ppl_function(PPLParallelForeachEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
2993 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
void _Parallel_for_each_impl(const _Random_iterator &_First, const _Random_iterator &_Last, const _Function &_Func, _Partitioner &&_Part, std::random_access_iterator_tag)
Definition: ppl.h:2892
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
iterator_traits< _Iter >::iterator_category _Iter_cat(const _Iter &)
Definition: xutility:404
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
_FwdIt _Last
Definition: algorithm:1936
template<int _Rank, typename _Kernel_type >
void Concurrency::parallel_for_each ( const extent< _Rank > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain on an accelerator_view. The accelerator_view is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator_view can be derived, the default is chosen.

Parameters
_Compute_domainAn extent which represents the set of indices that form the compute domain.
_KernelA function object that takes an argument of type "index&lt;_Rank&gt;" which performs the parallel computation.
6989 {
6990  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
6991  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
6992 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void Concurrency::parallel_for_each ( const tiled_extent< _Dim0, _Dim1, _Dim2 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen.

Parameters
_Compute_domainA tiled_extent<_Dim0,_Dim1,_Dim2> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1,_Dim2&gt;" which performs the parallel computation.
7006 {
7007  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
7008  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7009 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, typename _Kernel_type >
void Concurrency::parallel_for_each ( const tiled_extent< _Dim0, _Dim1 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen.

Parameters
_Compute_domainA tiled_extent<_Dim0,_Dim1> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1&gt;" which performs the parallel computation.
7023 {
7024  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
7025  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7026 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, typename _Kernel_type >
void Concurrency::parallel_for_each ( const tiled_extent< _Dim0 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen.

Parameters
_Compute_domainA tiled_extent<_Dim0> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0&gt;" which performs the parallel computation.
7040 {
7041  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
7042  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7043 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Rank, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const extent< _Rank > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain on an accelerator.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainAn extent which represents the set of indices that form the compute domain.
_KernelA function object that takes an argument of type "index&lt;_Rank&gt;" which performs the parallel computation.
7058 {
7059  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7060  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7061 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const tiled_extent< _Dim0, _Dim1, _Dim2 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainA tiled_extent<_Dim0,_Dim1,_Dim2> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1,_Dim2&gt;" which performs the parallel computation.
7077 {
7078  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7079  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7080 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const tiled_extent< _Dim0, _Dim1 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainA tiled_extent<_Dim0,_Dim1> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1&gt;" which performs the parallel computation.
7096 {
7097  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7098  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7099 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const tiled_extent< _Dim0 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainA tiled_extent<_Dim0> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0&gt;" which performs the parallel computation.
7115 {
7116  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7117  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7118 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<typename _Function1 , typename _Function2 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

945 {
947 
948  _Parallel_invoke_impl(_Func1, _Func2);
949 
950  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
951 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
void _Parallel_invoke_impl(const _Function1 &_Func1, const _Function2 &_Func2)
Definition: ppl.h:907
template<typename _Function1 , typename _Function2 , typename _Function3 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

985 {
987 
988  structured_task_group _Task_group;
989 
990  task_handle<_Function1> _Task_handle1(_Func1);
991  _Task_group.run(_Task_handle1);
992 
993  task_handle<_Function2> _Task_handle2(_Func2);
994  _Task_group.run(_Task_handle2);
995 
996  task_handle<_Function3> _Task_handle3(_Func3);
997  _Task_group.run_and_wait(_Task_handle3);
998 
999  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1000 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1040 {
1041  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
1042 
1043  structured_task_group _Task_group;
1044 
1045  task_handle<_Function1> _Task_handle1(_Func1);
1046  _Task_group.run(_Task_handle1);
1047 
1048  task_handle<_Function2> _Task_handle2(_Func2);
1049  _Task_group.run(_Task_handle2);
1050 
1051  task_handle<_Function3> _Task_handle3(_Func3);
1052  _Task_group.run(_Task_handle3);
1053 
1054  task_handle<_Function4> _Task_handle4(_Func4);
1055  _Task_group.run_and_wait(_Task_handle4);
1056 
1057  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1058 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1104 {
1105  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
1106 
1107  structured_task_group _Task_group;
1108 
1109  task_handle<_Function1> _Task_handle1(_Func1);
1110  _Task_group.run(_Task_handle1);
1111 
1112  task_handle<_Function2> _Task_handle2(_Func2);
1113  _Task_group.run(_Task_handle2);
1114 
1115  task_handle<_Function3> _Task_handle3(_Func3);
1116  _Task_group.run(_Task_handle3);
1117 
1118  task_handle<_Function4> _Task_handle4(_Func4);
1119  _Task_group.run(_Task_handle4);
1120 
1121  task_handle<_Function5> _Task_handle5(_Func5);
1122  _Task_group.run_and_wait(_Task_handle5);
1123 
1124  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1125 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1179 {
1180  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
1181 
1182  structured_task_group _Task_group;
1183 
1184  task_handle<_Function1> _Task_handle1(_Func1);
1185  _Task_group.run(_Task_handle1);
1186 
1187  task_handle<_Function2> _Task_handle2(_Func2);
1188  _Task_group.run(_Task_handle2);
1189 
1190  task_handle<_Function3> _Task_handle3(_Func3);
1191  _Task_group.run(_Task_handle3);
1192 
1193  task_handle<_Function4> _Task_handle4(_Func4);
1194  _Task_group.run(_Task_handle4);
1195 
1196  task_handle<_Function5> _Task_handle5(_Func5);
1197  _Task_group.run(_Task_handle5);
1198 
1199  task_handle<_Function6> _Task_handle6(_Func6);
1200  _Task_group.run_and_wait(_Task_handle6);
1201 
1202  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1203 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1263 {
1264  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
1265 
1266  structured_task_group _Task_group;
1267 
1268  task_handle<_Function1> _Task_handle1(_Func1);
1269  _Task_group.run(_Task_handle1);
1270 
1271  task_handle<_Function2> _Task_handle2(_Func2);
1272  _Task_group.run(_Task_handle2);
1273 
1274  task_handle<_Function3> _Task_handle3(_Func3);
1275  _Task_group.run(_Task_handle3);
1276 
1277  task_handle<_Function4> _Task_handle4(_Func4);
1278  _Task_group.run(_Task_handle4);
1279 
1280  task_handle<_Function5> _Task_handle5(_Func5);
1281  _Task_group.run(_Task_handle5);
1282 
1283  task_handle<_Function6> _Task_handle6(_Func6);
1284  _Task_group.run(_Task_handle6);
1285 
1286  task_handle<_Function7> _Task_handle7(_Func7);
1287  _Task_group.run_and_wait(_Task_handle7);
1288 
1289  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1290 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7,
const _Function8 &  _Func8 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
_Function8The type of the eighth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.
_Func8The eighth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1356 {
1357  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
1358 
1359  structured_task_group _Task_group;
1360 
1361  task_handle<_Function1> _Task_handle1(_Func1);
1362  _Task_group.run(_Task_handle1);
1363 
1364  task_handle<_Function2> _Task_handle2(_Func2);
1365  _Task_group.run(_Task_handle2);
1366 
1367  task_handle<_Function3> _Task_handle3(_Func3);
1368  _Task_group.run(_Task_handle3);
1369 
1370  task_handle<_Function4> _Task_handle4(_Func4);
1371  _Task_group.run(_Task_handle4);
1372 
1373  task_handle<_Function5> _Task_handle5(_Func5);
1374  _Task_group.run(_Task_handle5);
1375 
1376  task_handle<_Function6> _Task_handle6(_Func6);
1377  _Task_group.run(_Task_handle6);
1378 
1379  task_handle<_Function7> _Task_handle7(_Func7);
1380  _Task_group.run(_Task_handle7);
1381 
1382  task_handle<_Function8> _Task_handle8(_Func8);
1383  _Task_group.run_and_wait(_Task_handle8);
1384 
1385  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1386 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7,
const _Function8 &  _Func8,
const _Function9 &  _Func9 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
_Function8The type of the eighth function object to be executed in parallel.
_Function9The type of the ninth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.
_Func8The eighth function object to be executed in parallel.
_Func9The ninth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1458 {
1459  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
1460 
1461  structured_task_group _Task_group;
1462 
1463  task_handle<_Function1> _Task_handle1(_Func1);
1464  _Task_group.run(_Task_handle1);
1465 
1466  task_handle<_Function2> _Task_handle2(_Func2);
1467  _Task_group.run(_Task_handle2);
1468 
1469  task_handle<_Function3> _Task_handle3(_Func3);
1470  _Task_group.run(_Task_handle3);
1471 
1472  task_handle<_Function4> _Task_handle4(_Func4);
1473  _Task_group.run(_Task_handle4);
1474 
1475  task_handle<_Function5> _Task_handle5(_Func5);
1476  _Task_group.run(_Task_handle5);
1477 
1478  task_handle<_Function6> _Task_handle6(_Func6);
1479  _Task_group.run(_Task_handle6);
1480 
1481  task_handle<_Function7> _Task_handle7(_Func7);
1482  _Task_group.run(_Task_handle7);
1483 
1484  task_handle<_Function8> _Task_handle8(_Func8);
1485  _Task_group.run(_Task_handle8);
1486 
1487  task_handle<_Function9> _Task_handle9(_Func9);
1488  _Task_group.run_and_wait(_Task_handle9);
1489 
1490  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1491 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 , typename _Function10 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7,
const _Function8 &  _Func8,
const _Function9 &  _Func9,
const _Function10 &  _Func10 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
_Function8The type of the eighth function object to be executed in parallel.
_Function9The type of the ninth function object to be executed in parallel.
_Function10The type of the tenth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.
_Func8The eighth function object to be executed in parallel.
_Func9The ninth function object to be executed in parallel.
_Func10The tenth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1569 {
1570  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_START);
1571 
1572  structured_task_group _Task_group;
1573 
1574  task_handle<_Function1> _Task_handle1(_Func1);
1575  _Task_group.run(_Task_handle1);
1576 
1577  task_handle<_Function2> _Task_handle2(_Func2);
1578  _Task_group.run(_Task_handle2);
1579 
1580  task_handle<_Function3> _Task_handle3(_Func3);
1581  _Task_group.run(_Task_handle3);
1582 
1583  task_handle<_Function4> _Task_handle4(_Func4);
1584  _Task_group.run(_Task_handle4);
1585 
1586  task_handle<_Function5> _Task_handle5(_Func5);
1587  _Task_group.run(_Task_handle5);
1588 
1589  task_handle<_Function6> _Task_handle6(_Func6);
1590  _Task_group.run(_Task_handle6);
1591 
1592  task_handle<_Function7> _Task_handle7(_Func7);
1593  _Task_group.run(_Task_handle7);
1594 
1595  task_handle<_Function8> _Task_handle8(_Func8);
1596  _Task_group.run(_Task_handle8);
1597 
1598  task_handle<_Function9> _Task_handle9(_Func9);
1599  _Task_group.run(_Task_handle9);
1600 
1601  task_handle<_Function10> _Task_handle10(_Func10);
1602  _Task_group.run_and_wait(_Task_handle10);
1603 
1604  _Trace_ppl_function(PPLParallelInvokeEventGuid, _TRACE_LEVEL_INFORMATION, CONCRT_EVENT_END);
1605 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5611
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:37
_CRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5606
template<typename _Random_iterator >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. An unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5694 {
5695  typedef typename std::iterator_traits<_Random_iterator>::value_type _DataType;
5696 
5697  _Radix_sort_default_function<_DataType> _Proj_func;
5698 
5699  parallel_radixsort<std::allocator<_DataType>>(_Begin, _End, _Proj_func, 256 * 256);
5700 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. An unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5732 {
5733  _Allocator _Alloc;
5734  return parallel_radixsort<_Allocator, _Random_iterator>(_Alloc, _Begin, _End);
5735 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_radixsort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. An unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5770 {
5771  typedef typename std::iterator_traits<_Random_iterator>::value_type _DataType;
5772 
5773  _Radix_sort_default_function<_DataType> _Proj_func;
5774 
5775  parallel_radixsort<_Allocator>(_Alloc, _Begin, _End, _Proj_func);
5776 }
template<typename _Random_iterator , typename _Function >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Proj_func,
const size_t  _Chunk_size = 256 * 256 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the projection function.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_Proj_funcA user-defined projection function object that converts an element into an integral value.
_Chunk_sizeThe mimimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. An unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5814 {
5815  parallel_radixsort<std::allocator<typename std::iterator_traits<_Random_iterator>::value_type>>(
5816  _Begin, _End, _Proj_func, _Chunk_size);
5817 }
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Proj_func,
const size_t  _Chunk_size = 256 * 256 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the projection function.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_Proj_funcA user-defined projection function object that converts an element into an integral value.
_Chunk_sizeThe mimimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. An unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5858 {
5859  _Allocator _Alloc;
5860  return parallel_radixsort<_Allocator, _Random_iterator, _Function>(_Alloc, _Begin, _End, _Proj_func, _Chunk_size);
5861 }
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_radixsort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Proj_func,
const size_t  _Chunk_size = 256 * 256 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the projection function.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_Proj_funcA user-defined projection function object that converts an element into an integral value.
_Chunk_sizeThe mimimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. An unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5905 {
5906  _CONCRT_ASSERT(_Chunk_size > 0);
5907 
5908  // Check for cancellation before the algorithm starts.
5910 
5911  size_t _Size = _End - _Begin;
5912 
5913  // If _Size <= 1, no more sorting needs to be done.
5914  if (_Size <= 1)
5915  {
5916  return;
5917  }
5918 
5919  _AllocatedBufferHolder<_Allocator> _Holder(_Size, _Alloc);
5920 
5921  // Prevent cancellation from happening during the algorithm in case it leaves the buffers in unknown state.
5923  _Parallel_integer_sort_asc(_Begin, _Size, stdext::make_unchecked_array_iterator(_Holder._Get_buffer()), _Proj_func, _Chunk_size);
5924  }, cancellation_token::none());
5925 }
void _Parallel_integer_sort_asc(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, _Function _Proj_func, const size_t _Chunk_size)
Definition: ppl.h:4971
unchecked_array_iterator< _Iterator > make_unchecked_array_iterator(_Iterator _Ptr)
Definition: iterator:729
void run_with_cancellation_token(const _Function &_Func, cancellation_token _Ct)
Executes a function object immediately and synchronously in the context of a given cancellation token...
Definition: ppl.h:864
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
void interruption_point()
Creates an interruption point for cancellation. If a cancellation is in progress in the context where...
Definition: ppl.h:879
_Check_return_ _In_ long _Size
Definition: io.h:325
template<typename _Forward_iterator >
std::iterator_traits<_Forward_iterator>::value_type Concurrency::parallel_reduce ( _Forward_iterator  _Begin,
_Forward_iterator  _End,
const typename std::iterator_traits< _Forward_iterator >::value_type &  _Identity 
)
inline

Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value.

Template Parameters
_Forward_iteratorThe iterator type of input range.
Parameters
_BeginAn input iterator addressing the first element in the range to be reduced.
_EndAn input iterator addressing the element that is one position beyond the final element in the range to be reduced.
_IdentityThe identity value _Identity is of the same type as the result type of the reduction and also the value_type of the iterator for the first and second overloads. For the third overload, the identity value must have the same type as the result type of the reduction, but can be different from the value_type of the iterator. It must have an appropriate value such that the range reduction operator _Range_fun , when applied to a range of a single element of type value_type and the identity value, behaves like a type cast of the value from type value_type to the identity type.
Returns
The result of the reduction.

To perform a parallel reduction, the function divides the range into chunks based on the number of workers available to the underlying scheduler. The reduction takes place in two phases, the first phase performs a reduction within each chunk, and the second phase performs a reduction between the partial results from each chunk.

The first overload requires that the iterator's value_type, T, be the same as the identity value type as well as the reduction result type. The element type T must provide the operator T T::operator + (T) to reduce elements in each chunk. The same operator is used in the second phase as well.

The second overload also requires that the iterator's value_type be the same as the identity value type as well as the reduction result type. The supplied binary operator _Sym_fun is used in both reduction phases, with the identity value as the initial value for the first phase.

For the third overload, the identity value type must be the same as the reduction result type, but the iterator's value_type may be different from both. The range reduction function _Range_fun is used in the first phase with the identity value as the initial value, and the binary function _Sym_reduce_fun is applied to sub results in the second phase.

3042 {
3043  return parallel_reduce(_Begin, _End, _Identity, std::plus<typename std::iterator_traits<_Forward_iterator>::value_type>());
3044 }
_Reduce_type parallel_reduce(_Forward_iterator _Begin, _Forward_iterator _End, const _Reduce_type &_Identity, const _Range_reduce_fun &_Range_fun, const _Sym_reduce_fun &_Sym_fun)
Computes the sum of all elements in a specified range by computing successive partial sums...
Definition: ppl.h:3177
Definition: xtr1common:380
template<typename _Forward_iterator , typename _Sym_reduce_fun >
std::iterator_traits<_Forward_iterator>::value_type Concurrency::parallel_reduce ( _Forward_iterator  _Begin,
_Forward_iterator  _End,
const typename std::iterator_traits< _Forward_iterator >::value_type &  _Identity,
_Sym_reduce_fun  _Sym_fun 
)
inline

Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value.

Template Parameters
_Forward_iteratorThe iterator type of input range.
_Sym_reduce_funThe type of the symmetric reduction function. This must be a function type with signature _Reduce_type _Sym_fun(_Reduce_type, _Reduce_type), where _Reduce_type is the same as the identity type and the result type of the reduction. For the third overload, this should be consistent with the output type of _Range_reduce_fun.
Parameters
_BeginAn input iterator addressing the first element in the range to be reduced.
_EndAn input iterator addressing the element that is one position beyond the final element in the range to be reduced.
_IdentityThe identity value _Identity is of the same type as the result type of the reduction and also the value_type of the iterator for the first and second overloads. For the third overload, the identity value must have the same type as the result type of the reduction, but can be different from the value_type of the iterator. It must have an appropriate value such that the range reduction operator _Range_fun , when applied to a range of a single element of type value_type and the identity value, behaves like a type cast of the value from type value_type to the identity type.
_Sym_funThe symmetric function that will be used in the second of the reduction. Refer to Remarks for more information.
Returns
The result of the reduction.

To perform a parallel reduction, the function divides the range into chunks based on the number of workers available to the underlying scheduler. The reduction takes place in two phases, the first phase performs a reduction within each chunk, and the second phase performs a reduction between the partial results from each chunk.

The first overload requires that the iterator's value_type, T, be the same as the identity value type as well as the reduction result type. The element type T must provide the operator T T::operator + (T) to reduce elements in each chunk. The same operator is used in the second phase as well.

The second overload also requires that the iterator's value_type be the same as the identity value type as well as the reduction result type. The supplied binary operator _Sym_fun is used in both reduction phases, with the identity value as the initial value for the first phase.

For the third overload, the identity value type must be the same as the reduction result type, but the iterator's value_type may be different from both. The range reduction function _Range_fun is used in the first phase with the identity value as the initial value, and the binary function _Sym_reduce_fun is applied to sub results in the second phase.

3096 {
3097  typedef typename std::remove_cv<typename std::iterator_traits<_Forward_iterator>::value_type>::type _Reduce_type;
3098 
3099  return parallel_reduce(_Begin, _End, _Identity,
3100  [_Sym_fun](_Forward_iterator _Begin, _Forward_iterator _End, _Reduce_type _Init)->_Reduce_type
3101  {
3102  while (_Begin != _End)
3103  {
3104  _Init = _Sym_fun(_Init, *_Begin++);
3105  }
3106 
3107  return _Init;
3108  },
3109  _Sym_fun);
3110 }
_Reduce_type parallel_reduce(_Forward_iterator _Begin, _Forward_iterator _End, const _Reduce_type &_Identity, const _Range_reduce_fun &_Range_fun, const _Sym_reduce_fun &_Sym_fun)
Computes the sum of all elements in a specified range by computing successive partial sums...
Definition: ppl.h:3177
Definition: xtr1common:380
template<typename _Reduce_type , typename _Forward_iterator , typename _Range_reduce_fun , typename _Sym_reduce_fun >
_Reduce_type Concurrency::parallel_reduce ( _Forward_iterator  _Begin,
_Forward_iterator  _End,
const _Reduce_type &  _Identity,
const _Range_reduce_fun &  _Range_fun,
const _Sym_reduce_fun &  _Sym_fun 
)
inline

Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value.

Template Parameters
_Reduce_typeThe type that the input will reduce to, which can be different from the input element type. The return value and identity value will has this type.
_Forward_iteratorThe iterator type of input range.
_Range_reduce_funThe type of the range reduction function. This must be a function type with signature _Reduce_type _Range_fun(_Forward_iterator, _Forward_iterator, _Reduce_type), _Reduce_type is the same as the identity type and the result type of the reduction.
_Sym_reduce_funThe type of the symmetric reduction function. This must be a function type with signature _Reduce_type _Sym_fun(_Reduce_type, _Reduce_type), where _Reduce_type is the same as the identity type and the result type of the reduction. For the third overload, this should be consistent with the output type of _Range_reduce_fun.
Parameters
_BeginAn input iterator addressing the first element in the range to be reduced.
_EndAn input iterator addressing the element that is one position beyond the final element in the range to be reduced.
_IdentityThe identity value _Identity is of the same type as the result type of the reduction and also the value_type of the iterator for the first and second overloads. For the third overload, the identity value must have the same type as the result type of the reduction, but can be different from the value_type of the iterator. It must have an appropriate value such that the range reduction operator _Range_fun , when applied to a range of a single element of type value_type and the identity value, behaves like a type cast of the value from type value_type to the identity type.
_Range_funThe function that will be used in the first phase of the reduction. Refer to Remarks for more information.
_Sym_funThe symmetric function that will be used in the second of the reduction. Refer to Remarks for more information.
Returns
The result of the reduction.

To perform a parallel reduction, the function divides the range into chunks based on the number of workers available to the underlying scheduler. The reduction takes place in two phases, the first phase performs a reduction within each chunk, and the second phase performs a reduction between the partial results from each chunk.

The first overload requires that the iterator's value_type, T, be the same as the identity value type as well as the reduction result type. The element type T must provide the operator T T::operator + (T) to reduce elements in each chunk. The same operator is used in the second phase as well.

The second overload also requires that the iterator's value_type be the same as the identity value type as well as the reduction result type. The supplied binary operator _Sym_fun is used in both reduction phases, with the identity value as the initial value for the first phase.

For the third overload, the identity value type must be the same as the reduction result type, but the iterator's value_type may be different from both. The range reduction function _Range_fun is used in the first phase with the identity value as the initial value, and the binary function _Sym_reduce_fun is applied to sub results in the second phase.

3179 {
3180  typedef typename std::iterator_traits<_Forward_iterator>::value_type _Value_type;
3181 
3182  static_assert(!std::tr1::is_same<typename std::iterator_traits<_Forward_iterator>::iterator_category, std::input_iterator_tag>::value
3183  && !std::tr1::is_same<typename std::iterator_traits<_Forward_iterator>::iterator_category, std::output_iterator_tag>::value,
3184  "iterator can not be input_iterator or output_iterator.");
3185 
3186  return _Parallel_reduce_impl(_Begin, _End,
3187  _Reduce_functor_helper<_Reduce_type, _Range_reduce_fun,
3188  _Order_combinable<_Reduce_type, _Sym_reduce_fun>>(_Identity, _Range_fun, _Order_combinable<_Reduce_type, _Sym_reduce_fun>(_Sym_fun)),
3189  typename std::iterator_traits<_Forward_iterator>::iterator_category());
3190 }
_Function::_Reduce_type _Parallel_reduce_impl(_Random_iterator _First, _Random_iterator _Last, const _Function &_Func, std::random_access_iterator_tag)
Definition: ppl.h:3309
Definition: xtr1common:380
template<typename _Random_iterator >
void Concurrency::parallel_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort.

Template Parameters
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

The first overload uses the the binary comparator std::less.

The second overloaded uses the supplied binary comparator that should have the signature bool _Func(T, T) where T is the type of the elements in the input range.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5274 {
5275  parallel_sort(_Begin, _End, std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5276 }
void parallel_sort(const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
Arranges the elements in a specified range into a nondescending order, or according to an ordering cr...
Definition: ppl.h:5312
template<typename _Random_iterator , typename _Function >
void Concurrency::parallel_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort.

Template Parameters
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparison functor.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe mimimum size of a chunk that will be split into two for parallel execution.

The first overload uses the the binary comparator std::less.

The second overloaded uses the supplied binary comparator that should have the signature bool _Func(T, T) where T is the type of the elements in the input range.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5313 {
5314  _CONCRT_ASSERT(_Chunk_size > 0);
5315 
5316  // Check for cancellation before the algorithm starts.
5318 
5319  size_t _Size = _End - _Begin;
5321 
5322  if (_Size <= _Chunk_size || _Core_num < 2)
5323  {
5324  return std::sort(_Begin, _End, _Func);
5325  }
5326 
5327  _Parallel_quicksort_impl(_Begin, _Size, _Func, _Core_num * _MAX_NUM_TASKS_PER_CORE, _Chunk_size, 0);
5328 }
void _Parallel_quicksort_impl(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
Definition: ppl.h:5006
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
void interruption_point()
Creates an interruption point for cancellation. If a cancellation is in progress in the context where...
Definition: ppl.h:879
#define _MAX_NUM_TASKS_PER_CORE
Definition: ppl.h:4554
_Check_return_ _In_ long _Size
Definition: io.h:325
void sort(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:3153
static _CRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
const auto_partitioner &  _Part = auto_partitioner() 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

3868 {
3869  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
3870 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3801
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
const static_partitioner &  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

3925 {
3926  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
3927 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3801
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
const simple_partitioner &  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

3982 {
3983  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
3984 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3801
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
affinity_partitioner &  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

4039 {
4040  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
4041 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3801
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator , typename _Partitioner >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Input_iterator2  _First2,
_Output_iterator  _Result,
const _Binary_operator&  _Binary_op,
_Partitioner &&  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Input_iterator2The type of second input iterator.
_Output_iteratorThe type of the output iterator.
_Binary_operatorThe type of the binary functor executed pairwise on elements from the two source ranges.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_First2An input iterator addressing the position of the first element in the second source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Binary_opA user-defined binary function object that is applied pairwise, in a forward order, to the two source ranges.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

4103 {
4104  typedef typename std::iterator_traits<_Input_iterator1>::iterator_category _Input_iterator_type1;
4105  typedef typename std::iterator_traits<_Input_iterator2>::iterator_category _Input_iterator_type2;
4106  typedef typename std::iterator_traits<_Output_iterator>::iterator_category _Output_iterator_type;
4107 
4108  if (_First1 != _Last1)
4109  {
4110  _Binary_transform_impl_helper<_Input_iterator_type1, _Input_iterator_type2, _Output_iterator_type>
4111  ::_Parallel_transform_binary_impl(_First1, _Last1, _First2, _Result, _Binary_op, std::forward<_Partitioner>(_Part));
4112  }
4113 
4114  return _Result;
4115 }
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Input_iterator2  _First2,
_Output_iterator  _Result,
const _Binary_operator&  _Binary_op 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Input_iterator2The type of second input iterator.
_Output_iteratorThe type of the output iterator.
_Binary_operatorThe type of the binary functor executed pairwise on elements from the two source ranges.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_First2An input iterator addressing the position of the first element in the second source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Binary_opA user-defined binary function object that is applied pairwise, in a forward order, to the two source ranges.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

4168 {
4169  return parallel_transform(_First1, _Last1, _First2, _Result, _Binary_op, auto_partitioner());
4170 }
_Output_iterator parallel_transform(_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator _Result, const _Binary_operator&_Binary_op)
Applies a specified function object to each element in a source range, or to a pair of elements from ...
Definition: ppl.h:4166
template<class _Type >
_Type Concurrency::receive ( _Inout_ ISource< _Type > *  _Src,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
12069 {
12070  return _Receive_impl(_Src, _Timeout, NULL);
12071 }
#define NULL
Definition: crtdbg.h:30
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:11813
template<class _Type >
_Type Concurrency::receive ( _Inout_ ISource< _Type > *  _Src,
typename ITarget< _Type >::filter_method const &  _Filter_proc,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_Filter_procA filter function which determines whether messages should be accepted.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
12106 {
12107  return _Receive_impl(_Src, _Timeout, &_Filter_proc);
12108 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:11813
template<class _Type >
_Type Concurrency::receive ( ISource< _Type > &  _Src,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
12140 {
12141  return _Receive_impl(&_Src, _Timeout, NULL);
12142 }
#define NULL
Definition: crtdbg.h:30
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:11813
template<class _Type >
_Type Concurrency::receive ( ISource< _Type > &  _Src,
typename ITarget< _Type >::filter_method const &  _Filter_proc,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_Filter_procA filter function which determines whether messages should be accepted.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
12177 {
12178  return _Receive_impl(&_Src, _Timeout, &_Filter_proc);
12179 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:11813
template<typename _Function >
void Concurrency::run_with_cancellation_token ( const _Function &  _Func,
cancellation_token  _Ct 
)

Executes a function object immediately and synchronously in the context of a given cancellation token.

Template Parameters
_FunctionThe type of the function object that will be invoked.
Parameters
_FuncThe function object which will be executed. This object must support the function call operator with a signature of void(void).
_CtThe cancellation token which will control implicit cancellation of the function object. Use cancellation_token::none() if you want the function execute without any possibility of implicit cancellation from a parent task group being canceled.

Any interruption points in the function object will be triggered when the cancellation_token is canceled. The explicit token _Ct will isolate this _Func from parent cancellation if the parent has a different token or no token.

865 {
866  structured_task_group _Stg(_Ct);
867  _Stg.run_and_wait(_Func);
868 }
template<class _Type >
bool Concurrency::send ( _Inout_ ITarget< _Type > *  _Trg,
const _Type _Data 
)

A synchronous send operation, which waits until the target either accepts or declines the message.

Template Parameters
_TypeThe payload type.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, asend Function
13343 {
13344  return details::_Originator::_send(_Trg, _Data);
13345 }
template<class _Type >
bool Concurrency::send ( ITarget< _Type > &  _Trg,
const _Type _Data 
)

A synchronous send operation, which waits until the target either accepts or declines the message.

Template Parameters
_TypeThe payload type.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, asend Function
13372 {
13373  return send(&_Trg, _Data);
13374 }
bool send(ITarget< _Type > &_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:13371
void Concurrency::set_ambient_scheduler ( std::shared_ptr< ::Concurrency::scheduler_interface >  _Scheduler)
inline
70 {
71  throw invalid_operation("Scheduler is already initialized");
72 }
template<typename _Ty , class _Ax >
void Concurrency::swap ( concurrent_vector< _Ty, _Ax > &  _A,
concurrent_vector< _Ty, _Ax > &  _B 
)
inline

Exchanges the elements of two concurrent_vector objects.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
_AxThe allocator type of the concurrent vectors.
Parameters
_BThe concurrent vector providing the elements to be swapped, or the vector whose elements are to be exchanged with those of the concurrent vector _A .
_AThe concurrent vector whose elements are to be exchanged with those of the concurrent vector _B .

The template function is an algorithm specialized on the container class concurrent_vector to execute the member function _A .concurrent_vector::swap(_B ). These are instances of the partial ordering of function templates by the compiler. When template functions are overloaded in such a way that the match of the template with the function call is not unique, then the compiler will select the most specialized version of the template function. The general version of the template function, template <class T> void swap(T&, T&), in the algorithm class works by assignment and is a slow operation. The specialized version in each container is much faster as it can work with the internal representation of the container class.

This method is not concurrency-safe. You must ensure that no other threads are performing operations on either of the concurrent vectors when you call this method.

See also
concurrent_vector Class, Parallel Containers and Objects
1956 {
1957  _A.swap( _B );
1958 }
void Concurrency::tile_static_memory_fence ( const tile_barrier &  _Barrier)
inline

Ensures that tile_static memory accesses are visible to other threads in the thread tile, and are executed according to program order

Parameters
_BarrierA tile_barrier object
7169 {
7171 }
void __dp_d3d_tile_static_memory_fence() __GPU_ONLY
template<class _Type >
void Concurrency::Trace_agents_register_name ( _Inout_ _Type _PObject,
_In_z_ const wchar_t _Name 
)

Associates the given name to the message block or agent in the ETW trace.

Template Parameters
_TypeThe type of the object. This is typically a message block or an agent.
Parameters
_PObjectA pointer to the message block or agent that is being named in the trace.
_NameThe name for the given object.
13447 {
13449 }
__int64 _Trace_agents_get_id(_Type *_PObject)
Definition: agents.h:434
An event type that represents the name for an object
Definition: concrt.h:5837
_CRTIMP void __cdecl _Trace_agents(Agents_EventType _Type, __int64 agentId,...)
template<class _Type >
bool Concurrency::try_receive ( _Inout_ ISource< _Type > *  _Src,
_Type _value 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
12427 {
12428  return _Try_receive_impl(_Src, _value, NULL);
12429 }
#define NULL
Definition: crtdbg.h:30
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:12204
template<class _Type >
bool Concurrency::try_receive ( _Inout_ ISource< _Type > *  _Src,
_Type _value,
typename ITarget< _Type >::filter_method const &  _Filter_proc 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
_Filter_procA filter function which determines whether messages should be accepted.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
12460 {
12461  return _Try_receive_impl(_Src, _value, &_Filter_proc);
12462 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:12204
template<class _Type >
bool Concurrency::try_receive ( ISource< _Type > &  _Src,
_Type _value 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
12490 {
12491  return _Try_receive_impl(&_Src, _value, NULL);
12492 }
#define NULL
Definition: crtdbg.h:30
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:12204
template<class _Type >
bool Concurrency::try_receive ( ISource< _Type > &  _Src,
_Type _value,
typename ITarget< _Type >::filter_method const &  _Filter_proc 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
_Filter_procA filter function which determines whether messages should be accepted.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
12523 {
12524  return _Try_receive_impl(&_Src, _value, &_Filter_proc);
12525 }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:12204
_CRTIMP void __cdecl Concurrency::wait ( unsigned int  _Milliseconds)

Pauses the current context for a specified amount of time.

Parameters
_MillisecondsThe number of milliseconds the current context should be paused for. If the _Milliseconds parameter is set to the value 0, the current context should yield execution to other runnable contexts before continuing.

If this method is called on a Concurrency Runtime scheduler context, the scheduler will find a different context to run on the underlying resource. Because the scheduler is cooperative in nature, this context cannot resume exactly after the number of milliseconds specified. If the scheduler is busy executing other tasks that do not cooperatively yield to the scheduler, the wait period could be indefinite.

Variable Documentation

const unsigned int Concurrency::COOPERATIVE_TIMEOUT_INFINITE = (unsigned int)-1

Value indicating that a wait should never time out.

See also
event Class, event::wait Method, event::wait_for_multiple Method
const size_t Concurrency::COOPERATIVE_WAIT_TIMEOUT = SIZE_MAX

Value indicating that a wait timed out.

See also
event Class, event::wait Method, event::wait_for_multiple Method