cilk.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* cilk.h -*-C++-*-
  2. *
  3. * @copyright
  4. * Copyright (C) 2010-2013, Intel Corporation
  5. * All rights reserved.
  6. *
  7. * @copyright
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * * Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * * Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in
  16. * the documentation and/or other materials provided with the
  17. * distribution.
  18. * * Neither the name of Intel Corporation nor the names of its
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * @copyright
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  26. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  27. * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  28. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  29. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  30. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  31. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
  33. * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. * POSSIBILITY OF SUCH DAMAGE.
  35. */
  36. /** @file cilk.h
  37. *
  38. * @brief Provides convenient aliases for the Cilk language keywords.
  39. *
  40. * @details
  41. * Since Cilk is a nonstandard extension to both C and C++, the Cilk
  42. * language keywords all begin with “`_Cilk_`”, which guarantees that they
  43. * will not conflict with user-defined identifiers in properly written
  44. * programs, so that “standard” C and C++ programs can safely be
  45. * compiled a Cilk-enabled C or C++ compiler.
  46. *
  47. * However, this means that the keywords _look_ like something grafted on to
  48. * the base language. Therefore, you can include this header:
  49. *
  50. * #include "cilk/cilk.h"
  51. *
  52. * and then write the Cilk keywords with a “`cilk_`” prefix instead of
  53. * “`_Cilk_`”.
  54. *
  55. * @ingroup language
  56. */
  57. /** @defgroup language Language Keywords
  58. * Definitions having to do with the Cilk language.
  59. * @{
  60. */
  61. #ifndef cilk_spawn
  62. # define cilk_spawn _Cilk_spawn ///< Spawn a task that can execute in parallel.
  63. # define cilk_sync _Cilk_sync ///< Wait for spawned tasks to complete.
  64. # define cilk_for _Cilk_for ///< Execute iterations of a for loop in parallel.
  65. #endif
  66. /// @}