Intel® Cilk™ Plus Include Directory  Revision 4358
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Files | Namespaces | Classes | Macros | Typedefs | Functions
Common Definitions

Definitions for runtime macros, structures, and classes. More...

Files

file  common.h
 common.h
 
file  metaprogramming.h
 Defines metaprogramming utility classes used in the Intel(R) Cilk(TM) Plus library.
 

Namespaces

 cilk
 Namespace for all Intel Cilk Plus definitions that can be included in user code.
 

Classes

struct  __cilkrts_pedigree
 Pedigree information kept in the worker and stack frame. More...
 
class  cilk::internal::class_is_empty< Class >
 Test if a class is empty. More...
 
struct  cilk::internal::align_of< Tp >
 Get the alignment of a type. More...
 
struct  cilk::internal::binary_functor< F >
 Get the functor class corresponding to a binary function type. More...
 
class  cilk::internal::typed_indirect_binary_function< F, A1, A2, R, Functor, FunctorIsEmpty >
 Indirect binary function class with specified types. More...
 
class  cilk::internal::indirect_binary_function< F, Functor >
 Indirect binary function class with inferred types. More...
 
struct  cilk::internal::condition< Cond, IfTrue, IfFalse >
 Choose a type based on a boolean constant. More...
 

Macros

#define CILK_LIBRARY_VERSION   102
 Intel Cilk Plus library version = 1.02.
 
#define __STDNS   std::
 Prefix standard library function and type names with __STDNS to get correct lookup in both C and C++.
 
#define CILK_EXPORT   __declspec(dllimport)
 Define export of runtime functions from shared library. More...
 
#define CILK_EXPORT_DATA   __declspec(dllimport)
 Define export of runtime data from shared library.
 
#define __CILKRTS_BEGIN_EXTERN_C   extern "C" {
 Macro to denote the start of a section in which all names have "C" linkage. More...
 
#define __CILKRTS_END_EXTERN_C   }
 Macro to denote the end of a section in which all names have "C" linkage. More...
 
#define __CILKRTS_EXTERN_C   extern "C"
 Macro to prefix a single definition which has "C" linkage. More...
 
#define __CILKRTS_NOTHROW   __declspec(nothrow)
 OS-independent macro to specify a function which is known to not throw an exception.
 
#define __CILKRTS_CACHE_LINE__   64
 Cache alignment. More...
 
#define CILK_ALIGNAS(n)   __declspec(align(n))
 Macro to specify alignment of a data member in a structure. More...
 
#define __CILKRTS_CACHE_ALIGN   CILK_ALIGNAS(__CILKRTS_CACHE_LINE__)
 Macro to specify cache-line alignment of a data member in a structure.
 
#define CILK_ALIGNAS_TYPE(t)   __declspec(align(__alignof(t)))
 Macro to specify a class as being at least as strictly aligned as some type on Windows. More...
 
#define CILK_API(RET_TYPE)   CILK_EXPORT RET_TYPE __CILKRTS_NOTHROW __cdecl
 A function called explicitly by the programmer.
 
#define CILK_ABI(RET_TYPE)   CILK_EXPORT RET_TYPE __CILKRTS_NOTHROW __cdecl
 A function called by compiler-generated code.
 
#define CILK_ABI_THROWS(RET_TYPE)   CILK_EXPORT RET_TYPE __cdecl
 An ABI function that may throw an exception. More...
 
#define __CILKRTS_ASSERT(e)   static_cast<void>(0)
 __CILKRTS_ASSERT should be defined for debugging only, otherwise it interferes with vectorization. More...
 
#define __CILKRTS_INLINE   extern __inline__
 OS-independent macro to specify a function that should be inlined.
 
#define CILK_EXPORT_AND_INLINE   __CILKRTS_INLINE
 Functions marked as CILK_EXPORT_AND_INLINE have both inline versions defined in the Intel Cilk Plus API, as well as non-inlined versions that are exported (for compatibility with previous versions that did not inline the functions).
 
#define __CILKRTS_STATIC_ASSERT(Cond, Msg)
 Compile-time assertion. More...
 

Typedefs

typedef void * __cilkrts_void_ptr
 void *, defined to work around complaints from the compiler about using __declspec(nothrow) after the "void *" return type
 

Functions

__cilkrts_worker_ptr __cilkrts_get_tls_worker (void)
 Fetch the worker out of TLS.
 
template<typename T >
void cilk::aligned_delete (const T *ptr)
 Deallocate an aligned data structure on the heap. More...
 
template<typename T >
T * cilk::aligned_new ()
 Allocate an aligned data structure on the heap. More...
 
template<typename T , typename T1 >
T * cilk::aligned_new (const T1 &x1)
 Allocate an aligned data structure on the heap. More...
 
template<typename T , typename T1 , typename T2 >
T * cilk::aligned_new (const T1 &x1, const T2 &x2)
 Allocate an aligned data structure on the heap. More...
 
template<typename T , typename T1 , typename T2 , typename T3 >
T * cilk::aligned_new (const T1 &x1, const T2 &x2, const T3 &x3)
 Allocate an aligned data structure on the heap. More...
 
template<typename T , typename T1 , typename T2 , typename T3 , typename T4 >
T * cilk::aligned_new (const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4)
 Allocate an aligned data structure on the heap. More...
 
template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
T * cilk::aligned_new (const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const T5 &x5)
 Allocate an aligned data structure on the heap. More...
 

Detailed Description

Definitions for runtime macros, structures, and classes.

Macro Definition Documentation

#define __CILKRTS_ASSERT (   e)    static_cast<void>(0)

__CILKRTS_ASSERT should be defined for debugging only, otherwise it interferes with vectorization.

Since NDEBUG is not reliable (it must be set by the user), we must use a platform-specific detection of debug mode.

#define __CILKRTS_BEGIN_EXTERN_C   extern "C" {

Macro to denote the start of a section in which all names have "C" linkage.

That is, none of the names are to be mangled.

See Also
__CILKRTS_END_EXTERN_C
__CILKRTS_EXTERN_C
#define __CILKRTS_CACHE_LINE__   64

Cache alignment.

(Good enough for most architectures.)

#define __CILKRTS_END_EXTERN_C   }

Macro to denote the end of a section in which all names have "C" linkage.

That is, none of the names are to be mangled.

See Also
__CILKRTS_BEGIN_EXTERN_C
__CILKRTS_EXTERN_C
#define __CILKRTS_EXTERN_C   extern "C"

Macro to prefix a single definition which has "C" linkage.

That is, the defined name is not to be mangled.

See Also
__CILKRTS_BEGIN_EXTERN_C
__CILKRTS_END_EXTERN_C
#define __CILKRTS_STATIC_ASSERT (   Cond,
  Msg 
)
Value:
typedef int __CILKRTS_STATIC_ASSERT_DUMMY_TYPE \
[::cilk::internal::static_assert_failure<(Cond)>::Success]

Compile-time assertion.

Causes a compilation error if a compile-time constant expression is false.

Usage example.
This assertion is used in reducer_min_max.h to avoid defining legacy reducer classes that would not be binary-compatible with the same classes compiled with earlier versions of the reducer library.
__CILKRTS_STATIC_ASSERT(
    internal::class_is_empty< internal::binary_functor<Compare> >::value,
    "cilk::reducer_max<Value, Compare> only works with an empty Compare class");
Note
In a C++11 compiler, this is just the language predefined static_assert macro.
In a non-C++11 compiler, the Msg string is not directly included in the compiler error message, but it may appear if the compiler prints the source line that the error occurred on.
Parameters
CondThe expression to test.
MsgA string explaining the failure.
#define CILK_ABI_THROWS (   RET_TYPE)    CILK_EXPORT RET_TYPE __cdecl

An ABI function that may throw an exception.

Even when these are the same definitions, they should be separate macros so that they can be easily found in the code.

#define CILK_ALIGNAS (   n)    __declspec(align(n))

Macro to specify alignment of a data member in a structure.

Because of the way that gcc's alignment attribute is defined, n must be a numeric literal, not just a compile-time constant expression.

#define CILK_ALIGNAS_TYPE (   t)    __declspec(align(__alignof(t)))

Macro to specify a class as being at least as strictly aligned as some type on Windows.

gcc does not provide a way of doing this, so on Unix, this just specifies the largest natural type alignment. Put the macro between the class keyword and the class name:

 class CILK_ALIGNAS_TYPE(foo) bar { ... };
#define CILK_EXPORT   __declspec(dllimport)

Define export of runtime functions from shared library.

Should be exported only from cilkrts*.dll/cilkrts*.so

Function Documentation

template<typename T >
void cilk::aligned_delete ( const T *  ptr)

Deallocate an aligned data structure on the heap.

cilk::aligned_delete(ptr) is equivalent to delete ptr, except that it operates on a pointer that was allocated by aligned_new().

template<typename T >
T* cilk::aligned_new ( )

Allocate an aligned data structure on the heap.

cilk::aligned_new<T>([args]) is equivalent to new T([args]), except that it guarantees that the returned pointer will be at least as aligned as the alignment requirements of type T.

template<typename T , typename T1 >
T* cilk::aligned_new ( const T1 &  x1)

Allocate an aligned data structure on the heap.

cilk::aligned_new<T>([args]) is equivalent to new T([args]), except that it guarantees that the returned pointer will be at least as aligned as the alignment requirements of type T.

template<typename T , typename T1 , typename T2 >
T* cilk::aligned_new ( const T1 &  x1,
const T2 &  x2 
)

Allocate an aligned data structure on the heap.

cilk::aligned_new<T>([args]) is equivalent to new T([args]), except that it guarantees that the returned pointer will be at least as aligned as the alignment requirements of type T.

template<typename T , typename T1 , typename T2 , typename T3 >
T* cilk::aligned_new ( const T1 &  x1,
const T2 &  x2,
const T3 &  x3 
)

Allocate an aligned data structure on the heap.

cilk::aligned_new<T>([args]) is equivalent to new T([args]), except that it guarantees that the returned pointer will be at least as aligned as the alignment requirements of type T.

template<typename T , typename T1 , typename T2 , typename T3 , typename T4 >
T* cilk::aligned_new ( const T1 &  x1,
const T2 &  x2,
const T3 &  x3,
const T4 &  x4 
)

Allocate an aligned data structure on the heap.

cilk::aligned_new<T>([args]) is equivalent to new T([args]), except that it guarantees that the returned pointer will be at least as aligned as the alignment requirements of type T.

template<typename T , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
T* cilk::aligned_new ( const T1 &  x1,
const T2 &  x2,
const T3 &  x3,
const T4 &  x4,
const T5 &  x5 
)

Allocate an aligned data structure on the heap.

cilk::aligned_new<T>([args]) is equivalent to new T([args]), except that it guarantees that the returned pointer will be at least as aligned as the alignment requirements of type T.

© 2015 Intel Corporation. All rights reserved. | Intel and Cilk are trademarks of Intel Corporation in the U.S. and/or other countries