From 6da088e1358004dcfabe711787ea73449a1860a9 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 20 Aug 2009 20:28:58 +0000 Subject: [PATCH] Switch to using the newer version of the TBB. git-svn-id: https://svn.dealii.org/trunk@19320 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/contrib/tbb/Makefile | 2 +- deal.II/contrib/tbb/tbb21_20090313oss/CHANGES | 569 --- deal.II/contrib/tbb/tbb21_20090313oss/COPYING | 353 -- .../contrib/tbb/tbb21_20090313oss/Makefile | 82 - deal.II/contrib/tbb/tbb21_20090313oss/README | 11 - .../tbb21_20090313oss/build/FreeBSD.gcc.inc | 93 - .../tbb/tbb21_20090313oss/build/FreeBSD.inc | 81 - .../tbb/tbb21_20090313oss/build/Makefile.tbb | 123 - .../build/Makefile.tbbmalloc | 167 - .../tbb/tbb21_20090313oss/build/Makefile.test | 251 - .../tbb/tbb21_20090313oss/build/SunOS.gcc.inc | 99 - .../tbb/tbb21_20090313oss/build/SunOS.inc | 90 - .../tbb21_20090313oss/build/SunOS.suncc.inc | 95 - .../tbb/tbb21_20090313oss/build/codecov.txt | 4 - .../tbb/tbb21_20090313oss/build/common.inc | 94 - .../tbb21_20090313oss/build/common_rules.inc | 138 - .../tbb/tbb21_20090313oss/build/detect.js | 114 - .../build/generate_tbbvars.bat | 98 - .../build/generate_tbbvars.sh | 132 - .../tbb/tbb21_20090313oss/build/index.html | 230 - .../tbb/tbb21_20090313oss/build/linux.gcc.inc | 102 - .../tbb/tbb21_20090313oss/build/linux.icc.inc | 94 - .../tbb/tbb21_20090313oss/build/linux.inc | 104 - .../tbb/tbb21_20090313oss/build/macos.gcc.inc | 81 - .../tbb/tbb21_20090313oss/build/macos.icc.inc | 74 - .../tbb/tbb21_20090313oss/build/macos.inc | 85 - .../tbb21_20090313oss/build/suncc.map.pause | 1 - .../tbb21_20090313oss/build/test_launcher.bat | 36 - .../tbb21_20090313oss/build/test_launcher.sh | 41 - .../build/version_info_linux.sh | 42 - .../build/version_info_macos.sh | 39 - .../build/version_info_sunos.sh | 39 - .../build/version_info_windows.js | 131 - .../build/vsproject/index.html | 31 - .../build/vsproject/makefile.sln | 72 - .../build/vsproject/tbb.vcproj | 918 ---- .../build/vsproject/tbbmalloc.vcproj | 822 --- .../build/vsproject/tbbmalloc_proxy.vcproj | 441 -- .../build/vsproject/version_string.tmp | 1 - .../tbb21_20090313oss/build/windows.cl.inc | 122 - .../tbb21_20090313oss/build/windows.icl.inc | 140 - .../tbb/tbb21_20090313oss/build/windows.inc | 92 - .../tbb21_20090313oss/doc/Release_Notes.txt | 166 - .../tbb21_20090313oss/doc/html/a00001.html | 34 - .../tbb21_20090313oss/doc/html/a00005.html | 45 - .../tbb21_20090313oss/doc/html/a00006.html | 41 - .../tbb21_20090313oss/doc/html/a00007.html | 43 - .../tbb21_20090313oss/doc/html/a00008.html | 49 - .../tbb21_20090313oss/doc/html/a00010.html | 35 - .../tbb21_20090313oss/doc/html/a00012.html | 34 - .../tbb21_20090313oss/doc/html/a00013.html | 83 - .../tbb21_20090313oss/doc/html/a00014.html | 41 - .../tbb21_20090313oss/doc/html/a00015.html | 39 - .../tbb21_20090313oss/doc/html/a00019.html | 59 - .../tbb21_20090313oss/doc/html/a00021.html | 92 - .../tbb21_20090313oss/doc/html/a00024.html | 56 - .../tbb21_20090313oss/doc/html/a00028.html | 38 - .../tbb21_20090313oss/doc/html/a00029.html | 38 - .../tbb21_20090313oss/doc/html/a00034.html | 34 - .../tbb21_20090313oss/doc/html/a00035.html | 33 - .../tbb21_20090313oss/doc/html/a00036.html | 33 - .../tbb21_20090313oss/doc/html/a00037.html | 37 - .../tbb21_20090313oss/doc/html/a00038.html | 36 - .../tbb21_20090313oss/doc/html/a00040.html | 36 - .../tbb21_20090313oss/doc/html/a00042.html | 37 - .../tbb21_20090313oss/doc/html/a00043.html | 46 - .../tbb21_20090313oss/doc/html/a00044.html | 40 - .../tbb21_20090313oss/doc/html/a00045.html | 38 - .../tbb21_20090313oss/doc/html/a00046.html | 38 - .../tbb21_20090313oss/doc/html/a00047.html | 39 - .../tbb21_20090313oss/doc/html/a00048.html | 40 - .../tbb21_20090313oss/doc/html/a00049.html | 38 - .../tbb21_20090313oss/doc/html/a00050.html | 38 - .../tbb21_20090313oss/doc/html/a00051.html | 49 - .../tbb21_20090313oss/doc/html/a00053.html | 35 - .../tbb21_20090313oss/doc/html/a00055.html | 38 - .../tbb21_20090313oss/doc/html/a00056.html | 38 - .../tbb21_20090313oss/doc/html/a00057.html | 37 - .../tbb21_20090313oss/doc/html/a00058.html | 40 - .../tbb21_20090313oss/doc/html/a00059.html | 43 - .../tbb21_20090313oss/doc/html/a00061.html | 86 - .../tbb21_20090313oss/doc/html/a00062.html | 84 - .../tbb21_20090313oss/doc/html/a00063.html | 39 - .../tbb21_20090313oss/doc/html/a00064.html | 41 - .../tbb21_20090313oss/doc/html/a00066.html | 53 - .../tbb21_20090313oss/doc/html/a00068.html | 35 - .../tbb21_20090313oss/doc/html/a00070.html | 34 - .../tbb21_20090313oss/doc/html/a00071.html | 37 - .../tbb21_20090313oss/doc/html/a00072.html | 41 - .../tbb21_20090313oss/doc/html/a00073.html | 44 - .../tbb21_20090313oss/doc/html/a00074.html | 36 - .../tbb21_20090313oss/doc/html/a00081.html | 33 - .../tbb21_20090313oss/doc/html/a00083.html | 35 - .../tbb21_20090313oss/doc/html/a00084.html | 41 - .../tbb21_20090313oss/doc/html/a00096.html | 59 - .../tbb21_20090313oss/doc/html/a00097.html | 63 - .../tbb21_20090313oss/doc/html/a00098.html | 54 - .../tbb21_20090313oss/doc/html/a00099.html | 59 - .../tbb21_20090313oss/doc/html/a00100.html | 64 - .../tbb21_20090313oss/doc/html/a00101.html | 50 - .../tbb21_20090313oss/doc/html/a00102.html | 224 - .../tbb21_20090313oss/doc/html/a00103.html | 86 - .../tbb21_20090313oss/doc/html/a00104.html | 93 - .../tbb21_20090313oss/doc/html/a00105.html | 114 - .../tbb21_20090313oss/doc/html/a00106.html | 65 - .../tbb21_20090313oss/doc/html/a00107.html | 148 - .../tbb21_20090313oss/doc/html/a00108.html | 573 --- .../tbb21_20090313oss/doc/html/a00109.html | 66 - .../tbb21_20090313oss/doc/html/a00110.html | 89 - .../tbb21_20090313oss/doc/html/a00111.html | 299 -- .../tbb21_20090313oss/doc/html/a00112.html | 438 -- .../tbb21_20090313oss/doc/html/a00113.html | 51 - .../tbb21_20090313oss/doc/html/a00114.html | 150 - .../tbb21_20090313oss/doc/html/a00115.html | 194 - .../tbb21_20090313oss/doc/html/a00116.html | 53 - .../tbb21_20090313oss/doc/html/a00117.html | 168 - .../tbb21_20090313oss/doc/html/a00118.html | 74 - .../tbb21_20090313oss/doc/html/a00119.html | 95 - .../tbb21_20090313oss/doc/html/a00120.html | 65 - .../tbb21_20090313oss/doc/html/a00121.html | 140 - .../tbb21_20090313oss/doc/html/a00122.html | 99 - .../tbb21_20090313oss/doc/html/a00123.html | 53 - .../tbb21_20090313oss/doc/html/a00124.html | 75 - .../tbb21_20090313oss/doc/html/a00125.html | 115 - .../tbb21_20090313oss/doc/html/a00126.html | 81 - .../tbb21_20090313oss/doc/html/a00127.html | 153 - .../tbb21_20090313oss/doc/html/a00128.html | 74 - .../tbb21_20090313oss/doc/html/a00129.html | 95 - .../tbb21_20090313oss/doc/html/a00130.html | 112 - .../tbb21_20090313oss/doc/html/a00131.html | 65 - .../tbb21_20090313oss/doc/html/a00132.html | 64 - .../tbb21_20090313oss/doc/html/a00133.html | 98 - .../tbb21_20090313oss/doc/html/a00134.html | 71 - .../tbb21_20090313oss/doc/html/a00135.html | 72 - .../tbb21_20090313oss/doc/html/a00136.html | 153 - .../tbb21_20090313oss/doc/html/a00137.html | 51 - .../tbb21_20090313oss/doc/html/a00138.html | 644 --- .../tbb21_20090313oss/doc/html/a00139.html | 182 - .../tbb21_20090313oss/doc/html/a00140.html | 80 - .../tbb21_20090313oss/doc/html/a00141.html | 164 - .../tbb21_20090313oss/doc/html/a00142.html | 130 - .../tbb21_20090313oss/doc/html/a00143.html | 65 - .../tbb21_20090313oss/doc/html/a00144.html | 141 - .../tbb21_20090313oss/doc/html/a00145.html | 56 - .../tbb21_20090313oss/doc/html/a00146.html | 68 - .../tbb21_20090313oss/doc/html/a00147.html | 83 - .../tbb21_20090313oss/doc/html/a00148.html | 55 - .../tbb21_20090313oss/doc/html/a00175.html | 75 - .../tbb21_20090313oss/doc/html/a00191.html | 593 --- .../tbb21_20090313oss/doc/html/a00193.html | 310 -- .../tbb21_20090313oss/doc/html/a00194.html | 38 - .../tbb21_20090313oss/doc/html/a00195.html | 285 -- .../tbb21_20090313oss/doc/html/a00196.html | 50 - .../tbb21_20090313oss/doc/html/a00197.html | 32 - .../tbb21_20090313oss/doc/html/a00198.html | 44 - .../tbb21_20090313oss/doc/html/a00199.html | 106 - .../tbb21_20090313oss/doc/html/a00201.html | 73 - .../tbb21_20090313oss/doc/html/a00203.html | 457 -- .../tbb21_20090313oss/doc/html/a00210.html | 127 - .../tbb21_20090313oss/doc/html/a00211.html | 113 - .../tbb21_20090313oss/doc/html/a00212.html | 131 - .../tbb21_20090313oss/doc/html/a00213.html | 143 - .../tbb21_20090313oss/doc/html/a00215.html | 945 ---- .../tbb21_20090313oss/doc/html/a00223.html | 363 -- .../tbb21_20090313oss/doc/html/a00229.html | 829 --- .../tbb21_20090313oss/doc/html/a00238.html | 569 --- .../tbb21_20090313oss/doc/html/a00243.html | 201 - .../tbb21_20090313oss/doc/html/a00244.html | 80 - .../tbb21_20090313oss/doc/html/a00247.html | 82 - .../tbb21_20090313oss/doc/html/a00249.html | 480 -- .../tbb21_20090313oss/doc/html/a00258.html | 174 - .../tbb21_20090313oss/doc/html/a00260.html | 348 -- .../tbb21_20090313oss/doc/html/a00266.html | 436 -- .../tbb21_20090313oss/doc/html/a00272.html | 335 -- .../tbb21_20090313oss/doc/html/a00277.html | 225 - .../tbb21_20090313oss/doc/html/a00281.html | 196 - .../tbb21_20090313oss/doc/html/a00285.html | 231 - .../tbb21_20090313oss/doc/html/a00290.html | 192 - .../tbb21_20090313oss/doc/html/a00291.html | 124 - .../tbb21_20090313oss/doc/html/a00292.html | 156 - .../tbb21_20090313oss/doc/html/a00293.html | 211 - .../tbb21_20090313oss/doc/html/a00294.html | 197 - .../tbb21_20090313oss/doc/html/a00295.html | 154 - .../tbb21_20090313oss/doc/html/a00296.html | 194 - .../tbb21_20090313oss/doc/html/a00297.html | 576 --- .../tbb21_20090313oss/doc/html/a00306.html | 99 - .../tbb21_20090313oss/doc/html/a00307.html | 90 - .../tbb21_20090313oss/doc/html/a00309.html | 149 - .../tbb21_20090313oss/doc/html/a00310.html | 125 - .../tbb21_20090313oss/doc/html/a00311.html | 221 - .../tbb21_20090313oss/doc/html/a00312.html | 587 --- .../tbb21_20090313oss/doc/html/a00315.html | 125 - .../tbb21_20090313oss/doc/html/a00316.html | 226 - .../tbb21_20090313oss/doc/html/a00321.html | 298 -- .../tbb21_20090313oss/doc/html/a00329.html | 66 - .../tbb21_20090313oss/doc/html/a00330.html | 164 - .../tbb21_20090313oss/doc/html/annotated.html | 86 - .../tbb21_20090313oss/doc/html/concepts.html | 31 - .../doc/html/deprecated.html | 29 - .../tbb21_20090313oss/doc/html/doxygen.css | 358 -- .../tbb/tbb21_20090313oss/doc/html/files.html | 73 - .../tbb21_20090313oss/doc/html/functions.html | 277 -- .../doc/html/functions_enum.html | 49 - .../doc/html/functions_eval.html | 56 - .../doc/html/functions_func.html | 246 - .../doc/html/functions_rela.html | 48 - .../doc/html/functions_type.html | 57 - .../doc/html/functions_vars.html | 49 - .../tbb21_20090313oss/doc/html/globals.html | 48 - .../doc/html/globals_func.html | 48 - .../doc/html/graph_legend.html | 87 - .../tbb21_20090313oss/doc/html/hierarchy.html | 93 - .../tbb/tbb21_20090313oss/doc/html/index.html | 32 - .../tbb21_20090313oss/doc/html/modules.html | 33 - .../doc/html/namespacemembers.html | 58 - .../doc/html/namespacemembers_enum.html | 45 - .../doc/html/namespacemembers_eval.html | 46 - .../doc/html/namespacemembers_func.html | 52 - .../doc/html/namespacemembers_type.html | 44 - .../doc/html/namespaces.html | 33 - .../tbb/tbb21_20090313oss/doc/html/pages.html | 31 - .../doc/html/parallel_do_body_req.html | 38 - .../doc/html/parallel_for_body_req.html | 30 - .../doc/html/parallel_reduce_body_req.html | 31 - .../doc/html/parallel_reduce_lambda_req.html | 25 - .../doc/html/parallel_scan_body_req.html | 32 - .../doc/html/parallel_sort_iter_req.html | 29 - .../tbb21_20090313oss/doc/html/range_req.html | 32 - .../tbb/tbb21_20090313oss/doc/html/tab_b.gif | Bin 35 -> 0 bytes .../tbb/tbb21_20090313oss/doc/html/tab_l.gif | Bin 706 -> 0 bytes .../tbb/tbb21_20090313oss/doc/html/tab_r.gif | Bin 2585 -> 0 bytes .../tbb/tbb21_20090313oss/doc/html/tabs.css | 102 - .../tbb/tbb21_20090313oss/include/index.html | 24 - .../include/tbb/_tbb_windef.h | 84 - .../include/tbb/aligned_space.h | 55 - .../tbb21_20090313oss/include/tbb/atomic.h | 448 -- .../include/tbb/blocked_range.h | 129 - .../include/tbb/blocked_range2d.h | 97 - .../include/tbb/blocked_range3d.h | 116 - .../include/tbb/cache_aligned_allocator.h | 139 - .../include/tbb/concurrent_hash_map.h | 1028 ---- .../include/tbb/concurrent_queue.h | 410 -- .../include/tbb/concurrent_vector.h | 945 ---- .../include/tbb/enumerable_thread_specific.h | 576 --- .../include/tbb/machine/ibm_aix51.h | 52 - .../include/tbb/machine/linux_common.h | 95 - .../include/tbb/machine/linux_em64t.h | 146 - .../include/tbb/machine/linux_ia32.h | 264 - .../include/tbb/machine/linux_itanium.h | 166 - .../include/tbb/machine/mac_ppc.h | 85 - .../include/tbb/machine/windows_em64t.h | 151 - .../include/tbb/machine/windows_ia32.h | 253 - .../include/tbb/machine/windows_ia32_inline.h | 189 - .../tbb/tbb21_20090313oss/include/tbb/mutex.h | 196 - .../include/tbb/null_mutex.h | 59 - .../include/tbb/null_rw_mutex.h | 61 - .../include/tbb/parallel_do.h | 508 -- .../include/tbb/parallel_for.h | 174 - .../include/tbb/parallel_invoke.h | 333 -- .../include/tbb/parallel_reduce.h | 466 -- .../include/tbb/parallel_scan.h | 344 -- .../include/tbb/parallel_sort.h | 227 - .../include/tbb/parallel_while.h | 194 - .../include/tbb/partitioner.h | 227 - .../tbb21_20090313oss/include/tbb/pipeline.h | 207 - .../include/tbb/queuing_mutex.h | 119 - .../include/tbb/queuing_rw_mutex.h | 161 - .../include/tbb/recursive_mutex.h | 206 - .../include/tbb/scalable_allocator.h | 199 - .../include/tbb/spin_mutex.h | 151 - .../include/tbb/spin_rw_mutex.h | 200 - .../tbb/tbb21_20090313oss/include/tbb/task.h | 730 --- .../include/tbb/task_scheduler_init.h | 106 - .../include/tbb/task_scheduler_observer.h | 74 - .../include/tbb/tbb_allocator.h | 145 - .../include/tbb/tbb_config.h | 124 - .../include/tbb/tbb_exception.h | 242 - .../include/tbb/tbb_machine.h | 573 --- .../include/tbb/tbb_profiling.h | 105 - .../include/tbb/tbb_stddef.h | 293 -- .../include/tbb/tbb_thread.h | 294 -- .../include/tbb/tbbmalloc_proxy.h | 62 - .../include/tbb/tick_count.h | 155 - .../contrib/tbb/tbb21_20090313oss/index.html | 44 - .../tbb/tbb21_20090313oss/src/Makefile | 192 - .../tbb/tbb21_20090313oss/src/index.html | 30 - .../src/old/concurrent_queue_v2.cpp | 383 -- .../src/old/concurrent_queue_v2.h | 328 -- .../src/old/concurrent_vector_v2.cpp | 266 - .../src/old/concurrent_vector_v2.h | 512 -- .../src/old/spin_rw_mutex_v2.cpp | 167 - .../src/old/spin_rw_mutex_v2.h | 185 - .../src/old/test_concurrent_queue_v2.cpp | 361 -- .../src/old/test_concurrent_vector_v2.cpp | 570 --- .../src/old/test_mutex_v2.cpp | 270 - .../tbb21_20090313oss/src/perf/perf_util.h | 292 -- .../tbb21_20090313oss/src/perf/statistics.cpp | 408 -- .../tbb21_20090313oss/src/perf/statistics.h | 188 - .../src/perf/statistics_xml.h | 208 - .../tbb21_20090313oss/src/perf/time_base.cpp | 262 - .../src/perf/time_framework.h | 329 -- .../src/perf/time_hash_map.cpp | 367 -- .../src/perf/time_locked_work.cpp | 174 - .../tbb21_20090313oss/src/perf/time_sandbox.h | 168 - .../tbb21_20090313oss/src/perf/time_unit.cpp | 291 -- .../src/perf/time_vector.cpp | 256 - .../src/tbb/cache_aligned_allocator.cpp | 307 -- .../src/tbb/concurrent_hash_map.cpp | 45 - .../src/tbb/concurrent_queue.cpp | 842 ---- .../src/tbb/concurrent_vector.cpp | 429 -- .../src/tbb/dynamic_link.cpp | 117 - .../tbb21_20090313oss/src/tbb/dynamic_link.h | 89 - .../src/tbb/em64t-masm/atomic_support.asm | 80 - .../src/tbb/enumerable_thread_specific.cpp | 172 - .../tbb/tbb21_20090313oss/src/tbb/gate.h | 194 - .../src/tbb/ia32-masm/atomic_support.asm | 196 - .../src/tbb/ia32-masm/lock_byte.asm | 46 - .../src/tbb/ibm_aix51/atomic_support.c | 55 - .../tbb/tbb21_20090313oss/src/tbb/index.html | 32 - .../src/tbb/itanium-gas/atomic_support.s | 678 --- .../src/tbb/itanium-gas/ia64_misc.s | 35 - .../src/tbb/itanium-gas/lock_byte.s | 54 - .../src/tbb/itanium-gas/log2.s | 67 - .../src/tbb/itanium-gas/pause.s | 41 - .../tbb21_20090313oss/src/tbb/itt_notify.cpp | 273 - .../tbb21_20090313oss/src/tbb/itt_notify.h | 207 - .../src/tbb/itt_notify_proxy.c | 55 - .../src/tbb/lin32-tbb-export.def | 310 -- .../src/tbb/lin64-tbb-export.def | 305 -- .../src/tbb/lin64ipf-tbb-export.def | 349 -- .../src/tbb/mac32-tbb-export.def | 292 -- .../src/tbb/mac64-tbb-export.def | 290 -- .../tbb/tbb21_20090313oss/src/tbb/mutex.cpp | 148 - .../tbb21_20090313oss/src/tbb/pipeline.cpp | 469 -- .../src/tbb/queuing_mutex.cpp | 117 - .../src/tbb/queuing_rw_mutex.cpp | 492 -- .../src/tbb/recursive_mutex.cpp | 143 - .../tbb21_20090313oss/src/tbb/spin_mutex.cpp | 68 - .../src/tbb/spin_rw_mutex.cpp | 174 - .../tbb/tbb21_20090313oss/src/tbb/task.cpp | 4426 ----------------- .../src/tbb/tbb_assert_impl.h | 99 - .../tbb21_20090313oss/src/tbb/tbb_misc.cpp | 144 - .../tbb/tbb21_20090313oss/src/tbb/tbb_misc.h | 212 - .../tbb21_20090313oss/src/tbb/tbb_resource.rc | 126 - .../tbb21_20090313oss/src/tbb/tbb_thread.cpp | 209 - .../tbb21_20090313oss/src/tbb/tbb_version.h | 101 - .../src/tbb/win32-tbb-export.def | 251 - .../src/tbb/win64-tbb-export.def | 247 - .../src/tbbmalloc/Customize.h | 113 - .../src/tbbmalloc/LifoQueue.h | 97 - .../src/tbbmalloc/MapMemory.h | 84 - .../src/tbbmalloc/MemoryAllocator.cpp | 1816 ------- .../src/tbbmalloc/Statistics.h | 121 - .../src/tbbmalloc/TypeDefinitions.h | 102 - .../src/tbbmalloc/lin-tbbmalloc-export.def | 45 - .../src/tbbmalloc/lin32-proxy-export.def | 52 - .../src/tbbmalloc/lin64-proxy-export.def | 52 - .../src/tbbmalloc/lin64ipf-proxy-export.def | 52 - .../src/tbbmalloc/mac32-tbbmalloc-export.def | 35 - .../src/tbbmalloc/mac64-tbbmalloc-export.def | 35 - .../tbb21_20090313oss/src/tbbmalloc/proxy.cpp | 380 -- .../tbb21_20090313oss/src/tbbmalloc/proxy.h | 56 - .../tbbmalloc/tbb_function_replacement.cpp | 371 -- .../src/tbbmalloc/tbb_function_replacement.h | 64 - .../src/tbbmalloc/tbbmalloc.cpp | 225 - .../src/tbbmalloc/tbbmalloc.rc | 129 - .../src/tbbmalloc/win32-tbbmalloc-export.def | 40 - .../src/tbbmalloc/win64-tbbmalloc-export.def | 39 - .../tbb/tbb21_20090313oss/src/test/harness.h | 301 -- .../src/test/harness_allocator.h | 228 - .../src/test/harness_assert.h | 48 - .../src/test/harness_bad_expr.h | 80 - .../src/test/harness_barrier.h | 85 - .../tbb21_20090313oss/src/test/harness_cpu.h | 108 - .../tbb21_20090313oss/src/test/harness_m128.h | 34 - .../src/test/harness_memory.h | 96 - .../src/test/harness_sleep.h | 44 - .../src/test/harness_trace.h | 148 - .../src/test/test_ScalableAllocator.cpp | 56 - .../src/test/test_ScalableAllocator_STL.cpp | 41 - .../src/test/test_aligned_space.cpp | 112 - .../src/test/test_allocator.h | 213 - .../src/test/test_allocator_STL.h | 100 - .../src/test/test_assembly.cpp | 290 -- .../src/test/test_atomic.cpp | 743 --- .../src/test/test_blocked_range.cpp | 130 - .../src/test/test_blocked_range2d.cpp | 154 - .../src/test/test_blocked_range3d.cpp | 185 - .../src/test/test_cache_aligned_allocator.cpp | 45 - .../test/test_cache_aligned_allocator_STL.cpp | 43 - .../src/test/test_compiler.cpp | 60 - .../src/test/test_concurrent_hash_map.cpp | 883 ---- .../src/test/test_concurrent_queue.cpp | 846 ---- .../src/test/test_concurrent_vector.cpp | 923 ---- .../src/test/test_eh_algorithms.cpp | 1777 ------- .../src/test/test_eh_tasks.cpp | 808 --- .../test/test_enumerable_thread_specific.cpp | 635 --- .../tbb21_20090313oss/src/test/test_halt.cpp | 126 - .../src/test/test_handle_perror.cpp | 56 - .../src/test/test_inits_loop.cpp | 101 - .../src/test/test_ittnotify.cpp | 103 - .../src/test/test_malloc_compliance.cpp | 965 ---- .../src/test/test_malloc_overload.cpp | 188 - .../src/test/test_malloc_pure_c.c | 81 - .../src/test/test_malloc_regression.cpp | 108 - .../src/test/test_model_plugin.cpp | 220 - .../tbb21_20090313oss/src/test/test_mutex.cpp | 506 -- .../src/test/test_mutex_native_threads.cpp | 231 - .../src/test/test_openmp.cpp | 236 - .../src/test/test_parallel_do.cpp | 278 -- .../src/test/test_parallel_for.cpp | 167 - .../src/test/test_parallel_invoke.cpp | 377 -- .../src/test/test_parallel_reduce.cpp | 174 - .../src/test/test_parallel_scan.cpp | 275 - .../src/test/test_parallel_sort.cpp | 532 -- .../src/test/test_parallel_while.cpp | 182 - .../src/test/test_pipeline.cpp | 281 -- .../src/test/test_rwm_upgrade_downgrade.cpp | 80 - .../tbb21_20090313oss/src/test/test_task.cpp | 492 -- .../src/test/test_task_assertions.cpp | 122 - .../src/test/test_task_leaks.cpp | 214 - .../src/test/test_task_scheduler_init.cpp | 118 - .../src/test/test_task_scheduler_observer.cpp | 163 - .../src/test/test_tbb_thread.cpp | 278 -- .../src/test/test_tbb_version.cpp | 232 - .../src/test/test_tick_count.cpp | 157 - .../tbb21_20090313oss/src/test/test_yield.cpp | 77 - 427 files changed, 1 insertion(+), 81562 deletions(-) delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/CHANGES delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/COPYING delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/Makefile delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/README delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.gcc.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbb delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbbmalloc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.test delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.gcc.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.suncc.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/codecov.txt delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/common.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/common_rules.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/detect.js delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.bat delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.sh delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/index.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/linux.gcc.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/linux.icc.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/linux.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/macos.gcc.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/macos.icc.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/macos.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/suncc.map.pause delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.bat delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.sh delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_linux.sh delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_macos.sh delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_sunos.sh delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_windows.js delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/index.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/makefile.sln delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbb.vcproj delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc.vcproj delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc_proxy.vcproj delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/version_string.tmp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/windows.cl.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/windows.icl.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/build/windows.inc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/Release_Notes.txt delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00001.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00005.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00006.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00007.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00008.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00010.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00012.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00013.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00014.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00015.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00019.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00021.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00024.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00028.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00029.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00034.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00035.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00036.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00037.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00038.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00040.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00042.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00043.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00044.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00045.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00046.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00047.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00048.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00049.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00050.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00051.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00053.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00055.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00056.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00057.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00058.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00059.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00061.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00062.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00063.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00064.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00066.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00068.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00070.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00071.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00072.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00073.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00074.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00081.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00083.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00084.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00096.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00097.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00098.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00099.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00100.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00101.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00102.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00103.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00104.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00105.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00106.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00107.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00108.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00109.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00110.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00111.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00112.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00113.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00114.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00115.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00116.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00117.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00118.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00119.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00120.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00121.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00122.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00123.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00124.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00125.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00126.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00127.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00128.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00129.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00130.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00131.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00132.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00133.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00134.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00135.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00136.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00137.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00138.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00139.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00140.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00141.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00142.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00143.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00144.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00145.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00146.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00147.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00148.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00175.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00191.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00193.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00194.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00195.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00196.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00197.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00198.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00199.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00201.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00203.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00210.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00211.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00212.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00213.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00215.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00223.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00229.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00238.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00243.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00244.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00247.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00249.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00258.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00260.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00266.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00272.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00277.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00281.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00285.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00290.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00291.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00292.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00293.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00294.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00295.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00296.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00297.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00306.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00307.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00309.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00310.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00311.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00312.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00315.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00316.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00321.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00329.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00330.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/annotated.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/concepts.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/deprecated.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/doxygen.css delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/files.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_enum.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_eval.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_func.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_rela.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_type.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_vars.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals_func.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/graph_legend.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/hierarchy.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/index.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/modules.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_enum.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_eval.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_func.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_type.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespaces.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/pages.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_do_body_req.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_for_body_req.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_body_req.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_lambda_req.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_scan_body_req.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_sort_iter_req.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/range_req.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_b.gif delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_l.gif delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_r.gif delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tabs.css delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/index.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/_tbb_windef.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/aligned_space.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/atomic.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range2d.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range3d.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/cache_aligned_allocator.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_hash_map.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_queue.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_vector.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/enumerable_thread_specific.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/ibm_aix51.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_common.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_em64t.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_ia32.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_itanium.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/mac_ppc.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_em64t.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32_inline.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_rw_mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_do.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_for.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_invoke.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_reduce.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_scan.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_sort.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_while.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/partitioner.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/pipeline.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_rw_mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/recursive_mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/scalable_allocator.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_rw_mutex.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_init.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_observer.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_allocator.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_config.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_exception.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_machine.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_profiling.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_stddef.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_thread.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbbmalloc_proxy.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tick_count.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/index.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/Makefile delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/index.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_queue_v2.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_vector_v2.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_mutex_v2.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/perf_util.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics_xml.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_base.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_framework.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_hash_map.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_locked_work.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_sandbox.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_unit.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_vector.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/cache_aligned_allocator.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_hash_map.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_queue.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_vector.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/em64t-masm/atomic_support.asm delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/enumerable_thread_specific.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/gate.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/atomic_support.asm delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/lock_byte.asm delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ibm_aix51/atomic_support.c delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/index.html delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/atomic_support.s delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/ia64_misc.s delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/lock_byte.s delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/log2.s delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/pause.s delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify_proxy.c delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin32-tbb-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64-tbb-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64ipf-tbb-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac32-tbb-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac64-tbb-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mutex.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/pipeline.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_mutex.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_rw_mutex.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/recursive_mutex.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_mutex.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_rw_mutex.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/task.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_assert_impl.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_resource.rc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_thread.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_version.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win32-tbb-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win64-tbb-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Customize.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/LifoQueue.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MapMemory.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MemoryAllocator.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Statistics.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/TypeDefinitions.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin-tbbmalloc-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin32-proxy-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64-proxy-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64ipf-proxy-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac32-tbbmalloc-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac64-tbbmalloc-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.rc delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win32-tbbmalloc-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win64-tbbmalloc-export.def delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_allocator.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_assert.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_bad_expr.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_barrier.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_cpu.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_m128.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_memory.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_sleep.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_trace.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator_STL.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_aligned_space.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator_STL.h delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_assembly.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_atomic.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range2d.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range3d.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator_STL.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_compiler.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_hash_map.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_queue.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_vector.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_algorithms.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_tasks.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_enumerable_thread_specific.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_halt.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_handle_perror.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_inits_loop.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ittnotify.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_compliance.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_overload.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_pure_c.c delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_regression.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_model_plugin.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex_native_threads.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_openmp.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_do.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_for.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_invoke.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_reduce.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_scan.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_sort.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_while.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_pipeline.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_rwm_upgrade_downgrade.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_assertions.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_leaks.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_init.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_observer.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_thread.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_version.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tick_count.cpp delete mode 100644 deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_yield.cpp diff --git a/deal.II/contrib/tbb/Makefile b/deal.II/contrib/tbb/Makefile index 3eba9f6249..6af3f0f807 100644 --- a/deal.II/contrib/tbb/Makefile +++ b/deal.II/contrib/tbb/Makefile @@ -2,7 +2,7 @@ # the system and compiler names etc. rename them to something that's a bit more # predictable for the downstream make files. tbb: - @cd tbb21_20090313oss ; $(MAKE) tbb tbb_build_dir=$D/lib/contrib/tbb + @cd tbb22_20090809oss ; $(MAKE) tbb tbb_build_dir=$D/lib/contrib/tbb @rm -f $D/lib/libtbb* @for i in $D/lib/contrib/tbb/*_debug/libtbb_debug* ; do \ ln -s -f $$i $D/lib/`echo $$i | $(PERL) -pi -e 's#.*/##g;'` ; done diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/CHANGES b/deal.II/contrib/tbb/tbb21_20090313oss/CHANGES deleted file mode 100644 index 8294d6c17c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/CHANGES +++ /dev/null @@ -1,569 +0,0 @@ -20090313 open-source release - -Changes (w.r.t. 20081109 open-source release): - -- Includes all changes introduced in TBB 2.1 Update 2 & Update 3 - commercial-aligned releases (see below for details). -- Added parallel_invoke template function. It runs up to 10 - user-defined functions in parallel and waits for them to complete. -- Added a special library providing ability to replace the standard - memory allocation routines in Microsoft* C/C++ RTL (malloc/free, - global new/delete, etc.) with the TBB memory allocator. - Usage details are described in include/tbb/tbbmalloc_proxy.h file. -- Task scheduler switched to use new implementation of its core - functionality (deque based task pool, new structure of arena slots). -- Preview of Microsoft* Visual Studio* 2005 project files for - building the library is available in build/vsproject folder. -- Added tests for aligned memory allocations and malloc replacement. -- Added parallel_for/game_of_life.net example (for Windows only) - showing TBB usage in a .NET application. -- A number of other fixes and improvements to code, tests, makefiles, - examples and documents. - -Bugs fixed: -- 150 - request to build TBB examples with debug info in release mode. -- backward compatibility issue with concurrent_queue on Windows. -- dependency on VS 2005 SP1 runtime libraries removed. -- compilation of GUI examples under XCode* 3.1 (1577). -- On Windows, TBB allocator classes can be instantiated with const types - for compatibility with MS implementation of STL containers (1566). - ------------------------------------------------------------------------- -TBB 2.1 Update 3 commercial-aligned release - -Changes (w.r.t. TBB 2.1 U2 commercial-aligned release): - -- Added support for aligned allocations to the TBB memory allocator. -- Added a special library to use with LD_PRELOAD on Linux* in order to - replace the standard memory allocation routines in C/C++ with the - TBB memory allocator. -- Added null_mutex and null_rw_mutex: no-op classes interface-compliant - to other TBB mutexes. -- Improved performance of parallel_sort, to close most of the serial gap - with std::sort, and beat it on 2 and more cores. -- A few other small changes. - -Bugs fixed: - -- the problem where parallel_for hanged after exception throw - if affinity_partitioner was used (1556). -- get rid of VS warnings about mbstowcs deprecation (1560), - as well as some other warnings. -- operator== for concurrent_vector::iterator fixed to work correctly - with different vector instances. - ------------------------------------------------------------------------- -TBB 2.1 Update 2 commercial-aligned release - -Changes (w.r.t. TBB 2.1 U1 commercial-aligned release): - -- Incorporates all open-source-release changes down to TBB 2.1 U1, - except for: - - 20081019 addition of enumerable_thread_specific; -- Warning level for Microsoft* Visual C++* compiler raised to /W4 /Wp64; - warnings found on this level were cleaned or suppressed. -- Added TBB_runtime_interface_version API function. -- Added new example: pipeline/square. -- Added exception handling and cancellation support - for parallel_do and pipeline. -- Added copy constructor and [begin,end) constructor to concurrent_queue. -- Added some support for beta version of Intel(R) Parallel Amplifier. -- Added scripts to set environment for cross-compilation of 32-bit - applications on 64-bit Linux with Intel(R) C++ Compiler. -- Fixed semantics of concurrent_vector::clear() to not deallocate - internal arrays. Fixed compact() to perform such deallocation later. -- Fixed the issue with atomic when T is incomplete type. -- Improved support for PowerPC* Macintosh*, including the fix - for a bug in masked compare-and-swap reported by a customer. -- As usual, a number of other improvements everywhere. - ------------------------------------------------------------------------- -20081109 open-source release - -Changes (w.r.t. previous open-source release): - -- Added new serial out of order filter for tbb::pipeline. -- Fixed the issue with atomic::operator= reported at the forum. -- Fixed the issue with using tbb::task::self() in task destructor - reported at the forum. -- A number of other improvements to code, tests, makefiles, examples - and documents. - -Open-source contributions integrated: -- Changes in the memory allocator were partially integrated. - ------------------------------------------------------------------------- -20081019 open-source release - -Changes (w.r.t. previous open-source release): - -- Introduced enumerable_thread_specific. This new class provides a - wrapper around native thread local storage as well as iterators and - ranges for accessing the thread local copies (1533). -- Improved support for Intel(R) Threading Analysis Tools - on Intel(R) 64 architecture. -- Dependency from Microsoft* CRT was integrated to the libraries using - manifests, to avoid issues if called from code that uses different - version of Visual C++* runtime than the library. -- Introduced new defines TBB_USE_ASSERT, TBB_USE_DEBUG, - TBB_USE_PERFORMANCE_WARNINGS, TBB_USE_THREADING_TOOLS. -- A number of other improvements to code, tests, makefiles, examples - and documents. - -Open-source contributions integrated: - -- linker optimization: /incremental:no . - ------------------------------------------------------------------------- -20080925 open-source release - -Changes (w.r.t. previous open-source release): - -- Same fix for a memory leak in the memory allocator as in TBB 2.1 U1. -- Improved support for lambda functions. -- Fixed more concurrent_queue issues reported at the forum. -- A number of other improvements to code, tests, makefiles, examples - and documents. - ------------------------------------------------------------------------- -TBB 2.1 Update 1 commercial-aligned release - -Changes (w.r.t. TBB 2.1 Gold commercial-aligned release): - -- Fixed small memory leak in the memory allocator. -- Incorporates all open-source-release changes down to TBB 2.1 GOLD, - except for: - - 20080825 changes for parallel_do; - ------------------------------------------------------------------------- -20080825 open-source release - -Changes (w.r.t. previous open-source release): - -- Added exception handling and cancellation support for parallel_do. -- Added default HashCompare template argument for concurrent_hash_map. -- Fixed concurrent_queue.clear() issues due to incorrect assumption - about clear() being private method. -- Added the possibility to use TBB in applications that change - default calling conventions (Windows* only). -- Many improvements to code, tests, examples, makefiles and documents. - -Bugs fixed: - -- 120, 130 - memset declaration missed in concurrent_hash_map.h - ------------------------------------------------------------------------- -20080724 open-source release - -Changes (w.r.t. previous open-source release): - -- Inline assembly for atomic operations improved for gcc 4.3 -- A few more improvements to the code. - ------------------------------------------------------------------------- -20080709 open-source release - -Changes (w.r.t. previous open-source release): - -- operator=() was added to the tbb_thread class according to - the current working draft for std::thread. -- Recognizing SPARC* in makefiles for Linux* and Sun Solaris*. - -Bugs fixed: - -- 127 - concurrent_hash_map::range fixed to split correctly. - -Open-source contributions integrated: - -- fix_set_midpoint.diff by jyasskin -- SPARC* support in makefiles by Raf Schietekat - ------------------------------------------------------------------------- -20080622 open-source release - -Changes (w.r.t. previous open-source release): - -- Fixed a hang that rarely happened on Linux - during deinitialization of the TBB scheduler. -- Improved support for Intel(R) Thread Checker. -- A few more improvements to the code. - ------------------------------------------------------------------------- -TBB 2.1 GOLD commercial-aligned release - -Changes (w.r.t. TBB 2.0 U3 commercial-aligned release): - -- All open-source-release changes down to, and including, TBB 2.0 GOLD - below, were incorporated into this release. - ------------------------------------------------------------------------- -20080605 open-source release - -Changes (w.r.t. previous open-source release): - -- Explicit control of exported symbols by version scripts added on Linux. -- Interfaces polished for exception handling & algorithm cancellation. -- Cache behavior improvements in the scalable allocator. -- Improvements in text_filter, polygon_overlay, and other examples. -- A lot of other stability improvements in code, tests, and makefiles. -- First release where binary packages include headers/docs/examples, so - binary packages are now self-sufficient for using TBB. - -Open-source contributions integrated: - -- atomics patch (partially). -- tick_count warning patch. - -Bugs fixed: - -- 118 - fix for boost compatibility. -- 123 - fix for tbb_machine.h. - ------------------------------------------------------------------------- -20080512 open-source release - -Changes (w.r.t. previous open-source release): - -- Fixed a problem with backward binary compatibility - of debug Linux builds. -- Sun* Studio* support added. -- soname support added on Linux via linker script. To restore backward - binary compatibility, *.so -> *.so.2 softlinks should be created. -- concurrent_hash_map improvements - added few new forms of insert() - method and fixed precondition and guarantees of erase() methods. - Added runtime warning reporting about bad hash function used for - the container. Various improvements for performance and concurrency. -- Cancellation mechanism reworked so that it does not hurt scalability. -- Algorithm parallel_do reworked. Requirement for Body::argument_type - definition removed, and work item argument type can be arbitrarily - cv-qualified. -- polygon_overlay example added. -- A few more improvements to code, tests, examples and Makefiles. - -Open-source contributions integrated: - -- Soname support patch for Bugzilla #112. - -Bugs fixed: - -- 112 - fix for soname support. - ------------------------------------------------------------------------- -TBB 2.0 U3 commercial-aligned release (package 017, April 20, 2008) - -Corresponds to commercial 019 (for Linux*, 020; for Mac OS* X, 018) -packages. - -Changes (w.r.t. TBB 2.0 U2 commercial-aligned release): - -- Does not contain open-source-release changes below; this release is - only a minor update of TBB 2.0 U2. -- Removed spin-waiting in pipeline and concurrent_queue. -- A few more small bug fixes from open-source releases below. - ------------------------------------------------------------------------- -20080408 open-source release - -Changes (w.r.t. previous open-source release): - -- count_strings example reworked: new word generator implemented, hash - function replaced, and tbb_allocator is used with std::string class. -- Static methods of spin_rw_mutex were replaced by normal member - functions, and the class name was versioned. -- tacheon example was renamed to tachyon. -- Improved support for Intel(R) Thread Checker. -- A few more minor improvements. - -Open-source contributions integrated: - -- Two sets of Sun patches for IA Solaris support. - ------------------------------------------------------------------------- -20080402 open-source release - -Changes (w.r.t. previous open-source release): - -- Exception handling and cancellation support for tasks and algorithms - fully enabled. -- Exception safety guaranties defined and fixed for all concurrent - containers. -- User-defined memory allocator support added to all concurrent - containers. -- Performance improvement of concurrent_hash_map, spin_rw_mutex. -- Critical fix for a rare race condition during scheduler - initialization/de-initialization. -- New methods added for concurrent containers to be closer to STL, - as well as automatic filters removal from pipeline - and __TBB_AtomicAND function. -- The volatile keyword dropped from where it is not really needed. -- A few more minor improvements. - ------------------------------------------------------------------------- -20080319 open-source release - -Changes (w.r.t. previous open-source release): - -- Support for gcc version 4.3 was added. -- tbb_thread class, near compatible with std::thread expected in C++0x, - was added. - -Bugs fixed: - -- 116 - fix for compilation issues with gcc version 4.2.1. -- 120 - fix for compilation issues with gcc version 4.3. - ------------------------------------------------------------------------- -20080311 open-source release - -Changes (w.r.t. previous open-source release): - -- An enumerator added for pipeline filter types (serial vs. parallel). -- New task_scheduler_observer class introduced, to observe when - threads start and finish interacting with the TBB task scheduler. -- task_scheduler_init reverted to not use internal versioned class; - binary compatibility guaranteed with stable releases only. -- Various improvements to code, tests, examples and Makefiles. - ------------------------------------------------------------------------- -20080304 open-source release - -Changes (w.r.t. previous open-source release): - -- Task-to-thread affinity support, previously kept under a macro, - now fully legalized. -- Work-in-progress on cache_aligned_allocator improvements. -- Pipeline really supports parallel input stage; it's no more serialized. -- Various improvements to code, tests, examples and Makefiles. - -Bugs fixed: - -- 119 - fix for scalable_malloc sometimes failing to return a big block. -- TR575 - fixed a deadlock occurring on Windows in startup/shutdown - under some conditions. - ------------------------------------------------------------------------- -20080226 open-source release - -Changes (w.r.t. previous open-source release): - -- Introduced tbb_allocator to select between standard allocator and - tbb::scalable_allocator when available. -- Removed spin-waiting in pipeline and concurrent_queue. -- Improved performance of concurrent_hash_map by using tbb_allocator. -- Improved support for Intel(R) Thread Checker. -- Various improvements to code, tests, examples and Makefiles. - ------------------------------------------------------------------------- -TBB 2.0 U2 commercial-aligned release (package 017, February 14, 2008) - -Corresponds to commercial 017 (for Linux*, 018; for Mac OS* X, 016) -packages. - -Changes (w.r.t. TBB 2.0 U1 commercial-aligned release): - -- Does not contain open-source-release changes below; this release is - only a minor update of TBB 2.0 U1. -- Add support for Microsoft* Visual Studio* 2008, including binary - libraries and VS2008 projects for examples. -- Use SwitchToThread() not Sleep() to yield threads on Windows*. -- Enhancements to Doxygen-readable comments in source code. -- A few more small bug fixes from open-source releases below. - -Bugs fixed: - -- TR569 - Memory leak in concurrent_queue. - ------------------------------------------------------------------------- -20080207 open-source release - -Changes (w.r.t. previous open-source release): - -- Improvements and minor fixes in VS2008 projects for examples. -- Improvements in code for gating worker threads that wait for work, - previously consolidated under #if IMPROVED_GATING, now legalized. -- Cosmetic changes in code, examples, tests. - -Bugs fixed: - -- 113 - Iterators and ranges should be convertible to their const - counterparts. -- TR569 - Memory leak in concurrent_queue. - ------------------------------------------------------------------------- -20080122 open-source release - -Changes (w.r.t. previous open-source release): - -- Updated examples/parallel_for/seismic to improve the visuals and to - use the affinity_partitioner (20071127 and forward) for better - performance. -- Minor improvements to unittests and performance tests. - ------------------------------------------------------------------------- -20080115 open-source release - -Changes (w.r.t. previous open-source release): - -- Cleanup, simplifications and enhancements to the Makefiles for - building the libraries (see build/index.html for high-level - changes) and the examples. -- Use SwitchToThread() not Sleep() to yield threads on Windows*. -- Engineering work-in-progress on exception safety/support. -- Engineering work-in-progress on affinity_partitioner for - parallel_reduce. -- Engineering work-in-progress on improved gating for worker threads - (idle workers now block in the OS instead of spinning). -- Enhancements to Doxygen-readable comments in source code. - -Bugs fixed: - -- 102 - Support for parallel build with gmake -j -- 114 - /Wp64 build warning on Windows*. - ------------------------------------------------------------------------- -20071218 open-source release - -Changes (w.r.t. previous open-source release): - -- Full support for Microsoft* Visual Studio* 2008 in open-source. - Binaries for vc9/ will be available in future stable releases. -- New recursive_mutex class. -- Full support for 32-bit PowerMac including export files for builds. -- Improvements to parallel_do. - ------------------------------------------------------------------------- -20071206 open-source release - -Changes (w.r.t. previous open-source release): - -- Support for Microsoft* Visual Studio* 2008 in building libraries - from source as well as in vc9/ projects for examples. -- Small fixes to the affinity_partitioner first introduced in 20071127. -- Small fixes to the thread-stack size hook first introduced in 20071127. -- Engineering work in progress on concurrent_vector. -- Engineering work in progress on exception behavior. -- Unittest improvements. - ------------------------------------------------------------------------- -20071127 open-source release - -Changes (w.r.t. previous open-source release): - -- Task-to-thread affinity support (affinity partitioner) first appears. -- More work on concurrent_vector. -- New parallel_do algorithm (function-style version of parallel while) - and parallel_do/parallel_preorder example. -- New task_scheduler_init() hooks for getting default_num_threads() and - for setting thread stack size. -- Support for weak memory consistency models in the code base. -- Futex usage in the task scheduler (Linux). -- Started adding 32-bit PowerMac support. -- Intel(R) 9.1 compilers are now the base supported Intel(R) compiler - version. -- TBB libraries added to link line automatically on Microsoft Windows* - systems via #pragma comment linker directives. - -Open-source contributions integrated: - -- FreeBSD platform support patches. -- AIX weak memory model patch. - -Bugs fixed: - -- 108 - Removed broken affinity.h reference. -- 101 - Does not build on Debian Lenny (replaced arch with uname -m). - ------------------------------------------------------------------------- -20071030 open-source release - -Changes (w.r.t. previous open-source release): - -- More work on concurrent_vector. -- Better support for building with -Wall -Werror (or not) as desired. -- A few fixes to eliminate extraneous warnings. -- Begin introduction of versioning hooks so that the internal/API - version is tracked via TBB_INTERFACE_VERSION. The newest binary - libraries should always work with previously-compiled code when- - ever possible. -- Engineering work in progress on using futex inside the mutexes (Linux). -- Engineering work in progress on exception behavior. -- Engineering work in progress on a new parallel_do algorithm. -- Unittest improvements. - ------------------------------------------------------------------------- -20070927 open-source release - -Changes: - -- Minor update to TBB 2.0 U1 below. -- Begin introduction of new concurrent_vector interfaces not released - with TBB 2.0 U1. - ------------------------------------------------------------------------- -TBB 2.0 U1 commercial-aligned release (package 014, October 1, 2007) - -Corresponds to commercial 014 (for Linux*, 016) packages. - -Changes (w.r.t. previous commercial-aligned release): - -- All open-source-release changes down to, and including, TBB 2.0 GOLD - below, were incorporated into this release. -- Made a number of changes to the officially supported OS list: - Added Linux* OSs: - Asianux* 3, Debian* 4.0, Fedora Core* 6, Fedora* 7, - Turbo Linux* 11, Ubuntu* 7.04; - Dropped Linux* OSs: - Asianux* 2, Fedora Core* 4, Haansoft* Linux 2006 Server, - Mandriva/Mandrake* 10.1, Miracle Linux* 4.0, - Red Flag* DC Server 5.0; - Only Mac OS* X 10.4.9 (and forward) and Xcode* tool suite 2.4.1 (and - forward) are now supported. -- Commercial installers on Linux* fixed to recommend the correct - binaries to use in more cases, with less unnecessary warnings. -- Changes to eliminate spurious build warnings. - -Open-source contributions integrated: - -- Two small header guard macro patches; it also fixed bug #94. -- New blocked_range3d class. - -Bugs fixed: - -- 93 - Removed misleading comments in task.h. -- 94 - See above. - ------------------------------------------------------------------------- -20070815 open-source release - -Changes: - -- Changes to eliminate spurious build warnings. -- Engineering work in progress on concurrent_vector allocator behavior. -- Added hooks to use the Intel(R) compiler code coverage tools. - -Open-source contributions integrated: - -- Mac OS* X build warning patch. - -Bugs fixed: - -- 88 - Fixed TBB compilation errors if both VS2005 and Windows SDK are - installed. - ------------------------------------------------------------------------- -20070719 open-source release - -Changes: - -- Minor update to TBB 2.0 GOLD below. -- Changes to eliminate spurious build warnings. - ------------------------------------------------------------------------- -TBB 2.0 GOLD commercial-aligned release (package 010, July 19, 2007) - -Corresponds to commercial 010 (for Linux*, 012) packages. - -- TBB open-source debut release. - ------------------------------------------------------------------------- -* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/COPYING b/deal.II/contrib/tbb/tbb21_20090313oss/COPYING deleted file mode 100644 index 5af6ed874d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/COPYING +++ /dev/null @@ -1,353 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. ----------------- END OF Gnu General Public License ---------------- - -The source code of Threading Building Blocks is distributed under version 2 -of the GNU General Public License, with the so-called "runtime exception," -as follows (or see any header or implementation file): - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/Makefile b/deal.II/contrib/tbb/tbb21_20090313oss/Makefile deleted file mode 100644 index aa64667300..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -tbb_root?=. -include $(tbb_root)/build/common.inc -.PHONY: default all tbb tbbmalloc test examples - -#workaround for non-depend targets tbb and tbbmalloc which both depend on version_string.tmp -#According to documentation submakes should run in parallel -.NOTPARALLEL: tbb tbbmalloc - -default: tbb tbbmalloc - -all: tbb tbbmalloc test examples - -tbb: mkdir - @$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbb cfg=debug tbb_root=$(tbb_root) - @$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release tbb_root=$(tbb_root) - -tbbmalloc: mkdir - @$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc tbb_root=$(tbb_root) - @$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc tbb_root=$(tbb_root) - -test: tbb tbbmalloc - -@$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_test tbb_root=$(tbb_root) - -@$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root) - -@$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_test tbb_root=$(tbb_root) - -@$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root) - - - -examples: tbb tbbmalloc - @$(MAKE) -C examples -r -f Makefile tbb_root=.. release test - -.PHONY: clean clean_examples mkdir info - -clean: clean_examples - $(shell $(RM) $(work_dir)_release$(SLASH)*.* >$(NUL) 2>$(NUL)) - $(shell $(RD) $(work_dir)_release >$(NUL) 2>$(NUL)) - $(shell $(RM) $(work_dir)_debug$(SLASH)*.* >$(NUL) 2>$(NUL)) - $(shell $(RD) $(work_dir)_debug >$(NUL) 2>$(NUL)) - @echo clean done - -clean_examples: - $(shell $(MAKE) -s -i -r -C examples -f Makefile tbb_root=.. clean >$(NUL) 2>$(NUL)) - -mkdir: - $(shell $(MD) "$(work_dir)_release" >$(NUL) 2>$(NUL)) - $(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_release" && $(MAKE_TBBVARS) $(tbb_build_prefix)_release) - $(shell $(MD) "$(work_dir)_debug" >$(NUL) 2>$(NUL)) - $(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_debug" && $(MAKE_TBBVARS) $(tbb_build_prefix)_debug) - -info: - @echo OS: $(tbb_os) - @echo arch=$(arch) - @echo compiler=$(compiler) - @echo runtime=$(runtime) - @echo tbb_build_prefix=$(tbb_build_prefix) - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/README b/deal.II/contrib/tbb/tbb21_20090313oss/README deleted file mode 100644 index 67ab8ad2e0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/README +++ /dev/null @@ -1,11 +0,0 @@ -Threading Building Blocks - README - -See index.html for directions and documentation. - -If source is present (./Makefile and src/ directories), -type 'gmake' in this directory to build and test. - -See examples/index.html for runnable examples and directions. - -See http://threadingbuildingblocks.org for full documentation -and software information. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.gcc.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.gcc.inc deleted file mode 100644 index 3efcb527fd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.gcc.inc +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -COMPILE_ONLY = -c -MMD -PREPROC_ONLY = -E -x c -INCLUDE_KEY = -I -DEFINE_KEY = -D -OUTPUT_KEY = -o # -OUTPUTOBJ_KEY = -o # -PIC_KEY = -fPIC -WARNING_AS_ERROR_KEY = -Werror -WARNING_KEY = -Wall -DYLIB_KEY = -shared -#LIBDL = -ldl - -TBB_NOSTRICT = 1 - -CPLUS = g++ -LIB_LINK_FLAGS = -shared -LIBS = -lpthread -C_FLAGS = $(CPLUS_FLAGS) -x c - -ifeq ($(cfg), release) - CPLUS_FLAGS = -O2 -DUSE_PTHREAD -endif -ifeq ($(cfg), debug) - CPLUS_FLAGS = -DTBB_USE_DEBUG -g -O0 -DUSE_PTHREAD -endif - -ASM= -ASM_FLAGS= - -TBB_ASM.OBJ= - -ifeq (itanium,$(arch)) -# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables - CPLUS_FLAGS += $(PIC_KEY) -endif - -ifeq (em64t,$(arch)) - CPLUS_FLAGS += -m64 - LIB_LINK_FLAGS += -m64 -endif - -ifeq (ia32,$(arch)) - CPLUS_FLAGS += -m32 - LIB_LINK_FLAGS += -m32 -endif - -#------------------------------------------------------------------------------ -# Setting assembler data. -#------------------------------------------------------------------------------ -ASSEMBLY_SOURCE=$(arch)-gas -ifeq (itanium,$(arch)) - ASM=as - TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o -endif -#------------------------------------------------------------------------------ -# End of setting assembler data. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ - -M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2 - -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.inc deleted file mode 100644 index e0b03cc03c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/FreeBSD.inc +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -ifndef arch - ifeq ($(shell uname -m),i386) - export arch:=ia32 - endif - ifeq ($(shell uname -m),ia64) - export arch:=itanium - endif - ifeq ($(shell uname -m),amd64) - export arch:=em64t - endif -endif - -ifndef runtime - gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//') - os_version:=$(shell uname -r) - os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//') - export runtime:=cc$(gcc_version)_kernel$(os_kernel_version) -endif - -native_compiler := gcc -export compiler ?= gcc -debugger ?= gdb - -CMD=$(SHELL) -c -CWD=$(shell pwd) -RM?=rm -f -RD?=rmdir -MD?=mkdir -p -NUL= /dev/null -SLASH=/ -MAKE_VERSIONS=sh $(tbb_root)/build/version_info_linux.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp -MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh - -ifdef LD_LIBRARY_PATH - export LD_LIBRARY_PATH := .:$(LD_LIBRARY_PATH) -else - export LD_LIBRARY_PATH := . -endif - -####### Build settings ######################################################## - -OBJ = o -DLL = so - -TBB.DEF = -TBB.DLL = libtbb$(DEBUG_SUFFIX).$(DLL) -TBB.LIB = $(TBB.DLL) -LINK_TBB.LIB = $(TBB.LIB) - -MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL) -MALLOC.LIB = $(MALLOC.DLL) - -TBB_NOSTRICT=1 - -TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbb b/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbb deleted file mode 100644 index 7142353e5f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbb +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -#------------------------------------------------------------------------------ -# Define rules for making the TBB shared library. -#------------------------------------------------------------------------------ - -tbb_root ?= "$(TBB21_INSTALL_DIR)" -BUILDING_PHASE=1 -include $(tbb_root)/build/common.inc -DEBUG_SUFFIX=$(findstring _debug,_$(cfg)) - -#------------------------------------------------------------ -# Define static pattern rules dealing with .cpp source files -#------------------------------------------------------------ -# $(warning CONFIG: cfg=$(cfg) arch=$(arch) compiler=$(compiler) os=$(tbb_os) runtime=$(runtime)) - -default_tbb: $(TBB.DLL) -.PHONY: default_tbb tbbvars clean -.PRECIOUS: %.$(OBJ) - -VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/old - -CPLUS_FLAGS += $(PIC_KEY) $(DEFINE_KEY)__TBB_BUILD=1 - -ifeq (1,$(TBB_NOSTRICT)) -# GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict_ansi mode. -# The Mac uses gcc, so the list is empty for that platform. -# The files below need the -strict_ansi flag downgraded to -ansi to compile - -KNOWN_NOSTRICT = concurrent_hash_map.o \ - concurrent_queue.o \ - enumerable_thread_specific.o \ - concurrent_vector_v2.o \ - concurrent_vector.o - -endif - -# Object files (that were compiled from C++ code) that gmake up TBB -TBB_CPLUS.OBJ = concurrent_hash_map.$(OBJ) \ - concurrent_queue.$(OBJ) \ - concurrent_vector.$(OBJ) \ - dynamic_link.$(OBJ) \ - itt_notify.$(OBJ) \ - cache_aligned_allocator.$(OBJ) \ - pipeline.$(OBJ) \ - queuing_mutex.$(OBJ) \ - queuing_rw_mutex.$(OBJ) \ - spin_rw_mutex.$(OBJ) \ - spin_mutex.$(OBJ) \ - task.$(OBJ) \ - tbb_misc.$(OBJ) \ - mutex.$(OBJ) \ - recursive_mutex.$(OBJ) \ - tbb_thread.$(OBJ) \ - enumerable_thread_specific.$(OBJ) \ - itt_notify_proxy.$(OBJ) - -# OLD/Legacy object files for backward binary compatibility -ifeq (,$(findstring $(DEFINE_KEY)TBB_NO_LEGACY,$(CPLUS_FLAGS))) -TBB_CPLUS_OLD.OBJ = \ - concurrent_vector_v2.$(OBJ) \ - concurrent_queue_v2.$(OBJ) \ - spin_rw_mutex_v2.$(OBJ) -endif - -# Object files that gmake up TBB (TBB_ASM.OBJ is platform-specific) -TBB.OBJ = $(TBB_CPLUS.OBJ) $(TBB_CPLUS_OLD.OBJ) $(TBB_ASM.OBJ) - -# Suppress superfluous warnings for TBB compilation -WARNING_KEY += $(WARNING_SUPPRESS) - - -include $(tbb_root)/build/common_rules.inc - -ifneq (,$(TBB.DEF)) -tbb.def: $(TBB.DEF) - @echo "=====tbb=========================MT== $(cfg)/$@" - @$(CMD) "$(CPLUS) $(PREPROC_ONLY) $(TBB.DEF) $(INCLUDES) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbb.def 2>$(NUL) || exit 0" - -LIB_LINK_FLAGS += $(EXPORT_KEY)tbb.def -$(TBB.DLL): tbb.def -endif - -$(TBB.DLL): BUILDING_LIBRARY = $(TBB.DLL) -$(TBB.DLL): $(TBB.OBJ) $(TBB.RES) tbbvars $(TBB_NO_VERSION.DLL) - @echo "=====tbb=========================MT== $(cfg)/$@" - @$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(TBB.DLL) $(TBB.OBJ) $(TBB.RES) $(LIB_LINK_LIBS) $(LIB_LINK_FLAGS) - -ifneq (,$(TBB_NO_VERSION.DLL)) -$(TBB_NO_VERSION.DLL): - @echo "=====tbb=========================MT== $(cfg)/$@" - @echo "INPUT ($(TBB.DLL))" > $(TBB_NO_VERSION.DLL) -endif - -#clean: -# $(RM) *.$(OBJ) *.$(DLL) *.res *.map *.ilk *.pdb *.exp *.manifest *.tmp *.d core core.*[0-9][0-9] - -# Include automatically generated dependences --include *.d diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbbmalloc b/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbbmalloc deleted file mode 100644 index 734b1ee638..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.tbbmalloc +++ /dev/null @@ -1,167 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -tbb_root ?= $(TBB21_INSTALL_DIR) -BUILDING_PHASE=1 -include $(tbb_root)/build/common.inc -DEBUG_SUFFIX=$(findstring _debug,_$(cfg)) - -# default target -default_malloc: malloc malloc_test - -MALLOC_ROOT ?= $(tbb_root)/src/tbbmalloc -MALLOC_SOURCE_ROOT ?= $(MALLOC_ROOT) - -VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/test -VPATH += $(MALLOC_ROOT) $(MALLOC_SOURCE_ROOT) - -KNOWN_NOSTRICT = test_ScalableAllocator_STL.$(OBJ) test_malloc_compliance.$(OBJ) test_malloc_overload.$(OBJ) -KNOWN_WARNINGS = - -CPLUS_FLAGS += $(if $(crosstest),$(DEFINE_KEY)__TBBMALLOC_NO_IMPLICIT_LINKAGE=1) - -include $(tbb_root)/build/common_rules.inc - -#------------------------------------------------------ -# Define rules for making the TBBMalloc shared library. -#------------------------------------------------------ - -# Object files that make up TBBMalloc -MALLOC_CPLUS.OBJ = tbbmalloc.$(OBJ) dynamic_link.$(OBJ) -MALLOC_CUSTOM.OBJ += tbb_misc_malloc.$(OBJ) -MALLOC_ASM.OBJ = $(TBB_ASM.OBJ) - -# MALLOC_CPLUS.OBJ is built in two steps due to Intel Compiler Tracker # C69574 -MALLOC.OBJ := $(MALLOC_CPLUS.OBJ) $(MALLOC_ASM.OBJ) $(MALLOC_CUSTOM.OBJ) MemoryAllocator.$(OBJ) itt_notify_proxy.$(OBJ) -MALLOC_CPLUS.OBJ += MemoryAllocator.$(OBJ) -PROXY.OBJ := proxy.$(OBJ) tbb_function_replacement.$(OBJ) -M_CPLUS_FLAGS := $(subst $(WARNING_KEY),,$(M_CPLUS_FLAGS)) $(DEFINE_KEY)__TBB_BUILD=1 -M_INCLUDES = $(INCLUDES) $(INCLUDE_KEY)$(MALLOC_ROOT) $(INCLUDE_KEY)$(MALLOC_SOURCE_ROOT) - -# Suppress superfluous warnings for TBBmalloc compilation -$(MALLOC.OBJ): M_CPLUS_FLAGS += $(WARNING_SUPPRESS) - -itt_notify_proxy.$(OBJ): C_FLAGS += $(PIC_KEY) - -$(PROXY.OBJ): %.$(OBJ): %.cpp - $(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $< - -$(MALLOC_CPLUS.OBJ): %.$(OBJ): %.cpp - $(CPLUS) $(COMPILE_ONLY) $(M_CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $< - -tbb_misc_malloc.$(OBJ): tbb_misc.cpp version_string.tmp - $(CPLUS) $(COMPILE_ONLY) $(subst -strict_ansi,-ansi,$(M_CPLUS_FLAGS)) $(PIC_KEY) $(OUTPUTOBJ_KEY)$@ $(INCLUDE_KEY). $(INCLUDES) $< - -MALLOC_LINK_FLAGS = $(LIB_LINK_FLAGS) -PROXY_LINK_FLAGS = $(LIB_LINK_FLAGS) - -ifneq (,$(MALLOC.DEF)) -tbbmalloc.def: $(MALLOC.DEF) - $(CMD) "$(CPLUS) $(PREPROC_ONLY) $(MALLOC.DEF) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbbmalloc.def 2>$(NUL) || exit 0" - -MALLOC_LINK_FLAGS += $(EXPORT_KEY)tbbmalloc.def -$(MALLOC.DLL): tbbmalloc.def -endif - -$(MALLOC.DLL): BUILDING_LIBRARY = $(MALLOC.DLL) -$(MALLOC.DLL): $(MALLOC.OBJ) $(MALLOC.RES) $(MALLOC_NO_VERSION.DLL) - $(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(MALLOC.DLL) $(MALLOC.OBJ) $(MALLOC.RES) $(LIB_LINK_LIBS) $(MALLOC_LINK_FLAGS) - -ifneq (,$(MALLOCPROXY.DEF)) -tbbmallocproxy.def: $(MALLOCPROXY.DEF) - $(CMD) "$(CPLUS) $(PREPROC_ONLY) $(MALLOCPROXY.DEF) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbbmallocproxy.def 2>$(NUL) || exit 0" - -PROXY_LINK_FLAGS += $(EXPORT_KEY)tbbmallocproxy.def -$(MALLOCPROXY.DLL): tbbmallocproxy.def -endif - -ifneq (,$(MALLOCPROXY.DLL)) -$(MALLOCPROXY.DLL): BUILDING_LIBRARY = $(MALLOCPROXY.DLL) -$(MALLOCPROXY.DLL): $(PROXY.OBJ) $(MALLOCPROXY_NO_VERSION.DLL) $(MALLOC.DLL) $(MALLOC.RES) - $(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(MALLOCPROXY.DLL) $(PROXY.OBJ) $(MALLOC.RES) $(LIB_LINK_LIBS) $(LINK_MALLOC.LIB) $(PROXY_LINK_FLAGS) - -malloc: $(MALLOCPROXY.DLL) -endif - -ifneq (,$(MALLOC_NO_VERSION.DLL)) -$(MALLOC_NO_VERSION.DLL): - echo "INPUT ($(MALLOC.DLL))" > $(MALLOC_NO_VERSION.DLL) -endif - -ifneq (,$(MALLOCPROXY_NO_VERSION.DLL)) -$(MALLOCPROXY_NO_VERSION.DLL): - echo "INPUT ($(MALLOCPROXY.DLL))" > $(MALLOCPROXY_NO_VERSION.DLL) -endif - -malloc: $(MALLOC.DLL) $(MALLOCPROXY.DLL) - -malloc_dll: $(MALLOC.DLL) - -malloc_proxy_dll: $(MALLOCPROXY.DLL) - -.PHONY: malloc malloc_dll malloc_proxy_dll - -#------------------------------------------------------ -# End of rules for making the TBBMalloc shared library -#------------------------------------------------------ - -#------------------------------------------------------ -# Define rules for making the TBBMalloc unit tests -#------------------------------------------------------ - -add_debug=$(basename $(1))_debug$(suffix $(1)) -cross_suffix=$(if $(crosstest),$(if $(DEBUG_SUFFIX),$(subst _debug,,$(1)),$(call add_debug,$(1))),$(1)) - -MALLOC_MAIN_TESTS = test_ScalableAllocator.exe test_ScalableAllocator_STL.exe test_malloc_compliance.exe test_malloc_regression.exe -MALLOC_C_TESTS = test_malloc_pure_c.exe -MALLOC_OVERLOAD_TESTS = test_malloc_overload.exe test_malloc_overload_proxy.exe - -test_malloc_overload.exe: test_malloc_overload.$(OBJ) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBDL) $(LIBS) $(LINK_FLAGS) -test_malloc_overload_proxy.exe: test_malloc_overload.$(OBJ) $(call cross_suffix,$(MALLOCPROXY.LIB)) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBDL) $(LIBS) $(LINK_FLAGS) - -$(MALLOC_MAIN_TESTS): %.exe: %.$(OBJ) $(call cross_suffix,$(MALLOC.LIB)) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBS) $(LINK_FLAGS) -$(MALLOC_C_TESTS): %.exe: %.$(OBJ) $(call cross_suffix,$(MALLOC.LIB)) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBS) $(LINK_FLAGS) - -# run_cmd is usually empty -malloc_test: $(call cross_suffix,$(MALLOC.DLL)) $(MALLOC_MAIN_TESTS) $(MALLOC_C_TESTS) $(MALLOC_OVERLOAD_TESTS) - $(run_cmd) $(TEST_LAUNCHER) -l $(MALLOCPROXY.DLL) test_malloc_overload.exe - $(run_cmd) $(TEST_LAUNCHER) test_malloc_overload_proxy.exe - $(run_cmd) $(TEST_LAUNCHER) test_malloc_compliance.exe 1:4 - $(run_cmd) ./test_ScalableAllocator.exe - $(run_cmd) ./test_ScalableAllocator_STL.exe - $(run_cmd) ./test_malloc_regression.exe - $(run_cmd) ./test_malloc_pure_c.exe - -#------------------------------------------------------ -# End of rules for making the TBBMalloc unit tests -#------------------------------------------------------ - -# Include automatically generated dependences --include *.d diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.test b/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.test deleted file mode 100644 index bb0f18049f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/Makefile.test +++ /dev/null @@ -1,251 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -#------------------------------------------------------------------------------ -# Define rules for making the TBB tests. -#------------------------------------------------------------------------------ -.PHONY: default test_tbb_plain test_tbb_old clean - -tbb_root ?= $(TBB21_INSTALL_DIR) -BUILDING_PHASE=1 -include $(tbb_root)/build/common.inc -DEBUG_SUFFIX=$(findstring _debug,$(call cross_cfg,_$(cfg))) - -default: test_tbb_plain test_tbb_old -ifneq (,$(codecov)) - profmerge - codecov $(if $(findstring -,$(codecov)),$(codecov),) -demang -comp $(tbb_root)/build/codecov.txt -endif - -#------------------------------------------------------------ -# Define static pattern rules dealing with .cpp source files -#------------------------------------------------------------ - -VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/old $(tbb_root)/src/test $(tbb_root)/src/perf - -CPLUS_FLAGS += $(if $(crosstest),$(DEFINE_KEY)__TBB_NO_IMPLICIT_LINKAGE=1) - -ifeq (1,$(TBB_NOSTRICT)) -# GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict_ansi mode. -# The Mac uses gcc 4.0, so the list is empty for that platform. -# The files below need the -strict_ansi flag downgraded to -ansi to compile - -KNOWN_NOSTRICT += \ - test_concurrent_hash_map.o \ - test_concurrent_vector.o \ - test_concurrent_queue.o \ - test_enumerable_thread_specific.o \ - test_handle_perror.o \ - test_cache_aligned_allocator_STL.o \ - test_task_scheduler_init.o \ - test_model_plugin.o \ - test_parallel_do.o \ - test_eh_algorithms.o \ - test_parallel_sort.o \ - test_tbb_version.o - -endif - -# KNOWN_WARNINGS is empty now! Kept here as a placeholder -# KNOWN_WARNINGS = - - -include $(tbb_root)/build/common_rules.inc - -# Rule for generating executable test -%.exe: %.$(OBJ) $(TBB.LIB) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LINK_TBB.LIB) $(LIBS) $(LINK_FLAGS) - -# Rules for generating a test DLL -%.$(DLL).$(OBJ): %.cpp - $(CPLUS) $(COMPILE_ONLY) $(OUTPUTOBJ_KEY)$@ $(CPLUS_FLAGS_NOSTRICT) $(PIC_KEY) $(DEFINE_KEY)_USRDLL $(INCLUDES) $< -%.$(DLL): %.$(DLL).$(OBJ) $(TBB.LIB) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LINK_TBB.LIB) $(LIBS) $(LINK_FLAGS) $(PIC_KEY) $(DYLIB_KEY) - -# Rules for the tests, which use TBB in a dynamically loadable library -test_model_plugin.exe: test_model_plugin.$(OBJ) test_model_plugin.$(DLL) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LIBDL) $(LIBS) $(LINK_FLAGS) - - -TASK_CPP_DEPENDENCIES = $(TBB_ASM.OBJ) cache_aligned_allocator.$(OBJ) dynamic_link.$(OBJ) tbb_misc.$(OBJ) itt_notify.$(OBJ) mutex.$(OBJ) spin_rw_mutex.$(OBJ) spin_mutex.$(OBJ) itt_notify_proxy.$(OBJ) - -# These executables don't depend on the TBB library, but include task.cpp directly -TASK_CPP_DIRECTLY_INCLUDED = test_eh_tasks.exe \ - test_task_leaks.exe \ - test_task_assertions.exe \ - test_assembly.exe - -$(TASK_CPP_DIRECTLY_INCLUDED): WARNING_KEY += $(WARNING_SUPPRESS) - -$(TASK_CPP_DIRECTLY_INCLUDED): %.exe : %.$(OBJ) $(TASK_CPP_DEPENDENCIES) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBDL) $(LIBS) $(LINK_FLAGS) - -test_handle_perror.exe: test_handle_perror.$(OBJ) tbb_misc.$(OBJ) $(TBB_ASM.OBJ) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LINK_TBB.LIB) $(LIBS) $(LINK_FLAGS) - - -# Rules for the tests, which depend on tbbmalloc -test_concurrent_hash_map_string.exe: test_concurrent_hash_map_string.$(OBJ) - $(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LINK_TBB.LIB) $(MALLOC.LIB) $(LIBS) $(LINK_FLAGS) - - -# These are in alphabetical order -TEST_TBB_PLAIN.EXE = test_assembly.exe \ - test_aligned_space.exe \ - test_task_assertions.exe \ - test_atomic.exe \ - test_blocked_range.exe \ - test_blocked_range2d.exe \ - test_blocked_range3d.exe \ - test_compiler.exe \ - test_concurrent_queue.exe \ - test_concurrent_vector.exe \ - test_concurrent_hash_map.exe \ - test_enumerable_thread_specific.exe \ - test_handle_perror.exe \ - test_halt.exe \ - test_model_plugin.exe \ - test_mutex.exe \ - test_mutex_native_threads.exe \ - test_rwm_upgrade_downgrade.exe \ - test_cache_aligned_allocator_STL.exe \ - test_cache_aligned_allocator.exe \ - test_parallel_for.exe \ - test_parallel_reduce.exe \ - test_parallel_sort.exe \ - test_parallel_scan.exe \ - test_parallel_while.exe \ - test_parallel_do.exe \ - test_pipeline.exe \ - test_task_scheduler_init.exe \ - test_task_scheduler_observer.exe \ - test_task.exe \ - test_task_leaks.exe \ - test_tbb_thread.exe \ - test_tick_count.exe \ - test_inits_loop.exe \ - test_yield.exe \ - test_tbb_version.exe \ - test_eh_tasks.exe \ - test_eh_algorithms.exe \ - test_parallel_invoke.exe \ - test_ittnotify.exe - -ifdef OPENMP_FLAG - TEST_TBB_PLAIN.EXE += test_tbb_openmp -test_openmp.exe: test_openmp.cpp - $(CPLUS) $(OPENMP_FLAG) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $(INCLUDES) $^ $(LIBS) $(LINK_TBB.LIB) -.PHONY: test_tbb_openmp -test_tbb_openmp: test_openmp.exe - ./test_openmp.exe 1:4 - -endif - -# Run tests that are in TEST_TBB_PLAIN.EXE -# The test are ordered so that simpler components are tested first. -# If a component Y uses component X, then tests for Y should come after tests for X. -# Note that usually run_cmd is empty, and tests run directly -test_tbb_plain: $(TEST_TBB_PLAIN.EXE) - $(run_cmd) ./test_assembly.exe - $(run_cmd) ./test_compiler.exe - # Yes, 4:8 is intended on the next line. - $(run_cmd) ./test_yield.exe 4:8 - $(run_cmd) ./test_handle_perror.exe - $(run_cmd) ./test_task_scheduler_init.exe 1:4 - $(run_cmd) ./test_task_scheduler_observer.exe 1:4 - $(run_cmd) ./test_task_assertions.exe - $(run_cmd) ./test_task.exe 1:4 - $(run_cmd) ./test_task_leaks.exe - $(run_cmd) ./test_atomic.exe - $(run_cmd) ./test_cache_aligned_allocator.exe - $(run_cmd) ./test_cache_aligned_allocator_STL.exe - $(run_cmd) ./test_blocked_range.exe 1:4 - $(run_cmd) ./test_blocked_range2d.exe 1:4 - $(run_cmd) ./test_blocked_range3d.exe 1:4 - $(run_cmd) ./test_parallel_for.exe 1:4 - $(run_cmd) ./test_parallel_sort.exe 1:4 - $(run_cmd) ./test_aligned_space.exe - $(run_cmd) ./test_parallel_reduce.exe 1:4 - $(run_cmd) ./test_parallel_scan.exe 1:4 - $(run_cmd) ./test_parallel_while.exe 1:4 - $(run_cmd) ./test_parallel_do.exe 1:4 - $(run_cmd) ./test_inits_loop.exe - $(run_cmd) ./test_mutex.exe 1 - $(run_cmd) ./test_mutex.exe 2 - $(run_cmd) ./test_mutex.exe 4 - $(run_cmd) ./test_mutex_native_threads.exe 1:4 - $(run_cmd) ./test_rwm_upgrade_downgrade.exe 4 - # Yes, 4:8 is intended on the next line. - $(run_cmd) ./test_halt.exe 4:8 - $(run_cmd) ./test_pipeline.exe 1:4 - $(run_cmd) ./test_tick_count.exe 1:4 - $(run_cmd) ./test_concurrent_queue.exe 1:4 - $(run_cmd) ./test_concurrent_vector.exe 1:4 - $(run_cmd) ./test_concurrent_hash_map.exe 1:4 - $(run_cmd) ./test_enumerable_thread_specific.exe 0:4 - $(run_cmd) ./test_model_plugin.exe 4 - $(run_cmd) ./test_tbb_version.exe - $(run_cmd) ./test_eh_tasks.exe 2:4 - $(run_cmd) ./test_eh_algorithms.exe 2:4 - $(run_cmd) ./test_tbb_thread.exe - $(run_cmd) ./test_parallel_invoke.exe 1:4 - $(run_cmd) ./test_ittnotify.exe 2:2 - -TEST_TBB_OLD.OBJ = test_concurrent_vector_v2.$(OBJ) test_concurrent_queue_v2.$(OBJ) test_mutex_v2.$(OBJ) - -TEST_TBB_DEPRECATED.OBJ = - -# For old files, we don't mind warnings etc., thus compilation rules are most relaxed -$(TEST_TBB_OLD.OBJ): %.$(OBJ): %.cpp - $(CPLUS) $(COMPILE_ONLY) $(subst $(WARNING_KEY),,$(CPLUS_FLAGS_NOSTRICT)) $(WARNING_SUPPRESS) $(INCLUDES) $< - -TEST_TBB_OLD.EXE = $(subst .$(OBJ),.exe,$(TEST_TBB_OLD.OBJ) $(TEST_TBB_DEPRECATED.OBJ)) - -test_tbb_old: $(TEST_TBB_OLD.EXE) - $(run_cmd) ./test_concurrent_vector_v2.exe 1:4 - $(run_cmd) ./test_concurrent_queue_v2.exe 1:4 - $(run_cmd) ./test_mutex_v2.exe 1 - $(run_cmd) ./test_mutex_v2.exe 2 - $(run_cmd) ./test_mutex_v2.exe 4 - -test_% debug_%: test_%.exe - $(run_cmd) ./$^ $(args) -ifneq (,$(codecov)) - profmerge - codecov $(if $(findstring -,$(codecov)),$(codecov),) -demang -comp $(tbb_root)/build/codecov.txt -endif - -time_%: time_%.exe - $(run_cmd) ./$^ $(args) - -clean_%: - $(RM) $*.$(OBJ) $*.exe $*.$(DLL) $*.$(LIBEXT) $*.res $*.map $*.ilk $*.pdb $*.exp $*.*manifest $*.tmp $*.d pgopti.* *.dyn - -clean: - $(RM) *.$(OBJ) *.exe *.$(DLL) *.$(LIBEXT) *.res *.map *.ilk *.pdb *.exp *.manifest *.tmp *.d pgopti.* *.dyn core core.*[0-9][0-9] - -# Include automatically generated dependences --include *.d diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.gcc.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.gcc.inc deleted file mode 100644 index b8cc312a76..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.gcc.inc +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -COMPILE_ONLY = -c -MMD -PREPROC_ONLY = -E -x c -INCLUDE_KEY = -I -DEFINE_KEY = -D -OUTPUT_KEY = -o # -OUTPUTOBJ_KEY = -o # -PIC_KEY = -fPIC -WARNING_AS_ERROR_KEY = -Werror -WARNING_KEY = -Wall -DYLIB_KEY = -shared -LIBDL = -ldl - -TBB_NOSTRICT = 1 - -CPLUS = g++ -LIB_LINK_FLAGS = -shared -LIBS = -lpthread -lrt -ldl -C_FLAGS = $(CPLUS_FLAGS) -x c - -ifeq ($(cfg), release) - CPLUS_FLAGS = -O2 -DUSE_PTHREAD -endif -ifeq ($(cfg), debug) - CPLUS_FLAGS = -DTBB_USE_DEBUG -g -O0 -DUSE_PTHREAD -endif - -ASM= -ASM_FLAGS= - -TBB_ASM.OBJ= - -ifeq (itanium,$(arch)) -# Position-independent code (PIC) is a must for IA-64 - CPLUS_FLAGS += $(PIC_KEY) -endif - -ifeq (em64t,$(arch)) - CPLUS_FLAGS += -m64 - LIB_LINK_FLAGS += -m64 -endif - -ifeq (ia32,$(arch)) - CPLUS_FLAGS += -m32 - LIB_LINK_FLAGS += -m32 -endif - -# for some gcc versions on Solaris, -m64 may imply V9, but perhaps not everywhere (TODO: verify) -ifeq (sparc,$(arch)) - CPLUS_FLAGS += -mcpu=v9 -m64 - LIB_LINK_FLAGS += -mcpu=v9 -m64 -endif - -#------------------------------------------------------------------------------ -# Setting assembler data. -#------------------------------------------------------------------------------ -ASSEMBLY_SOURCE=$(arch)-gas -ifeq (itanium,$(arch)) - ASM=ias - TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o -endif -#------------------------------------------------------------------------------ -# End of setting assembler data. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ - -M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2 - -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.inc deleted file mode 100644 index 36c4bb8f78..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.inc +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -ifndef arch - arch:=$(shell uname -p) - ifeq ($(arch),i386) - ifeq ($(shell isainfo -b),64) - arch:=em64t - else - arch:=ia32 - endif - endif - export arch -# For non-IA systems running Sun OS, 'arch' will contain whatever is printed by uname -p. -# In particular, for SPARC architecture it will contain "sparc". -endif - -ifndef runtime - gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//') - os_version:=$(shell uname -r) - os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//') - export runtime:=cc$(gcc_version)_kernel$(os_kernel_version) -endif - -native_compiler := suncc -export compiler ?= suncc -# debugger ?= gdb - -CMD=$(SHELL) -c -CWD=$(shell pwd) -RM?=rm -f -RD?=rmdir -MD?=mkdir -p -NUL= /dev/null -SLASH=/ -MAKE_VERSIONS=bash $(tbb_root)/build/version_info_sunos.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp -MAKE_TBBVARS=bash $(tbb_root)/build/generate_tbbvars.sh - -ifeq ($(compiler),suncc) - export TBB_CUSTOM_VARS_SH=CXXFLAGS="-I$(CWD)/../include -library=stlport4 $(CXXFLAGS) -M$(CWD)/../build/suncc.map.pause" - export TBB_CUSTOM_VARS_CSH=CXXFLAGS "-I$(CWD)/../include -library=stlport4 $(CXXFLAGS) -M$(CWD)/../build/suncc.map.pause" -endif - -ifdef LD_LIBRARY_PATH - export LD_LIBRARY_PATH := .:$(LD_LIBRARY_PATH) -else - export LD_LIBRARY_PATH := . -endif - -####### Build settings ######################################################## - -OBJ = o -DLL = so - -TBB.DEF = -TBB.DLL = libtbb$(DEBUG_SUFFIX).$(DLL) -TBB.LIB = $(TBB.DLL) -LINK_TBB.LIB = $(TBB.LIB) - -MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL) -MALLOC.LIB = $(MALLOC.DLL) - -MALLOCPROXY.DLL = libtbbmalloc_proxy$(DEBUG_SUFFIX).$(DLL) - -TBB_NOSTRICT=1 - -TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.suncc.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.suncc.inc deleted file mode 100644 index 540cb56002..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/SunOS.suncc.inc +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -COMPILE_ONLY = -c -MMD -errtags -PREPROC_ONLY = -E -MMD -INCLUDE_KEY = -I -DEFINE_KEY = -D -OUTPUT_KEY = -o # -OUTPUTOBJ_KEY = -o # -PIC_KEY = -KPIC -DYLIB_KEY = -G -LIBDL = -ldl -# WARNING_AS_ERROR_KEY = -errwarn=%all -WARNING_AS_ERROR_KEY = Warning as error -WARNING_SUPPRESS = -erroff=unassigned,attrskipunsup,badargtype2w,badbinaryopw,wbadasg,wvarhidemem -tbb_strict=0 - -TBB_NOSTRICT = 1 - -CPLUS = CC -CONLY = cc -LIB_LINK_FLAGS = -G -R . -M$(tbb_root)/build/suncc.map.pause -LINK_FLAGS += -M$(tbb_root)/build/suncc.map.pause -LIBS = -lpthread -lrt -R . -C_FLAGS = $(CPLUS_FLAGS) - -ifeq ($(cfg), release) - CPLUS_FLAGS = -mt -xO2 -library=stlport4 -DUSE_PTHREAD $(WARNING_SUPPRESS) -endif -ifeq ($(cfg), debug) - CPLUS_FLAGS = -mt -DTBB_USE_DEBUG -g -library=stlport4 -DUSE_PTHREAD $(WARNING_SUPPRESS) -endif - -ASM= -ASM_FLAGS= - -TBB_ASM.OBJ= - -ifeq (em64t,$(arch)) - CPLUS_FLAGS += -m64 - ASM_FLAGS += -m64 - LIB_LINK_FLAGS += -m64 -endif - -ifeq (ia32,$(arch)) - CPLUS_FLAGS += -m32 - LIB_LINK_FLAGS += -m32 -endif - -# TODO: verify whether -m64 implies V9 on relevant Sun Studio versions -# (those that handle gcc assembler syntax) -ifeq (sparc,$(arch)) - CPLUS_FLAGS += -m64 - LIB_LINK_FLAGS += -m64 -endif - -#------------------------------------------------------------------------------ -# Setting assembler data. -#------------------------------------------------------------------------------ -ASSEMBLY_SOURCE=$(arch)-fbe -#------------------------------------------------------------------------------ -# End of setting assembler data. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ -M_INCLUDES = $(INCLUDES) -I$(MALLOC_ROOT) -I$(MALLOC_SOURCE_ROOT) -M_CPLUS_FLAGS = $(CPLUS_FLAGS) -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/codecov.txt b/deal.II/contrib/tbb/tbb21_20090313oss/build/codecov.txt deleted file mode 100644 index b22397ee2b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/codecov.txt +++ /dev/null @@ -1,4 +0,0 @@ -src/tbb -src/tbbmalloc -include/tbb -source/malloc diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/common.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/common.inc deleted file mode 100644 index 4fbf5b7f4b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/common.inc +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -ifndef tbb_os - ifeq ($(OS), Windows_NT) - export tbb_os=windows - else - OS:=$(shell uname) - ifeq ($(OS),) - $(error "$(OS) is not supported") - else - export tbb_os=$(OS) - ifeq ($(OS), Linux) - export tbb_os=linux - endif - ifeq ($(OS), Darwin) - export tbb_os=macos - endif - endif # OS successfully detected - endif # !Windows -endif # !tbb_os - -ifeq ($(wildcard $(tbb_root)/build/$(tbb_os).inc),) - $(error "$(tbb_os)" is not supported. Add build/$(tbb_os).inc file with os-specific settings ) -endif - -# detect arch and runtime versions, provide common os-specific definitions -include $(tbb_root)/build/$(tbb_os).inc - -ifeq ($(arch),) - $(error Architecture not detected) -endif -ifeq ($(runtime),) - $(error Runtime version not detected) -endif -ifeq ($(wildcard $(tbb_root)/build/$(tbb_os).$(compiler).inc),) - $(error Compiler "$(compiler)" is not supported on $(tbb_os). Add build/$(tbb_os).$(compiler).inc file with compiler-specific settings ) -endif - -# Support for running debug tests to release library and vice versa -flip_cfg=$(subst _flipcfg,_release,$(subst _release,_debug,$(subst _debug,_flipcfg,$(1)))) -cross_cfg = $(if $(crosstest),$(call flip_cfg,$(1)),$(1)) - -ifdef BUILDING_PHASE - # Setting default configuration to release - cfg?=release - # include compiler-specific build configurations - -include $(tbb_root)/build/$(tbb_os).$(compiler).inc - ifdef extra_inc - -include $(tbb_root)/build/$(extra_inc) - endif -endif -ifneq ($(BUILDING_PHASE),1) - # definitions for top-level Makefiles - origin_build_dir:=$(origin tbb_build_dir) - tbb_build_dir?=$(tbb_root)$(SLASH)build - tbb_build_prefix?=$(tbb_os)_$(arch)_$(compiler)_$(runtime) - work_dir=$(tbb_build_dir)$(SLASH)$(tbb_build_prefix) - ifneq ($(BUILDING_PHASE),0) - work_dir:=$(work_dir) - # assign new value for tbb_root if path is not absolute (the filter keeps only /* paths) - ifeq ($(filter /% $(SLASH)%, $(subst :, ,$(tbb_root)) ),) - ifeq ($(origin_build_dir),undefined) - override tbb_root:=../.. - else - override tbb_root:=$(CWD)/$(tbb_root) - endif - endif - export tbb_root - endif # BUILDING_PHASE != 0 -endif # BUILDING_PHASE != 1 diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/common_rules.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/common_rules.inc deleted file mode 100644 index 87637a4e16..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/common_rules.inc +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -.PRECIOUS: %.$(OBJ) %.$(DLL).$(OBJ) %.exe - -ifeq ($(tbb_strict),1) - ifeq ($(WARNING_AS_ERROR_KEY),) - $(error WARNING_AS_ERROR_KEY is empty) - endif - # Do not remove line below! - WARNING_KEY += $(WARNING_AS_ERROR_KEY) -endif - -INCLUDES += $(INCLUDE_KEY)$(tbb_root)/src $(INCLUDE_KEY)$(tbb_root)/include - -CPLUS_FLAGS += $(WARNING_KEY) $(CXXFLAGS) -LINK_FLAGS += $(LDFLAGS) -LIB_LINK_FLAGS += $(LDFLAGS) -CPLUS_FLAGS_NOSTRICT:=$(subst -strict_ansi,-ansi,$(CPLUS_FLAGS)) - -LIB_LINK_CMD ?= $(CPLUS) $(PIC_KEY) -ifeq ($(origin LIB_OUTPUT_KEY), undefined) - LIB_OUTPUT_KEY = $(OUTPUT_KEY) -endif -ifeq ($(origin LIB_LINK_LIBS), undefined) - LIB_LINK_LIBS = $(LIBDL) $(LIBS) -endif - -CONLY ?= $(CPLUS) - -# The most generic rules -%.$(OBJ): %.cpp - @echo "=====tbb=========================MT== $(cfg)/$($*.tmp - $(ASM) $(ASM_FLAGS) -o $@ $*.tmp - rm $*.tmp - -%.$(OBJ): %.s - cpp <$< | grep -v '^#' >$*.tmp - $(ASM) $(ASM_FLAGS) -o $@ $*.tmp - rm $*.tmp - -# Rule for generating .E file if needed for visual inspection -%.E: %.cpp - $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) $(PREPROC_ONLY) $< >$@ - -# TODO Rule for generating .asm file if needed for visual inspection -%.asm: %.cpp - $(CPLUS) /c /Fa $(CPLUS_FLAGS) $(INCLUDES) $< - -# TODO Rule for generating .s file if needed for visual inspection -%.s: %.cpp - $(CPLUS) -S $(CPLUS_FLAGS) $(INCLUDES) $< - -# Customizations -ifeq (1,$(TBB_NOSTRICT)) -# GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict_ansi mode. -# The Mac uses gcc, so the list is empty for that platform. -# The files below need the -strict_ansi flag downgraded to -ansi to compile - -$(KNOWN_NOSTRICT): %.$(OBJ): %.cpp - @echo "=====tbb=========================MT== $(cfg)/$($@ - -%.res: %.rc version_string.tmp $(TBB.MANIFEST) - rc /Fo$@ $(INCLUDES) $(filter /D%,$(CPLUS_FLAGS)) $< - -tbbvars: - $(MAKE_TBBVARS) - -ifneq (,$(TBB.MANIFEST)) -$(TBB.MANIFEST): - cmd /C "echo #include ^ >tbbmanifest.c" - cmd /C "echo int main(){return 0;} >>tbbmanifest.c" - cl $(C_FLAGS) tbbmanifest.c - -version_string.tmp: $(TBB.MANIFEST) - @echo "=====tbb=========================MT== $(cfg)/$@" - @$(MAKE_VERSIONS) - @cmd /C "echo #define TBB_MANIFEST 1 >> version_string.tmp" - -else -version_string.tmp: - @echo "=====tbb=========================MT== $(cfg)/$@" - @$(MAKE_VERSIONS) -endif - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/detect.js b/deal.II/contrib/tbb/tbb21_20090313oss/build/detect.js deleted file mode 100644 index feebb99c51..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/detect.js +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -if ( WScript.Arguments.Count() > 0 ) { - - try { - - var WshShell = WScript.CreateObject("WScript.Shell"); - - var fso = new ActiveXObject("Scripting.FileSystemObject"); - - var tmpExec; - - //Compile binary - tmpExec = WshShell.Exec("cmd /c echo int main(){return 0;} >detect.c"); - while ( tmpExec.Status == 0 ) { - WScript.Sleep(100); - } - - tmpExec = WshShell.Exec("cl /MD detect.c /link /MAP"); - while ( tmpExec.Status == 0 ) { - WScript.Sleep(100); - } - - if ( WScript.Arguments(0) == "/arch" ) { - //read compiler banner - var clVersion = tmpExec.StdErr.ReadAll(); - - //detect target architecture - var em64t=/AMD64|EM64T|x64/mgi; - var itanium=/IA-64|Itanium/mgi; - var ia32=/80x86/mgi; - if ( clVersion.match(em64t) ) { - WScript.Echo( "em64t" ); - } else if ( clVersion.match(itanium) ) { - WScript.Echo( "itanium" ); - } else if ( clVersion.match(ia32) ) { - WScript.Echo( "ia32" ); - } else { - WScript.Echo( "unknown" ); - } - } - - if ( WScript.Arguments(0) == "/runtime" ) { - //read map-file - var map = fso.OpenTextFile("detect.map", 1, 0); - var mapContext = map.readAll(); - map.Close(); - - //detect runtime - var vc71=/MSVCR71\.DLL/mgi; - var vc80=/MSVCR80\.DLL/mgi; - var vc90=/MSVCR90\.DLL/mgi; - var psdk=/MSVCRT\.DLL/mgi; - if ( mapContext.match(vc71) ) { - WScript.Echo( "vc7.1" ); - } else if ( mapContext.match(vc80) ) { - WScript.Echo( "vc8" ); - } else if ( mapContext.match(vc90) ) { - WScript.Echo( "vc9" ); - } else if ( mapContext.match(psdk) ) { - // Our current naming convention assumes vc7.1 for 64-bit Windows PSDK - WScript.Echo( "vc7.1" ); - } else { - WScript.Echo( "unknown" ); - } - } - - // delete intermediate files - if ( fso.FileExists("detect.c") ) - fso.DeleteFile ("detect.c", false); - if ( fso.FileExists("detect.obj") ) - fso.DeleteFile ("detect.obj", false); - if ( fso.FileExists("detect.map") ) - fso.DeleteFile ("detect.map", false); - if ( fso.FileExists("detect.exe") ) - fso.DeleteFile ("detect.exe", false); - if ( fso.FileExists("detect.exe.manifest") ) - fso.DeleteFile ("detect.exe.manifest", false); - - } catch( error ) - { - WScript.Echo( "unknown" ); - WScript.Quit( 0 ); - } - -} else { - - WScript.Echo( "/arch or /runtime should be set" ); -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.bat b/deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.bat deleted file mode 100644 index 9c13c87f5a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.bat +++ /dev/null @@ -1,98 +0,0 @@ -@echo off -REM -REM Copyright 2005-2009 Intel Corporation. All Rights Reserved. -REM -REM This file is part of Threading Building Blocks. -REM -REM Threading Building Blocks is free software; you can redistribute it -REM and/or modify it under the terms of the GNU General Public License -REM version 2 as published by the Free Software Foundation. -REM -REM Threading Building Blocks is distributed in the hope that it will be -REM useful, but WITHOUT ANY WARRANTY; without even the implied warranty -REM of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with Threading Building Blocks; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -REM -REM As a special exception, you may use this file as part of a free software -REM library without restriction. Specifically, if other files instantiate -REM templates or use macros or inline functions from this file, or you compile -REM this file and link it with other files to produce an executable, this -REM file does not by itself cause the resulting executable to be covered by -REM the GNU General Public License. This exception does not however -REM invalidate any other reasons why the executable file might be covered by -REM the GNU General Public License. -REM -if exist tbbvars.bat exit -echo Generating tbbvars.bat -echo @echo off>tbbvars.bat -setlocal -for %%D in ("%tbb_root%") do set actual_root=%%~fD -if x%1==x goto without - -echo SET TBB21_INSTALL_DIR=%actual_root%>>tbbvars.bat -echo SET TBB_ARCH_PLATFORM=%arch%\%runtime%>>tbbvars.bat -echo SET INCLUDE=%%TBB21_INSTALL_DIR%%\include;%%INCLUDE%%>>tbbvars.bat -echo SET LIB=%%TBB21_INSTALL_DIR%%\build\%1;%%LIB%%>>tbbvars.bat -echo SET PATH=%%TBB21_INSTALL_DIR%%\build\%1;%%PATH%%>>tbbvars.bat - -if exist tbbvars.sh goto skipsh -set fslash_root=%actual_root:\=/% -echo Generating tbbvars.sh -echo #!/bin/sh>tbbvars.sh -echo export TBB21_INSTALL_DIR="%fslash_root%">>tbbvars.sh -echo TBB_ARCH_PLATFORM="%arch%\%runtime%">>tbbvars.sh -echo if [ -z "${PATH}" ]; then>>tbbvars.sh -echo export PATH="${TBB21_INSTALL_DIR}/build/%1">>tbbvars.sh -echo else>>tbbvars.sh -echo export PATH="${TBB21_INSTALL_DIR}/build/%1;$PATH">>tbbvars.sh -echo fi>>tbbvars.sh -echo if [ -z "${LIB}" ]; then>>tbbvars.sh -echo export LIB="${TBB21_INSTALL_DIR}/build/%1">>tbbvars.sh -echo else>>tbbvars.sh -echo export LIB="${TBB21_INSTALL_DIR}/build/%1;$LIB">>tbbvars.sh -echo fi>>tbbvars.sh -echo if [ -z "${INCLUDE}" ]; then>>tbbvars.sh -echo export INCLUDE="${TBB21_INSTALL_DIR}/include">>tbbvars.sh -echo else>>tbbvars.sh -echo export INCLUDE="${TBB21_INSTALL_DIR}/include;$INCLUDE">>tbbvars.sh -echo fi>>tbbvars.sh -:skipsh - -if exist tbbvars.csh goto skipcsh -echo Generating tbbvars.csh -echo #!/bin/csh>tbbvars.csh -echo setenv TBB21_INSTALL_DIR "%actual_root%">>tbbvars.csh -echo setenv TBB_ARCH_PLATFORM "%arch%\%runtime%">>tbbvars.csh -echo if (! $?PATH) then>>tbbvars.csh -echo setenv PATH "${TBB21_INSTALL_DIR}\build\%1">>tbbvars.csh -echo else>>tbbvars.csh -echo setenv PATH "${TBB21_INSTALL_DIR}\build\%1;$PATH">>tbbvars.csh -echo endif>>tbbvars.csh -echo if (! $?LIB) then>>tbbvars.csh -echo setenv LIB "${TBB21_INSTALL_DIR}\build\%1">>tbbvars.csh -echo else>>tbbvars.csh -echo setenv LIB "${TBB21_INSTALL_DIR}\build\%1;$LIB">>tbbvars.csh -echo endif>>tbbvars.csh -echo if (! $?INCLUDE) then>>tbbvars.csh -echo setenv INCLUDE "${TBB21_INSTALL_DIR}\include">>tbbvars.csh -echo else>>tbbvars.csh -echo setenv INCLUDE "${TBB21_INSTALL_DIR}\include;$INCLUDE">>tbbvars.csh -echo endif>>tbbvars.csh -) -:skipcsh -exit - -:without -set bin_dir=%CD% -echo SET tbb_root=%actual_root%>>tbbvars.bat -echo SET tbb_bin=%bin_dir%>>tbbvars.bat -echo SET TBB_ARCH_PLATFORM=%arch%\%runtime%>>tbbvars.bat -echo SET INCLUDE="%%tbb_root%%\include";%%INCLUDE%%>>tbbvars.bat -echo SET LIB="%%tbb_bin%%";%%LIB%%>>tbbvars.bat -echo SET PATH="%%tbb_bin%%";%%PATH%%>>tbbvars.bat - -endlocal diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.sh b/deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.sh deleted file mode 100644 index 84a8c95431..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/generate_tbbvars.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -# -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# Script used to generate tbbvars.[c]sh scripts -bin_dir="$PWD" # -cd "$tbb_root" # keep this comments here -tbb_root="$PWD" # to make it unsensible -cd "$bin_dir" # to EOL encoding -[ "`uname`" = "Darwin" ] && dll_path="DYLD_LIBRARY_PATH" || dll_path="LD_LIBRARY_PATH" # -custom_exp="$CXXFLAGS" # -if [ -z "$TBB_CUSTOM_VARS_SH" ]; then # -custom_exp_sh="" # -else # -custom_exp_sh="export $TBB_CUSTOM_VARS_SH" # -fi # -if [ -z "$TBB_CUSTOM_VARS_CSH" ]; then # -custom_exp_csh="" # -else # -custom_exp_csh="setenv $TBB_CUSTOM_VARS_CSH" # -fi # -if [ -z "$1" ]; then # custom tbb_build_dir, can't make with TBB_INSTALL_DIR -[ -f ./tbbvars.sh ] || cat >./tbbvars.sh <./tbbvars.csh <./tbbvars.sh <./tbbvars.csh < - - -

Overview

-This directory contains the internal Makefile infrastructure for Threading Building Blocks. - -

-See below for how to build TBB and how to port TBB -to a new platform, operating system or architecture. -

- -

Files

-The files here are not intended to be used directly. See below for usage. -
-
Makefile.tbb -
Main Makefile to build the TBB library. - Invoked via 'make tbb' from top-level Makefile. -
Makefile.tbbmalloc -
Main Makefile to build the TBB scalable memory allocator library as well as its tests. - Invoked via 'make tbbmalloc' from top-level Makefile. -
Makefile.test -
Main Makefile to build and run the tests for the TBB library. - Invoked via 'make test' from top-level Makefile. -
common.inc -
Main common included Makefile that includes OS-specific and compiler-specific Makefiles. -
<os>.inc -
OS-specific Makefile for a particular <os>. -
<os>_<compiler>.inc -
Compiler-specific Makefile for a particular <os> / <compiler> combination. -
*.sh -
Infrastructure utilities for Linux*, Mac OS* X, and UNIX*-related systems. -
*.js, *.bat -
Infrastructure utilities for Windows* systems. -
- -

To Build

-

-To port TBB to a new platform, operating system or architecture, see the porting directions below. -

- -

Software prerequisites:

-
    -
  1. C++ compiler for the platform, operating system and architecture of interest. - Either the native compiler for your system, or, optionally, the appropriate Intel® C++ compiler, may be used. -
  2. GNU make utility. On Windows*, if a UNIX* emulator is used to run GNU make, - it should be able to run Windows* utilities and commands. On Linux*, Mac OS* X, etc., - shell commands issued by GNU make should execute in a Bourne or BASH compatible shell. -
- -

-TBB libraries can be built by performing the following steps. -On systems that support only one ABI (e.g., 32-bit), these steps build the libraries for that ABI. -On systems that support both 64-bit and 32-bit libraries, these steps build the 64-bit libraries -(Linux*, Mac OS* X, and related systems) or whichever ABI is selected in the development environment (Windows* systems). -

-
    -
  1. Change to the top-level directory of the installed software. -
  2. If using the Intel® C++ compiler, make sure the appropriate compiler is available in your PATH - (e.g., by sourcing the appropriate iccvars script for the compiler to be used). -
  3. Invoke GNU make using no arguments, for example, 'gmake'. -
- -

-To build TBB libraries for other than the default ABI (e.g., to build 32-bit libraries on Linux*, Mac OS* X, -or related systems that support both 64-bit and 32-bit libraries), perform the following steps. -

-
    -
  1. Change to the top-level directory of the installed software. -
  2. If using the Intel® C++ compiler, make sure the appropriate compiler is available in your PATH - (e.g., by sourcing the appropriate iccvars script for the compiler to be used). -
  3. Invoke GNU make as follows, 'gmake arch=ia32'. -
- -

The default make target will build the release and debug versions of the TBB library.

-

Other targets are available in the top-level Makefile. You might find the following targets useful: -

    -
  • 'make test' will build and run TBB unit-tests; -
  • 'make examples' will build and run TBB examples; -
  • 'make all' will do all of the above. -
-See also the list of other targets below. -

- -

-By default, the libraries will be built in sub-directories within the build/ directory. -The sub-directories are named according to the operating system, architecture, compiler and software environment used -(the sub-directory names also distinguish release vs. debug libraries). On Linux*, the software environment comprises -the GCC, libc and kernel version used. On Mac OS* X, the software environment comprises the GCC and OS version used. -On Windows, the software environment comprises the Microsoft* Visual Studio* version used. -See below for how to change the default build directory. -

- -

-To perform different build and/or test operations, use the following steps. -

-
    -
  1. Change to the top-level directory of the installed software. -
  2. If using the Intel® C++ compiler, make sure the appropriate compiler is available in your PATH - (e.g., by sourcing the appropriate iccvars script for the compiler to be used). -
  3. Invoke GNU make by using one or more of the following commands. -
    -
    make -
    Default build. Equivalent to 'make tbb tbbmalloc'. -
    make all -
    Equivalent to 'make tbb tbbmalloc test examples'. -
    cd src;make release -
    Build and test release libraries only. -
    cd src;make debug -
    Build and test debug libraries only. -
    make tbb -
    Make TBB release and debug libraries. -
    make tbbmalloc -
    Make TBB scalable memory allocator libraries. -
    make test -
    Compile and run unit-tests -
    make examples -
    Build libraries and run all examples, like doing 'make debug clean release' from - the general example Makefile. -
    make compiler={icl, icc} [(above options or targets)] -
    Build and run as above, but use Intel® compilers instead of default, native compilers - (e.g., icl instead of cl.exe on Windows* systems, or icc instead of g++ on Linux* or Mac OS* X systems). -
    make arch={ia32, em64t, itanium} [(above options or targets)] -
    Build and run as above, but build libraries for the selected ABI. - Might be useful for cross-compilation; ensure proper environment is set before running this command. -
    make tbb_root={(TBB directory)} [(above options or targets)] -
    Build and run as above; for use when invoking 'make' from a directory other than - the top-level directory. -
    make tbb_build_dir={(build directory)} [(above options or targets)] -
    Build and run as above, but place the built libraries in the specified directory, rather than in the default - sub-directory within the build/ directory. This command might have troubles with the build in case the sources - installed to the directory with spaces in the path. -
    make tbb_build_prefix={(build sub-directory)} [(above options or targets)] -
    Build and run as above, but place the built libraries in the specified sub-directory within the build/ directory, - rather than using the default sub-directory name. -
    make [(above options)] clean -
    Remove any executables or intermediate files produced by the above commands. - Includes build directories, object files, libraries and test executables. -
    -
- -

To Port

-

-This section provides information on how to port TBB to a new platform, operating system or architecture. -A subset or a superset of these steps may be required for porting to a given platform. -

- -

To port the TBB source code:

-
    -
  1. If porting to a new architecture, create a file that describes the architecture-specific details for that architecture. -
      -
    • Create a <os>_<architecture>.h file in the include/tbb/machine directory - that describes these details. -
        -
      • The <os>_<architecture>.h is named after the operating system and architecture as recognized by - include/tbb/tbb_machine.h and the Makefile infrastructure. -
      • This file defines the implementations of synchronization operations, and also the - scheduler yield function, for the operating system and architecture. -
      • Several examples of <os>_<architecture>.h files can be found in the - include/tbb/machine directory. -
          -
        • A minimal implementation defines the 4-byte and 8-byte compare-and-swap operations, - and the scheduler yield function. See include/tbb/machine/mac_ppc.h - for an example of a minimal implementation. -
        • More complex implementation examples can also be found in the - include/tbb/machine directory - that implement all the individual variants of synchronization operations that TBB uses. - Such implementations are more verbose but may achieve better performance on a given architecture. -
        • In a given implementation, any synchronization operation that is not defined is implemented, by default, - in terms of 4-byte or 8-byte compare-and-swap. More operations can thus be added incrementally to increase - the performance of an implementation. -
        • In most cases, synchronization operations are implemented as inline assembly code; examples also exist, - (e.g., for Intel® Itanium® processors) that use out-of-line assembly code in *.s or *.asm files - (see the assembly code sub-directories in the src/tbb directory). -
        -
      -
    • Modify include/tbb/tbb_machine.h, if needed, to invoke the appropriate - <os>_<architecture>.h file in the include/tbb/machine directory. -
    -
  2. Add an implementation of DetectNumberOfWorkers() in src/tbb/tbb_misc.h, - if needed, that returns the number of cores found on the system. This is used to determine the default - number of threads for the TBB task scheduler. -
  3. Either properly define FillDynamicLinks for use in - src/tbb/cache_aligned_allocator.cpp, - or hardcode the allocator to be used. -
  4. Additional types might be required in the union defined in - include/tbb/aligned_space.h - to ensure proper alignment on your platform. -
  5. Changes may be required in include/tbb/tick_count.h - for systems that do not provide gettimeofday. -
- -

To port the Makefile infrastructure:

-Modify the appropriate files in the Makefile infrastructure to add a new platform, operating system or architecture as needed. -See the Makefile infrastructure files for examples. -
    -
  1. The top-level Makefile includes common.inc to determine the operating system. -
      -
    • To add a new operating system, add the appropriate test to common.inc, - and create the needed <os>.inc and <os>_<compiler>.inc files (see below). -
    -
  2. The <os>.inc file makes OS-specific settings for a particular <os>. -
      -
    • For example, linux.inc makes settings specific to Linux* systems. -
    • This file performs OS-dependent tests to determine the specific platform and/or architecture, - and sets other platform-dependent values. -
    • Add a new <os>.inc file for each new operating system added. -
    -
  3. The <os>_<compiler>.inc file makes compiler-specific settings for a particular - <os> / <compiler> combination. -
      -
    • For example, linux.gcc.inc makes specific settings for using GCC on Linux* systems, - and linux.icc.inc makes specific settings for using the Intel® C++ compiler on Linux* systems. -
    • This file sets particular compiler, assembler and linker options required when using a particular - <os> / <compiler> combination. -
    • Add a new <os>_<compiler>.inc file for each new <os> / <compiler> combination added. -
    -
- -
-Up to parent directory -

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.gcc.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.gcc.inc deleted file mode 100644 index be28f60ce8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.gcc.inc +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -COMPILE_ONLY = -c -MMD -PREPROC_ONLY = -E -x c -INCLUDE_KEY = -I -DEFINE_KEY = -D -OUTPUT_KEY = -o # -OUTPUTOBJ_KEY = -o # -PIC_KEY = -fPIC -WARNING_AS_ERROR_KEY = -Werror -WARNING_KEY = -Wall -WARNING_SUPPRESS = -Wno-parentheses -DYLIB_KEY = -shared -LIBDL = -ldl - -TBB_NOSTRICT = 1 - -CPLUS = g++ -CONLY = gcc -LIB_LINK_FLAGS = -shared -Wl,-soname=$(BUILDING_LIBRARY) -LIBS = -lpthread -lrt -C_FLAGS = $(CPLUS_FLAGS) - -ifeq ($(cfg), release) - CPLUS_FLAGS = -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD -endif -ifeq ($(cfg), debug) - CPLUS_FLAGS = -DTBB_USE_DEBUG -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD -endif - -ASM= -ASM_FLAGS= - -TBB_ASM.OBJ= - -ifeq (itanium,$(arch)) -# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables - CPLUS_FLAGS += $(PIC_KEY) -endif - -ifeq (em64t,$(arch)) - CPLUS_FLAGS += -m64 - LIB_LINK_FLAGS += -m64 -endif - -ifeq (ia32,$(arch)) - CPLUS_FLAGS += -m32 - LIB_LINK_FLAGS += -m32 -endif - -# for some gcc versions on Solaris, -m64 may imply V9, but perhaps not everywhere (TODO: verify) -ifeq (sparc,$(arch)) - CPLUS_FLAGS += -mcpu=v9 -m64 - LIB_LINK_FLAGS += -mcpu=v9 -m64 -endif - -#------------------------------------------------------------------------------ -# Setting assembler data. -#------------------------------------------------------------------------------ -ASSEMBLY_SOURCE=$(arch)-gas -ifeq (itanium,$(arch)) - ASM=as - ASM_FLAGS += -xexplicit - TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o ia64_misc.o -endif -#------------------------------------------------------------------------------ -# End of setting assembler data. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ - -M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2 - -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.icc.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.icc.inc deleted file mode 100644 index 558a4aa5a9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.icc.inc +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -COMPILE_ONLY = -c -MMD -PREPROC_ONLY = -E -x c -INCLUDE_KEY = -I -DEFINE_KEY = -D -OUTPUT_KEY = -o # -OUTPUTOBJ_KEY = -o # -PIC_KEY = -fPIC -WARNING_AS_ERROR_KEY = -Werror -WARNING_KEY = -w1 -DYLIB_KEY = -shared -LIBDL = -ldl -export COMPILER_VERSION := ICC: $(shell icc -V &1 | grep 'Version') -#TODO: autodetection of arch from COMPILER_VERSION!! - -TBB_NOSTRICT = 1 - -CPLUS = icpc -CONLY = icc - -ifeq (release,$(cfg)) -CPLUS_FLAGS = -O2 -strict_ansi -DUSE_PTHREAD -else -CPLUS_FLAGS = -O0 -g -strict_ansi -DUSE_PTHREAD -DTBB_USE_DEBUG -endif - -ifneq (,$(codecov)) - CPLUS_FLAGS += -prof-genx -else - CPLUS_FLAGS += -DDO_ITT_NOTIFY -endif - -OPENMP_FLAG = -openmp -LIB_LINK_FLAGS = -shared -i-static -Wl,-soname=$(BUILDING_LIBRARY) -LIBS = -lpthread -lrt -C_FLAGS = $(CPLUS_FLAGS) - -ASM= -ASM_FLAGS= - -TBB_ASM.OBJ= - -ifeq (itanium,$(arch)) -# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables - CPLUS_FLAGS += $(PIC_KEY) -endif - -#------------------------------------------------------------------------------ -# Setting assembler data. -#------------------------------------------------------------------------------ -ASSEMBLY_SOURCE=$(arch)-gas -ifeq (itanium,$(arch)) - ASM=ias - TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o ia64_misc.o -endif -#------------------------------------------------------------------------------ -# End of setting assembler data. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ - -M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions - -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.inc deleted file mode 100644 index a411d309f4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/linux.inc +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -ifndef arch - uname_m:=$(shell uname -m) - ifeq ($(uname_m),i686) - export arch:=ia32 - endif - ifeq ($(uname_m),ia64) - export arch:=itanium - endif - ifeq ($(uname_m),x86_64) - export arch:=em64t - endif - ifeq ($(uname_m),sparc64) - export arch:=sparc - endif -endif - -ifndef runtime - #gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc --version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//') - gcc_version_full=$(shell gcc --version | grep 'gcc'| egrep -o ' [0-9]+\.[0-9]+\.[0-9]+.*' | sed -e 's/^\ //') - gcc_version=$(shell echo "$(gcc_version_full)" | egrep -o '^[0-9]+\.[0-9]+\.[0-9]+\s*' | head -n 1 | sed -e 's/ *//g') - os_version:=$(shell uname -r) - os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//') - export os_glibc_version_full:=$(shell getconf GNU_LIBC_VERSION | grep glibc | sed -e 's/^glibc //') - os_glibc_version:=$(shell echo "$(os_glibc_version_full)" | sed -e '2,$$d' -e 's/-.*$$//') - export runtime:=cc$(gcc_version)_libc$(os_glibc_version)_kernel$(os_kernel_version) -endif - -native_compiler := gcc -export compiler ?= gcc -debugger ?= gdb - -CMD=sh -c -CWD=$(shell pwd) -RM?=rm -f -RD?=rmdir -MD?=mkdir -p -NUL= /dev/null -SLASH=/ -MAKE_VERSIONS=sh $(tbb_root)/build/version_info_linux.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp -MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh - -ifdef LD_LIBRARY_PATH - export LD_LIBRARY_PATH := .:$(LD_LIBRARY_PATH) -else - export LD_LIBRARY_PATH := . -endif - -####### Build settings ######################################################## - -OBJ = o -DLL = so -LIBEXT = so -SONAME_SUFFIX =$(shell grep TBB_COMPATIBLE_INTERFACE_VERSION $(tbb_root)/include/tbb/tbb_stddef.h | egrep -o [0-9.]+) - -def_prefix = $(if $(findstring 32,$(arch)),lin32,$(if $(findstring 64,$(arch)),lin64,lin64ipf)) -TBB.DEF = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.def - -EXPORT_KEY = -Wl,--version-script, -TBB.DLL = $(TBB_NO_VERSION.DLL).$(SONAME_SUFFIX) -TBB.LIB = $(TBB.DLL) -TBB_NO_VERSION.DLL=libtbb$(DEBUG_SUFFIX).$(DLL) -LINK_TBB.LIB = $(TBB_NO_VERSION.DLL) - -MALLOC_NO_VERSION.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL) -MALLOC.DEF = $(MALLOC_ROOT)/lin-tbbmalloc-export.def -MALLOC.DLL = $(MALLOC_NO_VERSION.DLL).$(SONAME_SUFFIX) -MALLOC.LIB = $(MALLOC_NO_VERSION.DLL) -LINK_MALLOC.LIB = $(MALLOC_NO_VERSION.DLL) - -MALLOCPROXY_NO_VERSION.DLL = libtbbmalloc_proxy$(DEBUG_SUFFIX).$(DLL) -MALLOCPROXY.DEF = $(MALLOC_ROOT)/$(def_prefix)-proxy-export.def -MALLOCPROXY.DLL = $(MALLOCPROXY_NO_VERSION.DLL).$(SONAME_SUFFIX) -MALLOCPROXY.LIB = $(MALLOCPROXY_NO_VERSION.DLL) - - -TBB_NOSTRICT=1 - -TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.gcc.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.gcc.inc deleted file mode 100644 index 7fe6ed7288..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.gcc.inc +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -CPLUS = g++ -COMPILE_ONLY = -c -MMD -PREPROC_ONLY = -E -x c -INCLUDE_KEY = -I -DEFINE_KEY = -D -OUTPUT_KEY = -o # -OUTPUTOBJ_KEY = -o # -PIC_KEY = -fPIC -WARNING_AS_ERROR_KEY = -Werror -WARNING_KEY = -Wall -DYLIB_KEY = -dynamiclib -EXPORT_KEY = -Wl,-exported_symbols_list, -LIBDL = -ldl - -LIBS = -lpthread -LINK_FLAGS = -LIB_LINK_FLAGS = -dynamiclib -C_FLAGS = $(CPLUS_FLAGS) -x c - -ifeq ($(cfg), release) - CPLUS_FLAGS = -O2 -else - CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG -endif - -CPLUS_FLAGS += -DUSE_PTHREAD - -ifeq (em64t,$(arch)) - CPLUS_FLAGS += -m64 - LINK_FLAGS += -m64 - LIB_LINK_FLAGS += -m64 -endif - -ifeq (ppc64,$(arch)) - CPLUS_FLAGS += -arch ppc64 - LINK_FLAGS += -arch ppc64 - LIB_LINK_FLAGS += -arch ppc64 -endif - -ifeq (ppc,$(arch)) - CPLUS_FLAGS += -arch ppc - LINK_FLAGS += -arch ppc - LIB_LINK_FLAGS += -arch ppc -endif - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ - -M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2 - -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.icc.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.icc.inc deleted file mode 100644 index 243b6d5b2d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.icc.inc +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -CPLUS = icpc -COMPILE_ONLY = -c -MMD -PREPROC_ONLY = -E -x c -INCLUDE_KEY = -I -DEFINE_KEY = -D -OUTPUT_KEY = -o # -OUTPUTOBJ_KEY = -o # -PIC_KEY = -fPIC -WARNING_AS_ERROR_KEY = -Werror -WARNING_KEY = -w1 -DYLIB_KEY = -dynamiclib -EXPORT_KEY = -Wl,-exported_symbols_list, -LIBDL = -ldl -export COMPILER_VERSION := $(shell icc -V &1 | grep 'Version') -#TODO: autodetection of arch from COMPILER_VERSION!! - -OPENMP_FLAG = -openmp -LIBS = -lpthread -LINK_FLAGS = -LIB_LINK_FLAGS = -dynamiclib -i-static -C_FLAGS = $(CPLUS_FLAGS) -x c - -ifeq ($(cfg), release) - CPLUS_FLAGS = -O2 -fno-omit-frame-pointer -else - CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG -endif - -CPLUS_FLAGS += -DUSE_PTHREAD - -ifneq (,$(codecov)) - CPLUS_FLAGS += -prof-genx -endif - -ifeq (em64t,$(arch)) -# LINK_FLAGS += -m64 -# LIB_LINK_FLAGS += -m64 -endif - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ - -M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions - -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.inc deleted file mode 100644 index c99e390437..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/macos.inc +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -####### Detections and Commands ############################################### -ifndef arch - ifeq ($(shell /usr/sbin/sysctl -n hw.machine),Power Macintosh) - ifeq ($(shell /usr/sbin/sysctl -n hw.optional.64bitops),1) - export arch:=ppc64 - else - export arch:=ppc32 - endif - else - ifeq ($(shell /usr/sbin/sysctl -n hw.optional.x86_64 2>/dev/null),1) - export arch:=em64t - else - export arch:=ia32 - endif - endif -endif - -ifndef runtime - #gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//' ) - gcc_version_full=$(shell gcc --version | grep 'gcc'| egrep -o ' [0-9]+\.[0-9]+\.[0-9]+.*' | sed -e 's/^\ //') - gcc_version=$(shell echo "$(gcc_version_full)" | egrep -o '^[0-9]+\.[0-9]+\.[0-9]+\s*' | head -n 1 | sed -e 's/ *//g') - os_version:=$(shell /usr/bin/sw_vers -productVersion) - export runtime:=cc$(gcc_version)_os$(os_version) -endif - -native_compiler := gcc -export compiler ?= gcc -debugger ?= gdb - -CMD=$(SHELL) -c -CWD=$(shell pwd) -RM?=rm -f -RD?=rmdir -MD?=mkdir -p -NUL= /dev/null -SLASH=/ -MAKE_VERSIONS=sh $(tbb_root)/build/version_info_macos.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp -MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh - -####### Build settings ######################################################## - -OBJ=o -DLL=dylib -LIBEXT=dylib - -def_prefix = $(if $(findstring 32,$(arch)),mac32,mac64) - -TBB.DEF = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.def -TBB.DLL = libtbb$(DEBUG_SUFFIX).$(DLL) -TBB.LIB = $(TBB.DLL) -LINK_TBB.LIB = $(TBB.LIB) - -MALLOC.DEF = $(MALLOC_ROOT)/$(def_prefix)-tbbmalloc-export.def -MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL) -MALLOC.LIB = $(MALLOC.DLL) - -TBB_NOSTRICT=1 - -TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/suncc.map.pause b/deal.II/contrib/tbb/tbb21_20090313oss/build/suncc.map.pause deleted file mode 100644 index a92d08eb19..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/suncc.map.pause +++ /dev/null @@ -1 +0,0 @@ -hwcap_1 = OVERRIDE; \ No newline at end of file diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.bat b/deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.bat deleted file mode 100644 index bc4f0b9fd3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.bat +++ /dev/null @@ -1,36 +0,0 @@ -@echo off -REM -REM Copyright 2005-2009 Intel Corporation. All Rights Reserved. -REM -REM This file is part of Threading Building Blocks. -REM -REM Threading Building Blocks is free software; you can redistribute it -REM and/or modify it under the terms of the GNU General Public License -REM version 2 as published by the Free Software Foundation. -REM -REM Threading Building Blocks is distributed in the hope that it will be -REM useful, but WITHOUT ANY WARRANTY; without even the implied warranty -REM of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with Threading Building Blocks; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -REM -REM As a special exception, you may use this file as part of a free software -REM library without restriction. Specifically, if other files instantiate -REM templates or use macros or inline functions from this file, or you compile -REM this file and link it with other files to produce an executable, this -REM file does not by itself cause the resulting executable to be covered by -REM the GNU General Public License. This exception does not however -REM invalidate any other reasons why the executable file might be covered by -REM the GNU General Public License. -REM - -REM i.e., no LD_PRELOAD under Windows -if "%1"=="-l" ( - echo skip - exit -) - -%* diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.sh b/deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.sh deleted file mode 100644 index 536f3405f6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/test_launcher.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -while getopts "l:" flag # -do # - if [ `uname` != 'Linux' ] ; then # - echo 'skip' # - exit # - fi # - LD_PRELOAD=$OPTARG # - shift `expr $OPTIND - 1` # -done # -# Set stack limit and run the command line passed via parameters -ulimit -s 10240 # -export LD_PRELOAD # -./$* # diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_linux.sh b/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_linux.sh deleted file mode 100644 index 87d75516e7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_linux.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# Script used to generate version info string -echo "#define __TBB_VERSION_STRINGS \\" -echo '"TBB:' "BUILD_HOST\t\t"`hostname -s`" ("`uname -m`")"'" ENDL \' -# find OS name in *-release and issue* files by filtering blank lines and lsb-release content out -echo '"TBB:' "BUILD_OS\t\t"`lsb_release -sd 2>/dev/null | grep -ih '[a-z] ' - /etc/*release /etc/issue 2>/dev/null | head -1 | sed -e 's/["\\\\]//g'`'" ENDL \' -echo '"TBB:' "BUILD_KERNEL\t"`uname -srv`'" ENDL \' -echo '"TBB:' "BUILD_GCC\t\t"`g++ -v &1 | grep 'gcc.*version'`'" ENDL \' -[ -z "$COMPILER_VERSION" ] || echo '"TBB:' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \' -echo '"TBB:' "BUILD_GLIBC\t"`getconf GNU_LIBC_VERSION | grep glibc | sed -e 's/^glibc //'`'" ENDL \' -echo '"TBB:' "BUILD_LD\t\t"`ld -v 2>&1 | grep 'version'`'" ENDL \' -echo '"TBB:' "BUILD_TARGET\t$arch on $runtime"'" ENDL \' -echo '"TBB:' "BUILD_COMMAND\t"$*'" ENDL \' -echo "" -echo "#define __TBB_DATETIME \""`date -u`"\"" diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_macos.sh b/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_macos.sh deleted file mode 100644 index d6a40afbb2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_macos.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# Script used to generate version info string -echo "#define __TBB_VERSION_STRINGS \\" -echo '"TBB:' "BUILD_HOST\t\t"`hostname -s`" ("`arch`")"'" ENDL \' -echo '"TBB:' "BUILD_OS\t\t"`sw_vers -productName`" version "`sw_vers -productVersion`'" ENDL \' -echo '"TBB:' "BUILD_KERNEL\t"`uname -v`'" ENDL \' -echo '"TBB:' "BUILD_GCC\t\t"`gcc -v &1 | grep 'version'`'" ENDL \' -[ -z "$COMPILER_VERSION" ] || echo '"TBB:' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \' -echo '"TBB:' "BUILD_TARGET\t$arch on $runtime"'" ENDL \' -echo '"TBB:' "BUILD_COMMAND\t"$*'" ENDL \' -echo "" -echo "#define __TBB_DATETIME \""`date -u`"\"" diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_sunos.sh b/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_sunos.sh deleted file mode 100644 index 16341165a9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_sunos.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# Script used to generate version info string -echo "#define __TBB_VERSION_STRINGS \\" -echo '"TBB:' "BUILD_HOST\t"`hostname`" ("`arch`")"'" ENDL \' -echo '"TBB:' "BUILD_OS\t\t"`uname`'" ENDL \' -echo '"TBB:' "BUILD_KERNEL\t"`uname -srv`'" ENDL \' -echo '"TBB:' "BUILD_SUNCC\t"`CC -V &1 | grep 'C++'`'" ENDL \' -[ -z "$COMPILER_VERSION" ] || echo '"TBB: ' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \' -echo '"TBB:' "BUILD_TARGET\t$arch on $runtime"'" ENDL \' -echo '"TBB:' "BUILD_COMMAND\t"$*'" ENDL \' -echo "" -echo "#define __TBB_DATETIME \""`date -u`"\"" diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_windows.js b/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_windows.js deleted file mode 100644 index bb36001c81..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/version_info_windows.js +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -var WshShell = WScript.CreateObject("WScript.Shell"); - -var tmpExec; - -WScript.Echo("#define __TBB_VERSION_STRINGS \\"); - -//Getting BUILD_HOST -WScript.echo( "\"TBB: BUILD_HOST\\t\\t" + - WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%") + - "\" ENDL \\" ); - -//Getting BUILD_OS -tmpExec = WshShell.Exec("cmd /c ver"); -while ( tmpExec.Status == 0 ) { - WScript.Sleep(100); -} -tmpExec.StdOut.ReadLine(); - -WScript.echo( "\"TBB: BUILD_OS\\t\\t" + - tmpExec.StdOut.ReadLine() + - "\" ENDL \\" ); - - -//Getting BUILD_CL -tmpExec = WshShell.Exec("cmd /c echo #define 0 0>empty.cpp"); -tmpExec = WshShell.Exec("cl -c empty.cpp "); -while ( tmpExec.Status == 0 ) { - WScript.Sleep(100); -} -var clVersion = tmpExec.StdErr.ReadLine(); -WScript.echo( "\"TBB: BUILD_CL\\t\\t" + - clVersion + - "\" ENDL \\" ); - -//Getting BUILD_COMPILER -if ( WScript.Arguments(0).toLowerCase().match("icl") ) { - tmpExec = WshShell.Exec("icl -c empty.cpp "); - while ( tmpExec.Status == 0 ) { - WScript.Sleep(100); - } - WScript.echo( "\"TBB: BUILD_COMPILER\\t" + - tmpExec.StdErr.ReadLine() + - "\" ENDL \\" ); -} else { - WScript.echo( "\"TBB: BUILD_COMPILER\\t\\t" + - clVersion + - "\" ENDL \\" ); -} - -tmpExec = WshShell.Exec("cmd /c del /F /Q empty.cpp "); -tmpExec = WshShell.Exec("cmd /c del /F /Q empty.obj "); - -//Getting BUILD_TARGET -WScript.echo( "\"TBB: BUILD_TARGET\\t" + - WScript.Arguments(1) + - "\" ENDL \\" ); - -//Getting BUILD_COMMAND -WScript.echo( "\"TBB: BUILD_COMMAND\\t" + WScript.Arguments(2) + "\" ENDL" ); - -//Getting __TBB_DATETIME and __TBB_VERSION_YMD -var date = new Date(); -WScript.echo( "#define __TBB_DATETIME \"" + date.toUTCString() + "\"" ); -WScript.echo( "#define __TBB_VERSION_YMD " + date.getUTCFullYear() + ", " + - (date.getUTCMonth() > 8 ? (date.getUTCMonth()+1):("0"+(date.getUTCMonth()+1))) + - (date.getUTCDate() > 9 ? date.getUTCDate():("0"+date.getUTCDate())) ); - - -/* - -Original strings - -#define __TBB_VERSION_STRINGS \ -"TBB: BUILD_HOST\t\tvpolin-mobl1 (ia32)" ENDL \ -"TBB: BUILD_OS\t\tMicrosoft Windows XP [Version 5.1.2600]" ENDL \ -"TBB: BUILD_CL\t\tMicrosoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86" ENDL \ -"TBB: BUILD_COMPILER\tIntel(R) C++ Compiler for 32-bit applications, Version 9.1 Build 20070109Z Package ID: W_CC_C_9.1.034 " ENDL \ -"TBB: BUILD_TARGET\t" ENDL \ -"TBB: BUILD_COMMAND\t" ENDL \ - -#define __TBB_DATETIME "Mon Jun 4 10:16:07 UTC 2007" -#define __TBB_VERSION_YMD 2007, 0604 - - - -# The script must be run from two directory levels below this level. -x='"TBB: ' -y='" ENDL \' -echo "#define __TBB_VERSION_STRINGS \\" -echo $x "BUILD_HOST\t\t"`hostname`" ("`../../arch.exe`")"$y -echo $x "BUILD_OS\t\t"`../../win_version.bat|grep -i 'Version'`$y -echo >empty.cpp -echo $x "BUILD_CL\t\t"`cl -c empty.cpp 2>&1 | grep -i Version`$y -echo $x "BUILD_COMPILER\t"`icl -c empty.cpp 2>&1 | grep -i Version`$y -echo $x "BUILD_TARGET\t"$TBB_ARCH$y -echo $x "BUILD_COMMAND\t"$*$y -echo "" -# A workaround for MKS 8.6 where `date -u` crashes. -date -u > date.tmp -echo "#define __TBB_DATETIME \""`cat date.tmp`"\"" -echo "#define __TBB_VERSION_YMD "`date '+%Y, %m%d'` -rm empty.cpp -rm empty.obj -rm date.tmp -*/ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/index.html b/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/index.html deleted file mode 100644 index 82cad002db..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - -

Overview

-This directory contains the visual studio* 2005 solution to build Threading Building Blocks. - - -

Files

-
-
makefile.sln -
Solution file. -
tbb.vcproj -
Library project file. -
tbbmalloc.vcproj -
Scalable allocator library project file. Allocator sources are expected to be located in ../../src/tbbmalloc folder. -
tbbmalloc_proxy.vcproj -
Standard allocator replacement project file. -
- -
-Up to parent directory -

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/makefile.sln b/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/makefile.sln deleted file mode 100644 index 2a681d4369..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/makefile.sln +++ /dev/null @@ -1,72 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbb", "tbb.vcproj", "{F62787DD-1327-448B-9818-030062BCFAA5}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbbmalloc", "tbbmalloc.vcproj", "{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection - ProjectSection(ProjectDependencies) = postProject - {F62787DD-1327-448B-9818-030062BCFAA5} = {F62787DD-1327-448B-9818-030062BCFAA5} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8898CE0B-0BFB-45AE-AA71-83735ED2510D}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection - ProjectSection(SolutionItems) = preProject - index.html = index.html - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbbmalloc_proxy", "tbbmalloc_proxy.vcproj", "{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection - ProjectSection(ProjectDependencies) = postProject - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8} = {B15F131E-328A-4D42-ADC2-9FF4CA6306D8} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F62787DD-1327-448B-9818-030062BCFAA5}.Debug|Win32.ActiveCfg = Debug|Win32 - {F62787DD-1327-448B-9818-030062BCFAA5}.Debug|Win32.Build.0 = Debug|Win32 - {F62787DD-1327-448B-9818-030062BCFAA5}.Debug|x64.ActiveCfg = Debug|x64 - {F62787DD-1327-448B-9818-030062BCFAA5}.Debug|x64.Build.0 = Debug|x64 - {F62787DD-1327-448B-9818-030062BCFAA5}.Release|Win32.ActiveCfg = Release|Win32 - {F62787DD-1327-448B-9818-030062BCFAA5}.Release|Win32.Build.0 = Release|Win32 - {F62787DD-1327-448B-9818-030062BCFAA5}.Release|x64.ActiveCfg = Release|x64 - {F62787DD-1327-448B-9818-030062BCFAA5}.Release|x64.Build.0 = Release|x64 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|Win32.ActiveCfg = Debug|Win32 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|Win32.Build.0 = Debug|Win32 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|x64.ActiveCfg = Debug|x64 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|x64.Build.0 = Debug|x64 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|Win32.ActiveCfg = Release|Win32 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|Win32.Build.0 = Release|Win32 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|x64.ActiveCfg = Release|x64 - {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|x64.Build.0 = Release|x64 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|Win32.ActiveCfg = Debug|Win32 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|Win32.Build.0 = Debug|Win32 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|x64.ActiveCfg = Debug|x64 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|x64.Build.0 = Debug|x64 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|Win32.ActiveCfg = Release|Win32 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|Win32.Build.0 = Release|Win32 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|x64.ActiveCfg = Release|x64 - {02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbb.vcproj b/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbb.vcproj deleted file mode 100644 index 8ec44b71df..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbb.vcproj +++ /dev/null @@ -1,918 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc.vcproj b/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc.vcproj deleted file mode 100644 index 9c6f1a1941..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc.vcproj +++ /dev/null @@ -1,822 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc_proxy.vcproj b/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc_proxy.vcproj deleted file mode 100644 index 72713dff38..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/tbbmalloc_proxy.vcproj +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/version_string.tmp b/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/version_string.tmp deleted file mode 100644 index 2098d67595..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/vsproject/version_string.tmp +++ /dev/null @@ -1 +0,0 @@ -#define __TBB_VERSION_STRINGS "Empty" diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.cl.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.cl.inc deleted file mode 100644 index f7aa6d9e45..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.cl.inc +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -#------------------------------------------------------------------------------ -# Define compiler-specific variables. -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Setting compiler flags. -#------------------------------------------------------------------------------ -CPLUS = cl /nologo -LINK_FLAGS = /link /nologo -LIB_LINK_FLAGS=/link /nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO -MS_CRT_KEY = /MD$(if $(findstring debug,$(cfg)),d) -EH_FLAGS = /EHsc /GR - -ifeq ($(cfg), release) - CPLUS_FLAGS = $(MS_CRT_KEY) /O2 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t - ASM_FLAGS = -ifeq (ia32,$(arch)) - CPLUS_FLAGS += /Oy -endif -endif -ifeq ($(cfg), debug) - CPLUS_FLAGS = $(MS_CRT_KEY) /Od /Ob0 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG - ASM_FLAGS = /DUSE_FRAME_POINTER -endif - - -COMPILE_ONLY = /c -PREPROC_ONLY = /TC /EP -INCLUDE_KEY = /I -DEFINE_KEY = /D -OUTPUT_KEY = /Fe -OUTPUTOBJ_KEY = /Fo -WARNING_AS_ERROR_KEY = /WX - -ifeq ($(runtime),vc7.1) - WARNING_KEY = /W3 -else - WARNING_KEY = /W4 -endif - -DYLIB_KEY = /DLL -EXPORT_KEY = /DEF: - -ifeq ($(runtime),vc8) - OPENMP_FLAG = /openmp - WARNING_KEY += /Wp64 - CPLUS_FLAGS += /D_USE_RTM_VERSION -endif -ifeq ($(runtime),vc9) - OPENMP_FLAG = /openmp -endif - -ifeq (em64t,$(arch)) - CPLUS_FLAGS += /GS- -endif - - - -CPLUS_FLAGS += /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE \ - /D_WIN32_WINNT=$(_WIN32_WINNT) -C_FLAGS = $(CPLUS_FLAGS) -#------------------------------------------------------------------------------ -# End of setting compiler flags. -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Setting assembler data. -#------------------------------------------------------------------------------ -ASSEMBLY_SOURCE=$(arch)-masm -ifeq (em64t,$(arch)) - ASM=ml64 - ASM_FLAGS += /DEM64T=1 /c /Zi - TBB_ASM.OBJ = atomic_support.obj -else - ASM=ml - ASM_FLAGS += /c /coff /Zi - TBB_ASM.OBJ = atomic_support.obj lock_byte.obj -endif -#------------------------------------------------------------------------------ -# End of setting assembler data. -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ -M_CPLUS_FLAGS = $(subst $(EH_FLAGS),/EHs-,$(CPLUS_FLAGS)) -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# End of define compiler-specific variables. -#------------------------------------------------------------------------------ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.icl.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.icl.inc deleted file mode 100644 index 5dd5c2a40a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.icl.inc +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -#------------------------------------------------------------------------------ -# Define compiler-specific variables. -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Setting default configuration to release. -#------------------------------------------------------------------------------ -cfg ?= release -#------------------------------------------------------------------------------ -# End of setting default configuration to release. -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Setting compiler flags. -#------------------------------------------------------------------------------ -CPLUS = icl /nologo $(VCCOMPAT_FLAG) -LINK_FLAGS = /link /nologo -LIB_LINK_FLAGS= /link /nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO -MS_CRT_KEY = /MD$(if $(findstring debug,$(cfg)),d) -EH_FLAGS = /EHsc /GR - -ifeq ($(cfg), release) - CPLUS_FLAGS = $(MS_CRT_KEY) /O2 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t - ASM_FLAGS = -ifeq (ia32,$(arch)) - CPLUS_FLAGS += /Oy -endif -endif -ifeq ($(cfg), debug) - CPLUS_FLAGS = $(MS_CRT_KEY) /Od /Ob0 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG - LINK_FLAGS += libmmds.lib /NODEFAULTLIB:libmmdd.lib - ASM_FLAGS = /DUSE_FRAME_POINTER -endif - - -COMPILE_ONLY = /c /QMMD -PREPROC_ONLY = /EP /Tc -INCLUDE_KEY = /I -DEFINE_KEY = /D -OUTPUT_KEY = /Fe -OUTPUTOBJ_KEY = /Fo -WARNING_AS_ERROR_KEY = /WX -WARNING_KEY = /W3 -DYLIB_KEY = /DLL -EXPORT_KEY = /DEF: - -ifeq (em64t,$(arch)) - CPLUS_FLAGS += /GS- -endif - -ifneq (,$(codecov)) - CPLUS_FLAGS += /Qprof-genx -else - CPLUS_FLAGS += /DDO_ITT_NOTIFY -endif - -OPENMP_FLAG = /Qopenmp -CPLUS_FLAGS += /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE \ - /D_WIN32_WINNT=$(_WIN32_WINNT) - -ifeq ($(runtime),vc8) - CPLUS_FLAGS += /D_USE_RTM_VERSION -endif - -C_FLAGS = $(CPLUS_FLAGS) - -VCVERSION:=$(runtime) -VCCOMPAT_FLAG := $(if $(findstring vc7.1, $(VCVERSION)),/Qvc7.1) -ifeq ($(VCCOMPAT_FLAG),) - VCCOMPAT_FLAG := $(if $(findstring vc8, $(VCVERSION)),/Qvc8) -endif -ifeq ($(VCCOMPAT_FLAG),) - VCCOMPAT_FLAG := $(if $(findstring vc9, $(VCVERSION)),/Qvc9) -endif -ifeq ($(VCCOMPAT_FLAG),) - $(error VC version not detected correctly: $(VCVERSION) ) -endif -export VCCOMPAT_FLAG -#------------------------------------------------------------------------------ -# End of setting compiler flags. -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Setting assembler data. -#------------------------------------------------------------------------------ -ASSEMBLY_SOURCE=$(arch)-masm -ifeq (em64t,$(arch)) - ASM=ml64 - ASM_FLAGS += /DEM64T=1 /c /Zi - TBB_ASM.OBJ = atomic_support.obj -else - ASM=ml - ASM_FLAGS += /c /coff /Zi - TBB_ASM.OBJ = atomic_support.obj lock_byte.obj -endif -#------------------------------------------------------------------------------ -# End of setting assembler data. -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# Setting tbbmalloc data. -#------------------------------------------------------------------------------ -M_CPLUS_FLAGS = $(subst $(EH_FLAGS),/EHs-,$(CPLUS_FLAGS)) -#------------------------------------------------------------------------------ -# End of setting tbbmalloc data. -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# End of define compiler-specific variables. -#------------------------------------------------------------------------------ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.inc b/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.inc deleted file mode 100644 index 3b39d06cd5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/build/windows.inc +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -ifdef tbb_build_dir - test_dir:=$(tbb_build_dir) -else - test_dir:=. -endif - -# TODO give an error if archs doesn't match -ifndef arch - export arch:=$(shell cmd /C "cscript /nologo /E:jscript $(tbb_root)/build/detect.js /arch") -endif - -ifndef runtime - export runtime:=$(shell cmd /C "cscript /nologo /E:jscript $(tbb_root)/build/detect.js /runtime") -endif - -native_compiler := cl -export compiler ?= cl -debugger ?= devenv /debugexe - -CMD=cmd /C -CWD=$(shell cmd /C echo %CD%) -RM=cmd /C del /Q /F -RD=cmd /C rmdir -MD=cmd /c mkdir -SLASH=/ -NUL = nul - -OBJ = obj -DLL = dll -LIBEXT = lib - -def_prefix = $(if $(findstring ia32,$(arch)),win32,win64) - -# Target Windows version. Do not increase beyond 0x0500 without prior discussion! -# Used as the value for macro definition opiton in windows.cl.inc etc. -_WIN32_WINNT=0x0400 - -TBB.DEF = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.def -TBB.DLL = tbb$(DEBUG_SUFFIX).$(DLL) -TBB.LIB = tbb$(DEBUG_SUFFIX).$(LIBEXT) -TBB.RES = tbb_resource.res -# On Windows, we use #pragma comment to set the proper TBB lib to link with -# But for cross-configuration testing, need to link explicitly -LINK_TBB.LIB = $(if $(crosstest),$(TBB.LIB)) -TBB.MANIFEST = -ifneq ($(runtime),vc7.1) -TBB.MANIFEST = tbbmanifest.exe.manifest -endif - -MALLOC.DEF = $(MALLOC_ROOT)/$(def_prefix)-tbbmalloc-export.def -MALLOC.DLL = tbbmalloc$(DEBUG_SUFFIX).$(DLL) -MALLOC.LIB = tbbmalloc$(DEBUG_SUFFIX).$(LIBEXT) -MALLOC.RES = tbbmalloc.res -MALLOC.MANIFEST = -ifneq ($(runtime),vc7.1) -MALLOC.MANIFEST = tbbmanifest.exe.manifest -endif -LINK_MALLOC.LIB = $(MALLOC.LIB) - -MALLOCPROXY.DLL = tbbmalloc_proxy$(DEBUG_SUFFIX).$(DLL) - - -MAKE_VERSIONS = cmd /C cscript /nologo /E:jscript $(subst \,/,$(tbb_root))/build/version_info_windows.js $(compiler) $(arch) $(subst \,/,"$(CPLUS) $(CPLUS_FLAGS) $(INCLUDES)") > version_string.tmp -MAKE_TBBVARS = cmd /C "$(subst /,\,$(tbb_root))\build\generate_tbbvars.bat" - -TEST_LAUNCHER = $(subst /,\,$(tbb_root))\build\test_launcher.bat diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/Release_Notes.txt b/deal.II/contrib/tbb/tbb21_20090313oss/doc/Release_Notes.txt deleted file mode 100644 index f5eebf572f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/Release_Notes.txt +++ /dev/null @@ -1,166 +0,0 @@ ------------------------------------------------------------------------- -Intel(R) Threading Building Blocks - Release Notes - Version 2.1 ------------------------------------------------------------------------- - - -System Requirements -------------------- - -Intel(R) Threading Building Blocks (Intel(R) TBB) is available -commercially (see http://www.intel.com/software/products/threading) as a -binary distribution, and in open source, in both source and binary -forms (see http://threadingbuildingblocks.org). - -When built from source, Intel(R) TBB is intended to be highly portable -and so supports a wide variety of operating systems and platforms (see -http://threadingbuildingblocks.org for more details). - -Binary distributions, including commercial distributions, are validated -and officially supported for the hardware, software, operating systems -and compilers listed here. - -Hardware - Recommended - - Microsoft* Windows* Systems - Intel(R) Core(TM) 2 Duo processor or Intel(R) Xeon(R) processor - or higher - Linux* Systems - Intel(R) Core(TM) 2 Duo processor or Intel(R) Xeon(R) processor - or Intel(R) Itanium(R) processor or higher - Mac OS* X Systems - Intel(R) Core(TM) 2 Duo processor or higher - -Hardware - Supported - - Intel(R) Pentium(R) 4 processor family - Intel(R) Pentium(R) D processor family - Intel(R) Xeon(R) processor family - Intel(R) Core(TM) processor family - Intel(R) Core(TM) 2 processor family - Intel(R) Itanium(R) processor family (Linux* systems only) - Non Intel(R) processors compatible with the above processors - -Software - Minimum Requirements - - Supported operating system (see below) - Supported compiler (see below) - Xcode* tool suite 2.4.1 or higher (Mac OS* X systems only) - Microsoft* Internet Explorer* 6.0, or other compatible web browser - Adobe(R) Reader(R)* 6.0 or higher - -Software - Recommended - - Intel(R) C++ Compiler 10.0 or higher - Intel(R) Thread Checker 3.1 or higher - Intel(R) Thread Profiler 3.1 or higher - -Software - Supported Operating Systems - - Microsoft* Windows* Systems - Microsoft* Windows* XP Professional - Microsoft* Windows* Server 2003 - Microsoft* Windows* Vista - Microsoft* Windows* Server 2008 - Linux* Systems - Red Hat* Enterprise Linux* 3, 4, 5 - (when using Red Hat* Enterprise Linux* 4 with Intel(R) - Itanium(R) processors, operating system Update 2 or higher - is recommended) - Red Hat* Fedora* Core 8, 9, 10 - (not with Intel(R) Itanium(R) processors) - Asianux* 3.0 - Debian* GNU/Linux* 4.0 - Ubuntu* 7.04, 7.10, 8.04, 8.10 - SuSE* Linux* Enterprise Server (SLES) 9, 10 - SGI* Propack* 4.0 (with Intel(R) Itanium(R) processors only) - SGI* Propack* 5.0 (not with IA-32 architecture processors) - Turbolinux* GreatTurbo Enterprise Server 10 SP1, Turbolinux* 11 - (not with Intel(R) Itanium(R) processors) - Mac OS* X Systems - Mac OS* X 10.4.9 or higher - -Software - Supported Compilers - - Microsoft* Visual C++* 7.1 (Microsoft* Visual Studio* .NET 2003, - Windows* systems only) - Microsoft* Visual C++ 8.0 (Microsoft* Visual Studio* 2005, - Windows* systems only) - Microsoft* Visual C++ 9.0 (Microsoft* Visual Studio* 2008, - Windows* systems only) - Intel(R) C++ Compiler 10.0 or higher - For each supported Linux* operating system, the standard gcc - version provided with that operating system is supported, - including gcc 3.2 through 4.3 - For each supported Mac OS* X operating system, the standard gcc - version provided with that operating system is supported, - including: 4.0.1 (Xcode* tool suite 2.4.1 or higher) - - -Known Issues ------------- - -Please note the following with respect to this particular release of -Intel(R) Threading Building Blocks. - -Library Issues - - - The atomic and atomic templates are - not supported when using the Microsoft* Visual C++* 7.1 - (Microsoft* Visual Studio* .NET 2003) compiler. - - - Unhandled exceptions in the user code executed in the context of - TBB algorithms or containers may lead to segmentation faults when - Intel(R) C++ Compiler 10.x is used with glibc 2.3.2, 2.3.3, or 2.3.4. - - - To allow more accurate results to be obtained with Intel(R) Thread - Checker or Intel(R) Thread Profiler, download the latest update - releases of these products before using them with Intel(R) - Threading Building Blocks. - - - If you are using Intel(R) Threading Building Blocks and OpenMP* - constructs mixed together in rapid succession in the same - program, and you are using Intel(R) compilers for your OpenMP* - code, set KMP_BLOCKTIME to a small value (e.g., 20 milliseconds) - to improve performance. This setting can also be made within - your OpenMP* code via the kmp_set_blocktime() library call. See - the Intel(R) compiler OpenMP* documentation for more details on - KMP_BLOCKTIME and kmp_set_blocktime(). - - - In general, non-debug ("release") builds of applications or - examples should link against the non-debug versions of the - Intel(R) Threading Building Blocks libraries, and debug builds - should link against the debug versions of these libraries. On - Windows* systems, compile with /MD and use Intel(R) Threading - Building Blocks release libraries, or compile with /MDd and use - debug libraries; not doing so may cause run-time failures. See - the Tutorial in the product "doc" sub-directory for more details - on debug vs. release libraries. - - - When using Ubuntu* 7.04 in 64-bit mode, compilations can fail with - error messages saying that "`::system' has not been declared". - These failures can be worked around by removing libpthread-dev - from the system. See the following link for more details: - - https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/77559 - - - By default, Ubuntu* in 64-bit mode does not install packages - required to compile 32-bit applications. Trying to compile 32-bit - applications (including TBB examples), you may get errors like: - /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread - /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread - /usr/bin/ld: cannot find -lpthread - or - /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory - In order to overcome the issue, additional packages should be - installed, such as gcc-multilib, ia32-libs, and others. - Refer to your provider of Ubuntu distribution for more details. - ------------------------------------------------------------------------- -Copyright (C) 2005-2009 Intel Corporation. All Rights Reserved. - -Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. - -* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00001.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00001.html deleted file mode 100644 index acac946763..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00001.html +++ /dev/null @@ -1,34 +0,0 @@ - - -Member List - - - - - - -

tbb::aligned_space< T, N > Member List

This is the complete list of members for tbb::aligned_space< T, N >, including all inherited members.

- - -
begin()tbb::aligned_space< T, N > [inline]
end()tbb::aligned_space< T, N > [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00005.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00005.html deleted file mode 100644 index 2c8d317311..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00005.html +++ /dev/null @@ -1,45 +0,0 @@ - - -Member List - - - - - - -

tbb::blocked_range< Value > Member List

This is the complete list of members for tbb::blocked_range< Value >, including all inherited members.

- - - - - - - - - - - - - -
begin() const tbb::blocked_range< Value > [inline]
blocked_range()tbb::blocked_range< Value > [inline]
blocked_range(Value begin_, Value end_, size_type grainsize_=1)tbb::blocked_range< Value > [inline]
blocked_range(blocked_range &r, split)tbb::blocked_range< Value > [inline]
blocked_range2d (defined in tbb::blocked_range< Value >)tbb::blocked_range< Value > [friend]
blocked_range3d (defined in tbb::blocked_range< Value >)tbb::blocked_range< Value > [friend]
const_iterator typedeftbb::blocked_range< Value >
empty() const tbb::blocked_range< Value > [inline]
end() const tbb::blocked_range< Value > [inline]
grainsize() const tbb::blocked_range< Value > [inline]
is_divisible() const tbb::blocked_range< Value > [inline]
size() const tbb::blocked_range< Value > [inline]
size_type typedeftbb::blocked_range< Value >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00006.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00006.html deleted file mode 100644 index 58207f71d6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00006.html +++ /dev/null @@ -1,41 +0,0 @@ - - -Member List - - - - - - -

tbb::blocked_range2d< RowValue, ColValue > Member List

This is the complete list of members for tbb::blocked_range2d< RowValue, ColValue >, including all inherited members.

- - - - - - - - - -
blocked_range2d(RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize, ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize) (defined in tbb::blocked_range2d< RowValue, ColValue >)tbb::blocked_range2d< RowValue, ColValue > [inline]
blocked_range2d(RowValue row_begin, RowValue row_end, ColValue col_begin, ColValue col_end) (defined in tbb::blocked_range2d< RowValue, ColValue >)tbb::blocked_range2d< RowValue, ColValue > [inline]
blocked_range2d(blocked_range2d &r, split) (defined in tbb::blocked_range2d< RowValue, ColValue >)tbb::blocked_range2d< RowValue, ColValue > [inline]
col_range_type typedef (defined in tbb::blocked_range2d< RowValue, ColValue >)tbb::blocked_range2d< RowValue, ColValue >
cols() const tbb::blocked_range2d< RowValue, ColValue > [inline]
empty() const tbb::blocked_range2d< RowValue, ColValue > [inline]
is_divisible() const tbb::blocked_range2d< RowValue, ColValue > [inline]
row_range_type typedeftbb::blocked_range2d< RowValue, ColValue >
rows() const tbb::blocked_range2d< RowValue, ColValue > [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00007.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00007.html deleted file mode 100644 index 3f2f9b3131..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00007.html +++ /dev/null @@ -1,43 +0,0 @@ - - -Member List - - - - - - -

tbb::blocked_range3d< PageValue, RowValue, ColValue > Member List

This is the complete list of members for tbb::blocked_range3d< PageValue, RowValue, ColValue >, including all inherited members.

- - - - - - - - - - - -
blocked_range3d(PageValue page_begin, PageValue page_end, RowValue row_begin, RowValue row_end, ColValue col_begin, ColValue col_end) (defined in tbb::blocked_range3d< PageValue, RowValue, ColValue >)tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]
blocked_range3d(PageValue page_begin, PageValue page_end, typename page_range_type::size_type page_grainsize, RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize, ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize) (defined in tbb::blocked_range3d< PageValue, RowValue, ColValue >)tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]
blocked_range3d(blocked_range3d &r, split) (defined in tbb::blocked_range3d< PageValue, RowValue, ColValue >)tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]
col_range_type typedef (defined in tbb::blocked_range3d< PageValue, RowValue, ColValue >)tbb::blocked_range3d< PageValue, RowValue, ColValue >
cols() const tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]
empty() const tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]
is_divisible() const tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]
page_range_type typedeftbb::blocked_range3d< PageValue, RowValue, ColValue >
pages() const tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]
row_range_type typedef (defined in tbb::blocked_range3d< PageValue, RowValue, ColValue >)tbb::blocked_range3d< PageValue, RowValue, ColValue >
rows() const tbb::blocked_range3d< PageValue, RowValue, ColValue > [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00008.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00008.html deleted file mode 100644 index 8105fbf28a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00008.html +++ /dev/null @@ -1,49 +0,0 @@ - - -Member List - - - - - - -

tbb::cache_aligned_allocator< T > Member List

This is the complete list of members for tbb::cache_aligned_allocator< T >, including all inherited members.

- - - - - - - - - - - - - - - - - -
address(reference x) const (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T > [inline]
address(const_reference x) const (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T > [inline]
allocate(size_type n, const void *hint=0)tbb::cache_aligned_allocator< T > [inline]
cache_aligned_allocator() (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T > [inline]
cache_aligned_allocator(const cache_aligned_allocator &) (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T > [inline]
cache_aligned_allocator(const cache_aligned_allocator< U > &) (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T > [inline]
const_pointer typedef (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T >
const_reference typedef (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T >
construct(pointer p, const value_type &value)tbb::cache_aligned_allocator< T > [inline]
deallocate(pointer p, size_type)tbb::cache_aligned_allocator< T > [inline]
destroy(pointer p)tbb::cache_aligned_allocator< T > [inline]
difference_type typedef (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T >
max_size() const tbb::cache_aligned_allocator< T > [inline]
pointer typedef (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T >
reference typedef (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T >
size_type typedef (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T >
value_type typedef (defined in tbb::cache_aligned_allocator< T >)tbb::cache_aligned_allocator< T >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00010.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00010.html deleted file mode 100644 index 4eded569f7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00010.html +++ /dev/null @@ -1,35 +0,0 @@ - - -Member List - - - - - - -

tbb::cache_aligned_allocator< void > Member List

This is the complete list of members for tbb::cache_aligned_allocator< void >, including all inherited members.

- - - -
const_pointer typedef (defined in tbb::cache_aligned_allocator< void >)tbb::cache_aligned_allocator< void >
pointer typedef (defined in tbb::cache_aligned_allocator< void >)tbb::cache_aligned_allocator< void >
value_type typedef (defined in tbb::cache_aligned_allocator< void >)tbb::cache_aligned_allocator< void >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00012.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00012.html deleted file mode 100644 index 9be8c01064..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00012.html +++ /dev/null @@ -1,34 +0,0 @@ - - -Member List - - - - - - -

tbb::tbb_hash_compare< T > Member List

This is the complete list of members for tbb::tbb_hash_compare< T >, including all inherited members.

- - -
equal(const T &a, const T &b) (defined in tbb::tbb_hash_compare< T >)tbb::tbb_hash_compare< T > [inline, static]
hash(const T &t) (defined in tbb::tbb_hash_compare< T >)tbb::tbb_hash_compare< T > [inline, static]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00013.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00013.html deleted file mode 100644 index d5537cd724..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00013.html +++ /dev/null @@ -1,83 +0,0 @@ - - -Member List - - - - - - -

tbb::concurrent_hash_map< Key, T, HashCompare, A > Member List

This is the complete list of members for tbb::concurrent_hash_map< Key, T, HashCompare, A >, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
allocator_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
begin() (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
begin() const (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
chain (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [friend]
clear()tbb::concurrent_hash_map< Key, T, HashCompare, A >
concurrent_hash_map(const allocator_type &a=allocator_type())tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
concurrent_hash_map(const concurrent_hash_map &table, const allocator_type &a=allocator_type())tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
concurrent_hash_map(I first, I last, const allocator_type &a=allocator_type())tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
const_accessor (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [friend]
const_iterator typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
const_pointer typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
const_range_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
const_reference typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
count(const Key &key) const tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
difference_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
empty() const tbb::concurrent_hash_map< Key, T, HashCompare, A >
end() (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
end() const (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
equal_range(const Key &key) (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
equal_range(const Key &key) const (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
erase(const Key &key)tbb::concurrent_hash_map< Key, T, HashCompare, A >
erase(const_accessor &item_accessor)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
erase(accessor &item_accessor)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
find(const_accessor &result, const Key &key) const tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
find(accessor &result, const Key &key)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
get_allocator() const tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
insert(const_accessor &result, const Key &key)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
insert(accessor &result, const Key &key)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
insert(const_accessor &result, const value_type &value)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
insert(accessor &result, const value_type &value)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
insert(const value_type &value)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
insert(I first, I last)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
internal::hash_map_iterator (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [friend]
internal::hash_map_range (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [friend]
iterator typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
key_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
mapped_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
max_size() const tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
node (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [friend]
operator=(const concurrent_hash_map &table)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
pointer typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
range(size_type grainsize=1) (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
range(size_type grainsize=1) const (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [inline]
range_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
reference typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
segment (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A > [friend]
size() const tbb::concurrent_hash_map< Key, T, HashCompare, A >
size_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
swap(concurrent_hash_map &table)tbb::concurrent_hash_map< Key, T, HashCompare, A >
value_type typedef (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >)tbb::concurrent_hash_map< Key, T, HashCompare, A >
~concurrent_hash_map()tbb::concurrent_hash_map< Key, T, HashCompare, A >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00014.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00014.html deleted file mode 100644 index 566f11869a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00014.html +++ /dev/null @@ -1,41 +0,0 @@ - - -Member List - - - - - - -

tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor Member List

This is the complete list of members for tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor, including all inherited members.

- - - - - - - - - -
accessor (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor)tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [friend]
concurrent_hash_map< Key, T, HashCompare, A > (defined in tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor)tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [friend]
const_accessor()tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
empty() const tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
operator *() const tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
operator->() const tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
release()tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
value_type typedeftbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor
~const_accessor()tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00015.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00015.html deleted file mode 100644 index 46845b813d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00015.html +++ /dev/null @@ -1,39 +0,0 @@ - - -Member List - - - - - - -

tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor Member List

This is the complete list of members for tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor, including all inherited members.

- - - - - - - -
const_accessor()tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
empty() const tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
operator *() const tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor [inline]
operator->() const tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor [inline]
release()tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]
value_type typedeftbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor
~const_accessor()tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00019.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00019.html deleted file mode 100644 index 4eaf5d6567..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00019.html +++ /dev/null @@ -1,59 +0,0 @@ - - -Member List - - - - - - -

tbb::concurrent_queue< T, A > Member List

This is the complete list of members for tbb::concurrent_queue< T, A >, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
allocator_type typedeftbb::concurrent_queue< T, A >
begin() (defined in tbb::concurrent_queue< T, A >)tbb::concurrent_queue< T, A > [inline]
begin() const (defined in tbb::concurrent_queue< T, A >)tbb::concurrent_queue< T, A > [inline]
capacity() const tbb::concurrent_queue< T, A > [inline]
clear()tbb::concurrent_queue< T, A >
concurrent_queue(const allocator_type &a=allocator_type())tbb::concurrent_queue< T, A > [inline, explicit]
concurrent_queue(const concurrent_queue &src, const allocator_type &a=allocator_type())tbb::concurrent_queue< T, A > [inline]
concurrent_queue(InputIterator begin, InputIterator end, const allocator_type &a=allocator_type())tbb::concurrent_queue< T, A > [inline]
const_iterator typedef (defined in tbb::concurrent_queue< T, A >)tbb::concurrent_queue< T, A >
const_reference typedeftbb::concurrent_queue< T, A >
difference_type typedeftbb::concurrent_queue< T, A >
empty() const tbb::concurrent_queue< T, A > [inline]
end() (defined in tbb::concurrent_queue< T, A >)tbb::concurrent_queue< T, A > [inline]
end() const (defined in tbb::concurrent_queue< T, A >)tbb::concurrent_queue< T, A > [inline]
get_allocator() const tbb::concurrent_queue< T, A > [inline]
internal::concurrent_queue_iterator (defined in tbb::concurrent_queue< T, A >)tbb::concurrent_queue< T, A > [friend]
iterator typedef (defined in tbb::concurrent_queue< T, A >)tbb::concurrent_queue< T, A >
pop(T &destination)tbb::concurrent_queue< T, A > [inline]
pop_if_present(T &destination)tbb::concurrent_queue< T, A > [inline]
push(const T &source)tbb::concurrent_queue< T, A > [inline]
push_if_not_full(const T &source)tbb::concurrent_queue< T, A > [inline]
reference typedeftbb::concurrent_queue< T, A >
set_capacity(size_type capacity)tbb::concurrent_queue< T, A > [inline]
size() const tbb::concurrent_queue< T, A > [inline]
size_type typedeftbb::concurrent_queue< T, A >
value_type typedeftbb::concurrent_queue< T, A >
~concurrent_queue()tbb::concurrent_queue< T, A >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00021.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00021.html deleted file mode 100644 index d1719b6fdf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00021.html +++ /dev/null @@ -1,92 +0,0 @@ - - -Member List - - - - - - -

tbb::concurrent_vector< T, A > Member List

This is the complete list of members for tbb::concurrent_vector< T, A >, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
allocator_type typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
assign(size_type n, const_reference t)tbb::concurrent_vector< T, A > [inline]
assign(I first, I last)tbb::concurrent_vector< T, A > [inline]
at(size_type index)tbb::concurrent_vector< T, A > [inline]
at(size_type index) const tbb::concurrent_vector< T, A > [inline]
back()tbb::concurrent_vector< T, A > [inline]
back() const tbb::concurrent_vector< T, A > [inline]
begin()tbb::concurrent_vector< T, A > [inline]
begin() const tbb::concurrent_vector< T, A > [inline]
capacity() const tbb::concurrent_vector< T, A > [inline]
clear()tbb::concurrent_vector< T, A > [inline]
compact()tbb::concurrent_vector< T, A >
concurrent_vector(const allocator_type &a=allocator_type())tbb::concurrent_vector< T, A > [inline, explicit]
concurrent_vector(const concurrent_vector &vector, const allocator_type &a=allocator_type())tbb::concurrent_vector< T, A > [inline]
concurrent_vector(const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type())tbb::concurrent_vector< T, A > [inline]
concurrent_vector(size_type n)tbb::concurrent_vector< T, A > [inline, explicit]
concurrent_vector(size_type n, const_reference t, const allocator_type &a=allocator_type())tbb::concurrent_vector< T, A > [inline]
concurrent_vector(I first, I last, const allocator_type &a=allocator_type())tbb::concurrent_vector< T, A > [inline]
const_iterator typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
const_pointer typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
const_range_type typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
const_reference typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
const_reverse_iterator typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
const_reverse_iterator typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
difference_type typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
empty() const tbb::concurrent_vector< T, A > [inline]
end()tbb::concurrent_vector< T, A > [inline]
end() const tbb::concurrent_vector< T, A > [inline]
front()tbb::concurrent_vector< T, A > [inline]
front() const tbb::concurrent_vector< T, A > [inline]
get_allocator() const tbb::concurrent_vector< T, A > [inline]
grow_by(size_type delta)tbb::concurrent_vector< T, A > [inline]
grow_by(size_type delta, const_reference t)tbb::concurrent_vector< T, A > [inline]
grow_to_at_least(size_type n)tbb::concurrent_vector< T, A > [inline]
internal::vector_iterator (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A > [friend]
internal_vector_base() const (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A > [inline]
iterator typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
max_size() const tbb::concurrent_vector< T, A > [inline]
operator=(const concurrent_vector &vector)tbb::concurrent_vector< T, A > [inline]
operator=(const concurrent_vector< T, M > &vector)tbb::concurrent_vector< T, A > [inline]
operator[](size_type index)tbb::concurrent_vector< T, A > [inline]
operator[](size_type index) const tbb::concurrent_vector< T, A > [inline]
pointer typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
push_back(const_reference item)tbb::concurrent_vector< T, A > [inline]
range(size_t grainsize=1)tbb::concurrent_vector< T, A > [inline]
range(size_t grainsize=1) const tbb::concurrent_vector< T, A > [inline]
range_type typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
rbegin()tbb::concurrent_vector< T, A > [inline]
rbegin() const tbb::concurrent_vector< T, A > [inline]
reference typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
rend()tbb::concurrent_vector< T, A > [inline]
rend() const tbb::concurrent_vector< T, A > [inline]
reserve(size_type n)tbb::concurrent_vector< T, A > [inline]
reverse_iterator typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
reverse_iterator typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
size() const tbb::concurrent_vector< T, A > [inline]
size_type typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
swap(concurrent_vector &vector)tbb::concurrent_vector< T, A > [inline]
value_type typedef (defined in tbb::concurrent_vector< T, A >)tbb::concurrent_vector< T, A >
~concurrent_vector()tbb::concurrent_vector< T, A > [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00024.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00024.html deleted file mode 100644 index 513a4b6540..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00024.html +++ /dev/null @@ -1,56 +0,0 @@ - - -Member List - - - - - - -

tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > Member List

This is the complete list of members for tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - -
allocator_type typedeftbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
begin()tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
begin() const tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
clear()tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
const_iterator typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
const_range_type typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
const_reference typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
difference_type typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
empty() const tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
end()tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
end() const tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
enumerable_thread_specific()tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
enumerable_thread_specific(const T &_exemplar)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
iterator typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
local()tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
pointer typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
range(size_t grainsize=1)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
range(size_t grainsize=1) const tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
range_type typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
reference typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
size() const tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]
size_type typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
value_type typedef (defined in tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >)tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >
~enumerable_thread_specific()tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00028.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00028.html deleted file mode 100644 index cde4313aa1..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00028.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::mutex Member List

This is the complete list of members for tbb::mutex, including all inherited members.

- - - - - - -
is_fair_mutex (defined in tbb::mutex)tbb::mutex [static]
is_recursive_mutex (defined in tbb::mutex)tbb::mutex [static]
is_rw_mutex (defined in tbb::mutex)tbb::mutex [static]
mutex()tbb::mutex [inline]
scoped_lock (defined in tbb::mutex)tbb::mutex [friend]
~mutex() (defined in tbb::mutex)tbb::mutex [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00029.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00029.html deleted file mode 100644 index 96710c4d2d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00029.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::mutex::scoped_lock Member List

This is the complete list of members for tbb::mutex::scoped_lock, including all inherited members.

- - - - - - -
acquire(mutex &mutex)tbb::mutex::scoped_lock [inline]
release()tbb::mutex::scoped_lock [inline]
scoped_lock()tbb::mutex::scoped_lock [inline]
scoped_lock(mutex &mutex)tbb::mutex::scoped_lock [inline]
try_acquire(mutex &mutex)tbb::mutex::scoped_lock [inline]
~scoped_lock()tbb::mutex::scoped_lock [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00034.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00034.html deleted file mode 100644 index 54acecf781..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00034.html +++ /dev/null @@ -1,34 +0,0 @@ - - -Member List - - - - - - -

tbb::parallel_do_feeder< Item > Member List

This is the complete list of members for tbb::parallel_do_feeder< Item >, including all inherited members.

- - -
add(const Item &item)tbb::parallel_do_feeder< Item > [inline]
internal::parallel_do_feeder_impl (defined in tbb::parallel_do_feeder< Item >)tbb::parallel_do_feeder< Item > [friend]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00035.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00035.html deleted file mode 100644 index 815feb75a7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00035.html +++ /dev/null @@ -1,33 +0,0 @@ - - -Member List - - - - - - -

tbb::pre_scan_tag Member List

This is the complete list of members for tbb::pre_scan_tag, including all inherited members.

- -
is_final_scan() (defined in tbb::pre_scan_tag)tbb::pre_scan_tag [inline, static]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00036.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00036.html deleted file mode 100644 index 00f29ee576..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00036.html +++ /dev/null @@ -1,33 +0,0 @@ - - -Member List - - - - - - -

tbb::final_scan_tag Member List

This is the complete list of members for tbb::final_scan_tag, including all inherited members.

- -
is_final_scan() (defined in tbb::final_scan_tag)tbb::final_scan_tag [inline, static]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00037.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00037.html deleted file mode 100644 index e2bbfe205c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00037.html +++ /dev/null @@ -1,37 +0,0 @@ - - -Member List - - - - - - -

tbb::parallel_while< Body > Member List

This is the complete list of members for tbb::parallel_while< Body >, including all inherited members.

- - - - - -
add(const value_type &item)tbb::parallel_while< Body >
parallel_while()tbb::parallel_while< Body > [inline]
run(Stream &stream, const Body &body)tbb::parallel_while< Body >
value_type typedeftbb::parallel_while< Body >
~parallel_while()tbb::parallel_while< Body > [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00038.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00038.html deleted file mode 100644 index cc8cc5220c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00038.html +++ /dev/null @@ -1,36 +0,0 @@ - - -Member List - - - - - - -

tbb::simple_partitioner Member List

This is the complete list of members for tbb::simple_partitioner, including all inherited members.

- - - - -
internal::start_for (defined in tbb::simple_partitioner)tbb::simple_partitioner [friend]
internal::start_reduce (defined in tbb::simple_partitioner)tbb::simple_partitioner [friend]
internal::start_scan (defined in tbb::simple_partitioner)tbb::simple_partitioner [friend]
simple_partitioner() (defined in tbb::simple_partitioner)tbb::simple_partitioner [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00040.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00040.html deleted file mode 100644 index 5ac153b75d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00040.html +++ /dev/null @@ -1,36 +0,0 @@ - - -Member List - - - - - - -

tbb::auto_partitioner Member List

This is the complete list of members for tbb::auto_partitioner, including all inherited members.

- - - - -
auto_partitioner() (defined in tbb::auto_partitioner)tbb::auto_partitioner [inline]
internal::start_for (defined in tbb::auto_partitioner)tbb::auto_partitioner [friend]
internal::start_reduce (defined in tbb::auto_partitioner)tbb::auto_partitioner [friend]
internal::start_scan (defined in tbb::auto_partitioner)tbb::auto_partitioner [friend]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00042.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00042.html deleted file mode 100644 index 993860606a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00042.html +++ /dev/null @@ -1,37 +0,0 @@ - - -Member List - - - - - - -

tbb::affinity_partitioner Member List

This is the complete list of members for tbb::affinity_partitioner, including all inherited members.

- - - - - -
affinity_partitioner() (defined in tbb::affinity_partitioner)tbb::affinity_partitioner [inline]
internal::affinity_partition_type (defined in tbb::affinity_partitioner)tbb::affinity_partitioner [friend]
internal::start_for (defined in tbb::affinity_partitioner)tbb::affinity_partitioner [friend]
internal::start_reduce_with_affinity (defined in tbb::affinity_partitioner)tbb::affinity_partitioner [friend]
internal::start_scan (defined in tbb::affinity_partitioner)tbb::affinity_partitioner [friend]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00043.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00043.html deleted file mode 100644 index ea3e11ab1f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00043.html +++ /dev/null @@ -1,46 +0,0 @@ - - -Member List - - - - - - -

tbb::filter Member List

This is the complete list of members for tbb::filter, including all inherited members.

- - - - - - - - - - - - - - -
filter(bool is_serial_) (defined in tbb::filter)tbb::filter [inline, protected]
filter(mode filter_mode) (defined in tbb::filter)tbb::filter [inline, protected]
finalize(void *)tbb::filter [inline, virtual]
internal::stage_task (defined in tbb::filter)tbb::filter [friend]
is_ordered() const (defined in tbb::filter)tbb::filter [inline]
is_serial() const tbb::filter [inline]
mode enum nametbb::filter
operator()(void *item)=0tbb::filter [pure virtual]
parallel enum valuetbb::filter
pipeline (defined in tbb::filter)tbb::filter [friend]
serial enum valuetbb::filter
serial_in_order enum valuetbb::filter
serial_out_of_order enum valuetbb::filter
~filter()tbb::filter [virtual]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00044.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00044.html deleted file mode 100644 index 237152a686..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00044.html +++ /dev/null @@ -1,40 +0,0 @@ - - -Member List - - - - - - -

tbb::pipeline Member List

This is the complete list of members for tbb::pipeline, including all inherited members.

- - - - - - - - -
add_filter(filter &filter_)tbb::pipeline
clear()tbb::pipeline
filter (defined in tbb::pipeline)tbb::pipeline [friend]
internal::stage_task (defined in tbb::pipeline)tbb::pipeline [friend]
pipeline()tbb::pipeline
run(size_t max_number_of_live_tokens)tbb::pipeline
run(size_t max_number_of_live_tokens, tbb::task_group_context &context)tbb::pipeline
~pipeline()tbb::pipeline [virtual]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00045.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00045.html deleted file mode 100644 index 42d6e58217..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00045.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::queuing_mutex Member List

This is the complete list of members for tbb::queuing_mutex, including all inherited members.

- - - - - - -
internal_construct() (defined in tbb::queuing_mutex)tbb::queuing_mutex
is_fair_mutex (defined in tbb::queuing_mutex)tbb::queuing_mutex [static]
is_recursive_mutex (defined in tbb::queuing_mutex)tbb::queuing_mutex [static]
is_rw_mutex (defined in tbb::queuing_mutex)tbb::queuing_mutex [static]
queuing_mutex()tbb::queuing_mutex [inline]
scoped_lock (defined in tbb::queuing_mutex)tbb::queuing_mutex [friend]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00046.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00046.html deleted file mode 100644 index 4f80eb845e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00046.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::queuing_mutex::scoped_lock Member List

This is the complete list of members for tbb::queuing_mutex::scoped_lock, including all inherited members.

- - - - - - -
acquire(queuing_mutex &m)tbb::queuing_mutex::scoped_lock
release()tbb::queuing_mutex::scoped_lock
scoped_lock()tbb::queuing_mutex::scoped_lock [inline]
scoped_lock(queuing_mutex &m)tbb::queuing_mutex::scoped_lock [inline]
try_acquire(queuing_mutex &m)tbb::queuing_mutex::scoped_lock
~scoped_lock()tbb::queuing_mutex::scoped_lock [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00047.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00047.html deleted file mode 100644 index 396a771b96..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00047.html +++ /dev/null @@ -1,39 +0,0 @@ - - -Member List - - - - - - -

tbb::queuing_rw_mutex Member List

This is the complete list of members for tbb::queuing_rw_mutex, including all inherited members.

- - - - - - - -
internal_construct() (defined in tbb::queuing_rw_mutex)tbb::queuing_rw_mutex
is_fair_mutex (defined in tbb::queuing_rw_mutex)tbb::queuing_rw_mutex [static]
is_recursive_mutex (defined in tbb::queuing_rw_mutex)tbb::queuing_rw_mutex [static]
is_rw_mutex (defined in tbb::queuing_rw_mutex)tbb::queuing_rw_mutex [static]
queuing_rw_mutex()tbb::queuing_rw_mutex [inline]
scoped_lock (defined in tbb::queuing_rw_mutex)tbb::queuing_rw_mutex [friend]
~queuing_rw_mutex()tbb::queuing_rw_mutex [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00048.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00048.html deleted file mode 100644 index 0b740d652f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00048.html +++ /dev/null @@ -1,40 +0,0 @@ - - -Member List - - - - - - -

tbb::queuing_rw_mutex::scoped_lock Member List

This is the complete list of members for tbb::queuing_rw_mutex::scoped_lock, including all inherited members.

- - - - - - - - -
acquire(queuing_rw_mutex &m, bool write=true)tbb::queuing_rw_mutex::scoped_lock
downgrade_to_reader()tbb::queuing_rw_mutex::scoped_lock
release()tbb::queuing_rw_mutex::scoped_lock
scoped_lock()tbb::queuing_rw_mutex::scoped_lock [inline]
scoped_lock(queuing_rw_mutex &m, bool write=true)tbb::queuing_rw_mutex::scoped_lock [inline]
try_acquire(queuing_rw_mutex &m, bool write=true)tbb::queuing_rw_mutex::scoped_lock
upgrade_to_writer()tbb::queuing_rw_mutex::scoped_lock
~scoped_lock()tbb::queuing_rw_mutex::scoped_lock [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00049.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00049.html deleted file mode 100644 index 77129ef6c1..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00049.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::recursive_mutex Member List

This is the complete list of members for tbb::recursive_mutex, including all inherited members.

- - - - - - -
is_fair_mutex (defined in tbb::recursive_mutex)tbb::recursive_mutex [static]
is_recursive_mutex (defined in tbb::recursive_mutex)tbb::recursive_mutex [static]
is_rw_mutex (defined in tbb::recursive_mutex)tbb::recursive_mutex [static]
recursive_mutex()tbb::recursive_mutex [inline]
scoped_lock (defined in tbb::recursive_mutex)tbb::recursive_mutex [friend]
~recursive_mutex() (defined in tbb::recursive_mutex)tbb::recursive_mutex [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00050.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00050.html deleted file mode 100644 index 60252318a6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00050.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::recursive_mutex::scoped_lock Member List

This is the complete list of members for tbb::recursive_mutex::scoped_lock, including all inherited members.

- - - - - - -
acquire(recursive_mutex &mutex)tbb::recursive_mutex::scoped_lock [inline]
release()tbb::recursive_mutex::scoped_lock [inline]
scoped_lock()tbb::recursive_mutex::scoped_lock [inline]
scoped_lock(recursive_mutex &mutex)tbb::recursive_mutex::scoped_lock [inline]
try_acquire(recursive_mutex &mutex)tbb::recursive_mutex::scoped_lock [inline]
~scoped_lock()tbb::recursive_mutex::scoped_lock [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00051.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00051.html deleted file mode 100644 index 3d8bc52167..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00051.html +++ /dev/null @@ -1,49 +0,0 @@ - - -Member List - - - - - - -

tbb::scalable_allocator< T > Member List

This is the complete list of members for tbb::scalable_allocator< T >, including all inherited members.

- - - - - - - - - - - - - - - - - -
address(reference x) const (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T > [inline]
address(const_reference x) const (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T > [inline]
allocate(size_type n, const void *=0)tbb::scalable_allocator< T > [inline]
const_pointer typedef (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T >
const_reference typedef (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T >
construct(pointer p, const value_type &val) (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T > [inline]
deallocate(pointer p, size_type)tbb::scalable_allocator< T > [inline]
destroy(pointer p) (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T > [inline]
difference_type typedef (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T >
max_size() const tbb::scalable_allocator< T > [inline]
pointer typedef (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T >
reference typedef (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T >
scalable_allocator() (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T > [inline]
scalable_allocator(const scalable_allocator &) (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T > [inline]
scalable_allocator(const scalable_allocator< U > &) (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T > [inline]
size_type typedef (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T >
value_type typedef (defined in tbb::scalable_allocator< T >)tbb::scalable_allocator< T >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00053.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00053.html deleted file mode 100644 index fb9f98894f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00053.html +++ /dev/null @@ -1,35 +0,0 @@ - - -Member List - - - - - - -

tbb::scalable_allocator< void > Member List

This is the complete list of members for tbb::scalable_allocator< void >, including all inherited members.

- - - -
const_pointer typedef (defined in tbb::scalable_allocator< void >)tbb::scalable_allocator< void >
pointer typedef (defined in tbb::scalable_allocator< void >)tbb::scalable_allocator< void >
value_type typedef (defined in tbb::scalable_allocator< void >)tbb::scalable_allocator< void >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00055.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00055.html deleted file mode 100644 index 34acfc99a3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00055.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::spin_mutex Member List

This is the complete list of members for tbb::spin_mutex, including all inherited members.

- - - - - - -
internal_construct() (defined in tbb::spin_mutex)tbb::spin_mutex
is_fair_mutex (defined in tbb::spin_mutex)tbb::spin_mutex [static]
is_recursive_mutex (defined in tbb::spin_mutex)tbb::spin_mutex [static]
is_rw_mutex (defined in tbb::spin_mutex)tbb::spin_mutex [static]
scoped_lock (defined in tbb::spin_mutex)tbb::spin_mutex [friend]
spin_mutex()tbb::spin_mutex [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00056.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00056.html deleted file mode 100644 index cb73240592..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00056.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Member List - - - - - - -

tbb::spin_mutex::scoped_lock Member List

This is the complete list of members for tbb::spin_mutex::scoped_lock, including all inherited members.

- - - - - - -
acquire(spin_mutex &m)tbb::spin_mutex::scoped_lock [inline]
release()tbb::spin_mutex::scoped_lock [inline]
scoped_lock()tbb::spin_mutex::scoped_lock [inline]
scoped_lock(spin_mutex &m)tbb::spin_mutex::scoped_lock [inline]
try_acquire(spin_mutex &m)tbb::spin_mutex::scoped_lock [inline]
~scoped_lock()tbb::spin_mutex::scoped_lock [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00057.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00057.html deleted file mode 100644 index 0b6dbff87a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00057.html +++ /dev/null @@ -1,37 +0,0 @@ - - -Member List - - - - - - -

tbb::spin_rw_mutex_v3 Member List

This is the complete list of members for tbb::spin_rw_mutex_v3, including all inherited members.

- - - - - -
is_fair_mutex (defined in tbb::spin_rw_mutex_v3)tbb::spin_rw_mutex_v3 [static]
is_recursive_mutex (defined in tbb::spin_rw_mutex_v3)tbb::spin_rw_mutex_v3 [static]
is_rw_mutex (defined in tbb::spin_rw_mutex_v3)tbb::spin_rw_mutex_v3 [static]
spin_rw_mutex_v3()tbb::spin_rw_mutex_v3 [inline]
~spin_rw_mutex_v3()tbb::spin_rw_mutex_v3 [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00058.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00058.html deleted file mode 100644 index d5ab0432a8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00058.html +++ /dev/null @@ -1,40 +0,0 @@ - - -Member List - - - - - - -

tbb::spin_rw_mutex_v3::scoped_lock Member List

This is the complete list of members for tbb::spin_rw_mutex_v3::scoped_lock, including all inherited members.

- - - - - - - - -
acquire(spin_rw_mutex &m, bool write=true)tbb::spin_rw_mutex_v3::scoped_lock [inline]
downgrade_to_reader()tbb::spin_rw_mutex_v3::scoped_lock [inline]
release()tbb::spin_rw_mutex_v3::scoped_lock [inline]
scoped_lock()tbb::spin_rw_mutex_v3::scoped_lock [inline]
scoped_lock(spin_rw_mutex &m, bool write=true)tbb::spin_rw_mutex_v3::scoped_lock [inline]
try_acquire(spin_rw_mutex &m, bool write=true)tbb::spin_rw_mutex_v3::scoped_lock [inline]
upgrade_to_writer()tbb::spin_rw_mutex_v3::scoped_lock [inline]
~scoped_lock()tbb::spin_rw_mutex_v3::scoped_lock [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00059.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00059.html deleted file mode 100644 index 14597bbb2a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00059.html +++ /dev/null @@ -1,43 +0,0 @@ - - -Member List - - - - - - -

tbb::task_group_context Member List

This is the complete list of members for tbb::task_group_context, including all inherited members.

- - - - - - - - - - - -
bound enum value (defined in tbb::task_group_context)tbb::task_group_context
cancel_group_execution()tbb::task_group_context
init()tbb::task_group_context [protected]
internal::allocate_root_with_context_proxy (defined in tbb::task_group_context)tbb::task_group_context [friend]
is_group_execution_cancelled() const tbb::task_group_context
isolated enum value (defined in tbb::task_group_context)tbb::task_group_context
kind_type enum name (defined in tbb::task_group_context)tbb::task_group_context
reset()tbb::task_group_context
task (defined in tbb::task_group_context)tbb::task_group_context [friend]
task_group_context(kind_type relation_with_parent=bound)tbb::task_group_context [inline]
~task_group_context() (defined in tbb::task_group_context)tbb::task_group_context


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00061.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00061.html deleted file mode 100644 index 2e3d40f58d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00061.html +++ /dev/null @@ -1,86 +0,0 @@ - - -Member List - - - - - - -

tbb::task Member List

This is the complete list of members for tbb::task, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
add_to_depth(int) (defined in tbb::task)tbb::task [inline]
add_to_depth(int delta)tbb::task [inline]
affinity() const tbb::task [inline]
affinity_id typedeftbb::task
allocate_additional_child_of(task &t)tbb::task [inline]
allocate_child()tbb::task [inline]
allocate_continuation()tbb::task [inline]
allocate_root()tbb::task [inline, static]
allocate_root(task_group_context &ctx)tbb::task [inline, static]
allocated enum valuetbb::task
cancel_group_execution()tbb::task [inline]
depth() const (defined in tbb::task)tbb::task [inline]
depth() const tbb::task [inline]
depth_type typedeftbb::task
destroy(task &victim)tbb::task
execute()=0tbb::task [pure virtual]
executing enum valuetbb::task
freed enum valuetbb::task
internal::allocate_additional_child_of_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_child_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_continuation_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_root_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_root_with_context_proxy (defined in tbb::task)tbb::task [friend]
internal::scheduler (defined in tbb::task)tbb::task [friend]
is_cancelled() const tbb::task [inline]
is_owned_by_current_thread() const tbb::task
is_stolen_task() const tbb::task [inline]
note_affinity(affinity_id id)tbb::task [virtual]
parent() const tbb::task [inline]
ready enum valuetbb::task
recycle enum valuetbb::task
recycle_as_child_of(task &new_parent)tbb::task [inline]
recycle_as_continuation()tbb::task [inline]
recycle_as_safe_continuation()tbb::task [inline]
recycle_to_reexecute()tbb::task [inline]
reexecute enum valuetbb::task
ref_count() const tbb::task [inline]
self()tbb::task [static]
set_affinity(affinity_id id)tbb::task [inline]
set_depth(intptr_t) (defined in tbb::task)tbb::task [inline]
set_depth(depth_type new_depth)tbb::task [inline]
set_ref_count(int count)tbb::task [inline]
spawn(task &child)tbb::task [inline]
spawn(task_list &list)tbb::task [inline]
spawn_and_wait_for_all(task &child)tbb::task [inline]
spawn_and_wait_for_all(task_list &list)tbb::task
spawn_root_and_wait(task &root)tbb::task [inline, static]
spawn_root_and_wait(task_list &root_list)tbb::task [inline, static]
state() const tbb::task [inline]
state_type enum nametbb::task
task()tbb::task [inline, protected]
task_list (defined in tbb::task)tbb::task [friend]
wait_for_all()tbb::task [inline]
~task()tbb::task [inline, virtual]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00062.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00062.html deleted file mode 100644 index bd105545fd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00062.html +++ /dev/null @@ -1,84 +0,0 @@ - - -Member List - - - - - - -

tbb::empty_task Member List

This is the complete list of members for tbb::empty_task, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
add_to_depth(int) (defined in tbb::task)tbb::task [inline]
add_to_depth(int delta)tbb::task [inline]
affinity() const tbb::task [inline]
affinity_id typedeftbb::task
allocate_additional_child_of(task &t)tbb::task [inline]
allocate_child()tbb::task [inline]
allocate_continuation()tbb::task [inline]
allocate_root()tbb::task [inline, static]
allocate_root(task_group_context &ctx)tbb::task [inline, static]
allocated enum valuetbb::task
cancel_group_execution()tbb::task [inline]
depth() const (defined in tbb::task)tbb::task [inline]
depth() const tbb::task [inline]
depth_type typedeftbb::task
destroy(task &victim)tbb::task
executing enum valuetbb::task
freed enum valuetbb::task
internal::allocate_additional_child_of_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_child_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_continuation_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_root_proxy (defined in tbb::task)tbb::task [friend]
internal::allocate_root_with_context_proxy (defined in tbb::task)tbb::task [friend]
internal::scheduler (defined in tbb::task)tbb::task [friend]
is_cancelled() const tbb::task [inline]
is_owned_by_current_thread() const tbb::task
is_stolen_task() const tbb::task [inline]
note_affinity(affinity_id id)tbb::task [virtual]
parent() const tbb::task [inline]
ready enum valuetbb::task
recycle enum valuetbb::task
recycle_as_child_of(task &new_parent)tbb::task [inline]
recycle_as_continuation()tbb::task [inline]
recycle_as_safe_continuation()tbb::task [inline]
recycle_to_reexecute()tbb::task [inline]
reexecute enum valuetbb::task
ref_count() const tbb::task [inline]
self()tbb::task [static]
set_affinity(affinity_id id)tbb::task [inline]
set_depth(intptr_t) (defined in tbb::task)tbb::task [inline]
set_depth(depth_type new_depth)tbb::task [inline]
set_ref_count(int count)tbb::task [inline]
spawn(task &child)tbb::task [inline]
spawn(task_list &list)tbb::task [inline]
spawn_and_wait_for_all(task &child)tbb::task [inline]
spawn_and_wait_for_all(task_list &list)tbb::task
spawn_root_and_wait(task &root)tbb::task [inline, static]
spawn_root_and_wait(task_list &root_list)tbb::task [inline, static]
state() const tbb::task [inline]
state_type enum nametbb::task
task()tbb::task [inline, protected]
wait_for_all()tbb::task [inline]
~task()tbb::task [inline, virtual]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00063.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00063.html deleted file mode 100644 index 3765324793..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00063.html +++ /dev/null @@ -1,39 +0,0 @@ - - -Member List - - - - - - -

tbb::task_list Member List

This is the complete list of members for tbb::task_list, including all inherited members.

- - - - - - - -
clear()tbb::task_list [inline]
empty() const tbb::task_list [inline]
pop_front()tbb::task_list [inline]
push_back(task &task)tbb::task_list [inline]
task (defined in tbb::task_list)tbb::task_list [friend]
task_list()tbb::task_list [inline]
~task_list()tbb::task_list [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00064.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00064.html deleted file mode 100644 index 11a9780a52..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00064.html +++ /dev/null @@ -1,41 +0,0 @@ - - -Member List - - - - - - -

tbb::task_scheduler_init Member List

This is the complete list of members for tbb::task_scheduler_init, including all inherited members.

- - - - - - - - - -
automatictbb::task_scheduler_init [static]
default_num_threads()tbb::task_scheduler_init [static]
deferredtbb::task_scheduler_init [static]
initialize(int number_of_threads=automatic)tbb::task_scheduler_init
initialize(int number_of_threads, stack_size_type thread_stack_size)tbb::task_scheduler_init
is_active() const tbb::task_scheduler_init [inline]
task_scheduler_init(int number_of_threads=automatic, stack_size_type thread_stack_size=0)tbb::task_scheduler_init [inline]
terminate()tbb::task_scheduler_init
~task_scheduler_init()tbb::task_scheduler_init [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00066.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00066.html deleted file mode 100644 index f1bb2ca96c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00066.html +++ /dev/null @@ -1,53 +0,0 @@ - - -Member List - - - - - - -

tbb::tbb_allocator< T > Member List

This is the complete list of members for tbb::tbb_allocator< T >, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - -
address(reference x) const (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T > [inline]
address(const_reference x) const (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T > [inline]
allocate(size_type n, const void *=0)tbb::tbb_allocator< T > [inline]
allocator_type()tbb::tbb_allocator< T > [inline, static]
const_pointer typedef (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
const_reference typedef (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
construct(pointer p, const value_type &value)tbb::tbb_allocator< T > [inline]
deallocate(pointer p, size_type)tbb::tbb_allocator< T > [inline]
destroy(pointer p)tbb::tbb_allocator< T > [inline]
difference_type typedef (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
malloc_type enum nametbb::tbb_allocator< T >
max_size() const tbb::tbb_allocator< T > [inline]
pointer typedef (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
reference typedef (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
scalable enum value (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
size_type typedef (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
standard enum value (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >
tbb_allocator() (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T > [inline]
tbb_allocator(const tbb_allocator &) (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T > [inline]
tbb_allocator(const tbb_allocator< U > &) (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T > [inline]
value_type typedef (defined in tbb::tbb_allocator< T >)tbb::tbb_allocator< T >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00068.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00068.html deleted file mode 100644 index 9de3fc2f93..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00068.html +++ /dev/null @@ -1,35 +0,0 @@ - - -Member List - - - - - - -

tbb::tbb_allocator< void > Member List

This is the complete list of members for tbb::tbb_allocator< void >, including all inherited members.

- - - -
const_pointer typedef (defined in tbb::tbb_allocator< void >)tbb::tbb_allocator< void >
pointer typedef (defined in tbb::tbb_allocator< void >)tbb::tbb_allocator< void >
value_type typedef (defined in tbb::tbb_allocator< void >)tbb::tbb_allocator< void >


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00070.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00070.html deleted file mode 100644 index 34c9c2461d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00070.html +++ /dev/null @@ -1,34 +0,0 @@ - - -Member List - - - - - - -

tbb::bad_last_alloc Member List

This is the complete list of members for tbb::bad_last_alloc, including all inherited members.

- - -
what() const (defined in tbb::bad_last_alloc)tbb::bad_last_alloc [inline, virtual]
~bad_last_alloc() (defined in tbb::bad_last_alloc)tbb::bad_last_alloc [inline, virtual]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00071.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00071.html deleted file mode 100644 index 31e6f416a5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00071.html +++ /dev/null @@ -1,37 +0,0 @@ - - -Member List - - - - - - -

tbb::tbb_exception Member List

This is the complete list of members for tbb::tbb_exception, including all inherited members.

- - - - - -
destroy()=0tbb::tbb_exception [pure virtual]
move()=0tbb::tbb_exception [pure virtual]
name() const =0tbb::tbb_exception [pure virtual]
throw_self()=0tbb::tbb_exception [pure virtual]
what() const =0tbb::tbb_exception [pure virtual]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00072.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00072.html deleted file mode 100644 index d9e748e12a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00072.html +++ /dev/null @@ -1,41 +0,0 @@ - - -Member List - - - - - - -

tbb::captured_exception Member List

This is the complete list of members for tbb::captured_exception, including all inherited members.

- - - - - - - - - -
captured_exception(const captured_exception &src) (defined in tbb::captured_exception)tbb::captured_exception [inline]
captured_exception(const char *name, const char *info) (defined in tbb::captured_exception)tbb::captured_exception [inline]
destroy()tbb::captured_exception [virtual]
move()tbb::captured_exception [virtual]
name() const tbb::captured_exception [virtual]
operator=(const captured_exception &src) (defined in tbb::captured_exception)tbb::captured_exception [inline]
throw_self()tbb::captured_exception [inline, virtual]
what() const tbb::captured_exception [virtual]
~captured_exception() (defined in tbb::captured_exception)tbb::captured_exception [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00073.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00073.html deleted file mode 100644 index 730f2f5b9c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00073.html +++ /dev/null @@ -1,44 +0,0 @@ - - -Member List - - - - - - -

tbb::movable_exception< ExceptionData > Member List

This is the complete list of members for tbb::movable_exception< ExceptionData >, including all inherited members.

- - - - - - - - - - - - -
data() (defined in tbb::movable_exception< ExceptionData >)tbb::movable_exception< ExceptionData > [inline]
data() const (defined in tbb::movable_exception< ExceptionData >)tbb::movable_exception< ExceptionData > [inline]
destroy()tbb::movable_exception< ExceptionData > [inline, virtual]
movable_exception(const ExceptionData &data) (defined in tbb::movable_exception< ExceptionData >)tbb::movable_exception< ExceptionData > [inline]
movable_exception(const movable_exception &src) (defined in tbb::movable_exception< ExceptionData >)tbb::movable_exception< ExceptionData > [inline]
move()tbb::movable_exception< ExceptionData > [inline, virtual]
my_exception_datatbb::movable_exception< ExceptionData > [protected]
name() const tbb::movable_exception< ExceptionData > [inline, virtual]
operator=(const movable_exception &src) (defined in tbb::movable_exception< ExceptionData >)tbb::movable_exception< ExceptionData > [inline]
throw_self()tbb::movable_exception< ExceptionData > [inline, virtual]
what() const tbb::movable_exception< ExceptionData > [inline, virtual]
~movable_exception() (defined in tbb::movable_exception< ExceptionData >)tbb::movable_exception< ExceptionData > [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00074.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00074.html deleted file mode 100644 index 6020efcea2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00074.html +++ /dev/null @@ -1,36 +0,0 @@ - - -Member List - - - - - - -

tbb::internal::AtomicBackoff Member List

This is the complete list of members for tbb::internal::AtomicBackoff, including all inherited members.

- - - - -
AtomicBackoff() (defined in tbb::internal::AtomicBackoff)tbb::internal::AtomicBackoff [inline]
bounded_pause() (defined in tbb::internal::AtomicBackoff)tbb::internal::AtomicBackoff [inline]
pause()tbb::internal::AtomicBackoff [inline]
reset() (defined in tbb::internal::AtomicBackoff)tbb::internal::AtomicBackoff [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00081.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00081.html deleted file mode 100644 index c3baf5401c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00081.html +++ /dev/null @@ -1,33 +0,0 @@ - - -Member List - - - - - - -

tbb::internal::work_around_alignment_bug< Size, T > Member List

This is the complete list of members for tbb::internal::work_around_alignment_bug< Size, T >, including all inherited members.

- -
alignment (defined in tbb::internal::work_around_alignment_bug< Size, T >)tbb::internal::work_around_alignment_bug< Size, T > [static]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00083.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00083.html deleted file mode 100644 index 4bd38f1c54..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00083.html +++ /dev/null @@ -1,35 +0,0 @@ - - -Member List - - - - - - -

tbb::tick_count Member List

This is the complete list of members for tbb::tick_count, including all inherited members.

- - - -
now()tbb::tick_count [inline, static]
operator-(const tick_count &t1, const tick_count &t0)tbb::tick_count [friend]
tick_count()tbb::tick_count [inline]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00084.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00084.html deleted file mode 100644 index 23c210b24f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00084.html +++ /dev/null @@ -1,41 +0,0 @@ - - -Member List - - - - - - -

tbb::tick_count::interval_t Member List

This is the complete list of members for tbb::tick_count::interval_t, including all inherited members.

- - - - - - - - - -
interval_t()tbb::tick_count::interval_t [inline]
interval_t(double sec)tbb::tick_count::interval_t [inline, explicit]
operator+(const interval_t &i, const interval_t &j)tbb::tick_count::interval_t [friend]
operator+=(const interval_t &i)tbb::tick_count::interval_t [inline]
operator-(const tick_count &t1, const tick_count &t0)tbb::tick_count::interval_t [friend]
operator-(const interval_t &i, const interval_t &j)tbb::tick_count::interval_t [friend]
operator-=(const interval_t &i)tbb::tick_count::interval_t [inline]
seconds() const tbb::tick_count::interval_t [inline]
tbb::tick_count (defined in tbb::tick_count::interval_t)tbb::tick_count::interval_t [friend]


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00096.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00096.html deleted file mode 100644 index cdf085be2c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00096.html +++ /dev/null @@ -1,59 +0,0 @@ - - -tbb::affinity_partitioner Class Reference - - - - - - - -

tbb::affinity_partitioner Class Reference

An affinity partitioner. -More... -

-#include <partitioner.h> -

-List of all members. - - - - - - - - - - -

Friends

-class internal::start_for
-class internal::start_reduce_with_affinity
-class internal::start_scan
-class internal::affinity_partition_type
-


Detailed Description

-An affinity partitioner. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00097.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00097.html deleted file mode 100644 index feb8bce3aa..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00097.html +++ /dev/null @@ -1,63 +0,0 @@ - - -tbb::aligned_space< T, N > Class Template Reference - - - - - - - -

tbb::aligned_space< T, N > Class Template Reference
- -[Memory Allocation] -

Block of space aligned sufficiently to construct an array T with N elements. -More... -

-#include <aligned_space.h> -

-List of all members. - - - - - - - - -

Public Member Functions

-T * begin ()
 Pointer to beginning of array.
-T * end ()
 Pointer to one past last element in array.
-


Detailed Description

-

template<typename T, size_t N>
- class tbb::aligned_space< T, N >

- -Block of space aligned sufficiently to construct an array T with N elements. -

-The elements are not constructed or destroyed by this class. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00098.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00098.html deleted file mode 100644 index 2228aafc08..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00098.html +++ /dev/null @@ -1,54 +0,0 @@ - - -tbb::atomic< T > Struct Template Reference - - - - - - - -

tbb::atomic< T > Struct Template Reference
- -[Synchronization] -

Primary template for atomic. -More... -

-#include <atomic.h> -

- - -
-


Detailed Description

-

template<typename T>
- struct tbb::atomic< T >

- -Primary template for atomic. -

-See the Reference for details. -

-


The documentation for this struct was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00099.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00099.html deleted file mode 100644 index 30bf6754ba..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00099.html +++ /dev/null @@ -1,59 +0,0 @@ - - -tbb::internal::AtomicBackoff Class Reference - - - - - - - -

tbb::internal::AtomicBackoff Class Reference

Class that implements exponential backoff. -More... -

-#include <tbb_machine.h> -

-List of all members. - - - - - - - - - -

Public Member Functions

-void pause ()
 Pause for a while.
-bool bounded_pause ()
-void reset ()
-


Detailed Description

-Class that implements exponential backoff. -

-See implementation of SpinwaitWhileEq for an example. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00100.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00100.html deleted file mode 100644 index 58eec04051..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00100.html +++ /dev/null @@ -1,64 +0,0 @@ - - -tbb::auto_partitioner Class Reference - - - - - - - -

tbb::auto_partitioner Class Reference
- -[Algorithms] -

An auto partitioner. -More... -

-#include <partitioner.h> -

-List of all members. - - - - - - - - - - - -

Friends

-class internal::start_for
-class internal::start_reduce
-class internal::start_scan

Classes

class  partition_type
-


Detailed Description

-An auto partitioner. -

-The range is initial divided into several large chunks. Chunks are further subdivided into VICTIM_CHUNKS pieces if they are stolen and divisible. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00101.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00101.html deleted file mode 100644 index ecb6ee5a79..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00101.html +++ /dev/null @@ -1,50 +0,0 @@ - - -tbb::bad_last_alloc Class Reference - - - - - - - -

tbb::bad_last_alloc Class Reference

Exception for concurrent containers. -More... -

-#include <tbb_exception.h> -

-List of all members. - - - - -

Public Member Functions

-virtual const char * what () const throw ()
-


Detailed Description

-Exception for concurrent containers. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00102.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00102.html deleted file mode 100644 index c449fe5756..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00102.html +++ /dev/null @@ -1,224 +0,0 @@ - - -tbb::blocked_range< Value > Class Template Reference - - - - - - - -

tbb::blocked_range< Value > Class Template Reference
- -[Algorithms] -

A range over which to iterate. -More... -

-#include <blocked_range.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

typedef Value const_iterator
 Type of a value.
-typedef std::size_t size_type
 Type for size of a range.

Public Member Functions

 blocked_range ()
 Construct range with default-constructed values for begin and end.
blocked_range (Value begin_, Value end_, size_type grainsize_=1)
 Construct range over half-open interval [begin,end), with the given grainsize.
-const_iterator begin () const
 Beginning of range.
-const_iterator end () const
 One past last value in range.
size_type size () const
 Size of the range.
-size_type grainsize () const
 The grain size for this range.
-bool empty () const
 True if range is empty.
bool is_divisible () const
 True if range is divisible.
 blocked_range (blocked_range &r, split)
 Split range.

Friends

-class blocked_range2d
-class blocked_range3d
-


Detailed Description

-

template<typename Value>
- class tbb::blocked_range< Value >

- -A range over which to iterate. -

-


Member Typedef Documentation

- -
-
-
-template<typename Value>
- - - - -
typedef Value tbb::blocked_range< Value >::const_iterator
-
-
- -

-Type of a value. -

-Called a const_iterator for sake of algorithms that need to treat a blocked_range as an STL container. -

-

-


Constructor & Destructor Documentation

- -
-
-
-template<typename Value>
- - - - - - - - -
tbb::blocked_range< Value >::blocked_range (  )  [inline]
-
-
- -

-Construct range with default-constructed values for begin and end. -

-Requires that Value have a default constructor. -

-

- -

-
-
-template<typename Value>
- - - - - - - - - - - - - - - - - - -
tbb::blocked_range< Value >::blocked_range (blocked_range< Value > &  r,
split  
) [inline]
-
-
- -

-Split range. -

-The new Range *this has the second half, the old range r has the first half. Unspecified if end()<begin() or !is_divisible(). -

-

-


Member Function Documentation

- -
-
-
-template<typename Value>
- - - - - - - - -
bool tbb::blocked_range< Value >::is_divisible (  )  const [inline]
-
-
- -

-True if range is divisible. -

-Unspecified if end()<begin(). -

-

- -

-
-
-template<typename Value>
- - - - - - - - -
size_type tbb::blocked_range< Value >::size (  )  const [inline]
-
-
- -

-Size of the range. -

-Unspecified if end()<begin(). -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00103.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00103.html deleted file mode 100644 index 10e1c2cb74..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00103.html +++ /dev/null @@ -1,86 +0,0 @@ - - -tbb::blocked_range2d< RowValue, ColValue > Class Template Reference - - - - - - - -

tbb::blocked_range2d< RowValue, ColValue > Class Template Reference
- -[Algorithms] -

A 2-dimensional range that models the Range concept. -More... -

-#include <blocked_range2d.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef blocked_range< RowValue > row_range_type
 Type for size of an iteation range.
-typedef blocked_range< ColValue > col_range_type

Public Member Functions

blocked_range2d (RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize, ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize)
blocked_range2d (RowValue row_begin, RowValue row_end, ColValue col_begin, ColValue col_end)
-bool empty () const
 True if range is empty.
-bool is_divisible () const
 True if range is divisible into two pieces.
blocked_range2d (blocked_range2d &r, split)
-const row_range_typerows () const
 The rows of the iteration space.
-const col_range_typecols () const
 The columns of the iteration space.
-


Detailed Description

-

template<typename RowValue, typename ColValue = RowValue>
- class tbb::blocked_range2d< RowValue, ColValue >

- -A 2-dimensional range that models the Range concept. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00104.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00104.html deleted file mode 100644 index 10c11ad18c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00104.html +++ /dev/null @@ -1,93 +0,0 @@ - - -tbb::blocked_range3d< PageValue, RowValue, ColValue > Class Template Reference - - - - - - - -

tbb::blocked_range3d< PageValue, RowValue, ColValue > Class Template Reference
- -[Algorithms] -

A 3-dimensional range that models the Range concept. -More... -

-#include <blocked_range3d.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef blocked_range< PageValue > page_range_type
 Type for size of an iteation range.
-typedef blocked_range< RowValue > row_range_type
-typedef blocked_range< ColValue > col_range_type

Public Member Functions

blocked_range3d (PageValue page_begin, PageValue page_end, RowValue row_begin, RowValue row_end, ColValue col_begin, ColValue col_end)
blocked_range3d (PageValue page_begin, PageValue page_end, typename page_range_type::size_type page_grainsize, RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize, ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize)
-bool empty () const
 True if range is empty.
-bool is_divisible () const
 True if range is divisible into two pieces.
blocked_range3d (blocked_range3d &r, split)
-const page_range_typepages () const
 The pages of the iteration space.
-const row_range_typerows () const
 The rows of the iteration space.
-const col_range_typecols () const
 The columns of the iteration space.
-


Detailed Description

-

template<typename PageValue, typename RowValue = PageValue, typename ColValue = RowValue>
- class tbb::blocked_range3d< PageValue, RowValue, ColValue >

- -A 3-dimensional range that models the Range concept. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00105.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00105.html deleted file mode 100644 index 4f14a4bfe6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00105.html +++ /dev/null @@ -1,114 +0,0 @@ - - -tbb::cache_aligned_allocator< T > Class Template Reference - - - - - - - -

tbb::cache_aligned_allocator< T > Class Template Reference
- -[Memory Allocation] -

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. -More... -

-#include <cache_aligned_allocator.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef internal::allocator_type<
- T >::value_type 
value_type
-typedef value_type * pointer
-typedef const value_type * const_pointer
-typedef value_type & reference
-typedef const value_type & const_reference
-typedef size_t size_type
-typedef ptrdiff_t difference_type

Public Member Functions

cache_aligned_allocator (const cache_aligned_allocator &) throw ()
-template<typename U>
 cache_aligned_allocator (const cache_aligned_allocator< U > &) throw ()
-pointer address (reference x) const
-const_pointer address (const_reference x) const
-pointer allocate (size_type n, const void *hint=0)
 Allocate space for n objects, starting on a cache/sector line.
-void deallocate (pointer p, size_type)
 Free block of memory that starts on a cache line.
-size_type max_size () const throw ()
 Largest value for which method allocate might succeed.
-void construct (pointer p, const value_type &value)
 Copy-construct value at location pointed to by p.
-void destroy (pointer p)
 Destroy value at location pointed to by p.

Classes

struct  rebind
-


Detailed Description

-

template<typename T>
- class tbb::cache_aligned_allocator< T >

- -Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. -

-The members are ordered the same way they are in section 20.4.1 of the ISO C++ standard. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00106.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00106.html deleted file mode 100644 index a8c79f241d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00106.html +++ /dev/null @@ -1,65 +0,0 @@ - - -tbb::cache_aligned_allocator< void > Class Template Reference - - - - - - - -

tbb::cache_aligned_allocator< void > Class Template Reference
- -[Memory Allocation] -

Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. -More... -

-#include <cache_aligned_allocator.h> -

-List of all members. - - - - - - - - - - - -

Public Types

-typedef void * pointer
-typedef const void * const_pointer
-typedef void value_type

Classes

struct  rebind
-


Detailed Description

-

template<>
- class tbb::cache_aligned_allocator< void >

- -Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00107.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00107.html deleted file mode 100644 index a1bdaf63d6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00107.html +++ /dev/null @@ -1,148 +0,0 @@ - - -tbb::captured_exception Class Reference - - - - - - - -

tbb::captured_exception Class Reference

This class is used by TBB to propagate information about unhandled exceptions into the root thread. -More... -

-#include <tbb_exception.h> -

-Inherits tbb::tbb_exception. -

-Inheritance diagram for tbb::captured_exception:

[legend]
List of all members. - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

captured_exception (const captured_exception &src)
captured_exception (const char *name, const char *info)
-captured_exceptionoperator= (const captured_exception &src)
captured_exceptionmove () throw ()
 Creates and returns pointer to the deep copy of this exception object.
void destroy () throw ()
 Destroys objects created by the move() method.
void throw_self ()
 Throws this exception object.
-const char *__TBB_EXPORTED_METHOD name () const throw ()
 Returns RTTI name of the originally intercepted exception.
-const char *__TBB_EXPORTED_METHOD what () const throw ()
 Returns the result of originally intercepted exception's what() method.
-

Detailed Description

-This class is used by TBB to propagate information about unhandled exceptions into the root thread. -

-Exception of this type is thrown by TBB in the root thread (thread that started a parallel algorithm ) if an unhandled exception was intercepted during the algorithm execution in one of the workers.

See also:
tbb::tbb_exception
- -

-


Member Function Documentation

- -
-
- - - - - - - - -
void tbb::captured_exception::destroy (  )  throw () [virtual]
-
-
- -

-Destroys objects created by the move() method. -

-Frees memory and calls destructor for this exception object. Can and must be used only on objects created by the move method. -

-Implements tbb::tbb_exception. -

-

- -

-
- - - - - - - - -
captured_exception* tbb::captured_exception::move (  )  throw () [virtual]
-
-
- -

-Creates and returns pointer to the deep copy of this exception object. -

-Move semantics is allowed. -

-Implements tbb::tbb_exception. -

-

- -

-
- - - - - - - - -
void tbb::captured_exception::throw_self (  )  [inline, virtual]
-
-
- -

-Throws this exception object. -

-Make sure that if you have several levels of derivation from this interface you implement or override this method on the most derived level. The implementation is as simple as "throw *this;". Failure to do this will result in exception of a base class type being thrown. -

-Implements tbb::tbb_exception. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00108.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00108.html deleted file mode 100644 index 8c85941d7d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00108.html +++ /dev/null @@ -1,573 +0,0 @@ - - -tbb::concurrent_hash_map< Key, T, HashCompare, A > Class Template Reference - - - - - - - -

tbb::concurrent_hash_map< Key, T, HashCompare, A > Class Template Reference
- -[Containers] -

Unordered map from Key to T. -More... -

-#include <concurrent_hash_map.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef Key key_type
-typedef T mapped_type
-typedef std::pair< const Key,
- T > 
value_type
-typedef size_t size_type
-typedef ptrdiff_t difference_type
-typedef value_type * pointer
-typedef const value_type * const_pointer
-typedef value_type & reference
-typedef const value_type & const_reference
-typedef internal::hash_map_iterator<
- concurrent_hash_map, value_type > 
iterator
-typedef internal::hash_map_iterator<
- concurrent_hash_map, const
-value_type > 
const_iterator
-typedef internal::hash_map_range<
- iterator > 
range_type
-typedef internal::hash_map_range<
- const_iterator > 
const_range_type
-typedef A allocator_type

Public Member Functions

concurrent_hash_map (const allocator_type &a=allocator_type())
 Construct empty table.
concurrent_hash_map (const concurrent_hash_map &table, const allocator_type &a=allocator_type())
 Copy constructor.
-template<typename I>
 concurrent_hash_map (I first, I last, const allocator_type &a=allocator_type())
 Construction with copying iteration range and given allocator instance.
-concurrent_hash_mapoperator= (const concurrent_hash_map &table)
 Assignment.
-void clear ()
 Clear table.
~concurrent_hash_map ()
 Clear table and destroy it.
-range_type range (size_type grainsize=1)
-const_range_type range (size_type grainsize=1) const
-iterator begin ()
-iterator end ()
-const_iterator begin () const
-const_iterator end () const
-std::pair< iterator, iterator > equal_range (const Key &key)
-std::pair< const_iterator,
- const_iterator > 
equal_range (const Key &key) const
size_type size () const
 Number of items in table.
-bool empty () const
 True if size()==0.
-size_type max_size () const
 Upper bound on size.
-allocator_type get_allocator () const
 return allocator object
-void swap (concurrent_hash_map &table)
 swap two instances
-size_type count (const Key &key) const
 Return count of items (0 or 1).
bool find (const_accessor &result, const Key &key) const
 Find item and acquire a read lock on the item.
bool find (accessor &result, const Key &key)
 Find item and acquire a write lock on the item.
bool insert (const_accessor &result, const Key &key)
 Insert item (if not already present) and acquire a read lock on the item.
bool insert (accessor &result, const Key &key)
 Insert item (if not already present) and acquire a write lock on the item.
bool insert (const_accessor &result, const value_type &value)
 Insert item by copying if there is no such key present already and acquire a read lock on the item.
bool insert (accessor &result, const value_type &value)
 Insert item by copying if there is no such key present already and acquire a write lock on the item.
bool insert (const value_type &value)
 Insert item by copying if there is no such key present already.
-template<typename I>
void insert (I first, I last)
 Insert range [first, last).
bool erase (const Key &key)
 Erase item.
bool erase (const_accessor &item_accessor)
 Erase item by const_accessor.
bool erase (accessor &item_accessor)
 Erase item by accessor.

Friends

-class internal::hash_map_iterator
-class internal::hash_map_range
-struct node
-class const_accessor
-struct chain
-struct segment

Classes

class  accessor
 Allows write access to elements and combines data access, locking, and garbage collection. More...
struct  chain
 A linked-list of nodes.
class  const_accessor
 Combines data access, locking, and garbage collection. More...
struct  node
 Basic unit of storage used in chain.
struct  segment
 Segment of the table.
-


Detailed Description

-

template<typename Key, typename T, typename HashCompare, typename A>
- class tbb::concurrent_hash_map< Key, T, HashCompare, A >

- -Unordered map from Key to T. -

-concurrent_hash_map is associative container with concurrent access.

-

Compatibility
The class meets all Container Requirements from C++ Standard (See ISO/IEC 14882:2003(E), clause 23.1).
-
Exception Safety
    -
  • Hash function is not permitted to throw an exception. User-defined types Key and T are forbidden from throwing an exception in destructors.
  • If exception happens during insert() operations, it has no effect (unless exception raised by HashCompare::hash() function during grow_segment).
  • If exception happens during operator=() operation, the container can have a part of source items, and methods size() and empty() can return wrong results.
-
-
Changes since TBB 2.0
    -
  • Fixed exception-safety
  • Added template argument for allocator
  • Added allocator argument in constructors
  • Added constructor from a range of iterators
  • Added several new overloaded insert() methods
  • Added get_allocator()
  • Added swap()
  • Added count()
  • Added overloaded erase(accessor &) and erase(const_accessor&)
  • Added equal_range() [const]
  • Added [const_]pointer, [const_]reference, and allocator_type types
  • Added global functions: operator==(), operator!=(), and swap()
-
- -

-


Member Function Documentation

- -
-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::erase (accessor item_accessor  )  [inline]
-
-
- -

-Erase item by accessor. -

-Return true if item was erased by particularly this call. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::erase (const_accessor item_accessor  )  [inline]
-
-
- -

-Erase item by const_accessor. -

-Return true if item was erased by particularly this call. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::erase (const Key &  key  ) 
-
-
- -

-Erase item. -

-Return true if item was erased by particularly this call. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - - - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::find (accessor result,
const Key &  key 
) [inline]
-
-
- -

-Find item and acquire a write lock on the item. -

-Return true if item is found, false otherwise. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - - - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::find (const_accessor result,
const Key &  key 
) const [inline]
-
-
- -

-Find item and acquire a read lock on the item. -

-Return true if item is found, false otherwise. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::insert (const value_type &  value  )  [inline]
-
-
- -

-Insert item by copying if there is no such key present already. -

-Returns true if item is inserted. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - - - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::insert (accessor result,
const value_type &  value 
) [inline]
-
-
- -

-Insert item by copying if there is no such key present already and acquire a write lock on the item. -

-Returns true if item is new. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - - - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::insert (const_accessor result,
const value_type &  value 
) [inline]
-
-
- -

-Insert item by copying if there is no such key present already and acquire a read lock on the item. -

-Returns true if item is new. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - - - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::insert (accessor result,
const Key &  key 
) [inline]
-
-
- -

-Insert item (if not already present) and acquire a write lock on the item. -

-Returns true if item is new. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - - - - - - - - - - - -
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::insert (const_accessor result,
const Key &  key 
) [inline]
-
-
- -

-Insert item (if not already present) and acquire a read lock on the item. -

-Returns true if item is new. -

-

- -

-
-
-template<typename Key, typename T, typename HashCompare, typename A>
- - - - - - - - -
concurrent_hash_map< Key, T, HashCompare, A >::size_type tbb::concurrent_hash_map< Key, T, HashCompare, A >::size (  )  const
-
-
- -

-Number of items in table. -

-Be aware that this method is relatively slow compared to the typical size() method for an STL container. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00109.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00109.html deleted file mode 100644 index 78a85e000f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00109.html +++ /dev/null @@ -1,66 +0,0 @@ - - -tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor Class Reference - - - - - - - -

tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor Class Reference

Allows write access to elements and combines data access, locking, and garbage collection. -More... -

-#include <concurrent_hash_map.h> -

-Inherits tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor. -

-Inheritance diagram for tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor:

[legend]
List of all members. - - - - - - - - - - - - -

Public Types

-typedef std::pair< const Key,
- T > 
value_type
 Type of value.

Public Member Functions

-reference operator * () const
 Return reference to associated value in hash table.
-pointer operator-> () const
 Return pointer to associated value in hash table.
-

Detailed Description

-

template<typename Key, typename T, typename HashCompare, typename A>
- class tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor

- -Allows write access to elements and combines data access, locking, and garbage collection. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00110.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00110.html deleted file mode 100644 index 3a4e037f71..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00110.html +++ /dev/null @@ -1,89 +0,0 @@ - - -tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor Class Reference - - - - - - - -

tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor Class Reference

Combines data access, locking, and garbage collection. -More... -

-#include <concurrent_hash_map.h> -

-Inherited by tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessor. -

-Inheritance diagram for tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor:

[legend]
List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef const std::pair< const
-Key, T > 
value_type
 Type of value.

Public Member Functions

-bool empty () const
 True if result is empty.
-void release ()
 Set to null.
-const_reference operator * () const
 Return reference to associated value in hash table.
-const_pointer operator-> () const
 Return pointer to associated value in hash table.
const_accessor ()
 Create empty result.
~const_accessor ()
 Destroy result after releasing the underlying reference.

Friends

-class concurrent_hash_map< Key, T, HashCompare, A >
-class accessor
-

Detailed Description

-

template<typename Key, typename T, typename HashCompare, typename A>
- class tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessor

- -Combines data access, locking, and garbage collection. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00111.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00111.html deleted file mode 100644 index aee06738f9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00111.html +++ /dev/null @@ -1,299 +0,0 @@ - - -tbb::concurrent_queue< T, A > Class Template Reference - - - - - - - -

tbb::concurrent_queue< T, A > Class Template Reference
- -[Containers] -

A high-performance thread-safe queue. -More... -

-#include <concurrent_queue.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef T value_type
 Element type in the queue.
-typedef A allocator_type
 Allocator type.
-typedef T & reference
 Reference type.
-typedef const T & const_reference
 Const reference type.
typedef std::ptrdiff_t size_type
 Integral type for representing size of the queue.
-typedef std::ptrdiff_t difference_type
 Difference type for iterator.
-typedef internal::concurrent_queue_iterator<
- concurrent_queue, T > 
iterator
-typedef internal::concurrent_queue_iterator<
- concurrent_queue, const T > 
const_iterator

Public Member Functions

concurrent_queue (const allocator_type &a=allocator_type())
 Construct empty queue.
~concurrent_queue ()
 Destroy queue.
-void push (const T &source)
 Enqueue an item at tail of queue.
void pop (T &destination)
 Dequeue item from head of queue.
bool push_if_not_full (const T &source)
 Enqueue an item at tail of queue if queue is not already full.
bool pop_if_present (T &destination)
 Attempt to dequeue an item from head of queue.
size_type size () const
 Return number of pushes minus number of pops.
-bool empty () const
 Equivalent to size()<=0.
-size_type capacity () const
 Maximum number of allowed elements.
void set_capacity (size_type capacity)
 Set the capacity.
-allocator_type get_allocator () const
 return allocator object
-void clear ()
 clear the queue. not thread-safe.
-iterator begin ()
-iterator end ()
-const_iterator begin () const
-const_iterator end () const
concurrent_queue (const concurrent_queue &src, const allocator_type &a=allocator_type())
 Copy constructor.
-template<typename InputIterator>
 concurrent_queue (InputIterator begin, InputIterator end, const allocator_type &a=allocator_type())
 [begin,end) constructor

Friends

-class internal::concurrent_queue_iterator

Classes

class  destroyer
 Class used to ensure exception-safety of method "pop".
-


Detailed Description

-

template<typename T, class A>
- class tbb::concurrent_queue< T, A >

- -A high-performance thread-safe queue. -

-Multiple threads may each push and pop concurrently. Assignment construction is not allowed. -

-


Member Typedef Documentation

- -
-
-
-template<typename T, class A>
- - - - -
typedef std::ptrdiff_t tbb::concurrent_queue< T, A >::size_type
-
-
- -

-Integral type for representing size of the queue. -

-Notice that the size_type is a signed integral type. This is because the size can be negative if there are pending pops without corresponding pushes. -

-

-


Member Function Documentation

- -
-
-
-template<typename T, class A>
- - - - - - - - - -
void tbb::concurrent_queue< T, A >::pop (T &  destination  )  [inline]
-
-
- -

-Dequeue item from head of queue. -

-Block until an item becomes available, and then dequeue it. -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - - -
bool tbb::concurrent_queue< T, A >::pop_if_present (T &  destination  )  [inline]
-
-
- -

-Attempt to dequeue an item from head of queue. -

-Does not wait for item to become available. Returns true if successful; false otherwise. -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - - -
bool tbb::concurrent_queue< T, A >::push_if_not_full (const T &  source  )  [inline]
-
-
- -

-Enqueue an item at tail of queue if queue is not already full. -

-Does not wait for queue to become not full. Returns true if item is pushed; false if queue was already full. -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - - -
void tbb::concurrent_queue< T, A >::set_capacity (size_type  capacity  )  [inline]
-
-
- -

-Set the capacity. -

-Setting the capacity to 0 causes subsequent push_if_not_full operations to always fail, and subsequent push operations to block forever. -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - -
size_type tbb::concurrent_queue< T, A >::size (  )  const [inline]
-
-
- -

-Return number of pushes minus number of pops. -

-Note that the result can be negative if there are pops waiting for the corresponding pushes. The result can also exceed capacity() if there are push operations in flight. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00112.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00112.html deleted file mode 100644 index 81a4c166e5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00112.html +++ /dev/null @@ -1,438 +0,0 @@ - - -tbb::concurrent_vector< T, A > Class Template Reference - - - - - - - -

tbb::concurrent_vector< T, A > Class Template Reference
- -[Containers] -

Concurrent vector container. -More... -

-#include <concurrent_vector.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef internal::concurrent_vector_base_v3::size_type size_type
-typedef internal::allocator_base<
- T, A >::allocator_type 
allocator_type
-typedef T value_type
-typedef ptrdiff_t difference_type
-typedef T & reference
-typedef const T & const_reference
-typedef T * pointer
-typedef const T * const_pointer
-typedef internal::vector_iterator<
- concurrent_vector, T > 
iterator
-typedef internal::vector_iterator<
- concurrent_vector, const
-T > 
const_iterator
-typedef std::reverse_iterator<
- iterator > 
reverse_iterator
-typedef std::reverse_iterator<
- const_iterator > 
const_reverse_iterator
-typedef std::reverse_iterator<
- iterator, T, T &, T * > 
reverse_iterator
-typedef std::reverse_iterator<
- const_iterator, T, const
-T &, const T * > 
const_reverse_iterator
-typedef generic_range_type<
- iterator > 
range_type
-typedef generic_range_type<
- const_iterator > 
const_range_type

Public Member Functions

concurrent_vector (const allocator_type &a=allocator_type())
 Construct empty vector.
concurrent_vector (const concurrent_vector &vector, const allocator_type &a=allocator_type())
 Copying constructor.
-template<class M>
 concurrent_vector (const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type())
 Copying constructor for vector with different allocator type.
concurrent_vector (size_type n)
 Construction with initial size specified by argument n.
concurrent_vector (size_type n, const_reference t, const allocator_type &a=allocator_type())
 Construction with initial size specified by argument n, initialization by copying of t, and given allocator instance.
-template<class I>
 concurrent_vector (I first, I last, const allocator_type &a=allocator_type())
 Construction with copying iteration range and given allocator instance.
-concurrent_vectoroperator= (const concurrent_vector &vector)
 Assignment.
-template<class M>
concurrent_vectoroperator= (const concurrent_vector< T, M > &vector)
 Assignment for vector with different allocator type.
size_type grow_by (size_type delta)
 Grow by "delta" elements.
size_type grow_by (size_type delta, const_reference t)
 Grow by "delta" elements using copying constuctor.
-void grow_to_at_least (size_type n)
 Grow array until it has at least n elements.
-size_type push_back (const_reference item)
 Push item.
reference operator[] (size_type index)
 Get reference to element at given index.
-const_reference operator[] (size_type index) const
 Get const reference to element at given index.
-reference at (size_type index)
 Get reference to element at given index.
-const_reference at (size_type index) const
 Get const reference to element at given index.
-range_type range (size_t grainsize=1)
 Get range for iterating with parallel algorithms.
-const_range_type range (size_t grainsize=1) const
 Get const range for iterating with parallel algorithms.
-size_type size () const
 Return size of vector.
-bool empty () const
 Return size of vector.
-size_type capacity () const
 Maximum size to which array can grow without allocating more memory.
void reserve (size_type n)
 Allocate enough space to grow to size n without having to allocate more memory later.
-void compact ()
 Optimize memory usage and fragmentation.
-size_type max_size () const
 Upper bound on argument to reserve.
-iterator begin ()
 start iterator
-iterator end ()
 end iterator
-const_iterator begin () const
 start const iterator
-const_iterator end () const
 end const iterator
-reverse_iterator rbegin ()
 reverse start iterator
-reverse_iterator rend ()
 reverse end iterator
-const_reverse_iterator rbegin () const
 reverse start const iterator
-const_reverse_iterator rend () const
 reverse end const iterator
-reference front ()
 the first item
-const_reference front () const
 the first item const
-reference back ()
 the last item
-const_reference back () const
 the last item const
-allocator_type get_allocator () const
 return allocator object
-void assign (size_type n, const_reference t)
 assign n items by copying t item
-template<class I>
void assign (I first, I last)
 assign range [first, last)
-void swap (concurrent_vector &vector)
 swap two instances
void clear ()
 Clear container while keeping memory allocated.
~concurrent_vector ()
 Clear and destroy vector.
-const internal::concurrent_vector_base_v3 & internal_vector_base () const

Friends

-class internal::vector_iterator

Classes

class  generic_range_type
class  internal_loop_guide
 Exception-aware helper class for filling a segment by exception-danger operators of user class.
-


Detailed Description

-

template<typename T, class A>
- class tbb::concurrent_vector< T, A >

- -Concurrent vector container. -

-concurrent_vector is a container having the following main properties:

    -
  • It provides random indexed access to its elements. The index of the first element is 0.
  • It ensures safe concurrent growing its size (different threads can safely append new elements).
  • Adding new elements does not invalidate existing iterators and does not change indices of existing items.
-

-

Compatibility
The class meets all Container Requirements and Reversible Container Requirements from C++ Standard (See ISO/IEC 14882:2003(E), clause 23.1). But it doesn't meet Sequence Requirements due to absence of insert() and erase() methods.
-
Exception Safety
Methods working with memory allocation and/or new elements construction can throw an exception if allocator fails to allocate memory or element's default constructor throws one. Concurrent vector's element of type T must conform to the following requirements:
    -
  • Throwing an exception is forbidden for destructor of T.
  • Default constructor of T must not throw an exception OR its non-virtual destructor must safely work when its object memory is zero-initialized.
-Otherwise, the program's behavior is undefined.
-
If an exception happens inside growth or assignment operation, an instance of the vector becomes invalid unless it is stated otherwise in the method documentation. Invalid state means:
    -
  • There are no guaranties that all items were initialized by a constructor. The rest of items is zero-filled, including item where exception happens.
  • An invalid vector instance cannot be repaired; it is unable to grow anymore.
  • Size and capacity reported by the vector are incorrect, and calculated as if the failed operation were successful.
  • Attempt to access not allocated elements using operator[] or iterators results in access violation or segmentation fault exception, and in case of using at() method a C++ exception is thrown.
-If a concurrent grow operation successfully completes, all the elements it has added to the vector will remain valid and accessible even if one of subsequent grow operations fails.
-
Fragmentation
Unlike an STL vector, a concurrent_vector does not move existing elements if it needs to allocate more memory. The container is divided into a series of contiguous arrays of elements. The first reservation, growth, or assignment operation determines the size of the first array. Using small number of elements as initial size incurs fragmentation that may increase element access time. Internal layout can be optimized by method compact() that merges several smaller arrays into one solid.
-
Changes since TBB 2.0
    -
  • Implemented exception-safety guaranties
  • Added template argument for allocator
  • Added allocator argument in constructors
  • Faster index calculation
  • First growth call specifies a number of segments to be merged in the first allocation.
  • Fixed memory blow up for swarm of vector's instances of small size
  • Added grow_by(size_type n, const_reference t) growth using copying constructor to init new items.
  • Added STL-like constructors.
  • Added operators ==, < and derivatives
  • Added at() method, approved for using after an exception was thrown inside the vector
  • Added get_allocator() method.
  • Added assign() methods
  • Added compact() method to defragment first segments
  • Added swap() method
  • range() defaults on grainsize = 1 supporting auto grainsize algorithms.
-
- -

-


Member Function Documentation

- -
-
-
-template<typename T, class A>
- - - - - - - - -
void tbb::concurrent_vector< T, A >::clear (  )  [inline]
-
-
- -

-Clear container while keeping memory allocated. -

-To free up the memory, use in conjunction with method compact(). Not thread safe -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - - - - - - - - - - - -
size_type tbb::concurrent_vector< T, A >::grow_by (size_type  delta,
const_reference  t 
) [inline]
-
-
- -

-Grow by "delta" elements using copying constuctor. -

-Returns old size. -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - - -
size_type tbb::concurrent_vector< T, A >::grow_by (size_type  delta  )  [inline]
-
-
- -

-Grow by "delta" elements. -

-Returns old size. -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - - -
reference tbb::concurrent_vector< T, A >::operator[] (size_type  index  )  [inline]
-
-
- -

-Get reference to element at given index. -

-This method is thread-safe for concurrent reads, and also while growing the vector, as long as the calling thread has checked that index<size(). -

-

- -

-
-
-template<typename T, class A>
- - - - - - - - - -
void tbb::concurrent_vector< T, A >::reserve (size_type  n  )  [inline]
-
-
- -

-Allocate enough space to grow to size n without having to allocate more memory later. -

-Like most of the methods provided for STL compatibility, this method is *not* thread safe. The capacity afterwards may be bigger than the requested reservation. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00113.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00113.html deleted file mode 100644 index 7aea52e031..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00113.html +++ /dev/null @@ -1,51 +0,0 @@ - - -tbb::empty_task Class Reference - - - - - - - -

tbb::empty_task Class Reference
- -[Task Scheduling] -

task that does nothing. Useful for synchronization. -More... -

-#include <task.h> -

-Inherits tbb::task. -

-Inheritance diagram for tbb::empty_task:

[legend]
List of all members. - -
-

Detailed Description

-task that does nothing. Useful for synchronization. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00114.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00114.html deleted file mode 100644 index 5b1c1612f6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00114.html +++ /dev/null @@ -1,150 +0,0 @@ - - -tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > Class Template Reference - - - - - - - -

tbb::enumerable_thread_specific< T, Allocator, ETS_key_type > Class Template Reference

The thread local class template. -More... -

-#include <enumerable_thread_specific.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef Allocator allocator_type
 Basic types.
-typedef T value_type
-typedef T & reference
-typedef const T & const_reference
-typedef T * pointer
-typedef internal_collection_type::size_type size_type
-typedef internal_collection_type::difference_type difference_type
-typedef internal::enumerable_thread_specific_iterator<
- internal_collection_type,
- value_type > 
iterator
-typedef internal::enumerable_thread_specific_iterator<
- internal_collection_type,
- const value_type > 
const_iterator
-typedef generic_range_type<
- iterator > 
range_type
-typedef generic_range_type<
- const_iterator > 
const_range_type

Public Member Functions

enumerable_thread_specific ()
 Default constructor, which leads to default construction of local copies.
enumerable_thread_specific (const T &_exemplar)
 Constuction with exemplar, which leads to copy construction of local copies.
~enumerable_thread_specific ()
 Destructor.
-reference local ()
 Returns reference to calling thread's local copy, creating one if necessary.
-size_type size () const
 Get the number of local copies.
-bool empty () const
 true if there have been no local copies created
-iterator begin ()
 begin iterator
-iterator end ()
 end iterator
-const_iterator begin () const
 begin const iterator
-const_iterator end () const
 end const iterator
-range_type range (size_t grainsize=1)
 Get range for parallel algorithms.
-const_range_type range (size_t grainsize=1) const
 Get const range for parallel algorithms.
-void clear ()
 Destroys local copies.

Classes

class  generic_range_type
 A generic range, used to create range objects from the iterators.
struct  padded_element
 The padded elements; padded to avoid false sharing.
-


Detailed Description

-

template<typename T, typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_single_key>
- class tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >

- -The thread local class template. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00115.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00115.html deleted file mode 100644 index 1cabb9c8f5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00115.html +++ /dev/null @@ -1,194 +0,0 @@ - - -tbb::filter Class Reference - - - - - - - -

tbb::filter Class Reference
- -[Algorithms] -

A stage in a pipeline. -More... -

-#include <pipeline.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

 parallel = current_version | filter_is_out_of_order
 processes multiple items in parallel and in no particular order
 serial_in_order = current_version | filter_is_serial
 processes items one at a time; all such filters process items in the same order
 serial_out_of_order = current_version | filter_is_serial | filter_is_out_of_order
 processes items one at a time and in no particular order
 serial = serial_in_order
enum  mode { parallel = current_version | filter_is_out_of_order, -serial_in_order = current_version | filter_is_serial, -serial_out_of_order = current_version | filter_is_serial | filter_is_out_of_order, -serial = serial_in_order - }

Public Member Functions

-bool is_serial () const
 True if filter is serial.
-bool is_ordered () const
virtual void * operator() (void *item)=0
 Operate on an item from the input stream, and return item for output stream.
virtual __TBB_EXPORTED_METHOD ~filter ()
 Destroy filter.
virtual void finalize (void *)
 Destroys item if pipeline is cancelled.

Protected Member Functions

filter (bool is_serial_)
filter (mode filter_mode)

Friends

-class internal::stage_task
-class pipeline
-


Detailed Description

-A stage in a pipeline. -

-


Member Enumeration Documentation

- -
-
- - - - -
enum tbb::filter::mode
-
-
- -

-

Enumerator:
- - - - - -
parallel  -processes multiple items in parallel and in no particular order
serial_in_order  -processes items one at a time; all such filters process items in the same order
serial_out_of_order  -processes items one at a time and in no particular order
serial  -
Deprecated:
use serial_in_order instead
-
-
- -
-

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - -
virtual __TBB_EXPORTED_METHOD tbb::filter::~filter (  )  [virtual]
-
-
- -

-Destroy filter. -

-If the filter was added to a pipeline, the pipeline must be destroyed first. -

-

-


Member Function Documentation

- -
-
- - - - - - - - - -
virtual void tbb::filter::finalize (void *   )  [inline, virtual]
-
-
- -

-Destroys item if pipeline is cancelled. -

-Required to prevent memory leaks Note it can be called concurrently even for serial filters. -

-

- -

-
- - - - - - - - - -
virtual void* tbb::filter::operator() (void *  item  )  [pure virtual]
-
-
- -

-Operate on an item from the input stream, and return item for output stream. -

-Returns NULL if filter is a sink. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00116.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00116.html deleted file mode 100644 index 90887ee6b9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00116.html +++ /dev/null @@ -1,53 +0,0 @@ - - -tbb::final_scan_tag Struct Reference - - - - - - - -

tbb::final_scan_tag Struct Reference
- -[Algorithms] -

Used to indicate that the final scan is being performed. -More... -

-#include <parallel_scan.h> -

-List of all members. - - - - -

Static Public Member Functions

-static bool is_final_scan ()
-


Detailed Description

-Used to indicate that the final scan is being performed. -

-


The documentation for this struct was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00117.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00117.html deleted file mode 100644 index aea37ff8d7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00117.html +++ /dev/null @@ -1,168 +0,0 @@ - - -tbb::movable_exception< ExceptionData > Class Template Reference - - - - - - - -

tbb::movable_exception< ExceptionData > Class Template Reference

Template that can be used to implement exception that transfers arbitrary ExceptionData to the root thread. -More... -

-#include <tbb_exception.h> -

-Inherits tbb::tbb_exception. -

-Inheritance diagram for tbb::movable_exception< ExceptionData >:

[legend]
List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

movable_exception (const ExceptionData &data)
movable_exception (const movable_exception &src) throw ()
-const movable_exceptionoperator= (const movable_exception &src)
-ExceptionData & data () throw ()
-const ExceptionData & data () const throw ()
-const char * name () const throw ()
 Returns RTTI name of the originally intercepted exception.
-const char * what () const throw ()
 Returns the result of originally intercepted exception's what() method.
movable_exceptionmove () throw ()
 Creates and returns pointer to the deep copy of this exception object.
void destroy () throw ()
 Destroys objects created by the move() method.
void throw_self ()
 Throws this exception object.

Protected Attributes

-ExceptionData my_exception_data
 User data.
-

Detailed Description

-

template<typename ExceptionData>
- class tbb::movable_exception< ExceptionData >

- -Template that can be used to implement exception that transfers arbitrary ExceptionData to the root thread. -

-Code using TBB can instantiate this template with an arbitrary ExceptionData type and throw this exception object. Such exceptions are intercepted by the TBB scheduler and delivered to the root thread ().

See also:
tbb::tbb_exception
- -

-


Member Function Documentation

- -
-
-
-template<typename ExceptionData>
- - - - - - - - -
void tbb::movable_exception< ExceptionData >::destroy (  )  throw () [inline, virtual]
-
-
- -

-Destroys objects created by the move() method. -

-Frees memory and calls destructor for this exception object. Can and must be used only on objects created by the move method. -

-Implements tbb::tbb_exception. -

-

- -

-
-
-template<typename ExceptionData>
- - - - - - - - -
movable_exception* tbb::movable_exception< ExceptionData >::move (  )  throw () [inline, virtual]
-
-
- -

-Creates and returns pointer to the deep copy of this exception object. -

-Move semantics is allowed. -

-Implements tbb::tbb_exception. -

-

- -

-
-
-template<typename ExceptionData>
- - - - - - - - -
void tbb::movable_exception< ExceptionData >::throw_self (  )  [inline, virtual]
-
-
- -

-Throws this exception object. -

-Make sure that if you have several levels of derivation from this interface you implement or override this method on the most derived level. The implementation is as simple as "throw *this;". Failure to do this will result in exception of a base class type being thrown. -

-Implements tbb::tbb_exception. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00118.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00118.html deleted file mode 100644 index 3c13b935be..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00118.html +++ /dev/null @@ -1,74 +0,0 @@ - - -tbb::mutex Class Reference - - - - - - - -

tbb::mutex Class Reference
- -[Synchronization] -

Wrapper around the platform's native reader-writer lock. -More... -

-#include <mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - -

Public Member Functions

mutex ()
 Construct unacquired mutex.

Static Public Attributes

-static const bool is_rw_mutex = false
-static const bool is_recursive_mutex = false
-static const bool is_fair_mutex = false

Friends

-class scoped_lock

Classes

class  scoped_lock
 The scoped locking pattern. More...
-


Detailed Description

-Wrapper around the platform's native reader-writer lock. -

-For testing purposes only. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00119.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00119.html deleted file mode 100644 index 85504ea824..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00119.html +++ /dev/null @@ -1,95 +0,0 @@ - - -tbb::mutex::scoped_lock Class Reference - - - - - - - -

tbb::mutex::scoped_lock Class Reference

The scoped locking pattern. -More... -

-#include <mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

scoped_lock ()
 Construct lock that has not acquired a mutex.
 scoped_lock (mutex &mutex)
 Acquire lock on given mutex.
~scoped_lock ()
 Release lock (if lock is held).
-void acquire (mutex &mutex)
 Acquire lock on given mutex.
-bool try_acquire (mutex &mutex)
 Try acquire lock on given mutex.
-void release ()
 Release lock.
-


Detailed Description

-The scoped locking pattern. -

-It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - - -
tbb::mutex::scoped_lock::scoped_lock (mutex mutex  )  [inline]
-
-
- -

-Acquire lock on given mutex. -

-Upon entry, *this should not be in the "have acquired a mutex" state. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00120.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00120.html deleted file mode 100644 index 8b99c864a7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00120.html +++ /dev/null @@ -1,65 +0,0 @@ - - -tbb::parallel_do_feeder< Item > Class Template Reference - - - - - - - -

tbb::parallel_do_feeder< Item > Class Template Reference

Class the user supplied algorithm body uses to add new tasks. -More... -

-#include <parallel_do.h> -

-List of all members. - - - - - - - - -

Public Member Functions

-void add (const Item &item)
 Add a work item to a running parallel_do.

Friends

-class internal::parallel_do_feeder_impl
-


Detailed Description

-

template<typename Item>
- class tbb::parallel_do_feeder< Item >

- -Class the user supplied algorithm body uses to add new tasks. -

-

Parameters:
- - -
Item Work item type
-
- -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00121.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00121.html deleted file mode 100644 index 6d02336c4e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00121.html +++ /dev/null @@ -1,140 +0,0 @@ - - -tbb::parallel_while< Body > Class Template Reference - - - - - - - -

tbb::parallel_while< Body > Class Template Reference
- -[Algorithms] -

Parallel iteration over a stream, with optional addition of more work. -More... -

-#include <parallel_while.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef Body::argument_type value_type
 Type of items.

Public Member Functions

parallel_while ()
 Construct empty non-running parallel while.
~parallel_while ()
 Destructor cleans up data members before returning.
template<typename Stream>
void run (Stream &stream, const Body &body)
 Apply body.apply to each item in the stream.
void add (const value_type &item)
 Add a work item while running.
-


Detailed Description

-

template<typename Body>
- class tbb::parallel_while< Body >

- -Parallel iteration over a stream, with optional addition of more work. -

-The Body b has the requirement:
- "b(v)"
- "b.argument_type"
- where v is an argument_type -

-


Member Function Documentation

- -
-
-
-template<typename Body>
- - - - - - - - - -
void tbb::parallel_while< Body >::add (const value_type item  ) 
-
-
- -

-Add a work item while running. -

-Should be executed only by body.apply or a thread spawned therefrom. -

-

- -

-
-
-template<typename Body>
-
-template<typename Stream>
- - - - - - - - - - - - - - - - - - -
void tbb::parallel_while< Body >::run (Stream &  stream,
const Body &  body 
)
-
-
- -

-Apply body.apply to each item in the stream. -

-A Stream s has the requirements
- "S::value_type"
- "s.pop_if_present(value) is convertible to bool -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00122.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00122.html deleted file mode 100644 index 50473260e5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00122.html +++ /dev/null @@ -1,99 +0,0 @@ - - -tbb::pipeline Class Reference - - - - - - - -

tbb::pipeline Class Reference
- -[Algorithms] -

A processing pipeling that applies filters to items. -More... -

-#include <pipeline.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

-__TBB_EXPORTED_METHOD pipeline ()
 Construct empty pipeline.
virtual __TBB_EXPORTED_METHOD ~pipeline ()
-void __TBB_EXPORTED_METHOD add_filter (filter &filter_)
 Add filter to end of pipeline.
-void __TBB_EXPORTED_METHOD run (size_t max_number_of_live_tokens)
 Run the pipeline to completion.
-void __TBB_EXPORTED_METHOD run (size_t max_number_of_live_tokens, tbb::task_group_context &context)
 Run the pipeline to completion with user-supplied context.
-void __TBB_EXPORTED_METHOD clear ()
 Remove all filters from the pipeline.

Friends

-class internal::stage_task
-class filter
-


Detailed Description

-A processing pipeling that applies filters to items. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - -
virtual __TBB_EXPORTED_METHOD tbb::pipeline::~pipeline (  )  [virtual]
-
-
- -

-Though the current implementation declares the destructor virtual, do not rely on this detail. The virtualness is deprecated and may disappear in future versions of TBB. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00123.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00123.html deleted file mode 100644 index a6db630475..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00123.html +++ /dev/null @@ -1,53 +0,0 @@ - - -tbb::pre_scan_tag Struct Reference - - - - - - - -

tbb::pre_scan_tag Struct Reference
- -[Algorithms] -

Used to indicate that the initial scan is being performed. -More... -

-#include <parallel_scan.h> -

-List of all members. - - - - -

Static Public Member Functions

-static bool is_final_scan ()
-


Detailed Description

-Used to indicate that the initial scan is being performed. -

-


The documentation for this struct was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00124.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00124.html deleted file mode 100644 index 1c3954398d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00124.html +++ /dev/null @@ -1,75 +0,0 @@ - - -tbb::queuing_mutex Class Reference - - - - - - - -

tbb::queuing_mutex Class Reference
- -[Synchronization] -

Queuing lock with local-only spinning. -More... -

-#include <queuing_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

queuing_mutex ()
 Construct unacquired mutex.
-void __TBB_EXPORTED_METHOD internal_construct ()

Static Public Attributes

-static const bool is_rw_mutex = false
-static const bool is_recursive_mutex = false
-static const bool is_fair_mutex = true

Friends

-class scoped_lock

Classes

class  scoped_lock
 The scoped locking pattern. More...
-


Detailed Description

-Queuing lock with local-only spinning. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00125.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00125.html deleted file mode 100644 index e1826ef9d2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00125.html +++ /dev/null @@ -1,115 +0,0 @@ - - -tbb::queuing_mutex::scoped_lock Class Reference - - - - - - - -

tbb::queuing_mutex::scoped_lock Class Reference

The scoped locking pattern. -More... -

-#include <queuing_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

 scoped_lock ()
 Construct lock that has not acquired a mutex.
 scoped_lock (queuing_mutex &m)
 Acquire lock on given mutex.
~scoped_lock ()
 Release lock (if lock is held).
-void __TBB_EXPORTED_METHOD acquire (queuing_mutex &m)
 Acquire lock on given mutex.
-bool __TBB_EXPORTED_METHOD try_acquire (queuing_mutex &m)
 Acquire lock on given mutex if free (i.e. non-blocking).
-void __TBB_EXPORTED_METHOD release ()
 Release lock.
-


Detailed Description

-The scoped locking pattern. -

-It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - -
tbb::queuing_mutex::scoped_lock::scoped_lock (  )  [inline]
-
-
- -

-Construct lock that has not acquired a mutex. -

-Equivalent to zero-initialization of *this. -

-

- -

-
- - - - - - - - - -
tbb::queuing_mutex::scoped_lock::scoped_lock (queuing_mutex m  )  [inline]
-
-
- -

-Acquire lock on given mutex. -

-Upon entry, *this should not be in the "have acquired a mutex" state. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00126.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00126.html deleted file mode 100644 index b2bfabb8e0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00126.html +++ /dev/null @@ -1,81 +0,0 @@ - - -tbb::queuing_rw_mutex Class Reference - - - - - - - -

tbb::queuing_rw_mutex Class Reference
- -[Synchronization] -

Reader-writer lock with local-only spinning. -More... -

-#include <queuing_rw_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

queuing_rw_mutex ()
 Construct unacquired mutex.
~queuing_rw_mutex ()
 Destructor asserts if the mutex is acquired, i.e. q_tail is non-NULL.
-void __TBB_EXPORTED_METHOD internal_construct ()

Static Public Attributes

-static const bool is_rw_mutex = true
-static const bool is_recursive_mutex = false
-static const bool is_fair_mutex = true

Friends

-class scoped_lock

Classes

class  scoped_lock
 The scoped locking pattern. More...
-


Detailed Description

-Reader-writer lock with local-only spinning. -

-Adapted from Krieger, Stumm, et al. pseudocode at http://www.eecg.toronto.edu/parallel/pubs_abs.html#Krieger_etal_ICPP93 -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00127.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00127.html deleted file mode 100644 index 5d54b1c201..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00127.html +++ /dev/null @@ -1,153 +0,0 @@ - - -tbb::queuing_rw_mutex::scoped_lock Class Reference - - - - - - - -

tbb::queuing_rw_mutex::scoped_lock Class Reference

The scoped locking pattern. -More... -

-#include <queuing_rw_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

 scoped_lock ()
 Construct lock that has not acquired a mutex.
 scoped_lock (queuing_rw_mutex &m, bool write=true)
 Acquire lock on given mutex.
~scoped_lock ()
 Release lock (if lock is held).
-void acquire (queuing_rw_mutex &m, bool write=true)
 Acquire lock on given mutex.
-bool try_acquire (queuing_rw_mutex &m, bool write=true)
 Try acquire lock on given mutex.
-void release ()
 Release lock.
bool upgrade_to_writer ()
 Upgrade reader to become a writer.
-bool downgrade_to_reader ()
 Downgrade writer to become a reader.
-


Detailed Description

-The scoped locking pattern. -

-It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - -
tbb::queuing_rw_mutex::scoped_lock::scoped_lock (  )  [inline]
-
-
- -

-Construct lock that has not acquired a mutex. -

-Equivalent to zero-initialization of *this. -

-

- -

-
- - - - - - - - - - - - - - - - - - -
tbb::queuing_rw_mutex::scoped_lock::scoped_lock (queuing_rw_mutex m,
bool  write = true 
) [inline]
-
-
- -

-Acquire lock on given mutex. -

-Upon entry, *this should not be in the "have acquired a mutex" state. -

-

-


Member Function Documentation

- -
-
- - - - - - - - -
bool tbb::queuing_rw_mutex::scoped_lock::upgrade_to_writer (  ) 
-
-
- -

-Upgrade reader to become a writer. -

-Returns true if the upgrade happened without re-acquiring the lock and false if opposite -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00128.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00128.html deleted file mode 100644 index 268db85d0d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00128.html +++ /dev/null @@ -1,74 +0,0 @@ - - -tbb::recursive_mutex Class Reference - - - - - - - -

tbb::recursive_mutex Class Reference
- -[Synchronization] -

Mutex that allows recursive mutex acquisition. -More... -

-#include <recursive_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - -

Public Member Functions

recursive_mutex ()
 Construct unacquired recursive_mutex.

Static Public Attributes

-static const bool is_rw_mutex = false
-static const bool is_recursive_mutex = true
-static const bool is_fair_mutex = false

Friends

-class scoped_lock

Classes

class  scoped_lock
 The scoped locking pattern. More...
-


Detailed Description

-Mutex that allows recursive mutex acquisition. -

-Mutex that allows recursive mutex acquisition. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00129.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00129.html deleted file mode 100644 index 1e6932f1c1..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00129.html +++ /dev/null @@ -1,95 +0,0 @@ - - -tbb::recursive_mutex::scoped_lock Class Reference - - - - - - - -

tbb::recursive_mutex::scoped_lock Class Reference

The scoped locking pattern. -More... -

-#include <recursive_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

scoped_lock ()
 Construct lock that has not acquired a recursive_mutex.
 scoped_lock (recursive_mutex &mutex)
 Acquire lock on given mutex.
~scoped_lock ()
 Release lock (if lock is held).
-void acquire (recursive_mutex &mutex)
 Acquire lock on given mutex.
-bool try_acquire (recursive_mutex &mutex)
 Try acquire lock on given recursive_mutex.
-void release ()
 Release lock.
-


Detailed Description

-The scoped locking pattern. -

-It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - - -
tbb::recursive_mutex::scoped_lock::scoped_lock (recursive_mutex mutex  )  [inline]
-
-
- -

-Acquire lock on given mutex. -

-Upon entry, *this should not be in the "have acquired a mutex" state. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00130.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00130.html deleted file mode 100644 index ee49a21e0d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00130.html +++ /dev/null @@ -1,112 +0,0 @@ - - -tbb::scalable_allocator< T > Class Template Reference - - - - - - - -

tbb::scalable_allocator< T > Class Template Reference
- -[Memory Allocation] -

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. -More... -

-#include <scalable_allocator.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef internal::allocator_type<
- T >::value_type 
value_type
-typedef value_type * pointer
-typedef const value_type * const_pointer
-typedef value_type & reference
-typedef const value_type & const_reference
-typedef size_t size_type
-typedef ptrdiff_t difference_type

Public Member Functions

scalable_allocator (const scalable_allocator &) throw ()
-template<typename U>
 scalable_allocator (const scalable_allocator< U > &) throw ()
-pointer address (reference x) const
-const_pointer address (const_reference x) const
-pointer allocate (size_type n, const void *=0)
 Allocate space for n objects.
-void deallocate (pointer p, size_type)
 Free previously allocated block of memory.
-size_type max_size () const throw ()
 Largest value for which method allocate might succeed.
-void construct (pointer p, const value_type &val)
-void destroy (pointer p)

Classes

struct  rebind
-


Detailed Description

-

template<typename T>
- class tbb::scalable_allocator< T >

- -Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. -

-The members are ordered the same way they are in section 20.4.1 of the ISO C++ standard. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00131.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00131.html deleted file mode 100644 index bfa1364947..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00131.html +++ /dev/null @@ -1,65 +0,0 @@ - - -tbb::scalable_allocator< void > Class Template Reference - - - - - - - -

tbb::scalable_allocator< void > Class Template Reference
- -[Memory Allocation] -

Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. -More... -

-#include <scalable_allocator.h> -

-List of all members. - - - - - - - - - - - -

Public Types

-typedef void * pointer
-typedef const void * const_pointer
-typedef void value_type

Classes

struct  rebind
-


Detailed Description

-

template<>
- class tbb::scalable_allocator< void >

- -Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00132.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00132.html deleted file mode 100644 index 65165e8e19..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00132.html +++ /dev/null @@ -1,64 +0,0 @@ - - -tbb::simple_partitioner Class Reference - - - - - - - -

tbb::simple_partitioner Class Reference
- -[Algorithms] -

A simple partitioner. -More... -

-#include <partitioner.h> -

-List of all members. - - - - - - - - - - - -

Friends

-class internal::start_for
-class internal::start_reduce
-class internal::start_scan

Classes

class  partition_type
-


Detailed Description

-A simple partitioner. -

-Divides the range until the range is not divisible. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00133.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00133.html deleted file mode 100644 index fca94521d4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00133.html +++ /dev/null @@ -1,98 +0,0 @@ - - -tbb::spin_mutex Class Reference - - - - - - - -

tbb::spin_mutex Class Reference
- -[Synchronization] -

A lock that occupies a single byte. -More... -

-#include <spin_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

 spin_mutex ()
 Construct unacquired lock.
-void __TBB_EXPORTED_METHOD internal_construct ()

Static Public Attributes

-static const bool is_rw_mutex = false
-static const bool is_recursive_mutex = false
-static const bool is_fair_mutex = false

Friends

-class scoped_lock

Classes

class  scoped_lock
 Represents acquisition of a mutex. More...
-


Detailed Description

-A lock that occupies a single byte. -

-A spin_mutex is a spin mutex that fits in a single byte. It should be used only for locking short critical sections (typically <20 instructions) when fairness is not an issue. If zero-initialized, the mutex is considered unheld. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - -
tbb::spin_mutex::spin_mutex (  )  [inline]
-
-
- -

-Construct unacquired lock. -

-Equivalent to zero-initialization of *this. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00134.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00134.html deleted file mode 100644 index 3a221272dd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00134.html +++ /dev/null @@ -1,71 +0,0 @@ - - -tbb::spin_mutex::scoped_lock Class Reference - - - - - - - -

tbb::spin_mutex::scoped_lock Class Reference

Represents acquisition of a mutex. -More... -

-#include <spin_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

scoped_lock ()
 Construct without acquiring a mutex.
scoped_lock (spin_mutex &m)
 Construct and acquire lock on a mutex.
-void acquire (spin_mutex &m)
 Acquire lock.
-bool try_acquire (spin_mutex &m)
 Try acquiring lock (non-blocking).
-void release ()
 Release lock.
~scoped_lock ()
 Destroy lock. If holding a lock, releases the lock first.
-


Detailed Description

-Represents acquisition of a mutex. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00135.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00135.html deleted file mode 100644 index 2864e62bc1..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00135.html +++ /dev/null @@ -1,72 +0,0 @@ - - -tbb::spin_rw_mutex_v3 Class Reference - - - - - - - -

tbb::spin_rw_mutex_v3 Class Reference
- -[Synchronization] -

Fast, unfair, spinning reader-writer lock with backoff and writer-preference. -More... -

-#include <spin_rw_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - -

Public Member Functions

spin_rw_mutex_v3 ()
 Construct unacquired mutex.
~spin_rw_mutex_v3 ()
 Destructor asserts if the mutex is acquired, i.e. state is zero.

Static Public Attributes

-static const bool is_rw_mutex = true
-static const bool is_recursive_mutex = false
-static const bool is_fair_mutex = false

Classes

class  scoped_lock
 The scoped locking pattern. More...
-


Detailed Description

-Fast, unfair, spinning reader-writer lock with backoff and writer-preference. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00136.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00136.html deleted file mode 100644 index 9c276abe5d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00136.html +++ /dev/null @@ -1,153 +0,0 @@ - - -tbb::spin_rw_mutex_v3::scoped_lock Class Reference - - - - - - - -

tbb::spin_rw_mutex_v3::scoped_lock Class Reference

The scoped locking pattern. -More... -

-#include <spin_rw_mutex.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

 scoped_lock ()
 Construct lock that has not acquired a mutex.
 scoped_lock (spin_rw_mutex &m, bool write=true)
 Acquire lock on given mutex.
~scoped_lock ()
 Release lock (if lock is held).
-void acquire (spin_rw_mutex &m, bool write=true)
 Acquire lock on given mutex.
bool upgrade_to_writer ()
 Upgrade reader to become a writer.
-void release ()
 Release lock.
-bool downgrade_to_reader ()
 Downgrade writer to become a reader.
-bool try_acquire (spin_rw_mutex &m, bool write=true)
 Try acquire lock on given mutex.
-


Detailed Description

-The scoped locking pattern. -

-It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - -
tbb::spin_rw_mutex_v3::scoped_lock::scoped_lock (  )  [inline]
-
-
- -

-Construct lock that has not acquired a mutex. -

-Equivalent to zero-initialization of *this. -

-

- -

-
- - - - - - - - - - - - - - - - - - -
tbb::spin_rw_mutex_v3::scoped_lock::scoped_lock (spin_rw_mutex m,
bool  write = true 
) [inline]
-
-
- -

-Acquire lock on given mutex. -

-Upon entry, *this should not be in the "have acquired a mutex" state. -

-

-


Member Function Documentation

- -
-
- - - - - - - - -
bool tbb::spin_rw_mutex_v3::scoped_lock::upgrade_to_writer (  )  [inline]
-
-
- -

-Upgrade reader to become a writer. -

-Returns true if the upgrade happened without re-acquiring the lock and false if opposite -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00137.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00137.html deleted file mode 100644 index e8a367ab0b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00137.html +++ /dev/null @@ -1,51 +0,0 @@ - - -tbb::split Class Reference - - - - - - - -

tbb::split Class Reference
- -[Algorithms] -

Dummy type that distinguishes splitting constructor from copy constructor. -More... -

-#include <tbb_stddef.h> -

- - -
-


Detailed Description

-Dummy type that distinguishes splitting constructor from copy constructor. -

-See description of parallel_for and parallel_reduce for example usages. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00138.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00138.html deleted file mode 100644 index 0ca91fe9cc..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00138.html +++ /dev/null @@ -1,644 +0,0 @@ - - -tbb::task Class Reference - - - - - - - -

tbb::task Class Reference
- -[Task Scheduling] -

Base class for user-defined tasks. -More... -

-#include <task.h> -

-Inherited by tbb::empty_task. -

-Inheritance diagram for tbb::task:

[legend]
List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

typedef internal::intptr depth_type
 A scheduling depth.
typedef internal::affinity_id affinity_id
 An id as used for specifying affinity.
 executing
 task is running, and will be destroyed after method execute() completes.
 reexecute
 task to be rescheduled.
 ready
 task is in ready pool, or is going to be put there, or was just taken off.
 allocated
 task object is freshly allocated or recycled.
 freed
 task object is on free list, or is going to be put there, or was just taken off.
 recycle
 task to be recycled as continuation
enum  state_type {
-  executing, -reexecute, -ready, -allocated, -
-  freed, -recycle -
- }
 Enumeration of task states that the scheduler considers. More...

Public Member Functions

-virtual ~task ()
 Destructor.
-virtual taskexecute ()=0
 Should be overridden by derived classes.
internal::allocate_continuation_proxy & allocate_continuation ()
 Returns proxy for overloaded new that allocates a continuation task of *this.
-internal::allocate_child_proxy & allocate_child ()
 Returns proxy for overloaded new that allocates a child task of *this.
internal::allocate_additional_child_of_proxy allocate_additional_child_of (task &t)
 Like allocate_child, except that task's parent becomes "t", not this.
void __TBB_EXPORTED_METHOD destroy (task &victim)
 Destroy a task.
void recycle_as_continuation ()
 Change this to be a continuation of its former self.
void recycle_as_safe_continuation ()
 Recommended to use, safe variant of recycle_as_continuation.
-void recycle_as_child_of (task &new_parent)
 Change this to be a child of new_parent.
void recycle_to_reexecute ()
 Schedule this for reexecution after current execute() returns.
-intptr_t depth () const
-void set_depth (intptr_t)
-void add_to_depth (int)
-depth_type depth () const
 Scheduling depth.
void set_depth (depth_type new_depth)
 Set scheduling depth to given value.
void add_to_depth (int delta)
 Change scheduling depth by given amount.
-void set_ref_count (int count)
 Set reference count.
void spawn (task &child)
 Schedule task for execution when a worker becomes available.
void spawn (task_list &list)
 Spawn multiple tasks and clear list.
-void spawn_and_wait_for_all (task &child)
 Similar to spawn followed by wait_for_all, but more efficient.
-void __TBB_EXPORTED_METHOD spawn_and_wait_for_all (task_list &list)
 Similar to spawn followed by wait_for_all, but more efficient.
void wait_for_all ()
 Wait for reference count to become one, and set reference count to zero.
-taskparent () const
 task on whose behalf this task is working, or NULL if this is a root.
-bool is_stolen_task () const
 True if task is owned by different thread than thread that owns its parent.
-state_type state () const
 Current execution state.
-int ref_count () const
 The internal reference count.
-bool __TBB_EXPORTED_METHOD is_owned_by_current_thread () const
 True if this task is owned by the calling thread; false otherwise.
-void set_affinity (affinity_id id)
 Set affinity for this task.
-affinity_id affinity () const
 Current affinity of this task.
virtual void __TBB_EXPORTED_METHOD note_affinity (affinity_id id)
 Invoked by scheduler to notify task that it ran on unexpected thread.
bool cancel_group_execution ()
 Initiates cancellation of all tasks in this cancellation group and its subordinate groups.
-bool is_cancelled () const
 Returns true if the context received cancellation request.

Static Public Member Functions

-static internal::allocate_root_proxy allocate_root ()
 Returns proxy for overloaded new that allocates a root task.
-static internal::allocate_root_with_context_proxy allocate_root (task_group_context &ctx)
 Returns proxy for overloaded new that allocates a root task associated with user supplied context.
static void spawn_root_and_wait (task &root)
 Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.
static void spawn_root_and_wait (task_list &root_list)
 Spawn root tasks on list and wait for all of them to finish.
-static task &__TBB_EXPORTED_FUNC self ()
 The innermost task being executed or destroyed by the current thread at the moment.

Protected Member Functions

task ()
 Default constructor.

Friends

-class task_list
-class internal::scheduler
-class internal::allocate_root_proxy
-class internal::allocate_root_with_context_proxy
-class internal::allocate_continuation_proxy
-class internal::allocate_child_proxy
-class internal::allocate_additional_child_of_proxy
-

Detailed Description

-Base class for user-defined tasks. -

-


Member Typedef Documentation

- -
-
- - - - -
typedef internal::affinity_id tbb::task::affinity_id
-
-
- -

-An id as used for specifying affinity. -

-Guaranteed to be integral type. Value of 0 means no affinity. -

-

- -

-
- - - - -
typedef internal::intptr tbb::task::depth_type
-
-
- -

-A scheduling depth. -

-Guaranteed to be a signed integral type. -

-

-


Member Enumeration Documentation

- -
-
- - - - -
enum tbb::task::state_type
-
-
- -

-Enumeration of task states that the scheduler considers. -

-

Enumerator:
- - - - - - - -
executing  -task is running, and will be destroyed after method execute() completes.
reexecute  -task to be rescheduled.
ready  -task is in ready pool, or is going to be put there, or was just taken off.
allocated  -task object is freshly allocated or recycled.
freed  -task object is on free list, or is going to be put there, or was just taken off.
recycle  -task to be recycled as continuation
-
- -
-

-


Member Function Documentation

- -
-
- - - - - - - - - -
void tbb::task::add_to_depth (int  delta  )  [inline]
-
-
- -

-Change scheduling depth by given amount. -

-The resulting depth must be non-negative. -

-

- -

-
- - - - - - - - - -
internal::allocate_additional_child_of_proxy tbb::task::allocate_additional_child_of (task t  )  [inline]
-
-
- -

-Like allocate_child, except that task's parent becomes "t", not this. -

-Typically used in conjunction with schedule_to_reexecute to implement while loops. Atomically increments the reference count of t.parent() -

-

- -

-
- - - - - - - - -
internal::allocate_continuation_proxy& tbb::task::allocate_continuation (  )  [inline]
-
-
- -

-Returns proxy for overloaded new that allocates a continuation task of *this. -

-The continuation's parent becomes the parent of *this. -

-

- -

-
- - - - - - - - -
bool tbb::task::cancel_group_execution (  )  [inline]
-
-
- -

-Initiates cancellation of all tasks in this cancellation group and its subordinate groups. -

-

Returns:
false if cancellation has already been requested, true otherwise.
- -
-

- -

-
- - - - - - - - - -
void __TBB_EXPORTED_METHOD tbb::task::destroy (task victim  ) 
-
-
- -

-Destroy a task. -

-Usually, calling this method is unnecessary, because a task is implicitly deleted after its execute() method runs. However, sometimes a task needs to be explicitly deallocated, such as when a root task is used as the parent in spawn_and_wait_for_all. -

-

- -

-
- - - - - - - - - -
virtual void __TBB_EXPORTED_METHOD tbb::task::note_affinity (affinity_id  id  )  [virtual]
-
-
- -

-Invoked by scheduler to notify task that it ran on unexpected thread. -

-Invoked before method execute() runs, if task is stolen, or task has affinity but will be executed on another thread.

-The default action does nothing. -

-

- -

-
- - - - - - - - -
void tbb::task::recycle_as_continuation (  )  [inline]
-
-
- -

-Change this to be a continuation of its former self. -

-The caller must guarantee that the task's refcount does not become zero until after the method execute() returns. Typically, this is done by having method execute() return a pointer to a child of the task. If the guarantee cannot be made, use method recycle_as_safe_continuation instead.

-Because of the hazard, this method may be deprecated in the future. -

-

- -

-
- - - - - - - - -
void tbb::task::recycle_as_safe_continuation (  )  [inline]
-
-
- -

-Recommended to use, safe variant of recycle_as_continuation. -

-For safety, it requires additional increment of ref_count. -

-

- -

-
- - - - - - - - -
void tbb::task::recycle_to_reexecute (  )  [inline]
-
-
- -

-Schedule this for reexecution after current execute() returns. -

-Requires that this.execute() be running. -

-

- -

-
- - - - - - - - - -
void tbb::task::set_depth (depth_type  new_depth  )  [inline]
-
-
- -

-Set scheduling depth to given value. -

-The depth must be non-negative -

-

- -

-
- - - - - - - - - -
void tbb::task::spawn (task_list list  )  [inline]
-
-
- -

-Spawn multiple tasks and clear list. -

-All of the tasks must be at the same depth. -

-

- -

-
- - - - - - - - - -
void tbb::task::spawn (task child  )  [inline]
-
-
- -

-Schedule task for execution when a worker becomes available. -

-After all children spawned so far finish their method task::execute, their parent's method task::execute may start running. Therefore, it is important to ensure that at least one child has not completed until the parent is ready to run. -

-

- -

-
- - - - - - - - - -
void tbb::task::spawn_root_and_wait (task_list root_list  )  [inline, static]
-
-
- -

-Spawn root tasks on list and wait for all of them to finish. -

-If there are more tasks than worker threads, the tasks are spawned in order of front to back. -

-

- -

-
- - - - - - - - - -
static void tbb::task::spawn_root_and_wait (task root  )  [inline, static]
-
-
- -

-Spawn task allocated by allocate_root, wait for it to complete, and deallocate it. -

-The thread that calls spawn_root_and_wait must be the same thread that allocated the task. -

-

- -

-
- - - - - - - - -
void tbb::task::wait_for_all (  )  [inline]
-
-
- -

-Wait for reference count to become one, and set reference count to zero. -

-Works on tasks while waiting. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00139.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00139.html deleted file mode 100644 index f870f86cfc..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00139.html +++ /dev/null @@ -1,182 +0,0 @@ - - -tbb::task_group_context Class Reference - - - - - - - -

tbb::task_group_context Class Reference
- -[Task Scheduling] -

Used to form groups of tasks. -More... -

-#include <task.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

isolated
bound
enum  kind_type { isolated, -bound - }

Public Member Functions

 task_group_context (kind_type relation_with_parent=bound)
 Default & binding constructor.
void __TBB_EXPORTED_METHOD reset ()
 Forcefully reinitializes context object after an algorithm it was used with finished.
bool __TBB_EXPORTED_METHOD cancel_group_execution ()
 Initiates cancellation of all tasks in this cancellation group and its subordinate groups.
-bool __TBB_EXPORTED_METHOD is_group_execution_cancelled () const
 Returns true if the context received cancellation request.

Protected Member Functions

void __TBB_EXPORTED_METHOD init ()
 Out-of-line part of the constructor.

Friends

-class task
-class internal::allocate_root_with_context_proxy
-


Detailed Description

-Used to form groups of tasks. -

-The context services explicit cancellation requests from user code, and unhandled exceptions intercepted during tasks execution. Intercepting an exception results in generating internal cancellation requests (which is processed in exactly the same way as external ones).

-The context is associated with one or more root tasks and defines the cancellation group that includes all the descendants of the corresponding root task(s). Association is established when a context object is passed as an argument to the task::allocate_root() method. See task_group_context::task_group_context for more details.

-The context can be bound to another one, and other contexts can be bound to it, forming a tree-like structure: parent -> this -> children. Arrows here designate cancellation propagation direction. If a task in a cancellation group is canceled all the other tasks in this group and groups bound to it (as children) get canceled too. -

-


Constructor & Destructor Documentation

- -
-
- - - - - - - - - -
tbb::task_group_context::task_group_context (kind_type  relation_with_parent = bound  )  [inline]
-
-
- -

-Default & binding constructor. -

-By default a bound context is created. That is this context will be bound (as child) to the context of the task calling task::allocate_root(this_context) method. Cancellation requests passed to the parent context are propagated to all the contexts bound to it.

-If task_group_context::isolated is used as the argument, then the tasks associated with this context will never be affected by events in any other context.

-Creating isolated context is involves much less overhead, but they have limited utility. Normally when an exception occur in an algorithm that has nested algorithms running one would want all the nested ones canceled as well. Such behavior requires nested algorithms to use bound contexts.

-There is one good place where using isolated algorithms is beneficial. It is a master thread. That is if a particular algorithm is invoked directly from the master thread (not from a TBB task), supplying it with explicitly created isolated context will result in a faster algorithm startup. -

-

-


Member Function Documentation

- -
-
- - - - - - - - -
bool __TBB_EXPORTED_METHOD tbb::task_group_context::cancel_group_execution (  ) 
-
-
- -

-Initiates cancellation of all tasks in this cancellation group and its subordinate groups. -

-

Returns:
false if cancellation has already been requested, true otherwise.
-Note that canceling never fails. When false is returned, it just means that another thread (or this one) has already sent cancellation request to this context or to one of its ancestors (if this context is bound). It is guaranteed that when this method is called on the same context, true may be returned by at most one invocation. -
-

- -

-
- - - - - - - - -
void __TBB_EXPORTED_METHOD tbb::task_group_context::init (  )  [protected]
-
-
- -

-Out-of-line part of the constructor. -

-Separated to facilitate future support for backward binary compatibility. -

-

- -

-
- - - - - - - - -
void __TBB_EXPORTED_METHOD tbb::task_group_context::reset (  ) 
-
-
- -

-Forcefully reinitializes context object after an algorithm it was used with finished. -

-Because the method assumes that the all the tasks that used to be associated with this context have already finished, you must be extremely careful to not invalidate the context while it is still in use somewhere in the task hierarchy.

-IMPORTANT: It is assumed that this method is not used concurrently!

-The method does not change the context's parent if it is set. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00140.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00140.html deleted file mode 100644 index 31058bb4e6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00140.html +++ /dev/null @@ -1,80 +0,0 @@ - - -tbb::task_list Class Reference - - - - - - - -

tbb::task_list Class Reference
- -[Task Scheduling] -

A list of children. -More... -

-#include <task.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

task_list ()
 Construct empty list.
~task_list ()
 Destroys the list, but does not destroy the task objects.
-bool empty () const
 True if list if empty; false otherwise.
-void push_back (task &task)
 Push task onto back of list.
-taskpop_front ()
 Pop the front task from the list.
-void clear ()
 Clear the list.

Friends

-class task
-


Detailed Description

-A list of children. -

-Used for method task::spawn_children -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00141.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00141.html deleted file mode 100644 index 6b207e9092..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00141.html +++ /dev/null @@ -1,164 +0,0 @@ - - -tbb::task_scheduler_init Class Reference - - - - - - - -

tbb::task_scheduler_init Class Reference
- -[Task Scheduling] -

Class representing reference to tbb scheduler. -More... -

-#include <task_scheduler_init.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

void __TBB_EXPORTED_METHOD initialize (int number_of_threads=automatic)
 Ensure that scheduler exists for this thread.
void __TBB_EXPORTED_METHOD initialize (int number_of_threads, stack_size_type thread_stack_size)
 The overloaded method with stack size parameter.
-void __TBB_EXPORTED_METHOD terminate ()
 Inverse of method initialize.
task_scheduler_init (int number_of_threads=automatic, stack_size_type thread_stack_size=0)
 Shorthand for default constructor followed by call to intialize(number_of_threads).
~task_scheduler_init ()
 Destroy scheduler for this thread if thread has no other live task_scheduler_inits.
-bool is_active () const
 Returns true if scheduler is active (initialized); false otherwise.

Static Public Member Functions

static int __TBB_EXPORTED_FUNC default_num_threads ()
 Returns the number of threads tbb scheduler would create if initialized by default.

Static Public Attributes

-static const int automatic = -1
 Typedef for number of threads that is automatic.
-static const int deferred = -2
 Argument to initialize() or constructor that causes initialization to be deferred.
-


Detailed Description

-Class representing reference to tbb scheduler. -

-A thread must construct a task_scheduler_init, and keep it alive, during the time that it uses the services of class task. -

-


Member Function Documentation

- -
-
- - - - - - - - -
static int __TBB_EXPORTED_FUNC tbb::task_scheduler_init::default_num_threads (  )  [static]
-
-
- -

-Returns the number of threads tbb scheduler would create if initialized by default. -

-Result returned by this method does not depend on whether the scheduler has already been initialized.

-Because tbb 2.0 does not support blocking tasks yet, you may use this method to boost the number of threads in the tbb's internal pool, if your tasks are doing I/O operations. The optimal number of additional threads depends on how much time your tasks spend in the blocked state. -

-

- -

-
- - - - - - - - - - - - - - - - - - -
void __TBB_EXPORTED_METHOD tbb::task_scheduler_init::initialize (int  number_of_threads,
stack_size_type  thread_stack_size 
)
-
-
- -

-The overloaded method with stack size parameter. -

-Overloading is necessary to preserve ABI compatibility -

-

- -

-
- - - - - - - - - -
void __TBB_EXPORTED_METHOD tbb::task_scheduler_init::initialize (int  number_of_threads = automatic  ) 
-
-
- -

-Ensure that scheduler exists for this thread. -

-A value of -1 lets tbb decide on the number of threads, which is typically the number of hardware threads. For production code, the default value of -1 should be used, particularly if the client code is mixed with third party clients that might also use tbb.

-The number_of_threads is ignored if any other task_scheduler_inits currently exist. A thread may construct multiple task_scheduler_inits. Doing so does no harm because the underlying scheduler is reference counted. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00142.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00142.html deleted file mode 100644 index 13e746e311..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00142.html +++ /dev/null @@ -1,130 +0,0 @@ - - -tbb::tbb_allocator< T > Class Template Reference - - - - - - - -

tbb::tbb_allocator< T > Class Template Reference
- -[Memory Allocation] -

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. -More... -

-#include <tbb_allocator.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Types

-typedef internal::allocator_type<
- T >::value_type 
value_type
-typedef value_type * pointer
-typedef const value_type * const_pointer
-typedef value_type & reference
-typedef const value_type & const_reference
-typedef size_t size_type
-typedef ptrdiff_t difference_type
scalable
standard
enum  malloc_type { scalable, -standard - }
 Specifies current allocator.

Public Member Functions

tbb_allocator (const tbb_allocator &) throw ()
-template<typename U>
 tbb_allocator (const tbb_allocator< U > &) throw ()
-pointer address (reference x) const
-const_pointer address (const_reference x) const
-pointer allocate (size_type n, const void *=0)
 Allocate space for n objects.
-void deallocate (pointer p, size_type)
 Free previously allocated block of memory.
-size_type max_size () const throw ()
 Largest value for which method allocate might succeed.
-void construct (pointer p, const value_type &value)
 Copy-construct value at location pointed to by p.
-void destroy (pointer p)
 Destroy value at location pointed to by p.

Static Public Member Functions

-static malloc_type allocator_type ()
 Returns current allocator.

Classes

struct  rebind
-


Detailed Description

-

template<typename T>
- class tbb::tbb_allocator< T >

- -Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. -

-The class selects the best memory allocation mechanism available from scalable_malloc and standard malloc. The members are ordered the same way they are in section 20.4.1 of the ISO C++ standard. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00143.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00143.html deleted file mode 100644 index ce8ff4a557..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00143.html +++ /dev/null @@ -1,65 +0,0 @@ - - -tbb::tbb_allocator< void > Class Template Reference - - - - - - - -

tbb::tbb_allocator< void > Class Template Reference
- -[Memory Allocation] -

Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. -More... -

-#include <tbb_allocator.h> -

-List of all members. - - - - - - - - - - - -

Public Types

-typedef void * pointer
-typedef const void * const_pointer
-typedef void value_type

Classes

struct  rebind
-


Detailed Description

-

template<>
- class tbb::tbb_allocator< void >

- -Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00144.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00144.html deleted file mode 100644 index 9e52e90601..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00144.html +++ /dev/null @@ -1,141 +0,0 @@ - - -tbb::tbb_exception Class Reference - - - - - - - -

tbb::tbb_exception Class Reference

Interface to be implemented by all exceptions TBB recognizes and propagates across the threads. -More... -

-#include <tbb_exception.h> -

-Inherited by tbb::captured_exception, and tbb::movable_exception< ExceptionData >. -

-Inheritance diagram for tbb::tbb_exception:

[legend]
List of all members. - - - - - - - - - - - - - - - - - -

Public Member Functions

virtual tbb_exceptionmove ()=0 throw ()
 Creates and returns pointer to the deep copy of this exception object.
virtual void destroy ()=0 throw ()
 Destroys objects created by the move() method.
virtual void throw_self ()=0
 Throws this exception object.
-virtual const char * name () const =0 throw ()
 Returns RTTI name of the originally intercepted exception.
-virtual const char * what () const =0 throw ()
 Returns the result of originally intercepted exception's what() method.
-

Detailed Description

-Interface to be implemented by all exceptions TBB recognizes and propagates across the threads. -

-If an unhandled exception of the type derived from tbb::tbb_exception is intercepted by the TBB scheduler in one of the worker threads, it is delivered to and re-thrown in the root thread. The root thread is the thread that has started the outermost algorithm or root task sharing the same task_group_context with the guilty algorithm/task (the one that threw the exception first).

-Note: when documentation mentions workers with respect to exception handling, masters are implied as well, because they are completely equivalent in this context. Consequently a root thread can be master or worker thread.

-NOTE: In case of nested algorithms or complex task hierarchies when the nested levels share (explicitly or by means of implicit inheritance) the task group context of the outermost level, the exception may be (re-)thrown multiple times (ultimately - in each worker on each nesting level) before reaching the root thread at the outermost level. IMPORTANT: if you intercept an exception derived from this class on a nested level, you must re-throw it in the catch block by means of the "throw;" operator.

-TBB provides two implementations of this interface: tbb::captured_exception and template class tbb::movable_exception. See their declarations for more info. -

-


Member Function Documentation

- -
-
- - - - - - - - -
virtual void tbb::tbb_exception::destroy (  )  throw () [pure virtual]
-
-
- -

-Destroys objects created by the move() method. -

-Frees memory and calls destructor for this exception object. Can and must be used only on objects created by the move method. -

-Implemented in tbb::captured_exception, and tbb::movable_exception< ExceptionData >. -

-

- -

-
- - - - - - - - -
virtual tbb_exception* tbb::tbb_exception::move (  )  throw () [pure virtual]
-
-
- -

-Creates and returns pointer to the deep copy of this exception object. -

-Move semantics is allowed. -

-Implemented in tbb::captured_exception, and tbb::movable_exception< ExceptionData >. -

-

- -

-
- - - - - - - - -
virtual void tbb::tbb_exception::throw_self (  )  [pure virtual]
-
-
- -

-Throws this exception object. -

-Make sure that if you have several levels of derivation from this interface you implement or override this method on the most derived level. The implementation is as simple as "throw *this;". Failure to do this will result in exception of a base class type being thrown. -

-Implemented in tbb::captured_exception, and tbb::movable_exception< ExceptionData >. -

-

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00145.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00145.html deleted file mode 100644 index 0a97a9ee56..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00145.html +++ /dev/null @@ -1,56 +0,0 @@ - - -tbb::tbb_hash_compare< T > Struct Template Reference - - - - - - - -

tbb::tbb_hash_compare< T > Struct Template Reference

hash_compare - default argument -More... -

-#include <concurrent_hash_map.h> -

-List of all members. - - - - - - -

Static Public Member Functions

-static internal::hashcode_t hash (const T &t)
-static bool equal (const T &a, const T &b)
-


Detailed Description

-

template<typename T>
- struct tbb::tbb_hash_compare< T >

- -hash_compare - default argument -

-


The documentation for this struct was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00146.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00146.html deleted file mode 100644 index 5b3320eed5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00146.html +++ /dev/null @@ -1,68 +0,0 @@ - - -tbb::tick_count Class Reference - - - - - - - -

tbb::tick_count Class Reference
- -[Timing] -

Absolute timestamp. -More... -

-#include <tick_count.h> -

-List of all members. - - - - - - - - - - - - - - - - - -

Public Member Functions

tick_count ()
 Construct an absolute timestamp initialized to zero.

Static Public Member Functions

-static tick_count now ()
 Return current time.

Friends

-interval_t operator- (const tick_count &t1, const tick_count &t0)
 Subtract two timestamps to get the time interval between.

Classes

class  interval_t
 Relative time interval. More...
-


Detailed Description

-Absolute timestamp. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00147.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00147.html deleted file mode 100644 index 6bfa9d9846..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00147.html +++ /dev/null @@ -1,83 +0,0 @@ - - -tbb::tick_count::interval_t Class Reference - - - - - - - -

tbb::tick_count::interval_t Class Reference

Relative time interval. -More... -

-#include <tick_count.h> -

-List of all members. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

interval_t ()
 Construct a time interval representing zero time duration.
interval_t (double sec)
 Construct a time interval representing sec seconds time duration.
-double seconds () const
 Return the length of a time interval in seconds.
-interval_toperator+= (const interval_t &i)
 Accumulation operator.
-interval_toperator-= (const interval_t &i)
 Subtraction operator.

Friends

-class tbb::tick_count
-interval_t operator- (const tick_count &t1, const tick_count &t0)
 Extract the intervals from the tick_counts and subtract them.
-interval_t operator+ (const interval_t &i, const interval_t &j)
 Add two intervals.
-interval_t operator- (const interval_t &i, const interval_t &j)
 Subtract two intervals.
-


Detailed Description

-Relative time interval. -

-


The documentation for this class was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00148.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00148.html deleted file mode 100644 index 12aedb665f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00148.html +++ /dev/null @@ -1,55 +0,0 @@ - - -tbb::internal::work_around_alignment_bug< Size, T > Struct Template Reference - - - - - - - -

tbb::internal::work_around_alignment_bug< Size, T > Struct Template Reference

Work around for bug in GNU 3.2 and MSVC compilers. -More... -

-#include <tbb_machine.h> -

-List of all members. - - - - -

Static Public Attributes

-static const size_t alignment = __alignof(T)
-


Detailed Description

-

template<size_t Size, typename T>
- struct tbb::internal::work_around_alignment_bug< Size, T >

- -Work around for bug in GNU 3.2 and MSVC compilers. -

-Bug is that compiler sometimes returns 0 for __alignof(T) when T has not yet been instantiated. The work-around forces instantiation by forcing computation of sizeof(T) before __alignof(T). -

-


The documentation for this struct was generated from the following file: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00175.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00175.html deleted file mode 100644 index 83f8bd0344..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00175.html +++ /dev/null @@ -1,75 +0,0 @@ - - -scalable_allocator.h File Reference - - - - - - -

scalable_allocator.h File Reference

-

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Namespaces

namespace  tbb

Classes

class  tbb::scalable_allocator< T >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
struct  tbb::scalable_allocator< T >::rebind< U >
class  tbb::scalable_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
struct  tbb::scalable_allocator< void >::rebind< U >

Functions

void *__TBB_EXPORTED_FUNC scalable_malloc (size_t size)
void __TBB_EXPORTED_FUNC scalable_free (void *ptr)
void *__TBB_EXPORTED_FUNC scalable_realloc (void *ptr, size_t size)
void *__TBB_EXPORTED_FUNC scalable_calloc (size_t nobj, size_t size)
int __TBB_EXPORTED_FUNC scalable_posix_memalign (void **memptr, size_t alignment, size_t size)
void *__TBB_EXPORTED_FUNC scalable_aligned_malloc (size_t size, size_t alignment)
void *__TBB_EXPORTED_FUNC scalable_aligned_realloc (void *ptr, size_t size, size_t alignment)
void __TBB_EXPORTED_FUNC scalable_aligned_free (void *ptr)
-template<typename T, typename U>
bool tbb::operator== (const scalable_allocator< T > &, const scalable_allocator< U > &)
-template<typename T, typename U>
bool tbb::operator!= (const scalable_allocator< T > &, const scalable_allocator< U > &)
-


Detailed Description

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00191.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00191.html deleted file mode 100644 index 1e217bb134..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00191.html +++ /dev/null @@ -1,593 +0,0 @@ - - -tbb Namespace Reference - - - - - - -

tbb Namespace Reference

The namespace tbb contains all components of the library. -More... -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Classes

class  aligned_space
 Block of space aligned sufficiently to construct an array T with N elements. More...
struct  atomic
 Primary template for atomic. More...
struct  atomic< void * >
struct  atomic< bool >
class  blocked_range
 A range over which to iterate. More...
class  blocked_range2d
 A 2-dimensional range that models the Range concept. More...
class  blocked_range3d
 A 3-dimensional range that models the Range concept. More...
class  cache_aligned_allocator
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
class  cache_aligned_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
struct  tbb_hash_compare
 hash_compare - default argument More...
class  concurrent_hash_map
 Unordered map from Key to T. More...
class  concurrent_queue
 A high-performance thread-safe queue. More...
class  concurrent_vector
 Concurrent vector container. More...
class  enumerable_thread_specific
 The thread local class template. More...
class  flattened2d
class  mutex
 Wrapper around the platform's native reader-writer lock. More...
class  null_mutex
class  null_rw_mutex
class  parallel_do_feeder
 Class the user supplied algorithm body uses to add new tasks. More...
struct  pre_scan_tag
 Used to indicate that the initial scan is being performed. More...
struct  final_scan_tag
 Used to indicate that the final scan is being performed. More...
class  parallel_while
 Parallel iteration over a stream, with optional addition of more work. More...
class  simple_partitioner
 A simple partitioner. More...
class  auto_partitioner
 An auto partitioner. More...
class  affinity_partitioner
 An affinity partitioner. More...
class  filter
 A stage in a pipeline. More...
class  pipeline
 A processing pipeling that applies filters to items. More...
class  queuing_mutex
 Queuing lock with local-only spinning. More...
class  queuing_rw_mutex
 Reader-writer lock with local-only spinning. More...
class  recursive_mutex
 Mutex that allows recursive mutex acquisition. More...
class  scalable_allocator
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
class  scalable_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
class  spin_mutex
 A lock that occupies a single byte. More...
class  spin_rw_mutex_v3
 Fast, unfair, spinning reader-writer lock with backoff and writer-preference. More...
class  task_group_context
 Used to form groups of tasks. More...
class  task
 Base class for user-defined tasks. More...
class  empty_task
 task that does nothing. Useful for synchronization. More...
class  task_list
 A list of children. More...
class  task_scheduler_init
 Class representing reference to tbb scheduler. More...
class  tbb_allocator
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
class  tbb_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
class  bad_last_alloc
 Exception for concurrent containers. More...
class  tbb_exception
 Interface to be implemented by all exceptions TBB recognizes and propagates across the threads. More...
class  captured_exception
 This class is used by TBB to propagate information about unhandled exceptions into the root thread. More...
class  movable_exception
 Template that can be used to implement exception that transfers arbitrary ExceptionData to the root thread. More...
class  split
 Dummy type that distinguishes splitting constructor from copy constructor. More...
class  tick_count
 Absolute timestamp. More...

parallel_do

See also requirements on parallel_do Body.

-template<typename Iterator, typename Body>
void parallel_do (Iterator first, Iterator last, const Body &body)
 Parallel iteration over a range, with optional addition of more work.
-template<typename Iterator, typename Body>
void parallel_do (Iterator first, Iterator last, const Body &body, task_group_context &context)
 Parallel iteration over a range, with optional addition of more work and user-supplied context.

parallel_for

See also requirements on Range and parallel_for Body.

-template<typename Range, typename Body>
void parallel_for (const Range &range, const Body &body, const simple_partitioner &partitioner=simple_partitioner())
 Parallel iteration over range with simple partitioner, or default partitioner if no partitioner is specified.
-template<typename Range, typename Body>
void parallel_for (const Range &range, const Body &body, const auto_partitioner &partitioner)
 Parallel iteration over range with auto_partitioner.
-template<typename Range, typename Body>
void parallel_for (const Range &range, const Body &body, affinity_partitioner &partitioner)
 Parallel iteration over range with affinity_partitioner.
-template<typename Range, typename Body>
void parallel_for (const Range &range, const Body &body, const simple_partitioner &partitioner, task_group_context &context)
 Parallel iteration over range with simple partitioner and user-supplied context.
-template<typename Range, typename Body>
void parallel_for (const Range &range, const Body &body, const auto_partitioner &partitioner, task_group_context &context)
 Parallel iteration over range with auto_partitioner and user-supplied context.
-template<typename Range, typename Body>
void parallel_for (const Range &range, const Body &body, affinity_partitioner &partitioner, task_group_context &context)
 Parallel iteration over range with affinity_partitioner and user-supplied context.

parallel_invoke

-template<typename F0, typename F1>
void parallel_invoke (F0 &f0, F1 &f1, tbb::task_group_context &context)
 Executes a list of tasks in parallel and waits for all tasks to complete.
-template<typename F0, typename F1, typename F2>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8, typename F9>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8, F9 &f9, tbb::task_group_context &context)
-template<typename F0, typename F1>
void parallel_invoke (F0 &f0, F1 &f1)
-template<typename F0, typename F1, typename F2>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2)
-template<typename F0, typename F1, typename F2, typename F3>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3)
-template<typename F0, typename F1, typename F2, typename F3, typename F4>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8, typename F9>
void parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8, F9 &f9)

parallel_reduce

See also requirements on Range and parallel_reduce Body.

-template<typename Range, typename Body>
void parallel_reduce (const Range &range, Body &body, const simple_partitioner &partitioner=simple_partitioner())
 Parallel iteration with reduction and simple_partitioner, or no partitioner specified.
-template<typename Range, typename Body>
void parallel_reduce (const Range &range, Body &body, const auto_partitioner &partitioner)
 Parallel iteration with reduction and auto_partitioner.
-template<typename Range, typename Body>
void parallel_reduce (const Range &range, Body &body, affinity_partitioner &partitioner)
 Parallel iteration with reduction and affinity_partitioner.
-template<typename Range, typename Body>
void parallel_reduce (const Range &range, Body &body, const simple_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, simple partitioner and user-supplied context.
-template<typename Range, typename Body>
void parallel_reduce (const Range &range, Body &body, const auto_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, auto_partitioner and user-supplied context.
-template<typename Range, typename Body>
void parallel_reduce (const Range &range, Body &body, affinity_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, affinity_partitioner and user-supplied context.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const simple_partitioner &partitioner=simple_partitioner())
 Parallel iteration with reduction and simple_partitioner, or no partitioner specified.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const auto_partitioner &partitioner)
 Parallel iteration with reduction and auto_partitioner.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, affinity_partitioner &partitioner)
 Parallel iteration with reduction and affinity_partitioner.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const simple_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, simple partitioner and user-supplied context.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const auto_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, auto_partitioner and user-supplied context.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, affinity_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, affinity_partitioner and user-supplied context.

parallel_scan

See also requirements on Range and parallel_scan Body.

-template<typename Range, typename Body>
void parallel_scan (const Range &range, Body &body, const simple_partitioner &partitioner=simple_partitioner())
 Parallel prefix with simple_partitioner.
-template<typename Range, typename Body>
void parallel_scan (const Range &range, Body &body, const auto_partitioner &partitioner)
 Parallel prefix with auto_partitioner.

parallel_sort

See also requirements on iterators for parallel_sort.

template<typename RandomAccessIterator, typename Compare>
void parallel_sort (RandomAccessIterator begin, RandomAccessIterator end, const Compare &comp)
 Sorts the data in [begin,end) using the given comparator.
-template<typename RandomAccessIterator>
void parallel_sort (RandomAccessIterator begin, RandomAccessIterator end)
 Sorts the data in [begin,end) with a default comparator std::less<RandomAccessIterator>.
-template<typename T>
void parallel_sort (T *begin, T *end)
 Sorts the data in the range [begin,end) with a default comparator std::less<T>.

Typedefs

-typedef spin_rw_mutex_v3 spin_rw_mutex
-typedef std::size_t stack_size_type
-typedef internal::task_scheduler_observer_v3 task_scheduler_observer
-typedef void(*) assertion_handler_type (const char *filename, int line, const char *expression, const char *comment)
 Type for an assertion handler.

Enumerations

enum  memory_semantics { __TBB_full_fence, -acquire, -release - }
 Specifies memory fencing. More...
enum  ets_key_usage_type { ets_single_key, -ets_key_per_instance - }
 enum for selecting between single key and key-per-instance versions

Functions

__TBB_DECL_ATOMIC (__TBB_LONG_LONG) __TBB_DECL_ATOMIC(unsigned __TBB_LONG_LONG) __TBB_DECL_ATOMIC(long) __TBB_DECL_ATOMIC(unsigned long) __TBB_DECL_ATOMIC_ALT(unsigned
-size_t __TBB_DECL_ATOMIC_ALT (int, ptrdiff_t) __TBB_DECL_ATOMIC(unsigned) __TBB_DECL_ATOMIC(int) __TBB_DECL_ATOMIC(unsigned short) __TBB_DECL_ATOMIC(short) __TBB_DECL_ATOMIC(char) __TBB_DECL_ATOMIC(signed char) __TBB_DECL_ATOMIC(unsigned char) __TBB_DECL_ATOMIC(wchar_t) template< typename T > struct atomic< T * >
-template<typename T, typename U>
bool operator== (const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
-template<typename T, typename U>
bool operator!= (const cache_aligned_allocator< T > &, const cache_aligned_allocator< U > &)
-template<typename Key, typename T, typename HashCompare, typename A1, typename A2>
bool operator== (const concurrent_hash_map< Key, T, HashCompare, A1 > &a, const concurrent_hash_map< Key, T, HashCompare, A2 > &b)
-template<typename Key, typename T, typename HashCompare, typename A1, typename A2>
bool operator!= (const concurrent_hash_map< Key, T, HashCompare, A1 > &a, const concurrent_hash_map< Key, T, HashCompare, A2 > &b)
-template<typename Key, typename T, typename HashCompare, typename A>
void swap (concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
-template<typename T, class A1, class A2>
bool operator== (const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
-template<typename T, class A1, class A2>
bool operator!= (const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
-template<typename T, class A1, class A2>
bool operator< (const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
-template<typename T, class A1, class A2>
bool operator> (const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
-template<typename T, class A1, class A2>
bool operator<= (const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
-template<typename T, class A1, class A2>
bool operator>= (const concurrent_vector< T, A1 > &a, const concurrent_vector< T, A2 > &b)
-template<typename T, class A>
void swap (concurrent_vector< T, A > &a, concurrent_vector< T, A > &b)
-template<typename Container>
flattened2d< Container > flatten2d (const Container &c, const typename Container::const_iterator b, const typename Container::const_iterator e)
-template<typename Container>
flattened2d< Container > flatten2d (const Container &c)
-template<typename T, typename U>
bool operator== (const scalable_allocator< T > &, const scalable_allocator< U > &)
-template<typename T, typename U>
bool operator!= (const scalable_allocator< T > &, const scalable_allocator< U > &)
-template<typename T, typename U>
bool operator== (const tbb_allocator< T > &, const tbb_allocator< U > &)
-template<typename T, typename U>
bool operator!= (const tbb_allocator< T > &, const tbb_allocator< U > &)
-assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler (assertion_handler_type new_handler)
 Set assertion handler and return previous value of it.
void __TBB_EXPORTED_FUNC assertion_failure (const char *filename, int line, const char *expression, const char *comment)
 Process an assertion failure.
int __TBB_EXPORTED_FUNC TBB_runtime_interface_version ()
 The function returns the interface version of the TBB shared library being used.
-tick_count::interval_t operator- (const tick_count &t1, const tick_count &t0)
-


Detailed Description

-The namespace tbb contains all components of the library.

Enumeration Type Documentation

- -
-
- - - - -
enum tbb::memory_semantics
-
-
- -

-Specifies memory fencing. -

-

Enumerator:
- - - - -
__TBB_full_fence  -For internal use only.
acquire  -Acquire fence.
release  -Release fence.
-
- -
-

-


Function Documentation

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void __TBB_EXPORTED_FUNC tbb::assertion_failure (const char *  filename,
int  line,
const char *  expression,
const char *  comment 
)
-
-
- -

-Process an assertion failure. -

-Normally called from __TBB_ASSERT macro. If assertion handler is null, print message for assertion failure and abort. Otherwise call the assertion handler. -

-

- -

-
- - - - - - - - -
int __TBB_EXPORTED_FUNC tbb::TBB_runtime_interface_version (  ) 
-
-
- -

-The function returns the interface version of the TBB shared library being used. -

-The version it returns is determined at runtime, not at compile/link time. So it can be different than the value of TBB_INTERFACE_VERSION obtained at compile time. -

-

-


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00193.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00193.html deleted file mode 100644 index 6a418bbb8a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00193.html +++ /dev/null @@ -1,310 +0,0 @@ - - -Algorithms - - - - - -

Algorithms

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Classes

class  tbb::blocked_range< Value >
 A range over which to iterate. More...
class  tbb::blocked_range2d< RowValue, ColValue >
 A 2-dimensional range that models the Range concept. More...
class  tbb::blocked_range3d< PageValue, RowValue, ColValue >
 A 3-dimensional range that models the Range concept. More...
struct  tbb::pre_scan_tag
 Used to indicate that the initial scan is being performed. More...
struct  tbb::final_scan_tag
 Used to indicate that the final scan is being performed. More...
class  tbb::parallel_while< Body >
 Parallel iteration over a stream, with optional addition of more work. More...
class  tbb::simple_partitioner
 A simple partitioner. More...
class  tbb::auto_partitioner
 An auto partitioner. More...
class  tbb::filter
 A stage in a pipeline. More...
class  tbb::pipeline
 A processing pipeling that applies filters to items. More...
class  tbb::split
 Dummy type that distinguishes splitting constructor from copy constructor. More...

parallel_do

See also requirements on parallel_do Body.

-template<typename Iterator, typename Body>
void tbb::parallel_do (Iterator first, Iterator last, const Body &body)
 Parallel iteration over a range, with optional addition of more work.
-template<typename Iterator, typename Body>
void tbb::parallel_do (Iterator first, Iterator last, const Body &body, task_group_context &context)
 Parallel iteration over a range, with optional addition of more work and user-supplied context.

parallel_for

See also requirements on Range and parallel_for Body.

-template<typename Range, typename Body>
void tbb::parallel_for (const Range &range, const Body &body, const simple_partitioner &partitioner=simple_partitioner())
 Parallel iteration over range with simple partitioner, or default partitioner if no partitioner is specified.
-template<typename Range, typename Body>
void tbb::parallel_for (const Range &range, const Body &body, const auto_partitioner &partitioner)
 Parallel iteration over range with auto_partitioner.
-template<typename Range, typename Body>
void tbb::parallel_for (const Range &range, const Body &body, affinity_partitioner &partitioner)
 Parallel iteration over range with affinity_partitioner.
-template<typename Range, typename Body>
void tbb::parallel_for (const Range &range, const Body &body, const simple_partitioner &partitioner, task_group_context &context)
 Parallel iteration over range with simple partitioner and user-supplied context.
-template<typename Range, typename Body>
void tbb::parallel_for (const Range &range, const Body &body, const auto_partitioner &partitioner, task_group_context &context)
 Parallel iteration over range with auto_partitioner and user-supplied context.
-template<typename Range, typename Body>
void tbb::parallel_for (const Range &range, const Body &body, affinity_partitioner &partitioner, task_group_context &context)
 Parallel iteration over range with affinity_partitioner and user-supplied context.

parallel_invoke

-template<typename F0, typename F1>
void tbb::parallel_invoke (F0 &f0, F1 &f1, tbb::task_group_context &context)
 Executes a list of tasks in parallel and waits for all tasks to complete.
-template<typename F0, typename F1, typename F2>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8, tbb::task_group_context &context)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8, typename F9>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8, F9 &f9, tbb::task_group_context &context)
-template<typename F0, typename F1>
void tbb::parallel_invoke (F0 &f0, F1 &f1)
-template<typename F0, typename F1, typename F2>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2)
-template<typename F0, typename F1, typename F2, typename F3>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3)
-template<typename F0, typename F1, typename F2, typename F3, typename F4>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8)
-template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6, typename F7, typename F8, typename F9>
void tbb::parallel_invoke (F0 &f0, F1 &f1, F2 &f2, F3 &f3, F4 &f4, F5 &f5, F6 &f6, F7 &f7, F8 &f8, F9 &f9)

parallel_reduce

See also requirements on Range and parallel_reduce Body.

-template<typename Range, typename Body>
void tbb::parallel_reduce (const Range &range, Body &body, const simple_partitioner &partitioner=simple_partitioner())
 Parallel iteration with reduction and simple_partitioner, or no partitioner specified.
-template<typename Range, typename Body>
void tbb::parallel_reduce (const Range &range, Body &body, const auto_partitioner &partitioner)
 Parallel iteration with reduction and auto_partitioner.
-template<typename Range, typename Body>
void tbb::parallel_reduce (const Range &range, Body &body, affinity_partitioner &partitioner)
 Parallel iteration with reduction and affinity_partitioner.
-template<typename Range, typename Body>
void tbb::parallel_reduce (const Range &range, Body &body, const simple_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, simple partitioner and user-supplied context.
-template<typename Range, typename Body>
void tbb::parallel_reduce (const Range &range, Body &body, const auto_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, auto_partitioner and user-supplied context.
-template<typename Range, typename Body>
void tbb::parallel_reduce (const Range &range, Body &body, affinity_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, affinity_partitioner and user-supplied context.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const simple_partitioner &partitioner=simple_partitioner())
 Parallel iteration with reduction and simple_partitioner, or no partitioner specified.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const auto_partitioner &partitioner)
 Parallel iteration with reduction and auto_partitioner.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, affinity_partitioner &partitioner)
 Parallel iteration with reduction and affinity_partitioner.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const simple_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, simple partitioner and user-supplied context.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const auto_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, auto_partitioner and user-supplied context.
-template<typename Range, typename Value, typename RealBody, typename Reduction>
Value tbb::parallel_reduce (const Range &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, affinity_partitioner &partitioner, task_group_context &context)
 Parallel iteration with reduction, affinity_partitioner and user-supplied context.

parallel_scan

See also requirements on Range and parallel_scan Body.

-template<typename Range, typename Body>
void tbb::parallel_scan (const Range &range, Body &body, const simple_partitioner &partitioner=simple_partitioner())
 Parallel prefix with simple_partitioner.
-template<typename Range, typename Body>
void tbb::parallel_scan (const Range &range, Body &body, const auto_partitioner &partitioner)
 Parallel prefix with auto_partitioner.

parallel_sort

See also requirements on iterators for parallel_sort.

template<typename RandomAccessIterator, typename Compare>
void tbb::parallel_sort (RandomAccessIterator begin, RandomAccessIterator end, const Compare &comp)
 Sorts the data in [begin,end) using the given comparator.
-template<typename RandomAccessIterator>
void tbb::parallel_sort (RandomAccessIterator begin, RandomAccessIterator end)
 Sorts the data in [begin,end) with a default comparator std::less<RandomAccessIterator>.
-template<typename T>
void tbb::parallel_sort (T *begin, T *end)
 Sorts the data in the range [begin,end) with a default comparator std::less<T>.
-

Function Documentation

- -
-
-
-template<typename RandomAccessIterator, typename Compare>
- - - - - - - - - - - - - - - - - - - - - - - - -
void tbb::parallel_sort (RandomAccessIterator  begin,
RandomAccessIterator  end,
const Compare &  comp 
)
-
-
- -

-Sorts the data in [begin,end) using the given comparator. -

-The compare function object is used for all comparisons between elements during sorting. The compare object must define a bool operator() function. -

-

-


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00194.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00194.html deleted file mode 100644 index 94ca25600d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00194.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Containers - - - - - -

Containers

- - - - - - - - - - - -

Classes

class  tbb::concurrent_hash_map< Key, T, HashCompare, A >
 Unordered map from Key to T. More...
class  tbb::concurrent_queue< T, A >
 A high-performance thread-safe queue. More...
class  tbb::concurrent_vector< T, A >
 Concurrent vector container. More...
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00195.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00195.html deleted file mode 100644 index c4c538587f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00195.html +++ /dev/null @@ -1,285 +0,0 @@ - - -Memory Allocation - - - - - -

Memory Allocation

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Classes

class  tbb::aligned_space< T, N >
 Block of space aligned sufficiently to construct an array T with N elements. More...
class  tbb::cache_aligned_allocator< T >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
class  tbb::cache_aligned_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
class  tbb::scalable_allocator< T >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
class  tbb::scalable_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...
class  tbb::tbb_allocator< T >
 Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...
class  tbb::tbb_allocator< void >
 Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1. More...

Functions

void *__TBB_EXPORTED_FUNC scalable_malloc (size_t size)
void __TBB_EXPORTED_FUNC scalable_free (void *ptr)
void *__TBB_EXPORTED_FUNC scalable_realloc (void *ptr, size_t size)
void *__TBB_EXPORTED_FUNC scalable_calloc (size_t nobj, size_t size)
int __TBB_EXPORTED_FUNC scalable_posix_memalign (void **memptr, size_t alignment, size_t size)
void *__TBB_EXPORTED_FUNC scalable_aligned_malloc (size_t size, size_t alignment)
void *__TBB_EXPORTED_FUNC scalable_aligned_realloc (void *ptr, size_t size, size_t alignment)
void __TBB_EXPORTED_FUNC scalable_aligned_free (void *ptr)
-

Function Documentation

- -
-
- - - - - - - - - -
void __TBB_EXPORTED_FUNC scalable_aligned_free (void *  ptr  ) 
-
-
- -

-The "_aligned_free" analogue. -

-

- -

-
- - - - - - - - - - - - - - - - - - -
void* __TBB_EXPORTED_FUNC scalable_aligned_malloc (size_t  size,
size_t  alignment 
)
-
-
- -

-The "_aligned_malloc" analogue. -

-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
void* __TBB_EXPORTED_FUNC scalable_aligned_realloc (void *  ptr,
size_t  size,
size_t  alignment 
)
-
-
- -

-The "_aligned_realloc" analogue. -

-

- -

-
- - - - - - - - - - - - - - - - - - -
void* __TBB_EXPORTED_FUNC scalable_calloc (size_t  nobj,
size_t  size 
)
-
-
- -

-The "calloc" analogue complementing scalable_malloc. -

-

- -

-
- - - - - - - - - -
void __TBB_EXPORTED_FUNC scalable_free (void *  ptr  ) 
-
-
- -

-The "free" analogue to discard a previously allocated piece of memory. -

-

- -

-
- - - - - - - - - -
void* __TBB_EXPORTED_FUNC scalable_malloc (size_t  size  ) 
-
-
- -

-The "malloc" analogue to allocate block of memory of size bytes. -

-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
int __TBB_EXPORTED_FUNC scalable_posix_memalign (void **  memptr,
size_t  alignment,
size_t  size 
)
-
-
- -

-The "posix_memalign" analogue. -

-

- -

-
- - - - - - - - - - - - - - - - - - -
void* __TBB_EXPORTED_FUNC scalable_realloc (void *  ptr,
size_t  size 
)
-
-
- -

-The "realloc" analogue complementing scalable_malloc. -

-

-


-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00196.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00196.html deleted file mode 100644 index 7ec3cee2d9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00196.html +++ /dev/null @@ -1,50 +0,0 @@ - - -Synchronization - - - - - -

Synchronization

- - - - - - - - - - - - - - - - - - - - - - - -

Classes

struct  tbb::atomic< T >
 Primary template for atomic. More...
class  tbb::mutex
 Wrapper around the platform's native reader-writer lock. More...
class  tbb::queuing_mutex
 Queuing lock with local-only spinning. More...
class  tbb::queuing_rw_mutex
 Reader-writer lock with local-only spinning. More...
class  tbb::recursive_mutex
 Mutex that allows recursive mutex acquisition. More...
class  tbb::spin_mutex
 A lock that occupies a single byte. More...
class  tbb::spin_rw_mutex_v3
 Fast, unfair, spinning reader-writer lock with backoff and writer-preference. More...
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00197.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00197.html deleted file mode 100644 index 1dc27b7684..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00197.html +++ /dev/null @@ -1,32 +0,0 @@ - - -Timing - - - - - -

Timing

- - - - - -

Classes

class  tbb::tick_count
 Absolute timestamp. More...
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00198.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00198.html deleted file mode 100644 index dc5821bb3e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00198.html +++ /dev/null @@ -1,44 +0,0 @@ - - -Task Scheduling - - - - - -

Task Scheduling

- - - - - - - - - - - - - - - - - -

Classes

class  tbb::task_group_context
 Used to form groups of tasks. More...
class  tbb::task
 Base class for user-defined tasks. More...
class  tbb::empty_task
 task that does nothing. Useful for synchronization. More...
class  tbb::task_list
 A list of children. More...
class  tbb::task_scheduler_init
 Class representing reference to tbb scheduler. More...
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00199.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00199.html deleted file mode 100644 index e6bd6a32fb..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00199.html +++ /dev/null @@ -1,106 +0,0 @@ - - -_tbb_windef.h Source File - - - - - - -

_tbb_windef.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_tbb_windef_H
-00022 #error Do not #include this file directly.  Use "#include tbb/tbb_stddef.h" instead.
-00023 #endif /* __TBB_tbb_windef_H */
-00024 
-00025 // Check that the target Windows version has all API calls requried for TBB.
-00026 // Do not increase the version in condition beyond 0x0500 without prior discussion!
-00027 #if defined(_WIN32_WINNT) && _WIN32_WINNT<0x0400
-00028 #error TBB is unable to run on old Windows versions; _WIN32_WINNT must be 0x0400 or greater.
-00029 #endif
-00030 
-00031 #if !defined(_MT)
-00032 #error TBB requires linkage with multithreaded C/C++ runtime library. \
-00033        Choose multithreaded DLL runtime in project settings, or use /MD[d] compiler switch.
-00034 #elif !defined(_DLL)
-00035 #pragma message("Warning: Using TBB together with static C/C++ runtime library is not recommended. " \
-00036                 "Consider switching your project to multithreaded DLL runtime used by TBB.")
-00037 #endif
-00038 
-00039 // Workaround for the problem with MVSC headers failing to define namespace std
-00040 namespace std {
-00041   using ::size_t; using ::ptrdiff_t;
-00042 }
-00043 
-00044 #define __TBB_STRING_AUX(x) #x
-00045 #define __TBB_STRING(x) __TBB_STRING_AUX(x)
-00046 
-00047 // Default setting of TBB_USE_DEBUG
-00048 #ifdef TBB_USE_DEBUG
-00049 #    if TBB_USE_DEBUG 
-00050 #        if !defined(_DEBUG)
-00051 #            pragma message(__FILE__ "(" __TBB_STRING(__LINE__) ") : Warning: Recommend using /MDd if compiling with TBB_USE_DEBUG!=0")
-00052 #        endif
-00053 #    else
-00054 #        if defined(_DEBUG)
-00055 #            pragma message(__FILE__ "(" __TBB_STRING(__LINE__) ") : Warning: Recommend using /MD if compiling with TBB_USE_DEBUG==0")
-00056 #        endif
-00057 #    endif
-00058 #else
-00059 #    ifdef _DEBUG
-00060 #        define TBB_USE_DEBUG 1
-00061 #    endif
-00062 #endif 
-00063 
-00064 #if __TBB_BUILD && !defined(__TBB_NO_IMPLICIT_LINKAGE)
-00065 #define __TBB_NO_IMPLICIT_LINKAGE 1
-00066 #endif
-00067 
-00068 #if _MSC_VER
-00069     #if !__TBB_NO_IMPLICIT_LINKAGE
-00070         #ifdef _DEBUG
-00071             #pragma comment(lib, "tbb_debug.lib")
-00072         #else
-00073             #pragma comment(lib, "tbb.lib")
-00074         #endif
-00075     #endif
-00076 #endif
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00201.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00201.html deleted file mode 100644 index caaf534f74..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00201.html +++ /dev/null @@ -1,73 +0,0 @@ - - -aligned_space.h Source File - - - - - - -

aligned_space.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_aligned_space_H
-00022 #define __TBB_aligned_space_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 #include "tbb_machine.h"
-00026 
-00027 namespace tbb {
-00028 
-00030 
-00032 template<typename T,size_t N>
-00033 class aligned_space {
-00034 private:
-00035     typedef __TBB_TypeWithAlignmentAtLeastAsStrict(T) element_type;
-00036     element_type array[(sizeof(T)*N+sizeof(element_type)-1)/sizeof(element_type)];
-00037 public:
-00039     T* begin() {return reinterpret_cast<T*>(this);}
-00040 
-00042     T* end() {return begin()+N;}
-00043 };
-00044 
-00045 } // namespace tbb 
-00046 
-00047 #endif /* __TBB_aligned_space_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00203.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00203.html deleted file mode 100644 index b68f17a940..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00203.html +++ /dev/null @@ -1,457 +0,0 @@ - - -atomic.h Source File - - - - - - -

atomic.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_atomic_H
-00022 #define __TBB_atomic_H
-00023 
-00024 #include <cstddef>
-00025 #include "tbb_stddef.h"
-00026 
-00027 #if _MSC_VER 
-00028 #define __TBB_LONG_LONG __int64
-00029 #else
-00030 #define __TBB_LONG_LONG long long
-00031 #endif /* _MSC_VER */
-00032 
-00033 #include "tbb_machine.h"
-00034 
-00035 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
-00036     // Workaround for overzealous compiler warnings 
-00037     #pragma warning (push)
-00038     #pragma warning (disable: 4244 4267)
-00039 #endif
-00040 
-00041 namespace tbb {
-00042 
-00044 enum memory_semantics {
-00046     __TBB_full_fence,
-00048     acquire,
-00050     release
-00051 };
-00052 
-00054 namespace internal {
-00055 
-00056 template<size_t Size, memory_semantics M>
-00057 struct atomic_traits {       // Primary template
-00058 };
-00059 
-00060 template<size_t Size>
-00061 struct atomic_word {             // Primary template
-00062     typedef intptr word;
-00063 };
-00064 
-00065 template<typename I>            // Primary template
-00066 struct atomic_base {
-00067     I my_value;
-00068 };
-00069 
-00070 #if __GNUC__ || __SUNPRO_CC
-00071 #define __TBB_DECL_ATOMIC_FIELD(t,f,a) t f  __attribute__ ((aligned(a)));
-00072 #elif defined(__INTEL_COMPILER)||_MSC_VER >= 1300
-00073 #define __TBB_DECL_ATOMIC_FIELD(t,f,a) __declspec(align(a)) t f;
-00074 #else 
-00075 #error Do not know syntax for forcing alignment.
-00076 #endif /* __GNUC__ */
-00077 
-00078 template<>
-00079 struct atomic_word<8> {          // Specialization
-00080     typedef int64_t word;
-00081 };
-00082 
-00083 #if _WIN32 && __TBB_x86_64
-00084 // ATTENTION: On 64-bit Windows, we currently have to specialize atomic_word
-00085 // for every size to avoid type conversion warnings
-00086 // See declarations of atomic primitives in machine/windows_em64t.h
-00087 template<>
-00088 struct atomic_word<1> {          // Specialization
-00089     typedef int8_t word;
-00090 };
-00091 template<>
-00092 struct atomic_word<2> {          // Specialization
-00093     typedef int16_t word;
-00094 };
-00095 template<>
-00096 struct atomic_word<4> {          // Specialization
-00097     typedef int32_t word;
-00098 };
-00099 #endif
-00100 
-00101 template<>
-00102 struct atomic_base<uint64_t> {   // Specialization
-00103     __TBB_DECL_ATOMIC_FIELD(uint64_t,my_value,8)
-00104 };
-00105 
-00106 template<>
-00107 struct atomic_base<int64_t> {    // Specialization
-00108     __TBB_DECL_ATOMIC_FIELD(int64_t,my_value,8)
-00109 };
-00110 
-00111 #define __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(S,M)                         \
-00112     template<> struct atomic_traits<S,M> {                               \
-00113         typedef atomic_word<S>::word word;                               \
-00114         inline static word compare_and_swap( volatile void* location, word new_value, word comparand ) {\
-00115             return __TBB_CompareAndSwap##S##M(location,new_value,comparand);    \
-00116         }                                                                       \
-00117         inline static word fetch_and_add( volatile void* location, word addend ) { \
-00118             return __TBB_FetchAndAdd##S##M(location,addend);                    \
-00119         }                                                                       \
-00120         inline static word fetch_and_store( volatile void* location, word value ) {\
-00121             return __TBB_FetchAndStore##S##M(location,value);                   \
-00122         }                                                                       \
-00123     };
-00124 
-00125 #define __TBB_DECL_ATOMIC_PRIMITIVES(S)                                  \
-00126     template<memory_semantics M>                                         \
-00127     struct atomic_traits<S,M> {                                          \
-00128         typedef atomic_word<S>::word word;                               \
-00129         inline static word compare_and_swap( volatile void* location, word new_value, word comparand ) {\
-00130             return __TBB_CompareAndSwap##S(location,new_value,comparand);       \
-00131         }                                                                       \
-00132         inline static word fetch_and_add( volatile void* location, word addend ) { \
-00133             return __TBB_FetchAndAdd##S(location,addend);                       \
-00134         }                                                                       \
-00135         inline static word fetch_and_store( volatile void* location, word value ) {\
-00136             return __TBB_FetchAndStore##S(location,value);                      \
-00137         }                                                                       \
-00138     };
-00139 
-00140 #if __TBB_DECL_FENCED_ATOMICS
-00141 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,__TBB_full_fence)
-00142 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,__TBB_full_fence)
-00143 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,__TBB_full_fence)
-00144 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,__TBB_full_fence)
-00145 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,acquire)
-00146 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,acquire)
-00147 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,acquire)
-00148 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,acquire)
-00149 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,release)
-00150 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,release)
-00151 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,release)
-00152 __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,release)
-00153 #else
-00154 __TBB_DECL_ATOMIC_PRIMITIVES(1)
-00155 __TBB_DECL_ATOMIC_PRIMITIVES(2)
-00156 __TBB_DECL_ATOMIC_PRIMITIVES(4)
-00157 __TBB_DECL_ATOMIC_PRIMITIVES(8)
-00158 #endif
-00159 
-00161 
-00163 #define __TBB_MINUS_ONE(T) (T(T(0)-T(1)))
-00164 
-00166 
-00169 template<typename I, typename D, typename StepType>
-00170 struct atomic_impl: private atomic_base<I> {
-00171 private:
-00172     typedef typename atomic_word<sizeof(I)>::word word;
-00173 public:
-00174     typedef I value_type;
-00175 
-00176     template<memory_semantics M>
-00177     value_type fetch_and_add( D addend ) {
-00178         return value_type(internal::atomic_traits<sizeof(value_type),M>::fetch_and_add( &this->my_value, addend*sizeof(StepType) ));
-00179     }
-00180 
-00181     value_type fetch_and_add( D addend ) {
-00182         return fetch_and_add<__TBB_full_fence>(addend);
-00183     }
-00184 
-00185     template<memory_semantics M>
-00186     value_type fetch_and_increment() {
-00187         return fetch_and_add<M>(1);
-00188     }
-00189 
-00190     value_type fetch_and_increment() {
-00191         return fetch_and_add(1);
-00192     }
-00193 
-00194     template<memory_semantics M>
-00195     value_type fetch_and_decrement() {
-00196         return fetch_and_add<M>(__TBB_MINUS_ONE(D));
-00197     }
-00198 
-00199     value_type fetch_and_decrement() {
-00200         return fetch_and_add(__TBB_MINUS_ONE(D));
-00201     }
-00202 
-00203     template<memory_semantics M>
-00204     value_type fetch_and_store( value_type value ) {
-00205         return value_type(internal::atomic_traits<sizeof(value_type),M>::fetch_and_store(&this->my_value,word(value)));
-00206     }
-00207 
-00208     value_type fetch_and_store( value_type value ) {
-00209         return fetch_and_store<__TBB_full_fence>(value);
-00210     }
-00211 
-00212     template<memory_semantics M>
-00213     value_type compare_and_swap( value_type value, value_type comparand ) {
-00214         return value_type(internal::atomic_traits<sizeof(value_type),M>::compare_and_swap(&this->my_value,word(value),word(comparand)));
-00215     }
-00216 
-00217     value_type compare_and_swap( value_type value, value_type comparand ) {
-00218         return compare_and_swap<__TBB_full_fence>(value,comparand);
-00219     }
-00220 
-00221     operator value_type() const volatile {                // volatile qualifier here for backwards compatibility 
-00222         return __TBB_load_with_acquire( this->my_value );
-00223     }
-00224 
-00225 protected:
-00226     value_type store_with_release( value_type rhs ) {
-00227         __TBB_store_with_release(this->my_value,rhs);
-00228         return rhs;
-00229     }
-00230 
-00231 public:
-00232     value_type operator+=( D addend ) {
-00233         return fetch_and_add(addend)+addend;
-00234     }
-00235 
-00236     value_type operator-=( D addend ) {
-00237         // Additive inverse of addend computed using binary minus,
-00238         // instead of unary minus, for sake of avoiding compiler warnings.
-00239         return operator+=(D(0)-addend);    
-00240     }
-00241 
-00242     value_type operator++() {
-00243         return fetch_and_add(1)+1;
-00244     }
-00245 
-00246     value_type operator--() {
-00247         return fetch_and_add(__TBB_MINUS_ONE(D))-1;
-00248     }
-00249 
-00250     value_type operator++(int) {
-00251         return fetch_and_add(1);
-00252     }
-00253 
-00254     value_type operator--(int) {
-00255         return fetch_and_add(__TBB_MINUS_ONE(D));
-00256     }
-00257 };
-00258 
-00259 #if __TBB_WORDSIZE == 4
-00260 // Plaforms with 32-bit hardware require special effort for 64-bit loads and stores.
-00261 #if defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400
-00262 
-00263 template<>
-00264 inline atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::operator atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::value_type() const volatile {
-00265     return __TBB_Load8(&this->my_value);
-00266 }
-00267 
-00268 template<>
-00269 inline atomic_impl<unsigned __TBB_LONG_LONG,unsigned __TBB_LONG_LONG,char>::operator atomic_impl<unsigned __TBB_LONG_LONG,unsigned __TBB_LONG_LONG,char>::value_type() const volatile {
-00270     return __TBB_Load8(&this->my_value);
-00271 }
-00272 
-00273 template<>
-00274 inline atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::value_type atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::store_with_release( value_type rhs ) {
-00275     __TBB_Store8(&this->my_value,rhs);
-00276     return rhs;
-00277 }
-00278 
-00279 template<>
-00280 inline atomic_impl<unsigned __TBB_LONG_LONG,unsigned __TBB_LONG_LONG,char>::value_type atomic_impl<unsigned __TBB_LONG_LONG,unsigned __TBB_LONG_LONG,char>::store_with_release( value_type rhs ) {
-00281     __TBB_Store8(&this->my_value,rhs);
-00282     return rhs;
-00283 }
-00284 
-00285 #endif /* defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 */
-00286 #endif /* __TBB_WORDSIZE==4 */
-00287 
-00288 } /* Internal */
-00290 
-00292 
-00294 template<typename T>
-00295 struct atomic {
-00296 };
-00297 
-00298 #define __TBB_DECL_ATOMIC(T) \
-00299     template<> struct atomic<T>: internal::atomic_impl<T,T,char> {  \
-00300         T operator=( T rhs ) {return store_with_release(rhs);}  \
-00301         atomic<T>& operator=( const atomic<T>& rhs ) {store_with_release(rhs); return *this;}  \
-00302     };
-00303 
-00304 #if defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400
-00305 __TBB_DECL_ATOMIC(__TBB_LONG_LONG)
-00306 __TBB_DECL_ATOMIC(unsigned __TBB_LONG_LONG)
-00307 #else
-00308 // Some old versions of MVSC cannot correctly compile templates with "long long".
-00309 #endif /* defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 */
-00310 
-00311 __TBB_DECL_ATOMIC(long)
-00312 __TBB_DECL_ATOMIC(unsigned long)
-00313 
-00314 #if defined(_MSC_VER) && __TBB_WORDSIZE==4
-00315 /* Special version of __TBB_DECL_ATOMIC that avoids gratuitous warnings from cl /Wp64 option. 
-00316    It is identical to __TBB_DECL_ATOMIC(unsigned) except that it replaces operator=(T) 
-00317    with an operator=(U) that explicitly converts the U to a T.  Types T and U should be
-00318    type synonyms on the platform.  Type U should be the wider variant of T from the
-00319    perspective of /Wp64. */
-00320 #define __TBB_DECL_ATOMIC_ALT(T,U) \
-00321     template<> struct atomic<T>: internal::atomic_impl<T,T,char> {  \
-00322         T operator=( U rhs ) {return store_with_release(T(rhs));}  \
-00323         atomic<T>& operator=( const atomic<T>& rhs ) {store_with_release(rhs); return *this;}  \
-00324     };
-00325 __TBB_DECL_ATOMIC_ALT(unsigned,size_t)
-00326 __TBB_DECL_ATOMIC_ALT(int,ptrdiff_t)
-00327 #else
-00328 __TBB_DECL_ATOMIC(unsigned)
-00329 __TBB_DECL_ATOMIC(int)
-00330 #endif /* defined(_MSC_VER) && __TBB_WORDSIZE==4 */
-00331 
-00332 __TBB_DECL_ATOMIC(unsigned short)
-00333 __TBB_DECL_ATOMIC(short)
-00334 __TBB_DECL_ATOMIC(char)
-00335 __TBB_DECL_ATOMIC(signed char)
-00336 __TBB_DECL_ATOMIC(unsigned char)
-00337 
-00338 #if !defined(_MSC_VER)||defined(_NATIVE_WCHAR_T_DEFINED) 
-00339 __TBB_DECL_ATOMIC(wchar_t)
-00340 #endif /* _MSC_VER||!defined(_NATIVE_WCHAR_T_DEFINED) */
-00341 
-00342 template<typename T> struct atomic<T*>: internal::atomic_impl<T*,ptrdiff_t,T> {
-00343     T* operator=( T* rhs ) {
-00344         // "this" required here in strict ISO C++ because store_with_release is a dependent name
-00345         return this->store_with_release(rhs);
-00346     }
-00347     atomic<T*>& operator=( const atomic<T*>& rhs ) {this->store_with_release(rhs); return *this;}
-00348     T* operator->() const {
-00349         return (*this);
-00350     }
-00351 };
-00352 
-00353 template<>
-00354 struct atomic<void*> {
-00355 private:
-00356     void* my_value;
-00357 
-00358 public:
-00359     typedef void* value_type;
-00360 
-00361     template<memory_semantics M>
-00362     value_type compare_and_swap( value_type value, value_type comparand ) {
-00363         return value_type(internal::atomic_traits<sizeof(value_type),M>::compare_and_swap(&my_value,internal::intptr(value),internal::intptr(comparand)));
-00364     }
-00365 
-00366     value_type compare_and_swap( value_type value, value_type comparand ) {
-00367         return compare_and_swap<__TBB_full_fence>(value,comparand);
-00368     }
-00369 
-00370     template<memory_semantics M>
-00371     value_type fetch_and_store( value_type value ) {
-00372         return value_type(internal::atomic_traits<sizeof(value_type),M>::fetch_and_store(&my_value,internal::intptr(value)));
-00373     }
-00374 
-00375     value_type fetch_and_store( value_type value ) {
-00376         return fetch_and_store<__TBB_full_fence>(value);
-00377     }
-00378 
-00379     operator value_type() const {
-00380         return __TBB_load_with_acquire(my_value);
-00381     }
-00382 
-00383     value_type operator=( value_type rhs ) {
-00384         __TBB_store_with_release(my_value,rhs);
-00385         return rhs;
-00386     }
-00387 
-00388     atomic<void*>& operator=( const atomic<void*>& rhs ) {
-00389         __TBB_store_with_release(my_value,rhs);
-00390         return *this;
-00391     }
-00392 };
-00393 
-00394 template<>
-00395 struct atomic<bool> {
-00396 private:
-00397     bool my_value;
-00398     typedef internal::atomic_word<sizeof(bool)>::word word;
-00399 public:
-00400     typedef bool value_type;
-00401     template<memory_semantics M>
-00402     value_type compare_and_swap( value_type value, value_type comparand ) {
-00403         return internal::atomic_traits<sizeof(value_type),M>::compare_and_swap(&my_value,word(value),word(comparand))!=0;
-00404     }
-00405 
-00406     value_type compare_and_swap( value_type value, value_type comparand ) {
-00407         return compare_and_swap<__TBB_full_fence>(value,comparand);
-00408     }
-00409 
-00410     template<memory_semantics M>
-00411     value_type fetch_and_store( value_type value ) {
-00412         return internal::atomic_traits<sizeof(value_type),M>::fetch_and_store(&my_value,word(value))!=0;
-00413     }
-00414 
-00415     value_type fetch_and_store( value_type value ) {
-00416         return fetch_and_store<__TBB_full_fence>(value);
-00417     }
-00418 
-00419     operator value_type() const {
-00420         return __TBB_load_with_acquire(my_value);
-00421     }
-00422 
-00423     value_type operator=( value_type rhs ) {
-00424         __TBB_store_with_release(my_value,rhs);
-00425         return rhs;
-00426     }
-00427 
-00428     atomic<bool>& operator=( const atomic<bool>& rhs ) {
-00429         __TBB_store_with_release(my_value,rhs);
-00430         return *this;
-00431     }
-00432 };
-00433 
-00434 } // namespace tbb
-00435 
-00436 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
-00437     #pragma warning (pop)
-00438 #endif // warnings 4244, 4267 are back
-00439 
-00440 #endif /* __TBB_atomic_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00210.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00210.html deleted file mode 100644 index c32eb516e6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00210.html +++ /dev/null @@ -1,127 +0,0 @@ - - -blocked_range.h Source File - - - - - - -

blocked_range.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_blocked_range_H
-00022 #define __TBB_blocked_range_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 
-00026 namespace tbb {
-00027 
-00037 
-00038 
-00039 template<typename Value>
-00040 class blocked_range {
-00041 public:
-00043 
-00045     typedef Value const_iterator;
-00046 
-00048     typedef std::size_t size_type;
-00049 
-00051 
-00052     blocked_range() : my_begin(), my_end() {}
-00053 
-00055     blocked_range( Value begin_, Value end_, size_type grainsize_=1 ) : 
-00056         my_end(end_), my_begin(begin_), my_grainsize(grainsize_) 
-00057     {
-00058         __TBB_ASSERT( my_grainsize>0, "grainsize must be positive" );
-00059     }
-00060 
-00062     const_iterator begin() const {return my_begin;}
-00063 
-00065     const_iterator end() const {return my_end;}
-00066 
-00068 
-00069     size_type size() const {
-00070         __TBB_ASSERT( !(end()<begin()), "size() unspecified if end()<begin()" );
-00071         return size_type(my_end-my_begin);
-00072     }
-00073 
-00075     size_type grainsize() const {return my_grainsize;}
-00076 
-00077     //------------------------------------------------------------------------
-00078     // Methods that implement Range concept
-00079     //------------------------------------------------------------------------
-00080 
-00082     bool empty() const {return !(my_begin<my_end);}
-00083 
-00085 
-00086     bool is_divisible() const {return my_grainsize<size();}
-00087 
-00089 
-00091     blocked_range( blocked_range& r, split ) : 
-00092         my_end(r.my_end),
-00093         my_begin(do_split(r)),
-00094         my_grainsize(r.my_grainsize)
-00095     {}
-00096 
-00097 private:
-00099     Value my_end;
-00100     Value my_begin;
-00101     size_type my_grainsize;
-00102 
-00104 
-00105     static Value do_split( blocked_range& r ) {
-00106         __TBB_ASSERT( r.is_divisible(), "cannot split blocked_range that is not divisible" );
-00107         Value middle = r.my_begin + (r.my_end-r.my_begin)/2u;
-00108         r.my_end = middle;
-00109         return middle;
-00110     }
-00111 
-00112     template<typename RowValue, typename ColValue>
-00113     friend class blocked_range2d;
-00114 
-00115     template<typename RowValue, typename ColValue, typename PageValue>
-00116     friend class blocked_range3d;
-00117 };
-00118 
-00119 } // namespace tbb 
-00120 
-00121 #endif /* __TBB_blocked_range_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00211.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00211.html deleted file mode 100644 index f6f3f5e367..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00211.html +++ /dev/null @@ -1,113 +0,0 @@ - - -blocked_range2d.h Source File - - - - - - -

blocked_range2d.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_blocked_range2d_H
-00022 #define __TBB_blocked_range2d_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 #include "blocked_range.h"
-00026 
-00027 namespace tbb {
-00028 
-00030 
-00031 template<typename RowValue, typename ColValue=RowValue>
-00032 class blocked_range2d {
-00033 public:
-00035     typedef blocked_range<RowValue> row_range_type;
-00036     typedef blocked_range<ColValue> col_range_type;
-00037  
-00038 private:
-00039     row_range_type my_rows;
-00040     col_range_type my_cols;
-00041 
-00042 public:
-00043 
-00044     blocked_range2d( RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize,
-00045                      ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize ) : 
-00046         my_rows(row_begin,row_end,row_grainsize),
-00047         my_cols(col_begin,col_end,col_grainsize)
-00048     {
-00049     }
-00050 
-00051     blocked_range2d( RowValue row_begin, RowValue row_end,
-00052                      ColValue col_begin, ColValue col_end ) : 
-00053         my_rows(row_begin,row_end),
-00054         my_cols(col_begin,col_end)
-00055     {
-00056     }
-00057 
-00059     bool empty() const {
-00060         // Yes, it is a logical OR here, not AND.
-00061         return my_rows.empty() || my_cols.empty();
-00062     }
-00063 
-00065     bool is_divisible() const {
-00066         return my_rows.is_divisible() || my_cols.is_divisible();
-00067     }
-00068 
-00069     blocked_range2d( blocked_range2d& r, split ) : 
-00070         my_rows(r.my_rows),
-00071         my_cols(r.my_cols)
-00072     {
-00073         if( my_rows.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_rows.grainsize()) ) {
-00074             my_cols.my_begin = col_range_type::do_split(r.my_cols);
-00075         } else {
-00076             my_rows.my_begin = row_range_type::do_split(r.my_rows);
-00077         }
-00078     }
-00079 
-00081     const row_range_type& rows() const {return my_rows;}
-00082 
-00084     const col_range_type& cols() const {return my_cols;}
-00085 };
-00086 
-00087 } // namespace tbb 
-00088 
-00089 #endif /* __TBB_blocked_range2d_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00212.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00212.html deleted file mode 100644 index 7eab7708d1..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00212.html +++ /dev/null @@ -1,131 +0,0 @@ - - -blocked_range3d.h Source File - - - - - - -

blocked_range3d.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_blocked_range3d_H
-00022 #define __TBB_blocked_range3d_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 #include "blocked_range.h"
-00026 
-00027 namespace tbb {
-00028 
-00030 
-00031 template<typename PageValue, typename RowValue=PageValue, typename ColValue=RowValue>
-00032 class blocked_range3d {
-00033 public:
-00035     typedef blocked_range<PageValue> page_range_type;
-00036     typedef blocked_range<RowValue>  row_range_type;
-00037     typedef blocked_range<ColValue>  col_range_type;
-00038  
-00039 private:
-00040     page_range_type my_pages;
-00041     row_range_type  my_rows;
-00042     col_range_type  my_cols;
-00043 
-00044 public:
-00045 
-00046     blocked_range3d( PageValue page_begin, PageValue page_end,
-00047                      RowValue  row_begin,  RowValue row_end,
-00048                      ColValue  col_begin,  ColValue col_end ) : 
-00049         my_pages(page_begin,page_end),
-00050         my_rows(row_begin,row_end),
-00051         my_cols(col_begin,col_end)
-00052     {
-00053     }
-00054 
-00055     blocked_range3d( PageValue page_begin, PageValue page_end, typename page_range_type::size_type page_grainsize, 
-00056                      RowValue  row_begin,  RowValue row_end,   typename row_range_type::size_type row_grainsize,
-00057                      ColValue  col_begin,  ColValue col_end,   typename col_range_type::size_type col_grainsize ) :  
-00058         my_pages(page_begin,page_end,page_grainsize),
-00059         my_rows(row_begin,row_end,row_grainsize),
-00060         my_cols(col_begin,col_end,col_grainsize)
-00061     {
-00062     }
-00063 
-00065     bool empty() const {
-00066         // Yes, it is a logical OR here, not AND.
-00067         return my_pages.empty() || my_rows.empty() || my_cols.empty();
-00068     }
-00069 
-00071     bool is_divisible() const {
-00072         return  my_pages.is_divisible() || my_rows.is_divisible() || my_cols.is_divisible();
-00073     }
-00074 
-00075     blocked_range3d( blocked_range3d& r, split ) : 
-00076         my_pages(r.my_pages),
-00077         my_rows(r.my_rows),
-00078         my_cols(r.my_cols)
-00079     {
-00080         if( my_pages.size()*double(my_rows.grainsize()) < my_rows.size()*double(my_pages.grainsize()) ) {
-00081             if ( my_rows.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_rows.grainsize()) ) {
-00082                 my_cols.my_begin = col_range_type::do_split(r.my_cols);
-00083             } else {
-00084                 my_rows.my_begin = row_range_type::do_split(r.my_rows);
-00085             }
-00086         } else {
-00087             if ( my_pages.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_pages.grainsize()) ) {
-00088                 my_cols.my_begin = col_range_type::do_split(r.my_cols);
-00089             } else {
-00090                     my_pages.my_begin = page_range_type::do_split(r.my_pages);
-00091             }
-00092         }
-00093     }
-00094 
-00096     const page_range_type& pages() const {return my_pages;}
-00097 
-00099     const row_range_type& rows() const {return my_rows;}
-00100 
-00102     const col_range_type& cols() const {return my_cols;}
-00103 
-00104 };
-00105 
-00106 } // namespace tbb 
-00107 
-00108 #endif /* __TBB_blocked_range3d_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00213.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00213.html deleted file mode 100644 index f0abb054b7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00213.html +++ /dev/null @@ -1,143 +0,0 @@ - - -cache_aligned_allocator.h Source File - - - - - - -

cache_aligned_allocator.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_cache_aligned_allocator_H
-00022 #define __TBB_cache_aligned_allocator_H
-00023 
-00024 #include <new>
-00025 #include "tbb_stddef.h"
-00026 
-00027 namespace tbb {
-00028 
-00030 namespace internal {
-00032 
-00035     const size_t NFS_MaxLineSize = 128;
-00036 
-00038 
-00039     size_t __TBB_EXPORTED_FUNC NFS_GetLineSize();
-00040 
-00042 
-00043     void* __TBB_EXPORTED_FUNC NFS_Allocate( size_t n_element, size_t element_size, void* hint );
-00044 
-00046 
-00048     void __TBB_EXPORTED_FUNC NFS_Free( void* );
-00049 }
-00051 
-00052 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00053     // Workaround for erroneous "unreferenced parameter" warning in method destroy.
-00054     #pragma warning (push)
-00055     #pragma warning (disable: 4100)
-00056 #endif
-00057 
-00059 
-00062 template<typename T>
-00063 class cache_aligned_allocator {
-00064 public:
-00065     typedef typename internal::allocator_type<T>::value_type value_type;
-00066     typedef value_type* pointer;
-00067     typedef const value_type* const_pointer;
-00068     typedef value_type& reference;
-00069     typedef const value_type& const_reference;
-00070     typedef size_t size_type;
-00071     typedef ptrdiff_t difference_type;
-00072     template<typename U> struct rebind {
-00073         typedef cache_aligned_allocator<U> other;
-00074     };
-00075 
-00076     cache_aligned_allocator() throw() {}
-00077     cache_aligned_allocator( const cache_aligned_allocator& ) throw() {}
-00078     template<typename U> cache_aligned_allocator(const cache_aligned_allocator<U>&) throw() {}
-00079 
-00080     pointer address(reference x) const {return &x;}
-00081     const_pointer address(const_reference x) const {return &x;}
-00082     
-00084     pointer allocate( size_type n, const void* hint=0 ) {
-00085         // The "hint" argument is always ignored in NFS_Allocate thus const_cast shouldn't hurt
-00086         return pointer(internal::NFS_Allocate( n, sizeof(value_type), const_cast<void*>(hint) ));
-00087     }
-00088 
-00090     void deallocate( pointer p, size_type ) {
-00091         internal::NFS_Free(p);
-00092     }
-00093 
-00095     size_type max_size() const throw() {
-00096         return (~size_t(0)-internal::NFS_MaxLineSize)/sizeof(value_type);
-00097     }
-00098 
-00100     void construct( pointer p, const value_type& value ) {new(static_cast<void*>(p)) value_type(value);}
-00101 
-00103     void destroy( pointer p ) {p->~value_type();}
-00104 };
-00105 
-00106 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00107     #pragma warning (pop)
-00108 #endif // warning 4100 is back
-00109 
-00111 
-00112 template<> 
-00113 class cache_aligned_allocator<void> {
-00114 public:
-00115     typedef void* pointer;
-00116     typedef const void* const_pointer;
-00117     typedef void value_type;
-00118     template<typename U> struct rebind {
-00119         typedef cache_aligned_allocator<U> other;
-00120     };
-00121 };
-00122 
-00123 template<typename T, typename U>
-00124 inline bool operator==( const cache_aligned_allocator<T>&, const cache_aligned_allocator<U>& ) {return true;}
-00125 
-00126 template<typename T, typename U>
-00127 inline bool operator!=( const cache_aligned_allocator<T>&, const cache_aligned_allocator<U>& ) {return false;}
-00128 
-00129 } // namespace tbb
-00130 
-00131 #endif /* __TBB_cache_aligned_allocator_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00215.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00215.html deleted file mode 100644 index 94c218301d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00215.html +++ /dev/null @@ -1,945 +0,0 @@ - - -concurrent_hash_map.h Source File - - - - - - -

concurrent_hash_map.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_concurrent_hash_map_H
-00022 #define __TBB_concurrent_hash_map_H
-00023 
-00024 #include <stdexcept>
-00025 #include <iterator>
-00026 #include <utility>      // Need std::pair
-00027 #include <cstring>      // Need std::memset
-00028 #include <string>
-00029 #include "tbb_stddef.h"
-00030 #include "cache_aligned_allocator.h"
-00031 #include "tbb_allocator.h"
-00032 #include "spin_rw_mutex.h"
-00033 #include "atomic.h"
-00034 #if TBB_USE_PERFORMANCE_WARNINGS
-00035 #include <typeinfo>
-00036 #endif
-00037 
-00038 namespace tbb {
-00039 
-00040 template<typename T> struct tbb_hash_compare;
-00041 template<typename Key, typename T, typename HashCompare = tbb_hash_compare<Key>, typename A = tbb_allocator<std::pair<Key, T> > >
-00042 class concurrent_hash_map;
-00043 
-00045 namespace internal {
-00047     typedef size_t hashcode_t;
-00049     class hash_map_base {
-00050     public:
-00051         // Mutex types for each layer of the container
-00052         typedef spin_rw_mutex node_mutex_t;
-00053         typedef spin_rw_mutex chain_mutex_t;
-00054         typedef spin_rw_mutex segment_mutex_t;
-00055 
-00057         typedef internal::hashcode_t hashcode_t;
-00059         static const size_t n_segment_bits = 6;
-00061         static const size_t n_segment = size_t(1)<<n_segment_bits; 
-00063         static const size_t max_physical_size = size_t(1)<<(8*sizeof(hashcode_t)-n_segment_bits);
-00064     };
-00065 
-00066     template<typename Iterator>
-00067     class hash_map_range;
-00068 
-00069     struct hash_map_segment_base {
-00071         hash_map_base::segment_mutex_t my_mutex;
-00072 
-00073         // Number of nodes
-00074         atomic<size_t> my_logical_size;
-00075 
-00076         // Size of chains
-00078         size_t my_physical_size;
-00079 
-00081 
-00082         bool __TBB_EXPORTED_METHOD internal_grow_predicate() const;
-00083     };
-00084 
-00086 
-00088     template<typename Container, typename Value>
-00089     class hash_map_iterator
-00090         : public std::iterator<std::forward_iterator_tag,Value>
-00091     {
-00092         typedef typename Container::node node;
-00093         typedef typename Container::chain chain;
-00094         typedef typename Container::segment segment;
-00095 
-00097         Container* my_table;
-00098 
-00100         node* my_node;
-00101 
-00103         size_t my_array_index;
-00104 
-00106         size_t my_segment_index;
-00107 
-00108         template<typename C, typename T, typename U>
-00109         friend bool operator==( const hash_map_iterator<C,T>& i, const hash_map_iterator<C,U>& j );
-00110 
-00111         template<typename C, typename T, typename U>
-00112         friend bool operator!=( const hash_map_iterator<C,T>& i, const hash_map_iterator<C,U>& j );
-00113 
-00114         template<typename C, typename T, typename U>
-00115         friend ptrdiff_t operator-( const hash_map_iterator<C,T>& i, const hash_map_iterator<C,U>& j );
-00116     
-00117         template<typename C, typename U>
-00118         friend class internal::hash_map_iterator;
-00119 
-00120         template<typename I>
-00121         friend class internal::hash_map_range;
-00122 
-00123         void advance_to_next_node() {
-00124             size_t i = my_array_index+1;
-00125             do {
-00126                 segment &s = my_table->my_segment[my_segment_index];
-00127                 while( i<s.my_physical_size ) {
-00128                     my_node = s.my_array[i].node_list;
-00129                     if( my_node ) goto done;
-00130                     ++i;
-00131                 }
-00132                 i = 0;
-00133             } while( ++my_segment_index<my_table->n_segment );
-00134         done:
-00135             my_array_index = i;
-00136         }
-00137 #if !defined(_MSC_VER) || defined(__INTEL_COMPILER)
-00138         template<typename Key, typename T, typename HashCompare, typename A>
-00139         friend class tbb::concurrent_hash_map;
-00140 #else
-00141     public: // workaround
-00142 #endif
-00143         hash_map_iterator( const Container& table, size_t segment_index, size_t array_index=0, node* b=NULL );
-00144     public:
-00146         hash_map_iterator() {}
-00147         hash_map_iterator( const hash_map_iterator<Container,typename Container::value_type>& other ) :
-00148             my_table(other.my_table),
-00149             my_node(other.my_node),
-00150             my_array_index(other.my_array_index),
-00151             my_segment_index(other.my_segment_index)
-00152         {}
-00153         Value& operator*() const {
-00154             __TBB_ASSERT( my_node, "iterator uninitialized or at end of container?" );
-00155             return my_node->item;
-00156         }
-00157         Value* operator->() const {return &operator*();}
-00158         hash_map_iterator& operator++();
-00159         
-00161         Value* operator++(int) {
-00162             Value* result = &operator*();
-00163             operator++();
-00164             return result;
-00165         }
-00166     };
-00167 
-00168     template<typename Container, typename Value>
-00169     hash_map_iterator<Container,Value>::hash_map_iterator( const Container& table, size_t segment_index, size_t array_index, node* b ) : 
-00170         my_table(const_cast<Container*>(&table)),
-00171         my_node(b),
-00172         my_array_index(array_index),
-00173         my_segment_index(segment_index)
-00174     {
-00175         if( segment_index<my_table->n_segment ) {
-00176             if( !my_node ) {
-00177                 segment &s = my_table->my_segment[segment_index];
-00178                 chain* first_chain = s.my_array;
-00179                 if( first_chain && my_array_index < s.my_physical_size)
-00180                     my_node = first_chain[my_array_index].node_list;
-00181             }
-00182             if( !my_node ) advance_to_next_node();
-00183         }
-00184     }
-00185 
-00186     template<typename Container, typename Value>
-00187     hash_map_iterator<Container,Value>& hash_map_iterator<Container,Value>::operator++() {
-00188         my_node=my_node->next;
-00189         if( !my_node ) advance_to_next_node();
-00190         return *this;
-00191     }
-00192 
-00193     template<typename Container, typename T, typename U>
-00194     bool operator==( const hash_map_iterator<Container,T>& i, const hash_map_iterator<Container,U>& j ) {
-00195         return i.my_node==j.my_node;
-00196     }
-00197 
-00198     template<typename Container, typename T, typename U>
-00199     bool operator!=( const hash_map_iterator<Container,T>& i, const hash_map_iterator<Container,U>& j ) {
-00200         return i.my_node!=j.my_node;
-00201     }
-00202 
-00204 
-00205     template<typename Iterator>
-00206     class hash_map_range {
-00207     private:
-00208         Iterator my_begin;
-00209         Iterator my_end;
-00210         mutable Iterator my_midpoint;
-00211         size_t my_grainsize;
-00213         void set_midpoint() const;
-00214         template<typename U> friend class hash_map_range;
-00215     public:
-00217         typedef std::size_t size_type;
-00218         typedef typename Iterator::value_type value_type;
-00219         typedef typename Iterator::reference reference;
-00220         typedef typename Iterator::difference_type difference_type;
-00221         typedef Iterator iterator;
-00222 
-00224         bool empty() const {return my_begin==my_end;}
-00225 
-00227         bool is_divisible() const {
-00228             return my_midpoint!=my_end;
-00229         }
-00231         hash_map_range( hash_map_range& r, split ) : 
-00232             my_end(r.my_end),
-00233             my_grainsize(r.my_grainsize)
-00234         {
-00235             r.my_end = my_begin = r.my_midpoint;
-00236             __TBB_ASSERT( my_begin!=my_end, "Splitting despite the range is not divisible" );
-00237             __TBB_ASSERT( r.my_begin!=r.my_end, "Splitting despite the range is not divisible" );
-00238             set_midpoint();
-00239             r.set_midpoint();
-00240         }
-00242         template<typename U>
-00243         hash_map_range( hash_map_range<U>& r) : 
-00244             my_begin(r.my_begin),
-00245             my_end(r.my_end),
-00246             my_midpoint(r.my_midpoint),
-00247             my_grainsize(r.my_grainsize)
-00248         {}
-00250         hash_map_range( const Iterator& begin_, const Iterator& end_, size_type grainsize = 1 ) : 
-00251             my_begin(begin_), 
-00252             my_end(end_), 
-00253             my_grainsize(grainsize) 
-00254         {
-00255             set_midpoint();
-00256             __TBB_ASSERT( grainsize>0, "grainsize must be positive" );
-00257         }
-00258         const Iterator& begin() const {return my_begin;}
-00259         const Iterator& end() const {return my_end;}
-00261         size_type grainsize() const {return my_grainsize;}
-00262     };
-00263 
-00264     template<typename Iterator>
-00265     void hash_map_range<Iterator>::set_midpoint() const {
-00266         size_t n = my_end.my_segment_index - my_begin.my_segment_index;
-00267         if( n > 1 || (n == 1 && my_end.my_array_index > my_grainsize/2) ) {
-00268             // Split by groups of segments
-00269             my_midpoint = Iterator(*my_begin.my_table,(my_end.my_segment_index+my_begin.my_segment_index+1)/2u);
-00270         } else {
-00271             // Split by groups of nodes
-00272             size_t m = my_end.my_array_index-my_begin.my_array_index;
-00273             if( n ) m += my_begin.my_table->my_segment[my_begin.my_segment_index].my_physical_size;
-00274             if( m > my_grainsize ) {
-00275                 my_midpoint = Iterator(*my_begin.my_table,my_begin.my_segment_index,my_begin.my_array_index + m/2u);
-00276             } else {
-00277                 my_midpoint = my_end;
-00278             }
-00279         }
-00280         __TBB_ASSERT( my_begin.my_segment_index < my_midpoint.my_segment_index
-00281             || (my_begin.my_segment_index == my_midpoint.my_segment_index
-00282             && my_begin.my_array_index <= my_midpoint.my_array_index),
-00283             "my_begin is after my_midpoint" );
-00284         __TBB_ASSERT( my_midpoint.my_segment_index < my_end.my_segment_index
-00285             || (my_midpoint.my_segment_index == my_end.my_segment_index
-00286             && my_midpoint.my_array_index <= my_end.my_array_index),
-00287             "my_midpoint is after my_end" );
-00288         __TBB_ASSERT( my_begin != my_midpoint || my_begin == my_end,
-00289             "[my_begin, my_midpoint) range should not be empty" );
-00290     }
-00292     static const hashcode_t hash_multiplier = sizeof(hashcode_t)==4? 2654435769U : 11400714819323198485ULL;
-00294     template<typename T>
-00295     inline static hashcode_t hasher( const T& t ) {
-00296         return static_cast<hashcode_t>( t ) * hash_multiplier;
-00297     }
-00298     template<typename P>
-00299     inline static hashcode_t hasher( P* ptr ) {
-00300         hashcode_t const h = reinterpret_cast<hashcode_t>( ptr );
-00301         return (h >> 3) ^ h;
-00302     }
-00303     template<typename E, typename S, typename A>
-00304     inline static hashcode_t hasher( const std::basic_string<E,S,A>& s ) {
-00305         hashcode_t h = 0;
-00306         for( const E* c = s.c_str(); *c; c++ )
-00307             h = static_cast<hashcode_t>(*c) ^ (h * hash_multiplier);
-00308         return h;
-00309     }
-00310     template<typename F, typename S>
-00311     inline static hashcode_t hasher( const std::pair<F,S>& p ) {
-00312         return hasher(p.first) ^ hasher(p.second);
-00313     }
-00314 } // namespace internal
-00316 
-00318 template<typename T>
-00319 struct tbb_hash_compare {
-00320     static internal::hashcode_t hash( const T& t ) { return internal::hasher(t); }
-00321     static bool equal( const T& a, const T& b ) { return a == b; }
-00322 };
-00323 
-00325 
-00350 template<typename Key, typename T, typename HashCompare, typename A>
-00351 class concurrent_hash_map : protected internal::hash_map_base {
-00352     template<typename Container, typename Value>
-00353     friend class internal::hash_map_iterator;
-00354 
-00355     template<typename I>
-00356     friend class internal::hash_map_range;
-00357 
-00358     struct node;
-00359     friend struct node;
-00360     typedef typename A::template rebind<node>::other node_allocator_type;
-00361 
-00362 public:
-00363     class const_accessor;
-00364     friend class const_accessor;
-00365     class accessor;
-00366 
-00367     typedef Key key_type;
-00368     typedef T mapped_type;
-00369     typedef std::pair<const Key,T> value_type;
-00370     typedef size_t size_type;
-00371     typedef ptrdiff_t difference_type;
-00372     typedef value_type *pointer;
-00373     typedef const value_type *const_pointer;
-00374     typedef value_type &reference;
-00375     typedef const value_type &const_reference;
-00376     typedef internal::hash_map_iterator<concurrent_hash_map,value_type> iterator;
-00377     typedef internal::hash_map_iterator<concurrent_hash_map,const value_type> const_iterator;
-00378     typedef internal::hash_map_range<iterator> range_type;
-00379     typedef internal::hash_map_range<const_iterator> const_range_type;
-00380     typedef A allocator_type;
-00381 
-00383     class const_accessor {
-00384         friend class concurrent_hash_map<Key,T,HashCompare,A>;
-00385         friend class accessor;
-00386         void operator=( const accessor& ) const; // Deny access
-00387         const_accessor( const accessor& );       // Deny access
-00388     public:
-00390         typedef const std::pair<const Key,T> value_type;
-00391 
-00393         bool empty() const {return !my_node;}
-00394 
-00396         void release() {
-00397             if( my_node ) {
-00398                 my_lock.release();
-00399                 my_node = NULL;
-00400             }
-00401         }
-00402 
-00404         const_reference operator*() const {
-00405             __TBB_ASSERT( my_node, "attempt to dereference empty accessor" );
-00406             return my_node->item;
-00407         }
-00408 
-00410         const_pointer operator->() const {
-00411             return &operator*();
-00412         }
-00413 
-00415         const_accessor() : my_node(NULL) {}
-00416 
-00418         ~const_accessor() {
-00419             my_node = NULL; // my_lock.release() is called in scoped_lock destructor
-00420         }
-00421     private:
-00422         node* my_node;
-00423         node_mutex_t::scoped_lock my_lock;
-00424         hashcode_t my_hash;
-00425     };
-00426 
-00428     class accessor: public const_accessor {
-00429     public:
-00431         typedef std::pair<const Key,T> value_type;
-00432 
-00434         reference operator*() const {
-00435             __TBB_ASSERT( this->my_node, "attempt to dereference empty accessor" );
-00436             return this->my_node->item;
-00437         }
-00438 
-00440         pointer operator->() const {
-00441             return &operator*();
-00442         }       
-00443     };
-00444 
-00446     concurrent_hash_map(const allocator_type &a = allocator_type())
-00447         : my_allocator(a)
-00448 
-00449     {
-00450         initialize();
-00451     }
-00452 
-00454     concurrent_hash_map( const concurrent_hash_map& table, const allocator_type &a = allocator_type())
-00455         : my_allocator(a)
-00456     {
-00457         initialize();
-00458         internal_copy(table);
-00459     }
-00460 
-00462     template<typename I>
-00463     concurrent_hash_map(I first, I last, const allocator_type &a = allocator_type())
-00464         : my_allocator(a)
-00465     {
-00466         initialize();
-00467         internal_copy(first, last);
-00468     }
-00469 
-00471     concurrent_hash_map& operator=( const concurrent_hash_map& table ) {
-00472         if( this!=&table ) {
-00473             clear();
-00474             internal_copy(table);
-00475         } 
-00476         return *this;
-00477     }
-00478 
-00479 
-00481     void clear();
-00482 
-00484     ~concurrent_hash_map();
-00485 
-00486     //------------------------------------------------------------------------
-00487     // Parallel algorithm support
-00488     //------------------------------------------------------------------------
-00489     range_type range( size_type grainsize=1 ) {
-00490         return range_type( begin(), end(), grainsize );
-00491     }
-00492     const_range_type range( size_type grainsize=1 ) const {
-00493         return const_range_type( begin(), end(), grainsize );
-00494     }
-00495 
-00496     //------------------------------------------------------------------------
-00497     // STL support - not thread-safe methods
-00498     //------------------------------------------------------------------------
-00499     iterator begin() {return iterator(*this,0);}
-00500     iterator end() {return iterator(*this,n_segment);}
-00501     const_iterator begin() const {return const_iterator(*this,0);}
-00502     const_iterator end() const {return const_iterator(*this,n_segment);}
-00503     std::pair<iterator, iterator> equal_range( const Key& key ) { return internal_equal_range(key, end()); }
-00504     std::pair<const_iterator, const_iterator> equal_range( const Key& key ) const { return internal_equal_range(key, end()); }
-00505     
-00507 
-00509     size_type size() const;
-00510 
-00512     bool empty() const;
-00513 
-00515     size_type max_size() const {return (~size_type(0))/sizeof(node);}
-00516 
-00518     allocator_type get_allocator() const { return this->my_allocator; }
-00519 
-00521     void swap(concurrent_hash_map &table);
-00522 
-00523     //------------------------------------------------------------------------
-00524     // concurrent map operations
-00525     //------------------------------------------------------------------------
-00526 
-00528     size_type count( const Key& key ) const {
-00529         return const_cast<concurrent_hash_map*>(this)->lookup</*insert*/false>(NULL, key, /*write=*/false, NULL );
-00530     }
-00531 
-00533 
-00534     bool find( const_accessor& result, const Key& key ) const {
-00535         return const_cast<concurrent_hash_map*>(this)->lookup</*insert*/false>(&result, key, /*write=*/false, NULL );
-00536     }
-00537 
-00539 
-00540     bool find( accessor& result, const Key& key ) {
-00541         return lookup</*insert*/false>(&result, key, /*write=*/true, NULL );
-00542     }
-00543         
-00545 
-00546     bool insert( const_accessor& result, const Key& key ) {
-00547         return lookup</*insert*/true>(&result, key, /*write=*/false, NULL );
-00548     }
-00549 
-00551 
-00552     bool insert( accessor& result, const Key& key ) {
-00553         return lookup</*insert*/true>(&result, key, /*write=*/true, NULL );
-00554     }
-00555 
-00557 
-00558     bool insert( const_accessor& result, const value_type& value ) {
-00559         return lookup</*insert*/true>(&result, value.first, /*write=*/false, &value.second );
-00560     }
-00561 
-00563 
-00564     bool insert( accessor& result, const value_type& value ) {
-00565         return lookup</*insert*/true>(&result, value.first, /*write=*/true, &value.second );
-00566     }
-00567 
-00569 
-00570     bool insert( const value_type& value ) {
-00571         return lookup</*insert*/true>(NULL, value.first, /*write=*/false, &value.second );
-00572     }
-00573 
-00575     template<typename I>
-00576     void insert(I first, I last) {
-00577         for(; first != last; ++first)
-00578             insert( *first );
-00579     }
-00580 
-00582 
-00583     bool erase( const Key& key );
-00584 
-00586 
-00587     bool erase( const_accessor& item_accessor ) {
-00588         return exclude( item_accessor, /*readonly=*/ true );
-00589     }
-00590 
-00592 
-00593     bool erase( accessor& item_accessor ) {
-00594         return exclude( item_accessor, /*readonly=*/ false );
-00595     }
-00596 
-00597 private:
-00599     struct node: internal::no_copy {
-00601         node* next;
-00602         node_mutex_t mutex;
-00603         value_type item;
-00604         node( const Key& key ) : item(key, T()) {}
-00605         node( const Key& key, const T& t ) : item(key, t) {}
-00606         // exception-safe allocation, see C++ Standard 2003, clause 5.3.4p17
-00607         void* operator new( size_t /*size*/, node_allocator_type& a ) {
-00608             void *ptr = a.allocate(1);
-00609             if(!ptr) throw std::bad_alloc();
-00610             return ptr;
-00611         }
-00612         // match placement-new form above to be called if exception thrown in constructor
-00613         void operator delete( void* ptr, node_allocator_type& a ) {return a.deallocate(static_cast<node*>(ptr),1); }
-00614     };
-00615 
-00616     struct chain;
-00617     friend struct chain;
-00618 
-00620 
-00621     struct chain {
-00622         void push_front( node& b ) {
-00623             b.next = node_list;
-00624             node_list = &b;
-00625         }
-00626         chain_mutex_t mutex;
-00627         node* node_list;
-00628     };
-00629 
-00630     struct segment;
-00631     friend struct segment;
-00632 
-00634 
-00636     struct segment: internal::hash_map_segment_base {
-00637 #if TBB_USE_ASSERT
-00638         ~segment() {
-00639             __TBB_ASSERT( !my_array, "should have been cleared earlier" );
-00640         }
-00641 #endif /* TBB_USE_ASSERT */
-00642 
-00643         // Pointer to array of chains
-00644         chain* my_array;
-00645 
-00646         // Get chain in this segment that corresponds to given hash code.
-00647         chain& get_chain( hashcode_t hashcode, size_t n_segment_bits ) {
-00648             return my_array[(hashcode>>n_segment_bits)&(my_physical_size-1)];
-00649         }
-00650      
-00652 
-00654         void allocate_array( size_t new_size ) {
-00655             size_t n=(internal::NFS_GetLineSize()+sizeof(chain)-1)/sizeof(chain);
-00656             __TBB_ASSERT((n&(n-1))==0, NULL);
-00657             while( n<new_size ) n<<=1;
-00658             chain* array = cache_aligned_allocator<chain>().allocate( n );
-00659             // storing earlier might help overcome false positives of in deducing "bool grow" in concurrent threads
-00660             __TBB_store_with_release(my_physical_size, n);
-00661             std::memset( array, 0, n*sizeof(chain) );
-00662             my_array = array;
-00663         }
-00664     };
-00665 
-00666     segment& get_segment( hashcode_t hashcode ) {
-00667         return my_segment[hashcode&(n_segment-1)];
-00668     }
-00669 
-00670     node_allocator_type my_allocator;
-00671 
-00672     HashCompare my_hash_compare;
-00673 
-00674     segment* my_segment;
-00675 
-00676     node* create_node(const Key& key, const T* t) {
-00677         // exception-safe allocation and construction
-00678         if(t) return new( my_allocator ) node(key, *t);
-00679         else  return new( my_allocator ) node(key);
-00680     }
-00681 
-00682     void delete_node(node* b) {
-00683         my_allocator.destroy(b);
-00684         my_allocator.deallocate(b, 1);
-00685     }
-00686 
-00687     node* search_list( const Key& key, chain& c ) const {
-00688         node* b = c.node_list;
-00689         while( b && !my_hash_compare.equal(key, b->item.first) )
-00690             b = b->next;
-00691         return b;
-00692     }
-00694     template<typename I>
-00695     std::pair<I, I> internal_equal_range( const Key& key, I end ) const;
-00696 
-00698     bool exclude( const_accessor& item_accessor, bool readonly );
-00699 
-00701     void grow_segment( segment_mutex_t::scoped_lock& segment_lock, segment& s );
-00702 
-00704     template<bool op_insert>
-00705     bool lookup( const_accessor* result, const Key& key, bool write, const T* t );
-00706 
-00708     void initialize() {
-00709         my_segment = cache_aligned_allocator<segment>().allocate(n_segment);
-00710         std::memset( my_segment, 0, sizeof(segment)*n_segment );
-00711      }
-00712 
-00714     void internal_copy( const concurrent_hash_map& source );
-00715 
-00716     template<typename I>
-00717     void internal_copy(I first, I last);
-00718 };
-00719 
-00720 template<typename Key, typename T, typename HashCompare, typename A>
-00721 concurrent_hash_map<Key,T,HashCompare,A>::~concurrent_hash_map() {
-00722     clear();
-00723     cache_aligned_allocator<segment>().deallocate( my_segment, n_segment );
-00724 }
-00725 
-00726 template<typename Key, typename T, typename HashCompare, typename A>
-00727 typename concurrent_hash_map<Key,T,HashCompare,A>::size_type concurrent_hash_map<Key,T,HashCompare,A>::size() const {
-00728     size_type result = 0;
-00729     for( size_t k=0; k<n_segment; ++k )
-00730         result += my_segment[k].my_logical_size;
-00731     return result;
-00732 }
-00733 
-00734 template<typename Key, typename T, typename HashCompare, typename A>
-00735 bool concurrent_hash_map<Key,T,HashCompare,A>::empty() const {
-00736     for( size_t k=0; k<n_segment; ++k )
-00737         if( my_segment[k].my_logical_size )
-00738             return false;
-00739     return true;
-00740 }
-00741 
-00742 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00743     // Suppress "conditional expression is constant" warning.
-00744     #pragma warning( push )
-00745     #pragma warning( disable: 4127 )
-00746 #endif
-00747 
-00748 template<typename Key, typename T, typename HashCompare, typename A>
-00749 template<bool op_insert>
-00750 bool concurrent_hash_map<Key,T,HashCompare,A>::lookup( const_accessor* result, const Key& key, bool write, const T* t ) {
-00751     if( result )
-00752         result->release();
-00753     const hashcode_t h = my_hash_compare.hash( key );
-00754     segment& s = get_segment(h);
-00755 restart:
-00756     bool return_value = false;
-00757     // first check in double-check sequence
-00758 #if TBB_USE_THREADING_TOOLS
-00759     bool grow = op_insert && s.internal_grow_predicate();
-00760 #else
-00761     bool grow = op_insert && s.my_logical_size >= s.my_physical_size
-00762         && s.my_physical_size < max_physical_size; // check whether there are free bits
-00763 #endif /* TBB_USE_THREADING_TOOLS */
-00764     segment_mutex_t::scoped_lock segment_lock( s.my_mutex, /*write=*/grow );
-00765     if( grow ) { // Load factor is too high  
-00766         grow_segment( segment_lock, s );
-00767     }
-00768     if( !s.my_array ) {
-00769         __TBB_ASSERT( !op_insert, NULL );
-00770         return false;
-00771     }
-00772     __TBB_ASSERT( (s.my_physical_size&(s.my_physical_size-1))==0, NULL );
-00773     chain& c = s.get_chain( h, n_segment_bits );
-00774     chain_mutex_t::scoped_lock chain_lock( c.mutex, /*write=*/false );
-00775 
-00776     node* b = search_list( key, c );
-00777     if( op_insert ) {
-00778         if( !b ) {
-00779             b = create_node(key, t);
-00780             // Search failed
-00781             if( !chain_lock.upgrade_to_writer() ) {
-00782                 // Rerun search_list, in case another thread inserted the item during the upgrade.
-00783                 node* b_temp = search_list( key, c );
-00784                 if( b_temp ) { // unfortunately, it did
-00785                     chain_lock.downgrade_to_reader();
-00786                     delete_node( b );
-00787                     b = b_temp;
-00788                     goto done;
-00789                 }
-00790             }
-00791             ++s.my_logical_size; // we can't change it earlier due to correctness of size() and exception safety of equal()
-00792             return_value = true;
-00793             c.push_front( *b );
-00794         }
-00795     } else { // find or count
-00796         if( !b )      return false;
-00797         return_value = true;
-00798     }
-00799 done:
-00800     if( !result ) return return_value;
-00801     if( !result->my_lock.try_acquire( b->mutex, write ) ) {
-00802         // we are unlucky, prepare for longer wait
-00803         internal::AtomicBackoff trials;
-00804         do {
-00805             if( !trials.bounded_pause() ) {
-00806                 // the wait takes really long, restart the operation
-00807                 chain_lock.release(); segment_lock.release();
-00808                 __TBB_Yield();
-00809                 goto restart;
-00810             }
-00811         } while( !result->my_lock.try_acquire( b->mutex, write ) );
-00812     }
-00813     result->my_node = b;
-00814     result->my_hash = h;
-00815     return return_value;
-00816 }
-00817 
-00818 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00819     #pragma warning( pop )
-00820 #endif // warning 4127 is back
-00821 
-00822 template<typename Key, typename T, typename HashCompare, typename A>
-00823 template<typename I>
-00824 std::pair<I, I> concurrent_hash_map<Key,T,HashCompare,A>::internal_equal_range( const Key& key, I end ) const {
-00825     hashcode_t h = my_hash_compare.hash( key );
-00826     size_t segment_index = h&(n_segment-1);
-00827     segment& s = my_segment[segment_index ];
-00828     size_t chain_index = (h>>n_segment_bits)&(s.my_physical_size-1);
-00829     if( !s.my_array )
-00830         return std::make_pair(end, end);
-00831     chain& c = s.my_array[chain_index];
-00832     node* b = search_list( key, c );
-00833     if( !b )
-00834         return std::make_pair(end, end);
-00835     iterator lower(*this, segment_index, chain_index, b), upper(lower);
-00836     return std::make_pair(lower, ++upper);
-00837 }
-00838 
-00839 template<typename Key, typename T, typename HashCompare, typename A>
-00840 bool concurrent_hash_map<Key,T,HashCompare,A>::erase( const Key &key ) {
-00841     hashcode_t h = my_hash_compare.hash( key );
-00842     segment& s = get_segment( h );
-00843     node* b=NULL; // explicitly initialized to prevent compiler warnings
-00844     {
-00845         bool chain_locked_for_write = false;
-00846         segment_mutex_t::scoped_lock segment_lock( s.my_mutex, /*write=*/false );
-00847         if( !s.my_array ) return false;
-00848         __TBB_ASSERT( (s.my_physical_size&(s.my_physical_size-1))==0, NULL );
-00849         chain& c = s.get_chain( h, n_segment_bits );
-00850         chain_mutex_t::scoped_lock chain_lock( c.mutex, /*write=*/false );
-00851     search:
-00852         node** p = &c.node_list;
-00853         b = *p;
-00854         while( b && !my_hash_compare.equal(key, b->item.first ) ) {
-00855             p = &b->next;
-00856             b = *p;
-00857         }
-00858         if( !b ) return false;
-00859         if( !chain_locked_for_write && !chain_lock.upgrade_to_writer() ) {
-00860             chain_locked_for_write = true;
-00861             goto search;
-00862         }
-00863         *p = b->next;
-00864         --s.my_logical_size;
-00865     }
-00866     {
-00867         node_mutex_t::scoped_lock item_locker( b->mutex, /*write=*/true );
-00868     }
-00869     // note: there should be no threads pretending to acquire this mutex again, do not try to upgrade const_accessor!
-00870     delete_node( b ); // Only one thread can delete it due to write lock on the chain_mutex
-00871     return true;        
-00872 }
-00873 
-00874 template<typename Key, typename T, typename HashCompare, typename A>
-00875 bool concurrent_hash_map<Key,T,HashCompare,A>::exclude( const_accessor &item_accessor, bool readonly ) {
-00876     __TBB_ASSERT( item_accessor.my_node, NULL );
-00877     const hashcode_t h = item_accessor.my_hash;
-00878     node *const b = item_accessor.my_node;
-00879     item_accessor.my_node = NULL; // we ought release accessor anyway
-00880     segment& s = get_segment( h );
-00881     {
-00882         segment_mutex_t::scoped_lock segment_lock( s.my_mutex, /*write=*/false );
-00883         __TBB_ASSERT( s.my_array, NULL );
-00884         __TBB_ASSERT( (s.my_physical_size&(s.my_physical_size-1))==0, NULL );
-00885         chain& c = s.get_chain( h, n_segment_bits );
-00886         chain_mutex_t::scoped_lock chain_lock( c.mutex, /*write=*/true );
-00887         node** p = &c.node_list;
-00888         while( *p && *p != b )
-00889             p = &(*p)->next;
-00890         if( !*p ) { // someone else was the first
-00891             item_accessor.my_lock.release();
-00892             return false;
-00893         }
-00894         __TBB_ASSERT( *p == b, NULL );
-00895         *p = b->next;
-00896         --s.my_logical_size;
-00897     }
-00898     if( readonly ) // need to get exclusive lock
-00899         item_accessor.my_lock.upgrade_to_writer(); // return value means nothing here
-00900     item_accessor.my_lock.release();
-00901     delete_node( b ); // Only one thread can delete it due to write lock on the chain_mutex
-00902     return true;
-00903 }
-00904 
-00905 template<typename Key, typename T, typename HashCompare, typename A>
-00906 void concurrent_hash_map<Key,T,HashCompare,A>::swap(concurrent_hash_map<Key,T,HashCompare,A> &table) {
-00907     std::swap(this->my_allocator, table.my_allocator);
-00908     std::swap(this->my_hash_compare, table.my_hash_compare);
-00909     std::swap(this->my_segment, table.my_segment);
-00910 }
-00911 
-00912 template<typename Key, typename T, typename HashCompare, typename A>
-00913 void concurrent_hash_map<Key,T,HashCompare,A>::clear() {
-00914 #if TBB_USE_PERFORMANCE_WARNINGS
-00915     size_t total_physical_size = 0, min_physical_size = size_t(-1L), max_physical_size = 0; //< usage statistics
-00916     static bool reported = false;
-00917 #endif
-00918     for( size_t i=0; i<n_segment; ++i ) {
-00919         segment& s = my_segment[i];
-00920         size_t n = s.my_physical_size;
-00921         if( chain* array = s.my_array ) {
-00922             s.my_array = NULL;
-00923             s.my_physical_size = 0;
-00924             s.my_logical_size = 0;
-00925             for( size_t j=0; j<n; ++j ) {
-00926                 while( node* b = array[j].node_list ) {
-00927                     array[j].node_list = b->next;
-00928                     delete_node(b);
-00929                 }
-00930             }
-00931             cache_aligned_allocator<chain>().deallocate( array, n );
-00932         }
-00933 #if TBB_USE_PERFORMANCE_WARNINGS
-00934         total_physical_size += n;
-00935         if(min_physical_size > n) min_physical_size = n;
-00936         if(max_physical_size < n) max_physical_size = n;
-00937     }
-00938     if( !reported
-00939         && ( (total_physical_size >= n_segment*48 && min_physical_size < total_physical_size/n_segment/2)
-00940          || (total_physical_size >= n_segment*128 && max_physical_size > total_physical_size/n_segment*2) ) )
-00941     {
-00942         reported = true;
-00943         internal::runtime_warning(
-00944             "Performance is not optimal because the hash function produces bad randomness in lower bits in %s",
-00945             typeid(*this).name() );
-00946 #endif
-00947     }
-00948 }
-00949 
-00950 template<typename Key, typename T, typename HashCompare, typename A>
-00951 void concurrent_hash_map<Key,T,HashCompare,A>::grow_segment( segment_mutex_t::scoped_lock& segment_lock, segment& s ) {
-00952     // Following is second check in a double-check.
-00953     if( s.my_logical_size >= s.my_physical_size ) {
-00954         chain* old_array = s.my_array;
-00955         size_t old_size = s.my_physical_size;
-00956         s.allocate_array( s.my_logical_size+1 );
-00957         for( size_t k=0; k<old_size; ++k )
-00958             while( node* b = old_array[k].node_list ) {
-00959                 old_array[k].node_list = b->next;
-00960                 hashcode_t h = my_hash_compare.hash( b->item.first );
-00961                 __TBB_ASSERT( &get_segment(h)==&s, "hash function changed?" );
-00962                 s.get_chain(h,n_segment_bits).push_front(*b);
-00963             }
-00964         cache_aligned_allocator<chain>().deallocate( old_array, old_size );
-00965     }
-00966     segment_lock.downgrade_to_reader();
-00967 }
-00968 
-00969 template<typename Key, typename T, typename HashCompare, typename A>
-00970 void concurrent_hash_map<Key,T,HashCompare,A>::internal_copy( const concurrent_hash_map& source ) {
-00971     for( size_t i=0; i<n_segment; ++i ) {
-00972         segment& s = source.my_segment[i];
-00973         __TBB_ASSERT( !my_segment[i].my_array, "caller should have cleared" );
-00974         if( s.my_logical_size ) {
-00975             segment& d = my_segment[i];
-00976             d.allocate_array( s.my_logical_size );
-00977             d.my_logical_size = s.my_logical_size;
-00978             size_t s_size = s.my_physical_size;
-00979             chain* s_array = s.my_array;
-00980             chain* d_array = d.my_array;
-00981             for( size_t k=0; k<s_size; ++k )
-00982                 for( node* b = s_array[k].node_list; b; b=b->next ) {
-00983                     __TBB_ASSERT( &get_segment(my_hash_compare.hash( b->item.first ))==&d, "hash function changed?" );
-00984                     node* b_new = create_node(b->item.first, &b->item.second);
-00985                     d_array[k].push_front(*b_new); // hashcode is the same and segment and my_physical sizes are the same
-00986                 }
-00987         }
-00988     }
-00989 }
-00990 
-00991 template<typename Key, typename T, typename HashCompare, typename A>
-00992 template<typename I>
-00993 void concurrent_hash_map<Key,T,HashCompare,A>::internal_copy(I first, I last) {
-00994     for(; first != last; ++first)
-00995         insert( *first );
-00996 }
-00997 
-00998 template<typename Key, typename T, typename HashCompare, typename A1, typename A2>
-00999 inline bool operator==(const concurrent_hash_map<Key, T, HashCompare, A1> &a, const concurrent_hash_map<Key, T, HashCompare, A2> &b) {
-01000     if(a.size() != b.size()) return false;
-01001     typename concurrent_hash_map<Key, T, HashCompare, A1>::const_iterator i(a.begin()), i_end(a.end());
-01002     typename concurrent_hash_map<Key, T, HashCompare, A2>::const_iterator j, j_end(b.end());
-01003     for(; i != i_end; ++i) {
-01004         j = b.equal_range(i->first).first;
-01005         if( j == j_end || !(i->second == j->second) ) return false;
-01006     }
-01007     return true;
-01008 }
-01009 
-01010 template<typename Key, typename T, typename HashCompare, typename A1, typename A2>
-01011 inline bool operator!=(const concurrent_hash_map<Key, T, HashCompare, A1> &a, const concurrent_hash_map<Key, T, HashCompare, A2> &b)
-01012 {    return !(a == b); }
-01013 
-01014 template<typename Key, typename T, typename HashCompare, typename A>
-01015 inline void swap(concurrent_hash_map<Key, T, HashCompare, A> &a, concurrent_hash_map<Key, T, HashCompare, A> &b)
-01016 {    a.swap( b ); }
-01017 
-01018 } // namespace tbb
-01019 
-01020 #endif /* __TBB_concurrent_hash_map_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00223.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00223.html deleted file mode 100644 index ed644894f9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00223.html +++ /dev/null @@ -1,363 +0,0 @@ - - -concurrent_queue.h Source File - - - - - - -

concurrent_queue.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_concurrent_queue_H
-00022 #define __TBB_concurrent_queue_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 #include "cache_aligned_allocator.h"
-00026 #include <iterator>
-00027 #include <new>
-00028 
-00029 namespace tbb {
-00030 
-00031 template<typename T, class A = cache_aligned_allocator<T> > 
-00032 class concurrent_queue;
-00033 
-00035 namespace internal {
-00036 
-00037 class concurrent_queue_rep;
-00038 class concurrent_queue_iterator_rep;
-00039 class concurrent_queue_iterator_base_v3;
-00040 template<typename Container, typename Value> class concurrent_queue_iterator;
-00041 
-00043 
-00045 class concurrent_queue_base_v3: no_copy {
-00047     concurrent_queue_rep* my_rep;
-00048 
-00049     friend class concurrent_queue_rep;
-00050     friend struct micro_queue;
-00051     friend class micro_queue_pop_finalizer;
-00052     friend class concurrent_queue_iterator_rep;
-00053     friend class concurrent_queue_iterator_base_v3;
-00054 protected:
-00056     struct page {
-00057         page* next;
-00058         uintptr mask; 
-00059     };
-00060 
-00062     ptrdiff_t my_capacity;
-00063    
-00065     size_t items_per_page;
-00066 
-00068     size_t item_size;
-00069 
-00070 private:
-00071     virtual void copy_item( page& dst, size_t index, const void* src ) = 0;
-00072     virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) = 0;
-00073 protected:
-00074     __TBB_EXPORTED_METHOD concurrent_queue_base_v3( size_t item_size );
-00075     virtual __TBB_EXPORTED_METHOD ~concurrent_queue_base_v3();
-00076 
-00078     void __TBB_EXPORTED_METHOD internal_push( const void* src );
-00079 
-00081     void __TBB_EXPORTED_METHOD internal_pop( void* dst );
-00082 
-00084     bool __TBB_EXPORTED_METHOD internal_push_if_not_full( const void* src );
-00085 
-00087 
-00088     bool __TBB_EXPORTED_METHOD internal_pop_if_present( void* dst );
-00089 
-00091     ptrdiff_t __TBB_EXPORTED_METHOD internal_size() const;
-00092 
-00094     void __TBB_EXPORTED_METHOD internal_set_capacity( ptrdiff_t capacity, size_t element_size );
-00095 
-00097     virtual page *allocate_page() = 0;
-00098 
-00100     virtual void deallocate_page( page *p ) = 0;
-00101 
-00103     /* note that the name may be misleading, but it remains so due to a historical accident. */
-00104     void __TBB_EXPORTED_METHOD internal_finish_clear() ;
-00105 
-00107     void __TBB_EXPORTED_METHOD internal_throw_exception() const;
-00108 
-00110     void __TBB_EXPORTED_METHOD assign( const concurrent_queue_base_v3& src ) ;
-00111 
-00112 private:
-00113     virtual void copy_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) = 0;
-00114 };
-00115 
-00116 typedef concurrent_queue_base_v3 concurrent_queue_base ;
-00117 
-00119 
-00120 class concurrent_queue_iterator_base_v3 {
-00122 
-00123     concurrent_queue_iterator_rep* my_rep;
-00124 
-00125     template<typename C, typename T, typename U>
-00126     friend bool operator==( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j );
-00127 
-00128     template<typename C, typename T, typename U>
-00129     friend bool operator!=( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j );
-00130 protected:
-00132     mutable void* my_item;
-00133 
-00135     concurrent_queue_iterator_base_v3() : my_rep(NULL), my_item(NULL) {}
-00136 
-00138     concurrent_queue_iterator_base_v3( const concurrent_queue_iterator_base_v3& i ) : my_rep(NULL), my_item(NULL) {
-00139         assign(i);
-00140     }
-00141 
-00143     __TBB_EXPORTED_METHOD concurrent_queue_iterator_base_v3( const concurrent_queue_base& queue );
-00144 
-00146     void __TBB_EXPORTED_METHOD assign( const concurrent_queue_iterator_base_v3& i );
-00147 
-00149     void __TBB_EXPORTED_METHOD advance();
-00150 
-00152     __TBB_EXPORTED_METHOD ~concurrent_queue_iterator_base_v3();
-00153 };
-00154 
-00155 typedef concurrent_queue_iterator_base_v3 concurrent_queue_iterator_base;
-00156 
-00158 
-00160 template<typename Container, typename Value>
-00161 class concurrent_queue_iterator: public concurrent_queue_iterator_base,
-00162         public std::iterator<std::forward_iterator_tag,Value> {
-00163 #if !defined(_MSC_VER) || defined(__INTEL_COMPILER)
-00164     template<typename T, class A>
-00165     friend class ::tbb::concurrent_queue;
-00166 #else
-00167 public: // workaround for MSVC
-00168 #endif 
-00170     concurrent_queue_iterator( const concurrent_queue_base& queue ) :
-00171         concurrent_queue_iterator_base_v3(queue)
-00172     {
-00173     }
-00174 public:
-00175     concurrent_queue_iterator() {}
-00176 
-00179     concurrent_queue_iterator( const concurrent_queue_iterator<Container,typename Container::value_type>& other ) :
-00180         concurrent_queue_iterator_base_v3(other)
-00181     {}
-00182 
-00184     concurrent_queue_iterator& operator=( const concurrent_queue_iterator& other ) {
-00185         assign(other);
-00186         return *this;
-00187     }
-00188 
-00190     Value& operator*() const {
-00191         return *static_cast<Value*>(my_item);
-00192     }
-00193 
-00194     Value* operator->() const {return &operator*();}
-00195 
-00197     concurrent_queue_iterator& operator++() {
-00198         advance();
-00199         return *this;
-00200     }
-00201 
-00203     Value* operator++(int) {
-00204         Value* result = &operator*();
-00205         operator++();
-00206         return result;
-00207     }
-00208 }; // concurrent_queue_iterator
-00209 
-00210 
-00211 template<typename C, typename T, typename U>
-00212 bool operator==( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j ) {
-00213     return i.my_item==j.my_item;
-00214 }
-00215 
-00216 template<typename C, typename T, typename U>
-00217 bool operator!=( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j ) {
-00218     return i.my_item!=j.my_item;
-00219 }
-00220 
-00221 } // namespace internal;
-00222 
-00224 
-00226 
-00229 template<typename T, class A>
-00230 class concurrent_queue: public internal::concurrent_queue_base_v3 {
-00231     template<typename Container, typename Value> friend class internal::concurrent_queue_iterator;
-00232 
-00234     typedef typename A::template rebind<char>::other page_allocator_type;
-00235     page_allocator_type my_allocator;
-00236 
-00238     class destroyer: internal::no_copy {
-00239         T& my_value;
-00240     public:
-00241         destroyer( T& value ) : my_value(value) {}
-00242         ~destroyer() {my_value.~T();}          
-00243     };
-00244 
-00245     T& get_ref( page& page, size_t index ) {
-00246         __TBB_ASSERT( index<items_per_page, NULL );
-00247         return static_cast<T*>(static_cast<void*>(&page+1))[index];
-00248     }
-00249 
-00250     /*override*/ virtual void copy_item( page& dst, size_t index, const void* src ) {
-00251         new( &get_ref(dst,index) ) T(*static_cast<const T*>(src)); 
-00252     }
-00253 
-00254     /*override*/ virtual void copy_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) {
-00255         new( &get_ref(dst,dindex) ) T( static_cast<const T*>(static_cast<const void*>(&src+1))[sindex] );
-00256     }
-00257 
-00258     /*override*/ virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) {
-00259         T& from = get_ref(src,index);
-00260         destroyer d(from);
-00261         *static_cast<T*>(dst) = from;
-00262     }
-00263 
-00264     /*overide*/ virtual page *allocate_page() {
-00265         size_t n = sizeof(page) + items_per_page*item_size;
-00266         page *p = reinterpret_cast<page*>(my_allocator.allocate( n ));
-00267         if( !p ) internal_throw_exception(); 
-00268         return p;
-00269     }
-00270 
-00271     /*override*/ virtual void deallocate_page( page *p ) {
-00272         size_t n = sizeof(page) + items_per_page*item_size;
-00273         my_allocator.deallocate( reinterpret_cast<char*>(p), n );
-00274     }
-00275 
-00276 public:
-00278     typedef T value_type;
-00279 
-00281     typedef A allocator_type;
-00282 
-00284     typedef T& reference;
-00285 
-00287     typedef const T& const_reference;
-00288 
-00290 
-00292     typedef std::ptrdiff_t size_type;
-00293 
-00295     typedef std::ptrdiff_t difference_type;
-00296 
-00298     explicit concurrent_queue(const allocator_type  &a = allocator_type()) : 
-00299         concurrent_queue_base_v3( sizeof(T) ), my_allocator( a )
-00300     {
-00301     }
-00302 
-00304     ~concurrent_queue();
-00305 
-00307     void push( const T& source ) {
-00308         internal_push( &source );
-00309     }
-00310 
-00312 
-00313     void pop( T& destination ) {
-00314         internal_pop( &destination );
-00315     }
-00316 
-00318 
-00320     bool push_if_not_full( const T& source ) {
-00321         return internal_push_if_not_full( &source );
-00322     }
-00323 
-00325 
-00327     bool pop_if_present( T& destination ) {
-00328         return internal_pop_if_present( &destination );
-00329     }
-00330 
-00332 
-00335     size_type size() const {return internal_size();}
-00336 
-00338     bool empty() const {return size()<=0;}
-00339 
-00341     size_type capacity() const {
-00342         return my_capacity;
-00343     }
-00344 
-00346 
-00348     void set_capacity( size_type capacity ) {
-00349         internal_set_capacity( capacity, sizeof(T) );
-00350     }
-00351 
-00353     allocator_type get_allocator() const { return this->my_allocator; }
-00354 
-00356     void clear() ;
-00357 
-00358     typedef internal::concurrent_queue_iterator<concurrent_queue,T> iterator;
-00359     typedef internal::concurrent_queue_iterator<concurrent_queue,const T> const_iterator;
-00360 
-00361     //------------------------------------------------------------------------
-00362     // The iterators are intended only for debugging.  They are slow and not thread safe.
-00363     //------------------------------------------------------------------------
-00364     iterator begin() {return iterator(*this);}
-00365     iterator end() {return iterator();}
-00366     const_iterator begin() const {return const_iterator(*this);}
-00367     const_iterator end() const {return const_iterator();}
-00368     
-00370     concurrent_queue( const concurrent_queue& src, const allocator_type &a = allocator_type()) : 
-00371         concurrent_queue_base_v3( sizeof(T) ), my_allocator( a )
-00372     {
-00373         assign( src );
-00374     }
-00375 
-00377     template<typename InputIterator>
-00378     concurrent_queue( InputIterator begin, InputIterator end, const allocator_type &a = allocator_type()) :
-00379         concurrent_queue_base_v3( sizeof(T) ), my_allocator( a )
-00380     {
-00381         for( ; begin != end; ++begin )
-00382             internal_push_if_not_full(&*begin);
-00383     }
-00384 }; 
-00385 
-00386 template<typename T, class A>
-00387 concurrent_queue<T,A>::~concurrent_queue() {
-00388     clear();
-00389     internal_finish_clear();
-00390 }
-00391 
-00392 template<typename T, class A>
-00393 void concurrent_queue<T,A>::clear() {
-00394     while( !empty() ) {
-00395         T value;
-00396         internal_pop_if_present(&value);
-00397     }
-00398 }
-00399 
-00400 } // namespace tbb
-00401 
-00402 #endif /* __TBB_concurrent_queue_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00229.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00229.html deleted file mode 100644 index 926605bb70..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00229.html +++ /dev/null @@ -1,829 +0,0 @@ - - -concurrent_vector.h Source File - - - - - - -

concurrent_vector.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_concurrent_vector_H
-00022 #define __TBB_concurrent_vector_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 #include <algorithm>
-00026 #include <iterator>
-00027 #include <memory>
-00028 #include <limits>
-00029 #include <new>
-00030 #include <cstring>
-00031 #include "atomic.h"
-00032 #include "cache_aligned_allocator.h"
-00033 #include "blocked_range.h"
-00034 
-00035 #include "tbb_machine.h"
-00036 
-00037 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && defined(_Wp64)
-00038     // Workaround for overzealous compiler warnings in /Wp64 mode
-00039     #pragma warning (push)
-00040     #pragma warning (disable: 4267)
-00041 #endif
-00042 
-00043 namespace tbb {
-00044 
-00045 template<typename T, class A = cache_aligned_allocator<T> >
-00046 class concurrent_vector;
-00047 
-00049 #define __TBB_BAD_ALLOC reinterpret_cast<void*>(size_t(63))
-00050 
-00052 namespace internal {
-00053 
-00055     void* __TBB_EXPORTED_FUNC itt_load_pointer_v3( const void* src );
-00056 
-00058 
-00059     class concurrent_vector_base_v3 {
-00060     protected:
-00061 
-00062         // Basic types declarations
-00063         typedef size_t segment_index_t;
-00064         typedef size_t size_type;
-00065 
-00066         // Using enumerations due to Mac linking problems of static const variables
-00067         enum {
-00068             // Size constants
-00069             default_initial_segments = 1, // 2 initial items
-00071             pointers_per_short_table = 3, // to fit into 8 words of entire structure
-00072             pointers_per_long_table = sizeof(segment_index_t) * 8 // one segment per bit
-00073         };
-00074 
-00075         // Segment pointer. Can be zero-initialized
-00076         struct segment_t {
-00077             void* array;
-00078 #if TBB_USE_ASSERT
-00079             ~segment_t() {
-00080                 __TBB_ASSERT( array <= __TBB_BAD_ALLOC, "should have been freed by clear" );
-00081             }
-00082 #endif /* TBB_USE_ASSERT */
-00083         };
-00084  
-00085         // Data fields
-00086 
-00088         void* (*vector_allocator_ptr)(concurrent_vector_base_v3 &, size_t);
-00089 
-00091         atomic<size_type> my_first_block;
-00092 
-00094         atomic<size_type> my_early_size;
-00095 
-00097         atomic<segment_t*> my_segment;
-00098 
-00100         segment_t my_storage[pointers_per_short_table];
-00101 
-00102         // Methods
-00103 
-00104         concurrent_vector_base_v3() {
-00105             my_early_size = 0;
-00106             my_first_block = 0; // here is not default_initial_segments
-00107             for( segment_index_t i = 0; i < pointers_per_short_table; i++)
-00108                 my_storage[i].array = NULL;
-00109             my_segment = my_storage;
-00110         }
-00111         __TBB_EXPORTED_METHOD ~concurrent_vector_base_v3();
-00112 
-00113         static segment_index_t segment_index_of( size_type index ) {
-00114             return segment_index_t( __TBB_Log2( index|1 ) );
-00115         }
-00116 
-00117         static segment_index_t segment_base( segment_index_t k ) {
-00118             return (segment_index_t(1)<<k & ~segment_index_t(1));
-00119         }
-00120 
-00121         static inline segment_index_t segment_base_index_of( segment_index_t &index ) {
-00122             segment_index_t k = segment_index_of( index );
-00123             index -= segment_base(k);
-00124             return k;
-00125         }
-00126 
-00127         static size_type segment_size( segment_index_t k ) {
-00128             return segment_index_t(1)<<k; // fake value for k==0
-00129         }
-00130 
-00132         typedef void (__TBB_EXPORTED_FUNC *internal_array_op1)(void* begin, size_type n );
-00133 
-00135         typedef void (__TBB_EXPORTED_FUNC *internal_array_op2)(void* dst, const void* src, size_type n );
-00136 
-00138         struct internal_segments_table {
-00139             segment_index_t first_block;
-00140             void* table[pointers_per_long_table];
-00141         };
-00142 
-00143         void __TBB_EXPORTED_METHOD internal_reserve( size_type n, size_type element_size, size_type max_size );
-00144         size_type __TBB_EXPORTED_METHOD internal_capacity() const;
-00145         void __TBB_EXPORTED_METHOD internal_grow_to_at_least( size_type new_size, size_type element_size, internal_array_op2 init, const void *src );
-00146         void internal_grow( size_type start, size_type finish, size_type element_size, internal_array_op2 init, const void *src );
-00147         size_type __TBB_EXPORTED_METHOD internal_grow_by( size_type delta, size_type element_size, internal_array_op2 init, const void *src );
-00148         void* __TBB_EXPORTED_METHOD internal_push_back( size_type element_size, size_type& index );
-00149         segment_index_t __TBB_EXPORTED_METHOD internal_clear( internal_array_op1 destroy );
-00150         void* __TBB_EXPORTED_METHOD internal_compact( size_type element_size, void *table, internal_array_op1 destroy, internal_array_op2 copy );
-00151         void __TBB_EXPORTED_METHOD internal_copy( const concurrent_vector_base_v3& src, size_type element_size, internal_array_op2 copy );
-00152         void __TBB_EXPORTED_METHOD internal_assign( const concurrent_vector_base_v3& src, size_type element_size,
-00153                               internal_array_op1 destroy, internal_array_op2 assign, internal_array_op2 copy );
-00154         void __TBB_EXPORTED_METHOD internal_throw_exception(size_type) const;
-00155         void __TBB_EXPORTED_METHOD internal_swap(concurrent_vector_base_v3& v);
-00156 
-00157 private:
-00159         class helper;
-00160         friend class helper;
-00161     };
-00162     
-00163     typedef concurrent_vector_base_v3 concurrent_vector_base;
-00164 
-00166 
-00168     template<typename Container, typename Value>
-00169     class vector_iterator 
-00170     {
-00172         Container* my_vector;
-00173 
-00175         size_t my_index;
-00176 
-00178 
-00179         mutable Value* my_item;
-00180 
-00181         template<typename C, typename T>
-00182         friend vector_iterator<C,T> operator+( ptrdiff_t offset, const vector_iterator<C,T>& v );
-00183 
-00184         template<typename C, typename T, typename U>
-00185         friend bool operator==( const vector_iterator<C,T>& i, const vector_iterator<C,U>& j );
-00186 
-00187         template<typename C, typename T, typename U>
-00188         friend bool operator<( const vector_iterator<C,T>& i, const vector_iterator<C,U>& j );
-00189 
-00190         template<typename C, typename T, typename U>
-00191         friend ptrdiff_t operator-( const vector_iterator<C,T>& i, const vector_iterator<C,U>& j );
-00192     
-00193         template<typename C, typename U>
-00194         friend class internal::vector_iterator;
-00195 
-00196 #if !defined(_MSC_VER) || defined(__INTEL_COMPILER)
-00197         template<typename T, class A>
-00198         friend class tbb::concurrent_vector;
-00199 #else
-00200 public: // workaround for MSVC
-00201 #endif 
-00202 
-00203         vector_iterator( const Container& vector, size_t index ) : 
-00204             my_vector(const_cast<Container*>(&vector)), 
-00205             my_index(index), 
-00206             my_item(NULL)
-00207         {}
-00208 
-00209     public:
-00211         vector_iterator() : my_vector(NULL), my_index(~size_t(0)), my_item(NULL) {}
-00212 
-00213         vector_iterator( const vector_iterator<Container,typename Container::value_type>& other ) :
-00214             my_vector(other.my_vector),
-00215             my_index(other.my_index),
-00216             my_item(other.my_item)
-00217         {}
-00218 
-00219         vector_iterator operator+( ptrdiff_t offset ) const {
-00220             return vector_iterator( *my_vector, my_index+offset );
-00221         }
-00222         vector_iterator &operator+=( ptrdiff_t offset ) {
-00223             my_index+=offset;
-00224             my_item = NULL;
-00225             return *this;
-00226         }
-00227         vector_iterator operator-( ptrdiff_t offset ) const {
-00228             return vector_iterator( *my_vector, my_index-offset );
-00229         }
-00230         vector_iterator &operator-=( ptrdiff_t offset ) {
-00231             my_index-=offset;
-00232             my_item = NULL;
-00233             return *this;
-00234         }
-00235         Value& operator*() const {
-00236             Value* item = my_item;
-00237             if( !item ) {
-00238                 item = my_item = &my_vector->internal_subscript(my_index);
-00239             }
-00240             __TBB_ASSERT( item==&my_vector->internal_subscript(my_index), "corrupt cache" );
-00241             return *item;
-00242         }
-00243         Value& operator[]( ptrdiff_t k ) const {
-00244             return my_vector->internal_subscript(my_index+k);
-00245         }
-00246         Value* operator->() const {return &operator*();}
-00247 
-00249         vector_iterator& operator++() {
-00250             size_t k = ++my_index;
-00251             if( my_item ) {
-00252                 // Following test uses 2's-complement wizardry
-00253                 if( (k& (k-2))==0 ) {
-00254                     // k is a power of two that is at least k-2
-00255                     my_item= NULL;
-00256                 } else {
-00257                     ++my_item;
-00258                 }
-00259             }
-00260             return *this;
-00261         }
-00262 
-00264         vector_iterator& operator--() {
-00265             __TBB_ASSERT( my_index>0, "operator--() applied to iterator already at beginning of concurrent_vector" ); 
-00266             size_t k = my_index--;
-00267             if( my_item ) {
-00268                 // Following test uses 2's-complement wizardry
-00269                 if( (k& (k-2))==0 ) {
-00270                     // k is a power of two that is at least k-2  
-00271                     my_item= NULL;
-00272                 } else {
-00273                     --my_item;
-00274                 }
-00275             }
-00276             return *this;
-00277         }
-00278 
-00280         vector_iterator operator++(int) {
-00281             vector_iterator result = *this;
-00282             operator++();
-00283             return result;
-00284         }
-00285 
-00287         vector_iterator operator--(int) {
-00288             vector_iterator result = *this;
-00289             operator--();
-00290             return result;
-00291         }
-00292 
-00293         // STL support
-00294 
-00295         typedef ptrdiff_t difference_type;
-00296         typedef Value value_type;
-00297         typedef Value* pointer;
-00298         typedef Value& reference;
-00299         typedef std::random_access_iterator_tag iterator_category;
-00300     };
-00301 
-00302     template<typename Container, typename T>
-00303     vector_iterator<Container,T> operator+( ptrdiff_t offset, const vector_iterator<Container,T>& v ) {
-00304         return vector_iterator<Container,T>( *v.my_vector, v.my_index+offset );
-00305     }
-00306 
-00307     template<typename Container, typename T, typename U>
-00308     bool operator==( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
-00309         return i.my_index==j.my_index && i.my_vector == j.my_vector;
-00310     }
-00311 
-00312     template<typename Container, typename T, typename U>
-00313     bool operator!=( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
-00314         return !(i==j);
-00315     }
-00316 
-00317     template<typename Container, typename T, typename U>
-00318     bool operator<( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
-00319         return i.my_index<j.my_index;
-00320     }
-00321 
-00322     template<typename Container, typename T, typename U>
-00323     bool operator>( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
-00324         return j<i;
-00325     }
-00326 
-00327     template<typename Container, typename T, typename U>
-00328     bool operator>=( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
-00329         return !(i<j);
-00330     }
-00331 
-00332     template<typename Container, typename T, typename U>
-00333     bool operator<=( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
-00334         return !(j<i);
-00335     }
-00336 
-00337     template<typename Container, typename T, typename U>
-00338     ptrdiff_t operator-( const vector_iterator<Container,T>& i, const vector_iterator<Container,U>& j ) {
-00339         return ptrdiff_t(i.my_index)-ptrdiff_t(j.my_index);
-00340     }
-00341 
-00342     template<typename T, class A>
-00343     class allocator_base {
-00344     public:
-00345         typedef typename A::template
-00346             rebind<T>::other allocator_type;
-00347         allocator_type my_allocator;
-00348 
-00349         allocator_base(const allocator_type &a = allocator_type() ) : my_allocator(a) {}
-00350     };
-00351 
-00352 } // namespace internal
-00354 
-00356 
-00410 template<typename T, class A>
-00411 class concurrent_vector: protected internal::allocator_base<T, A>,
-00412                          private internal::concurrent_vector_base_v3 {
-00413 private:
-00414     template<typename I>
-00415     class generic_range_type: public blocked_range<I> {
-00416     public:
-00417         typedef T value_type;
-00418         typedef T& reference;
-00419         typedef const T& const_reference;
-00420         typedef I iterator;
-00421         typedef ptrdiff_t difference_type;
-00422         generic_range_type( I begin_, I end_, size_t grainsize = 1) : blocked_range<I>(begin_,end_,grainsize) {} 
-00423         template<typename U>
-00424         generic_range_type( const generic_range_type<U>& r) : blocked_range<I>(r.begin(),r.end(),r.grainsize()) {} 
-00425         generic_range_type( generic_range_type& r, split ) : blocked_range<I>(r,split()) {}
-00426     };
-00427 
-00428     template<typename C, typename U>
-00429     friend class internal::vector_iterator;
-00430 public:
-00431     //------------------------------------------------------------------------
-00432     // STL compatible types
-00433     //------------------------------------------------------------------------
-00434     typedef internal::concurrent_vector_base_v3::size_type size_type;
-00435     typedef typename internal::allocator_base<T, A>::allocator_type allocator_type;
-00436 
-00437     typedef T value_type;
-00438     typedef ptrdiff_t difference_type;
-00439     typedef T& reference;
-00440     typedef const T& const_reference;
-00441     typedef T *pointer;
-00442     typedef const T *const_pointer;
-00443 
-00444     typedef internal::vector_iterator<concurrent_vector,T> iterator;
-00445     typedef internal::vector_iterator<concurrent_vector,const T> const_iterator;
-00446 
-00447 #if !defined(_MSC_VER) || _CPPLIB_VER>=300 
-00448     // Assume ISO standard definition of std::reverse_iterator
-00449     typedef std::reverse_iterator<iterator> reverse_iterator;
-00450     typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-00451 #else
-00452     // Use non-standard std::reverse_iterator
-00453     typedef std::reverse_iterator<iterator,T,T&,T*> reverse_iterator;
-00454     typedef std::reverse_iterator<const_iterator,T,const T&,const T*> const_reverse_iterator;
-00455 #endif /* defined(_MSC_VER) && (_MSC_VER<1300) */
-00456 
-00457     //------------------------------------------------------------------------
-00458     // Parallel algorithm support
-00459     //------------------------------------------------------------------------
-00460     typedef generic_range_type<iterator> range_type;
-00461     typedef generic_range_type<const_iterator> const_range_type;
-00462 
-00463     //------------------------------------------------------------------------
-00464     // STL compatible constructors & destructors
-00465     //------------------------------------------------------------------------
-00466 
-00468     explicit concurrent_vector(const allocator_type &a = allocator_type())
-00469         : internal::allocator_base<T, A>(a)
-00470     {
-00471         vector_allocator_ptr = &internal_allocator;
-00472     }
-00473 
-00475     concurrent_vector( const concurrent_vector& vector, const allocator_type& a = allocator_type() )
-00476         : internal::allocator_base<T, A>(a)
-00477     {
-00478         vector_allocator_ptr = &internal_allocator;
-00479         internal_copy(vector, sizeof(T), &copy_array);
-00480     }
-00481 
-00483     template<class M>
-00484     concurrent_vector( const concurrent_vector<T, M>& vector, const allocator_type& a = allocator_type() )
-00485         : internal::allocator_base<T, A>(a)
-00486     {
-00487         vector_allocator_ptr = &internal_allocator;
-00488         internal_copy(vector.internal_vector_base(), sizeof(T), &copy_array);
-00489     }
-00490 
-00492     explicit concurrent_vector(size_type n)
-00493     {
-00494         vector_allocator_ptr = &internal_allocator;
-00495         if ( !n ) return;
-00496         internal_reserve(n, sizeof(T), max_size()); my_early_size = n;
-00497         __TBB_ASSERT( my_first_block == segment_index_of(n-1)+1, NULL );
-00498         initialize_array(static_cast<T*>(my_segment[0].array), NULL, n);
-00499     }
-00500 
-00502     concurrent_vector(size_type n, const_reference t, const allocator_type& a = allocator_type())
-00503         : internal::allocator_base<T, A>(a)
-00504     {
-00505         vector_allocator_ptr = &internal_allocator;
-00506         internal_assign( n, t );
-00507     }
-00508 
-00510     template<class I>
-00511     concurrent_vector(I first, I last, const allocator_type &a = allocator_type())
-00512         : internal::allocator_base<T, A>(a)
-00513     {
-00514         vector_allocator_ptr = &internal_allocator;
-00515         internal_assign(first, last, static_cast<is_integer_tag<std::numeric_limits<I>::is_integer> *>(0) );
-00516     }
-00517 
-00519     concurrent_vector& operator=( const concurrent_vector& vector ) {
-00520         if( this != &vector )
-00521             concurrent_vector_base_v3::internal_assign(vector, sizeof(T), &destroy_array, &assign_array, &copy_array);
-00522         return *this;
-00523     }
-00524 
-00526     template<class M>
-00527     concurrent_vector& operator=( const concurrent_vector<T, M>& vector ) {
-00528         if( static_cast<void*>( this ) != static_cast<const void*>( &vector ) )
-00529             concurrent_vector_base_v3::internal_assign(vector.internal_vector_base(),
-00530                 sizeof(T), &destroy_array, &assign_array, &copy_array);
-00531         return *this;
-00532     }
-00533 
-00534     //------------------------------------------------------------------------
-00535     // Concurrent operations
-00536     //------------------------------------------------------------------------
-00538 
-00539     size_type grow_by( size_type delta ) {
-00540         return delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size;
-00541     }
-00542 
-00544 
-00545     size_type grow_by( size_type delta, const_reference t ) {
-00546         return delta ? internal_grow_by( delta, sizeof(T), &initialize_array_by, static_cast<const void*>(&t) ) : my_early_size;
-00547     }
-00548 
-00550     void grow_to_at_least( size_type n ) {
-00551         if( my_early_size<n )
-00552             internal_grow_to_at_least( n, sizeof(T), &initialize_array, NULL );
-00553     };
-00554 
-00556     size_type push_back( const_reference item ) {
-00557         size_type k;
-00558         internal_loop_guide loop(1, internal_push_back(sizeof(T),k));
-00559         loop.init(&item);
-00560         return k;
-00561     }
-00562 
-00564 
-00566     reference operator[]( size_type index ) {
-00567         return internal_subscript(index);
-00568     }
-00569 
-00571     const_reference operator[]( size_type index ) const {
-00572         return internal_subscript(index);
-00573     }
-00574 
-00576     reference at( size_type index ) {
-00577         return internal_subscript_with_exceptions(index);
-00578     }
-00579 
-00581     const_reference at( size_type index ) const {
-00582         return internal_subscript_with_exceptions(index);
-00583     }
-00584 
-00586     range_type range( size_t grainsize = 1) {
-00587         return range_type( begin(), end(), grainsize );
-00588     }
-00589 
-00591     const_range_type range( size_t grainsize = 1 ) const {
-00592         return const_range_type( begin(), end(), grainsize );
-00593     }
-00594     //------------------------------------------------------------------------
-00595     // Capacity
-00596     //------------------------------------------------------------------------
-00598     size_type size() const {return my_early_size;}
-00599 
-00601     bool empty() const {return !my_early_size;}
-00602 
-00604     size_type capacity() const {return internal_capacity();}
-00605 
-00607 
-00609     void reserve( size_type n ) {
-00610         if( n )
-00611             internal_reserve(n, sizeof(T), max_size());
-00612     }
-00613 
-00615     void compact();
-00616 
-00618     size_type max_size() const {return (~size_type(0))/sizeof(T);}
-00619 
-00620     //------------------------------------------------------------------------
-00621     // STL support
-00622     //------------------------------------------------------------------------
-00623 
-00625     iterator begin() {return iterator(*this,0);}
-00627     iterator end() {return iterator(*this,size());}
-00629     const_iterator begin() const {return const_iterator(*this,0);}
-00631     const_iterator end() const {return const_iterator(*this,size());}
-00633     reverse_iterator rbegin() {return reverse_iterator(end());}
-00635     reverse_iterator rend() {return reverse_iterator(begin());}
-00637     const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
-00639     const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
-00641     reference front() {
-00642         __TBB_ASSERT( size()>0, NULL);
-00643         return static_cast<T*>(my_segment[0].array)[0];
-00644     }
-00646     const_reference front() const {
-00647         __TBB_ASSERT( size()>0, NULL);
-00648         return static_cast<const T*>(my_segment[0].array)[0];
-00649     }
-00651     reference back() {
-00652         __TBB_ASSERT( size()>0, NULL);
-00653         return internal_subscript( my_early_size-1 );
-00654     }
-00656     const_reference back() const {
-00657         __TBB_ASSERT( size()>0, NULL);
-00658         return internal_subscript( my_early_size-1 );
-00659     }
-00661     allocator_type get_allocator() const { return this->my_allocator; }
-00662 
-00664     void assign(size_type n, const_reference t) { clear(); internal_assign( n, t ); }
-00665 
-00667     template<class I>
-00668     void assign(I first, I last) {
-00669         clear(); internal_assign( first, last, static_cast<is_integer_tag<std::numeric_limits<I>::is_integer> *>(0) );
-00670     }
-00671 
-00673     void swap(concurrent_vector &vector) {
-00674         if( this != &vector ) {
-00675             concurrent_vector_base_v3::internal_swap(static_cast<concurrent_vector_base_v3&>(vector));
-00676             std::swap(this->my_allocator, vector.my_allocator);
-00677         }
-00678     }
-00679 
-00681 
-00682     void clear() {
-00683         internal_clear(&destroy_array);
-00684     }
-00685 
-00687     ~concurrent_vector() {
-00688         segment_t *table = my_segment;
-00689         internal_free_segments( reinterpret_cast<void**>(table), internal_clear(&destroy_array), my_first_block );
-00690         // base class destructor call should be then
-00691     }
-00692 
-00693     const internal::concurrent_vector_base_v3 &internal_vector_base() const { return *this; }
-00694 private:
-00696     static void *internal_allocator(internal::concurrent_vector_base_v3 &vb, size_t k) {
-00697         return static_cast<concurrent_vector<T, A>&>(vb).my_allocator.allocate(k);
-00698     }
-00700     void internal_free_segments(void *table[], segment_index_t k, segment_index_t first_block);
-00701 
-00703     T& internal_subscript( size_type index ) const;
-00704 
-00706     T& internal_subscript_with_exceptions( size_type index ) const;
-00707 
-00709     void internal_assign(size_type n, const_reference t);
-00710 
-00712     template<bool B> class is_integer_tag;
-00713 
-00715     template<class I>
-00716     void internal_assign(I first, I last, is_integer_tag<true> *) {
-00717         internal_assign(static_cast<size_type>(first), static_cast<T>(last));
-00718     }
-00720     template<class I>
-00721     void internal_assign(I first, I last, is_integer_tag<false> *) {
-00722         internal_assign_iterators(first, last);
-00723     }
-00725     template<class I>
-00726     void internal_assign_iterators(I first, I last);
-00727 
-00729     static void __TBB_EXPORTED_FUNC initialize_array( void* begin, const void*, size_type n );
-00730 
-00732     static void __TBB_EXPORTED_FUNC initialize_array_by( void* begin, const void* src, size_type n );
-00733 
-00735     static void __TBB_EXPORTED_FUNC copy_array( void* dst, const void* src, size_type n );
-00736 
-00738     static void __TBB_EXPORTED_FUNC assign_array( void* dst, const void* src, size_type n );
-00739 
-00741     static void __TBB_EXPORTED_FUNC destroy_array( void* begin, size_type n );
-00742 
-00744     class internal_loop_guide : internal::no_copy {
-00745     public:
-00746         const pointer array;
-00747         const size_type n;
-00748         size_type i;
-00749         internal_loop_guide(size_type ntrials, void *ptr)
-00750             : array(static_cast<pointer>(ptr)), n(ntrials), i(0) {}
-00751         void init() {   for(; i < n; ++i) new( &array[i] ) T(); }
-00752         void init(const void *src) { for(; i < n; ++i) new( &array[i] ) T(*static_cast<const T*>(src)); }
-00753         void copy(const void *src) { for(; i < n; ++i) new( &array[i] ) T(static_cast<const T*>(src)[i]); }
-00754         void assign(const void *src) { for(; i < n; ++i) array[i] = static_cast<const T*>(src)[i]; }
-00755         template<class I> void iterate(I &src) { for(; i < n; ++i, ++src) new( &array[i] ) T( *src ); }
-00756         ~internal_loop_guide() {
-00757             if(i < n) // if exception raised, do zerroing on the rest of items
-00758                 std::memset(array+i, 0, (n-i)*sizeof(value_type));
-00759         }
-00760     };
-00761 };
-00762 
-00763 template<typename T, class A>
-00764 void concurrent_vector<T, A>::compact() {
-00765     internal_segments_table old;
-00766     try {
-00767         if( internal_compact( sizeof(T), &old, &destroy_array, &copy_array ) )
-00768             internal_free_segments( old.table, pointers_per_long_table, old.first_block ); // free joined and unnecessary segments
-00769     } catch(...) {
-00770         if( old.first_block ) // free segment allocated for compacting. Only for support of exceptions in ctor of user T[ype]
-00771             internal_free_segments( old.table, 1, old.first_block );
-00772         throw;
-00773     }
-00774 }
-00775 
-00776 template<typename T, class A>
-00777 void concurrent_vector<T, A>::internal_free_segments(void *table[], segment_index_t k, segment_index_t first_block) {
-00778     // Free the arrays
-00779     while( k > first_block ) {
-00780         --k;
-00781         T* array = static_cast<T*>(table[k]);
-00782         table[k] = NULL;
-00783         if( array > __TBB_BAD_ALLOC ) // check for correct segment pointer
-00784             this->my_allocator.deallocate( array, segment_size(k) );
-00785     }
-00786     T* array = static_cast<T*>(table[0]);
-00787     if( array > __TBB_BAD_ALLOC ) {
-00788         __TBB_ASSERT( first_block > 0, NULL );
-00789         while(k > 0) table[--k] = NULL;
-00790         this->my_allocator.deallocate( array, segment_size(first_block) );
-00791     }
-00792 }
-00793 
-00794 template<typename T, class A>
-00795 T& concurrent_vector<T, A>::internal_subscript( size_type index ) const {
-00796     __TBB_ASSERT( index<size(), "index out of bounds" );
-00797     size_type j = index;
-00798     segment_index_t k = segment_base_index_of( j );
-00799     // no need in __TBB_load_with_acquire since thread works in own space or gets 
-00800 #if TBB_USE_THREADING_TOOLS
-00801     return static_cast<T*>( tbb::internal::itt_load_pointer_v3(&my_segment[k].array))[j];
-00802 #else
-00803     return static_cast<T*>(my_segment[k].array)[j];
-00804 #endif /* TBB_USE_THREADING_TOOLS */
-00805 }
-00806 
-00807 template<typename T, class A>
-00808 T& concurrent_vector<T, A>::internal_subscript_with_exceptions( size_type index ) const {
-00809     if( index >= size() )
-00810         internal_throw_exception(0); // throw std::out_of_range
-00811     size_type j = index;
-00812     segment_index_t k = segment_base_index_of( j );
-00813     if( my_segment == (segment_t*)my_storage && k >= pointers_per_short_table )
-00814         internal_throw_exception(1); // throw std::out_of_range
-00815     void *array = my_segment[k].array; // no need in __TBB_load_with_acquire
-00816     if( array <= __TBB_BAD_ALLOC ) // check for correct segment pointer
-00817         internal_throw_exception(2); // throw std::range_error
-00818     return static_cast<T*>(array)[j];
-00819 }
-00820 
-00821 template<typename T, class A>
-00822 void concurrent_vector<T, A>::internal_assign(size_type n, const_reference t)
-00823 {
-00824     __TBB_ASSERT(my_early_size == 0, NULL);
-00825     if( !n ) return;
-00826     internal_reserve(n, sizeof(T), max_size());
-00827     my_early_size = n;
-00828     segment_index_t k = 0;
-00829     size_type sz = segment_size( my_first_block );
-00830     while( sz < n ) {
-00831         initialize_array_by(static_cast<T*>(my_segment[k].array), static_cast<const void*>(&t), sz);
-00832         n -= sz;
-00833         if( !k ) k = my_first_block;
-00834         else { ++k; sz <<= 1; }
-00835     }
-00836     initialize_array_by(static_cast<T*>(my_segment[k].array), static_cast<const void*>(&t), n);
-00837 }
-00838 
-00839 template<typename T, class A> template<class I>
-00840 void concurrent_vector<T, A>::internal_assign_iterators(I first, I last) {
-00841     __TBB_ASSERT(my_early_size == 0, NULL);
-00842     size_type n = std::distance(first, last);
-00843     if( !n ) return;
-00844     internal_reserve(n, sizeof(T), max_size());
-00845     my_early_size = n;
-00846     segment_index_t k = 0;
-00847     size_type sz = segment_size( my_first_block );
-00848     while( sz < n ) {
-00849         internal_loop_guide loop(sz, my_segment[k].array);
-00850         loop.iterate(first);
-00851         n -= sz;
-00852         if( !k ) k = my_first_block;
-00853         else { ++k; sz <<= 1; }
-00854     }
-00855     internal_loop_guide loop(n, my_segment[k].array);
-00856     loop.iterate(first);
-00857 }
-00858 
-00859 template<typename T, class A>
-00860 void concurrent_vector<T, A>::initialize_array( void* begin, const void *, size_type n ) {
-00861     internal_loop_guide loop(n, begin); loop.init();
-00862 }
-00863 
-00864 template<typename T, class A>
-00865 void concurrent_vector<T, A>::initialize_array_by( void* begin, const void *src, size_type n ) {
-00866     internal_loop_guide loop(n, begin); loop.init(src);
-00867 }
-00868 
-00869 template<typename T, class A>
-00870 void concurrent_vector<T, A>::copy_array( void* dst, const void* src, size_type n ) {
-00871     internal_loop_guide loop(n, dst); loop.copy(src);
-00872 }
-00873 
-00874 template<typename T, class A>
-00875 void concurrent_vector<T, A>::assign_array( void* dst, const void* src, size_type n ) {
-00876     internal_loop_guide loop(n, dst); loop.assign(src);
-00877 }
-00878 
-00879 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 
-00880     // Workaround for overzealous compiler warning
-00881     #pragma warning (push)
-00882     #pragma warning (disable: 4189)
-00883 #endif
-00884 template<typename T, class A>
-00885 void concurrent_vector<T, A>::destroy_array( void* begin, size_type n ) {
-00886     T* array = static_cast<T*>(begin);
-00887     for( size_type j=n; j>0; --j )
-00888         array[j-1].~T(); // destructors are supposed to not throw any exceptions
-00889 }
-00890 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 
-00891     #pragma warning (pop)
-00892 #endif // warning 4189 is back 
-00893 
-00894 // concurrent_vector's template functions
-00895 template<typename T, class A1, class A2>
-00896 inline bool operator==(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b) {
-00897     //TODO[?]: deal with _Range_checked_iterator_tag of MSVC.
-00898     // Simply:    return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
-00899     if(a.size() != b.size()) return false;
-00900     typename concurrent_vector<T, A1>::const_iterator i(a.begin());
-00901     typename concurrent_vector<T, A2>::const_iterator j(b.begin());
-00902     for(; i != a.end(); ++i, ++j)
-00903         if( !(*i == *j) ) return false;
-00904     return true;
-00905 }
-00906 
-00907 template<typename T, class A1, class A2>
-00908 inline bool operator!=(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
-00909 {    return !(a == b); }
-00910 
-00911 template<typename T, class A1, class A2>
-00912 inline bool operator<(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
-00913 {    return (std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end())); }
-00914 
-00915 template<typename T, class A1, class A2>
-00916 inline bool operator>(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
-00917 {    return b < a; }
-00918 
-00919 template<typename T, class A1, class A2>
-00920 inline bool operator<=(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
-00921 {    return !(b < a); }
-00922 
-00923 template<typename T, class A1, class A2>
-00924 inline bool operator>=(const concurrent_vector<T, A1> &a, const concurrent_vector<T, A2> &b)
-00925 {    return !(a < b); }
-00926 
-00927 template<typename T, class A>
-00928 inline void swap(concurrent_vector<T, A> &a, concurrent_vector<T, A> &b)
-00929 {    a.swap( b ); }
-00930 
-00931 } // namespace tbb
-00932 
-00933 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && defined(_Wp64)
-00934     #pragma warning (pop)
-00935 #endif // warning 4267 is back
-00936 
-00937 #endif /* __TBB_concurrent_vector_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00238.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00238.html deleted file mode 100644 index 13641d4521..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00238.html +++ /dev/null @@ -1,569 +0,0 @@ - - -enumerable_thread_specific.h Source File - - - - - - -

enumerable_thread_specific.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_enumerable_thread_specific_H
-00022 #define __TBB_enumerable_thread_specific_H
-00023 
-00024 #include "concurrent_vector.h"
-00025 #include "cache_aligned_allocator.h"
-00026 
-00027 #if _WIN32||_WIN64
-00028 #include <windows.h>
-00029 #else
-00030 #include <pthread.h>
-00031 #endif
-00032 
-00033 namespace tbb {
-00034 
-00036     enum ets_key_usage_type { ets_single_key, ets_key_per_instance };
-00037 
-00039     namespace internal {
-00040         
-00042         template< typename Container, typename Value >
-00043         class enumerable_thread_specific_iterator 
-00044 #if defined(_WIN64) && defined(_MSC_VER) 
-00045             // Ensure that Microsoft's internal template function _Val_type works correctly.
-00046             : public std::iterator<std::random_access_iterator_tag,Value>
-00047 #endif /* defined(_WIN64) && defined(_MSC_VER) */
-00048         {
-00050         
-00051             Container *my_container;
-00052             typename Container::size_type my_index;
-00053             mutable Value *my_value;
-00054         
-00055             template<typename C, typename T>
-00056             friend enumerable_thread_specific_iterator<C,T> operator+( ptrdiff_t offset, 
-00057                                                                        const enumerable_thread_specific_iterator<C,T>& v );
-00058         
-00059             template<typename C, typename T, typename U>
-00060             friend bool operator==( const enumerable_thread_specific_iterator<C,T>& i, 
-00061                                     const enumerable_thread_specific_iterator<C,U>& j );
-00062         
-00063             template<typename C, typename T, typename U>
-00064             friend bool operator<( const enumerable_thread_specific_iterator<C,T>& i, 
-00065                                    const enumerable_thread_specific_iterator<C,U>& j );
-00066         
-00067             template<typename C, typename T, typename U>
-00068             friend ptrdiff_t operator-( const enumerable_thread_specific_iterator<C,T>& i, const enumerable_thread_specific_iterator<C,U>& j );
-00069             
-00070             template<typename C, typename U> 
-00071             friend class enumerable_thread_specific_iterator;
-00072         
-00073             public:
-00074         
-00075             enumerable_thread_specific_iterator( const Container &container, typename Container::size_type index ) : 
-00076                 my_container(&const_cast<Container &>(container)), my_index(index), my_value(NULL) {}
-00077         
-00079             enumerable_thread_specific_iterator() : my_container(NULL), my_index(0), my_value(NULL) {}
-00080         
-00081             template<typename U>
-00082             enumerable_thread_specific_iterator( const enumerable_thread_specific_iterator<Container, U>& other ) :
-00083                     my_container( other.my_container ), my_index( other.my_index), my_value( const_cast<Value *>(other.my_value) ) {}
-00084         
-00085             enumerable_thread_specific_iterator operator+( ptrdiff_t offset ) const {
-00086                 return enumerable_thread_specific_iterator(*my_container, my_index + offset);
-00087             }
-00088         
-00089             enumerable_thread_specific_iterator &operator+=( ptrdiff_t offset ) {
-00090                 my_index += offset;
-00091                 my_value = NULL;
-00092                 return *this;
-00093             }
-00094         
-00095             enumerable_thread_specific_iterator operator-( ptrdiff_t offset ) const {
-00096                 return enumerable_thread_specific_iterator( *my_container, my_index-offset );
-00097             }
-00098         
-00099             enumerable_thread_specific_iterator &operator-=( ptrdiff_t offset ) {
-00100                 my_index -= offset;
-00101                 my_value = NULL;
-00102                 return *this;
-00103             }
-00104         
-00105             Value& operator*() const {
-00106                 Value* value = my_value;
-00107                 if( !value ) {
-00108                     value = my_value = &(*my_container)[my_index].value;
-00109                 }
-00110                 __TBB_ASSERT( value==&(*my_container)[my_index].value, "corrupt cache" );
-00111                 return *value;
-00112             }
-00113         
-00114             Value& operator[]( ptrdiff_t k ) const {
-00115                return (*my_container)[my_index + k].value;
-00116             }
-00117         
-00118             Value* operator->() const {return &operator*();}
-00119         
-00120             enumerable_thread_specific_iterator& operator++() {
-00121                 ++my_index;
-00122                 my_value = NULL;
-00123                 return *this;
-00124             }
-00125         
-00126             enumerable_thread_specific_iterator& operator--() {
-00127                 --my_index;
-00128                 my_value = NULL;
-00129                 return *this;
-00130             }
-00131         
-00133             enumerable_thread_specific_iterator operator++(int) {
-00134                 enumerable_thread_specific_iterator result = *this;
-00135                 ++my_index;
-00136                 my_value = NULL;
-00137                 return result;
-00138             }
-00139         
-00141             enumerable_thread_specific_iterator operator--(int) {
-00142                 enumerable_thread_specific_iterator result = *this;
-00143                 --my_index;
-00144                 my_value = NULL;
-00145                 return result;
-00146             }
-00147         
-00148             // STL support
-00149             typedef ptrdiff_t difference_type;
-00150             typedef Value value_type;
-00151             typedef Value* pointer;
-00152             typedef Value& reference;
-00153             typedef std::random_access_iterator_tag iterator_category;
-00154         };
-00155         
-00156         template<typename Container, typename T>
-00157         enumerable_thread_specific_iterator<Container,T> operator+( ptrdiff_t offset, 
-00158                                                                     const enumerable_thread_specific_iterator<Container,T>& v ) {
-00159             return enumerable_thread_specific_iterator<Container,T>( v.my_container, v.my_index + offset );
-00160         }
-00161         
-00162         template<typename Container, typename T, typename U>
-00163         bool operator==( const enumerable_thread_specific_iterator<Container,T>& i, 
-00164                          const enumerable_thread_specific_iterator<Container,U>& j ) {
-00165             return i.my_index==j.my_index && i.my_container == j.my_container;
-00166         }
-00167         
-00168         template<typename Container, typename T, typename U>
-00169         bool operator!=( const enumerable_thread_specific_iterator<Container,T>& i, 
-00170                          const enumerable_thread_specific_iterator<Container,U>& j ) {
-00171             return !(i==j);
-00172         }
-00173         
-00174         template<typename Container, typename T, typename U>
-00175         bool operator<( const enumerable_thread_specific_iterator<Container,T>& i, 
-00176                         const enumerable_thread_specific_iterator<Container,U>& j ) {
-00177             return i.my_index<j.my_index;
-00178         }
-00179         
-00180         template<typename Container, typename T, typename U>
-00181         bool operator>( const enumerable_thread_specific_iterator<Container,T>& i, 
-00182                         const enumerable_thread_specific_iterator<Container,U>& j ) {
-00183             return j<i;
-00184         }
-00185         
-00186         template<typename Container, typename T, typename U>
-00187         bool operator>=( const enumerable_thread_specific_iterator<Container,T>& i, 
-00188                          const enumerable_thread_specific_iterator<Container,U>& j ) {
-00189             return !(i<j);
-00190         }
-00191         
-00192         template<typename Container, typename T, typename U>
-00193         bool operator<=( const enumerable_thread_specific_iterator<Container,T>& i, 
-00194                          const enumerable_thread_specific_iterator<Container,U>& j ) {
-00195             return !(j<i);
-00196         }
-00197         
-00198         template<typename Container, typename T, typename U>
-00199         ptrdiff_t operator-( const enumerable_thread_specific_iterator<Container,T>& i, 
-00200                              const enumerable_thread_specific_iterator<Container,U>& j ) {
-00201             return i.my_index-j.my_index;
-00202         }
-00203 
-00204     template<typename SegmentedContainer, typename Value >
-00205         class segmented_iterator
-00206 #if defined(_WIN64) && defined(_MSC_VER)
-00207         : public std::iterator<std::input_iterator_tag, Value>
-00208 #endif
-00209         {
-00210             template<typename C, typename T, typename U>
-00211             friend bool operator==(const segmented_iterator<C,T>& i, const segmented_iterator<C,U>& j);
-00212 
-00213             template<typename C, typename T, typename U>
-00214             friend bool operator!=(const segmented_iterator<C,T>& i, const segmented_iterator<C,U>& j);
-00215             
-00216             template<typename C, typename U> 
-00217             friend class segmented_iterator;
-00218 
-00219             public:
-00220 
-00221                 segmented_iterator() {my_segcont = NULL;}
-00222 
-00223                 segmented_iterator( const SegmentedContainer& _segmented_container ) : 
-00224                     my_segcont(const_cast<SegmentedContainer*>(&_segmented_container)),
-00225                     outer_iter(my_segcont->end()) { }
-00226 
-00227                 ~segmented_iterator() {}
-00228 
-00229                 typedef typename SegmentedContainer::iterator outer_iterator;
-00230                 typedef typename SegmentedContainer::value_type InnerContainer;
-00231                 typedef typename InnerContainer::iterator inner_iterator;
-00232 
-00233                 // STL support
-00234                 typedef ptrdiff_t difference_type;
-00235                 typedef Value value_type;
-00236                 typedef typename SegmentedContainer::size_type size_type;
-00237                 typedef Value* pointer;
-00238                 typedef Value& reference;
-00239                 typedef std::input_iterator_tag iterator_category;
-00240 
-00241                 // Copy Constructor
-00242                 template<typename U>
-00243                 segmented_iterator(const segmented_iterator<SegmentedContainer, U>& other) :
-00244                     my_segcont(other.my_segcont),
-00245                     outer_iter(other.outer_iter),
-00246                     // can we assign a default-constructed iterator to inner if we're at the end?
-00247                     inner_iter(other.inner_iter)
-00248                 {}
-00249 
-00250                 // assignment
-00251                 template<typename U>
-00252                 segmented_iterator& operator=( const segmented_iterator<SegmentedContainer, U>& other) {
-00253                     if(this != &other) {
-00254                         my_segcont = other.my_segcont;
-00255                         outer_iter = other.outer_iter;
-00256                         if(outer_iter != my_segcont->end()) inner_iter = other.inner_iter;
-00257                     }
-00258                     return *this;
-00259                 }
-00260 
-00261                 // allow assignment of outer iterator to segmented iterator.  Once it is
-00262                 // assigned, move forward until a non-empty inner container is found or
-00263                 // the end of the outer container is reached.
-00264                 segmented_iterator& operator=(const outer_iterator& new_outer_iter) {
-00265                     __TBB_ASSERT(my_segcont != NULL, NULL);
-00266                     // check that this iterator points to something inside the segmented container
-00267                     for(outer_iter = new_outer_iter ;outer_iter!=my_segcont->end(); ++outer_iter) {
-00268                         if( !outer_iter->empty() ) {
-00269                             inner_iter = outer_iter->begin();
-00270                             break;
-00271                         }
-00272                     }
-00273                     return *this;
-00274                 }
-00275 
-00276                 // pre-increment
-00277                 segmented_iterator& operator++() {
-00278                     advance_me();
-00279                     return *this;
-00280                 }
-00281 
-00282                 // post-increment
-00283                 segmented_iterator operator++(int) {
-00284                     segmented_iterator tmp = *this;
-00285                     operator++();
-00286                     return tmp;
-00287                 }
-00288 
-00289                 bool operator==(const outer_iterator& other_outer) const {
-00290                     __TBB_ASSERT(my_segcont != NULL, NULL);
-00291                     return (outer_iter == other_outer &&
-00292                             (outer_iter == my_segcont->end() || inner_iter == outer_iter->begin()));
-00293                 }
-00294 
-00295                 bool operator!=(const outer_iterator& other_outer) const {
-00296                     return !operator==(other_outer);
-00297 
-00298                 }
-00299 
-00300                 // (i)* RHS
-00301                 reference operator*() const {
-00302                     __TBB_ASSERT(my_segcont != NULL, NULL);
-00303                     __TBB_ASSERT(outer_iter != my_segcont->end(), "Dereferencing a pointer at end of container");
-00304                     __TBB_ASSERT(inner_iter != outer_iter->end(), NULL); // should never happen
-00305                     return *inner_iter;
-00306                 }
-00307 
-00308                 // i->
-00309                 pointer operator->() const { return &operator*();}
-00310 
-00311             private:
-00312                 SegmentedContainer*             my_segcont;
-00313                 outer_iterator outer_iter;
-00314                 inner_iterator inner_iter;
-00315 
-00316                 void advance_me() {
-00317                     __TBB_ASSERT(my_segcont != NULL, NULL);
-00318                     __TBB_ASSERT(outer_iter != my_segcont->end(), NULL); // not true if there are no inner containers
-00319                     __TBB_ASSERT(inner_iter != outer_iter->end(), NULL); // not true if the inner containers are all empty.
-00320                     ++inner_iter;
-00321                     while(inner_iter == outer_iter->end() && ++outer_iter != my_segcont->end()) {
-00322                         inner_iter = outer_iter->begin();
-00323                     }
-00324                 }
-00325         };    // segmented_iterator
-00326 
-00327         template<typename SegmentedContainer, typename T, typename U>
-00328         bool operator==( const segmented_iterator<SegmentedContainer,T>& i, 
-00329                          const segmented_iterator<SegmentedContainer,U>& j ) {
-00330             if(i.my_segcont != j.my_segcont) return false;
-00331             if(i.my_segcont == NULL) return true;
-00332             if(i.outer_iter != j.outer_iter) return false;
-00333             if(i.outer_iter == i.my_segcont->end()) return true;
-00334             return i.inner_iter == j.inner_iter;
-00335         }
-00336 
-00337         // !=
-00338         template<typename SegmentedContainer, typename T, typename U>
-00339         bool operator!=( const segmented_iterator<SegmentedContainer,T>& i, 
-00340                          const segmented_iterator<SegmentedContainer,U>& j ) {
-00341             return !(i==j);
-00342         }
-00343 
-00345         struct tls_single_key_manager_v4 {
-00346             typedef tbb::concurrent_vector<void *>::size_type tls_key_t;
-00347             static void __TBB_EXPORTED_FUNC create_key( tls_key_t &k);
-00348             static void __TBB_EXPORTED_FUNC destroy_key( tls_key_t &k );
-00349             static void __TBB_EXPORTED_FUNC set_tls( tls_key_t &k, void * value );
-00350             static void * __TBB_EXPORTED_FUNC get_tls( tls_key_t &k );
-00351         };
-00352 
-00353         // empty template for following specializations
-00354         template<ets_key_usage_type et>
-00355         struct tls_manager {};
-00356         
-00358         template <>
-00359         struct tls_manager<ets_single_key> {
-00360             typedef tls_single_key_manager_v4::tls_key_t tls_key_t;
-00361             static inline void create_key( tls_key_t &k) { internal::tls_single_key_manager_v4::create_key(k); }
-00362             static inline void destroy_key( tls_key_t &k ) { internal::tls_single_key_manager_v4::destroy_key(k); }
-00363             static inline void set_tls( tls_key_t &k, void * value ) { 
-00364                 internal::tls_single_key_manager_v4::set_tls(k, value); 
-00365             }
-00366             static inline void * get_tls( tls_key_t &k ) { return internal::tls_single_key_manager_v4::get_tls(k); }
-00367         };
-00368 
-00369         
-00371         template <>
-00372         struct tls_manager <ets_key_per_instance> {
-00373 #if _WIN32||_WIN64
-00374             typedef DWORD tls_key_t;
-00375             static inline void create_key( tls_key_t &k) { k = TlsAlloc(); }
-00376             static inline void destroy_key( tls_key_t &k) { TlsFree(k); }
-00377             static inline void set_tls( tls_key_t &k, void * value) { TlsSetValue(k, (LPVOID)value); }
-00378             static inline void * get_tls( tls_key_t &k ) { return (void *)TlsGetValue(k); }
-00379 #else
-00380             typedef pthread_key_t tls_key_t;
-00381             static inline void create_key( tls_key_t &k) { pthread_key_create(&k, NULL); }
-00382             static inline void destroy_key( tls_key_t &k) { pthread_key_delete(k); }
-00383             static inline void set_tls( tls_key_t &k, void * value) { pthread_setspecific(k, value); }
-00384             static inline void * get_tls( tls_key_t &k ) { return pthread_getspecific(k); }
-00385 #endif
-00386         };
-00387 
-00388     } // namespace internal
-00390 
-00392     template <typename T, 
-00393               typename Allocator=cache_aligned_allocator<T>, 
-00394               ets_key_usage_type ETS_key_type=ets_single_key > 
-00395     class enumerable_thread_specific { 
-00396     
-00397         typedef internal::tls_manager< ETS_key_type > my_tls_manager;
-00398 
-00400         struct padded_element {
-00401             T value;
-00402             char padding[ ( (sizeof(T) - 1) / internal::NFS_MaxLineSize + 1 ) * internal::NFS_MaxLineSize - sizeof(T) ];
-00403             padded_element(const T &v) : value(v) {}
-00404             padded_element() {}
-00405         };
-00406     
-00408         template<typename I>
-00409         class generic_range_type: public blocked_range<I> {
-00410         public:
-00411             typedef T value_type;
-00412             typedef T& reference;
-00413             typedef const T& const_reference;
-00414             typedef I iterator;
-00415             typedef ptrdiff_t difference_type;
-00416             generic_range_type( I begin_, I end_, size_t grainsize = 1) : blocked_range<I>(begin_,end_,grainsize) {} 
-00417             template<typename U>
-00418             generic_range_type( const generic_range_type<U>& r) : blocked_range<I>(r.begin(),r.end(),r.grainsize()) {} 
-00419             generic_range_type( generic_range_type& r, split ) : blocked_range<I>(r,split()) {}
-00420         };
-00421     
-00422         typedef typename Allocator::template rebind< padded_element >::other padded_allocator_type;
-00423         typedef tbb::concurrent_vector< padded_element, padded_allocator_type > internal_collection_type;
-00424     
-00425         typename my_tls_manager::tls_key_t my_key;
-00426         padded_element my_exemplar;
-00427         internal_collection_type my_locals;
-00428     
-00429     public:
-00430     
-00432         typedef Allocator allocator_type;
-00433         typedef T value_type;
-00434         typedef T& reference;
-00435         typedef const T& const_reference;
-00436         typedef T* pointer;
-00437         typedef typename internal_collection_type::size_type size_type;
-00438         typedef typename internal_collection_type::difference_type difference_type;
-00439     
-00440         // Iterator types
-00441         typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator;
-00442         typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator;
-00443 
-00444         // Parallel range types
-00445         typedef generic_range_type< iterator > range_type;
-00446         typedef generic_range_type< const_iterator > const_range_type;
-00447     
-00449         enumerable_thread_specific() { 
-00450             my_tls_manager::create_key(my_key); 
-00451         }
-00452     
-00454         enumerable_thread_specific(const T &_exemplar) : my_exemplar(_exemplar) {
-00455             my_tls_manager::create_key(my_key); 
-00456         }
-00457     
-00459         ~enumerable_thread_specific() { 
-00460             my_tls_manager::destroy_key(my_key); 
-00461         }
-00462       
-00463     
-00465         reference local()  {
-00466             if ( pointer local_ptr = static_cast< pointer >(my_tls_manager::get_tls(my_key)) ) {
-00467                return *local_ptr;
-00468             } else {
-00469                 typename internal_collection_type::size_type local_index = my_locals.push_back( my_exemplar );
-00470                 reference local_ref = my_locals[local_index].value;
-00471                 my_tls_manager::set_tls( my_key, static_cast<void *>(&local_ref) );
-00472                 return local_ref;
-00473             }
-00474         }
-00475 
-00477         size_type size() const { return my_locals.size(); }
-00478     
-00480         bool empty() const { return my_locals.empty(); }
-00481     
-00483         iterator begin() { return iterator( my_locals, 0 ); }
-00485         iterator end() { return iterator(my_locals, my_locals.size() ); }
-00486     
-00488         const_iterator begin() const { return const_iterator(my_locals, 0); }
-00489     
-00491         const_iterator end() const { return const_iterator(my_locals, my_locals.size()); }
-00492 
-00494         range_type range( size_t grainsize=1 ) { return range_type( begin(), end(), grainsize ); } 
-00495         
-00497         const_range_type range( size_t grainsize=1 ) const { return const_range_type( begin(), end(), grainsize ); }
-00498     
-00500         void clear() {
-00501             my_locals.clear();
-00502             my_tls_manager::destroy_key(my_key);
-00503             my_tls_manager::create_key(my_key); 
-00504         }
-00505     
-00506     };
-00507 
-00508     template< typename Container >
-00509     class flattened2d {
-00510 
-00511         // This intermediate typedef is to address issues with VC7.1 compilers
-00512         typedef typename Container::value_type conval_type;
-00513 
-00514     public:
-00515 
-00517         typedef typename conval_type::size_type size_type;
-00518         typedef typename conval_type::difference_type difference_type;
-00519         typedef typename conval_type::allocator_type allocator_type;
-00520         typedef typename conval_type::value_type value_type;
-00521         typedef typename conval_type::reference reference;
-00522         typedef typename conval_type::const_reference const_reference;
-00523         typedef typename conval_type::pointer pointer;
-00524         typedef typename conval_type::const_pointer const_pointer;
-00525 
-00526         typedef typename internal::segmented_iterator<Container, value_type> iterator;
-00527         typedef typename internal::segmented_iterator<Container, const value_type> const_iterator;
-00528 
-00529         flattened2d( const Container &c, typename Container::const_iterator b, typename Container::const_iterator e ) : 
-00530             my_container(const_cast<Container*>(&c)), my_begin(b), my_end(e) { }
-00531 
-00532         flattened2d( const Container &c ) : 
-00533             my_container(const_cast<Container*>(&c)), my_begin(c.begin()), my_end(c.end()) { }
-00534 
-00535         iterator begin() { return iterator(*my_container) = my_begin; }
-00536         iterator end() { return iterator(*my_container) = my_end; }
-00537         const_iterator begin() const { return const_iterator(*my_container) = my_begin; }
-00538         const_iterator end() const { return const_iterator(*my_container) = my_end; }
-00539 
-00540         size_type size() const {
-00541             size_type tot_size = 0;
-00542             for(typename Container::const_iterator i = my_begin; i != my_end; ++i) {
-00543                 tot_size += i->size();
-00544             }
-00545             return tot_size;
-00546         }
-00547 
-00548     private:
-00549 
-00550         Container *my_container;
-00551         typename Container::const_iterator my_begin;
-00552         typename Container::const_iterator my_end;
-00553 
-00554     };
-00555 
-00556     template <typename Container>
-00557     flattened2d<Container> flatten2d(const Container &c, const typename Container::const_iterator b, const typename Container::const_iterator e) {
-00558         return flattened2d<Container>(c, b, e);
-00559     }
-00560 
-00561     template <typename Container>
-00562     flattened2d<Container> flatten2d(const Container &c) {
-00563         return flattened2d<Container>(c);
-00564     }
-00565 
-00566 } // namespace tbb
-00567 
-00568 #endif
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00243.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00243.html deleted file mode 100644 index b7aa1c10da..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00243.html +++ /dev/null @@ -1,201 +0,0 @@ - - -mutex.h Source File - - - - - - -

mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_mutex_H
-00022 #define __TBB_mutex_H
-00023 
-00024 #if _WIN32||_WIN64
-00025 #include <windows.h>
-00026 #if !defined(_WIN32_WINNT)
-00027 // The following Windows API function is declared explicitly;
-00028 // otherwise any user would have to specify /D_WIN32_WINNT=0x0400
-00029 extern "C" BOOL WINAPI TryEnterCriticalSection( LPCRITICAL_SECTION );
-00030 #endif
-00031 
-00032 #else /* if not _WIN32||_WIN64 */
-00033 #include <pthread.h>
-00034 namespace tbb { namespace internal {
-00035 // Use this internal TBB function to throw an exception
-00036 extern void handle_perror( int error_code, const char* what );
-00037 } } //namespaces
-00038 #endif /* _WIN32||_WIN64 */
-00039 
-00040 #include "tbb_stddef.h"
-00041 #include "tbb_profiling.h"
-00042 
-00043 namespace tbb {
-00044 
-00046 
-00048 class mutex {
-00049 public:
-00051     mutex() {
-00052 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS
-00053     internal_construct();
-00054 #else
-00055   #if _WIN32||_WIN64
-00056         InitializeCriticalSection(&impl);
-00057   #else
-00058         int error_code = pthread_mutex_init(&impl,NULL);
-00059         if( error_code )
-00060             tbb::internal::handle_perror(error_code,"mutex: pthread_mutex_init failed");
-00061   #endif /* _WIN32||_WIN64*/
-00062 #endif /* TBB_USE_ASSERT */
-00063     };
-00064 
-00065     ~mutex() {
-00066 #if TBB_USE_ASSERT
-00067         internal_destroy();
-00068 #else
-00069   #if _WIN32||_WIN64
-00070         DeleteCriticalSection(&impl);
-00071   #else
-00072         pthread_mutex_destroy(&impl); 
-00073 
-00074   #endif /* _WIN32||_WIN64 */
-00075 #endif /* TBB_USE_ASSERT */
-00076     };
-00077 
-00078     class scoped_lock;
-00079     friend class scoped_lock;
-00080 
-00082 
-00084     class scoped_lock : internal::no_copy {
-00085     public:
-00087         scoped_lock() : my_mutex(NULL) {};
-00088 
-00090 
-00091         scoped_lock( mutex& mutex ) {
-00092             acquire( mutex );
-00093         }
-00094 
-00096         ~scoped_lock() {
-00097             if( my_mutex ) 
-00098                 release();
-00099         }
-00100 
-00102         void acquire( mutex& mutex ) {
-00103 #if TBB_USE_ASSERT
-00104             internal_acquire(mutex);
-00105 #else
-00106             my_mutex = &mutex;
-00107   #if _WIN32||_WIN64
-00108             EnterCriticalSection(&mutex.impl);
-00109   #else
-00110             pthread_mutex_lock(&mutex.impl);
-00111   #endif /* _WIN32||_WIN64 */
-00112 #endif /* TBB_USE_ASSERT */
-00113         }
-00114 
-00116         bool try_acquire( mutex& mutex ) {
-00117 #if TBB_USE_ASSERT
-00118             return internal_try_acquire (mutex);
-00119 #else
-00120             bool result;
-00121   #if _WIN32||_WIN64
-00122             result = TryEnterCriticalSection(&mutex.impl)!=0;
-00123   #else
-00124             result = pthread_mutex_trylock(&mutex.impl)==0;
-00125   #endif /* _WIN32||_WIN64 */
-00126             if( result )
-00127                 my_mutex = &mutex;
-00128             return result;
-00129 #endif /* TBB_USE_ASSERT */
-00130         }
-00131 
-00133         void release() {
-00134 #if TBB_USE_ASSERT
-00135             internal_release ();
-00136 #else
-00137   #if _WIN32||_WIN64
-00138             LeaveCriticalSection(&my_mutex->impl);
-00139   #else
-00140             pthread_mutex_unlock(&my_mutex->impl);
-00141   #endif /* _WIN32||_WIN64 */
-00142             my_mutex = NULL;
-00143 #endif /* TBB_USE_ASSERT */
-00144         }
-00145 
-00146     private:
-00148         mutex* my_mutex;
-00149 
-00151         void __TBB_EXPORTED_METHOD internal_acquire( mutex& m );
-00152 
-00154         bool __TBB_EXPORTED_METHOD internal_try_acquire( mutex& m );
-00155 
-00157         void __TBB_EXPORTED_METHOD internal_release();
-00158     };
-00159 
-00160     // Mutex traits
-00161     static const bool is_rw_mutex = false;
-00162     static const bool is_recursive_mutex = false;
-00163     static const bool is_fair_mutex = false;
-00164 
-00165 private:
-00166 #if _WIN32||_WIN64
-00167     CRITICAL_SECTION impl;    
-00168     enum state_t {
-00169         INITIALIZED=0x1234,
-00170         DESTROYED=0x789A,
-00171         HELD=0x56CD
-00172     } state;
-00173 #else
-00174     pthread_mutex_t impl;
-00175 #endif /* _WIN32||_WIN64 */
-00176 
-00178     void __TBB_EXPORTED_METHOD internal_construct();
-00179 
-00181     void __TBB_EXPORTED_METHOD internal_destroy();
-00182 };
-00183 
-00184 __TBB_DEFINE_PROFILING_SET_NAME(mutex)
-00185 
-00186 } // namespace tbb 
-00187 
-00188 #endif /* __TBB_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00244.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00244.html deleted file mode 100644 index 5330ee7e9c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00244.html +++ /dev/null @@ -1,80 +0,0 @@ - - -null_mutex.h Source File - - - - - - -

null_mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_null_mutex_H
-00022 #define __TBB_null_mutex_H
-00023 
-00024 namespace tbb {
-00025     
-00026 class null_mutex {   
-00028     null_mutex( const null_mutex& );   
-00029     void operator=( const null_mutex& );   
-00030 public:   
-00031     class scoped_lock {   
-00032     public:   
-00033         scoped_lock() {}
-00034         scoped_lock( null_mutex& ) {}   
-00035         ~scoped_lock() {}
-00036         void acquire( null_mutex& ) {}
-00037         bool try_acquire( null_mutex& ) { return true; }
-00038         void release() {}
-00039     };
-00040   
-00041     null_mutex() {}
-00042     
-00043     // Mutex traits   
-00044     static const bool is_rw_mutex = false;   
-00045     static const bool is_recursive_mutex = true;
-00046     static const bool is_fair_mutex = true;
-00047 };  
-00048 
-00049 }
-00050 
-00051 #endif /* __TBB_null_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00247.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00247.html deleted file mode 100644 index 886e901d66..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00247.html +++ /dev/null @@ -1,82 +0,0 @@ - - -null_rw_mutex.h Source File - - - - - - -

null_rw_mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_null_rw_mutex_H
-00022 #define __TBB_null_rw_mutex_H
-00023 
-00024 namespace tbb {
-00025     
-00026 class null_rw_mutex {
-00028     null_rw_mutex( const null_rw_mutex& );   
-00029     void operator=( const null_rw_mutex& );   
-00030 public:   
-00031     class scoped_lock {   
-00032     public:   
-00033         scoped_lock() {}
-00034         scoped_lock( null_rw_mutex& , bool = true ) {}
-00035         ~scoped_lock() {}
-00036         void acquire( null_rw_mutex& , bool = true ) {}
-00037         bool upgrade_to_writer() { return true; }
-00038         bool downgrade_to_reader() { return true; }
-00039         bool try_acquire( null_rw_mutex& , bool = true ) { return true; }
-00040         void release() {}
-00041     };
-00042   
-00043     null_rw_mutex() {}
-00044     
-00045     // Mutex traits   
-00046     static const bool is_rw_mutex = true;   
-00047     static const bool is_recursive_mutex = true;
-00048     static const bool is_fair_mutex = true;
-00049 };  
-00050 
-00051 }
-00052 
-00053 #endif /* __TBB_null_rw_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00249.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00249.html deleted file mode 100644 index 2b5d660f12..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00249.html +++ /dev/null @@ -1,480 +0,0 @@ - - -parallel_do.h Source File - - - - - - -

parallel_do.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_parallel_do_H
-00022 #define __TBB_parallel_do_H
-00023 
-00024 #include "task.h"
-00025 #include "aligned_space.h"
-00026 #include <iterator>
-00027 
-00028 namespace tbb {
-00029 
-00031 namespace internal {
-00032     template<typename Body, typename Item> class parallel_do_feeder_impl;
-00033     template<typename Body> class do_group_task;
-00034 
-00036     template<typename T>
-00037     struct strip { typedef T type; };
-00038     template<typename T>
-00039     struct strip<T&> { typedef T type; };
-00040     template<typename T>
-00041     struct strip<const T&> { typedef T type; };
-00042     template<typename T>
-00043     struct strip<volatile T&> { typedef T type; };
-00044     template<typename T>
-00045     struct strip<const volatile T&> { typedef T type; };
-00046     // Most of the compilers remove cv-qualifiers from non-reference function argument types. 
-00047     // But unfortunately there are those that don't.
-00048     template<typename T>
-00049     struct strip<const T> { typedef T type; };
-00050     template<typename T>
-00051     struct strip<volatile T> { typedef T type; };
-00052     template<typename T>
-00053     struct strip<const volatile T> { typedef T type; };
-00054 } // namespace internal
-00056 
-00058 
-00059 template<typename Item>
-00060 class parallel_do_feeder: internal::no_copy
-00061 {
-00062     parallel_do_feeder() {}
-00063     virtual ~parallel_do_feeder () {}
-00064     virtual void internal_add( const Item& item ) = 0;
-00065     template<typename Body_, typename Item_> friend class internal::parallel_do_feeder_impl;
-00066 public:
-00068     void add( const Item& item ) {internal_add(item);}
-00069 };
-00070 
-00072 namespace internal {
-00074 
-00076     template<class Body, typename Item>
-00077     class parallel_do_operator_selector
-00078     {
-00079         typedef parallel_do_feeder<Item> Feeder;
-00080         template<typename A1, typename A2, typename CvItem >
-00081         static void internal_call( const Body& obj, A1& arg1, A2&, void (Body::*)(CvItem) const ) {
-00082             obj(arg1);
-00083         }
-00084         template<typename A1, typename A2, typename CvItem >
-00085         static void internal_call( const Body& obj, A1& arg1, A2& arg2, void (Body::*)(CvItem, parallel_do_feeder<Item>&) const ) {
-00086             obj(arg1, arg2);
-00087         }
-00088 
-00089     public:
-00090         template<typename A1, typename A2 >
-00091         static void call( const Body& obj, A1& arg1, A2& arg2 )
-00092         {
-00093             internal_call( obj, arg1, arg2, &Body::operator() );
-00094         }
-00095     };
-00096 
-00098 
-00100     template<typename Body, typename Item>
-00101     class do_iteration_task: public task
-00102     {
-00103         typedef parallel_do_feeder_impl<Body, Item> feeder_type;
-00104 
-00105         Item my_value;
-00106         feeder_type& my_feeder;
-00107 
-00108         do_iteration_task( const Item& value, feeder_type& feeder ) : 
-00109             my_value(value), my_feeder(feeder)
-00110         {}
-00111 
-00112         /*override*/ 
-00113         task* execute()
-00114         {
-00115             parallel_do_operator_selector<Body, Item>::call(*my_feeder.my_body, my_value, my_feeder);
-00116             return NULL;
-00117         }
-00118 
-00119         template<typename Body_, typename Item_> friend class parallel_do_feeder_impl;
-00120     }; // class do_iteration_task
-00121 
-00122     template<typename Iterator, typename Body, typename Item>
-00123     class do_iteration_task_iter: public task
-00124     {
-00125         typedef parallel_do_feeder_impl<Body, Item> feeder_type;
-00126 
-00127         Iterator my_iter;
-00128         feeder_type& my_feeder;
-00129 
-00130         do_iteration_task_iter( const Iterator& iter, feeder_type& feeder ) : 
-00131             my_iter(iter), my_feeder(feeder)
-00132         {}
-00133 
-00134         /*override*/ 
-00135         task* execute()
-00136         {
-00137             parallel_do_operator_selector<Body, Item>::call(*my_feeder.my_body, *my_iter, my_feeder);
-00138             return NULL;
-00139         }
-00140 
-00141         template<typename Iterator_, typename Body_, typename Item_> friend class do_group_task_forward;    
-00142         template<typename Body_, typename Item_> friend class do_group_task_input;    
-00143         template<typename Iterator_, typename Body_, typename Item_> friend class do_task_iter;    
-00144     }; // class do_iteration_task_iter
-00145 
-00147 
-00149     template<class Body, typename Item>
-00150     class parallel_do_feeder_impl : public parallel_do_feeder<Item>
-00151     {
-00152         /*override*/ 
-00153         void internal_add( const Item& item )
-00154         {
-00155             typedef do_iteration_task<Body, Item> iteration_type;
-00156 
-00157             iteration_type& t = *new (task::self().allocate_additional_child_of(*my_barrier)) iteration_type(item, *this);
-00158 
-00159             t.spawn( t );
-00160         }
-00161     public:
-00162         const Body* my_body;
-00163         empty_task* my_barrier;
-00164 
-00165         parallel_do_feeder_impl()
-00166         {
-00167             my_barrier = new( task::allocate_root() ) empty_task();
-00168             __TBB_ASSERT(my_barrier, "root task allocation failed");
-00169         }
-00170 
-00171 #if __TBB_EXCEPTIONS
-00172         parallel_do_feeder_impl(tbb::task_group_context &context)
-00173         {
-00174             my_barrier = new( task::allocate_root(context) ) empty_task();
-00175             __TBB_ASSERT(my_barrier, "root task allocation failed");
-00176         }
-00177 #endif
-00178 
-00179         ~parallel_do_feeder_impl()
-00180         {
-00181             my_barrier->destroy(*my_barrier);
-00182         }
-00183     }; // class parallel_do_feeder_impl
-00184 
-00185 
-00187 
-00190     template<typename Iterator, typename Body, typename Item>
-00191     class do_group_task_forward: public task
-00192     {
-00193         static const size_t max_arg_size = 4;         
-00194 
-00195         typedef parallel_do_feeder_impl<Body, Item> feeder_type;
-00196 
-00197         feeder_type& my_feeder;
-00198         Iterator my_first;
-00199         size_t my_size;
-00200         
-00201         do_group_task_forward( Iterator first, size_t size, feeder_type& feeder ) 
-00202             : my_feeder(feeder), my_first(first), my_size(size)
-00203         {}
-00204 
-00205         /*override*/ task* execute()
-00206         {
-00207             typedef do_iteration_task_iter<Iterator, Body, Item> iteration_type;
-00208             __TBB_ASSERT( my_size>0, NULL );
-00209             task_list list;
-00210             task* t; 
-00211             size_t k=0; 
-00212             for(;;) {
-00213                 t = new( allocate_child() ) iteration_type( my_first, my_feeder );
-00214                 ++my_first;
-00215                 if( ++k==my_size ) break;
-00216                 list.push_back(*t);
-00217             }
-00218             set_ref_count(int(k+1));
-00219             spawn(list);
-00220             spawn_and_wait_for_all(*t);
-00221             return NULL;
-00222         }
-00223 
-00224         template<typename Iterator_, typename Body_, typename _Item> friend class do_task_iter;
-00225     }; // class do_group_task_forward
-00226 
-00227     template<typename Body, typename Item>
-00228     class do_group_task_input: public task
-00229     {
-00230         static const size_t max_arg_size = 4;         
-00231         
-00232         typedef parallel_do_feeder_impl<Body, Item> feeder_type;
-00233 
-00234         feeder_type& my_feeder;
-00235         size_t my_size;
-00236         aligned_space<Item, max_arg_size> my_arg;
-00237 
-00238         do_group_task_input( feeder_type& feeder ) 
-00239             : my_feeder(feeder), my_size(0)
-00240         {}
-00241 
-00242         /*override*/ task* execute()
-00243         {
-00244             typedef do_iteration_task_iter<Item*, Body, Item> iteration_type;
-00245             __TBB_ASSERT( my_size>0, NULL );
-00246             task_list list;
-00247             task* t; 
-00248             size_t k=0; 
-00249             for(;;) {
-00250                 t = new( allocate_child() ) iteration_type( my_arg.begin() + k, my_feeder );
-00251                 if( ++k==my_size ) break;
-00252                 list.push_back(*t);
-00253             }
-00254             set_ref_count(int(k+1));
-00255             spawn(list);
-00256             spawn_and_wait_for_all(*t);
-00257             return NULL;
-00258         }
-00259 
-00260         ~do_group_task_input(){
-00261             for( size_t k=0; k<my_size; ++k)
-00262                 (my_arg.begin() + k)->~Item();
-00263         }
-00264 
-00265         template<typename Iterator_, typename Body_, typename Item_> friend class do_task_iter;
-00266     }; // class do_group_task_input
-00267     
-00269 
-00271     template<typename Iterator, typename Body, typename Item>
-00272     class do_task_iter: public task
-00273     {
-00274         typedef parallel_do_feeder_impl<Body, Item> feeder_type;
-00275 
-00276     public:
-00277         do_task_iter( Iterator first, Iterator last , feeder_type& feeder ) : 
-00278             my_first(first), my_last(last), my_feeder(feeder)
-00279         {}
-00280 
-00281     private:
-00282         Iterator my_first;
-00283         Iterator my_last;
-00284         feeder_type& my_feeder;
-00285 
-00286         /* Do not merge run(xxx) and run_xxx() methods. They are separated in order
-00287             to make sure that compilers will eliminate unused argument of type xxx
-00288             (that is will not put it on stack). The sole purpose of this argument 
-00289             is overload resolution.
-00290             
-00291             An alternative could be using template functions, but explicit specialization 
-00292             of member function templates is not supported for non specialized class 
-00293             templates. Besides template functions would always fall back to the least 
-00294             efficient variant (the one for input iterators) in case of iterators having 
-00295             custom tags derived from basic ones. */
-00296         /*override*/ task* execute()
-00297         {
-00298             typedef typename std::iterator_traits<Iterator>::iterator_category iterator_tag;
-00299             return run( (iterator_tag*)NULL );
-00300         }
-00301 
-00304         inline task* run( void* ) { return run_for_input_iterator(); }
-00305         
-00306         task* run_for_input_iterator() {
-00307             typedef do_group_task_input<Body, Item> block_type;
-00308 
-00309             block_type& t = *new( allocate_additional_child_of(*my_feeder.my_barrier) ) block_type(my_feeder);
-00310             size_t k=0; 
-00311             while( !(my_first == my_last) ) {
-00312                 new (t.my_arg.begin() + k) Item(*my_first);
-00313                 ++my_first;
-00314                 if( ++k==block_type::max_arg_size ) {
-00315                     if ( !(my_first == my_last) )
-00316                         recycle_to_reexecute();
-00317                     break;
-00318                 }
-00319             }
-00320             if( k==0 ) {
-00321                 destroy(t);
-00322                 return NULL;
-00323             } else {
-00324                 t.my_size = k;
-00325                 return &t;
-00326             }
-00327         }
-00328 
-00329         inline task* run( std::forward_iterator_tag* ) { return run_for_forward_iterator(); }
-00330 
-00331         task* run_for_forward_iterator() {
-00332             typedef do_group_task_forward<Iterator, Body, Item> block_type;
-00333 
-00334             Iterator first = my_first;
-00335             size_t k=0; 
-00336             while( !(my_first==my_last) ) {
-00337                 ++my_first;
-00338                 if( ++k==block_type::max_arg_size ) {
-00339                     if ( !(my_first==my_last) )
-00340                         recycle_to_reexecute();
-00341                     break;
-00342                 }
-00343             }
-00344             return k==0 ? NULL : new( allocate_additional_child_of(*my_feeder.my_barrier) ) block_type(first, k, my_feeder);
-00345         }
-00346         
-00347         inline task* run( std::random_access_iterator_tag* ) { return run_for_random_access_iterator(); }
-00348 
-00349         task* run_for_random_access_iterator() {
-00350             typedef do_group_task_forward<Iterator, Body, Item> block_type;
-00351             typedef do_iteration_task_iter<Iterator, Body, Item> iteration_type;
-00352             
-00353             size_t k = static_cast<size_t>(my_last-my_first); 
-00354             if( k > block_type::max_arg_size ) {
-00355                 Iterator middle = my_first + k/2;
-00356 
-00357                 empty_task& c = *new( allocate_continuation() ) empty_task;
-00358                 do_task_iter& b = *new( c.allocate_child() ) do_task_iter(middle, my_last, my_feeder);
-00359                 recycle_as_child_of(c);
-00360 
-00361                 my_last = middle;
-00362                 c.set_ref_count(2);
-00363                 c.spawn(b);
-00364                 return this;
-00365             }else if( k != 0 ) {
-00366                 task_list list;
-00367                 task* t; 
-00368                 size_t k1=0; 
-00369                 for(;;) {
-00370                     t = new( allocate_child() ) iteration_type(my_first, my_feeder);
-00371                     ++my_first;
-00372                     if( ++k1==k ) break;
-00373                     list.push_back(*t);
-00374                 }
-00375                 set_ref_count(int(k+1));
-00376                 spawn(list);
-00377                 spawn_and_wait_for_all(*t);
-00378             }
-00379             return NULL;
-00380         }
-00381     }; // class do_task_iter
-00382 
-00384 
-00386     template<typename Iterator, typename Body, typename Item> 
-00387     void run_parallel_do( Iterator first, Iterator last, const Body& body
-00388 #if __TBB_EXCEPTIONS
-00389         , task_group_context& context
-00390 #endif
-00391         )
-00392     {
-00393         typedef do_task_iter<Iterator, Body, Item> root_iteration_task;
-00394 #if __TBB_EXCEPTIONS
-00395         parallel_do_feeder_impl<Body, Item> feeder(context);
-00396 #else
-00397         parallel_do_feeder_impl<Body, Item> feeder;
-00398 #endif
-00399         feeder.my_body = &body;
-00400 
-00401         root_iteration_task &t = *new( feeder.my_barrier->allocate_child() ) root_iteration_task(first, last, feeder);
-00402 
-00403         feeder.my_barrier->set_ref_count(2);
-00404         feeder.my_barrier->spawn_and_wait_for_all(t);
-00405     }
-00406 
-00408 
-00410     template<typename Iterator, typename Body, typename Item> 
-00411     void select_parallel_do( Iterator first, Iterator last, const Body& body, void (Body::*)(Item) const
-00412 #if __TBB_EXCEPTIONS
-00413         , task_group_context& context 
-00414 #endif // __TBB_EXCEPTIONS 
-00415         )
-00416     {
-00417         run_parallel_do<Iterator, Body, typename strip<Item>::type>( first, last, body
-00418 #if __TBB_EXCEPTIONS
-00419             , context
-00420 #endif // __TBB_EXCEPTIONS 
-00421             );
-00422     }
-00423 
-00425 
-00427     template<typename Iterator, typename Body, typename Item, typename _Item> 
-00428     void select_parallel_do( Iterator first, Iterator last, const Body& body, void (Body::*)(Item, parallel_do_feeder<_Item>&) const
-00429 #if __TBB_EXCEPTIONS
-00430         , task_group_context& context 
-00431 #endif // __TBB_EXCEPTIONS
-00432         )
-00433     {
-00434         run_parallel_do<Iterator, Body, typename strip<Item>::type>( first, last, body
-00435 #if __TBB_EXCEPTIONS
-00436             , context
-00437 #endif // __TBB_EXCEPTIONS
-00438             );
-00439     }
-00440 
-00441 } // namespace internal
-00443 
-00444 
-00467 
-00468 
-00469 template<typename Iterator, typename Body> 
-00470 void parallel_do( Iterator first, Iterator last, const Body& body )
-00471 {
-00472     if ( first == last )
-00473         return;
-00474 #if __TBB_EXCEPTIONS
-00475     task_group_context context;
-00476 #endif // __TBB_EXCEPTIONS
-00477     internal::select_parallel_do( first, last, body, &Body::operator()
-00478 #if __TBB_EXCEPTIONS
-00479         , context
-00480 #endif // __TBB_EXCEPTIONS
-00481         );
-00482 }
-00483 
-00484 #if __TBB_EXCEPTIONS
-00486 
-00487 template<typename Iterator, typename Body> 
-00488 void parallel_do( Iterator first, Iterator last, const Body& body, task_group_context& context  )
-00489 {
-00490     if ( first == last )
-00491         return;
-00492     internal::select_parallel_do( first, last, body, &Body::operator(), context );
-00493 }
-00494 #endif // __TBB_EXCEPTIONS
-00495 
-00497 
-00498 } // namespace 
-00499 
-00500 #endif /* __TBB_parallel_do_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00258.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00258.html deleted file mode 100644 index 4fc28c5050..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00258.html +++ /dev/null @@ -1,174 +0,0 @@ - - -parallel_for.h Source File - - - - - - -

parallel_for.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_parallel_for_H
-00022 #define __TBB_parallel_for_H
-00023 
-00024 #include "task.h"
-00025 #include "partitioner.h"
-00026 #include <new>
-00027 
-00028 namespace tbb {
-00029 
-00031 namespace internal {
-00032 
-00034 
-00035     template<typename Range, typename Body, typename Partitioner>
-00036     class start_for: public task {
-00037         Range my_range;
-00038         const Body my_body;
-00039         typename Partitioner::partition_type my_partition;
-00040         /*override*/ task* execute();
-00041 
-00043         start_for( const Range& range, const Body& body, Partitioner& partitioner ) :
-00044             my_range(range),    
-00045             my_body(body),
-00046             my_partition(partitioner)
-00047         {
-00048         }
-00050 
-00051         start_for( start_for& parent, split ) :
-00052             my_range(parent.my_range,split()),    
-00053             my_body(parent.my_body),
-00054             my_partition(parent.my_partition,split())
-00055         {
-00056             my_partition.set_affinity(*this);
-00057         }
-00059         /*override*/ void note_affinity( affinity_id id ) {
-00060             my_partition.note_affinity( id );
-00061         }
-00062     public:
-00063         static void run(  const Range& range, const Body& body, const Partitioner& partitioner ) {
-00064             if( !range.empty() ) {
-00065 #if !__TBB_EXCEPTIONS || TBB_JOIN_OUTER_TASK_GROUP
-00066                 start_for& a = *new(task::allocate_root()) start_for(range,body,const_cast<Partitioner&>(partitioner));
-00067 #else
-00068                 // Bound context prevents exceptions from body to affect nesting or sibling algorithms,
-00069                 // and allows users to handle exceptions safely by wrapping parallel_for in the try-block.
-00070                 task_group_context context;
-00071                 start_for& a = *new(task::allocate_root(context)) start_for(range,body,const_cast<Partitioner&>(partitioner));
-00072 #endif /* __TBB_EXCEPTIONS && !TBB_JOIN_OUTER_TASK_GROUP */
-00073                 task::spawn_root_and_wait(a);
-00074             }
-00075         }
-00076 #if __TBB_EXCEPTIONS
-00077         static void run(  const Range& range, const Body& body, const Partitioner& partitioner, task_group_context& context ) {
-00078             if( !range.empty() ) {
-00079                 start_for& a = *new(task::allocate_root(context)) start_for(range,body,const_cast<Partitioner&>(partitioner));
-00080                 task::spawn_root_and_wait(a);
-00081             }
-00082         }
-00083 #endif /* __TBB_EXCEPTIONS */
-00084     };
-00085 
-00086     template<typename Range, typename Body, typename Partitioner>
-00087     task* start_for<Range,Body,Partitioner>::execute() {
-00088         if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) {
-00089             my_body( my_range );
-00090             return my_partition.continue_after_execute_range(*this); 
-00091         } else {
-00092             empty_task& c = *new( this->allocate_continuation() ) empty_task;
-00093             recycle_as_child_of(c);
-00094             c.set_ref_count(2);
-00095             bool delay = my_partition.decide_whether_to_delay();
-00096             start_for& b = *new( c.allocate_child() ) start_for(*this,split());
-00097             my_partition.spawn_or_delay(delay,*this,b);
-00098             return this;
-00099         }
-00100     } 
-00101 } // namespace internal
-00103 
-00104 
-00105 // Requirements on Range concept are documented in blocked_range.h
-00106 
-00117 
-00119 
-00120 template<typename Range, typename Body>
-00121 void parallel_for( const Range& range, const Body& body, const simple_partitioner& partitioner=simple_partitioner() ) {
-00122     internal::start_for<Range,Body,simple_partitioner>::run(range,body,partitioner);
-00123 }
-00124 
-00126 
-00127 template<typename Range, typename Body>
-00128 void parallel_for( const Range& range, const Body& body, const auto_partitioner& partitioner ) {
-00129     internal::start_for<Range,Body,auto_partitioner>::run(range,body,partitioner);
-00130 }
-00131 
-00133 
-00134 template<typename Range, typename Body>
-00135 void parallel_for( const Range& range, const Body& body, affinity_partitioner& partitioner ) {
-00136     internal::start_for<Range,Body,affinity_partitioner>::run(range,body,partitioner);
-00137 }
-00138 
-00139 #if __TBB_EXCEPTIONS
-00141 
-00142 template<typename Range, typename Body>
-00143 void parallel_for( const Range& range, const Body& body, const simple_partitioner& partitioner, task_group_context& context ) {
-00144     internal::start_for<Range,Body,simple_partitioner>::run(range, body, partitioner, context);
-00145 }
-00146 
-00148 
-00149 template<typename Range, typename Body>
-00150 void parallel_for( const Range& range, const Body& body, const auto_partitioner& partitioner, task_group_context& context ) {
-00151     internal::start_for<Range,Body,auto_partitioner>::run(range, body, partitioner, context);
-00152 }
-00153 
-00155 
-00156 template<typename Range, typename Body>
-00157 void parallel_for( const Range& range, const Body& body, affinity_partitioner& partitioner, task_group_context& context ) {
-00158     internal::start_for<Range,Body,affinity_partitioner>::run(range,body,partitioner, context);
-00159 }
-00160 #endif /* __TBB_EXCEPTIONS */
-00161 
-00162 
-00163 } // namespace tbb
-00164 
-00165 #endif /* __TBB_parallel_for_H */
-00166 
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00260.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00260.html deleted file mode 100644 index bdfbd85fd6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00260.html +++ /dev/null @@ -1,348 +0,0 @@ - - -parallel_invoke.h Source File - - - - - - -

parallel_invoke.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_parallel_invoke_H
-00022 #define __TBB_parallel_invoke_H
-00023 
-00024 #include "task.h"
-00025 
-00026 namespace tbb {
-00027 
-00029 namespace internal {
-00030     // Simple task object, executing user method
-00031     template<typename function>
-00032     class function_invoker : public task{
-00033     public:
-00034         function_invoker(function& _function) : my_function(_function) {}
-00035     private:
-00036         function &my_function;
-00037         /*override*/
-00038         task* execute()
-00039         {
-00040             my_function();
-00041             return NULL;
-00042         }
-00043     };
-00044 
-00045     // The class spawns two or three child tasks
-00046     template <size_t N, typename function1, typename function2, typename function3>
-00047     class spawner : public task {
-00048     private:
-00049         function1& my_func1;
-00050         function2& my_func2;
-00051         function3& my_func3;
-00052         bool is_recycled;
-00053 
-00054         task* execute (){
-00055             if(is_recycled){
-00056                 return NULL;
-00057             }else{
-00058                 __TBB_ASSERT(N==2 || N==3, "Number of arguments passed to spawner is wrong");
-00059                 set_ref_count(N);
-00060                 recycle_as_safe_continuation();
-00061                 internal::function_invoker<function2>* invoker2 = new (allocate_child()) internal::function_invoker<function2>(my_func2);
-00062                 __TBB_ASSERT(invoker2, "Child task allocation failed");
-00063                 spawn(*invoker2);
-00064                 size_t n = N; // To prevent compiler warnings
-00065                 if (n>2) {
-00066                     internal::function_invoker<function3>* invoker3 = new (allocate_child()) internal::function_invoker<function3>(my_func3);
-00067                     __TBB_ASSERT(invoker3, "Child task allocation failed");
-00068                     spawn(*invoker3);
-00069                 }
-00070                 my_func1();
-00071                 is_recycled = true;
-00072                 return NULL;
-00073             }
-00074         } // execute
-00075 
-00076     public:
-00077         spawner(function1& _func1, function2& _func2, function3& _func3) : my_func1(_func1), my_func2(_func2), my_func3(_func3), is_recycled(false) {}
-00078     };
-00079 
-00080     // Creates and spawns child tasks
-00081     class parallel_invoke_helper : public empty_task {
-00082     public:
-00083         // Dummy functor class
-00084         class parallel_invoke_noop {
-00085         public:
-00086             void operator() () const {}
-00087         };
-00088         // Creates a helper object with user-defined number of children expected
-00089         parallel_invoke_helper(int number_of_children)
-00090         {
-00091             set_ref_count(number_of_children + 1);
-00092         }
-00093         // Adds child task and spawns it
-00094         template <typename function>
-00095         void add_child (function &_func)
-00096         {
-00097             internal::function_invoker<function>* invoker = new (allocate_child()) internal::function_invoker<function>(_func);
-00098             __TBB_ASSERT(invoker, "Child task allocation failed");
-00099             spawn(*invoker);
-00100         }
-00101 
-00102         // Adds a task with multiple child tasks and spawns it
-00103         // two arguments
-00104         template <typename function1, typename function2>
-00105         void add_children (function1& _func1, function2& _func2)
-00106         {
-00107             // The third argument is dummy, it is ignored actually.
-00108             parallel_invoke_noop noop;
-00109             internal::spawner<2, function1, function2, parallel_invoke_noop>& sub_root = *new(allocate_child())internal::spawner<2, function1, function2, parallel_invoke_noop>(_func1, _func2, noop);
-00110             spawn(sub_root);
-00111         }
-00112         // three arguments
-00113         template <typename function1, typename function2, typename function3>
-00114         void add_children (function1& _func1, function2& _func2, function3& _func3)
-00115         {
-00116             internal::spawner<3, function1, function2, function3>& sub_root = *new(allocate_child())internal::spawner<3, function1, function2, function3>(_func1, _func2, _func3);
-00117             spawn(sub_root);
-00118         }
-00119 
-00120         // Waits for all child tasks
-00121         template <typename F0>
-00122         void run_and_finish(F0& f0)
-00123         {
-00124             internal::function_invoker<F0>* invoker = new (allocate_child()) internal::function_invoker<F0>(f0);
-00125             __TBB_ASSERT(invoker, "Child task allocation failed");
-00126             spawn_and_wait_for_all(*invoker);
-00127         }
-00128     };
-00129     // The class destroys root if exception occured as well as in normal case
-00130     class parallel_invoke_cleaner: internal::no_copy { 
-00131     public:
-00132         parallel_invoke_cleaner(int number_of_children, tbb::task_group_context& context) : root(*new(task::allocate_root(context)) internal::parallel_invoke_helper(number_of_children))
-00133         {}
-00134         ~parallel_invoke_cleaner(){
-00135             root.destroy(root);
-00136         }
-00137         internal::parallel_invoke_helper& root;
-00138     };
-00139 } // namespace internal
-00141 
-00145 
-00146 
-00148 // parallel_invoke with user-defined context
-00149 // two arguments
-00150 template<typename F0, typename F1 >
-00151 void parallel_invoke(F0& f0, F1& f1, tbb::task_group_context& context) {
-00152     internal::parallel_invoke_cleaner cleaner(2, context);
-00153     internal::parallel_invoke_helper& root = cleaner.root;
-00154 
-00155     root.add_child(f1);
-00156 
-00157     root.run_and_finish(f0);
-00158 }
-00159 
-00160 // three arguments
-00161 template<typename F0, typename F1, typename F2 >
-00162 void parallel_invoke(F0& f0, F1& f1, F2& f2, tbb::task_group_context& context) {
-00163     internal::parallel_invoke_cleaner cleaner(3, context);
-00164     internal::parallel_invoke_helper& root = cleaner.root;
-00165 
-00166     root.add_child(f2);
-00167     root.add_child(f1);
-00168 
-00169     root.run_and_finish(f0);
-00170 }
-00171 
-00172 // four arguments
-00173 template<typename F0, typename F1, typename F2, typename F3>
-00174 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, tbb::task_group_context& context) {
-00175     internal::parallel_invoke_cleaner cleaner(4, context);
-00176     internal::parallel_invoke_helper& root = cleaner.root;
-00177 
-00178     root.add_child(f3);
-00179     root.add_child(f2);
-00180     root.add_child(f1);
-00181 
-00182     root.run_and_finish(f0);
-00183 }
-00184 
-00185 // five arguments
-00186 template<typename F0, typename F1, typename F2, typename F3, typename F4 >
-00187 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, tbb::task_group_context& context) {
-00188     internal::parallel_invoke_cleaner cleaner(3, context);
-00189     internal::parallel_invoke_helper& root = cleaner.root;
-00190 
-00191     root.add_children(f4, f3);
-00192     root.add_children(f2, f1);
-00193 
-00194     root.run_and_finish(f0);
-00195 }
-00196 
-00197 // six arguments
-00198 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5 >
-00199 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, tbb::task_group_context& context) {
-00200     internal::parallel_invoke_cleaner cleaner(3, context);
-00201     internal::parallel_invoke_helper& root = cleaner.root;
-00202 
-00203     root.add_children(f5, f4, f3);
-00204     root.add_children(f2, f1);
-00205 
-00206     root.run_and_finish(f0);
-00207 }
-00208 
-00209 // seven arguments
-00210 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6 >
-00211 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, tbb::task_group_context& context) {
-00212     internal::parallel_invoke_cleaner cleaner(3, context);
-00213     internal::parallel_invoke_helper& root = cleaner.root;
-00214 
-00215     root.add_children(f6, f5, f4);
-00216     root.add_children(f3, f2, f1);
-00217 
-00218     root.run_and_finish(f0);
-00219 }
-00220 
-00221 // eight arguments
-00222 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
-00223     typename F7>
-00224 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, tbb::task_group_context& context) {
-00225     internal::parallel_invoke_cleaner cleaner(4, context);
-00226     internal::parallel_invoke_helper& root = cleaner.root;
-00227 
-00228     root.add_children(f7, f6, f5);
-00229     root.add_children(f4, f3);
-00230     root.add_children(f2, f1);
-00231 
-00232     root.run_and_finish(f0);
-00233 }
-00234 
-00235 // nine arguments
-00236 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
-00237         typename F7, typename F8>
-00238 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8, tbb::task_group_context& context) {
-00239     internal::parallel_invoke_cleaner cleaner(4, context);
-00240     internal::parallel_invoke_helper& root = cleaner.root;
-00241 
-00242     root.add_children(f8, f7, f6);
-00243     root.add_children(f5, f4, f3);
-00244     root.add_children(f2, f1);
-00245 
-00246     root.run_and_finish(f0);
-00247 }
-00248 
-00249 // ten arguments
-00250 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
-00251         typename F7, typename F8, typename F9>
-00252 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8, F9 &f9, tbb::task_group_context& context) {
-00253     internal::parallel_invoke_cleaner cleaner(4, context);
-00254     internal::parallel_invoke_helper& root = cleaner.root;
-00255 
-00256     root.add_children(f9, f8, f7);
-00257     root.add_children(f6, f5, f4);
-00258     root.add_children(f3, f2, f1);
-00259 
-00260     root.run_and_finish(f0);
-00261 }
-00262 
-00263 // two arguments
-00264 template<typename F0, typename F1>
-00265 void parallel_invoke(F0& f0, F1& f1) {
-00266     task_group_context context;
-00267     parallel_invoke<F0, F1>(f0, f1, context);
-00268 }
-00269 // three arguments
-00270 template<typename F0, typename F1, typename F2>
-00271 void parallel_invoke(F0& f0, F1& f1, F2& f2) {
-00272     task_group_context context;
-00273     parallel_invoke<F0, F1, F2>(f0, f1, f2, context);
-00274 }
-00275 // four arguments
-00276 template<typename F0, typename F1, typename F2, typename F3 >
-00277 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3) {
-00278     task_group_context context;
-00279     parallel_invoke<F0, F1, F2, F3>(f0, f1, f2, f3, context);
-00280 }
-00281 // five arguments
-00282 template<typename F0, typename F1, typename F2, typename F3, typename F4>
-00283 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4) {
-00284     task_group_context context;
-00285     parallel_invoke<F0, F1, F2, F3, F4>(f0, f1, f2, f3, f4, context);
-00286 }
-00287 // six arguments
-00288 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
-00289 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5) {
-00290     task_group_context context;
-00291     parallel_invoke<F0, F1, F2, F3, F4, F5>(f0, f1, f2, f3, f4, f5, context);
-00292 }
-00293 // seven arguments
-00294 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
-00295 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6) {
-00296     task_group_context context;
-00297     parallel_invoke<F0, F1, F2, F3, F4, F5, F6>(f0, f1, f2, f3, f4, f5, f6, context);
-00298 }
-00299 // eigth arguments
-00300 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
-00301         typename F7>
-00302 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7) {
-00303     task_group_context context;
-00304     parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7>(f0, f1, f2, f3, f4, f5, f6, f7, context);
-00305 }
-00306 // nine arguments
-00307 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
-00308         typename F7, typename F8>
-00309 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8) {
-00310     task_group_context context;
-00311     parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7, F8>(f0, f1, f2, f3, f4, f5, f6, f7, f8, context);
-00312 }
-00313 // ten arguments
-00314 template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
-00315         typename F7, typename F8, typename F9>
-00316 void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8, F9& f9) {
-00317     task_group_context context;
-00318     parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7, F8, F9>(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, context);
-00319 }
-00320 
-00322 
-00323 } // namespace
-00324 
-00325 #endif /* __TBB_parallel_invoke_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00266.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00266.html deleted file mode 100644 index 6612ecf00b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00266.html +++ /dev/null @@ -1,436 +0,0 @@ - - -parallel_reduce.h Source File - - - - - - -

parallel_reduce.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_parallel_reduce_H
-00022 #define __TBB_parallel_reduce_H
-00023 
-00024 #include "task.h"
-00025 #include "aligned_space.h"
-00026 #include "partitioner.h"
-00027 #include <new>
-00028 
-00029 namespace tbb {
-00030 
-00032 namespace internal {
-00033 
-00035     void __TBB_EXPORTED_FUNC itt_store_pointer_with_release_v3( void* dst, void* src );
-00036 
-00038     void* __TBB_EXPORTED_FUNC itt_load_pointer_with_acquire_v3( const void* src );
-00039 
-00040     template<typename T> inline void parallel_reduce_store_body( T*& dst, T* src ) {
-00041 #if TBB_USE_THREADING_TOOLS
-00042         itt_store_pointer_with_release_v3(&dst,src);
-00043 #else
-00044         __TBB_store_with_release(dst,src);
-00045 #endif /* TBB_USE_THREADING_TOOLS */
-00046     }
-00047 
-00048     template<typename T> inline T* parallel_reduce_load_body( T*& src ) {
-00049 #if TBB_USE_THREADING_TOOLS
-00050         return static_cast<T*>(itt_load_pointer_with_acquire_v3(&src));
-00051 #else
-00052         return __TBB_load_with_acquire(src);
-00053 #endif /* TBB_USE_THREADING_TOOLS */
-00054     }
-00055 
-00057 
-00058     template<typename Body>
-00059     class finish_reduce: public task {
-00060         Body* const my_body;
-00061         bool has_right_zombie;
-00062         aligned_space<Body,1> zombie_space;
-00063         finish_reduce( Body* body ) : 
-00064             my_body(body),
-00065             has_right_zombie(false)
-00066         {
-00067         }
-00068         task* execute() {
-00069             if( has_right_zombie ) {
-00070                 // Right child was stolen.
-00071                 Body* s = zombie_space.begin();
-00072                 my_body->join( *s );
-00073                 s->~Body();
-00074             }
-00075             return NULL;
-00076         }       
-00077         template<typename Range,typename Body_, typename Partitioner>
-00078         friend class start_reduce;
-00079     };
-00080 
-00082 
-00083     template<typename Range, typename Body, typename Partitioner>
-00084     class start_reduce: public task {
-00085         typedef finish_reduce<Body> finish_type;
-00086         Body* my_body;
-00087         Range my_range;
-00088         typename Partitioner::partition_type my_partition;
-00089         /*override*/ task* execute();
-00090         template<typename Body_>
-00091         friend class finish_reduce;
-00092     
-00094         start_reduce( const Range& range, Body* body, const Partitioner &partitioner ) :
-00095             my_body(body),
-00096             my_range(range),
-00097             my_partition(partitioner)
-00098         {
-00099         }
-00101 
-00102         start_reduce( start_reduce& parent, split ) :
-00103             my_body(parent.my_body),
-00104             my_range(parent.my_range,split()),
-00105             my_partition(parent.my_partition,split())
-00106         {
-00107         }
-00109 
-00110         /*override*/ void note_affinity( affinity_id /*id*/ ) {
-00111             finish_type* p = static_cast<finish_type*>(parent() );
-00112             Body* body = new( p->zombie_space.begin() ) Body(*my_body,split());
-00113             p->has_right_zombie = true;
-00114             my_body = body;
-00115         }
-00116     public:
-00117 #if !__TBB_EXCEPTIONS
-00118         static void run( const Range& range, Body& body, const Partitioner &partitioner ) {
-00119             if( !range.empty() ) 
-00120                 task::spawn_root_and_wait( *new(task::allocate_root()) start_reduce(range,&body,partitioner) );
-00121         }
-00122 #else /* __TBB_EXCEPTIONS */
-00123         static void run( const Range& range, Body& body, const Partitioner &partitioner ) {
-00124             // Bound context prevents exceptions from body to affect nesting or sibling algorithms,
-00125             // and allows users to handle exceptions safely by wrapping parallel_for in the try-block.
-00126             if( !range.empty() )  {
-00127                 task_group_context context;
-00128                 task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce(range,&body,partitioner) );
-00129             }
-00130         }
-00131         static void run( const Range& range, Body& body, const Partitioner &partitioner, task_group_context& context ) {
-00132             if( !range.empty() ) 
-00133                 task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce(range,&body,partitioner) );
-00134         }
-00135 #endif /* __TBB_EXCEPTIONS */
-00136     };
-00137 
-00138     template<typename Range, typename Body, typename Partitioner>
-00139     task* start_reduce<Range,Body,Partitioner>::execute() {
-00140         if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) {
-00141             (*my_body)( my_range );
-00142             return NULL;
-00143         } else {
-00144             finish_type& c = *new( allocate_continuation()) finish_type(my_body);
-00145             recycle_as_child_of(c);
-00146             c.set_ref_count(2);    
-00147             start_reduce& b = *new( c.allocate_child() ) start_reduce(*this,split());
-00148             spawn(b);
-00149             return this;
-00150         }
-00151     }
-00152  
-00154 
-00155     typedef char reduction_context;
-00156 
-00158 
-00159     template<typename Body>
-00160     class finish_reduce_with_affinity: public task {
-00162         Body* my_body;
-00163         bool has_right_zombie;
-00164         const reduction_context my_context;
-00165         aligned_space<Body,1> zombie_space;
-00166         finish_reduce_with_affinity( char context ) : 
-00167             my_body(NULL),
-00168             has_right_zombie(false),
-00169             my_context(context)
-00170         {
-00171         }
-00172         task* execute() {
-00173             if( has_right_zombie ) {
-00174                 // Right child was stolen.
-00175                 Body* s = zombie_space.begin();
-00176                 my_body->join( *s );
-00177                 s->~Body();
-00178             }
-00179             if( my_context==1 ) 
-00180                 parallel_reduce_store_body( static_cast<finish_reduce_with_affinity*>(parent())->my_body, my_body );
-00181             return NULL;
-00182         }       
-00183         template<typename Range,typename Body_>
-00184         friend class start_reduce_with_affinity;
-00185     };
-00186 
-00188 
-00189     template<typename Range, typename Body>
-00190     class start_reduce_with_affinity: public task {
-00191         typedef finish_reduce_with_affinity<Body> finish_type;
-00192         Body* my_body;
-00193         Range my_range;
-00194         typename affinity_partitioner::partition_type my_partition;
-00195         reduction_context my_context;
-00196         /*override*/ task* execute();
-00197         template<typename Body_>
-00198         friend class finish_reduce_with_affinity;
-00199     
-00201         start_reduce_with_affinity( const Range& range, Body* body, affinity_partitioner& partitioner ) :
-00202             my_body(body),
-00203             my_range(range),
-00204             my_partition(partitioner),
-00205             my_context(0)
-00206         {
-00207         }
-00209 
-00210         start_reduce_with_affinity( start_reduce_with_affinity& parent, split ) :
-00211             my_body(parent.my_body),
-00212             my_range(parent.my_range,split()),
-00213             my_partition(parent.my_partition,split()),
-00214             my_context(2)
-00215         {
-00216             my_partition.set_affinity(*this);
-00217             parent.my_context = 1;
-00218         }
-00220         /*override*/ void note_affinity( affinity_id id ) {
-00221             my_partition.note_affinity( id );
-00222         }
-00223 
-00224 public:
-00225         static void run( const Range& range, Body& body, affinity_partitioner& partitioner ) {
-00226             if( !range.empty() ) {
-00227 #if !__TBB_EXCEPTIONS || TBB_JOIN_OUTER_TASK_GROUP
-00228                 task::spawn_root_and_wait( *new(task::allocate_root()) start_reduce_with_affinity(range,&body,partitioner) );
-00229 #else
-00230                 // Bound context prevents exceptions from body to affect nesting or sibling algorithms,
-00231                 // and allows users to handle exceptions safely by wrapping parallel_for in the try-block.
-00232                 task_group_context context;
-00233                 task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce_with_affinity(range,&body,partitioner) );
-00234 #endif /* __TBB_EXCEPTIONS && !TBB_JOIN_OUTER_TASK_GROUP */
-00235             }
-00236         }
-00237 #if __TBB_EXCEPTIONS
-00238         static void run( const Range& range, Body& body, affinity_partitioner& partitioner, task_group_context& context ) {
-00239             if( !range.empty() ) 
-00240                 task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce_with_affinity(range,&body,partitioner) );
-00241         }
-00242 #endif /* __TBB_EXCEPTIONS */
-00243     };
-00244 
-00245     template<typename Range, typename Body>
-00246     task* start_reduce_with_affinity<Range,Body>::execute() {
-00247         if( my_context==2 ) {
-00248             finish_type* p = static_cast<finish_type*>(parent() );
-00249             if( !parallel_reduce_load_body(p->my_body) ) {
-00250                 my_body = new( p->zombie_space.begin() ) Body(*my_body,split());
-00251                 p->has_right_zombie = true;
-00252             } 
-00253         }
-00254         if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) {
-00255             (*my_body)( my_range );
-00256             if( my_context==1 ) 
-00257                 parallel_reduce_store_body(static_cast<finish_type*>(parent())->my_body, my_body );
-00258             return my_partition.continue_after_execute_range(*this);
-00259         } else {
-00260             finish_type& c = *new( allocate_continuation()) finish_type(my_context);
-00261             recycle_as_child_of(c);
-00262             c.set_ref_count(2);    
-00263             bool delay = my_partition.decide_whether_to_delay();
-00264             start_reduce_with_affinity& b = *new( c.allocate_child() ) start_reduce_with_affinity(*this,split());
-00265             my_partition.spawn_or_delay(delay,*this,b);
-00266             return this;
-00267         }
-00268     } 
-00269 
-00271 
-00275     template<typename Range, typename Value, typename RealBody, typename Reduction>
-00276     class lambda_reduce_body {
-00277 
-00278 //FIXME: decide if my_real_body, my_reduction, and identity_element should be copied or referenced
-00279 //       (might require some performance measurements)
-00280 
-00281         const Value&     identity_element;
-00282         const RealBody&  my_real_body;
-00283         const Reduction& my_reduction;
-00284         Value            my_value;
-00285     public:
-00286         lambda_reduce_body( const Value& identity, const RealBody& body, const Reduction& reduction )
-00287             : identity_element(identity)
-00288             , my_real_body(body)
-00289             , my_reduction(reduction)
-00290             , my_value(identity)
-00291         { }
-00292         lambda_reduce_body( const lambda_reduce_body& other )
-00293             : identity_element(other.identity_element)
-00294             , my_real_body(other.my_real_body)
-00295             , my_reduction(other.my_reduction)
-00296             , my_value(other.my_value)
-00297         { }
-00298         lambda_reduce_body( lambda_reduce_body& other, tbb::split )
-00299             : identity_element(other.identity_element)
-00300             , my_real_body(other.my_real_body)
-00301             , my_reduction(other.my_reduction)
-00302             , my_value(other.identity_element)
-00303         { }
-00304         void operator()(Range& range) {
-00305             my_value = my_real_body(range, const_cast<const Value&>(my_value));
-00306         }
-00307         void join( lambda_reduce_body& rhs ) {
-00308             my_value = my_reduction(const_cast<const Value&>(my_value), const_cast<const Value&>(rhs.my_value));
-00309         }
-00310         Value result() const {
-00311             return my_value;
-00312         }
-00313     };
-00314 
-00315 } // namespace internal
-00317 
-00318 // Requirements on Range concept are documented in blocked_range.h
-00319 
-00338 
-00340 
-00341 template<typename Range, typename Body>
-00342 void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner = simple_partitioner() ) {
-00343     internal::start_reduce<Range,Body,simple_partitioner>::run( range, body, partitioner );
-00344 }
-00345 
-00347 
-00348 template<typename Range, typename Body>
-00349 void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner ) {
-00350     internal::start_reduce<Range,Body,auto_partitioner>::run( range, body, partitioner );
-00351 }
-00352 
-00354 
-00355 template<typename Range, typename Body>
-00356 void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner ) {
-00357     internal::start_reduce_with_affinity<Range,Body>::run( range, body, partitioner );
-00358 }
-00359 
-00360 #if __TBB_EXCEPTIONS
-00362 
-00363 template<typename Range, typename Body>
-00364 void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner, task_group_context& context ) {
-00365     internal::start_reduce<Range,Body,simple_partitioner>::run( range, body, partitioner, context );
-00366 }
-00367 
-00369 
-00370 template<typename Range, typename Body>
-00371 void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner, task_group_context& context ) {
-00372     internal::start_reduce<Range,Body,auto_partitioner>::run( range, body, partitioner, context );
-00373 }
-00374 
-00376 
-00377 template<typename Range, typename Body>
-00378 void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner, task_group_context& context ) {
-00379     internal::start_reduce_with_affinity<Range,Body>::run( range, body, partitioner, context );
-00380 }
-00381 #endif /* __TBB_EXCEPTIONS */
-00382 
-00386 
-00387 
-00388 template<typename Range, typename Value, typename RealBody, typename Reduction>
-00389 Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
-00390                        const simple_partitioner& partitioner = simple_partitioner() ) {
-00391     internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
-00392     internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,simple_partitioner>
-00393                           ::run(range, body, partitioner );
-00394     return body.result();
-00395 }
-00396 
-00398 
-00399 template<typename Range, typename Value, typename RealBody, typename Reduction>
-00400 Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
-00401                        const auto_partitioner& partitioner ) {
-00402     internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
-00403     internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,auto_partitioner>
-00404                           ::run( range, body, partitioner );
-00405     return body.result();
-00406 }
-00407 
-00409 
-00410 template<typename Range, typename Value, typename RealBody, typename Reduction>
-00411 Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
-00412                        affinity_partitioner& partitioner ) {
-00413     internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
-00414     internal::start_reduce_with_affinity<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction> >
-00415                                         ::run( range, body, partitioner );
-00416     return body.result();
-00417 }
-00418 
-00419 #if __TBB_EXCEPTIONS
-00421 
-00422 template<typename Range, typename Value, typename RealBody, typename Reduction>
-00423 Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
-00424                        const simple_partitioner& partitioner, task_group_context& context ) {
-00425     internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
-00426     internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,simple_partitioner>
-00427                           ::run( range, body, partitioner, context );
-00428     return body.result();
-00429 }
-00430 
-00432 
-00433 template<typename Range, typename Value, typename RealBody, typename Reduction>
-00434 Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
-00435                        const auto_partitioner& partitioner, task_group_context& context ) {
-00436     internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
-00437     internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,auto_partitioner>
-00438                           ::run( range, body, partitioner, context );
-00439     return body.result();
-00440 }
-00441 
-00443 
-00444 template<typename Range, typename Value, typename RealBody, typename Reduction>
-00445 Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
-00446                        affinity_partitioner& partitioner, task_group_context& context ) {
-00447     internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
-00448     internal::start_reduce_with_affinity<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction> >
-00449                                         ::run( range, body, partitioner, context );
-00450     return body.result();
-00451 }
-00452 #endif /* __TBB_EXCEPTIONS */
-00453 
-00454 
-00455 } // namespace tbb
-00456 
-00457 #endif /* __TBB_parallel_reduce_H */
-00458 
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00272.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00272.html deleted file mode 100644 index 5898c629d4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00272.html +++ /dev/null @@ -1,335 +0,0 @@ - - -parallel_scan.h Source File - - - - - - -

parallel_scan.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_parallel_scan_H
-00022 #define __TBB_parallel_scan_H
-00023 
-00024 #include "task.h"
-00025 #include "aligned_space.h"
-00026 #include <new>
-00027 #include "partitioner.h"
-00028 
-00029 namespace tbb {
-00030 
-00032 
-00033 struct pre_scan_tag {
-00034     static bool is_final_scan() {return false;}
-00035 };
-00036 
-00038 
-00039 struct final_scan_tag {
-00040     static bool is_final_scan() {return true;}
-00041 };
-00042 
-00044 namespace internal {
-00045 
-00047 
-00048     template<typename Range, typename Body>
-00049     class final_sum: public task {
-00050     public:
-00051         Body body;
-00052     private:
-00053         aligned_space<Range,1> range;
-00055         Body* stuff_last;
-00056     public:
-00057         final_sum( Body& body_ ) :
-00058             body(body_,split())
-00059         {
-00060             poison_pointer(stuff_last);
-00061         }
-00062         ~final_sum() {
-00063             range.begin()->~Range();
-00064         }     
-00065         void finish_construction( const Range& range_, Body* stuff_last_ ) {
-00066             new( range.begin() ) Range(range_);
-00067             stuff_last = stuff_last_;
-00068         }
-00069     private:
-00070         /*override*/ task* execute() {
-00071             body( *range.begin(), final_scan_tag() );
-00072             if( stuff_last )
-00073                 stuff_last->assign(body);
-00074             return NULL;
-00075         }
-00076     };       
-00077 
-00079 
-00080     template<typename Range, typename Body>
-00081     class sum_node: public task {
-00082         typedef final_sum<Range,Body> final_sum_type;
-00083     public:
-00084         final_sum_type *incoming; 
-00085         final_sum_type *body;
-00086         Body *stuff_last;
-00087     private:
-00088         final_sum_type *left_sum;
-00089         sum_node *left;
-00090         sum_node *right;     
-00091         bool left_is_final;
-00092         Range range;
-00093         sum_node( const Range range_, bool left_is_final_ ) : 
-00094             left_sum(NULL), 
-00095             left(NULL), 
-00096             right(NULL), 
-00097             left_is_final(left_is_final_), 
-00098             range(range_)
-00099         {
-00100             // Poison fields that will be set by second pass.
-00101             poison_pointer(body);
-00102             poison_pointer(incoming);
-00103         }
-00104         task* create_child( const Range& range, final_sum_type& f, sum_node* n, final_sum_type* incoming, Body* stuff_last ) {
-00105             if( !n ) {
-00106                 f.recycle_as_child_of( *this );
-00107                 f.finish_construction( range, stuff_last );
-00108                 return &f;
-00109             } else {
-00110                 n->body = &f;
-00111                 n->incoming = incoming;
-00112                 n->stuff_last = stuff_last;
-00113                 return n;
-00114             }
-00115         }
-00116         /*override*/ task* execute() {
-00117             if( body ) {
-00118                 if( incoming )
-00119                     left_sum->body.reverse_join( incoming->body );
-00120                 recycle_as_continuation();
-00121                 sum_node& c = *this;
-00122                 task* b = c.create_child(Range(range,split()),*left_sum,right,left_sum,stuff_last);
-00123                 task* a = left_is_final ? NULL : c.create_child(range,*body,left,incoming,NULL);
-00124                 set_ref_count( (a!=NULL)+(b!=NULL) );
-00125                 body = NULL; 
-00126                 if( a ) spawn(*b);
-00127                 else a = b;
-00128                 return a;
-00129             } else {
-00130                 return NULL;
-00131             }
-00132         }
-00133         template<typename Range_,typename Body_,typename Partitioner_>
-00134         friend class start_scan;
-00135 
-00136         template<typename Range_,typename Body_>
-00137         friend class finish_scan;
-00138     };
-00139 
-00141 
-00142     template<typename Range, typename Body>
-00143     class finish_scan: public task {
-00144         typedef sum_node<Range,Body> sum_node_type;
-00145         typedef final_sum<Range,Body> final_sum_type;
-00146         final_sum_type** const sum;
-00147         sum_node_type*& return_slot;
-00148     public:
-00149         final_sum_type* right_zombie;
-00150         sum_node_type& result;
-00151 
-00152         /*override*/ task* execute() {
-00153             __TBB_ASSERT( result.ref_count()==(result.left!=NULL)+(result.right!=NULL), NULL );
-00154             if( result.left )
-00155                 result.left_is_final = false;
-00156             if( right_zombie && sum ) 
-00157                 ((*sum)->body).reverse_join(result.left_sum->body);
-00158             __TBB_ASSERT( !return_slot, NULL );
-00159             if( right_zombie || result.right ) {
-00160                 return_slot = &result;
-00161             } else {
-00162                 destroy( result );
-00163             }
-00164             if( right_zombie && !sum && !result.right ) destroy(*right_zombie);
-00165             return NULL;
-00166         }
-00167 
-00168         finish_scan( sum_node_type*& return_slot_, final_sum_type** sum_, sum_node_type& result_ ) : 
-00169             sum(sum_),
-00170             return_slot(return_slot_), 
-00171             right_zombie(NULL),
-00172             result(result_)
-00173         {
-00174             __TBB_ASSERT( !return_slot, NULL );
-00175         }
-00176     };
-00177 
-00179 
-00180     template<typename Range, typename Body, typename Partitioner=simple_partitioner>
-00181     class start_scan: public task {
-00182         typedef sum_node<Range,Body> sum_node_type;
-00183         typedef final_sum<Range,Body> final_sum_type;
-00184         final_sum_type* body;
-00186         final_sum_type** sum; 
-00187         sum_node_type** return_slot;
-00189         sum_node_type* parent_sum;
-00190         bool is_final;
-00191         bool is_right_child;
-00192         Range range;
-00193         typename Partitioner::partition_type partition;
-00194         /*override*/ task* execute();
-00195     public:
-00196         start_scan( sum_node_type*& return_slot_, start_scan& parent, sum_node_type* parent_sum_ ) :
-00197             body(parent.body),
-00198             sum(parent.sum),
-00199             return_slot(&return_slot_),
-00200             parent_sum(parent_sum_),
-00201             is_final(parent.is_final),
-00202             is_right_child(false),
-00203             range(parent.range,split()),
-00204             partition(parent.partition,split())
-00205         {
-00206             __TBB_ASSERT( !*return_slot, NULL );
-00207         }
-00208 
-00209         start_scan( sum_node_type*& return_slot_, const Range& range_, final_sum_type& body_, const Partitioner& partitioner_) :
-00210             body(&body_),
-00211             sum(NULL),
-00212             return_slot(&return_slot_),
-00213             parent_sum(NULL),
-00214             is_final(true),
-00215             is_right_child(false),
-00216             range(range_),
-00217             partition(partitioner_)
-00218         {
-00219             __TBB_ASSERT( !*return_slot, NULL );
-00220         }
-00221 
-00222         static void run(  const Range& range, Body& body, const Partitioner& partitioner ) {
-00223             if( !range.empty() ) {
-00224                 typedef internal::start_scan<Range,Body,Partitioner> start_pass1_type;
-00225                 internal::sum_node<Range,Body>* root = NULL;
-00226                 typedef internal::final_sum<Range,Body> final_sum_type;
-00227                 final_sum_type* temp_body = new(task::allocate_root()) final_sum_type( body );
-00228                 start_pass1_type& pass1 = *new(task::allocate_root()) start_pass1_type(
-00229                     /*return_slot=*/root,
-00230                     range,
-00231                     *temp_body,
-00232                     partitioner );
-00233                 task::spawn_root_and_wait( pass1 );
-00234                 if( root ) {
-00235                     root->body = temp_body;
-00236                     root->incoming = NULL;
-00237                     root->stuff_last = &body;
-00238                     task::spawn_root_and_wait( *root );
-00239                 } else {
-00240                     body.assign(temp_body->body);
-00241                     temp_body->finish_construction( range, NULL );
-00242                     temp_body->destroy(*temp_body);
-00243                 }
-00244             }
-00245         }
-00246     };
-00247 
-00248     template<typename Range, typename Body, typename Partitioner>
-00249     task* start_scan<Range,Body,Partitioner>::execute() {
-00250         typedef internal::finish_scan<Range,Body> finish_pass1_type;
-00251         finish_pass1_type* p = parent_sum ? static_cast<finish_pass1_type*>( parent() ) : NULL;
-00252         // Inspecting p->result.left_sum would ordinarily be a race condition.
-00253         // But we inspect it only if we are not a stolen task, in which case we
-00254         // know that task assigning to p->result.left_sum has completed.
-00255         bool treat_as_stolen = is_right_child && (is_stolen_task() || body!=p->result.left_sum);
-00256         if( treat_as_stolen ) {
-00257             // Invocation is for right child that has been really stolen or needs to be virtually stolen
-00258             p->right_zombie = body = new( allocate_root() ) final_sum_type(body->body);
-00259             is_final = false;
-00260         }
-00261         task* next_task = NULL;
-00262         if( (is_right_child && !treat_as_stolen) || !range.is_divisible() || partition.should_execute_range(*this) ) {
-00263             if( is_final )
-00264                 (body->body)( range, final_scan_tag() );
-00265             else if( sum )
-00266                 (body->body)( range, pre_scan_tag() );
-00267             if( sum ) 
-00268                 *sum = body;
-00269             __TBB_ASSERT( !*return_slot, NULL );
-00270         } else {
-00271             sum_node_type* result;
-00272             if( parent_sum ) 
-00273                 result = new(allocate_additional_child_of(*parent_sum)) sum_node_type(range,/*left_is_final=*/is_final);
-00274             else
-00275                 result = new(task::allocate_root()) sum_node_type(range,/*left_is_final=*/is_final);
-00276             finish_pass1_type& c = *new( allocate_continuation()) finish_pass1_type(*return_slot,sum,*result);
-00277             // Split off right child
-00278             start_scan& b = *new( c.allocate_child() ) start_scan( /*return_slot=*/result->right, *this, result );
-00279             b.is_right_child = true;    
-00280             // Left child is recycling of *this.  Must recycle this before spawning b, 
-00281             // otherwise b might complete and decrement c.ref_count() to zero, which
-00282             // would cause c.execute() to run prematurely.
-00283             recycle_as_child_of(c);
-00284             c.set_ref_count(2);
-00285             c.spawn(b);
-00286             sum = &result->left_sum;
-00287             return_slot = &result->left;
-00288             is_right_child = false;
-00289             next_task = this;
-00290             parent_sum = result; 
-00291             __TBB_ASSERT( !*return_slot, NULL );
-00292         }
-00293         return next_task;
-00294     } 
-00295 } // namespace internal
-00297 
-00298 // Requirements on Range concept are documented in blocked_range.h
-00299 
-00317 
-00319 
-00320 template<typename Range, typename Body>
-00321 void parallel_scan( const Range& range, Body& body, const simple_partitioner& partitioner=simple_partitioner() ) {
-00322     internal::start_scan<Range,Body,simple_partitioner>::run(range,body,partitioner);
-00323 }
-00324 
-00326 
-00327 template<typename Range, typename Body>
-00328 void parallel_scan( const Range& range, Body& body, const auto_partitioner& partitioner ) {
-00329     internal::start_scan<Range,Body,auto_partitioner>::run(range,body,partitioner);
-00330 }
-00332 
-00333 } // namespace tbb
-00334 
-00335 #endif /* __TBB_parallel_scan_H */
-00336 
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00277.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00277.html deleted file mode 100644 index a1ade8d158..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00277.html +++ /dev/null @@ -1,225 +0,0 @@ - - -parallel_sort.h Source File - - - - - - -

parallel_sort.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_parallel_sort_H
-00022 #define __TBB_parallel_sort_H
-00023 
-00024 #include "parallel_for.h"
-00025 #include "blocked_range.h"
-00026 #include <algorithm>
-00027 #include <iterator>
-00028 #include <functional>
-00029 
-00030 namespace tbb {
-00031 
-00033 namespace internal {
-00034 
-00036 
-00039 template<typename RandomAccessIterator, typename Compare>
-00040 class quick_sort_range: private no_assign {
-00041 
-00042     inline size_t median_of_three(const RandomAccessIterator &array, size_t l, size_t m, size_t r) const {
-00043         return comp(array[l], array[m]) ? ( comp(array[m], array[r]) ? m : ( comp( array[l], array[r]) ? r : l ) ) 
-00044                                         : ( comp(array[r], array[m]) ? m : ( comp( array[r], array[l] ) ? r : l ) );
-00045     }
-00046 
-00047     inline size_t pseudo_median_of_nine( const RandomAccessIterator &array, const quick_sort_range &range ) const {
-00048         size_t offset = range.size/8u;
-00049         return median_of_three(array, 
-00050                                median_of_three(array, 0, offset, offset*2),
-00051                                median_of_three(array, offset*3, offset*4, offset*5),
-00052                                median_of_three(array, offset*6, offset*7, range.size - 1) );
-00053 
-00054     }
-00055 
-00056 public:
-00057 
-00058     static const size_t grainsize = 500;
-00059     const Compare &comp;
-00060     RandomAccessIterator begin;
-00061     size_t size;
-00062 
-00063     quick_sort_range( RandomAccessIterator begin_, size_t size_, const Compare &comp_ ) :
-00064         comp(comp_), begin(begin_), size(size_) {}
-00065 
-00066     bool empty() const {return size==0;}
-00067     bool is_divisible() const {return size>=grainsize;}
-00068 
-00069     quick_sort_range( quick_sort_range& range, split ) : comp(range.comp) {
-00070         RandomAccessIterator array = range.begin;
-00071         RandomAccessIterator key0 = range.begin; 
-00072         size_t m = pseudo_median_of_nine(array, range);
-00073         if (m) std::swap ( array[0], array[m] );
-00074 
-00075         size_t i=0;
-00076         size_t j=range.size;
-00077         // Partition interval [i+1,j-1] with key *key0.
-00078         for(;;) {
-00079             __TBB_ASSERT( i<j, NULL );
-00080             // Loop must terminate since array[l]==*key0.
-00081             do {
-00082                 --j;
-00083                 __TBB_ASSERT( i<=j, "bad ordering relation?" );
-00084             } while( comp( *key0, array[j] ));
-00085             do {
-00086                 __TBB_ASSERT( i<=j, NULL );
-00087                 if( i==j ) goto partition;
-00088                 ++i;
-00089             } while( comp( array[i],*key0 ));
-00090             if( i==j ) goto partition;
-00091             std::swap( array[i], array[j] );
-00092         }
-00093 partition:
-00094         // Put the partition key were it belongs
-00095         std::swap( array[j], *key0 );
-00096         // array[l..j) is less or equal to key.
-00097         // array(j..r) is greater or equal to key.
-00098         // array[j] is equal to key
-00099         i=j+1;
-00100         begin = array+i;
-00101         size = range.size-i;
-00102         range.size = j;
-00103     }
-00104 };
-00105 
-00107 
-00108 template<typename RandomAccessIterator, typename Compare>
-00109 class quick_sort_pretest_body : internal::no_assign {
-00110     const Compare &comp;
-00111 
-00112 public:
-00113     quick_sort_pretest_body(const Compare &_comp) : comp(_comp) {}
-00114 
-00115     void operator()( const blocked_range<RandomAccessIterator>& range ) const {
-00116         task &my_task = task::self();
-00117         RandomAccessIterator my_end = range.end();
-00118 
-00119         int i = 0;
-00120         for (RandomAccessIterator k = range.begin(); k != my_end; ++k, ++i) {
-00121             if ( i%64 == 0 && my_task.is_cancelled() ) break;
-00122           
-00123             // The k-1 is never out-of-range because the first chunk starts at begin+serial_cutoff+1
-00124             if ( comp( *(k), *(k-1) ) ) {
-00125                 my_task.cancel_group_execution();
-00126                 break;
-00127             }
-00128         }
-00129     }
-00130 
-00131 };
-00132 
-00134 
-00135 template<typename RandomAccessIterator, typename Compare>
-00136 struct quick_sort_body {
-00137     void operator()( const quick_sort_range<RandomAccessIterator,Compare>& range ) const {
-00138         //SerialQuickSort( range.begin, range.size, range.comp );
-00139         std::sort( range.begin, range.begin + range.size, range.comp );
-00140     }
-00141 };
-00142 
-00144 
-00145 template<typename RandomAccessIterator, typename Compare>
-00146 void parallel_quick_sort( RandomAccessIterator begin, RandomAccessIterator end, const Compare& comp ) {
-00147     task_group_context my_context;
-00148     const int serial_cutoff = 9;
-00149 
-00150     __TBB_ASSERT( begin + serial_cutoff < end, "min_parallel_size is smaller than serial cutoff?" );
-00151     RandomAccessIterator k;
-00152     for ( k = begin ; k != begin + serial_cutoff; ++k ) {
-00153         if ( comp( *(k+1), *k ) ) {
-00154             goto do_parallel_quick_sort;
-00155         }
-00156     }
-00157 
-00158     parallel_for( blocked_range<RandomAccessIterator>(k+1, end),
-00159                   quick_sort_pretest_body<RandomAccessIterator,Compare>(comp),
-00160                   auto_partitioner(),
-00161                   my_context);
-00162 
-00163     if (my_context.is_group_execution_cancelled())
-00164 do_parallel_quick_sort:
-00165         parallel_for( quick_sort_range<RandomAccessIterator,Compare>(begin, end-begin, comp ), 
-00166                       quick_sort_body<RandomAccessIterator,Compare>(),
-00167                       auto_partitioner() );
-00168 }
-00169 
-00170 } // namespace internal
-00172 
-00183 
-00185 
-00188 template<typename RandomAccessIterator, typename Compare>
-00189 void parallel_sort( RandomAccessIterator begin, RandomAccessIterator end, const Compare& comp) { 
-00190     const int min_parallel_size = 500; 
-00191     if( end > begin ) {
-00192         if (end - begin < min_parallel_size) { 
-00193             std::sort(begin, end, comp);
-00194         } else {
-00195             internal::parallel_quick_sort(begin, end, comp);
-00196         }
-00197     }
-00198 }
-00199 
-00201 
-00202 template<typename RandomAccessIterator>
-00203 inline void parallel_sort( RandomAccessIterator begin, RandomAccessIterator end ) { 
-00204     parallel_sort( begin, end, std::less< typename std::iterator_traits<RandomAccessIterator>::value_type >() );
-00205 }
-00206 
-00208 
-00209 template<typename T>
-00210 inline void parallel_sort( T * begin, T * end ) {
-00211     parallel_sort( begin, end, std::less< T >() );
-00212 }   
-00214 
-00215 
-00216 } // namespace tbb
-00217 
-00218 #endif
-00219 
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00281.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00281.html deleted file mode 100644 index cb0f61ce17..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00281.html +++ /dev/null @@ -1,196 +0,0 @@ - - -parallel_while.h Source File - - - - - - -

parallel_while.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_parallel_while
-00022 #define __TBB_parallel_while
-00023 
-00024 #include "task.h"
-00025 #include <new>
-00026 
-00027 namespace tbb {
-00028 
-00029 template<typename Body>
-00030 class parallel_while;
-00031 
-00033 namespace internal {
-00034 
-00035     template<typename Stream, typename Body> class while_task;
-00036 
-00038 
-00040     template<typename Body>
-00041     class while_iteration_task: public task {
-00042         const Body& my_body;
-00043         typename Body::argument_type my_value;
-00044         /*override*/ task* execute() {
-00045             my_body(my_value); 
-00046             return NULL;
-00047         }
-00048         while_iteration_task( const typename Body::argument_type& value, const Body& body ) : 
-00049             my_body(body), my_value(value)
-00050         {}
-00051         template<typename Body_> friend class while_group_task;
-00052         friend class tbb::parallel_while<Body>;
-00053     };
-00054 
-00056 
-00058     template<typename Body>
-00059     class while_group_task: public task {
-00060         static const size_t max_arg_size = 4;         
-00061         const Body& my_body;
-00062         size_t size;
-00063         typename Body::argument_type my_arg[max_arg_size];
-00064         while_group_task( const Body& body ) : my_body(body), size(0) {} 
-00065         /*override*/ task* execute() {
-00066             typedef while_iteration_task<Body> iteration_type;
-00067             __TBB_ASSERT( size>0, NULL );
-00068             task_list list;
-00069             task* t; 
-00070             size_t k=0; 
-00071             for(;;) {
-00072                 t = new( allocate_child() ) iteration_type(my_arg[k],my_body); 
-00073                 if( ++k==size ) break;
-00074                 list.push_back(*t);
-00075             }
-00076             set_ref_count(int(k+1));
-00077             spawn(list);
-00078             spawn_and_wait_for_all(*t);
-00079             return NULL;
-00080         }
-00081         template<typename Stream, typename Body_> friend class while_task;
-00082     };
-00083     
-00085 
-00087     template<typename Stream, typename Body>
-00088     class while_task: public task {
-00089         Stream& my_stream;
-00090         const Body& my_body;
-00091         empty_task& my_barrier;
-00092         /*override*/ task* execute() {
-00093             typedef while_group_task<Body> block_type;
-00094             block_type& t = *new( allocate_additional_child_of(my_barrier) ) block_type(my_body);
-00095             size_t k=0; 
-00096             while( my_stream.pop_if_present(t.my_arg[k]) ) {
-00097                 if( ++k==block_type::max_arg_size ) {
-00098                     // There might be more iterations.
-00099                     recycle_to_reexecute();
-00100                     break;
-00101                 }
-00102             }
-00103             if( k==0 ) {
-00104                 destroy(t);
-00105                 return NULL;
-00106             } else {
-00107                 t.size = k;
-00108                 return &t;
-00109             }
-00110         }
-00111         while_task( Stream& stream, const Body& body, empty_task& barrier ) : 
-00112             my_stream(stream),
-00113             my_body(body),
-00114             my_barrier(barrier)
-00115         {} 
-00116         friend class tbb::parallel_while<Body>;
-00117     };
-00118 
-00119 } // namespace internal
-00121 
-00123 
-00128 template<typename Body>
-00129 class parallel_while: internal::no_copy {
-00130 public:
-00132     parallel_while() : my_body(NULL), my_barrier(NULL) {}
-00133 
-00135     ~parallel_while() {
-00136         if( my_barrier ) {
-00137             my_barrier->destroy(*my_barrier);    
-00138             my_barrier = NULL;
-00139         }
-00140     }
-00141 
-00143     typedef typename Body::argument_type value_type;
-00144 
-00146 
-00149     template<typename Stream>
-00150     void run( Stream& stream, const Body& body );
-00151 
-00153 
-00154     void add( const value_type& item );
-00155 
-00156 private:
-00157     const Body* my_body;
-00158     empty_task* my_barrier;
-00159 };
-00160 
-00161 template<typename Body>
-00162 template<typename Stream>
-00163 void parallel_while<Body>::run( Stream& stream, const Body& body ) {
-00164     using namespace internal;
-00165     empty_task& barrier = *new( task::allocate_root() ) empty_task();
-00166     my_body = &body;
-00167     my_barrier = &barrier;
-00168     my_barrier->set_ref_count(2);
-00169     while_task<Stream,Body>& w = *new( my_barrier->allocate_child() ) while_task<Stream,Body>( stream, body, barrier );
-00170     my_barrier->spawn_and_wait_for_all(w);
-00171     my_barrier->destroy(*my_barrier);
-00172     my_barrier = NULL;
-00173     my_body = NULL;
-00174 }
-00175 
-00176 template<typename Body>
-00177 void parallel_while<Body>::add( const value_type& item ) {
-00178     __TBB_ASSERT(my_barrier,"attempt to add to parallel_while that is not running");
-00179     typedef internal::while_iteration_task<Body> iteration_type;
-00180     iteration_type& i = *new( task::self().allocate_additional_child_of(*my_barrier) ) iteration_type(item,*my_body);
-00181     task::self().spawn( i );
-00182 }
-00183 
-00184 } // namespace 
-00185 
-00186 #endif /* __TBB_parallel_while */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00285.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00285.html deleted file mode 100644 index 116f99f500..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00285.html +++ /dev/null @@ -1,231 +0,0 @@ - - -partitioner.h Source File - - - - - - -

partitioner.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_partitioner_H
-00022 #define __TBB_partitioner_H
-00023 
-00024 #include "task.h"
-00025 
-00026 namespace tbb {
-00027 class affinity_partitioner;
-00028 
-00030 namespace internal {
-00031 size_t __TBB_EXPORTED_FUNC get_initial_auto_partitioner_divisor();
-00032 
-00034 
-00035 class affinity_partitioner_base_v3: no_copy {
-00036     friend class tbb::affinity_partitioner;
-00038 
-00039     affinity_id* my_array;
-00041     size_t my_size;
-00043     affinity_partitioner_base_v3() : my_array(NULL), my_size(0) {}
-00045     ~affinity_partitioner_base_v3() {resize(0);}
-00047 
-00048     void __TBB_EXPORTED_METHOD resize( unsigned factor );
-00049     friend class affinity_partition_type;
-00050 };
-00051 
-00053 class partition_type_base {
-00054 public:
-00055     void set_affinity( task & ) {}
-00056     void note_affinity( task::affinity_id ) {}
-00057     task* continue_after_execute_range( task& ) {return NULL;}
-00058     bool decide_whether_to_delay() {return false;}
-00059     void spawn_or_delay( bool, task& a, task& b ) {
-00060         a.spawn(b);
-00061     }
-00062 };
-00063 
-00064 class affinity_partition_type;
-00065 
-00066 template<typename Range, typename Body, typename Partitioner> class start_for;
-00067 template<typename Range, typename Body, typename Partitioner> class start_reduce;
-00068 template<typename Range, typename Body> class start_reduce_with_affinity;
-00069 template<typename Range, typename Body, typename Partitioner> class start_scan;
-00070 
-00071 } // namespace internal
-00073 
-00075 
-00077 class simple_partitioner {
-00078 public:
-00079     simple_partitioner() {}
-00080 private:
-00081     template<typename Range, typename Body, typename Partitioner> friend class internal::start_for;
-00082     template<typename Range, typename Body, typename Partitioner> friend class internal::start_reduce;
-00083     template<typename Range, typename Body, typename Partitioner> friend class internal::start_scan;
-00084 
-00085     class partition_type: public internal::partition_type_base {
-00086     public:
-00087         bool should_execute_range(const task& ) {return false;}
-00088         partition_type( const simple_partitioner& ) {}
-00089         partition_type( const partition_type&, split ) {}
-00090     };
-00091 };
-00092 
-00094 
-00097 class auto_partitioner {
-00098 public:
-00099     auto_partitioner() {}
-00100 
-00101 private:
-00102     template<typename Range, typename Body, typename Partitioner> friend class internal::start_for;
-00103     template<typename Range, typename Body, typename Partitioner> friend class internal::start_reduce;
-00104     template<typename Range, typename Body, typename Partitioner> friend class internal::start_scan;
-00105 
-00106     class partition_type: public internal::partition_type_base {
-00107         size_t num_chunks;
-00108         static const size_t VICTIM_CHUNKS = 4;
-00109 public:
-00110         bool should_execute_range(const task &t) {
-00111             if( num_chunks<VICTIM_CHUNKS && t.is_stolen_task() )
-00112                 num_chunks = VICTIM_CHUNKS;
-00113             return num_chunks==1;
-00114         }
-00115         partition_type( const auto_partitioner& ) : num_chunks(internal::get_initial_auto_partitioner_divisor()) {}
-00116         partition_type( partition_type& pt, split ) {
-00117             num_chunks = pt.num_chunks /= 2u;
-00118         }
-00119     };
-00120 };
-00121 
-00123 class affinity_partitioner: internal::affinity_partitioner_base_v3 {
-00124 public:
-00125     affinity_partitioner() {}
-00126 
-00127 private:
-00128     template<typename Range, typename Body, typename Partitioner> friend class internal::start_for;
-00129     template<typename Range, typename Body> friend class internal::start_reduce_with_affinity;
-00130     template<typename Range, typename Body, typename Partitioner> friend class internal::start_scan;
-00131 
-00132     typedef internal::affinity_partition_type partition_type;
-00133     friend class internal::affinity_partition_type;
-00134 };
-00135 
-00137 namespace internal {
-00138 
-00139 class affinity_partition_type: public no_copy {
-00141     static const unsigned factor = 16;
-00142     static const size_t VICTIM_CHUNKS = 4;
-00143 
-00144     internal::affinity_id* my_array;
-00145     task_list delay_list;
-00146     unsigned map_begin, map_end;
-00147     size_t num_chunks;
-00148 public:
-00149     affinity_partition_type( affinity_partitioner& ap ) {
-00150         __TBB_ASSERT( (factor&(factor-1))==0, "factor must be power of two" ); 
-00151         ap.resize(factor);
-00152         my_array = ap.my_array;
-00153         map_begin = 0;
-00154         map_end = unsigned(ap.my_size);
-00155         num_chunks = internal::get_initial_auto_partitioner_divisor();
-00156     }
-00157     affinity_partition_type(affinity_partition_type& p, split) : my_array(p.my_array) {
-00158         __TBB_ASSERT( p.map_end-p.map_begin<factor || (p.map_end-p.map_begin)%factor==0, NULL );
-00159         num_chunks = p.num_chunks /= 2;
-00160         unsigned e = p.map_end;
-00161         unsigned d = (e - p.map_begin)/2;
-00162         if( d>factor ) 
-00163             d &= 0u-factor;
-00164         map_end = e;
-00165         map_begin = p.map_end = e-d;
-00166     }
-00167 
-00168     bool should_execute_range(const task &t) {
-00169         if( num_chunks < VICTIM_CHUNKS && t.is_stolen_task() )
-00170             num_chunks = VICTIM_CHUNKS;
-00171         return num_chunks == 1;
-00172     }
-00173 
-00174     void set_affinity( task &t ) {
-00175         if( map_begin<map_end )
-00176             t.set_affinity( my_array[map_begin] );
-00177     }
-00178     void note_affinity( task::affinity_id id ) {
-00179         if( map_begin<map_end ) 
-00180             my_array[map_begin] = id;
-00181     }
-00182     task* continue_after_execute_range( task& t ) {
-00183         task* first = NULL;
-00184         if( !delay_list.empty() ) {
-00185             first = &delay_list.pop_front();
-00186             while( !delay_list.empty() ) {
-00187                 t.spawn(*first);
-00188                 first = &delay_list.pop_front();
-00189             }
-00190         }
-00191         return first;
-00192     }
-00193     bool decide_whether_to_delay() {
-00194         // The possible underflow caused by "-1u" is deliberate
-00195         return (map_begin&(factor-1))==0 && map_end-map_begin-1u<factor;
-00196     }
-00197     void spawn_or_delay( bool delay, task& a, task& b ) {
-00198         if( delay )  
-00199             delay_list.push_back(b);
-00200         else 
-00201             a.spawn(b);
-00202     }
-00203 
-00204     ~affinity_partition_type() {
-00205         // The delay_list can be non-empty if an exception is thrown.
-00206         while( !delay_list.empty() ) {
-00207             task& t = delay_list.pop_front();
-00208             t.destroy(t);
-00209         } 
-00210     }
-00211 };
-00212 
-00213 } // namespace internal
-00215 
-00216 
-00217 } // namespace tbb
-00218 
-00219 #endif /* __TBB_partitioner_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00290.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00290.html deleted file mode 100644 index 2742f1e8ab..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00290.html +++ /dev/null @@ -1,192 +0,0 @@ - - -pipeline.h Source File - - - - - - -

pipeline.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_pipeline_H 
-00022 #define __TBB_pipeline_H 
-00023 
-00024 #include "atomic.h"
-00025 #include "task.h"
-00026 #include <cstddef>
-00027 
-00028 namespace tbb {
-00029 
-00030 class pipeline;
-00031 class filter;
-00032 
-00034 namespace internal {
-00035 
-00036 // The argument for PIPELINE_VERSION should be an integer between 2 and 9
-00037 #define __TBB_PIPELINE_VERSION(x) (unsigned char)(x-2)<<1
-00038 
-00039 typedef unsigned long Token;
-00040 typedef long tokendiff_t;
-00041 class stage_task;
-00042 class ordered_buffer;
-00043 
-00044 } // namespace internal
-00046 
-00048 
-00049 class filter: internal::no_copy {
-00050 private:
-00052     static filter* not_in_pipeline() {return reinterpret_cast<filter*>(internal::intptr(-1));}
-00053     
-00055     static const unsigned char filter_is_serial = 0x1; 
-00056 
-00058     // The bit was not set for parallel filters in TBB 2.1 and earlier,
-00059     // but is_ordered() function always treats parallel filters as out of order
-00060     static const unsigned char filter_is_out_of_order = 0x1<<4;  
-00061 
-00062     static const unsigned char current_version = __TBB_PIPELINE_VERSION(4);
-00063     static const unsigned char version_mask = 0x7<<1; // bits 1-3 are for version
-00064 public:
-00065     enum mode {
-00067         parallel = current_version | filter_is_out_of_order, 
-00069         serial_in_order = current_version | filter_is_serial,
-00071         serial_out_of_order = current_version | filter_is_serial | filter_is_out_of_order,
-00073         serial = serial_in_order
-00074     };
-00075 protected:
-00076     filter( bool is_serial_ ) : 
-00077         next_filter_in_pipeline(not_in_pipeline()),
-00078         input_buffer(NULL),
-00079         my_filter_mode(static_cast<unsigned char>(is_serial_ ? serial : parallel)),
-00080         prev_filter_in_pipeline(not_in_pipeline()),
-00081         my_pipeline(NULL)
-00082     {}
-00083     
-00084     filter( mode filter_mode ) :
-00085         next_filter_in_pipeline(not_in_pipeline()),
-00086         input_buffer(NULL),
-00087         my_filter_mode(static_cast<unsigned char>(filter_mode)),
-00088         prev_filter_in_pipeline(not_in_pipeline()),
-00089         my_pipeline(NULL)
-00090     {}
-00091 
-00092 public:
-00094     bool is_serial() const {
-00095         return bool( my_filter_mode & filter_is_serial );
-00096     }  
-00097     
-00098     // ! True if filter must receive stream in order.
-00099     bool is_ordered() const {
-00100         return (my_filter_mode & (filter_is_out_of_order|filter_is_serial))==filter_is_serial;
-00101     }
-00102 
-00104 
-00105     virtual void* operator()( void* item ) = 0;
-00106 
-00108 
-00109     virtual __TBB_EXPORTED_METHOD ~filter();
-00110 
-00111 #if __TBB_EXCEPTIONS
-00113 
-00115     virtual void finalize( void* /*item*/ ) {};
-00116 #endif
-00117 
-00118 private:
-00120     filter* next_filter_in_pipeline;
-00121 
-00123     internal::ordered_buffer* input_buffer;
-00124 
-00125     friend class internal::stage_task;
-00126     friend class pipeline;
-00127 
-00129     const unsigned char my_filter_mode;
-00130 
-00132     filter* prev_filter_in_pipeline;
-00133 
-00135     pipeline* my_pipeline;
-00136 };
-00137 
-00139 
-00140 class pipeline {
-00141 public:
-00143     __TBB_EXPORTED_METHOD pipeline();
-00144 
-00147     virtual __TBB_EXPORTED_METHOD ~pipeline();
-00148 
-00150     void __TBB_EXPORTED_METHOD add_filter( filter& filter_ );
-00151 
-00153     void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens );
-00154 
-00155 #if __TBB_EXCEPTIONS
-00157     void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens, tbb::task_group_context& context );
-00158 #endif
-00159 
-00161     void __TBB_EXPORTED_METHOD clear();
-00162 
-00163 private:
-00164     friend class internal::stage_task;
-00165     friend class filter;
-00166 
-00168     filter* filter_list;
-00169 
-00171     filter* filter_end;
-00172 
-00174     empty_task* end_counter;
-00175 
-00177     atomic<internal::Token> input_tokens;
-00178 
-00180     internal::Token token_counter;
-00181 
-00183     bool end_of_input;
-00184 
-00186     void remove_filter( filter& filter_ );
-00187 
-00189     void __TBB_EXPORTED_METHOD inject_token( task& self );
-00190 
-00191 #if __TBB_EXCEPTIONS
-00193     void clear_filters();
-00194 #endif
-00195 };
-00196 
-00197 } // tbb
-00198 
-00199 #endif /* __TBB_pipeline_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00291.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00291.html deleted file mode 100644 index 895ac4b10b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00291.html +++ /dev/null @@ -1,124 +0,0 @@ - - -queuing_mutex.h Source File - - - - - - -

queuing_mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_queuing_mutex_H
-00022 #define __TBB_queuing_mutex_H
-00023 
-00024 #include <cstring>
-00025 #include "atomic.h"
-00026 #include "tbb_profiling.h"
-00027 
-00028 namespace tbb {
-00029 
-00031 
-00032 class queuing_mutex {
-00033 public:
-00035     queuing_mutex() {
-00036         q_tail = NULL;
-00037 #if TBB_USE_THREADING_TOOLS
-00038         internal_construct();
-00039 #endif
-00040     }
-00041 
-00043 
-00045     class scoped_lock: internal::no_copy {
-00047         void initialize() {
-00048             mutex = NULL;
-00049 #if TBB_USE_ASSERT
-00050             internal::poison_pointer(next);
-00051 #endif /* TBB_USE_ASSERT */
-00052         }
-00053     public:
-00055 
-00056         scoped_lock() {initialize();}
-00057 
-00059 
-00060         scoped_lock( queuing_mutex& m ) {
-00061             initialize();
-00062             acquire(m);
-00063         }
-00064 
-00066         ~scoped_lock() {
-00067             if( mutex ) release();
-00068         }
-00069 
-00071         void __TBB_EXPORTED_METHOD acquire( queuing_mutex& m );
-00072 
-00074         bool __TBB_EXPORTED_METHOD try_acquire( queuing_mutex& m );
-00075 
-00077         void __TBB_EXPORTED_METHOD release();
-00078 
-00079     private:
-00081         queuing_mutex* mutex;
-00082 
-00084         scoped_lock *next;
-00085 
-00087 
-00090         internal::uintptr going;
-00091     };
-00092 
-00093     void __TBB_EXPORTED_METHOD internal_construct();
-00094 
-00095     // Mutex traits
-00096     static const bool is_rw_mutex = false;
-00097     static const bool is_recursive_mutex = false;
-00098     static const bool is_fair_mutex = true;
-00099 
-00100     friend class scoped_lock;
-00101 private:
-00103     atomic<scoped_lock*> q_tail;
-00104 
-00105 };
-00106 
-00107 __TBB_DEFINE_PROFILING_SET_NAME(queuing_mutex)
-00108 
-00109 } // namespace tbb
-00110 
-00111 #endif /* __TBB_queuing_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00292.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00292.html deleted file mode 100644 index 4de5a5b490..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00292.html +++ /dev/null @@ -1,156 +0,0 @@ - - -queuing_rw_mutex.h Source File - - - - - - -

queuing_rw_mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_queuing_rw_mutex_H
-00022 #define __TBB_queuing_rw_mutex_H
-00023 
-00024 #include <cstring>
-00025 #include "atomic.h"
-00026 #include "tbb_profiling.h"
-00027 
-00028 namespace tbb {
-00029 
-00031 
-00034 class queuing_rw_mutex {
-00035 public:
-00037     queuing_rw_mutex() {
-00038         q_tail = NULL;
-00039 #if TBB_USE_THREADING_TOOLS
-00040         internal_construct();
-00041 #endif
-00042     }
-00043 
-00045     ~queuing_rw_mutex() {
-00046 #if TBB_USE_ASSERT
-00047         __TBB_ASSERT( !q_tail, "destruction of an acquired mutex");
-00048 #endif
-00049     }
-00050 
-00051     class scoped_lock;
-00052     friend class scoped_lock;
-00053 
-00055 
-00057     class scoped_lock: internal::no_copy {
-00059         void initialize() {
-00060             mutex = NULL;
-00061 #if TBB_USE_ASSERT
-00062             state = 0xFF; // Set to invalid state
-00063             internal::poison_pointer(next);
-00064             internal::poison_pointer(prev);
-00065 #endif /* TBB_USE_ASSERT */
-00066         }
-00067     public:
-00069 
-00070         scoped_lock() {initialize();}
-00071 
-00073 
-00074         scoped_lock( queuing_rw_mutex& m, bool write=true ) {
-00075             initialize();
-00076             acquire(m,write);
-00077         }
-00078 
-00080         ~scoped_lock() {
-00081             if( mutex ) release();
-00082         }
-00083 
-00085         void acquire( queuing_rw_mutex& m, bool write=true );
-00086 
-00088         bool try_acquire( queuing_rw_mutex& m, bool write=true );
-00089 
-00091         void release();
-00092 
-00094 
-00095         bool upgrade_to_writer();
-00096 
-00098         bool downgrade_to_reader();
-00099 
-00100     private:
-00102         queuing_rw_mutex* mutex;
-00103 
-00105         scoped_lock * prev, * next;
-00106 
-00107         typedef unsigned char state_t;
-00108 
-00110         atomic<state_t> state;
-00111 
-00113 
-00114         unsigned char going;
-00115 
-00117         unsigned char internal_lock;
-00118 
-00120         void acquire_internal_lock();
-00121 
-00123 
-00124         bool try_acquire_internal_lock();
-00125 
-00127         void release_internal_lock();
-00128 
-00130         void wait_for_release_of_internal_lock();
-00131 
-00133         void unblock_or_wait_on_internal_lock( uintptr_t );
-00134     };
-00135 
-00136     void __TBB_EXPORTED_METHOD internal_construct();
-00137 
-00138     // Mutex traits
-00139     static const bool is_rw_mutex = true;
-00140     static const bool is_recursive_mutex = false;
-00141     static const bool is_fair_mutex = true;
-00142 
-00143 private:
-00145     atomic<scoped_lock*> q_tail;
-00146 
-00147 };
-00148 
-00149 __TBB_DEFINE_PROFILING_SET_NAME(queuing_rw_mutex)
-00150 
-00151 } // namespace tbb
-00152 
-00153 #endif /* __TBB_queuing_rw_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00293.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00293.html deleted file mode 100644 index 7a3ee27403..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00293.html +++ /dev/null @@ -1,211 +0,0 @@ - - -recursive_mutex.h Source File - - - - - - -

recursive_mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_recursive_mutex_H
-00022 #define __TBB_recursive_mutex_H
-00023 
-00024 #if _WIN32||_WIN64
-00025 
-00026 #include <windows.h>
-00027 #if !defined(_WIN32_WINNT)
-00028 // The following Windows API function is declared explicitly;
-00029 // otherwise any user would have to specify /D_WIN32_WINNT=0x0400
-00030 extern "C" BOOL WINAPI TryEnterCriticalSection( LPCRITICAL_SECTION );
-00031 #endif
-00032 
-00033 #else /* if not _WIN32||_WIN64 */
-00034 
-00035 #include <pthread.h>
-00036 namespace tbb { namespace internal {
-00037 // Use this internal TBB function to throw an exception
-00038   extern void handle_perror( int error_code, const char* what );
-00039 } } //namespaces
-00040 
-00041 #endif /* _WIN32||_WIN64 */
-00042 
-00043 #include "tbb_stddef.h"
-00044 #include "tbb_profiling.h"
-00045 
-00046 namespace tbb {
-00048 
-00050 class recursive_mutex {
-00051 public:
-00053     recursive_mutex() {
-00054 #if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS
-00055         internal_construct();
-00056 #else
-00057   #if _WIN32||_WIN64
-00058         InitializeCriticalSection(&impl);
-00059   #else
-00060         pthread_mutexattr_t mtx_attr;
-00061         int error_code = pthread_mutexattr_init( &mtx_attr );
-00062         if( error_code )
-00063             tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutexattr_init failed");
-00064 
-00065         pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE );
-00066         error_code = pthread_mutex_init( &impl, &mtx_attr );
-00067         if( error_code )
-00068             tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutex_init failed");
-00069 
-00070         pthread_mutexattr_destroy( &mtx_attr );
-00071   #endif /* _WIN32||_WIN64*/
-00072 #endif /* TBB_USE_ASSERT */
-00073     };
-00074 
-00075     ~recursive_mutex() {
-00076 #if TBB_USE_ASSERT
-00077         internal_destroy();
-00078 #else
-00079   #if _WIN32||_WIN64
-00080         DeleteCriticalSection(&impl);
-00081   #else
-00082         pthread_mutex_destroy(&impl); 
-00083 
-00084   #endif /* _WIN32||_WIN64 */
-00085 #endif /* TBB_USE_ASSERT */
-00086     };
-00087 
-00088     class scoped_lock;
-00089     friend class scoped_lock;
-00090 
-00092 
-00094     class scoped_lock: internal::no_copy {
-00095     public:
-00097         scoped_lock() : my_mutex(NULL) {};
-00098 
-00100 
-00101         scoped_lock( recursive_mutex& mutex ) {
-00102             acquire( mutex );
-00103         }
-00104 
-00106         ~scoped_lock() {
-00107             if( my_mutex ) 
-00108                 release();
-00109         }
-00110 
-00112         void acquire( recursive_mutex& mutex ) {
-00113 #if TBB_USE_ASSERT
-00114             internal_acquire( mutex );
-00115 #else
-00116             my_mutex = &mutex;
-00117   #if _WIN32||_WIN64
-00118             EnterCriticalSection(&mutex.impl);
-00119   #else
-00120             pthread_mutex_lock( &mutex.impl );
-00121   #endif /* _WIN32||_WIN64 */
-00122 #endif /* TBB_USE_ASSERT */
-00123         }
-00124 
-00126         bool try_acquire( recursive_mutex& mutex ) {
-00127 #if TBB_USE_ASSERT
-00128             return internal_try_acquire( mutex );
-00129 #else
-00130             bool result;
-00131   #if _WIN32||_WIN64
-00132             result = TryEnterCriticalSection(&mutex.impl)!=0;
-00133   #else
-00134             result = pthread_mutex_trylock(&mutex.impl)==0;
-00135   #endif /* _WIN32||_WIN64 */
-00136             if( result )
-00137                 my_mutex = &mutex;
-00138 
-00139             return result;
-00140 #endif /* TBB_USE_ASSERT */
-00141         }
-00142 
-00144         void release() {
-00145 #if TBB_USE_ASSERT
-00146             internal_release ();
-00147 #else
-00148   #if _WIN32||_WIN64
-00149             LeaveCriticalSection(&my_mutex->impl);
-00150   #else
-00151             pthread_mutex_unlock(&my_mutex->impl);
-00152   #endif /* _WIN32||_WIN64 */
-00153             my_mutex = NULL;
-00154 #endif /* TBB_USE_ASSERT */
-00155         }
-00156 
-00157     private:
-00159         recursive_mutex* my_mutex;
-00160 
-00162         void __TBB_EXPORTED_METHOD internal_acquire( recursive_mutex& m );
-00163 
-00165         bool __TBB_EXPORTED_METHOD internal_try_acquire( recursive_mutex& m );
-00166 
-00168         void __TBB_EXPORTED_METHOD internal_release();
-00169     };
-00170 
-00171     // Mutex traits
-00172     static const bool is_rw_mutex = false;
-00173     static const bool is_recursive_mutex = true;
-00174     static const bool is_fair_mutex = false;
-00175 
-00176 private:
-00177 #if _WIN32||_WIN64
-00178     CRITICAL_SECTION impl;
-00179     enum state_t {
-00180         INITIALIZED=0x1234,
-00181         DESTROYED=0x789A,
-00182     } state;
-00183 #else
-00184     pthread_mutex_t impl;
-00185 #endif /* _WIN32||_WIN64 */
-00186 
-00188     void __TBB_EXPORTED_METHOD internal_construct();
-00189 
-00191     void __TBB_EXPORTED_METHOD internal_destroy();
-00192 };
-00193 
-00194 __TBB_DEFINE_PROFILING_SET_NAME(recursive_mutex)
-00195 
-00196 } // namespace tbb 
-00197 
-00198 #endif /* __TBB_recursive_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00294.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00294.html deleted file mode 100644 index a85b549605..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00294.html +++ /dev/null @@ -1,197 +0,0 @@ - - -scalable_allocator.h Source File - - - - - - -

scalable_allocator.h

Go to the documentation of this file.
00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_scalable_allocator_H
-00022 #define __TBB_scalable_allocator_H
-00023 
-00025 #include <stddef.h> /* Need ptrdiff_t and size_t from here. */
-00026 
-00027 #if !defined(__cplusplus) && __ICC==1100
-00028     #pragma warning (push)
-00029     #pragma warning (disable: 991)
-00030 #endif
-00031 
-00032 #ifdef __cplusplus
-00033 extern "C" {
-00034 #endif /* __cplusplus */
-00035 
-00036 #if _MSC_VER >= 1400
-00037 #define __TBB_EXPORTED_FUNC   __cdecl
-00038 #else
-00039 #define __TBB_EXPORTED_FUNC
-00040 #endif
-00041 
-00044 void * __TBB_EXPORTED_FUNC scalable_malloc (size_t size);
-00045 
-00048 void   __TBB_EXPORTED_FUNC scalable_free (void* ptr);
-00049 
-00052 void * __TBB_EXPORTED_FUNC scalable_realloc (void* ptr, size_t size);
-00053 
-00056 void * __TBB_EXPORTED_FUNC scalable_calloc (size_t nobj, size_t size);
-00057 
-00060 int __TBB_EXPORTED_FUNC scalable_posix_memalign (void** memptr, size_t alignment, size_t size);
-00061 
-00064 void * __TBB_EXPORTED_FUNC scalable_aligned_malloc (size_t size, size_t alignment);
-00065 
-00068 void * __TBB_EXPORTED_FUNC scalable_aligned_realloc (void* ptr, size_t size, size_t alignment);
-00069 
-00072 void __TBB_EXPORTED_FUNC scalable_aligned_free (void* ptr);
-00073 
-00074 #ifdef __cplusplus
-00075 } /* extern "C" */
-00076 #endif /* __cplusplus */
-00077 
-00078 #ifdef __cplusplus
-00079 
-00080 #include <new>      /* To use new with the placement argument */
-00081 
-00082 /* Ensure that including this header does not cause implicit linkage with TBB */
-00083 #ifndef __TBB_NO_IMPLICIT_LINKAGE
-00084     #define __TBB_NO_IMPLICIT_LINKAGE 1
-00085     #include "tbb_stddef.h"
-00086     #undef  __TBB_NO_IMPLICIT_LINKAGE
-00087 #else
-00088     #include "tbb_stddef.h"
-00089 #endif
-00090 
-00091 
-00092 namespace tbb {
-00093 
-00094 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00095     // Workaround for erroneous "unreferenced parameter" warning in method destroy.
-00096     #pragma warning (push)
-00097     #pragma warning (disable: 4100)
-00098 #endif
-00099 
-00101 
-00104 template<typename T>
-00105 class scalable_allocator {
-00106 public:
-00107     typedef typename internal::allocator_type<T>::value_type value_type;
-00108     typedef value_type* pointer;
-00109     typedef const value_type* const_pointer;
-00110     typedef value_type& reference;
-00111     typedef const value_type& const_reference;
-00112     typedef size_t size_type;
-00113     typedef ptrdiff_t difference_type;
-00114     template<class U> struct rebind {
-00115         typedef scalable_allocator<U> other;
-00116     };
-00117 
-00118     scalable_allocator() throw() {}
-00119     scalable_allocator( const scalable_allocator& ) throw() {}
-00120     template<typename U> scalable_allocator(const scalable_allocator<U>&) throw() {}
-00121 
-00122     pointer address(reference x) const {return &x;}
-00123     const_pointer address(const_reference x) const {return &x;}
-00124 
-00126     pointer allocate( size_type n, const void* /*hint*/ =0 ) {
-00127         return static_cast<pointer>( scalable_malloc( n * sizeof(value_type) ) );
-00128     }
-00129 
-00131     void deallocate( pointer p, size_type ) {
-00132         scalable_free( p );
-00133     }
-00134 
-00136     size_type max_size() const throw() {
-00137         size_type absolutemax = static_cast<size_type>(-1) / sizeof (value_type);
-00138         return (absolutemax > 0 ? absolutemax : 1);
-00139     }
-00140     void construct( pointer p, const value_type& val ) { new(static_cast<void*>(p)) value_type(val); }
-00141     void destroy( pointer p ) {p->~value_type();}
-00142 };
-00143 
-00144 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00145     #pragma warning (pop)
-00146 #endif // warning 4100 is back
-00147 
-00149 
-00150 template<>
-00151 class scalable_allocator<void> {
-00152 public:
-00153     typedef void* pointer;
-00154     typedef const void* const_pointer;
-00155     typedef void value_type;
-00156     template<class U> struct rebind {
-00157         typedef scalable_allocator<U> other;
-00158     };
-00159 };
-00160 
-00161 template<typename T, typename U>
-00162 inline bool operator==( const scalable_allocator<T>&, const scalable_allocator<U>& ) {return true;}
-00163 
-00164 template<typename T, typename U>
-00165 inline bool operator!=( const scalable_allocator<T>&, const scalable_allocator<U>& ) {return false;}
-00166 
-00167 } // namespace tbb
-00168 
-00169 #if _MSC_VER
-00170     #if __TBB_BUILD && !defined(__TBBMALLOC_NO_IMPLICIT_LINKAGE)
-00171         #define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
-00172     #endif
-00173 
-00174     #if !__TBBMALLOC_NO_IMPLICIT_LINKAGE
-00175         #ifdef _DEBUG
-00176             #pragma comment(lib, "tbbmalloc_debug.lib")
-00177         #else
-00178             #pragma comment(lib, "tbbmalloc.lib")
-00179         #endif
-00180     #endif
-00181 
-00182 
-00183 #endif
-00184 
-00185 #endif /* __cplusplus */
-00186 
-00187 #if !defined(__cplusplus) && __ICC==1100
-00188     #pragma warning (pop)
-00189 #endif // ICC 11.0 warning 991 is back
-00190 
-00191 #endif /* __TBB_scalable_allocator_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00295.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00295.html deleted file mode 100644 index a15ebe50c0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00295.html +++ /dev/null @@ -1,154 +0,0 @@ - - -spin_mutex.h Source File - - - - - - -

spin_mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_spin_mutex_H
-00022 #define __TBB_spin_mutex_H
-00023 
-00024 #include <cstddef>
-00025 #include "tbb_stddef.h"
-00026 #include "tbb_machine.h"
-00027 #include "tbb_profiling.h"
-00028 
-00029 namespace tbb {
-00030 
-00032 
-00037 class spin_mutex {
-00039     unsigned char flag;
-00040 
-00041 public:
-00043 
-00044     spin_mutex() : flag(0) {
-00045 #if TBB_USE_THREADING_TOOLS
-00046         internal_construct();
-00047 #endif
-00048     }
-00049 
-00051     class scoped_lock : internal::no_copy {
-00052     private:
-00054         spin_mutex* my_mutex; 
-00055 
-00057         internal::uintptr my_unlock_value;
-00058 
-00060         void __TBB_EXPORTED_METHOD internal_acquire( spin_mutex& m );
-00061 
-00063         bool __TBB_EXPORTED_METHOD internal_try_acquire( spin_mutex& m );
-00064 
-00066         void __TBB_EXPORTED_METHOD internal_release();
-00067 
-00068     public:
-00070         scoped_lock() : my_mutex(NULL), my_unlock_value(0) {}
-00071 
-00073         scoped_lock( spin_mutex& m ) { 
-00074 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00075             my_mutex=NULL;
-00076             internal_acquire(m);
-00077 #else
-00078             my_unlock_value = __TBB_LockByte(m.flag);
-00079             my_mutex=&m;
-00080 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/
-00081         }
-00082 
-00084         void acquire( spin_mutex& m ) {
-00085 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00086             internal_acquire(m);
-00087 #else
-00088             my_unlock_value = __TBB_LockByte(m.flag);
-00089             my_mutex = &m;
-00090 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/
-00091         }
-00092 
-00094         bool try_acquire( spin_mutex& m ) {
-00095 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00096             return internal_try_acquire(m);
-00097 #else
-00098             bool result = __TBB_TryLockByte(m.flag);
-00099             if( result ) {
-00100                 my_unlock_value = 0;
-00101                 my_mutex = &m;
-00102             }
-00103             return result;
-00104 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/
-00105         }
-00106 
-00108         void release() {
-00109 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00110             internal_release();
-00111 #else
-00112             __TBB_store_with_release(my_mutex->flag, static_cast<unsigned char>(my_unlock_value));
-00113             my_mutex = NULL;
-00114 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
-00115         }
-00116 
-00118         ~scoped_lock() {
-00119             if( my_mutex ) {
-00120 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00121                 internal_release();
-00122 #else
-00123                 __TBB_store_with_release(my_mutex->flag, static_cast<unsigned char>(my_unlock_value));
-00124 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
-00125             }
-00126         }
-00127     };
-00128 
-00129     void __TBB_EXPORTED_METHOD internal_construct();
-00130 
-00131     // Mutex traits
-00132     static const bool is_rw_mutex = false;
-00133     static const bool is_recursive_mutex = false;
-00134     static const bool is_fair_mutex = false;
-00135 
-00136     friend class scoped_lock;
-00137 };
-00138 
-00139 __TBB_DEFINE_PROFILING_SET_NAME(spin_mutex)
-00140 
-00141 } // namespace tbb
-00142 
-00143 #endif /* __TBB_spin_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00296.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00296.html deleted file mode 100644 index bc897d7179..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00296.html +++ /dev/null @@ -1,194 +0,0 @@ - - -spin_rw_mutex.h Source File - - - - - - -

spin_rw_mutex.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_spin_rw_mutex_H
-00022 #define __TBB_spin_rw_mutex_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 #include "tbb_machine.h"
-00026 #include "tbb_profiling.h"
-00027 
-00028 namespace tbb {
-00029 
-00030 class spin_rw_mutex_v3;
-00031 typedef spin_rw_mutex_v3 spin_rw_mutex;
-00032 
-00034 
-00035 class spin_rw_mutex_v3 {
-00037 
-00039     bool __TBB_EXPORTED_METHOD internal_acquire_writer();
-00040 
-00042 
-00043     void __TBB_EXPORTED_METHOD internal_release_writer();
-00044 
-00046     void __TBB_EXPORTED_METHOD internal_acquire_reader();
-00047 
-00049     bool __TBB_EXPORTED_METHOD internal_upgrade();
-00050 
-00052 
-00053     void __TBB_EXPORTED_METHOD internal_downgrade();
-00054 
-00056     void __TBB_EXPORTED_METHOD internal_release_reader();
-00057 
-00059     bool __TBB_EXPORTED_METHOD internal_try_acquire_writer();
-00060 
-00062     bool __TBB_EXPORTED_METHOD internal_try_acquire_reader();
-00063 
-00065 public:
-00067     spin_rw_mutex_v3() : state(0) {
-00068 #if TBB_USE_THREADING_TOOLS
-00069         internal_construct();
-00070 #endif
-00071     }
-00072 
-00073 #if TBB_USE_ASSERT
-00075     ~spin_rw_mutex_v3() {
-00076         __TBB_ASSERT( !state, "destruction of an acquired mutex");
-00077     };
-00078 #endif /* TBB_USE_ASSERT */
-00079 
-00081 
-00083     class scoped_lock : internal::no_copy {
-00084     public:
-00086 
-00087         scoped_lock() : mutex(NULL) {}
-00088 
-00090 
-00091         scoped_lock( spin_rw_mutex& m, bool write = true ) : mutex(NULL) {
-00092             acquire(m, write);
-00093         }
-00094 
-00096         ~scoped_lock() {
-00097             if( mutex ) release();
-00098         }
-00099 
-00101         void acquire( spin_rw_mutex& m, bool write = true ) {
-00102             __TBB_ASSERT( !mutex, "holding mutex already" );
-00103             is_writer = write; 
-00104             mutex = &m;
-00105             if( write ) mutex->internal_acquire_writer();
-00106             else        mutex->internal_acquire_reader();
-00107         }
-00108 
-00110 
-00111         bool upgrade_to_writer() {
-00112             __TBB_ASSERT( mutex, "lock is not acquired" );
-00113             __TBB_ASSERT( !is_writer, "not a reader" );
-00114             is_writer = true; 
-00115             return mutex->internal_upgrade();
-00116         }
-00117 
-00119         void release() {
-00120             __TBB_ASSERT( mutex, "lock is not acquired" );
-00121             spin_rw_mutex *m = mutex; 
-00122             mutex = NULL;
-00123 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00124             if( is_writer ) m->internal_release_writer();
-00125             else            m->internal_release_reader();
-00126 #else
-00127             if( is_writer ) __TBB_AtomicAND( &m->state, READERS ); 
-00128             else            __TBB_FetchAndAddWrelease( &m->state, -(intptr_t)ONE_READER);
-00129 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
-00130         }
-00131 
-00133         bool downgrade_to_reader() {
-00134 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00135             __TBB_ASSERT( mutex, "lock is not acquired" );
-00136             __TBB_ASSERT( is_writer, "not a writer" );
-00137             mutex->internal_downgrade();
-00138 #else
-00139              __TBB_FetchAndAddW( &mutex->state, ((intptr_t)ONE_READER-WRITER));
-00140 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
-00141             is_writer = false;
-00142 
-00143             return true;
-00144         }
-00145 
-00147         bool try_acquire( spin_rw_mutex& m, bool write = true ) {
-00148             __TBB_ASSERT( !mutex, "holding mutex already" );
-00149             bool result;
-00150             is_writer = write; 
-00151             result = write? m.internal_try_acquire_writer()
-00152                           : m.internal_try_acquire_reader();
-00153             if( result ) 
-00154                 mutex = &m;
-00155             return result;
-00156         }
-00157 
-00158     private:
-00160         spin_rw_mutex* mutex;
-00161 
-00163 
-00164         bool is_writer;
-00165     };
-00166 
-00167     // Mutex traits
-00168     static const bool is_rw_mutex = true;
-00169     static const bool is_recursive_mutex = false;
-00170     static const bool is_fair_mutex = false;
-00171 
-00172 private:
-00173     typedef intptr_t state_t;
-00174     static const state_t WRITER = 1;
-00175     static const state_t WRITER_PENDING = 2;
-00176     static const state_t READERS = ~(WRITER | WRITER_PENDING);
-00177     static const state_t ONE_READER = 4;
-00178     static const state_t BUSY = WRITER | READERS;
-00180 
-00183     state_t state;
-00184 
-00185     void __TBB_EXPORTED_METHOD internal_construct();
-00186 };
-00187 
-00188 __TBB_DEFINE_PROFILING_SET_NAME(spin_rw_mutex)
-00189 
-00190 } // namespace tbb
-00191 
-00192 #endif /* __TBB_spin_rw_mutex_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00297.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00297.html deleted file mode 100644 index b34ca00f35..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00297.html +++ /dev/null @@ -1,576 +0,0 @@ - - -task.h Source File - - - - - - -

task.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_task_H
-00022 #define __TBB_task_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 
-00026 #if __TBB_EXCEPTIONS
-00027 #include "cache_aligned_allocator.h"
-00028 #endif /* __TBB_EXCEPTIONS */
-00029 
-00030 namespace tbb {
-00031 
-00032 class task;
-00033 class task_list;
-00034 #if __TBB_EXCEPTIONS
-00035 class task_group_context;
-00036 class tbb_exception;
-00037 #endif /* __TBB_EXCEPTIONS */
-00038 
-00040 namespace internal {
-00041 
-00042     class scheduler: no_copy {
-00043     public:
-00045         virtual void spawn( task& first, task*& next ) = 0;
-00046 
-00048         virtual void wait_for_all( task& parent, task* child ) = 0;
-00049 
-00051         virtual void spawn_root_and_wait( task& first, task*& next ) = 0;
-00052 
-00054         //  Have to have it just to shut up overzealous compilation warnings
-00055         virtual ~scheduler() = 0;
-00056     };
-00057 
-00059 
-00060     typedef intptr reference_count;
-00061 
-00063     typedef unsigned short affinity_id;
-00064 
-00065 #if __TBB_EXCEPTIONS
-00066     struct context_list_node_t {
-00067         context_list_node_t *my_prev,
-00068                             *my_next;
-00069     };
-00070 
-00071     class allocate_root_with_context_proxy: no_assign {
-00072         task_group_context& my_context;
-00073     public:
-00074         allocate_root_with_context_proxy ( task_group_context& ctx ) : my_context(ctx) {}
-00075         task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
-00076         void __TBB_EXPORTED_METHOD free( task& ) const;
-00077     };
-00078 #endif /* __TBB_EXCEPTIONS */
-00079 
-00080     class allocate_root_proxy: no_assign {
-00081     public:
-00082         static task& __TBB_EXPORTED_FUNC allocate( size_t size );
-00083         static void __TBB_EXPORTED_FUNC free( task& );
-00084     };
-00085 
-00086     class allocate_continuation_proxy: no_assign {
-00087     public:
-00088         task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
-00089         void __TBB_EXPORTED_METHOD free( task& ) const;
-00090     };
-00091 
-00092     class allocate_child_proxy: no_assign {
-00093     public:
-00094         task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
-00095         void __TBB_EXPORTED_METHOD free( task& ) const;
-00096     };
-00097 
-00098     class allocate_additional_child_of_proxy: no_assign {
-00099         task& self;
-00100         task& parent;
-00101     public:
-00102         allocate_additional_child_of_proxy( task& self_, task& parent_ ) : self(self_), parent(parent_) {}
-00103         task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
-00104         void __TBB_EXPORTED_METHOD free( task& ) const;
-00105     };
-00106 
-00108 
-00113     class task_prefix {
-00114     private:
-00115         friend class tbb::task;
-00116         friend class tbb::task_list;
-00117         friend class internal::scheduler;
-00118         friend class internal::allocate_root_proxy;
-00119         friend class internal::allocate_child_proxy;
-00120         friend class internal::allocate_continuation_proxy;
-00121         friend class internal::allocate_additional_child_of_proxy;
-00122 
-00123 #if __TBB_EXCEPTIONS
-00125 
-00128         task_group_context  *context;
-00129 #endif /* __TBB_EXCEPTIONS */
-00130         
-00132 
-00137         scheduler* origin;
-00138 
-00140         scheduler* owner;
-00141 
-00143 
-00146         tbb::task* parent;
-00147 
-00149 
-00153         reference_count ref_count;
-00154 
-00156         int depth;
-00157 
-00159 
-00160         unsigned char state;
-00161 
-00163 
-00167         unsigned char extra_state;
-00168 
-00169         affinity_id affinity;
-00170 
-00172         tbb::task* next;
-00173 
-00175         tbb::task& task() {return *reinterpret_cast<tbb::task*>(this+1);}
-00176     };
-00177 
-00178 } // namespace internal
-00180 
-00181 #if __TBB_EXCEPTIONS
-00182 
-00183 
-00185 
-00200 class task_group_context : internal::no_copy
-00201 {
-00202 public:
-00203     enum kind_type {
-00204         isolated,
-00205         bound
-00206     };
-00207 
-00208 private:
-00209     union {
-00211         kind_type my_kind;
-00212         uintptr_t _my_kind_aligner;
-00213     };
-00214 
-00216     task_group_context *my_parent;
-00217 
-00219 
-00221     internal::context_list_node_t my_node;
-00222 
-00224 
-00227     char _leading_padding[internal::NFS_MaxLineSize - 2 * sizeof(uintptr_t)- sizeof(void*) - sizeof(internal::context_list_node_t)];
-00228     
-00230     uintptr_t my_cancellation_requested;
-00231     
-00233 
-00236     uintptr_t  my_version;
-00237 
-00239     tbb_exception *my_exception;
-00240 
-00242 
-00245     void *my_owner;
-00246 
-00248 
-00249     char _trailing_padding[internal::NFS_MaxLineSize - sizeof(intptr_t) - 2 * sizeof(void*)];
-00250 
-00251 public:
-00252 
-00253 
-00255 
-00272     task_group_context ( kind_type relation_with_parent = bound )
-00273         : my_kind(relation_with_parent)
-00274         , my_version(0)
-00275     {
-00276         init();
-00277     }
-00278 
-00279     __TBB_EXPORTED_METHOD ~task_group_context ();
-00280 
-00282 
-00289     void __TBB_EXPORTED_METHOD reset ();
-00290 
-00292 
-00299     bool __TBB_EXPORTED_METHOD cancel_group_execution ();
-00300 
-00302     bool __TBB_EXPORTED_METHOD is_group_execution_cancelled () const;
-00303 
-00304 protected:
-00306 
-00307     void __TBB_EXPORTED_METHOD init ();
-00308 
-00309 private:
-00310     friend class task;
-00311     friend class internal::allocate_root_with_context_proxy;
-00312 
-00313     static const kind_type binding_required = bound;
-00314     static const kind_type binding_completed = kind_type(bound+1);
-00315 
-00318     void propagate_cancellation_from_ancestors ();
-00319 }; // class task_group_context
-00320 
-00321 #endif /* __TBB_EXCEPTIONS */
-00322 
-00324 
-00325 class task: internal::no_copy {
-00327     void __TBB_EXPORTED_METHOD internal_set_ref_count( int count );
-00328 
-00329 protected:
-00331     task() {prefix().extra_state=1;}
-00332 
-00333 public:
-00335     virtual ~task() {}
-00336 
-00338     virtual task* execute() = 0;
-00339 
-00341     enum state_type {
-00343         executing,
-00345         reexecute,
-00347         ready,
-00349         allocated,
-00351         freed,
-00353         recycle
-00354     };
-00355 
-00356     //------------------------------------------------------------------------
-00357     // Allocating tasks
-00358     //------------------------------------------------------------------------
-00359 
-00361     static internal::allocate_root_proxy allocate_root() {
-00362         return internal::allocate_root_proxy();
-00363     }
-00364 
-00365 #if __TBB_EXCEPTIONS
-00367     static internal::allocate_root_with_context_proxy allocate_root( task_group_context& ctx ) {
-00368         return internal::allocate_root_with_context_proxy(ctx);
-00369     }
-00370 #endif /* __TBB_EXCEPTIONS */
-00371 
-00373 
-00374     internal::allocate_continuation_proxy& allocate_continuation() {
-00375         return *reinterpret_cast<internal::allocate_continuation_proxy*>(this);
-00376     }
-00377 
-00379     internal::allocate_child_proxy& allocate_child() {
-00380         return *reinterpret_cast<internal::allocate_child_proxy*>(this);
-00381     }
-00382 
-00384 
-00386     internal::allocate_additional_child_of_proxy allocate_additional_child_of( task& t ) {
-00387         return internal::allocate_additional_child_of_proxy(*this,t);
-00388     }
-00389 
-00391 
-00395     void __TBB_EXPORTED_METHOD destroy( task& victim );
-00396 
-00397     //------------------------------------------------------------------------
-00398     // Recycling of tasks
-00399     //------------------------------------------------------------------------
-00400 
-00402 
-00408     void recycle_as_continuation() {
-00409         __TBB_ASSERT( prefix().state==executing, "execute not running?" );
-00410         prefix().state = allocated;
-00411     }
-00412 
-00414 
-00415     void recycle_as_safe_continuation() {
-00416         __TBB_ASSERT( prefix().state==executing, "execute not running?" );
-00417         prefix().state = recycle;
-00418     }
-00419 
-00421     void recycle_as_child_of( task& new_parent ) {
-00422         internal::task_prefix& p = prefix();
-00423         __TBB_ASSERT( prefix().state==executing||prefix().state==allocated, "execute not running, or already recycled" );
-00424         __TBB_ASSERT( prefix().ref_count==0, "no child tasks allowed when recycled as a child" );
-00425         __TBB_ASSERT( p.parent==NULL, "parent must be null" );
-00426         __TBB_ASSERT( new_parent.prefix().state<=recycle, "corrupt parent's state" );
-00427         __TBB_ASSERT( new_parent.prefix().state!=freed, "parent already freed" );
-00428         p.state = allocated;
-00429         p.parent = &new_parent;
-00430         p.depth = new_parent.prefix().depth+1;
-00431 #if __TBB_EXCEPTIONS
-00432         p.context = new_parent.prefix().context;
-00433 #endif /* __TBB_EXCEPTIONS */
-00434     }
-00435 
-00437 
-00438     void recycle_to_reexecute() {
-00439         __TBB_ASSERT( prefix().state==executing, "execute not running, or already recycled" );
-00440         __TBB_ASSERT( prefix().ref_count==0, "no child tasks allowed when recycled for reexecution" );
-00441         prefix().state = reexecute;
-00442     }
-00443 
-00444 #if __TBB_TASK_DEQUE
-00445     // All depth-related methods are obsolete, and are retained for the sake 
-00446     // of backward source compatibility only
-00447     intptr_t depth() const {return 0;}
-00448     void set_depth( intptr_t ) {}
-00449     void add_to_depth( int ) {}
-00450 
-00451 #else /* !__TBB_TASK_DEQUE */
-00453 
-00454     typedef internal::intptr depth_type;
-00455 
-00457     depth_type depth() const {return prefix().depth;}
-00458 
-00460 
-00461     void set_depth( depth_type new_depth ) {
-00462         __TBB_ASSERT( state()!=ready, "cannot change depth of ready task" );
-00463         __TBB_ASSERT( new_depth>=0, "depth cannot be negative" );
-00464         __TBB_ASSERT( new_depth==int(new_depth), "integer overflow error");
-00465         prefix().depth = int(new_depth);
-00466     }
-00467 
-00469 
-00470     void add_to_depth( int delta ) {
-00471         __TBB_ASSERT( state()!=ready, "cannot change depth of ready task" );
-00472         __TBB_ASSERT( prefix().depth>=-delta, "depth cannot be negative" );
-00473         prefix().depth+=delta;
-00474     }
-00475 #endif /* !__TBB_TASK_DEQUE */
-00476 
-00477     //------------------------------------------------------------------------
-00478     // Spawning and blocking
-00479     //------------------------------------------------------------------------
-00480 
-00482     void set_ref_count( int count ) {
-00483 #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
-00484         internal_set_ref_count(count);
-00485 #else
-00486         prefix().ref_count = count;
-00487 #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
-00488     }
-00489 
-00491 
-00495     void spawn( task& child ) {
-00496         __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" );
-00497         prefix().owner->spawn( child, child.prefix().next );
-00498     }
-00499 
-00501 
-00502     void spawn( task_list& list );
-00503 
-00505     void spawn_and_wait_for_all( task& child ) {
-00506         __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" );
-00507         prefix().owner->wait_for_all( *this, &child );
-00508     }
-00509 
-00511     void __TBB_EXPORTED_METHOD spawn_and_wait_for_all( task_list& list );
-00512 
-00514 
-00516     static void spawn_root_and_wait( task& root ) {
-00517         __TBB_ASSERT( root.is_owned_by_current_thread(), "root not owned by current thread" );
-00518         root.prefix().owner->spawn_root_and_wait( root, root.prefix().next );
-00519     }
-00520 
-00522 
-00524     static void spawn_root_and_wait( task_list& root_list );
-00525 
-00527 
-00528     void wait_for_all() {
-00529         __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" );
-00530         prefix().owner->wait_for_all( *this, NULL );
-00531     }
-00532 
-00534     static task& __TBB_EXPORTED_FUNC self();
-00535 
-00537     task* parent() const {return prefix().parent;}
-00538 
-00540     bool is_stolen_task() const {
-00541         internal::task_prefix& p = prefix();
-00542         internal::task_prefix& q = parent()->prefix();
-00543         return p.owner!=q.owner;
-00544     }
-00545 
-00546     //------------------------------------------------------------------------
-00547     // Debugging
-00548     //------------------------------------------------------------------------
-00549 
-00551     state_type state() const {return state_type(prefix().state);}
-00552 
-00554     int ref_count() const {
-00555 #if TBB_USE_ASSERT
-00556         internal::reference_count ref_count = prefix().ref_count;
-00557         __TBB_ASSERT( ref_count==int(ref_count), "integer overflow error");
-00558 #endif
-00559         return int(prefix().ref_count);
-00560     }
-00561 
-00563     bool __TBB_EXPORTED_METHOD is_owned_by_current_thread() const;
-00564 
-00565     //------------------------------------------------------------------------
-00566     // Affinity
-00567     //------------------------------------------------------------------------
-00568  
-00570 
-00571     typedef internal::affinity_id affinity_id;
-00572 
-00574     void set_affinity( affinity_id id ) {prefix().affinity = id;}
-00575 
-00577     affinity_id affinity() const {return prefix().affinity;}
-00578 
-00580 
-00584     virtual void __TBB_EXPORTED_METHOD note_affinity( affinity_id id );
-00585 
-00586 #if __TBB_EXCEPTIONS
-00588 
-00589     bool cancel_group_execution () { return prefix().context->cancel_group_execution(); }
-00590 
-00592     bool is_cancelled () const { return prefix().context->is_group_execution_cancelled(); }
-00593 #endif /* __TBB_EXCEPTIONS */
-00594 
-00595 private:
-00596     friend class task_list;
-00597     friend class internal::scheduler;
-00598     friend class internal::allocate_root_proxy;
-00599 #if __TBB_EXCEPTIONS
-00600     friend class internal::allocate_root_with_context_proxy;
-00601 #endif /* __TBB_EXCEPTIONS */
-00602     friend class internal::allocate_continuation_proxy;
-00603     friend class internal::allocate_child_proxy;
-00604     friend class internal::allocate_additional_child_of_proxy;
-00605 
-00607 
-00608     internal::task_prefix& prefix( internal::version_tag* = NULL ) const {
-00609         return reinterpret_cast<internal::task_prefix*>(const_cast<task*>(this))[-1];
-00610     }
-00611 }; // class task
-00612 
-00614 
-00615 class empty_task: public task {
-00616     /*override*/ task* execute() {
-00617         return NULL;
-00618     }
-00619 };
-00620 
-00622 
-00624 class task_list: internal::no_copy {
-00625 private:
-00626     task* first;
-00627     task** next_ptr;
-00628     friend class task;
-00629 public:
-00631     task_list() : first(NULL), next_ptr(&first) {}
-00632 
-00634     ~task_list() {}
-00635 
-00637     bool empty() const {return !first;}
-00638 
-00640     void push_back( task& task ) {
-00641         task.prefix().next = NULL;
-00642         *next_ptr = &task;
-00643         next_ptr = &task.prefix().next;
-00644     }
-00645 
-00647     task& pop_front() {
-00648         __TBB_ASSERT( !empty(), "attempt to pop item from empty task_list" );
-00649         task* result = first;
-00650         first = result->prefix().next;
-00651         if( !first ) next_ptr = &first;
-00652         return *result;
-00653     }
-00654 
-00656     void clear() {
-00657         first=NULL;
-00658         next_ptr=&first;
-00659     }
-00660 };
-00661 
-00662 inline void task::spawn( task_list& list ) {
-00663     __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" );
-00664     if( task* t = list.first ) {
-00665         prefix().owner->spawn( *t, *list.next_ptr );
-00666         list.clear();
-00667     }
-00668 }
-00669 
-00670 inline void task::spawn_root_and_wait( task_list& root_list ) {
-00671     if( task* t = root_list.first ) {
-00672         __TBB_ASSERT( t->is_owned_by_current_thread(), "'this' not owned by current thread" );
-00673         t->prefix().owner->spawn_root_and_wait( *t, *root_list.next_ptr );
-00674         root_list.clear();
-00675     }
-00676 }
-00677 
-00678 } // namespace tbb
-00679 
-00680 inline void *operator new( size_t bytes, const tbb::internal::allocate_root_proxy& ) {
-00681     return &tbb::internal::allocate_root_proxy::allocate(bytes);
-00682 }
-00683 
-00684 inline void operator delete( void* task, const tbb::internal::allocate_root_proxy& ) {
-00685     tbb::internal::allocate_root_proxy::free( *static_cast<tbb::task*>(task) );
-00686 }
-00687 
-00688 #if __TBB_EXCEPTIONS
-00689 inline void *operator new( size_t bytes, const tbb::internal::allocate_root_with_context_proxy& p ) {
-00690     return &p.allocate(bytes);
-00691 }
-00692 
-00693 inline void operator delete( void* task, const tbb::internal::allocate_root_with_context_proxy& p ) {
-00694     p.free( *static_cast<tbb::task*>(task) );
-00695 }
-00696 #endif /* __TBB_EXCEPTIONS */
-00697 
-00698 inline void *operator new( size_t bytes, const tbb::internal::allocate_continuation_proxy& p ) {
-00699     return &p.allocate(bytes);
-00700 }
-00701 
-00702 inline void operator delete( void* task, const tbb::internal::allocate_continuation_proxy& p ) {
-00703     p.free( *static_cast<tbb::task*>(task) );
-00704 }
-00705 
-00706 inline void *operator new( size_t bytes, const tbb::internal::allocate_child_proxy& p ) {
-00707     return &p.allocate(bytes);
-00708 }
-00709 
-00710 inline void operator delete( void* task, const tbb::internal::allocate_child_proxy& p ) {
-00711     p.free( *static_cast<tbb::task*>(task) );
-00712 }
-00713 
-00714 inline void *operator new( size_t bytes, const tbb::internal::allocate_additional_child_of_proxy& p ) {
-00715     return &p.allocate(bytes);
-00716 }
-00717 
-00718 inline void operator delete( void* task, const tbb::internal::allocate_additional_child_of_proxy& p ) {
-00719     p.free( *static_cast<tbb::task*>(task) );
-00720 }
-00721 
-00722 #endif /* __TBB_task_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00306.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00306.html deleted file mode 100644 index 89b2b1abfe..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00306.html +++ /dev/null @@ -1,99 +0,0 @@ - - -task_scheduler_init.h Source File - - - - - - -

task_scheduler_init.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_task_scheduler_init_H
-00022 #define __TBB_task_scheduler_init_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 
-00026 namespace tbb {
-00027 
-00028 typedef std::size_t stack_size_type;
-00029 
-00031 namespace internal {
-00033 
-00034     class scheduler;
-00035 } // namespace internal
-00037 
-00039 
-00042 class task_scheduler_init: internal::no_copy {
-00044     internal::scheduler* my_scheduler;
-00045 public:
-00046 
-00048     static const int automatic = -1;
-00049 
-00051     static const int deferred = -2;
-00052 
-00054 
-00062     void __TBB_EXPORTED_METHOD initialize( int number_of_threads=automatic );
-00063 
-00065 
-00066     void __TBB_EXPORTED_METHOD initialize( int number_of_threads, stack_size_type thread_stack_size );
-00067 
-00069     void __TBB_EXPORTED_METHOD terminate();
-00070 
-00072     task_scheduler_init( int number_of_threads=automatic, stack_size_type thread_stack_size=0 ) : my_scheduler(NULL)  {
-00073         initialize( number_of_threads, thread_stack_size );
-00074     }
-00075 
-00077     ~task_scheduler_init() {
-00078         if( my_scheduler ) 
-00079             terminate();
-00080         internal::poison_pointer( my_scheduler );
-00081     }
-00083 
-00090     static int __TBB_EXPORTED_FUNC default_num_threads ();
-00091 
-00093     bool is_active() const { return my_scheduler != NULL; }
-00094 };
-00095 
-00096 } // namespace tbb
-00097 
-00098 #endif /* __TBB_task_scheduler_init_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00307.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00307.html deleted file mode 100644 index 87886d1b66..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00307.html +++ /dev/null @@ -1,90 +0,0 @@ - - -task_scheduler_observer.h Source File - - - - - - -

task_scheduler_observer.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_task_scheduler_observer_H
-00022 #define __TBB_task_scheduler_observer_H
-00023 
-00024 #include "atomic.h"
-00025 
-00026 #if __TBB_SCHEDULER_OBSERVER
-00027 
-00028 namespace tbb {
-00029 
-00030 namespace internal {
-00031 
-00032 class observer_proxy;
-00033 
-00034 class task_scheduler_observer_v3 {
-00035     friend class observer_proxy;
-00036     observer_proxy* my_proxy;
-00037     atomic<intptr> my_busy_count;
-00038 public:
-00040     void __TBB_EXPORTED_METHOD observe( bool state=true );
-00041 
-00043     bool is_observing() const {return my_proxy!=NULL;}
-00044 
-00046     task_scheduler_observer_v3() : my_proxy(NULL) {my_busy_count=0;}
-00047 
-00049     virtual void on_scheduler_entry( bool /*is_worker*/ ) {} 
-00050 
-00052     virtual void on_scheduler_exit( bool /*is_worker*/ ) {}
-00053 
-00055     virtual ~task_scheduler_observer_v3() {observe(false);}
-00056 };
-00057 
-00058 } // namespace internal
-00059 
-00060 typedef internal::task_scheduler_observer_v3 task_scheduler_observer;
-00061 
-00062 } // namespace tbb
-00063 
-00064 #endif /* __TBB_SCHEDULER_OBSERVER */
-00065 
-00066 #endif /* __TBB_task_scheduler_observer_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00309.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00309.html deleted file mode 100644 index fff776efd4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00309.html +++ /dev/null @@ -1,149 +0,0 @@ - - -tbb_allocator.h Source File - - - - - - -

tbb_allocator.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_tbb_allocator_H
-00022 #define __TBB_tbb_allocator_H
-00023 
-00024 #include <new>
-00025 #include "tbb_stddef.h"
-00026 
-00027 namespace tbb {
-00028 
-00030 namespace internal {
-00031 
-00033 
-00034     void __TBB_EXPORTED_FUNC deallocate_via_handler_v3( void *p );
-00035 
-00037 
-00038     void* __TBB_EXPORTED_FUNC allocate_via_handler_v3( size_t n );
-00039 
-00041     bool __TBB_EXPORTED_FUNC is_malloc_used_v3();
-00042 }
-00044 
-00045 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00046     // Workaround for erroneous "unreferenced parameter" warning in method destroy.
-00047     #pragma warning (push)
-00048     #pragma warning (disable: 4100)
-00049 #endif
-00050 
-00052 
-00057 template<typename T>
-00058 class tbb_allocator {
-00059 public:
-00060     typedef typename internal::allocator_type<T>::value_type value_type;
-00061     typedef value_type* pointer;
-00062     typedef const value_type* const_pointer;
-00063     typedef value_type& reference;
-00064     typedef const value_type& const_reference;
-00065     typedef size_t size_type;
-00066     typedef ptrdiff_t difference_type;
-00067     template<typename U> struct rebind {
-00068         typedef tbb_allocator<U> other;
-00069     };
-00070 
-00072     enum malloc_type {
-00073         scalable, 
-00074         standard
-00075     };
-00076 
-00077     tbb_allocator() throw() {}
-00078     tbb_allocator( const tbb_allocator& ) throw() {}
-00079     template<typename U> tbb_allocator(const tbb_allocator<U>&) throw() {}
-00080 
-00081     pointer address(reference x) const {return &x;}
-00082     const_pointer address(const_reference x) const {return &x;}
-00083     
-00085     pointer allocate( size_type n, const void* /*hint*/ = 0) {
-00086         return pointer(internal::allocate_via_handler_v3( n * sizeof(value_type) ));
-00087     }
-00088 
-00090     void deallocate( pointer p, size_type ) {
-00091         internal::deallocate_via_handler_v3(p);        
-00092     }
-00093 
-00095     size_type max_size() const throw() {
-00096         size_type max = static_cast<size_type>(-1) / sizeof (value_type);
-00097         return (max > 0 ? max : 1);
-00098     }
-00099     
-00101     void construct( pointer p, const value_type& value ) {new(static_cast<void*>(p)) value_type(value);}
-00102 
-00104     void destroy( pointer p ) {p->~value_type();}
-00105 
-00107     static malloc_type allocator_type() {
-00108         return internal::is_malloc_used_v3() ? standard : scalable;
-00109     }
-00110 };
-00111 
-00112 #if _MSC_VER && !defined(__INTEL_COMPILER)
-00113     #pragma warning (pop)
-00114 #endif // warning 4100 is back
-00115 
-00117 
-00118 template<> 
-00119 class tbb_allocator<void> {
-00120 public:
-00121     typedef void* pointer;
-00122     typedef const void* const_pointer;
-00123     typedef void value_type;
-00124     template<typename U> struct rebind {
-00125         typedef tbb_allocator<U> other;
-00126     };
-00127 };
-00128 
-00129 template<typename T, typename U>
-00130 inline bool operator==( const tbb_allocator<T>&, const tbb_allocator<U>& ) {return true;}
-00131 
-00132 template<typename T, typename U>
-00133 inline bool operator!=( const tbb_allocator<T>&, const tbb_allocator<U>& ) {return false;}
-00134 
-00135 } // namespace tbb 
-00136 
-00137 #endif /* __TBB_tbb_allocator_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00310.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00310.html deleted file mode 100644 index 8b53cab36c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00310.html +++ /dev/null @@ -1,125 +0,0 @@ - - -tbb_config.h Source File - - - - - - -

tbb_config.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_tbb_config_H
-00022 #define __TBB_tbb_config_H
-00023 
-00033 #ifndef TBB_USE_DEBUG
-00034 #ifdef TBB_DO_ASSERT
-00035 #define TBB_USE_DEBUG TBB_DO_ASSERT
-00036 #else
-00037 #define TBB_USE_DEBUG 0
-00038 #endif /* TBB_DO_ASSERT */
-00039 #else
-00040 #define TBB_DO_ASSERT TBB_USE_DEBUG
-00041 #endif /* TBB_USE_DEBUG */
-00042 
-00043 #ifndef TBB_USE_ASSERT
-00044 #ifdef TBB_DO_ASSERT
-00045 #define TBB_USE_ASSERT TBB_DO_ASSERT
-00046 #else 
-00047 #define TBB_USE_ASSERT TBB_USE_DEBUG
-00048 #endif /* TBB_DO_ASSERT */
-00049 #endif /* TBB_USE_ASSERT */
-00050 
-00051 #ifndef TBB_USE_THREADING_TOOLS
-00052 #ifdef TBB_DO_THREADING_TOOLS
-00053 #define TBB_USE_THREADING_TOOLS TBB_DO_THREADING_TOOLS
-00054 #else 
-00055 #define TBB_USE_THREADING_TOOLS TBB_USE_DEBUG
-00056 #endif /* TBB_DO_THREADING_TOOLS */
-00057 #endif /* TBB_USE_THREADING_TOOLS */
-00058 
-00059 #ifndef TBB_USE_PERFORMANCE_WARNINGS
-00060 #ifdef TBB_PERFORMANCE_WARNINGS
-00061 #define TBB_USE_PERFORMANCE_WARNINGS TBB_PERFORMANCE_WARNINGS
-00062 #else 
-00063 #define TBB_USE_PERFORMANCE_WARNINGS TBB_USE_DEBUG
-00064 #endif /* TBB_PEFORMANCE_WARNINGS */
-00065 #endif /* TBB_USE_PERFORMANCE_WARNINGS */
-00066 
-00067 
-00070 #if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__SUNPRO_CC)
-00071 #ifndef __TBB_EXCEPTIONS
-00072 #define __TBB_EXCEPTIONS 1
-00073 #endif /* __TBB_EXCEPTIONS */
-00074 #endif
-00075 
-00076 #ifndef __TBB_SCHEDULER_OBSERVER
-00077 #define __TBB_SCHEDULER_OBSERVER 1
-00078 #endif /* __TBB_SCHEDULER_OBSERVER */
-00079 
-00080 #ifndef __TBB_TASK_SCHEDULER_AUTO_INIT
-00081 #define __TBB_TASK_SCHEDULER_AUTO_INIT 1
-00082 #endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */
-00083 
-00084 #ifndef __TBB_TASK_DEQUE
-00085 #define __TBB_TASK_DEQUE 1
-00086 #endif /* !__TBB_TASK_DEQUE */
-00087 
-00088 #ifndef __TBB_NEW_ITT_NOTIFY
-00089 #define __TBB_NEW_ITT_NOTIFY 0
-00090 #endif /* !__TBB_NEW_ITT_NOTIFY */
-00091 
-00092 
-00100 #if __GLIBC__==2 && __GLIBC_MINOR__==3
-00101 
-00102     #define __TBB_EXCEPTION_HANDLING_BROKEN 1
-00103 #endif
-00104 
-00105 #if __FreeBSD__
-00106 
-00108     #define __TBB_PRIO_INHERIT_BROKEN 1
-00109 
-00112     #define __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN 1
-00113 #endif /* __FreeBSD__ */
-00114 
-00115 
-00116 #endif /* __TBB_tbb_config_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00311.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00311.html deleted file mode 100644 index 91de867e55..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00311.html +++ /dev/null @@ -1,221 +0,0 @@ - - -tbb_exception.h Source File - - - - - - -

tbb_exception.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_exception_H
-00022 #define __TBB_exception_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 #include <stdexcept>
-00026 
-00027 namespace tbb {
-00028 
-00030 class bad_last_alloc : public std::bad_alloc {
-00031 public:
-00032     virtual const char* what() const throw() { return "bad allocation in previous or concurrent attempt"; }
-00033     virtual ~bad_last_alloc() throw() {}
-00034 };
-00035 
-00036 } // namespace tbb
-00037 
-00038 #if __TBB_EXCEPTIONS
-00039 #include "tbb_allocator.h"
-00040 #include <exception>
-00041 #include <typeinfo>
-00042 #include <new>
-00043 
-00044 namespace tbb {
-00045 
-00047 
-00067 class tbb_exception : public std::exception {
-00068 public:
-00070 
-00071     virtual tbb_exception* move () throw() = 0;
-00072     
-00074 
-00076     virtual void destroy () throw() = 0;
-00077 
-00079 
-00083     virtual void throw_self () = 0;
-00084 
-00086     virtual const char* name() const throw() = 0;
-00087 
-00089     virtual const char* what() const throw() = 0;
-00090 };
-00091 
-00093 
-00097 class captured_exception : public tbb_exception
-00098 {
-00099 public:
-00100     captured_exception ( const captured_exception& src )
-00101         : my_dynamic(false)
-00102     {
-00103         set(src.my_exception_name, src.my_exception_info);
-00104     }
-00105 
-00106     captured_exception ( const char* name, const char* info )
-00107         : my_dynamic(false)
-00108     {
-00109         set(name, info);
-00110     }
-00111 
-00112     __TBB_EXPORTED_METHOD ~captured_exception () throw() {
-00113         clear();
-00114     }
-00115 
-00116     captured_exception& operator= ( const captured_exception& src ) {
-00117         if ( this != &src ) {
-00118             clear();
-00119             set(src.my_exception_name, src.my_exception_info);
-00120         }
-00121         return *this;
-00122     }
-00123 
-00124     /*override*/ 
-00125     captured_exception* move () throw();
-00126 
-00127     /*override*/ 
-00128     void destroy () throw();
-00129 
-00130     /*override*/ 
-00131     void throw_self () { throw *this; }
-00132 
-00133     /*override*/ 
-00134     const char* __TBB_EXPORTED_METHOD name() const throw();
-00135 
-00136     /*override*/ 
-00137     const char* __TBB_EXPORTED_METHOD what() const throw();
-00138 
-00139 private:
-00141     captured_exception() {}
-00142 
-00144     static captured_exception* allocate ( const char* name, const char* info );
-00145 
-00146     void set ( const char* name, const char* info ) throw();
-00147     void clear () throw();
-00148 
-00149     bool my_dynamic;
-00150     const char* my_exception_name;
-00151     const char* my_exception_info;
-00152 };
-00153 
-00155 
-00159 template<typename ExceptionData>
-00160 class movable_exception : public tbb_exception
-00161 {
-00162     typedef movable_exception<ExceptionData> self_type;
-00163 
-00164 public:
-00165     movable_exception ( const ExceptionData& data ) 
-00166         : my_exception_data(data)
-00167         , my_dynamic(false)
-00168         , my_exception_name(typeid(self_type).name())
-00169     {}
-00170 
-00171     movable_exception ( const movable_exception& src ) throw () 
-00172         : my_exception_data(src.my_exception_data)
-00173         , my_dynamic(false)
-00174         , my_exception_name(src.my_exception_name)
-00175     {}
-00176 
-00177     ~movable_exception () throw() {}
-00178 
-00179     const movable_exception& operator= ( const movable_exception& src ) {
-00180         if ( this != &src ) {
-00181             my_exception_data = src.my_exception_data;
-00182             my_exception_name = src.my_exception_name;
-00183         }
-00184         return *this;
-00185     }
-00186 
-00187     ExceptionData& data () throw() { return my_exception_data; }
-00188 
-00189     const ExceptionData& data () const throw() { return my_exception_data; }
-00190 
-00191     /*override*/ const char* name () const throw() { return my_exception_name; }
-00192 
-00193     /*override*/ const char* what () const throw() { return "tbb::movable_exception"; }
-00194 
-00195     /*override*/ 
-00196     movable_exception* move () throw() {
-00197         void* e = internal::allocate_via_handler_v3(sizeof(movable_exception));
-00198         if ( e ) {
-00199             new (e) movable_exception(*this);
-00200             ((movable_exception*)e)->my_dynamic = true;
-00201         }
-00202         return (movable_exception*)e;
-00203     }
-00204     /*override*/ 
-00205     void destroy () throw() {
-00206         __TBB_ASSERT ( my_dynamic, "Method destroy can be called only on dynamically allocated movable_exceptions" );
-00207         if ( my_dynamic ) {
-00208             this->~movable_exception();
-00209             internal::deallocate_via_handler_v3(this);
-00210         }
-00211     }
-00212     /*override*/ 
-00213     void throw_self () {
-00214         throw *this;
-00215     }
-00216 
-00217 protected:
-00219     ExceptionData  my_exception_data;
-00220 
-00221 private:
-00223     bool my_dynamic;
-00224 
-00226 
-00227     const char* my_exception_name;
-00228 };
-00229 
-00230 } // namespace tbb
-00231 
-00232 #endif /* __TBB_EXCEPTIONS */
-00233 
-00234 #endif /* __TBB_exception_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00312.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00312.html deleted file mode 100644 index a3c8f6fd04..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00312.html +++ /dev/null @@ -1,587 +0,0 @@ - - -tbb_machine.h Source File - - - - - - -

tbb_machine.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_machine_H
-00022 #define __TBB_machine_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 
-00026 #if _WIN32||_WIN64
-00027 
-00028 #ifdef _MANAGED
-00029 #pragma managed(push, off)
-00030 #endif
-00031 
-00032 #if defined(_M_IX86)
-00033 #include "machine/windows_ia32.h"
-00034 #elif defined(_M_AMD64) 
-00035 #include "machine/windows_em64t.h"
-00036 #else
-00037 #error Unsupported platform
-00038 #endif
-00039 
-00040 #ifdef _MANAGED
-00041 #pragma managed(pop)
-00042 #endif
-00043 
-00044 #elif __linux__ || __FreeBSD__
-00045 
-00046 #if __i386__
-00047 #include "machine/linux_ia32.h"
-00048 #elif __x86_64__
-00049 #include "machine/linux_em64t.h"
-00050 #elif __ia64__
-00051 #include "machine/linux_itanium.h"
-00052 #endif
-00053 
-00054 #elif __APPLE__
-00055 
-00056 #if __i386__
-00057 #include "machine/linux_ia32.h"
-00058 #elif __x86_64__
-00059 #include "machine/linux_em64t.h"
-00060 #elif __POWERPC__
-00061 #include "machine/mac_ppc.h"
-00062 #endif
-00063 
-00064 #elif _AIX
-00065 
-00066 #include "machine/ibm_aix51.h"
-00067 
-00068 #elif __sun || __SUNPRO_CC
-00069 
-00070 #define __asm__ asm 
-00071 #define __volatile__ volatile
-00072 #if __i386  || __i386__
-00073 #include "machine/linux_ia32.h"
-00074 #elif __x86_64__
-00075 #include "machine/linux_em64t.h"
-00076 #endif
-00077 
-00078 #endif
-00079 
-00080 #if !defined(__TBB_CompareAndSwap4) || !defined(__TBB_CompareAndSwap8) || !defined(__TBB_Yield)
-00081 #error Minimal requirements for tbb_machine.h not satisfied 
-00082 #endif
-00083 
-00084 #ifndef __TBB_load_with_acquire
-00086     template<typename T>
-00087     inline T __TBB_load_with_acquire(const volatile T& location) {
-00088         T temp = location;
-00089 #ifdef __TBB_fence_for_acquire 
-00090         __TBB_fence_for_acquire();
-00091 #endif /* __TBB_fence_for_acquire */
-00092         return temp;
-00093     }
-00094 #endif
-00095 
-00096 #ifndef __TBB_store_with_release
-00098     template<typename T, typename V>
-00099     inline void __TBB_store_with_release(volatile T& location, V value) {
-00100 #ifdef __TBB_fence_for_release
-00101         __TBB_fence_for_release();
-00102 #endif /* __TBB_fence_for_release */
-00103         location = T(value); 
-00104     }
-00105 #endif
-00106 
-00107 #ifndef __TBB_Pause
-00108     inline void __TBB_Pause(int32_t) {
-00109         __TBB_Yield();
-00110     }
-00111 #endif
-00112 
-00113 namespace tbb {
-00114 namespace internal {
-00115 
-00117 
-00118 class AtomicBackoff {
-00120 
-00122     static const int32_t LOOPS_BEFORE_YIELD = 16;
-00123     int32_t count;
-00124 public:
-00125     AtomicBackoff() : count(1) {}
-00126 
-00128     void pause() {
-00129         if( count<=LOOPS_BEFORE_YIELD ) {
-00130             __TBB_Pause(count);
-00131             // Pause twice as long the next time.
-00132             count*=2;
-00133         } else {
-00134             // Pause is so long that we might as well yield CPU to scheduler.
-00135             __TBB_Yield();
-00136         }
-00137     }
-00138 
-00139     // pause for a few times and then return false immediately.
-00140     bool bounded_pause() {
-00141         if( count<=LOOPS_BEFORE_YIELD ) {
-00142             __TBB_Pause(count);
-00143             // Pause twice as long the next time.
-00144             count*=2;
-00145             return true;
-00146         } else {
-00147             return false;
-00148         }
-00149     }
-00150 
-00151     void reset() {
-00152         count = 1;
-00153     }
-00154 };
-00155 
-00156 // T should be unsigned, otherwise sign propagation will break correctness of bit manipulations.
-00157 // S should be either 1 or 2, for the mask calculation to work correctly.
-00158 // Together, these rules limit applicability of Masked CAS to unsigned char and unsigned short.
-00159 template<size_t S, typename T>
-00160 inline T __TBB_MaskedCompareAndSwap (volatile T *ptr, T value, T comparand ) {
-00161     volatile uint32_t * base = (uint32_t*)( (uintptr_t)ptr & ~(uintptr_t)0x3 );
-00162 #if __TBB_BIG_ENDIAN
-00163     const uint8_t bitoffset = uint8_t( 8*( 4-S - (uintptr_t(ptr) & 0x3) ) );
-00164 #else
-00165     const uint8_t bitoffset = uint8_t( 8*((uintptr_t)ptr & 0x3) );
-00166 #endif
-00167     const uint32_t mask = ( (1<<(S*8)) - 1 )<<bitoffset;
-00168     AtomicBackoff b;
-00169     uint32_t result;
-00170     for(;;) {
-00171         result = *base; // reload the base value which might change during the pause
-00172         uint32_t old_value = ( result & ~mask ) | ( comparand << bitoffset );
-00173         uint32_t new_value = ( result & ~mask ) | ( value << bitoffset );
-00174         // __TBB_CompareAndSwap4 presumed to have full fence. 
-00175         result = __TBB_CompareAndSwap4( base, new_value, old_value );
-00176         if(  result==old_value               // CAS succeeded
-00177           || ((result^old_value)&mask)!=0 )  // CAS failed and the bits of interest have changed
-00178             break;
-00179         else                                 // CAS failed but the bits of interest left unchanged
-00180             b.pause();
-00181     }
-00182     return T((result & mask) >> bitoffset);
-00183 }
-00184 
-00185 template<size_t S, typename T>
-00186 inline T __TBB_CompareAndSwapGeneric (volatile void *ptr, T value, T comparand ) { 
-00187     return __TBB_CompareAndSwapW((T *)ptr,value,comparand);
-00188 }
-00189 
-00190 template<>
-00191 inline uint8_t __TBB_CompareAndSwapGeneric <1,uint8_t> (volatile void *ptr, uint8_t value, uint8_t comparand ) {
-00192 #ifdef __TBB_CompareAndSwap1
-00193     return __TBB_CompareAndSwap1(ptr,value,comparand);
-00194 #else
-00195     return __TBB_MaskedCompareAndSwap<1,uint8_t>((volatile uint8_t *)ptr,value,comparand);
-00196 #endif
-00197 }
-00198 
-00199 template<>
-00200 inline uint16_t __TBB_CompareAndSwapGeneric <2,uint16_t> (volatile void *ptr, uint16_t value, uint16_t comparand ) {
-00201 #ifdef __TBB_CompareAndSwap2
-00202     return __TBB_CompareAndSwap2(ptr,value,comparand);
-00203 #else
-00204     return __TBB_MaskedCompareAndSwap<2,uint16_t>((volatile uint16_t *)ptr,value,comparand);
-00205 #endif
-00206 }
-00207 
-00208 template<>
-00209 inline uint32_t __TBB_CompareAndSwapGeneric <4,uint32_t> (volatile void *ptr, uint32_t value, uint32_t comparand ) { 
-00210     return __TBB_CompareAndSwap4(ptr,value,comparand);
-00211 }
-00212 
-00213 template<>
-00214 inline uint64_t __TBB_CompareAndSwapGeneric <8,uint64_t> (volatile void *ptr, uint64_t value, uint64_t comparand ) { 
-00215     return __TBB_CompareAndSwap8(ptr,value,comparand);
-00216 }
-00217 
-00218 template<size_t S, typename T>
-00219 inline T __TBB_FetchAndAddGeneric (volatile void *ptr, T addend) {
-00220     AtomicBackoff b;
-00221     T result;
-00222     for(;;) {
-00223         result = *reinterpret_cast<volatile T *>(ptr);
-00224         // __TBB_CompareAndSwapGeneric presumed to have full fence. 
-00225         if( __TBB_CompareAndSwapGeneric<S,T> ( ptr, result+addend, result )==result ) 
-00226             break;
-00227         b.pause();
-00228     }
-00229     return result;
-00230 }
-00231 
-00232 template<size_t S, typename T>
-00233 inline T __TBB_FetchAndStoreGeneric (volatile void *ptr, T value) {
-00234     AtomicBackoff b;
-00235     T result;
-00236     for(;;) {
-00237         result = *reinterpret_cast<volatile T *>(ptr);
-00238         // __TBB_CompareAndSwapGeneric presumed to have full fence.
-00239         if( __TBB_CompareAndSwapGeneric<S,T> ( ptr, value, result )==result ) 
-00240             break;
-00241         b.pause();
-00242     }
-00243     return result;
-00244 }
-00245 
-00246 // Macro __TBB_TypeWithAlignmentAtLeastAsStrict(T) should be a type with alignment at least as 
-00247 // strict as type T.  Type type should have a trivial default constructor and destructor, so that
-00248 // arrays of that type can be declared without initializers.  
-00249 // It is correct (but perhaps a waste of space) if __TBB_TypeWithAlignmentAtLeastAsStrict(T) expands
-00250 // to a type bigger than T.
-00251 // The default definition here works on machines where integers are naturally aligned and the
-00252 // strictest alignment is 16.
-00253 #ifndef __TBB_TypeWithAlignmentAtLeastAsStrict
-00254 
-00255 #if __GNUC__ || __SUNPRO_CC
-00256 struct __TBB_machine_type_with_strictest_alignment {
-00257     int member[4];
-00258 } __attribute__((aligned(16)));
-00259 #elif _MSC_VER
-00260 __declspec(align(16)) struct __TBB_machine_type_with_strictest_alignment {
-00261     int member[4];
-00262 };
-00263 #else
-00264 #error Must define __TBB_TypeWithAlignmentAtLeastAsStrict(T) or __TBB_machine_type_with_strictest_alignment
-00265 #endif
-00266 
-00267 template<size_t N> struct type_with_alignment {__TBB_machine_type_with_strictest_alignment member;};
-00268 template<> struct type_with_alignment<1> { char member; };
-00269 template<> struct type_with_alignment<2> { uint16_t member; };
-00270 template<> struct type_with_alignment<4> { uint32_t member; };
-00271 template<> struct type_with_alignment<8> { uint64_t member; };
-00272 
-00273 #if _MSC_VER||defined(__GNUC__)&&__GNUC__==3 && __GNUC_MINOR__<=2  
-00275 
-00277 template<size_t Size, typename T> 
-00278 struct work_around_alignment_bug {
-00279 #if _MSC_VER
-00280     static const size_t alignment = __alignof(T);
-00281 #else
-00282     static const size_t alignment = __alignof__(T);
-00283 #endif
-00284 };
-00285 #define __TBB_TypeWithAlignmentAtLeastAsStrict(T) tbb::internal::type_with_alignment<tbb::internal::work_around_alignment_bug<sizeof(T),T>::alignment>
-00286 #elif __GNUC__ || __SUNPRO_CC
-00287 #define __TBB_TypeWithAlignmentAtLeastAsStrict(T) tbb::internal::type_with_alignment<__alignof__(T)>
-00288 #else
-00289 #define __TBB_TypeWithAlignmentAtLeastAsStrict(T) __TBB_machine_type_with_strictest_alignment
-00290 #endif
-00291 #endif  /* ____TBB_TypeWithAlignmentAtLeastAsStrict */
-00292 
-00293 } // namespace internal
-00294 } // namespace tbb
-00295 
-00296 #ifndef __TBB_CompareAndSwap1
-00297 #define __TBB_CompareAndSwap1 tbb::internal::__TBB_CompareAndSwapGeneric<1,uint8_t>
-00298 #endif
-00299 
-00300 #ifndef __TBB_CompareAndSwap2 
-00301 #define __TBB_CompareAndSwap2 tbb::internal::__TBB_CompareAndSwapGeneric<2,uint16_t>
-00302 #endif
-00303 
-00304 #ifndef __TBB_CompareAndSwapW
-00305 #define __TBB_CompareAndSwapW tbb::internal::__TBB_CompareAndSwapGeneric<sizeof(ptrdiff_t),ptrdiff_t>
-00306 #endif
-00307 
-00308 #ifndef __TBB_FetchAndAdd1
-00309 #define __TBB_FetchAndAdd1 tbb::internal::__TBB_FetchAndAddGeneric<1,uint8_t>
-00310 #endif
-00311 
-00312 #ifndef __TBB_FetchAndAdd2
-00313 #define __TBB_FetchAndAdd2 tbb::internal::__TBB_FetchAndAddGeneric<2,uint16_t>
-00314 #endif
-00315 
-00316 #ifndef __TBB_FetchAndAdd4
-00317 #define __TBB_FetchAndAdd4 tbb::internal::__TBB_FetchAndAddGeneric<4,uint32_t>
-00318 #endif
-00319 
-00320 #ifndef __TBB_FetchAndAdd8
-00321 #define __TBB_FetchAndAdd8 tbb::internal::__TBB_FetchAndAddGeneric<8,uint64_t>
-00322 #endif
-00323 
-00324 #ifndef __TBB_FetchAndAddW
-00325 #define __TBB_FetchAndAddW tbb::internal::__TBB_FetchAndAddGeneric<sizeof(ptrdiff_t),ptrdiff_t>
-00326 #endif
-00327 
-00328 #ifndef __TBB_FetchAndStore1
-00329 #define __TBB_FetchAndStore1 tbb::internal::__TBB_FetchAndStoreGeneric<1,uint8_t>
-00330 #endif
-00331 
-00332 #ifndef __TBB_FetchAndStore2
-00333 #define __TBB_FetchAndStore2 tbb::internal::__TBB_FetchAndStoreGeneric<2,uint16_t>
-00334 #endif
-00335 
-00336 #ifndef __TBB_FetchAndStore4
-00337 #define __TBB_FetchAndStore4 tbb::internal::__TBB_FetchAndStoreGeneric<4,uint32_t>
-00338 #endif
-00339 
-00340 #ifndef __TBB_FetchAndStore8
-00341 #define __TBB_FetchAndStore8 tbb::internal::__TBB_FetchAndStoreGeneric<8,uint64_t>
-00342 #endif
-00343 
-00344 #ifndef __TBB_FetchAndStoreW
-00345 #define __TBB_FetchAndStoreW tbb::internal::__TBB_FetchAndStoreGeneric<sizeof(ptrdiff_t),ptrdiff_t>
-00346 #endif
-00347 
-00348 #if __TBB_DECL_FENCED_ATOMICS
-00349 
-00350 #ifndef __TBB_CompareAndSwap1__TBB_full_fence
-00351 #define __TBB_CompareAndSwap1__TBB_full_fence __TBB_CompareAndSwap1
-00352 #endif 
-00353 #ifndef __TBB_CompareAndSwap1acquire
-00354 #define __TBB_CompareAndSwap1acquire __TBB_CompareAndSwap1__TBB_full_fence
-00355 #endif 
-00356 #ifndef __TBB_CompareAndSwap1release
-00357 #define __TBB_CompareAndSwap1release __TBB_CompareAndSwap1__TBB_full_fence
-00358 #endif 
-00359 
-00360 #ifndef __TBB_CompareAndSwap2__TBB_full_fence
-00361 #define __TBB_CompareAndSwap2__TBB_full_fence __TBB_CompareAndSwap2
-00362 #endif
-00363 #ifndef __TBB_CompareAndSwap2acquire
-00364 #define __TBB_CompareAndSwap2acquire __TBB_CompareAndSwap2__TBB_full_fence
-00365 #endif
-00366 #ifndef __TBB_CompareAndSwap2release
-00367 #define __TBB_CompareAndSwap2release __TBB_CompareAndSwap2__TBB_full_fence
-00368 #endif
-00369 
-00370 #ifndef __TBB_CompareAndSwap4__TBB_full_fence
-00371 #define __TBB_CompareAndSwap4__TBB_full_fence __TBB_CompareAndSwap4
-00372 #endif 
-00373 #ifndef __TBB_CompareAndSwap4acquire
-00374 #define __TBB_CompareAndSwap4acquire __TBB_CompareAndSwap4__TBB_full_fence
-00375 #endif 
-00376 #ifndef __TBB_CompareAndSwap4release
-00377 #define __TBB_CompareAndSwap4release __TBB_CompareAndSwap4__TBB_full_fence
-00378 #endif 
-00379 
-00380 #ifndef __TBB_CompareAndSwap8__TBB_full_fence
-00381 #define __TBB_CompareAndSwap8__TBB_full_fence __TBB_CompareAndSwap8
-00382 #endif
-00383 #ifndef __TBB_CompareAndSwap8acquire
-00384 #define __TBB_CompareAndSwap8acquire __TBB_CompareAndSwap8__TBB_full_fence
-00385 #endif
-00386 #ifndef __TBB_CompareAndSwap8release
-00387 #define __TBB_CompareAndSwap8release __TBB_CompareAndSwap8__TBB_full_fence
-00388 #endif
-00389 
-00390 #ifndef __TBB_FetchAndAdd1__TBB_full_fence
-00391 #define __TBB_FetchAndAdd1__TBB_full_fence __TBB_FetchAndAdd1
-00392 #endif
-00393 #ifndef __TBB_FetchAndAdd1acquire
-00394 #define __TBB_FetchAndAdd1acquire __TBB_FetchAndAdd1__TBB_full_fence
-00395 #endif
-00396 #ifndef __TBB_FetchAndAdd1release
-00397 #define __TBB_FetchAndAdd1release __TBB_FetchAndAdd1__TBB_full_fence
-00398 #endif
-00399 
-00400 #ifndef __TBB_FetchAndAdd2__TBB_full_fence
-00401 #define __TBB_FetchAndAdd2__TBB_full_fence __TBB_FetchAndAdd2
-00402 #endif
-00403 #ifndef __TBB_FetchAndAdd2acquire
-00404 #define __TBB_FetchAndAdd2acquire __TBB_FetchAndAdd2__TBB_full_fence
-00405 #endif
-00406 #ifndef __TBB_FetchAndAdd2release
-00407 #define __TBB_FetchAndAdd2release __TBB_FetchAndAdd2__TBB_full_fence
-00408 #endif
-00409 
-00410 #ifndef __TBB_FetchAndAdd4__TBB_full_fence
-00411 #define __TBB_FetchAndAdd4__TBB_full_fence __TBB_FetchAndAdd4
-00412 #endif
-00413 #ifndef __TBB_FetchAndAdd4acquire
-00414 #define __TBB_FetchAndAdd4acquire __TBB_FetchAndAdd4__TBB_full_fence
-00415 #endif
-00416 #ifndef __TBB_FetchAndAdd4release
-00417 #define __TBB_FetchAndAdd4release __TBB_FetchAndAdd4__TBB_full_fence
-00418 #endif
-00419 
-00420 #ifndef __TBB_FetchAndAdd8__TBB_full_fence
-00421 #define __TBB_FetchAndAdd8__TBB_full_fence __TBB_FetchAndAdd8
-00422 #endif
-00423 #ifndef __TBB_FetchAndAdd8acquire
-00424 #define __TBB_FetchAndAdd8acquire __TBB_FetchAndAdd8__TBB_full_fence
-00425 #endif
-00426 #ifndef __TBB_FetchAndAdd8release
-00427 #define __TBB_FetchAndAdd8release __TBB_FetchAndAdd8__TBB_full_fence
-00428 #endif
-00429 
-00430 #ifndef __TBB_FetchAndStore1__TBB_full_fence
-00431 #define __TBB_FetchAndStore1__TBB_full_fence __TBB_FetchAndStore1
-00432 #endif
-00433 #ifndef __TBB_FetchAndStore1acquire
-00434 #define __TBB_FetchAndStore1acquire __TBB_FetchAndStore1__TBB_full_fence
-00435 #endif
-00436 #ifndef __TBB_FetchAndStore1release
-00437 #define __TBB_FetchAndStore1release __TBB_FetchAndStore1__TBB_full_fence
-00438 #endif
-00439 
-00440 #ifndef __TBB_FetchAndStore2__TBB_full_fence
-00441 #define __TBB_FetchAndStore2__TBB_full_fence __TBB_FetchAndStore2
-00442 #endif
-00443 #ifndef __TBB_FetchAndStore2acquire
-00444 #define __TBB_FetchAndStore2acquire __TBB_FetchAndStore2__TBB_full_fence
-00445 #endif
-00446 #ifndef __TBB_FetchAndStore2release
-00447 #define __TBB_FetchAndStore2release __TBB_FetchAndStore2__TBB_full_fence
-00448 #endif
-00449 
-00450 #ifndef __TBB_FetchAndStore4__TBB_full_fence
-00451 #define __TBB_FetchAndStore4__TBB_full_fence __TBB_FetchAndStore4
-00452 #endif
-00453 #ifndef __TBB_FetchAndStore4acquire
-00454 #define __TBB_FetchAndStore4acquire __TBB_FetchAndStore4__TBB_full_fence
-00455 #endif
-00456 #ifndef __TBB_FetchAndStore4release
-00457 #define __TBB_FetchAndStore4release __TBB_FetchAndStore4__TBB_full_fence
-00458 #endif
-00459 
-00460 #ifndef __TBB_FetchAndStore8__TBB_full_fence
-00461 #define __TBB_FetchAndStore8__TBB_full_fence __TBB_FetchAndStore8
-00462 #endif
-00463 #ifndef __TBB_FetchAndStore8acquire
-00464 #define __TBB_FetchAndStore8acquire __TBB_FetchAndStore8__TBB_full_fence
-00465 #endif
-00466 #ifndef __TBB_FetchAndStore8release
-00467 #define __TBB_FetchAndStore8release __TBB_FetchAndStore8__TBB_full_fence
-00468 #endif
-00469 
-00470 #endif // __TBB_DECL_FENCED_ATOMICS
-00471 
-00472 // Special atomic functions
-00473 #ifndef __TBB_FetchAndAddWrelease
-00474 #define __TBB_FetchAndAddWrelease __TBB_FetchAndAddW
-00475 #endif
-00476 
-00477 #ifndef __TBB_FetchAndIncrementWacquire
-00478 #define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAddW(P,1)
-00479 #endif
-00480 
-00481 #ifndef __TBB_FetchAndDecrementWrelease
-00482 #define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAddW(P,(-1))
-00483 #endif
-00484 
-00485 #if __TBB_WORDSIZE==4
-00486 // On 32-bit platforms, "atomic.h" requires definition of __TBB_Store8 and __TBB_Load8
-00487 #ifndef __TBB_Store8
-00488 inline void __TBB_Store8 (volatile void *ptr, int64_t value) {
-00489     tbb::internal::AtomicBackoff b;
-00490     for(;;) {
-00491         int64_t result = *(int64_t *)ptr;
-00492         if( __TBB_CompareAndSwap8(ptr,value,result)==result ) break;
-00493         b.pause();
-00494     }
-00495 }
-00496 #endif
-00497 
-00498 #ifndef __TBB_Load8
-00499 inline int64_t __TBB_Load8 (const volatile void *ptr) {
-00500     int64_t result = *(int64_t *)ptr;
-00501     result = __TBB_CompareAndSwap8((volatile void *)ptr,result,result);
-00502     return result;
-00503 }
-00504 #endif
-00505 #endif /* __TBB_WORDSIZE==4 */
-00506 
-00507 #ifndef __TBB_Log2
-00508 inline intptr_t __TBB_Log2( uintptr_t x ) {
-00509     if( x==0 ) return -1;
-00510     intptr_t result = 0;
-00511     uintptr_t tmp;
-00512 #if __TBB_WORDSIZE>=8
-00513     if( (tmp = x>>32) ) { x=tmp; result += 32; }
-00514 #endif
-00515     if( (tmp = x>>16) ) { x=tmp; result += 16; }
-00516     if( (tmp = x>>8) )  { x=tmp; result += 8; }
-00517     if( (tmp = x>>4) )  { x=tmp; result += 4; }
-00518     if( (tmp = x>>2) )  { x=tmp; result += 2; }
-00519     return (x&2)? result+1: result;
-00520 }
-00521 #endif
-00522 
-00523 #ifndef __TBB_AtomicOR
-00524 inline void __TBB_AtomicOR( volatile void *operand, uintptr_t addend ) {
-00525     tbb::internal::AtomicBackoff b;
-00526     for(;;) {
-00527         uintptr_t tmp = *(volatile uintptr_t *)operand;
-00528         uintptr_t result = __TBB_CompareAndSwapW(operand, tmp|addend, tmp);
-00529         if( result==tmp ) break;
-00530         b.pause();
-00531     }
-00532 }
-00533 #endif
-00534 
-00535 #ifndef __TBB_AtomicAND
-00536 inline void __TBB_AtomicAND( volatile void *operand, uintptr_t addend ) {
-00537     tbb::internal::AtomicBackoff b;
-00538     for(;;) {
-00539         uintptr_t tmp = *(volatile uintptr_t *)operand;
-00540         uintptr_t result = __TBB_CompareAndSwapW(operand, tmp&addend, tmp);
-00541         if( result==tmp ) break;
-00542         b.pause();
-00543     }
-00544 }
-00545 #endif
-00546 
-00547 #ifndef __TBB_TryLockByte
-00548 inline bool __TBB_TryLockByte( unsigned char &flag ) {
-00549     return __TBB_CompareAndSwap1(&flag,1,0)==0;
-00550 }
-00551 #endif
-00552 
-00553 #ifndef __TBB_LockByte
-00554 inline uintptr_t __TBB_LockByte( unsigned char& flag ) {
-00555     if ( !__TBB_TryLockByte(flag) ) {
-00556         tbb::internal::AtomicBackoff b;
-00557         do {
-00558             b.pause();
-00559         } while ( !__TBB_TryLockByte(flag) );
-00560     }
-00561     return 0;
-00562 }
-00563 #endif
-00564 
-00565 #endif /* __TBB_machine_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00315.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00315.html deleted file mode 100644 index ab8ac380b0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00315.html +++ /dev/null @@ -1,125 +0,0 @@ - - -tbb_profiling.h Source File - - - - - - -

tbb_profiling.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_profiling_H
-00022 #define __TBB_profiling_H
-00023 
-00024 // Check if the tools support is enabled
-00025 #if (_WIN32||_WIN64||__linux__) && TBB_USE_THREADING_TOOLS
-00026 
-00027 #if _WIN32||_WIN64
-00028 #include <stdlib.h>  /* mbstowcs_s */
-00029 #endif
-00030 #include "tbb/tbb_stddef.h"
-00031 
-00032 namespace tbb {
-00033     namespace internal {
-00034 #if _WIN32||_WIN64
-00035         void __TBB_EXPORTED_FUNC itt_set_sync_name_v3( void *obj, const wchar_t* name ); 
-00036         inline size_t multibyte_to_widechar( wchar_t* wcs, const char* mbs, size_t bufsize) {
-00037 #if _MSC_VER>=1400
-00038             size_t len;
-00039             mbstowcs_s( &len, wcs, bufsize, mbs, _TRUNCATE );
-00040             return len;   // mbstowcs_s counts null terminator
-00041 #else
-00042             size_t len = mbstowcs( wcs, mbs, bufsize );
-00043             if(wcs && len!=size_t(-1) )
-00044                 wcs[len<bufsize-1? len: bufsize-1] = wchar_t('\0');
-00045             return len+1; // mbstowcs does not count null terminator
-00046 #endif
-00047         }
-00048 #else
-00049         void __TBB_EXPORTED_FUNC itt_set_sync_name_v3( void *obj, const char* name ); 
-00050 #endif
-00051     } // namespace internal
-00052 } // namespace tbb
-00053 
-00055 
-00057 #if _WIN32||_WIN64
-00058     #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)    \
-00059         namespace profiling {                                                       \
-00060             inline void set_name( sync_object_type& obj, const wchar_t* name ) {    \
-00061                 tbb::internal::itt_set_sync_name_v3( &obj, name );                  \
-00062             }                                                                       \
-00063             inline void set_name( sync_object_type& obj, const char* name ) {       \
-00064                 size_t len = tbb::internal::multibyte_to_widechar(NULL, name, 0);   \
-00065                 wchar_t *wname = new wchar_t[len];                                  \
-00066                 tbb::internal::multibyte_to_widechar(wname, name, len);             \
-00067                 set_name( obj, wname );                                             \
-00068                 delete[] wname;                                                     \
-00069             }                                                                       \
-00070         }
-00071 #else /* !WIN */
-00072     #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)    \
-00073         namespace profiling {                                                       \
-00074             inline void set_name( sync_object_type& obj, const char* name ) {       \
-00075                 tbb::internal::itt_set_sync_name_v3( &obj, name );                  \
-00076             }                                                                       \
-00077         }
-00078 #endif /* !WIN */
-00079 
-00080 #else /* no tools support */
-00081 
-00082 #if _WIN32||_WIN64
-00083     #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)    \
-00084         namespace profiling {                                               \
-00085             inline void set_name( sync_object_type&, const wchar_t* ) {}    \
-00086             inline void set_name( sync_object_type&, const char* ) {}       \
-00087         }
-00088 #else /* !WIN */
-00089     #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type)    \
-00090         namespace profiling {                                               \
-00091             inline void set_name( sync_object_type&, const char* ) {}       \
-00092         }
-00093 #endif /* !WIN */
-00094 
-00095 #endif /* no tools support */
-00096 
-00097 #endif /* __TBB_profiling_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00316.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00316.html deleted file mode 100644 index 3363a09897..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00316.html +++ /dev/null @@ -1,226 +0,0 @@ - - -tbb_stddef.h Source File - - - - - - -

tbb_stddef.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_tbb_stddef_H
-00022 #define __TBB_tbb_stddef_H
-00023 
-00024 // Marketing-driven product version
-00025 #define TBB_VERSION_MAJOR 2
-00026 #define TBB_VERSION_MINOR 1
-00027 
-00028 // Engineering-focused interface version
-00029 #define TBB_INTERFACE_VERSION 3016
-00030 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
-00031 
-00032 // The oldest major interface version still supported
-00033 // To be used in SONAME, manifests, etc.
-00034 #define TBB_COMPATIBLE_INTERFACE_VERSION 2
-00035 
-00036 #define __TBB_STRING_AUX(x) #x
-00037 #define __TBB_STRING(x) __TBB_STRING_AUX(x)
-00038 
-00039 // We do not need defines below for resource processing on windows
-00040 #if !defined RC_INVOKED
-00041 
-00042 // Define groups for Doxygen documentation
-00052 // Simple text that is displayed on the main page of Doxygen documentation.
-00094 // Define preprocessor symbols used to determine architecture
-00095 #if _WIN32||_WIN64
-00096 #   if defined(_M_AMD64)
-00097 #       define __TBB_x86_64 1
-00098 #   elif defined(_M_IA64)
-00099 #       define __TBB_ipf 1
-00100 #   elif defined(_M_IX86)
-00101 #       define __TBB_x86_32 1
-00102 #   endif
-00103 #else /* Assume generic Unix */
-00104 #   if !__linux__ && !__APPLE__
-00105 #       define __TBB_generic_os 1
-00106 #   endif
-00107 #   if __x86_64__
-00108 #       define __TBB_x86_64 1
-00109 #   elif __ia64__
-00110 #       define __TBB_ipf 1
-00111 #   elif __i386__||__i386  // __i386 is for Sun OS
-00112 #       define __TBB_x86_32 1
-00113 #   else
-00114 #       define __TBB_generic_arch 1
-00115 #   endif
-00116 #endif
-00117 
-00118 #if _WIN32||_WIN64
-00119 // define the parts of stdint.h that are needed, but put them inside tbb::internal
-00120 namespace tbb {
-00121 namespace internal {
-00122     typedef __int8 int8_t;
-00123     typedef __int16 int16_t;
-00124     typedef __int32 int32_t;
-00125     typedef __int64 int64_t;
-00126     typedef unsigned __int8 uint8_t;
-00127     typedef unsigned __int16 uint16_t;
-00128     typedef unsigned __int32 uint32_t;
-00129     typedef unsigned __int64 uint64_t;
-00130 } // namespace internal
-00131 } // namespace tbb
-00132 #else
-00133 #include <stdint.h>
-00134 #endif
-00135 
-00136 #if _MSC_VER >=1400
-00137 #define __TBB_EXPORTED_FUNC   __cdecl
-00138 #define __TBB_EXPORTED_METHOD __thiscall
-00139 #else
-00140 #define __TBB_EXPORTED_FUNC
-00141 #define __TBB_EXPORTED_METHOD
-00142 #endif
-00143 
-00144 #include <cstddef>      /* Need size_t and ptrdiff_t (the latter on Windows only) from here. */
-00145 
-00146 #if _WIN32||_WIN64
-00147 #define __TBB_tbb_windef_H
-00148 #include "_tbb_windef.h"
-00149 #undef __TBB_tbb_windef_H
-00150 #endif /* _WIN32||_WIN64 */
-00151 
-00152 #include "tbb_config.h"
-00153 
-00154 namespace tbb {
-00156     typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment );
-00157 }
-00158 
-00159 #if TBB_USE_ASSERT
-00160 
-00162 
-00165 #define __TBB_ASSERT(predicate,message) ((predicate)?((void)0):tbb::assertion_failure(__FILE__,__LINE__,#predicate,message))
-00166 #define __TBB_ASSERT_EX __TBB_ASSERT
-00167 
-00168 namespace tbb {
-00170     assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler );
-00171 
-00173 
-00176     void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment );
-00177 } // namespace tbb
-00178 
-00179 #else
-00180 
-00182 #define __TBB_ASSERT(predicate,comment) ((void)0)
-00184 #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate)))
-00185 
-00186 #endif /* TBB_USE_ASSERT */
-00187 
-00189 namespace tbb {
-00190 
-00192 
-00196 extern "C" int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
-00197 
-00199 
-00203 class split {
-00204 };
-00205 
-00210 namespace internal {
-00211 
-00212 using std::size_t;
-00213 
-00215 
-00217 typedef size_t uintptr;
-00218 
-00220 
-00222 typedef std::ptrdiff_t intptr;
-00223 
-00225 void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... );
-00226 
-00227 #if TBB_USE_ASSERT
-00229 template<typename T>
-00230 inline void poison_pointer( T* & p ) {
-00231     p = reinterpret_cast<T*>(-1);
-00232 }
-00233 #else
-00234 template<typename T>
-00235 inline void poison_pointer( T* ) {/*do nothing*/}
-00236 #endif /* TBB_USE_ASSERT */
-00237 
-00239 class no_assign {
-00240     // Deny assignment
-00241     void operator=( const no_assign& );
-00242 public:
-00243 #if __GNUC__
-00245     no_assign() {}
-00246 #endif /* __GNUC__ */
-00247 };
-00248 
-00250 class no_copy: no_assign {
-00252     no_copy( const no_copy& );
-00253 public:
-00255     no_copy() {}
-00256 };
-00257 
-00259 template<typename T>
-00260 struct allocator_type {
-00261     typedef T value_type;
-00262 };
-00263 
-00264 #if _WIN32||_WIN64
-00266 template<typename T>
-00267 struct allocator_type<const T> {
-00268     typedef T value_type;
-00269 };
-00270 #endif /* _WIN32||_WIN64 */
-00271 
-00272 // Struct to be used as a version tag for inline functions.
-00275 struct version_tag_v3 {};
-00276 
-00277 typedef version_tag_v3 version_tag;
-00278 
-00279 } // internal
-00281 
-00282 } // tbb
-00283 
-00284 #endif /* RC_INVOKED */
-00285 #endif /* __TBB_tbb_stddef_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00321.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00321.html deleted file mode 100644 index 18637fa957..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00321.html +++ /dev/null @@ -1,298 +0,0 @@ - - -tbb_thread.h Source File - - - - - - -

tbb_thread.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_tbb_thread_H
-00022 #define __TBB_tbb_thread_H
-00023 
-00024 #if _WIN32||_WIN64
-00025 #include <windows.h>
-00026 #define __TBB_NATIVE_THREAD_ROUTINE unsigned WINAPI
-00027 #define __TBB_NATIVE_THREAD_ROUTINE_PTR(r) unsigned (WINAPI* r)( void* )
-00028 #else
-00029 #define __TBB_NATIVE_THREAD_ROUTINE void*
-00030 #define __TBB_NATIVE_THREAD_ROUTINE_PTR(r) void* (*r)( void* )
-00031 #include <pthread.h>
-00032 #endif // _WIN32||_WIN64
-00033 
-00034 #include <iosfwd>
-00035 #include <exception>             // Need std::terminate from here.
-00036 #include "tbb_stddef.h"
-00037 #include "tick_count.h"
-00038 
-00039 namespace tbb {
-00040 
-00042 namespace internal {
-00043     
-00044     class tbb_thread_v3;
-00045 
-00046 } // namespace internal
-00047 
-00048 void swap( internal::tbb_thread_v3& t1, internal::tbb_thread_v3& t2 ); 
-00049 
-00050 namespace internal {
-00051 
-00053     void* __TBB_EXPORTED_FUNC allocate_closure_v3( size_t size );
-00055     void __TBB_EXPORTED_FUNC free_closure_v3( void* );
-00056    
-00057     struct thread_closure_base {
-00058         void* operator new( size_t size ) {return allocate_closure_v3(size);}
-00059         void operator delete( void* ptr ) {free_closure_v3(ptr);}
-00060     };
-00061 
-00062     template<class F> struct thread_closure_0: thread_closure_base {
-00063         F function;
-00064 
-00065         static __TBB_NATIVE_THREAD_ROUTINE start_routine( void* c ) {
-00066             thread_closure_0 *self = static_cast<thread_closure_0*>(c);
-00067             try {
-00068                 self->function();
-00069             } catch ( ... ) {
-00070                 std::terminate();
-00071             }
-00072             delete self;
-00073             return 0;
-00074         }
-00075         thread_closure_0( const F& f ) : function(f) {}
-00076     };
-00078     template<class F, class X> struct thread_closure_1: thread_closure_base {
-00079         F function;
-00080         X arg1;
-00082         static __TBB_NATIVE_THREAD_ROUTINE start_routine( void* c ) {
-00083             thread_closure_1 *self = static_cast<thread_closure_1*>(c);
-00084             try {
-00085                 self->function(self->arg1);
-00086             } catch ( ... ) {
-00087                 std::terminate();
-00088             }
-00089             delete self;
-00090             return 0;
-00091         }
-00092         thread_closure_1( const F& f, const X& x ) : function(f), arg1(x) {}
-00093     };
-00094     template<class F, class X, class Y> struct thread_closure_2: thread_closure_base {
-00095         F function;
-00096         X arg1;
-00097         Y arg2;
-00099         static __TBB_NATIVE_THREAD_ROUTINE start_routine( void* c ) {
-00100             thread_closure_2 *self = static_cast<thread_closure_2*>(c);
-00101             try {
-00102                 self->function(self->arg1, self->arg2);
-00103             } catch ( ... ) {
-00104                 std::terminate();
-00105             }
-00106             delete self;
-00107             return 0;
-00108         }
-00109         thread_closure_2( const F& f, const X& x, const Y& y ) : function(f), arg1(x), arg2(y) {}
-00110     };
-00111 
-00113     class tbb_thread_v3 {
-00114         tbb_thread_v3(const tbb_thread_v3&); // = delete;   // Deny access
-00115     public:
-00116 #if _WIN32||_WIN64
-00117         typedef HANDLE native_handle_type; 
-00118 #else
-00119         typedef pthread_t native_handle_type; 
-00120 #endif // _WIN32||_WIN64
-00121 
-00122         class id;
-00124         tbb_thread_v3() : my_handle(0)
-00125 #if _WIN32||_WIN64
-00126             , my_thread_id(0)
-00127 #endif // _WIN32||_WIN64
-00128         {}
-00129         
-00131         template <class F> explicit tbb_thread_v3(F f) {
-00132             typedef internal::thread_closure_0<F> closure_type;
-00133             internal_start(closure_type::start_routine, new closure_type(f));
-00134         }
-00136         template <class F, class X> tbb_thread_v3(F f, X x) {
-00137             typedef internal::thread_closure_1<F,X> closure_type;
-00138             internal_start(closure_type::start_routine, new closure_type(f,x));
-00139         }
-00141         template <class F, class X, class Y> tbb_thread_v3(F f, X x, Y y) {
-00142             typedef internal::thread_closure_2<F,X,Y> closure_type;
-00143             internal_start(closure_type::start_routine, new closure_type(f,x,y));
-00144         }
-00145 
-00146         tbb_thread_v3& operator=(tbb_thread_v3& x) {
-00147             if (joinable()) detach();
-00148             my_handle = x.my_handle;
-00149             x.my_handle = 0;
-00150 #if _WIN32||_WIN64
-00151             my_thread_id = x.my_thread_id;
-00152             x.my_thread_id = 0;
-00153 #endif // _WIN32||_WIN64
-00154             return *this;
-00155         }
-00156         bool joinable() const {return my_handle!=0; }
-00158         void __TBB_EXPORTED_METHOD join();
-00160         void __TBB_EXPORTED_METHOD detach();
-00161         ~tbb_thread_v3() {if( joinable() ) detach();}
-00162         inline id get_id() const;
-00163         native_handle_type native_handle() { return my_handle; }
-00164     
-00166         static unsigned __TBB_EXPORTED_FUNC hardware_concurrency();
-00167     private:
-00168         native_handle_type my_handle; 
-00169 #if _WIN32||_WIN64
-00170         DWORD my_thread_id;
-00171 #endif // _WIN32||_WIN64
-00172 
-00174         void __TBB_EXPORTED_METHOD internal_start( __TBB_NATIVE_THREAD_ROUTINE_PTR(start_routine), 
-00175                              void* closure );
-00176         friend void __TBB_EXPORTED_FUNC move_v3( tbb_thread_v3& t1, tbb_thread_v3& t2 );
-00177         friend void tbb::swap( tbb_thread_v3& t1, tbb_thread_v3& t2 ); 
-00178     };
-00179         
-00180     class tbb_thread_v3::id { 
-00181 #if _WIN32||_WIN64
-00182         DWORD my_id;
-00183         id( DWORD my_id ) : my_id(my_id) {}
-00184 #else
-00185         pthread_t my_id;
-00186         id( pthread_t my_id ) : my_id(my_id) {}
-00187 #endif // _WIN32||_WIN64
-00188         friend class tbb_thread_v3;
-00189     public:
-00190         id() : my_id(0) {}
-00191 
-00192         friend bool operator==( tbb_thread_v3::id x, tbb_thread_v3::id y );
-00193         friend bool operator!=( tbb_thread_v3::id x, tbb_thread_v3::id y );
-00194         friend bool operator<( tbb_thread_v3::id x, tbb_thread_v3::id y );
-00195         friend bool operator<=( tbb_thread_v3::id x, tbb_thread_v3::id y );
-00196         friend bool operator>( tbb_thread_v3::id x, tbb_thread_v3::id y );
-00197         friend bool operator>=( tbb_thread_v3::id x, tbb_thread_v3::id y );
-00198         
-00199         template<class charT, class traits>
-00200         friend std::basic_ostream<charT, traits>&
-00201         operator<< (std::basic_ostream<charT, traits> &out, 
-00202                     tbb_thread_v3::id id)
-00203         {
-00204             out << id.my_id;
-00205             return out;
-00206         }
-00207         friend tbb_thread_v3::id __TBB_EXPORTED_FUNC thread_get_id_v3();
-00208     }; // tbb_thread_v3::id
-00209 
-00210     tbb_thread_v3::id tbb_thread_v3::get_id() const {
-00211 #if _WIN32||_WIN64
-00212         return id(my_thread_id);
-00213 #else
-00214         return id(my_handle);
-00215 #endif // _WIN32||_WIN64
-00216     }
-00217     void __TBB_EXPORTED_FUNC move_v3( tbb_thread_v3& t1, tbb_thread_v3& t2 );
-00218     tbb_thread_v3::id __TBB_EXPORTED_FUNC thread_get_id_v3();
-00219     void __TBB_EXPORTED_FUNC thread_yield_v3();
-00220     void __TBB_EXPORTED_FUNC thread_sleep_v3(const tick_count::interval_t &i);
-00221 
-00222     inline bool operator==(tbb_thread_v3::id x, tbb_thread_v3::id y)
-00223     {
-00224         return x.my_id == y.my_id;
-00225     }
-00226     inline bool operator!=(tbb_thread_v3::id x, tbb_thread_v3::id y)
-00227     {
-00228         return x.my_id != y.my_id;
-00229     }
-00230     inline bool operator<(tbb_thread_v3::id x, tbb_thread_v3::id y)
-00231     {
-00232         return x.my_id < y.my_id;
-00233     }
-00234     inline bool operator<=(tbb_thread_v3::id x, tbb_thread_v3::id y)
-00235     {
-00236         return x.my_id <= y.my_id;
-00237     }
-00238     inline bool operator>(tbb_thread_v3::id x, tbb_thread_v3::id y)
-00239     {
-00240         return x.my_id > y.my_id;
-00241     }
-00242     inline bool operator>=(tbb_thread_v3::id x, tbb_thread_v3::id y)
-00243     {
-00244         return x.my_id >= y.my_id;
-00245     }
-00246 
-00247 } // namespace internal;
-00248 
-00250 typedef internal::tbb_thread_v3 tbb_thread;
-00251 
-00252 using internal::operator==;
-00253 using internal::operator!=;
-00254 using internal::operator<;
-00255 using internal::operator>;
-00256 using internal::operator<=;
-00257 using internal::operator>=;
-00258 
-00259 inline void move( tbb_thread& t1, tbb_thread& t2 ) {
-00260     internal::move_v3(t1, t2);
-00261 }
-00262 
-00263 inline void swap( internal::tbb_thread_v3& t1, internal::tbb_thread_v3& t2 ) {
-00264     tbb::tbb_thread::native_handle_type h = t1.my_handle;
-00265     t1.my_handle = t2.my_handle;
-00266     t2.my_handle = h;
-00267 #if _WIN32||_WIN64
-00268     DWORD i = t1.my_thread_id;
-00269     t1.my_thread_id = t2.my_thread_id;
-00270     t2.my_thread_id = i;
-00271 #endif /* _WIN32||_WIN64 */
-00272 }
-00273 
-00274 namespace this_tbb_thread {
-00275     inline tbb_thread::id get_id() { return internal::thread_get_id_v3(); }
-00277     inline void yield() { internal::thread_yield_v3(); }
-00279     inline void sleep(const tick_count::interval_t &i) { 
-00280         internal::thread_sleep_v3(i);  
-00281     }
-00282 }  // namespace this_tbb_thread
-00283 
-00284 } // namespace tbb
-00285 
-00286 #endif /* __TBB_tbb_thread_H */
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00329.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00329.html deleted file mode 100644 index fe01c10f28..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00329.html +++ /dev/null @@ -1,66 +0,0 @@ - - -tbbmalloc_proxy.h Source File - - - - - - -

tbbmalloc_proxy.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_tbbmalloc_proxy_H
-00022 #define __TBB_tbbmalloc_proxy_H
-00023 
-00024 #ifdef _DEBUG
-00025     #pragma comment(lib, "tbbmalloc_proxy_debug.lib")
-00026 #else
-00027     #pragma comment(lib, "tbbmalloc_proxy.lib")
-00028 #endif
-00029 
-00030 #if defined(_WIN64)
-00031     #pragma comment(linker, "/include:__TBB_malloc_proxy")
-00032 #else
-00033     #pragma comment(linker, "/include:___TBB_malloc_proxy")
-00034 #endif
-00035 
-00036 #endif //__TBB_tbbmalloc_proxy_H
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00330.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00330.html deleted file mode 100644 index 48a799edb9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/a00330.html +++ /dev/null @@ -1,164 +0,0 @@ - - -tick_count.h Source File - - - - - - -

tick_count.h

00001 /*
-00002     Copyright 2005-2009 Intel Corporation.  All Rights Reserved.
-00003 
-00004     The source code contained or described herein and all documents related
-00005     to the source code ("Material") are owned by Intel Corporation or its
-00006     suppliers or licensors.  Title to the Material remains with Intel
-00007     Corporation or its suppliers and licensors.  The Material is protected
-00008     by worldwide copyright laws and treaty provisions.  No part of the
-00009     Material may be used, copied, reproduced, modified, published, uploaded,
-00010     posted, transmitted, distributed, or disclosed in any way without
-00011     Intel's prior express written permission.
-00012 
-00013     No license under any patent, copyright, trade secret or other
-00014     intellectual property right is granted to or conferred upon you by
-00015     disclosure or delivery of the Materials, either expressly, by
-00016     implication, inducement, estoppel or otherwise.  Any license under such
-00017     intellectual property rights must be express and approved by Intel in
-00018     writing.
-00019 */
-00020 
-00021 #ifndef __TBB_tick_count_H
-00022 #define __TBB_tick_count_H
-00023 
-00024 #include "tbb_stddef.h"
-00025 
-00026 #if _WIN32||_WIN64
-00027 #include <windows.h>
-00028 #elif __linux__
-00029 #include <ctime>
-00030 #else /* generic Unix */
-00031 #include <sys/time.h>
-00032 #endif /* (choice of OS) */
-00033 
-00034 namespace tbb {
-00035 
-00037 
-00038 class tick_count {
-00039 public:
-00041     class interval_t {
-00042         long long value;
-00043         explicit interval_t( long long value_ ) : value(value_) {}
-00044     public:
-00046         interval_t() : value(0) {};
-00047 
-00049         explicit interval_t( double sec );
-00050 
-00052         double seconds() const;
-00053 
-00054         friend class tbb::tick_count;
-00055 
-00057         friend interval_t operator-( const tick_count& t1, const tick_count& t0 );
-00058 
-00060         friend interval_t operator+( const interval_t& i, const interval_t& j ) {
-00061             return interval_t(i.value+j.value);
-00062         }
-00063 
-00065         friend interval_t operator-( const interval_t& i, const interval_t& j ) {
-00066             return interval_t(i.value-j.value);
-00067         }
-00068 
-00070         interval_t& operator+=( const interval_t& i ) {value += i.value; return *this;}
-00071 
-00073         interval_t& operator-=( const interval_t& i ) {value -= i.value; return *this;}
-00074     };
-00075     
-00077     tick_count() : my_count(0) {};
-00078 
-00080     static tick_count now();
-00081     
-00083     friend interval_t operator-( const tick_count& t1, const tick_count& t0 );
-00084 
-00085 private:
-00086     long long my_count;
-00087 };
-00088 
-00089 inline tick_count tick_count::now() {
-00090     tick_count result;
-00091 #if _WIN32||_WIN64
-00092     LARGE_INTEGER qpcnt;
-00093     QueryPerformanceCounter(&qpcnt);
-00094     result.my_count = qpcnt.QuadPart;
-00095 #elif __linux__
-00096     struct timespec ts;
-00097 #if TBB_USE_ASSERT
-00098     int status = 
-00099 #endif /* TBB_USE_ASSERT */
-00100         clock_gettime( CLOCK_REALTIME, &ts );
-00101     __TBB_ASSERT( status==0, "CLOCK_REALTIME not supported" );
-00102     result.my_count = static_cast<long long>(1000000000UL)*static_cast<long long>(ts.tv_sec) + static_cast<long long>(ts.tv_nsec);
-00103 #else /* generic Unix */
-00104     struct timeval tv;
-00105 #if TBB_USE_ASSERT
-00106     int status = 
-00107 #endif /* TBB_USE_ASSERT */
-00108         gettimeofday(&tv, NULL);
-00109     __TBB_ASSERT( status==0, "gettimeofday failed" );
-00110     result.my_count = static_cast<long long>(1000000)*static_cast<long long>(tv.tv_sec) + static_cast<long long>(tv.tv_usec);
-00111 #endif /*(choice of OS) */
-00112     return result;
-00113 }
-00114 
-00115 inline tick_count::interval_t::interval_t( double sec )
-00116 {
-00117 #if _WIN32||_WIN64
-00118     LARGE_INTEGER qpfreq;
-00119     QueryPerformanceFrequency(&qpfreq);
-00120     value = static_cast<long long>(sec*qpfreq.QuadPart);
-00121 #elif __linux__
-00122     value = static_cast<long long>(sec*1E9);
-00123 #else /* generic Unix */
-00124     value = static_cast<long long>(sec*1E6);
-00125 #endif /* (choice of OS) */
-00126 }
-00127 
-00128 inline tick_count::interval_t operator-( const tick_count& t1, const tick_count& t0 ) {
-00129     return tick_count::interval_t( t1.my_count-t0.my_count );
-00130 }
-00131 
-00132 inline double tick_count::interval_t::seconds() const {
-00133 #if _WIN32||_WIN64
-00134     LARGE_INTEGER qpfreq;
-00135     QueryPerformanceFrequency(&qpfreq);
-00136     return value/(double)qpfreq.QuadPart;
-00137 #elif __linux__
-00138     return value*1E-9;
-00139 #else /* generic Unix */
-00140     return value*1E-6;
-00141 #endif /* (choice of OS) */
-00142 }
-00143 
-00144 } // namespace tbb
-00145 
-00146 #endif /* __TBB_tick_count_H */
-00147 
-

-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/annotated.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/annotated.html deleted file mode 100644 index ec9aaf226f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/annotated.html +++ /dev/null @@ -1,86 +0,0 @@ - - -Class List - - - - - - -

Class List

Here are the classes, structs, unions and interfaces with brief descriptions: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tbb::affinity_partitionerAn affinity partitioner
tbb::aligned_space< T, N >Block of space aligned sufficiently to construct an array T with N elements
tbb::atomic< T >Primary template for atomic
tbb::internal::AtomicBackoffClass that implements exponential backoff
tbb::auto_partitionerAn auto partitioner
tbb::bad_last_allocException for concurrent containers
tbb::blocked_range< Value >A range over which to iterate
tbb::blocked_range2d< RowValue, ColValue >A 2-dimensional range that models the Range concept
tbb::blocked_range3d< PageValue, RowValue, ColValue >A 3-dimensional range that models the Range concept
tbb::cache_aligned_allocator< T >Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5
tbb::cache_aligned_allocator< void >Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1
tbb::captured_exceptionThis class is used by TBB to propagate information about unhandled exceptions into the root thread
tbb::concurrent_hash_map< Key, T, HashCompare, A >Unordered map from Key to T
tbb::concurrent_hash_map< Key, T, HashCompare, A >::accessorAllows write access to elements and combines data access, locking, and garbage collection
tbb::concurrent_hash_map< Key, T, HashCompare, A >::const_accessorCombines data access, locking, and garbage collection
tbb::concurrent_queue< T, A >A high-performance thread-safe queue
tbb::concurrent_vector< T, A >Concurrent vector container
tbb::empty_taskTask that does nothing. Useful for synchronization
tbb::enumerable_thread_specific< T, Allocator, ETS_key_type >The thread local class template
tbb::filterA stage in a pipeline
tbb::final_scan_tagUsed to indicate that the final scan is being performed
tbb::movable_exception< ExceptionData >Template that can be used to implement exception that transfers arbitrary ExceptionData to the root thread
tbb::mutexWrapper around the platform's native reader-writer lock
tbb::mutex::scoped_lockThe scoped locking pattern
tbb::parallel_do_feeder< Item >Class the user supplied algorithm body uses to add new tasks
tbb::parallel_while< Body >Parallel iteration over a stream, with optional addition of more work
tbb::pipelineA processing pipeling that applies filters to items
tbb::pre_scan_tagUsed to indicate that the initial scan is being performed
tbb::queuing_mutexQueuing lock with local-only spinning
tbb::queuing_mutex::scoped_lockThe scoped locking pattern
tbb::queuing_rw_mutexReader-writer lock with local-only spinning
tbb::queuing_rw_mutex::scoped_lockThe scoped locking pattern
tbb::recursive_mutexMutex that allows recursive mutex acquisition
tbb::recursive_mutex::scoped_lockThe scoped locking pattern
tbb::scalable_allocator< T >Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5
tbb::scalable_allocator< void >Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1
tbb::simple_partitionerA simple partitioner
tbb::spin_mutexA lock that occupies a single byte
tbb::spin_mutex::scoped_lockRepresents acquisition of a mutex
tbb::spin_rw_mutex_v3Fast, unfair, spinning reader-writer lock with backoff and writer-preference
tbb::spin_rw_mutex_v3::scoped_lockThe scoped locking pattern
tbb::splitDummy type that distinguishes splitting constructor from copy constructor
tbb::taskBase class for user-defined tasks
tbb::task_group_contextUsed to form groups of tasks
tbb::task_listA list of children
tbb::task_scheduler_initClass representing reference to tbb scheduler
tbb::tbb_allocator< T >Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5
tbb::tbb_allocator< void >Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1
tbb::tbb_exceptionInterface to be implemented by all exceptions TBB recognizes and propagates across the threads
tbb::tbb_hash_compare< T >Hash_compare - default argument
tbb::tick_countAbsolute timestamp
tbb::tick_count::interval_tRelative time interval
tbb::internal::work_around_alignment_bug< Size, T >Work around for bug in GNU 3.2 and MSVC compilers
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/concepts.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/concepts.html deleted file mode 100644 index 5bc1b55410..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/concepts.html +++ /dev/null @@ -1,31 +0,0 @@ - - -TBB concepts - - - - - - -

TBB concepts

A concept is a set of requirements to a type, which are necessary and sufficient for the type to model a particular behavior or a set of behaviors. Some concepts are specific to a particular algorithm (e.g. algorithm body), while other ones are common to several algorithms (e.g. range concept).

-All TBB algorithms make use of different classes implementing various concepts. Implementation classes are supplied by the user as type arguments of template parameters and/or as objects passed as function call arguments. The library provides predefined implementations of some concepts (e.g. several kinds of ranges), while other ones must always be implemented by the user.

-TBB defines a set of minimal requirements each concept must conform to. Here is the list of different concepts hyperlinked to the corresponding requirements specifications:

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/deprecated.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/deprecated.html deleted file mode 100644 index 6299d9f8c9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/deprecated.html +++ /dev/null @@ -1,29 +0,0 @@ - - -Deprecated List - - - - - -

Deprecated List

-
Member tbb::filter::serial
-
use serial_in_order instead
-
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/doxygen.css b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/doxygen.css deleted file mode 100644 index 5d583694ed..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/doxygen.css +++ /dev/null @@ -1,358 +0,0 @@ -BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { - font-family: Geneva, Arial, Helvetica, sans-serif; -} -BODY,TD { - font-size: 90%; -} -H1 { - text-align: center; - font-size: 160%; -} -H2 { - font-size: 120%; -} -H3 { - font-size: 100%; -} -CAPTION { font-weight: bold } -DIV.qindex { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.nav { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.navtab { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} -TD.navtab { - font-size: 70%; -} -A.qindex { - text-decoration: none; - font-weight: bold; - color: #1A419D; -} -A.qindex:visited { - text-decoration: none; - font-weight: bold; - color: #1A419D -} -A.qindex:hover { - text-decoration: none; - background-color: #ddddff; -} -A.qindexHL { - text-decoration: none; - font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; -} -A.qindexHL:hover { - text-decoration: none; - background-color: #6666cc; - color: #ffffff; -} -A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} -A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} -A.codeRef:link { font-weight: normal; color: #0000FF} -A.codeRef:visited { font-weight: normal; color: #0000FF} -A:hover { text-decoration: none; background-color: #f2f2ff } -DL.el { margin-left: -1cm } -.fragment { - font-family: monospace, fixed; - font-size: 95%; -} -PRE.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - margin-top: 4px; - margin-bottom: 4px; - margin-left: 2px; - margin-right: 8px; - padding-left: 6px; - padding-right: 6px; - padding-top: 4px; - padding-bottom: 4px; -} -DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } - -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; -} -DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } -BODY { - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; -} -TD.indexkey { - background-color: #e8eef2; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TD.indexvalue { - background-color: #e8eef2; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TR.memlist { - background-color: #f0f0f0; -} -P.formulaDsp { text-align: center; } -IMG.formulaDsp { } -IMG.formulaInl { vertical-align: middle; } -SPAN.keyword { color: #008000 } -SPAN.keywordtype { color: #604020 } -SPAN.keywordflow { color: #e08000 } -SPAN.comment { color: #800000 } -SPAN.preprocessor { color: #806020 } -SPAN.stringliteral { color: #002080 } -SPAN.charliteral { color: #008080 } -.mdescLeft { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.mdescRight { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.memItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplParams { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - color: #606060; - background-color: #FAFAFA; - font-size: 80%; -} -.search { color: #003399; - font-weight: bold; -} -FORM.search { - margin-bottom: 0px; - margin-top: 0px; -} -INPUT.search { font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #e8eef2; -} -TD.tiny { font-size: 75%; -} -a { - color: #1A41A8; -} -a:visited { - color: #2A3798; -} -.dirtab { padding: 4px; - border-collapse: collapse; - border: 1px solid #84b0c7; -} -TH.dirtab { background: #e8eef2; - font-weight: bold; -} -HR { height: 1px; - border: none; - border-top: 1px solid black; -} - -/* Style for detailed member documentation */ -.memtemplate { - font-size: 80%; - color: #606060; - font-weight: normal; -} -.memnav { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} -.memitem { - padding: 4px; - background-color: #eef3f5; - border-width: 1px; - border-style: solid; - border-color: #dedeee; - -moz-border-radius: 8px 8px 8px 8px; -} -.memname { - white-space: nowrap; - font-weight: bold; -} -.memdoc{ - padding-left: 10px; -} -.memproto { - background-color: #d5e1e8; - width: 100%; - border-width: 1px; - border-style: solid; - border-color: #84b0c7; - font-weight: bold; - -moz-border-radius: 8px 8px 8px 8px; -} -.paramkey { - text-align: right; -} -.paramtype { - white-space: nowrap; -} -.paramname { - color: #602020; - font-style: italic; -} -/* End Styling for detailed member documentation */ - -/* for the tree view */ -.ftvtree { - font-family: sans-serif; - margin:0.5em; -} -.directory { font-size: 9pt; font-weight: bold; } -.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } -.directory > h3 { margin-top: 0; } -.directory p { margin: 0px; white-space: nowrap; } -.directory div { display: none; margin: 0px; } -.directory img { vertical-align: -30%; } - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/files.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/files.html deleted file mode 100644 index 3172d9d9b2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/files.html +++ /dev/null @@ -1,73 +0,0 @@ - - -File Index - - - - - - -

File List

Here is a list of all documented files with brief descriptions: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_tbb_windef.h [code]
aligned_space.h [code]
atomic.h [code]
blocked_range.h [code]
blocked_range2d.h [code]
blocked_range3d.h [code]
cache_aligned_allocator.h [code]
concurrent_hash_map.h [code]
concurrent_queue.h [code]
concurrent_vector.h [code]
enumerable_thread_specific.h [code]
mutex.h [code]
null_mutex.h [code]
null_rw_mutex.h [code]
parallel_do.h [code]
parallel_for.h [code]
parallel_invoke.h [code]
parallel_reduce.h [code]
parallel_scan.h [code]
parallel_sort.h [code]
parallel_while.h [code]
partitioner.h [code]
pipeline.h [code]
queuing_mutex.h [code]
queuing_rw_mutex.h [code]
recursive_mutex.h [code]
scalable_allocator.h [code]
spin_mutex.h [code]
spin_rw_mutex.h [code]
task.h [code]
task_scheduler_init.h [code]
task_scheduler_observer.h [code]
tbb_allocator.h [code]
tbb_config.h [code]
tbb_exception.h [code]
tbb_machine.h [code]
tbb_profiling.h [code]
tbb_stddef.h [code]
tbb_thread.h [code]
tbbmalloc_proxy.h [code]
tick_count.h [code]
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions.html deleted file mode 100644 index 241f93c018..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions.html +++ /dev/null @@ -1,277 +0,0 @@ - - -Class Members - - - - - - - -
- -
- -

-Here is a list of all documented class members with links to the class documentation for each member: -

-

- a -

-

- b -

-

- c -

-

- d -

-

- e -

-

- f -

-

- g -

-

- i -

-

- l -

-

- m -

-

- n -

-

- o -

-

- p -

-

- q -

-

- r -

-

- s -

-

- t -

-

- u -

-

- v -

-

- w -

-

- ~ -

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_enum.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_enum.html deleted file mode 100644 index 19a6d76b92..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_enum.html +++ /dev/null @@ -1,49 +0,0 @@ - - -Class Members - Enumerations - - - - - - - -  -

-

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_eval.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_eval.html deleted file mode 100644 index 9248e5e5ad..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_eval.html +++ /dev/null @@ -1,56 +0,0 @@ - - -Class Members - Enumerator - - - - - - - -  -

-

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_func.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_func.html deleted file mode 100644 index 114c6c67c8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_func.html +++ /dev/null @@ -1,246 +0,0 @@ - - -Class Members - Functions - - - - - - - -
- -
- -

-  -

-

- a -

-

- b -

-

- c -

-

- d -

-

- e -

-

- f -

-

- g -

-

- i -

-

- l -

-

- m -

-

- n -

-

- o -

-

- p -

-

- q -

-

- r -

-

- s -

-

- t -

-

- u -

-

- w -

-

- ~ -

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_rela.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_rela.html deleted file mode 100644 index 727d9c11f9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_rela.html +++ /dev/null @@ -1,48 +0,0 @@ - - -Class Members - Related Functions - - - - - - - -  -

-

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_type.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_type.html deleted file mode 100644 index 93ab28de37..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_type.html +++ /dev/null @@ -1,57 +0,0 @@ - - -Class Members - Typedefs - - - - - - - -  -

-

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_vars.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_vars.html deleted file mode 100644 index b8a13510de..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/functions_vars.html +++ /dev/null @@ -1,49 +0,0 @@ - - -Class Members - Variables - - - - - - - -  -

-

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals.html deleted file mode 100644 index b9efe11dae..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals.html +++ /dev/null @@ -1,48 +0,0 @@ - - -Class Members - - - - - - -
- -
-Here is a list of all documented file members with links to the documentation: -

-

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals_func.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals_func.html deleted file mode 100644 index b0d9b8a465..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/globals_func.html +++ /dev/null @@ -1,48 +0,0 @@ - - -Class Members - - - - - - -
- -
-  -

-

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/graph_legend.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/graph_legend.html deleted file mode 100644 index 72aae12cd3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/graph_legend.html +++ /dev/null @@ -1,87 +0,0 @@ - - -Graph Legend - - - - - -

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

-Consider the following example:

/*! Invisible class because of truncation */
-class Invisible { };
-
-/*! Truncated class, inheritance relation is hidden */
-class Truncated : public Invisible { };
-
-/* Class not documented with doxygen comments */
-class Undocumented { };
-
-/*! Class that is inherited using public inheritance */
-class PublicBase : public Truncated { };
-
-/*! A template class */
-template<class T> class Templ { };
-
-/*! Class that is inherited using protected inheritance */
-class ProtectedBase { };
-
-/*! Class that is inherited using private inheritance */
-class PrivateBase { };
-
-/*! Class that is used by the Inherited class */
-class Used { };
-
-/*! Super class that inherits a number of other classes */
-class Inherited : public PublicBase,
-                  protected ProtectedBase,
-                  private PrivateBase,
-                  public Undocumented
-                  public Templ<int>
-{
-  private:
-    Used *m_usedClass;
-};
-
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 240 this will result in the following graph:

-

-graph_legend.gif -
-

-The boxes in the above graph have the following meaning:

    -
  • -A filled black box represents the struct or class for which the graph is generated.
  • -
  • -A box with a black border denotes a documented struct or class.
  • -
  • -A box with a grey border denotes an undocumented struct or class.
  • -
  • -A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
  • -
-The arrows have the following meaning:
    -
  • -A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • -
  • -A dark green arrow is used for protected inheritance.
  • -
  • -A dark red arrow is used for private inheritance.
  • -
  • -A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • -
  • -A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
  • -
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/hierarchy.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/hierarchy.html deleted file mode 100644 index 4d8c55d13c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/hierarchy.html +++ /dev/null @@ -1,93 +0,0 @@ - - -Hierarchical Index - - - - - - -

Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/index.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/index.html deleted file mode 100644 index 7625a3255c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - -Main Page - - - - - -

Main Page

-

-Click the tabs above for information about the

    -
  • Modules (groups of functionality) implemented by the library
  • Classes provided by the library
  • Files constituting the library.
-Please note that significant part of TBB functionality is implemented in the form of template functions, descriptions of which are not accessible on the Classes tab. Use Modules or Namespace/Namespace Members tabs to find them.

-Additional pieces of information can be found here

-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/modules.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/modules.html deleted file mode 100644 index 1d7ca0c5f2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/modules.html +++ /dev/null @@ -1,33 +0,0 @@ - - -Module Index - - - - - -

Modules

Here is a list of all modules: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers.html deleted file mode 100644 index 7bd9013ca9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers.html +++ /dev/null @@ -1,58 +0,0 @@ - - -Class Members - - - - - - - -Here is a list of all documented namespace members with links to the namespaces they belong to: -

-

    -
  • __TBB_full_fence -: tbb
  • acquire -: tbb
  • assertion_failure() -: tbb
  • assertion_handler_type -: tbb
  • ets_key_usage_type -: tbb
  • memory_semantics -: tbb
  • parallel_do() -: tbb
  • parallel_for() -: tbb
  • parallel_invoke() -: tbb
  • parallel_reduce() -: tbb
  • parallel_scan() -: tbb
  • parallel_sort() -: tbb
  • release -: tbb
  • set_assertion_handler() -: tbb
  • TBB_runtime_interface_version() -: tbb
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_enum.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_enum.html deleted file mode 100644 index d37d587c40..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_enum.html +++ /dev/null @@ -1,45 +0,0 @@ - - -Class Members - - - - - - - -  -

-

    -
  • ets_key_usage_type -: tbb
  • memory_semantics -: tbb
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_eval.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_eval.html deleted file mode 100644 index 6294dc1c4a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_eval.html +++ /dev/null @@ -1,46 +0,0 @@ - - -Class Members - - - - - - - -  -

-

    -
  • __TBB_full_fence -: tbb
  • acquire -: tbb
  • release -: tbb
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_func.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_func.html deleted file mode 100644 index a87003eb12..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_func.html +++ /dev/null @@ -1,52 +0,0 @@ - - -Class Members - - - - - - - -  -

-

    -
  • assertion_failure() -: tbb
  • parallel_do() -: tbb
  • parallel_for() -: tbb
  • parallel_invoke() -: tbb
  • parallel_reduce() -: tbb
  • parallel_scan() -: tbb
  • parallel_sort() -: tbb
  • set_assertion_handler() -: tbb
  • TBB_runtime_interface_version() -: tbb
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_type.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_type.html deleted file mode 100644 index da8efdb388..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespacemembers_type.html +++ /dev/null @@ -1,44 +0,0 @@ - - -Class Members - - - - - - - -  -

-

    -
  • assertion_handler_type -: tbb
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespaces.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespaces.html deleted file mode 100644 index 56d0485496..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/namespaces.html +++ /dev/null @@ -1,33 +0,0 @@ - - -Namespace Index - - - - - - -

Namespace List

Here is a list of all documented namespaces with brief descriptions: - -
tbbThe namespace tbb contains all components of the library
-
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/pages.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/pages.html deleted file mode 100644 index c865eb3da9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/pages.html +++ /dev/null @@ -1,31 +0,0 @@ - - -Page Index - - - - - -

Related Pages

Here is a list of all related documentation pages: -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_do_body_req.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_do_body_req.html deleted file mode 100644 index c35d5c66c3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_do_body_req.html +++ /dev/null @@ -1,38 +0,0 @@ - - -Requirements on parallel_do body - - - - - - -

Requirements on parallel_do body

Class Body implementing the concept of parallel_do body must define: -
        B::operator()( 
-                cv_item_type item,
-                parallel_do_feeder<item_type>& feeder
-        ) const
-        
-        OR
-
-        B::operator()( cv_item_type& item ) const
-
Process item. May be invoked concurrently for the same this but different item.

--

 item_type( const item_type& ) 
-
Copy a work item. -
 ~item_type() 
-
Destroy a work item
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_for_body_req.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_for_body_req.html deleted file mode 100644 index aa576583fd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_for_body_req.html +++ /dev/null @@ -1,30 +0,0 @@ - - -Requirements on parallel_for body - - - - - - -

Requirements on parallel_for body

Class Body implementing the concept of parallel_for body must define: -
 Body::Body( const Body& ); 
-
Copy constructor -
 Body::~Body(); 
-
Destructor -
 void Body::operator()( Range& r ) const; 
-
Function call operator applying the body to range r.
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_body_req.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_body_req.html deleted file mode 100644 index 32e67c437f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_body_req.html +++ /dev/null @@ -1,31 +0,0 @@ - - -Requirements on parallel_reduce body - - - - - - -

Requirements on parallel_reduce body

Class Body implementing the concept of parallel_reduce body must define: -
 Body::Body( Body&, split ); 
-
Splitting constructor. Must be able to run concurrently with operator() and method join -
 Body::~Body(); 
-
Destructor -
 void Body::operator()( Range& r ); 
-
Function call operator applying body to range r and accumulating the result -
 void Body::join( Body& b ); 
-
Join results. The result in b should be merged into the result of this
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_lambda_req.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_lambda_req.html deleted file mode 100644 index d607d03930..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_reduce_lambda_req.html +++ /dev/null @@ -1,25 +0,0 @@ - - -Requirements on parallel_reduce anonymous function objects (lambda functions) - - - - - -

Requirements on parallel_reduce anonymous function objects (lambda functions)

TO BE DOCUMENTED
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_scan_body_req.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_scan_body_req.html deleted file mode 100644 index 9806d53393..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_scan_body_req.html +++ /dev/null @@ -1,32 +0,0 @@ - - -Requirements on parallel_scan body - - - - - - -

Requirements on parallel_scan body

Class Body implementing the concept of parallel_reduce body must define: -
 Body::Body( Body&, split ); 
-
Splitting constructor. Split b so that this and b can accumulate separately -
 Body::~Body(); 
-
Destructor -
 void Body::operator()( const Range& r, pre_scan_tag ); 
-
Preprocess iterations for range r -
 void Body::operator()( const Range& r, final_scan_tag ); 
-
Do final processing for iterations of range r -
 void Body::reverse_join( Body& a ); 
-
Merge preprocessing state of a into this, where a was created earlier from b by b's splitting constructor
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_sort_iter_req.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_sort_iter_req.html deleted file mode 100644 index 15b4c393c3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/parallel_sort_iter_req.html +++ /dev/null @@ -1,29 +0,0 @@ - - -Requirements on iterators for parallel_sort - - - - - - -

Requirements on iterators for parallel_sort

Requirements on value type T of RandomAccessIterator for parallel_sort: -
 void swap( T& x, T& y ) 
-
Swaps x and y -
 bool Compare::operator()( const T& x, const T& y ) 
-
True if x comes before y;
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/range_req.html b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/range_req.html deleted file mode 100644 index 5509280881..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/range_req.html +++ /dev/null @@ -1,32 +0,0 @@ - - -Requirements on range concept - - - - - - -

Requirements on range concept

Class R implementing the concept of range must define: -
 R::R( const R& ); 
-
Copy constructor -
 R::~R(); 
-
Destructor -
 bool R::is_divisible() const; 
-
True if range can be partitioned into two subranges -
 bool R::empty() const; 
-
True if range is empty -
 R::R( R& r, split ); 
-
Split range r into two subranges.
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_b.gif b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_b.gif deleted file mode 100644 index 0d623483ffdf5f9f96900108042a7ab0643fe2a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35 ncmZ?wbhEHbWMp7uXkcJy*>IeJfk6j|fqX^=1|}vKMh0sDa2W*H diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_l.gif b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_l.gif deleted file mode 100644 index 9b1e6337c9299a700401a2a78a2c6ffced475216..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 706 zcmZ?wbhEHbZT`}F1e&(Gg}Y(8=I;HA5#Z$3JI=gGB)FQ#odI(O&E^@q;x zK6mr*m3xOS-#u~t!I@i+u0DKm^U160k6t`|^WpV}&n+8{U%dD9&a>B#U%!9-@yol< zU%&tQ{rk_K|NsC0`}dE5ET99@1@a36+kb~?0UJ*yc&I3X_m z!ND^5$O7$#8OFRuDhG}!?8z?cdZK&!`PWjdR;Aj^wZ` zeK{IEYHBJ)6K8VIp1`BVt++swf6j+=L{p1*nO(VhE`pFexG@5$|>uaCcd z`0m=9m+yak{QmXN#Sc$^{$X9h9&q2jiKAI|&T)a;PPx2K9p`YIdw8HtR5k2Q$2-O2 z*;3y{MQ-RnJTgJfI&R5|O)AHxDf_00XbPvDZPy4t=hHd)nfLPvms&O`Ok(sD()5v$ z5U@&h;a=#xbxVbo2~X&Xj0Ie(f{v>vERH+qC+nTG=B8Nca=wU-O$?1&vUgV~9=!H; zx>3p9Yn%*<>t~sk+&0xfyS8RsPfYBd<~wWK%j-LmpU>O7yX^h#UCp1x-p#i7@bE;py8XI6 zmY<)m>~)W~yIWcMVoiPg{duuf<*)9qZ9l$m*Ph&W&$jlv*Vpa+{pH@n=IQ$L?0$ax ec60Ul|8o2P|NVbd{6P)#weSbE3}s?04AuZvx_~SI diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_r.gif b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tab_r.gif deleted file mode 100644 index ce9dd9f533cb5486d6941844f442b59d4a9e9175..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2585 zcmbV}`9Bkk1ILFF--w5zJc=ZZT(zjE=;2|_S)Qm~rCWz1Pc)KPl;jv%A#&v2*x}yc zmf2~Jm~&=xjJY?PqwIN}f8qQ2{r$uH{c*nJbmr{cR5??*egHrs-B=MzCF`3%e{FAW z{oL5xTHn~5TM{jaB;@|_Ue5F&Zb@p(kMyG{*;gWDg zyeL|eZf7Qd8=#bXzSiR{yzRgLSj-fJS8>lBjVHN z^o-0eS=nE6a`W;LChBs=`+QAJP~{b93>H^eRb5kCSC1zUNezun%`L5M?RDzv#%jk7 zYVRX=vATPD`+oEfum^{RM@GjuP?-r=yh0!p;Vx^T9G7~`7%5ydH%70=jyJ;;`d;hv92x3R=z{xp+Lg2!*@OK*K15-t&okoPtSED)h&$RLxdbA zseWm^C3d%-yRNi-ryk^!ek+C`n&~cd$#ZWct_cUL{l~i+Nzx^5d!n94(>bW-iL~Rl z&8r)?q|1DIo=0=judQ{FaGcfLERz8gfn3-Qt<2lksh{mzpT}DXxUuR^z=^key&q4! z+wWI45vL0k$R^(F#{qfqhUsN@WA+w-V?LPH33!Q?WFSB3)WBojE@hK41Nb?KfS+Qo zXgrzfsP$wr4Qzy*{OD>uJBjdgGM@VMml5)2f~_}lD*YyOb}Hjeobhz#4c`w(l^>KK zr?Ud;W~Z}*w;%hZ|2^p^+f06gJDJQD zeIhGADbDmm&6arh(q>EZ<7mjzg7l|z$hRL8=1>)Nv=S7CY$B}iYJ&*T_-T_OG*L1q ztZ3Lana33?y3AKnyq^YCF|4x%Rb5WU&2qcl{TFKey%QJeMxn^SdT!hZ5+0i1zeusiYVp-phBl7b5+Px-X&LhByq z0F&<;K0l2+v>qiHlXb#$jXMv$uK-dEGE9L~qtdU(XeRXmvu*K2Q&6!fD**JxYP4b4BR7FdJ$Qx9G9`J%-_X!a#LGpp3g9)VWytGCa;7`S1_e8F~!R+aSJ zOF17p2`H?2kPs8Q`_;U}+D%3p zs2-0BTqFwpUoBk`?P;iPQ(IbEA|JmMx!P&YYG|R@S=5Mnw;-?A6rEEVyV%d7{iU4a zNk`i!%F(Ykpm`}#oH;BjY->@b8vQedv;pza2FL&*6ufjd+*3Ute&>kes~TU?^KkojsTh(o~(3tk1Y6>4(yn( z#U*ID9@eg-beKo1B;HXe+}{Z%n@7m0+yxivuqk9~;!1LGQlah)xYK4>wgL}l6dsaN zIxlRlq`*`j9PG4*0hD6YV_b_2w5b#)o7J?`q#{GjvvKlD`T*dWcZx<-s(ZvLB44E# z=!|sw!?)@%y$oRNL#25WS3lzdii}TuQ3?CLnvQ1_n};2sT_;Y;#d3=+-(O% zMN$>O!3;ke(UuLR%h_&)N zs^!-@A>QR}4yB1bPp`9S19ikTbZ~O{&FF-yHK{En;mmShDUIEw03`j(DBIsM}Rjki2J#SQa3gFZTKBPDeIiLt9Z z%bL3(B@Qw%(B`wSMS~dPh$=R`(}lBoFXKy(s|*{#ru$wjsBc_O#zxNk9w+UUHmx(U zmJ8+M+ndtnZ<7|VU9Mbt61zpo9T&3%Wx&XII=#QJxjR`CZf22ac3d51Z?GD%LEe_&*t46Qf;4`bZ7p2K(Ab5>GfT^}4! zBT&HZD`^PEgWoI&{~o-ID0F?O`75sm(87x%A{(}Ch1)QlzdJ)1B-eqe5a(weg0`4lQIf1evjvbBY50DVbzO7CLf|vP z2#0(U-|jZ`H{y5N^o7%iK6H>_HEGN->U6^!)1{XpJV!!4(Ig7wzZQ*9WYF4X1rG0x z=1uA@i`rIAciubDC{;~b(|&|A@xkjRP5aRcvRU9tvIm}jDB6J eQ0-6-y)mpwdT=ayS0tBxKDA*~;EWmo diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tabs.css b/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tabs.css deleted file mode 100644 index a61552a67a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/doc/html/tabs.css +++ /dev/null @@ -1,102 +0,0 @@ -/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ - -DIV.tabs -{ - float : left; - width : 100%; - background : url("tab_b.gif") repeat-x bottom; - margin-bottom : 4px; -} - -DIV.tabs UL -{ - margin : 0px; - padding-left : 10px; - list-style : none; -} - -DIV.tabs LI, DIV.tabs FORM -{ - display : inline; - margin : 0px; - padding : 0px; -} - -DIV.tabs FORM -{ - float : right; -} - -DIV.tabs A -{ - float : left; - background : url("tab_r.gif") no-repeat right top; - border-bottom : 1px solid #84B0C7; - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - -DIV.tabs A:hover -{ - background-position: 100% -150px; -} - -DIV.tabs A:link, DIV.tabs A:visited, -DIV.tabs A:active, DIV.tabs A:hover -{ - color: #1A419D; -} - -DIV.tabs SPAN -{ - float : left; - display : block; - background : url("tab_l.gif") no-repeat left top; - padding : 5px 9px; - white-space : nowrap; -} - -DIV.tabs INPUT -{ - float : right; - display : inline; - font-size : 1em; -} - -DIV.tabs TD -{ - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - - - -/* Commented Backslash Hack hides rule from IE5-Mac \*/ -DIV.tabs SPAN {float : none;} -/* End IE5-Mac hack */ - -DIV.tabs A:hover SPAN -{ - background-position: 0% -150px; -} - -DIV.tabs LI#current A -{ - background-position: 100% -150px; - border-width : 0px; -} - -DIV.tabs LI#current SPAN -{ - background-position: 0% -150px; - padding-bottom : 6px; -} - -DIV.nav -{ - background : none; - border : none; - border-bottom : 1px solid #84B0C7; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/index.html b/deal.II/contrib/tbb/tbb21_20090313oss/include/index.html deleted file mode 100644 index c37ff34b96..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - -

Overview

-Include files for Threading Building Blocks. - -

Directories

-
-
tbb -
Include files for Threading Building Blocks. -
- -
-Up to parent directory -

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/_tbb_windef.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/_tbb_windef.h deleted file mode 100644 index ceb697dc31..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/_tbb_windef.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_tbb_windef_H -#error Do not #include this file directly. Use "#include tbb/tbb_stddef.h" instead. -#endif /* __TBB_tbb_windef_H */ - -// Check that the target Windows version has all API calls requried for TBB. -// Do not increase the version in condition beyond 0x0500 without prior discussion! -#if defined(_WIN32_WINNT) && _WIN32_WINNT<0x0400 -#error TBB is unable to run on old Windows versions; _WIN32_WINNT must be 0x0400 or greater. -#endif - -#if !defined(_MT) -#error TBB requires linkage with multithreaded C/C++ runtime library. \ - Choose multithreaded DLL runtime in project settings, or use /MD[d] compiler switch. -#elif !defined(_DLL) -#pragma message("Warning: Using TBB together with static C/C++ runtime library is not recommended. " \ - "Consider switching your project to multithreaded DLL runtime used by TBB.") -#endif - -// Workaround for the problem with MVSC headers failing to define namespace std -namespace std { - using ::size_t; using ::ptrdiff_t; -} - -#define __TBB_STRING_AUX(x) #x -#define __TBB_STRING(x) __TBB_STRING_AUX(x) - -// Default setting of TBB_USE_DEBUG -#ifdef TBB_USE_DEBUG -# if TBB_USE_DEBUG -# if !defined(_DEBUG) -# pragma message(__FILE__ "(" __TBB_STRING(__LINE__) ") : Warning: Recommend using /MDd if compiling with TBB_USE_DEBUG!=0") -# endif -# else -# if defined(_DEBUG) -# pragma message(__FILE__ "(" __TBB_STRING(__LINE__) ") : Warning: Recommend using /MD if compiling with TBB_USE_DEBUG==0") -# endif -# endif -#else -# ifdef _DEBUG -# define TBB_USE_DEBUG 1 -# endif -#endif - -#if __TBB_BUILD && !defined(__TBB_NO_IMPLICIT_LINKAGE) -#define __TBB_NO_IMPLICIT_LINKAGE 1 -#endif - -#if _MSC_VER - #if !__TBB_NO_IMPLICIT_LINKAGE - #ifdef _DEBUG - #pragma comment(lib, "tbb_debug.lib") - #else - #pragma comment(lib, "tbb.lib") - #endif - #endif -#endif diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/aligned_space.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/aligned_space.h deleted file mode 100644 index f9a08df5ad..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/aligned_space.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_aligned_space_H -#define __TBB_aligned_space_H - -#include "tbb_stddef.h" -#include "tbb_machine.h" - -namespace tbb { - -//! Block of space aligned sufficiently to construct an array T with N elements. -/** The elements are not constructed or destroyed by this class. - @ingroup memory_allocation */ -template -class aligned_space { -private: - typedef __TBB_TypeWithAlignmentAtLeastAsStrict(T) element_type; - element_type array[(sizeof(T)*N+sizeof(element_type)-1)/sizeof(element_type)]; -public: - //! Pointer to beginning of array - T* begin() {return reinterpret_cast(this);} - - //! Pointer to one past last element in array. - T* end() {return begin()+N;} -}; - -} // namespace tbb - -#endif /* __TBB_aligned_space_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/atomic.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/atomic.h deleted file mode 100644 index 3ff9050b86..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/atomic.h +++ /dev/null @@ -1,448 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_atomic_H -#define __TBB_atomic_H - -#include -#include "tbb_stddef.h" - -#if _MSC_VER -#define __TBB_LONG_LONG __int64 -#else -#define __TBB_LONG_LONG long long -#endif /* _MSC_VER */ - -#include "tbb_machine.h" - -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - // Workaround for overzealous compiler warnings - #pragma warning (push) - #pragma warning (disable: 4244 4267) -#endif - -namespace tbb { - -//! Specifies memory fencing. -enum memory_semantics { - //! For internal use only. - __TBB_full_fence, - //! Acquire fence - acquire, - //! Release fence - release -}; - -//! @cond INTERNAL -namespace internal { - -template -struct atomic_traits { // Primary template -}; - -template -struct atomic_word { // Primary template - typedef intptr word; -}; - -template // Primary template -struct atomic_base { - I my_value; -}; - -#if __GNUC__ || __SUNPRO_CC -#define __TBB_DECL_ATOMIC_FIELD(t,f,a) t f __attribute__ ((aligned(a))); -#elif defined(__INTEL_COMPILER)||_MSC_VER >= 1300 -#define __TBB_DECL_ATOMIC_FIELD(t,f,a) __declspec(align(a)) t f; -#else -#error Do not know syntax for forcing alignment. -#endif /* __GNUC__ */ - -template<> -struct atomic_word<8> { // Specialization - typedef int64_t word; -}; - -#if _WIN32 && __TBB_x86_64 -// ATTENTION: On 64-bit Windows, we currently have to specialize atomic_word -// for every size to avoid type conversion warnings -// See declarations of atomic primitives in machine/windows_em64t.h -template<> -struct atomic_word<1> { // Specialization - typedef int8_t word; -}; -template<> -struct atomic_word<2> { // Specialization - typedef int16_t word; -}; -template<> -struct atomic_word<4> { // Specialization - typedef int32_t word; -}; -#endif - -template<> -struct atomic_base { // Specialization - __TBB_DECL_ATOMIC_FIELD(uint64_t,my_value,8) -}; - -template<> -struct atomic_base { // Specialization - __TBB_DECL_ATOMIC_FIELD(int64_t,my_value,8) -}; - -#define __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(S,M) \ - template<> struct atomic_traits { \ - typedef atomic_word::word word; \ - inline static word compare_and_swap( volatile void* location, word new_value, word comparand ) {\ - return __TBB_CompareAndSwap##S##M(location,new_value,comparand); \ - } \ - inline static word fetch_and_add( volatile void* location, word addend ) { \ - return __TBB_FetchAndAdd##S##M(location,addend); \ - } \ - inline static word fetch_and_store( volatile void* location, word value ) {\ - return __TBB_FetchAndStore##S##M(location,value); \ - } \ - }; - -#define __TBB_DECL_ATOMIC_PRIMITIVES(S) \ - template \ - struct atomic_traits { \ - typedef atomic_word::word word; \ - inline static word compare_and_swap( volatile void* location, word new_value, word comparand ) {\ - return __TBB_CompareAndSwap##S(location,new_value,comparand); \ - } \ - inline static word fetch_and_add( volatile void* location, word addend ) { \ - return __TBB_FetchAndAdd##S(location,addend); \ - } \ - inline static word fetch_and_store( volatile void* location, word value ) {\ - return __TBB_FetchAndStore##S(location,value); \ - } \ - }; - -#if __TBB_DECL_FENCED_ATOMICS -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,__TBB_full_fence) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,__TBB_full_fence) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,__TBB_full_fence) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,__TBB_full_fence) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,acquire) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,acquire) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,acquire) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,acquire) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,release) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,release) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,release) -__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,release) -#else -__TBB_DECL_ATOMIC_PRIMITIVES(1) -__TBB_DECL_ATOMIC_PRIMITIVES(2) -__TBB_DECL_ATOMIC_PRIMITIVES(4) -__TBB_DECL_ATOMIC_PRIMITIVES(8) -#endif - -//! Additive inverse of 1 for type T. -/** Various compilers issue various warnings if -1 is used with various integer types. - The baroque expression below avoids all the warnings (we hope). */ -#define __TBB_MINUS_ONE(T) (T(T(0)-T(1))) - -//! Base class that provides basic functionality for atomic. -/** I is the underlying type. - D is the difference type. - StepType should be char if I is an integral type, and T if I is a T*. */ -template -struct atomic_impl: private atomic_base { -private: - typedef typename atomic_word::word word; -public: - typedef I value_type; - - template - value_type fetch_and_add( D addend ) { - return value_type(internal::atomic_traits::fetch_and_add( &this->my_value, addend*sizeof(StepType) )); - } - - value_type fetch_and_add( D addend ) { - return fetch_and_add<__TBB_full_fence>(addend); - } - - template - value_type fetch_and_increment() { - return fetch_and_add(1); - } - - value_type fetch_and_increment() { - return fetch_and_add(1); - } - - template - value_type fetch_and_decrement() { - return fetch_and_add(__TBB_MINUS_ONE(D)); - } - - value_type fetch_and_decrement() { - return fetch_and_add(__TBB_MINUS_ONE(D)); - } - - template - value_type fetch_and_store( value_type value ) { - return value_type(internal::atomic_traits::fetch_and_store(&this->my_value,word(value))); - } - - value_type fetch_and_store( value_type value ) { - return fetch_and_store<__TBB_full_fence>(value); - } - - template - value_type compare_and_swap( value_type value, value_type comparand ) { - return value_type(internal::atomic_traits::compare_and_swap(&this->my_value,word(value),word(comparand))); - } - - value_type compare_and_swap( value_type value, value_type comparand ) { - return compare_and_swap<__TBB_full_fence>(value,comparand); - } - - operator value_type() const volatile { // volatile qualifier here for backwards compatibility - return __TBB_load_with_acquire( this->my_value ); - } - -protected: - value_type store_with_release( value_type rhs ) { - __TBB_store_with_release(this->my_value,rhs); - return rhs; - } - -public: - value_type operator+=( D addend ) { - return fetch_and_add(addend)+addend; - } - - value_type operator-=( D addend ) { - // Additive inverse of addend computed using binary minus, - // instead of unary minus, for sake of avoiding compiler warnings. - return operator+=(D(0)-addend); - } - - value_type operator++() { - return fetch_and_add(1)+1; - } - - value_type operator--() { - return fetch_and_add(__TBB_MINUS_ONE(D))-1; - } - - value_type operator++(int) { - return fetch_and_add(1); - } - - value_type operator--(int) { - return fetch_and_add(__TBB_MINUS_ONE(D)); - } -}; - -#if __TBB_WORDSIZE == 4 -// Plaforms with 32-bit hardware require special effort for 64-bit loads and stores. -#if defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 - -template<> -inline atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::operator atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::value_type() const volatile { - return __TBB_Load8(&this->my_value); -} - -template<> -inline atomic_impl::operator atomic_impl::value_type() const volatile { - return __TBB_Load8(&this->my_value); -} - -template<> -inline atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::value_type atomic_impl<__TBB_LONG_LONG,__TBB_LONG_LONG,char>::store_with_release( value_type rhs ) { - __TBB_Store8(&this->my_value,rhs); - return rhs; -} - -template<> -inline atomic_impl::value_type atomic_impl::store_with_release( value_type rhs ) { - __TBB_Store8(&this->my_value,rhs); - return rhs; -} - -#endif /* defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 */ -#endif /* __TBB_WORDSIZE==4 */ - -} /* Internal */ -//! @endcond - -//! Primary template for atomic. -/** See the Reference for details. - @ingroup synchronization */ -template -struct atomic { -}; - -#define __TBB_DECL_ATOMIC(T) \ - template<> struct atomic: internal::atomic_impl { \ - T operator=( T rhs ) {return store_with_release(rhs);} \ - atomic& operator=( const atomic& rhs ) {store_with_release(rhs); return *this;} \ - }; - -#if defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 -__TBB_DECL_ATOMIC(__TBB_LONG_LONG) -__TBB_DECL_ATOMIC(unsigned __TBB_LONG_LONG) -#else -// Some old versions of MVSC cannot correctly compile templates with "long long". -#endif /* defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 */ - -__TBB_DECL_ATOMIC(long) -__TBB_DECL_ATOMIC(unsigned long) - -#if defined(_MSC_VER) && __TBB_WORDSIZE==4 -/* Special version of __TBB_DECL_ATOMIC that avoids gratuitous warnings from cl /Wp64 option. - It is identical to __TBB_DECL_ATOMIC(unsigned) except that it replaces operator=(T) - with an operator=(U) that explicitly converts the U to a T. Types T and U should be - type synonyms on the platform. Type U should be the wider variant of T from the - perspective of /Wp64. */ -#define __TBB_DECL_ATOMIC_ALT(T,U) \ - template<> struct atomic: internal::atomic_impl { \ - T operator=( U rhs ) {return store_with_release(T(rhs));} \ - atomic& operator=( const atomic& rhs ) {store_with_release(rhs); return *this;} \ - }; -__TBB_DECL_ATOMIC_ALT(unsigned,size_t) -__TBB_DECL_ATOMIC_ALT(int,ptrdiff_t) -#else -__TBB_DECL_ATOMIC(unsigned) -__TBB_DECL_ATOMIC(int) -#endif /* defined(_MSC_VER) && __TBB_WORDSIZE==4 */ - -__TBB_DECL_ATOMIC(unsigned short) -__TBB_DECL_ATOMIC(short) -__TBB_DECL_ATOMIC(char) -__TBB_DECL_ATOMIC(signed char) -__TBB_DECL_ATOMIC(unsigned char) - -#if !defined(_MSC_VER)||defined(_NATIVE_WCHAR_T_DEFINED) -__TBB_DECL_ATOMIC(wchar_t) -#endif /* _MSC_VER||!defined(_NATIVE_WCHAR_T_DEFINED) */ - -template struct atomic: internal::atomic_impl { - T* operator=( T* rhs ) { - // "this" required here in strict ISO C++ because store_with_release is a dependent name - return this->store_with_release(rhs); - } - atomic& operator=( const atomic& rhs ) {this->store_with_release(rhs); return *this;} - T* operator->() const { - return (*this); - } -}; - -template<> -struct atomic { -private: - void* my_value; - -public: - typedef void* value_type; - - template - value_type compare_and_swap( value_type value, value_type comparand ) { - return value_type(internal::atomic_traits::compare_and_swap(&my_value,internal::intptr(value),internal::intptr(comparand))); - } - - value_type compare_and_swap( value_type value, value_type comparand ) { - return compare_and_swap<__TBB_full_fence>(value,comparand); - } - - template - value_type fetch_and_store( value_type value ) { - return value_type(internal::atomic_traits::fetch_and_store(&my_value,internal::intptr(value))); - } - - value_type fetch_and_store( value_type value ) { - return fetch_and_store<__TBB_full_fence>(value); - } - - operator value_type() const { - return __TBB_load_with_acquire(my_value); - } - - value_type operator=( value_type rhs ) { - __TBB_store_with_release(my_value,rhs); - return rhs; - } - - atomic& operator=( const atomic& rhs ) { - __TBB_store_with_release(my_value,rhs); - return *this; - } -}; - -template<> -struct atomic { -private: - bool my_value; - typedef internal::atomic_word::word word; -public: - typedef bool value_type; - template - value_type compare_and_swap( value_type value, value_type comparand ) { - return internal::atomic_traits::compare_and_swap(&my_value,word(value),word(comparand))!=0; - } - - value_type compare_and_swap( value_type value, value_type comparand ) { - return compare_and_swap<__TBB_full_fence>(value,comparand); - } - - template - value_type fetch_and_store( value_type value ) { - return internal::atomic_traits::fetch_and_store(&my_value,word(value))!=0; - } - - value_type fetch_and_store( value_type value ) { - return fetch_and_store<__TBB_full_fence>(value); - } - - operator value_type() const { - return __TBB_load_with_acquire(my_value); - } - - value_type operator=( value_type rhs ) { - __TBB_store_with_release(my_value,rhs); - return rhs; - } - - atomic& operator=( const atomic& rhs ) { - __TBB_store_with_release(my_value,rhs); - return *this; - } -}; - -} // namespace tbb - -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif // warnings 4244, 4267 are back - -#endif /* __TBB_atomic_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range.h deleted file mode 100644 index fd20aa0c48..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_blocked_range_H -#define __TBB_blocked_range_H - -#include "tbb_stddef.h" - -namespace tbb { - -/** \page range_req Requirements on range concept - Class \c R implementing the concept of range must define: - - \code R::R( const R& ); \endcode Copy constructor - - \code R::~R(); \endcode Destructor - - \code bool R::is_divisible() const; \endcode True if range can be partitioned into two subranges - - \code bool R::empty() const; \endcode True if range is empty - - \code R::R( R& r, split ); \endcode Split range \c r into two subranges. -**/ - -//! A range over which to iterate. -/** @ingroup algorithms */ -template -class blocked_range { -public: - //! Type of a value - /** Called a const_iterator for sake of algorithms that need to treat a blocked_range - as an STL container. */ - typedef Value const_iterator; - - //! Type for size of a range - typedef std::size_t size_type; - - //! Construct range with default-constructed values for begin and end. - /** Requires that Value have a default constructor. */ - blocked_range() : my_begin(), my_end() {} - - //! Construct range over half-open interval [begin,end), with the given grainsize. - blocked_range( Value begin_, Value end_, size_type grainsize_=1 ) : - my_end(end_), my_begin(begin_), my_grainsize(grainsize_) - { - __TBB_ASSERT( my_grainsize>0, "grainsize must be positive" ); - } - - //! Beginning of range. - const_iterator begin() const {return my_begin;} - - //! One past last value in range. - const_iterator end() const {return my_end;} - - //! Size of the range - /** Unspecified if end() - friend class blocked_range2d; - - template - friend class blocked_range3d; -}; - -} // namespace tbb - -#endif /* __TBB_blocked_range_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range2d.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range2d.h deleted file mode 100644 index d0e48b9369..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range2d.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_blocked_range2d_H -#define __TBB_blocked_range2d_H - -#include "tbb_stddef.h" -#include "blocked_range.h" - -namespace tbb { - -//! A 2-dimensional range that models the Range concept. -/** @ingroup algorithms */ -template -class blocked_range2d { -public: - //! Type for size of an iteation range - typedef blocked_range row_range_type; - typedef blocked_range col_range_type; - -private: - row_range_type my_rows; - col_range_type my_cols; - -public: - - blocked_range2d( RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize, - ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize ) : - my_rows(row_begin,row_end,row_grainsize), - my_cols(col_begin,col_end,col_grainsize) - { - } - - blocked_range2d( RowValue row_begin, RowValue row_end, - ColValue col_begin, ColValue col_end ) : - my_rows(row_begin,row_end), - my_cols(col_begin,col_end) - { - } - - //! True if range is empty - bool empty() const { - // Yes, it is a logical OR here, not AND. - return my_rows.empty() || my_cols.empty(); - } - - //! True if range is divisible into two pieces. - bool is_divisible() const { - return my_rows.is_divisible() || my_cols.is_divisible(); - } - - blocked_range2d( blocked_range2d& r, split ) : - my_rows(r.my_rows), - my_cols(r.my_cols) - { - if( my_rows.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_rows.grainsize()) ) { - my_cols.my_begin = col_range_type::do_split(r.my_cols); - } else { - my_rows.my_begin = row_range_type::do_split(r.my_rows); - } - } - - //! The rows of the iteration space - const row_range_type& rows() const {return my_rows;} - - //! The columns of the iteration space - const col_range_type& cols() const {return my_cols;} -}; - -} // namespace tbb - -#endif /* __TBB_blocked_range2d_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range3d.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range3d.h deleted file mode 100644 index 6b6742f553..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/blocked_range3d.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_blocked_range3d_H -#define __TBB_blocked_range3d_H - -#include "tbb_stddef.h" -#include "blocked_range.h" - -namespace tbb { - -//! A 3-dimensional range that models the Range concept. -/** @ingroup algorithms */ -template -class blocked_range3d { -public: - //! Type for size of an iteation range - typedef blocked_range page_range_type; - typedef blocked_range row_range_type; - typedef blocked_range col_range_type; - -private: - page_range_type my_pages; - row_range_type my_rows; - col_range_type my_cols; - -public: - - blocked_range3d( PageValue page_begin, PageValue page_end, - RowValue row_begin, RowValue row_end, - ColValue col_begin, ColValue col_end ) : - my_pages(page_begin,page_end), - my_rows(row_begin,row_end), - my_cols(col_begin,col_end) - { - } - - blocked_range3d( PageValue page_begin, PageValue page_end, typename page_range_type::size_type page_grainsize, - RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize, - ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize ) : - my_pages(page_begin,page_end,page_grainsize), - my_rows(row_begin,row_end,row_grainsize), - my_cols(col_begin,col_end,col_grainsize) - { - } - - //! True if range is empty - bool empty() const { - // Yes, it is a logical OR here, not AND. - return my_pages.empty() || my_rows.empty() || my_cols.empty(); - } - - //! True if range is divisible into two pieces. - bool is_divisible() const { - return my_pages.is_divisible() || my_rows.is_divisible() || my_cols.is_divisible(); - } - - blocked_range3d( blocked_range3d& r, split ) : - my_pages(r.my_pages), - my_rows(r.my_rows), - my_cols(r.my_cols) - { - if( my_pages.size()*double(my_rows.grainsize()) < my_rows.size()*double(my_pages.grainsize()) ) { - if ( my_rows.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_rows.grainsize()) ) { - my_cols.my_begin = col_range_type::do_split(r.my_cols); - } else { - my_rows.my_begin = row_range_type::do_split(r.my_rows); - } - } else { - if ( my_pages.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_pages.grainsize()) ) { - my_cols.my_begin = col_range_type::do_split(r.my_cols); - } else { - my_pages.my_begin = page_range_type::do_split(r.my_pages); - } - } - } - - //! The pages of the iteration space - const page_range_type& pages() const {return my_pages;} - - //! The rows of the iteration space - const row_range_type& rows() const {return my_rows;} - - //! The columns of the iteration space - const col_range_type& cols() const {return my_cols;} - -}; - -} // namespace tbb - -#endif /* __TBB_blocked_range3d_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/cache_aligned_allocator.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/cache_aligned_allocator.h deleted file mode 100644 index 1a7671e39b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/cache_aligned_allocator.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_cache_aligned_allocator_H -#define __TBB_cache_aligned_allocator_H - -#include -#include "tbb_stddef.h" - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - //! Compile-time constant that is upper bound on cache line/sector size. - /** It should be used only in situations where having a compile-time upper - bound is more useful than a run-time exact answer. - @ingroup memory_allocation */ - const size_t NFS_MaxLineSize = 128; - - //! Cache/sector line size. - /** @ingroup memory_allocation */ - size_t __TBB_EXPORTED_FUNC NFS_GetLineSize(); - - //! Allocate memory on cache/sector line boundary. - /** @ingroup memory_allocation */ - void* __TBB_EXPORTED_FUNC NFS_Allocate( size_t n_element, size_t element_size, void* hint ); - - //! Free memory allocated by NFS_Allocate. - /** Freeing a NULL pointer is allowed, but has no effect. - @ingroup memory_allocation */ - void __TBB_EXPORTED_FUNC NFS_Free( void* ); -} -//! @endcond - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Workaround for erroneous "unreferenced parameter" warning in method destroy. - #pragma warning (push) - #pragma warning (disable: 4100) -#endif - -//! Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5 -/** The members are ordered the same way they are in section 20.4.1 - of the ISO C++ standard. - @ingroup memory_allocation */ -template -class cache_aligned_allocator { -public: - typedef typename internal::allocator_type::value_type value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - template struct rebind { - typedef cache_aligned_allocator other; - }; - - cache_aligned_allocator() throw() {} - cache_aligned_allocator( const cache_aligned_allocator& ) throw() {} - template cache_aligned_allocator(const cache_aligned_allocator&) throw() {} - - pointer address(reference x) const {return &x;} - const_pointer address(const_reference x) const {return &x;} - - //! Allocate space for n objects, starting on a cache/sector line. - pointer allocate( size_type n, const void* hint=0 ) { - // The "hint" argument is always ignored in NFS_Allocate thus const_cast shouldn't hurt - return pointer(internal::NFS_Allocate( n, sizeof(value_type), const_cast(hint) )); - } - - //! Free block of memory that starts on a cache line - void deallocate( pointer p, size_type ) { - internal::NFS_Free(p); - } - - //! Largest value for which method allocate might succeed. - size_type max_size() const throw() { - return (~size_t(0)-internal::NFS_MaxLineSize)/sizeof(value_type); - } - - //! Copy-construct value at location pointed to by p. - void construct( pointer p, const value_type& value ) {new(static_cast(p)) value_type(value);} - - //! Destroy value at location pointed to by p. - void destroy( pointer p ) {p->~value_type();} -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif // warning 4100 is back - -//! Analogous to std::allocator, as defined in ISO C++ Standard, Section 20.4.1 -/** @ingroup memory_allocation */ -template<> -class cache_aligned_allocator { -public: - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - template struct rebind { - typedef cache_aligned_allocator other; - }; -}; - -template -inline bool operator==( const cache_aligned_allocator&, const cache_aligned_allocator& ) {return true;} - -template -inline bool operator!=( const cache_aligned_allocator&, const cache_aligned_allocator& ) {return false;} - -} // namespace tbb - -#endif /* __TBB_cache_aligned_allocator_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_hash_map.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_hash_map.h deleted file mode 100644 index 64945d0c9b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_hash_map.h +++ /dev/null @@ -1,1028 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_concurrent_hash_map_H -#define __TBB_concurrent_hash_map_H - -#include -#include -#include // Need std::pair -#include // Need std::memset -#include -#include "tbb_stddef.h" -#include "cache_aligned_allocator.h" -#include "tbb_allocator.h" -#include "spin_rw_mutex.h" -#include "atomic.h" -#if TBB_USE_PERFORMANCE_WARNINGS -#include -#endif - -namespace tbb { - -template struct tbb_hash_compare; -template, typename A = tbb_allocator > > -class concurrent_hash_map; - -//! @cond INTERNAL -namespace internal { - //! Type of a hash code. - typedef size_t hashcode_t; - //! base class of concurrent_hash_map - class hash_map_base { - public: - // Mutex types for each layer of the container - typedef spin_rw_mutex node_mutex_t; - typedef spin_rw_mutex chain_mutex_t; - typedef spin_rw_mutex segment_mutex_t; - - //! Type of a hash code. - typedef internal::hashcode_t hashcode_t; - //! Log2 of n_segment - static const size_t n_segment_bits = 6; - //! Number of segments - static const size_t n_segment = size_t(1)< - class hash_map_range; - - struct hash_map_segment_base { - //! Mutex that protects this segment - hash_map_base::segment_mutex_t my_mutex; - - // Number of nodes - atomic my_logical_size; - - // Size of chains - /** Always zero or a power of two */ - size_t my_physical_size; - - //! True if my_logical_size>=my_physical_size. - /** Used to support Intel(R) Thread Checker. */ - bool __TBB_EXPORTED_METHOD internal_grow_predicate() const; - }; - - //! Meets requirements of a forward iterator for STL */ - /** Value is either the T or const T type of the container. - @ingroup containers */ - template - class hash_map_iterator - : public std::iterator - { - typedef typename Container::node node; - typedef typename Container::chain chain; - typedef typename Container::segment segment; - - //! concurrent_hash_map over which we are iterating. - Container* my_table; - - //! Pointer to node that has current item - node* my_node; - - //! Index into hash table's array for current item - size_t my_array_index; - - //! Index of segment that has array for current item - size_t my_segment_index; - - template - friend bool operator==( const hash_map_iterator& i, const hash_map_iterator& j ); - - template - friend bool operator!=( const hash_map_iterator& i, const hash_map_iterator& j ); - - template - friend ptrdiff_t operator-( const hash_map_iterator& i, const hash_map_iterator& j ); - - template - friend class internal::hash_map_iterator; - - template - friend class internal::hash_map_range; - - void advance_to_next_node() { - size_t i = my_array_index+1; - do { - segment &s = my_table->my_segment[my_segment_index]; - while( in_segment ); - done: - my_array_index = i; - } -#if !defined(_MSC_VER) || defined(__INTEL_COMPILER) - template - friend class tbb::concurrent_hash_map; -#else - public: // workaround -#endif - hash_map_iterator( const Container& table, size_t segment_index, size_t array_index=0, node* b=NULL ); - public: - //! Construct undefined iterator - hash_map_iterator() {} - hash_map_iterator( const hash_map_iterator& other ) : - my_table(other.my_table), - my_node(other.my_node), - my_array_index(other.my_array_index), - my_segment_index(other.my_segment_index) - {} - Value& operator*() const { - __TBB_ASSERT( my_node, "iterator uninitialized or at end of container?" ); - return my_node->item; - } - Value* operator->() const {return &operator*();} - hash_map_iterator& operator++(); - - //! Post increment - Value* operator++(int) { - Value* result = &operator*(); - operator++(); - return result; - } - }; - - template - hash_map_iterator::hash_map_iterator( const Container& table, size_t segment_index, size_t array_index, node* b ) : - my_table(const_cast(&table)), - my_node(b), - my_array_index(array_index), - my_segment_index(segment_index) - { - if( segment_indexn_segment ) { - if( !my_node ) { - segment &s = my_table->my_segment[segment_index]; - chain* first_chain = s.my_array; - if( first_chain && my_array_index < s.my_physical_size) - my_node = first_chain[my_array_index].node_list; - } - if( !my_node ) advance_to_next_node(); - } - } - - template - hash_map_iterator& hash_map_iterator::operator++() { - my_node=my_node->next; - if( !my_node ) advance_to_next_node(); - return *this; - } - - template - bool operator==( const hash_map_iterator& i, const hash_map_iterator& j ) { - return i.my_node==j.my_node; - } - - template - bool operator!=( const hash_map_iterator& i, const hash_map_iterator& j ) { - return i.my_node!=j.my_node; - } - - //! Range class used with concurrent_hash_map - /** @ingroup containers */ - template - class hash_map_range { - private: - Iterator my_begin; - Iterator my_end; - mutable Iterator my_midpoint; - size_t my_grainsize; - //! Set my_midpoint to point approximately half way between my_begin and my_end. - void set_midpoint() const; - template friend class hash_map_range; - public: - //! Type for size of a range - typedef std::size_t size_type; - typedef typename Iterator::value_type value_type; - typedef typename Iterator::reference reference; - typedef typename Iterator::difference_type difference_type; - typedef Iterator iterator; - - //! True if range is empty. - bool empty() const {return my_begin==my_end;} - - //! True if range can be partitioned into two subranges. - bool is_divisible() const { - return my_midpoint!=my_end; - } - //! Split range. - hash_map_range( hash_map_range& r, split ) : - my_end(r.my_end), - my_grainsize(r.my_grainsize) - { - r.my_end = my_begin = r.my_midpoint; - __TBB_ASSERT( my_begin!=my_end, "Splitting despite the range is not divisible" ); - __TBB_ASSERT( r.my_begin!=r.my_end, "Splitting despite the range is not divisible" ); - set_midpoint(); - r.set_midpoint(); - } - //! type conversion - template - hash_map_range( hash_map_range& r) : - my_begin(r.my_begin), - my_end(r.my_end), - my_midpoint(r.my_midpoint), - my_grainsize(r.my_grainsize) - {} - //! Init range with iterators and grainsize specified - hash_map_range( const Iterator& begin_, const Iterator& end_, size_type grainsize = 1 ) : - my_begin(begin_), - my_end(end_), - my_grainsize(grainsize) - { - set_midpoint(); - __TBB_ASSERT( grainsize>0, "grainsize must be positive" ); - } - const Iterator& begin() const {return my_begin;} - const Iterator& end() const {return my_end;} - //! The grain size for this range. - size_type grainsize() const {return my_grainsize;} - }; - - template - void hash_map_range::set_midpoint() const { - size_t n = my_end.my_segment_index - my_begin.my_segment_index; - if( n > 1 || (n == 1 && my_end.my_array_index > my_grainsize/2) ) { - // Split by groups of segments - my_midpoint = Iterator(*my_begin.my_table,(my_end.my_segment_index+my_begin.my_segment_index+1)/2u); - } else { - // Split by groups of nodes - size_t m = my_end.my_array_index-my_begin.my_array_index; - if( n ) m += my_begin.my_table->my_segment[my_begin.my_segment_index].my_physical_size; - if( m > my_grainsize ) { - my_midpoint = Iterator(*my_begin.my_table,my_begin.my_segment_index,my_begin.my_array_index + m/2u); - } else { - my_midpoint = my_end; - } - } - __TBB_ASSERT( my_begin.my_segment_index < my_midpoint.my_segment_index - || (my_begin.my_segment_index == my_midpoint.my_segment_index - && my_begin.my_array_index <= my_midpoint.my_array_index), - "my_begin is after my_midpoint" ); - __TBB_ASSERT( my_midpoint.my_segment_index < my_end.my_segment_index - || (my_midpoint.my_segment_index == my_end.my_segment_index - && my_midpoint.my_array_index <= my_end.my_array_index), - "my_midpoint is after my_end" ); - __TBB_ASSERT( my_begin != my_midpoint || my_begin == my_end, - "[my_begin, my_midpoint) range should not be empty" ); - } - //! Hash multiplier - static const hashcode_t hash_multiplier = sizeof(hashcode_t)==4? 2654435769U : 11400714819323198485ULL; - //! Hasher functions - template - inline static hashcode_t hasher( const T& t ) { - return static_cast( t ) * hash_multiplier; - } - template - inline static hashcode_t hasher( P* ptr ) { - hashcode_t const h = reinterpret_cast( ptr ); - return (h >> 3) ^ h; - } - template - inline static hashcode_t hasher( const std::basic_string& s ) { - hashcode_t h = 0; - for( const E* c = s.c_str(); *c; c++ ) - h = static_cast(*c) ^ (h * hash_multiplier); - return h; - } - template - inline static hashcode_t hasher( const std::pair& p ) { - return hasher(p.first) ^ hasher(p.second); - } -} // namespace internal -//! @endcond - -//! hash_compare - default argument -template -struct tbb_hash_compare { - static internal::hashcode_t hash( const T& t ) { return internal::hasher(t); } - static bool equal( const T& a, const T& b ) { return a == b; } -}; - -//! Unordered map from Key to T. -/** concurrent_hash_map is associative container with concurrent access. - -@par Compatibility - The class meets all Container Requirements from C++ Standard (See ISO/IEC 14882:2003(E), clause 23.1). - -@par Exception Safety - - Hash function is not permitted to throw an exception. User-defined types Key and T are forbidden from throwing an exception in destructors. - - If exception happens during insert() operations, it has no effect (unless exception raised by HashCompare::hash() function during grow_segment). - - If exception happens during operator=() operation, the container can have a part of source items, and methods size() and empty() can return wrong results. - -@par Changes since TBB 2.0 - - Fixed exception-safety - - Added template argument for allocator - - Added allocator argument in constructors - - Added constructor from a range of iterators - - Added several new overloaded insert() methods - - Added get_allocator() - - Added swap() - - Added count() - - Added overloaded erase(accessor &) and erase(const_accessor&) - - Added equal_range() [const] - - Added [const_]pointer, [const_]reference, and allocator_type types - - Added global functions: operator==(), operator!=(), and swap() - - @ingroup containers */ -template -class concurrent_hash_map : protected internal::hash_map_base { - template - friend class internal::hash_map_iterator; - - template - friend class internal::hash_map_range; - - struct node; - friend struct node; - typedef typename A::template rebind::other node_allocator_type; - -public: - class const_accessor; - friend class const_accessor; - class accessor; - - typedef Key key_type; - typedef T mapped_type; - typedef std::pair value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef value_type *pointer; - typedef const value_type *const_pointer; - typedef value_type &reference; - typedef const value_type &const_reference; - typedef internal::hash_map_iterator iterator; - typedef internal::hash_map_iterator const_iterator; - typedef internal::hash_map_range range_type; - typedef internal::hash_map_range const_range_type; - typedef A allocator_type; - - //! Combines data access, locking, and garbage collection. - class const_accessor { - friend class concurrent_hash_map; - friend class accessor; - void operator=( const accessor& ) const; // Deny access - const_accessor( const accessor& ); // Deny access - public: - //! Type of value - typedef const std::pair value_type; - - //! True if result is empty. - bool empty() const {return !my_node;} - - //! Set to null - void release() { - if( my_node ) { - my_lock.release(); - my_node = NULL; - } - } - - //! Return reference to associated value in hash table. - const_reference operator*() const { - __TBB_ASSERT( my_node, "attempt to dereference empty accessor" ); - return my_node->item; - } - - //! Return pointer to associated value in hash table. - const_pointer operator->() const { - return &operator*(); - } - - //! Create empty result - const_accessor() : my_node(NULL) {} - - //! Destroy result after releasing the underlying reference. - ~const_accessor() { - my_node = NULL; // my_lock.release() is called in scoped_lock destructor - } - private: - node* my_node; - node_mutex_t::scoped_lock my_lock; - hashcode_t my_hash; - }; - - //! Allows write access to elements and combines data access, locking, and garbage collection. - class accessor: public const_accessor { - public: - //! Type of value - typedef std::pair value_type; - - //! Return reference to associated value in hash table. - reference operator*() const { - __TBB_ASSERT( this->my_node, "attempt to dereference empty accessor" ); - return this->my_node->item; - } - - //! Return pointer to associated value in hash table. - pointer operator->() const { - return &operator*(); - } - }; - - //! Construct empty table. - concurrent_hash_map(const allocator_type &a = allocator_type()) - : my_allocator(a) - - { - initialize(); - } - - //! Copy constructor - concurrent_hash_map( const concurrent_hash_map& table, const allocator_type &a = allocator_type()) - : my_allocator(a) - { - initialize(); - internal_copy(table); - } - - //! Construction with copying iteration range and given allocator instance - template - concurrent_hash_map(I first, I last, const allocator_type &a = allocator_type()) - : my_allocator(a) - { - initialize(); - internal_copy(first, last); - } - - //! Assignment - concurrent_hash_map& operator=( const concurrent_hash_map& table ) { - if( this!=&table ) { - clear(); - internal_copy(table); - } - return *this; - } - - - //! Clear table - void clear(); - - //! Clear table and destroy it. - ~concurrent_hash_map(); - - //------------------------------------------------------------------------ - // Parallel algorithm support - //------------------------------------------------------------------------ - range_type range( size_type grainsize=1 ) { - return range_type( begin(), end(), grainsize ); - } - const_range_type range( size_type grainsize=1 ) const { - return const_range_type( begin(), end(), grainsize ); - } - - //------------------------------------------------------------------------ - // STL support - not thread-safe methods - //------------------------------------------------------------------------ - iterator begin() {return iterator(*this,0);} - iterator end() {return iterator(*this,n_segment);} - const_iterator begin() const {return const_iterator(*this,0);} - const_iterator end() const {return const_iterator(*this,n_segment);} - std::pair equal_range( const Key& key ) { return internal_equal_range(key, end()); } - std::pair equal_range( const Key& key ) const { return internal_equal_range(key, end()); } - - //! Number of items in table. - /** Be aware that this method is relatively slow compared to the - typical size() method for an STL container. */ - size_type size() const; - - //! True if size()==0. - bool empty() const; - - //! Upper bound on size. - size_type max_size() const {return (~size_type(0))/sizeof(node);} - - //! return allocator object - allocator_type get_allocator() const { return this->my_allocator; } - - //! swap two instances - void swap(concurrent_hash_map &table); - - //------------------------------------------------------------------------ - // concurrent map operations - //------------------------------------------------------------------------ - - //! Return count of items (0 or 1) - size_type count( const Key& key ) const { - return const_cast(this)->lookup(NULL, key, /*write=*/false, NULL ); - } - - //! Find item and acquire a read lock on the item. - /** Return true if item is found, false otherwise. */ - bool find( const_accessor& result, const Key& key ) const { - return const_cast(this)->lookup(&result, key, /*write=*/false, NULL ); - } - - //! Find item and acquire a write lock on the item. - /** Return true if item is found, false otherwise. */ - bool find( accessor& result, const Key& key ) { - return lookup(&result, key, /*write=*/true, NULL ); - } - - //! Insert item (if not already present) and acquire a read lock on the item. - /** Returns true if item is new. */ - bool insert( const_accessor& result, const Key& key ) { - return lookup(&result, key, /*write=*/false, NULL ); - } - - //! Insert item (if not already present) and acquire a write lock on the item. - /** Returns true if item is new. */ - bool insert( accessor& result, const Key& key ) { - return lookup(&result, key, /*write=*/true, NULL ); - } - - //! Insert item by copying if there is no such key present already and acquire a read lock on the item. - /** Returns true if item is new. */ - bool insert( const_accessor& result, const value_type& value ) { - return lookup(&result, value.first, /*write=*/false, &value.second ); - } - - //! Insert item by copying if there is no such key present already and acquire a write lock on the item. - /** Returns true if item is new. */ - bool insert( accessor& result, const value_type& value ) { - return lookup(&result, value.first, /*write=*/true, &value.second ); - } - - //! Insert item by copying if there is no such key present already - /** Returns true if item is inserted. */ - bool insert( const value_type& value ) { - return lookup(NULL, value.first, /*write=*/false, &value.second ); - } - - //! Insert range [first, last) - template - void insert(I first, I last) { - for(; first != last; ++first) - insert( *first ); - } - - //! Erase item. - /** Return true if item was erased by particularly this call. */ - bool erase( const Key& key ); - - //! Erase item by const_accessor. - /** Return true if item was erased by particularly this call. */ - bool erase( const_accessor& item_accessor ) { - return exclude( item_accessor, /*readonly=*/ true ); - } - - //! Erase item by accessor. - /** Return true if item was erased by particularly this call. */ - bool erase( accessor& item_accessor ) { - return exclude( item_accessor, /*readonly=*/ false ); - } - -private: - //! Basic unit of storage used in chain. - struct node: internal::no_copy { - //! Next node in chain - node* next; - node_mutex_t mutex; - value_type item; - node( const Key& key ) : item(key, T()) {} - node( const Key& key, const T& t ) : item(key, t) {} - // exception-safe allocation, see C++ Standard 2003, clause 5.3.4p17 - void* operator new( size_t /*size*/, node_allocator_type& a ) { - void *ptr = a.allocate(1); - if(!ptr) throw std::bad_alloc(); - return ptr; - } - // match placement-new form above to be called if exception thrown in constructor - void operator delete( void* ptr, node_allocator_type& a ) {return a.deallocate(static_cast(ptr),1); } - }; - - struct chain; - friend struct chain; - - //! A linked-list of nodes. - /** Should be zero-initialized before use. */ - struct chain { - void push_front( node& b ) { - b.next = node_list; - node_list = &b; - } - chain_mutex_t mutex; - node* node_list; - }; - - struct segment; - friend struct segment; - - //! Segment of the table. - /** The table is partioned into disjoint segments to reduce conflicts. - A segment should be zero-initialized before use. */ - struct segment: internal::hash_map_segment_base { -#if TBB_USE_ASSERT - ~segment() { - __TBB_ASSERT( !my_array, "should have been cleared earlier" ); - } -#endif /* TBB_USE_ASSERT */ - - // Pointer to array of chains - chain* my_array; - - // Get chain in this segment that corresponds to given hash code. - chain& get_chain( hashcode_t hashcode, size_t n_segment_bits ) { - return my_array[(hashcode>>n_segment_bits)&(my_physical_size-1)]; - } - - //! Allocate an array with at least new_size chains. - /** "new_size" is rounded up to a power of two that occupies at least one cache line. - Does not deallocate the old array. Overwrites my_array. */ - void allocate_array( size_t new_size ) { - size_t n=(internal::NFS_GetLineSize()+sizeof(chain)-1)/sizeof(chain); - __TBB_ASSERT((n&(n-1))==0, NULL); - while( n().allocate( n ); - // storing earlier might help overcome false positives of in deducing "bool grow" in concurrent threads - __TBB_store_with_release(my_physical_size, n); - std::memset( array, 0, n*sizeof(chain) ); - my_array = array; - } - }; - - segment& get_segment( hashcode_t hashcode ) { - return my_segment[hashcode&(n_segment-1)]; - } - - node_allocator_type my_allocator; - - HashCompare my_hash_compare; - - segment* my_segment; - - node* create_node(const Key& key, const T* t) { - // exception-safe allocation and construction - if(t) return new( my_allocator ) node(key, *t); - else return new( my_allocator ) node(key); - } - - void delete_node(node* b) { - my_allocator.destroy(b); - my_allocator.deallocate(b, 1); - } - - node* search_list( const Key& key, chain& c ) const { - node* b = c.node_list; - while( b && !my_hash_compare.equal(key, b->item.first) ) - b = b->next; - return b; - } - //! Returns an iterator for an item defined by the key, or for the next item after it (if upper==true) - template - std::pair internal_equal_range( const Key& key, I end ) const; - - //! delete item by accessor - bool exclude( const_accessor& item_accessor, bool readonly ); - - //! Grow segment for which caller has acquired a write lock. - void grow_segment( segment_mutex_t::scoped_lock& segment_lock, segment& s ); - - //! Does heavy lifting for "find" and "insert". - template - bool lookup( const_accessor* result, const Key& key, bool write, const T* t ); - - //! Perform initialization on behalf of a constructor - void initialize() { - my_segment = cache_aligned_allocator().allocate(n_segment); - std::memset( my_segment, 0, sizeof(segment)*n_segment ); - } - - //! Copy "source" to *this, where *this must start out empty. - void internal_copy( const concurrent_hash_map& source ); - - template - void internal_copy(I first, I last); -}; - -template -concurrent_hash_map::~concurrent_hash_map() { - clear(); - cache_aligned_allocator().deallocate( my_segment, n_segment ); -} - -template -typename concurrent_hash_map::size_type concurrent_hash_map::size() const { - size_type result = 0; - for( size_t k=0; k -bool concurrent_hash_map::empty() const { - for( size_t k=0; k -template -bool concurrent_hash_map::lookup( const_accessor* result, const Key& key, bool write, const T* t ) { - if( result ) - result->release(); - const hashcode_t h = my_hash_compare.hash( key ); - segment& s = get_segment(h); -restart: - bool return_value = false; - // first check in double-check sequence -#if TBB_USE_THREADING_TOOLS - bool grow = op_insert && s.internal_grow_predicate(); -#else - bool grow = op_insert && s.my_logical_size >= s.my_physical_size - && s.my_physical_size < max_physical_size; // check whether there are free bits -#endif /* TBB_USE_THREADING_TOOLS */ - segment_mutex_t::scoped_lock segment_lock( s.my_mutex, /*write=*/grow ); - if( grow ) { // Load factor is too high - grow_segment( segment_lock, s ); - } - if( !s.my_array ) { - __TBB_ASSERT( !op_insert, NULL ); - return false; - } - __TBB_ASSERT( (s.my_physical_size&(s.my_physical_size-1))==0, NULL ); - chain& c = s.get_chain( h, n_segment_bits ); - chain_mutex_t::scoped_lock chain_lock( c.mutex, /*write=*/false ); - - node* b = search_list( key, c ); - if( op_insert ) { - if( !b ) { - b = create_node(key, t); - // Search failed - if( !chain_lock.upgrade_to_writer() ) { - // Rerun search_list, in case another thread inserted the item during the upgrade. - node* b_temp = search_list( key, c ); - if( b_temp ) { // unfortunately, it did - chain_lock.downgrade_to_reader(); - delete_node( b ); - b = b_temp; - goto done; - } - } - ++s.my_logical_size; // we can't change it earlier due to correctness of size() and exception safety of equal() - return_value = true; - c.push_front( *b ); - } - } else { // find or count - if( !b ) return false; - return_value = true; - } -done: - if( !result ) return return_value; - if( !result->my_lock.try_acquire( b->mutex, write ) ) { - // we are unlucky, prepare for longer wait - internal::AtomicBackoff trials; - do { - if( !trials.bounded_pause() ) { - // the wait takes really long, restart the operation - chain_lock.release(); segment_lock.release(); - __TBB_Yield(); - goto restart; - } - } while( !result->my_lock.try_acquire( b->mutex, write ) ); - } - result->my_node = b; - result->my_hash = h; - return return_value; -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif // warning 4127 is back - -template -template -std::pair concurrent_hash_map::internal_equal_range( const Key& key, I end ) const { - hashcode_t h = my_hash_compare.hash( key ); - size_t segment_index = h&(n_segment-1); - segment& s = my_segment[segment_index ]; - size_t chain_index = (h>>n_segment_bits)&(s.my_physical_size-1); - if( !s.my_array ) - return std::make_pair(end, end); - chain& c = s.my_array[chain_index]; - node* b = search_list( key, c ); - if( !b ) - return std::make_pair(end, end); - iterator lower(*this, segment_index, chain_index, b), upper(lower); - return std::make_pair(lower, ++upper); -} - -template -bool concurrent_hash_map::erase( const Key &key ) { - hashcode_t h = my_hash_compare.hash( key ); - segment& s = get_segment( h ); - node* b=NULL; // explicitly initialized to prevent compiler warnings - { - bool chain_locked_for_write = false; - segment_mutex_t::scoped_lock segment_lock( s.my_mutex, /*write=*/false ); - if( !s.my_array ) return false; - __TBB_ASSERT( (s.my_physical_size&(s.my_physical_size-1))==0, NULL ); - chain& c = s.get_chain( h, n_segment_bits ); - chain_mutex_t::scoped_lock chain_lock( c.mutex, /*write=*/false ); - search: - node** p = &c.node_list; - b = *p; - while( b && !my_hash_compare.equal(key, b->item.first ) ) { - p = &b->next; - b = *p; - } - if( !b ) return false; - if( !chain_locked_for_write && !chain_lock.upgrade_to_writer() ) { - chain_locked_for_write = true; - goto search; - } - *p = b->next; - --s.my_logical_size; - } - { - node_mutex_t::scoped_lock item_locker( b->mutex, /*write=*/true ); - } - // note: there should be no threads pretending to acquire this mutex again, do not try to upgrade const_accessor! - delete_node( b ); // Only one thread can delete it due to write lock on the chain_mutex - return true; -} - -template -bool concurrent_hash_map::exclude( const_accessor &item_accessor, bool readonly ) { - __TBB_ASSERT( item_accessor.my_node, NULL ); - const hashcode_t h = item_accessor.my_hash; - node *const b = item_accessor.my_node; - item_accessor.my_node = NULL; // we ought release accessor anyway - segment& s = get_segment( h ); - { - segment_mutex_t::scoped_lock segment_lock( s.my_mutex, /*write=*/false ); - __TBB_ASSERT( s.my_array, NULL ); - __TBB_ASSERT( (s.my_physical_size&(s.my_physical_size-1))==0, NULL ); - chain& c = s.get_chain( h, n_segment_bits ); - chain_mutex_t::scoped_lock chain_lock( c.mutex, /*write=*/true ); - node** p = &c.node_list; - while( *p && *p != b ) - p = &(*p)->next; - if( !*p ) { // someone else was the first - item_accessor.my_lock.release(); - return false; - } - __TBB_ASSERT( *p == b, NULL ); - *p = b->next; - --s.my_logical_size; - } - if( readonly ) // need to get exclusive lock - item_accessor.my_lock.upgrade_to_writer(); // return value means nothing here - item_accessor.my_lock.release(); - delete_node( b ); // Only one thread can delete it due to write lock on the chain_mutex - return true; -} - -template -void concurrent_hash_map::swap(concurrent_hash_map &table) { - std::swap(this->my_allocator, table.my_allocator); - std::swap(this->my_hash_compare, table.my_hash_compare); - std::swap(this->my_segment, table.my_segment); -} - -template -void concurrent_hash_map::clear() { -#if TBB_USE_PERFORMANCE_WARNINGS - size_t total_physical_size = 0, min_physical_size = size_t(-1L), max_physical_size = 0; //< usage statistics - static bool reported = false; -#endif - for( size_t i=0; inext; - delete_node(b); - } - } - cache_aligned_allocator().deallocate( array, n ); - } -#if TBB_USE_PERFORMANCE_WARNINGS - total_physical_size += n; - if(min_physical_size > n) min_physical_size = n; - if(max_physical_size < n) max_physical_size = n; - } - if( !reported - && ( (total_physical_size >= n_segment*48 && min_physical_size < total_physical_size/n_segment/2) - || (total_physical_size >= n_segment*128 && max_physical_size > total_physical_size/n_segment*2) ) ) - { - reported = true; - internal::runtime_warning( - "Performance is not optimal because the hash function produces bad randomness in lower bits in %s", - typeid(*this).name() ); -#endif - } -} - -template -void concurrent_hash_map::grow_segment( segment_mutex_t::scoped_lock& segment_lock, segment& s ) { - // Following is second check in a double-check. - if( s.my_logical_size >= s.my_physical_size ) { - chain* old_array = s.my_array; - size_t old_size = s.my_physical_size; - s.allocate_array( s.my_logical_size+1 ); - for( size_t k=0; knext; - hashcode_t h = my_hash_compare.hash( b->item.first ); - __TBB_ASSERT( &get_segment(h)==&s, "hash function changed?" ); - s.get_chain(h,n_segment_bits).push_front(*b); - } - cache_aligned_allocator().deallocate( old_array, old_size ); - } - segment_lock.downgrade_to_reader(); -} - -template -void concurrent_hash_map::internal_copy( const concurrent_hash_map& source ) { - for( size_t i=0; inext ) { - __TBB_ASSERT( &get_segment(my_hash_compare.hash( b->item.first ))==&d, "hash function changed?" ); - node* b_new = create_node(b->item.first, &b->item.second); - d_array[k].push_front(*b_new); // hashcode is the same and segment and my_physical sizes are the same - } - } - } -} - -template -template -void concurrent_hash_map::internal_copy(I first, I last) { - for(; first != last; ++first) - insert( *first ); -} - -template -inline bool operator==(const concurrent_hash_map &a, const concurrent_hash_map &b) { - if(a.size() != b.size()) return false; - typename concurrent_hash_map::const_iterator i(a.begin()), i_end(a.end()); - typename concurrent_hash_map::const_iterator j, j_end(b.end()); - for(; i != i_end; ++i) { - j = b.equal_range(i->first).first; - if( j == j_end || !(i->second == j->second) ) return false; - } - return true; -} - -template -inline bool operator!=(const concurrent_hash_map &a, const concurrent_hash_map &b) -{ return !(a == b); } - -template -inline void swap(concurrent_hash_map &a, concurrent_hash_map &b) -{ a.swap( b ); } - -} // namespace tbb - -#endif /* __TBB_concurrent_hash_map_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_queue.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_queue.h deleted file mode 100644 index f169a5190d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_queue.h +++ /dev/null @@ -1,410 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_concurrent_queue_H -#define __TBB_concurrent_queue_H - -#include "tbb_stddef.h" -#include "cache_aligned_allocator.h" -#include -#include - -namespace tbb { - -template > -class concurrent_queue; - -//! @cond INTERNAL -namespace internal { - -class concurrent_queue_rep; -class concurrent_queue_iterator_rep; -class concurrent_queue_iterator_base_v3; -template class concurrent_queue_iterator; - -//! For internal use only. -/** Type-independent portion of concurrent_queue. - @ingroup containers */ -class concurrent_queue_base_v3: no_copy { - //! Internal representation - concurrent_queue_rep* my_rep; - - friend class concurrent_queue_rep; - friend struct micro_queue; - friend class micro_queue_pop_finalizer; - friend class concurrent_queue_iterator_rep; - friend class concurrent_queue_iterator_base_v3; -protected: - //! Prefix on a page - struct page { - page* next; - uintptr mask; - }; - - //! Capacity of the queue - ptrdiff_t my_capacity; - - //! Always a power of 2 - size_t items_per_page; - - //! Size of an item - size_t item_size; - -private: - virtual void copy_item( page& dst, size_t index, const void* src ) = 0; - virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) = 0; -protected: - __TBB_EXPORTED_METHOD concurrent_queue_base_v3( size_t item_size ); - virtual __TBB_EXPORTED_METHOD ~concurrent_queue_base_v3(); - - //! Enqueue item at tail of queue - void __TBB_EXPORTED_METHOD internal_push( const void* src ); - - //! Dequeue item from head of queue - void __TBB_EXPORTED_METHOD internal_pop( void* dst ); - - //! Attempt to enqueue item onto queue. - bool __TBB_EXPORTED_METHOD internal_push_if_not_full( const void* src ); - - //! Attempt to dequeue item from queue. - /** NULL if there was no item to dequeue. */ - bool __TBB_EXPORTED_METHOD internal_pop_if_present( void* dst ); - - //! Get size of queue - ptrdiff_t __TBB_EXPORTED_METHOD internal_size() const; - - //! set the queue capacity - void __TBB_EXPORTED_METHOD internal_set_capacity( ptrdiff_t capacity, size_t element_size ); - - //! custom allocator - virtual page *allocate_page() = 0; - - //! custom de-allocator - virtual void deallocate_page( page *p ) = 0; - - //! free any remaining pages - /* note that the name may be misleading, but it remains so due to a historical accident. */ - void __TBB_EXPORTED_METHOD internal_finish_clear() ; - - //! throw an exception - void __TBB_EXPORTED_METHOD internal_throw_exception() const; - - //! copy internal representation - void __TBB_EXPORTED_METHOD assign( const concurrent_queue_base_v3& src ) ; - -private: - virtual void copy_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) = 0; -}; - -typedef concurrent_queue_base_v3 concurrent_queue_base ; - -//! Type-independent portion of concurrent_queue_iterator. -/** @ingroup containers */ -class concurrent_queue_iterator_base_v3 { - //! Concurrentconcurrent_queue over which we are iterating. - /** NULL if one past last element in queue. */ - concurrent_queue_iterator_rep* my_rep; - - template - friend bool operator==( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ); - - template - friend bool operator!=( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ); -protected: - //! Pointer to current item - mutable void* my_item; - - //! Default constructor - concurrent_queue_iterator_base_v3() : my_rep(NULL), my_item(NULL) {} - - //! Copy constructor - concurrent_queue_iterator_base_v3( const concurrent_queue_iterator_base_v3& i ) : my_rep(NULL), my_item(NULL) { - assign(i); - } - - //! Construct iterator pointing to head of queue. - __TBB_EXPORTED_METHOD concurrent_queue_iterator_base_v3( const concurrent_queue_base& queue ); - - //! Assignment - void __TBB_EXPORTED_METHOD assign( const concurrent_queue_iterator_base_v3& i ); - - //! Advance iterator one step towards tail of queue. - void __TBB_EXPORTED_METHOD advance(); - - //! Destructor - __TBB_EXPORTED_METHOD ~concurrent_queue_iterator_base_v3(); -}; - -typedef concurrent_queue_iterator_base_v3 concurrent_queue_iterator_base; - -//! Meets requirements of a forward iterator for STL. -/** Value is either the T or const T type of the container. - @ingroup containers */ -template -class concurrent_queue_iterator: public concurrent_queue_iterator_base, - public std::iterator { -#if !defined(_MSC_VER) || defined(__INTEL_COMPILER) - template - friend class ::tbb::concurrent_queue; -#else -public: // workaround for MSVC -#endif - //! Construct iterator pointing to head of queue. - concurrent_queue_iterator( const concurrent_queue_base& queue ) : - concurrent_queue_iterator_base_v3(queue) - { - } -public: - concurrent_queue_iterator() {} - - /** If Value==Container::value_type, then this routine is the copy constructor. - If Value==const Container::value_type, then this routine is a conversion constructor. */ - concurrent_queue_iterator( const concurrent_queue_iterator& other ) : - concurrent_queue_iterator_base_v3(other) - {} - - //! Iterator assignment - concurrent_queue_iterator& operator=( const concurrent_queue_iterator& other ) { - assign(other); - return *this; - } - - //! Reference to current item - Value& operator*() const { - return *static_cast(my_item); - } - - Value* operator->() const {return &operator*();} - - //! Advance to next item in queue - concurrent_queue_iterator& operator++() { - advance(); - return *this; - } - - //! Post increment - Value* operator++(int) { - Value* result = &operator*(); - operator++(); - return result; - } -}; // concurrent_queue_iterator - - -template -bool operator==( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ) { - return i.my_item==j.my_item; -} - -template -bool operator!=( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ) { - return i.my_item!=j.my_item; -} - -} // namespace internal; - -//! @endcond - -//! A high-performance thread-safe queue. -/** Multiple threads may each push and pop concurrently. - Assignment construction is not allowed. - @ingroup containers */ -template -class concurrent_queue: public internal::concurrent_queue_base_v3 { - template friend class internal::concurrent_queue_iterator; - - //! allocator type - typedef typename A::template rebind::other page_allocator_type; - page_allocator_type my_allocator; - - //! Class used to ensure exception-safety of method "pop" - class destroyer: internal::no_copy { - T& my_value; - public: - destroyer( T& value ) : my_value(value) {} - ~destroyer() {my_value.~T();} - }; - - T& get_ref( page& page, size_t index ) { - __TBB_ASSERT( index(static_cast(&page+1))[index]; - } - - /*override*/ virtual void copy_item( page& dst, size_t index, const void* src ) { - new( &get_ref(dst,index) ) T(*static_cast(src)); - } - - /*override*/ virtual void copy_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) { - new( &get_ref(dst,dindex) ) T( static_cast(static_cast(&src+1))[sindex] ); - } - - /*override*/ virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) { - T& from = get_ref(src,index); - destroyer d(from); - *static_cast(dst) = from; - } - - /*overide*/ virtual page *allocate_page() { - size_t n = sizeof(page) + items_per_page*item_size; - page *p = reinterpret_cast(my_allocator.allocate( n )); - if( !p ) internal_throw_exception(); - return p; - } - - /*override*/ virtual void deallocate_page( page *p ) { - size_t n = sizeof(page) + items_per_page*item_size; - my_allocator.deallocate( reinterpret_cast(p), n ); - } - -public: - //! Element type in the queue. - typedef T value_type; - - //! Allocator type - typedef A allocator_type; - - //! Reference type - typedef T& reference; - - //! Const reference type - typedef const T& const_reference; - - //! Integral type for representing size of the queue. - /** Notice that the size_type is a signed integral type. - This is because the size can be negative if there are pending pops without corresponding pushes. */ - typedef std::ptrdiff_t size_type; - - //! Difference type for iterator - typedef std::ptrdiff_t difference_type; - - //! Construct empty queue - explicit concurrent_queue(const allocator_type &a = allocator_type()) : - concurrent_queue_base_v3( sizeof(T) ), my_allocator( a ) - { - } - - //! Destroy queue - ~concurrent_queue(); - - //! Enqueue an item at tail of queue. - void push( const T& source ) { - internal_push( &source ); - } - - //! Dequeue item from head of queue. - /** Block until an item becomes available, and then dequeue it. */ - void pop( T& destination ) { - internal_pop( &destination ); - } - - //! Enqueue an item at tail of queue if queue is not already full. - /** Does not wait for queue to become not full. - Returns true if item is pushed; false if queue was already full. */ - bool push_if_not_full( const T& source ) { - return internal_push_if_not_full( &source ); - } - - //! Attempt to dequeue an item from head of queue. - /** Does not wait for item to become available. - Returns true if successful; false otherwise. */ - bool pop_if_present( T& destination ) { - return internal_pop_if_present( &destination ); - } - - //! Return number of pushes minus number of pops. - /** Note that the result can be negative if there are pops waiting for the - corresponding pushes. The result can also exceed capacity() if there - are push operations in flight. */ - size_type size() const {return internal_size();} - - //! Equivalent to size()<=0. - bool empty() const {return size()<=0;} - - //! Maximum number of allowed elements - size_type capacity() const { - return my_capacity; - } - - //! Set the capacity - /** Setting the capacity to 0 causes subsequent push_if_not_full operations to always fail, - and subsequent push operations to block forever. */ - void set_capacity( size_type capacity ) { - internal_set_capacity( capacity, sizeof(T) ); - } - - //! return allocator object - allocator_type get_allocator() const { return this->my_allocator; } - - //! clear the queue. not thread-safe. - void clear() ; - - typedef internal::concurrent_queue_iterator iterator; - typedef internal::concurrent_queue_iterator const_iterator; - - //------------------------------------------------------------------------ - // The iterators are intended only for debugging. They are slow and not thread safe. - //------------------------------------------------------------------------ - iterator begin() {return iterator(*this);} - iterator end() {return iterator();} - const_iterator begin() const {return const_iterator(*this);} - const_iterator end() const {return const_iterator();} - - //! Copy constructor - concurrent_queue( const concurrent_queue& src, const allocator_type &a = allocator_type()) : - concurrent_queue_base_v3( sizeof(T) ), my_allocator( a ) - { - assign( src ); - } - - //! [begin,end) constructor - template - concurrent_queue( InputIterator begin, InputIterator end, const allocator_type &a = allocator_type()) : - concurrent_queue_base_v3( sizeof(T) ), my_allocator( a ) - { - for( ; begin != end; ++begin ) - internal_push_if_not_full(&*begin); - } -}; - -template -concurrent_queue::~concurrent_queue() { - clear(); - internal_finish_clear(); -} - -template -void concurrent_queue::clear() { - while( !empty() ) { - T value; - internal_pop_if_present(&value); - } -} - -} // namespace tbb - -#endif /* __TBB_concurrent_queue_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_vector.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_vector.h deleted file mode 100644 index 4e9bd09114..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/concurrent_vector.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_concurrent_vector_H -#define __TBB_concurrent_vector_H - -#include "tbb_stddef.h" -#include -#include -#include -#include -#include -#include -#include "atomic.h" -#include "cache_aligned_allocator.h" -#include "blocked_range.h" - -#include "tbb_machine.h" - -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (push) - #pragma warning (disable: 4267) -#endif - -namespace tbb { - -template > -class concurrent_vector; - -//! Bad allocation marker -#define __TBB_BAD_ALLOC reinterpret_cast(size_t(63)) - -//! @cond INTERNAL -namespace internal { - - //! Routine that loads pointer from location pointed to by src without any fence, without causing ITT to report a race. - void* __TBB_EXPORTED_FUNC itt_load_pointer_v3( const void* src ); - - //! Base class of concurrent vector implementation. - /** @ingroup containers */ - class concurrent_vector_base_v3 { - protected: - - // Basic types declarations - typedef size_t segment_index_t; - typedef size_t size_type; - - // Using enumerations due to Mac linking problems of static const variables - enum { - // Size constants - default_initial_segments = 1, // 2 initial items - //! Number of slots for segment's pointers inside the class - pointers_per_short_table = 3, // to fit into 8 words of entire structure - pointers_per_long_table = sizeof(segment_index_t) * 8 // one segment per bit - }; - - // Segment pointer. Can be zero-initialized - struct segment_t { - void* array; -#if TBB_USE_ASSERT - ~segment_t() { - __TBB_ASSERT( array <= __TBB_BAD_ALLOC, "should have been freed by clear" ); - } -#endif /* TBB_USE_ASSERT */ - }; - - // Data fields - - //! allocator function pointer - void* (*vector_allocator_ptr)(concurrent_vector_base_v3 &, size_t); - - //! count of segments in the first block - atomic my_first_block; - - //! Requested size of vector - atomic my_early_size; - - //! Pointer to the segments table - atomic my_segment; - - //! embedded storage of segment pointers - segment_t my_storage[pointers_per_short_table]; - - // Methods - - concurrent_vector_base_v3() { - my_early_size = 0; - my_first_block = 0; // here is not default_initial_segments - for( segment_index_t i = 0; i < pointers_per_short_table; i++) - my_storage[i].array = NULL; - my_segment = my_storage; - } - __TBB_EXPORTED_METHOD ~concurrent_vector_base_v3(); - - static segment_index_t segment_index_of( size_type index ) { - return segment_index_t( __TBB_Log2( index|1 ) ); - } - - static segment_index_t segment_base( segment_index_t k ) { - return (segment_index_t(1)< - class vector_iterator - { - //! concurrent_vector over which we are iterating. - Container* my_vector; - - //! Index into the vector - size_t my_index; - - //! Caches my_vector->internal_subscript(my_index) - /** NULL if cached value is not available */ - mutable Value* my_item; - - template - friend vector_iterator operator+( ptrdiff_t offset, const vector_iterator& v ); - - template - friend bool operator==( const vector_iterator& i, const vector_iterator& j ); - - template - friend bool operator<( const vector_iterator& i, const vector_iterator& j ); - - template - friend ptrdiff_t operator-( const vector_iterator& i, const vector_iterator& j ); - - template - friend class internal::vector_iterator; - -#if !defined(_MSC_VER) || defined(__INTEL_COMPILER) - template - friend class tbb::concurrent_vector; -#else -public: // workaround for MSVC -#endif - - vector_iterator( const Container& vector, size_t index ) : - my_vector(const_cast(&vector)), - my_index(index), - my_item(NULL) - {} - - public: - //! Default constructor - vector_iterator() : my_vector(NULL), my_index(~size_t(0)), my_item(NULL) {} - - vector_iterator( const vector_iterator& other ) : - my_vector(other.my_vector), - my_index(other.my_index), - my_item(other.my_item) - {} - - vector_iterator operator+( ptrdiff_t offset ) const { - return vector_iterator( *my_vector, my_index+offset ); - } - vector_iterator &operator+=( ptrdiff_t offset ) { - my_index+=offset; - my_item = NULL; - return *this; - } - vector_iterator operator-( ptrdiff_t offset ) const { - return vector_iterator( *my_vector, my_index-offset ); - } - vector_iterator &operator-=( ptrdiff_t offset ) { - my_index-=offset; - my_item = NULL; - return *this; - } - Value& operator*() const { - Value* item = my_item; - if( !item ) { - item = my_item = &my_vector->internal_subscript(my_index); - } - __TBB_ASSERT( item==&my_vector->internal_subscript(my_index), "corrupt cache" ); - return *item; - } - Value& operator[]( ptrdiff_t k ) const { - return my_vector->internal_subscript(my_index+k); - } - Value* operator->() const {return &operator*();} - - //! Pre increment - vector_iterator& operator++() { - size_t k = ++my_index; - if( my_item ) { - // Following test uses 2's-complement wizardry - if( (k& (k-2))==0 ) { - // k is a power of two that is at least k-2 - my_item= NULL; - } else { - ++my_item; - } - } - return *this; - } - - //! Pre decrement - vector_iterator& operator--() { - __TBB_ASSERT( my_index>0, "operator--() applied to iterator already at beginning of concurrent_vector" ); - size_t k = my_index--; - if( my_item ) { - // Following test uses 2's-complement wizardry - if( (k& (k-2))==0 ) { - // k is a power of two that is at least k-2 - my_item= NULL; - } else { - --my_item; - } - } - return *this; - } - - //! Post increment - vector_iterator operator++(int) { - vector_iterator result = *this; - operator++(); - return result; - } - - //! Post decrement - vector_iterator operator--(int) { - vector_iterator result = *this; - operator--(); - return result; - } - - // STL support - - typedef ptrdiff_t difference_type; - typedef Value value_type; - typedef Value* pointer; - typedef Value& reference; - typedef std::random_access_iterator_tag iterator_category; - }; - - template - vector_iterator operator+( ptrdiff_t offset, const vector_iterator& v ) { - return vector_iterator( *v.my_vector, v.my_index+offset ); - } - - template - bool operator==( const vector_iterator& i, const vector_iterator& j ) { - return i.my_index==j.my_index && i.my_vector == j.my_vector; - } - - template - bool operator!=( const vector_iterator& i, const vector_iterator& j ) { - return !(i==j); - } - - template - bool operator<( const vector_iterator& i, const vector_iterator& j ) { - return i.my_index - bool operator>( const vector_iterator& i, const vector_iterator& j ) { - return j - bool operator>=( const vector_iterator& i, const vector_iterator& j ) { - return !(i - bool operator<=( const vector_iterator& i, const vector_iterator& j ) { - return !(j - ptrdiff_t operator-( const vector_iterator& i, const vector_iterator& j ) { - return ptrdiff_t(i.my_index)-ptrdiff_t(j.my_index); - } - - template - class allocator_base { - public: - typedef typename A::template - rebind::other allocator_type; - allocator_type my_allocator; - - allocator_base(const allocator_type &a = allocator_type() ) : my_allocator(a) {} - }; - -} // namespace internal -//! @endcond - -//! Concurrent vector container -/** concurrent_vector is a container having the following main properties: - - It provides random indexed access to its elements. The index of the first element is 0. - - It ensures safe concurrent growing its size (different threads can safely append new elements). - - Adding new elements does not invalidate existing iterators and does not change indices of existing items. - -@par Compatibility - The class meets all Container Requirements and Reversible Container Requirements from - C++ Standard (See ISO/IEC 14882:2003(E), clause 23.1). But it doesn't meet - Sequence Requirements due to absence of insert() and erase() methods. - -@par Exception Safety - Methods working with memory allocation and/or new elements construction can throw an - exception if allocator fails to allocate memory or element's default constructor throws one. - Concurrent vector's element of type T must conform to the following requirements: - - Throwing an exception is forbidden for destructor of T. - - Default constructor of T must not throw an exception OR its non-virtual destructor must safely work when its object memory is zero-initialized. - . - Otherwise, the program's behavior is undefined. -@par - If an exception happens inside growth or assignment operation, an instance of the vector becomes invalid unless it is stated otherwise in the method documentation. - Invalid state means: - - There are no guaranties that all items were initialized by a constructor. The rest of items is zero-filled, including item where exception happens. - - An invalid vector instance cannot be repaired; it is unable to grow anymore. - - Size and capacity reported by the vector are incorrect, and calculated as if the failed operation were successful. - - Attempt to access not allocated elements using operator[] or iterators results in access violation or segmentation fault exception, and in case of using at() method a C++ exception is thrown. - . - If a concurrent grow operation successfully completes, all the elements it has added to the vector will remain valid and accessible even if one of subsequent grow operations fails. - -@par Fragmentation - Unlike an STL vector, a concurrent_vector does not move existing elements if it needs - to allocate more memory. The container is divided into a series of contiguous arrays of - elements. The first reservation, growth, or assignment operation determines the size of - the first array. Using small number of elements as initial size incurs fragmentation that - may increase element access time. Internal layout can be optimized by method compact() that - merges several smaller arrays into one solid. - -@par Changes since TBB 2.0 - - Implemented exception-safety guaranties - - Added template argument for allocator - - Added allocator argument in constructors - - Faster index calculation - - First growth call specifies a number of segments to be merged in the first allocation. - - Fixed memory blow up for swarm of vector's instances of small size - - Added grow_by(size_type n, const_reference t) growth using copying constructor to init new items. - - Added STL-like constructors. - - Added operators ==, < and derivatives - - Added at() method, approved for using after an exception was thrown inside the vector - - Added get_allocator() method. - - Added assign() methods - - Added compact() method to defragment first segments - - Added swap() method - - range() defaults on grainsize = 1 supporting auto grainsize algorithms. - - @ingroup containers */ -template -class concurrent_vector: protected internal::allocator_base, - private internal::concurrent_vector_base_v3 { -private: - template - class generic_range_type: public blocked_range { - public: - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef I iterator; - typedef ptrdiff_t difference_type; - generic_range_type( I begin_, I end_, size_t grainsize = 1) : blocked_range(begin_,end_,grainsize) {} - template - generic_range_type( const generic_range_type& r) : blocked_range(r.begin(),r.end(),r.grainsize()) {} - generic_range_type( generic_range_type& r, split ) : blocked_range(r,split()) {} - }; - - template - friend class internal::vector_iterator; -public: - //------------------------------------------------------------------------ - // STL compatible types - //------------------------------------------------------------------------ - typedef internal::concurrent_vector_base_v3::size_type size_type; - typedef typename internal::allocator_base::allocator_type allocator_type; - - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef T& reference; - typedef const T& const_reference; - typedef T *pointer; - typedef const T *const_pointer; - - typedef internal::vector_iterator iterator; - typedef internal::vector_iterator const_iterator; - -#if !defined(_MSC_VER) || _CPPLIB_VER>=300 - // Assume ISO standard definition of std::reverse_iterator - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; -#else - // Use non-standard std::reverse_iterator - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; -#endif /* defined(_MSC_VER) && (_MSC_VER<1300) */ - - //------------------------------------------------------------------------ - // Parallel algorithm support - //------------------------------------------------------------------------ - typedef generic_range_type range_type; - typedef generic_range_type const_range_type; - - //------------------------------------------------------------------------ - // STL compatible constructors & destructors - //------------------------------------------------------------------------ - - //! Construct empty vector. - explicit concurrent_vector(const allocator_type &a = allocator_type()) - : internal::allocator_base(a) - { - vector_allocator_ptr = &internal_allocator; - } - - //! Copying constructor - concurrent_vector( const concurrent_vector& vector, const allocator_type& a = allocator_type() ) - : internal::allocator_base(a) - { - vector_allocator_ptr = &internal_allocator; - internal_copy(vector, sizeof(T), ©_array); - } - - //! Copying constructor for vector with different allocator type - template - concurrent_vector( const concurrent_vector& vector, const allocator_type& a = allocator_type() ) - : internal::allocator_base(a) - { - vector_allocator_ptr = &internal_allocator; - internal_copy(vector.internal_vector_base(), sizeof(T), ©_array); - } - - //! Construction with initial size specified by argument n - explicit concurrent_vector(size_type n) - { - vector_allocator_ptr = &internal_allocator; - if ( !n ) return; - internal_reserve(n, sizeof(T), max_size()); my_early_size = n; - __TBB_ASSERT( my_first_block == segment_index_of(n-1)+1, NULL ); - initialize_array(static_cast(my_segment[0].array), NULL, n); - } - - //! Construction with initial size specified by argument n, initialization by copying of t, and given allocator instance - concurrent_vector(size_type n, const_reference t, const allocator_type& a = allocator_type()) - : internal::allocator_base(a) - { - vector_allocator_ptr = &internal_allocator; - internal_assign( n, t ); - } - - //! Construction with copying iteration range and given allocator instance - template - concurrent_vector(I first, I last, const allocator_type &a = allocator_type()) - : internal::allocator_base(a) - { - vector_allocator_ptr = &internal_allocator; - internal_assign(first, last, static_cast::is_integer> *>(0) ); - } - - //! Assignment - concurrent_vector& operator=( const concurrent_vector& vector ) { - if( this != &vector ) - concurrent_vector_base_v3::internal_assign(vector, sizeof(T), &destroy_array, &assign_array, ©_array); - return *this; - } - - //! Assignment for vector with different allocator type - template - concurrent_vector& operator=( const concurrent_vector& vector ) { - if( static_cast( this ) != static_cast( &vector ) ) - concurrent_vector_base_v3::internal_assign(vector.internal_vector_base(), - sizeof(T), &destroy_array, &assign_array, ©_array); - return *this; - } - - //------------------------------------------------------------------------ - // Concurrent operations - //------------------------------------------------------------------------ - //! Grow by "delta" elements. - /** Returns old size. */ - size_type grow_by( size_type delta ) { - return delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size; - } - - //! Grow by "delta" elements using copying constuctor. - /** Returns old size. */ - size_type grow_by( size_type delta, const_reference t ) { - return delta ? internal_grow_by( delta, sizeof(T), &initialize_array_by, static_cast(&t) ) : my_early_size; - } - - //! Grow array until it has at least n elements. - void grow_to_at_least( size_type n ) { - if( my_early_size0, NULL); - return static_cast(my_segment[0].array)[0]; - } - //! the first item const - const_reference front() const { - __TBB_ASSERT( size()>0, NULL); - return static_cast(my_segment[0].array)[0]; - } - //! the last item - reference back() { - __TBB_ASSERT( size()>0, NULL); - return internal_subscript( my_early_size-1 ); - } - //! the last item const - const_reference back() const { - __TBB_ASSERT( size()>0, NULL); - return internal_subscript( my_early_size-1 ); - } - //! return allocator object - allocator_type get_allocator() const { return this->my_allocator; } - - //! assign n items by copying t item - void assign(size_type n, const_reference t) { clear(); internal_assign( n, t ); } - - //! assign range [first, last) - template - void assign(I first, I last) { - clear(); internal_assign( first, last, static_cast::is_integer> *>(0) ); - } - - //! swap two instances - void swap(concurrent_vector &vector) { - if( this != &vector ) { - concurrent_vector_base_v3::internal_swap(static_cast(vector)); - std::swap(this->my_allocator, vector.my_allocator); - } - } - - //! Clear container while keeping memory allocated. - /** To free up the memory, use in conjunction with method compact(). Not thread safe **/ - void clear() { - internal_clear(&destroy_array); - } - - //! Clear and destroy vector. - ~concurrent_vector() { - segment_t *table = my_segment; - internal_free_segments( reinterpret_cast(table), internal_clear(&destroy_array), my_first_block ); - // base class destructor call should be then - } - - const internal::concurrent_vector_base_v3 &internal_vector_base() const { return *this; } -private: - //! Allocate k items - static void *internal_allocator(internal::concurrent_vector_base_v3 &vb, size_t k) { - return static_cast&>(vb).my_allocator.allocate(k); - } - //! Free k segments from table - void internal_free_segments(void *table[], segment_index_t k, segment_index_t first_block); - - //! Get reference to element at given index. - T& internal_subscript( size_type index ) const; - - //! Get reference to element at given index with errors checks - T& internal_subscript_with_exceptions( size_type index ) const; - - //! assign n items by copying t - void internal_assign(size_type n, const_reference t); - - //! helper class - template class is_integer_tag; - - //! assign integer items by copying when arguments are treated as iterators. See C++ Standard 2003 23.1.1p9 - template - void internal_assign(I first, I last, is_integer_tag *) { - internal_assign(static_cast(first), static_cast(last)); - } - //! inline proxy assign by iterators - template - void internal_assign(I first, I last, is_integer_tag *) { - internal_assign_iterators(first, last); - } - //! assign by iterators - template - void internal_assign_iterators(I first, I last); - - //! Construct n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC initialize_array( void* begin, const void*, size_type n ); - - //! Construct n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC initialize_array_by( void* begin, const void* src, size_type n ); - - //! Construct n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC copy_array( void* dst, const void* src, size_type n ); - - //! Assign n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC assign_array( void* dst, const void* src, size_type n ); - - //! Destroy n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC destroy_array( void* begin, size_type n ); - - //! Exception-aware helper class for filling a segment by exception-danger operators of user class - class internal_loop_guide : internal::no_copy { - public: - const pointer array; - const size_type n; - size_type i; - internal_loop_guide(size_type ntrials, void *ptr) - : array(static_cast(ptr)), n(ntrials), i(0) {} - void init() { for(; i < n; ++i) new( &array[i] ) T(); } - void init(const void *src) { for(; i < n; ++i) new( &array[i] ) T(*static_cast(src)); } - void copy(const void *src) { for(; i < n; ++i) new( &array[i] ) T(static_cast(src)[i]); } - void assign(const void *src) { for(; i < n; ++i) array[i] = static_cast(src)[i]; } - template void iterate(I &src) { for(; i < n; ++i, ++src) new( &array[i] ) T( *src ); } - ~internal_loop_guide() { - if(i < n) // if exception raised, do zerroing on the rest of items - std::memset(array+i, 0, (n-i)*sizeof(value_type)); - } - }; -}; - -template -void concurrent_vector::compact() { - internal_segments_table old; - try { - if( internal_compact( sizeof(T), &old, &destroy_array, ©_array ) ) - internal_free_segments( old.table, pointers_per_long_table, old.first_block ); // free joined and unnecessary segments - } catch(...) { - if( old.first_block ) // free segment allocated for compacting. Only for support of exceptions in ctor of user T[ype] - internal_free_segments( old.table, 1, old.first_block ); - throw; - } -} - -template -void concurrent_vector::internal_free_segments(void *table[], segment_index_t k, segment_index_t first_block) { - // Free the arrays - while( k > first_block ) { - --k; - T* array = static_cast(table[k]); - table[k] = NULL; - if( array > __TBB_BAD_ALLOC ) // check for correct segment pointer - this->my_allocator.deallocate( array, segment_size(k) ); - } - T* array = static_cast(table[0]); - if( array > __TBB_BAD_ALLOC ) { - __TBB_ASSERT( first_block > 0, NULL ); - while(k > 0) table[--k] = NULL; - this->my_allocator.deallocate( array, segment_size(first_block) ); - } -} - -template -T& concurrent_vector::internal_subscript( size_type index ) const { - __TBB_ASSERT( index( tbb::internal::itt_load_pointer_v3(&my_segment[k].array))[j]; -#else - return static_cast(my_segment[k].array)[j]; -#endif /* TBB_USE_THREADING_TOOLS */ -} - -template -T& concurrent_vector::internal_subscript_with_exceptions( size_type index ) const { - if( index >= size() ) - internal_throw_exception(0); // throw std::out_of_range - size_type j = index; - segment_index_t k = segment_base_index_of( j ); - if( my_segment == (segment_t*)my_storage && k >= pointers_per_short_table ) - internal_throw_exception(1); // throw std::out_of_range - void *array = my_segment[k].array; // no need in __TBB_load_with_acquire - if( array <= __TBB_BAD_ALLOC ) // check for correct segment pointer - internal_throw_exception(2); // throw std::range_error - return static_cast(array)[j]; -} - -template -void concurrent_vector::internal_assign(size_type n, const_reference t) -{ - __TBB_ASSERT(my_early_size == 0, NULL); - if( !n ) return; - internal_reserve(n, sizeof(T), max_size()); - my_early_size = n; - segment_index_t k = 0; - size_type sz = segment_size( my_first_block ); - while( sz < n ) { - initialize_array_by(static_cast(my_segment[k].array), static_cast(&t), sz); - n -= sz; - if( !k ) k = my_first_block; - else { ++k; sz <<= 1; } - } - initialize_array_by(static_cast(my_segment[k].array), static_cast(&t), n); -} - -template template -void concurrent_vector::internal_assign_iterators(I first, I last) { - __TBB_ASSERT(my_early_size == 0, NULL); - size_type n = std::distance(first, last); - if( !n ) return; - internal_reserve(n, sizeof(T), max_size()); - my_early_size = n; - segment_index_t k = 0; - size_type sz = segment_size( my_first_block ); - while( sz < n ) { - internal_loop_guide loop(sz, my_segment[k].array); - loop.iterate(first); - n -= sz; - if( !k ) k = my_first_block; - else { ++k; sz <<= 1; } - } - internal_loop_guide loop(n, my_segment[k].array); - loop.iterate(first); -} - -template -void concurrent_vector::initialize_array( void* begin, const void *, size_type n ) { - internal_loop_guide loop(n, begin); loop.init(); -} - -template -void concurrent_vector::initialize_array_by( void* begin, const void *src, size_type n ) { - internal_loop_guide loop(n, begin); loop.init(src); -} - -template -void concurrent_vector::copy_array( void* dst, const void* src, size_type n ) { - internal_loop_guide loop(n, dst); loop.copy(src); -} - -template -void concurrent_vector::assign_array( void* dst, const void* src, size_type n ) { - internal_loop_guide loop(n, dst); loop.assign(src); -} - -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - // Workaround for overzealous compiler warning - #pragma warning (push) - #pragma warning (disable: 4189) -#endif -template -void concurrent_vector::destroy_array( void* begin, size_type n ) { - T* array = static_cast(begin); - for( size_type j=n; j>0; --j ) - array[j-1].~T(); // destructors are supposed to not throw any exceptions -} -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif // warning 4189 is back - -// concurrent_vector's template functions -template -inline bool operator==(const concurrent_vector &a, const concurrent_vector &b) { - //TODO[?]: deal with _Range_checked_iterator_tag of MSVC. - // Simply: return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin()); - if(a.size() != b.size()) return false; - typename concurrent_vector::const_iterator i(a.begin()); - typename concurrent_vector::const_iterator j(b.begin()); - for(; i != a.end(); ++i, ++j) - if( !(*i == *j) ) return false; - return true; -} - -template -inline bool operator!=(const concurrent_vector &a, const concurrent_vector &b) -{ return !(a == b); } - -template -inline bool operator<(const concurrent_vector &a, const concurrent_vector &b) -{ return (std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end())); } - -template -inline bool operator>(const concurrent_vector &a, const concurrent_vector &b) -{ return b < a; } - -template -inline bool operator<=(const concurrent_vector &a, const concurrent_vector &b) -{ return !(b < a); } - -template -inline bool operator>=(const concurrent_vector &a, const concurrent_vector &b) -{ return !(a < b); } - -template -inline void swap(concurrent_vector &a, concurrent_vector &b) -{ a.swap( b ); } - -} // namespace tbb - -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && defined(_Wp64) - #pragma warning (pop) -#endif // warning 4267 is back - -#endif /* __TBB_concurrent_vector_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/enumerable_thread_specific.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/enumerable_thread_specific.h deleted file mode 100644 index fd1588614b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/enumerable_thread_specific.h +++ /dev/null @@ -1,576 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_enumerable_thread_specific_H -#define __TBB_enumerable_thread_specific_H - -#include "concurrent_vector.h" -#include "cache_aligned_allocator.h" - -#if _WIN32||_WIN64 -#include -#else -#include -#endif - -namespace tbb { - - //! enum for selecting between single key and key-per-instance versions - enum ets_key_usage_type { ets_single_key, ets_key_per_instance }; - - //! @cond - namespace internal { - - //! Random access iterator for traversing the thread local copies. - template< typename Container, typename Value > - class enumerable_thread_specific_iterator -#if defined(_WIN64) && defined(_MSC_VER) - // Ensure that Microsoft's internal template function _Val_type works correctly. - : public std::iterator -#endif /* defined(_WIN64) && defined(_MSC_VER) */ - { - //! current position in the concurrent_vector - - Container *my_container; - typename Container::size_type my_index; - mutable Value *my_value; - - template - friend enumerable_thread_specific_iterator operator+( ptrdiff_t offset, - const enumerable_thread_specific_iterator& v ); - - template - friend bool operator==( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ); - - template - friend bool operator<( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ); - - template - friend ptrdiff_t operator-( const enumerable_thread_specific_iterator& i, const enumerable_thread_specific_iterator& j ); - - template - friend class enumerable_thread_specific_iterator; - - public: - - enumerable_thread_specific_iterator( const Container &container, typename Container::size_type index ) : - my_container(&const_cast(container)), my_index(index), my_value(NULL) {} - - //! Default constructor - enumerable_thread_specific_iterator() : my_container(NULL), my_index(0), my_value(NULL) {} - - template - enumerable_thread_specific_iterator( const enumerable_thread_specific_iterator& other ) : - my_container( other.my_container ), my_index( other.my_index), my_value( const_cast(other.my_value) ) {} - - enumerable_thread_specific_iterator operator+( ptrdiff_t offset ) const { - return enumerable_thread_specific_iterator(*my_container, my_index + offset); - } - - enumerable_thread_specific_iterator &operator+=( ptrdiff_t offset ) { - my_index += offset; - my_value = NULL; - return *this; - } - - enumerable_thread_specific_iterator operator-( ptrdiff_t offset ) const { - return enumerable_thread_specific_iterator( *my_container, my_index-offset ); - } - - enumerable_thread_specific_iterator &operator-=( ptrdiff_t offset ) { - my_index -= offset; - my_value = NULL; - return *this; - } - - Value& operator*() const { - Value* value = my_value; - if( !value ) { - value = my_value = &(*my_container)[my_index].value; - } - __TBB_ASSERT( value==&(*my_container)[my_index].value, "corrupt cache" ); - return *value; - } - - Value& operator[]( ptrdiff_t k ) const { - return (*my_container)[my_index + k].value; - } - - Value* operator->() const {return &operator*();} - - enumerable_thread_specific_iterator& operator++() { - ++my_index; - my_value = NULL; - return *this; - } - - enumerable_thread_specific_iterator& operator--() { - --my_index; - my_value = NULL; - return *this; - } - - //! Post increment - enumerable_thread_specific_iterator operator++(int) { - enumerable_thread_specific_iterator result = *this; - ++my_index; - my_value = NULL; - return result; - } - - //! Post decrement - enumerable_thread_specific_iterator operator--(int) { - enumerable_thread_specific_iterator result = *this; - --my_index; - my_value = NULL; - return result; - } - - // STL support - typedef ptrdiff_t difference_type; - typedef Value value_type; - typedef Value* pointer; - typedef Value& reference; - typedef std::random_access_iterator_tag iterator_category; - }; - - template - enumerable_thread_specific_iterator operator+( ptrdiff_t offset, - const enumerable_thread_specific_iterator& v ) { - return enumerable_thread_specific_iterator( v.my_container, v.my_index + offset ); - } - - template - bool operator==( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ) { - return i.my_index==j.my_index && i.my_container == j.my_container; - } - - template - bool operator!=( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ) { - return !(i==j); - } - - template - bool operator<( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ) { - return i.my_index - bool operator>( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ) { - return j - bool operator>=( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ) { - return !(i - bool operator<=( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ) { - return !(j - ptrdiff_t operator-( const enumerable_thread_specific_iterator& i, - const enumerable_thread_specific_iterator& j ) { - return i.my_index-j.my_index; - } - - template - class segmented_iterator -#if defined(_WIN64) && defined(_MSC_VER) - : public std::iterator -#endif - { - template - friend bool operator==(const segmented_iterator& i, const segmented_iterator& j); - - template - friend bool operator!=(const segmented_iterator& i, const segmented_iterator& j); - - template - friend class segmented_iterator; - - public: - - segmented_iterator() {my_segcont = NULL;} - - segmented_iterator( const SegmentedContainer& _segmented_container ) : - my_segcont(const_cast(&_segmented_container)), - outer_iter(my_segcont->end()) { } - - ~segmented_iterator() {} - - typedef typename SegmentedContainer::iterator outer_iterator; - typedef typename SegmentedContainer::value_type InnerContainer; - typedef typename InnerContainer::iterator inner_iterator; - - // STL support - typedef ptrdiff_t difference_type; - typedef Value value_type; - typedef typename SegmentedContainer::size_type size_type; - typedef Value* pointer; - typedef Value& reference; - typedef std::input_iterator_tag iterator_category; - - // Copy Constructor - template - segmented_iterator(const segmented_iterator& other) : - my_segcont(other.my_segcont), - outer_iter(other.outer_iter), - // can we assign a default-constructed iterator to inner if we're at the end? - inner_iter(other.inner_iter) - {} - - // assignment - template - segmented_iterator& operator=( const segmented_iterator& other) { - if(this != &other) { - my_segcont = other.my_segcont; - outer_iter = other.outer_iter; - if(outer_iter != my_segcont->end()) inner_iter = other.inner_iter; - } - return *this; - } - - // allow assignment of outer iterator to segmented iterator. Once it is - // assigned, move forward until a non-empty inner container is found or - // the end of the outer container is reached. - segmented_iterator& operator=(const outer_iterator& new_outer_iter) { - __TBB_ASSERT(my_segcont != NULL, NULL); - // check that this iterator points to something inside the segmented container - for(outer_iter = new_outer_iter ;outer_iter!=my_segcont->end(); ++outer_iter) { - if( !outer_iter->empty() ) { - inner_iter = outer_iter->begin(); - break; - } - } - return *this; - } - - // pre-increment - segmented_iterator& operator++() { - advance_me(); - return *this; - } - - // post-increment - segmented_iterator operator++(int) { - segmented_iterator tmp = *this; - operator++(); - return tmp; - } - - bool operator==(const outer_iterator& other_outer) const { - __TBB_ASSERT(my_segcont != NULL, NULL); - return (outer_iter == other_outer && - (outer_iter == my_segcont->end() || inner_iter == outer_iter->begin())); - } - - bool operator!=(const outer_iterator& other_outer) const { - return !operator==(other_outer); - - } - - // (i)* RHS - reference operator*() const { - __TBB_ASSERT(my_segcont != NULL, NULL); - __TBB_ASSERT(outer_iter != my_segcont->end(), "Dereferencing a pointer at end of container"); - __TBB_ASSERT(inner_iter != outer_iter->end(), NULL); // should never happen - return *inner_iter; - } - - // i-> - pointer operator->() const { return &operator*();} - - private: - SegmentedContainer* my_segcont; - outer_iterator outer_iter; - inner_iterator inner_iter; - - void advance_me() { - __TBB_ASSERT(my_segcont != NULL, NULL); - __TBB_ASSERT(outer_iter != my_segcont->end(), NULL); // not true if there are no inner containers - __TBB_ASSERT(inner_iter != outer_iter->end(), NULL); // not true if the inner containers are all empty. - ++inner_iter; - while(inner_iter == outer_iter->end() && ++outer_iter != my_segcont->end()) { - inner_iter = outer_iter->begin(); - } - } - }; // segmented_iterator - - template - bool operator==( const segmented_iterator& i, - const segmented_iterator& j ) { - if(i.my_segcont != j.my_segcont) return false; - if(i.my_segcont == NULL) return true; - if(i.outer_iter != j.outer_iter) return false; - if(i.outer_iter == i.my_segcont->end()) return true; - return i.inner_iter == j.inner_iter; - } - - // != - template - bool operator!=( const segmented_iterator& i, - const segmented_iterator& j ) { - return !(i==j); - } - - //! The internal key manage used when using a single key across instances - struct tls_single_key_manager_v4 { - typedef tbb::concurrent_vector::size_type tls_key_t; - static void __TBB_EXPORTED_FUNC create_key( tls_key_t &k); - static void __TBB_EXPORTED_FUNC destroy_key( tls_key_t &k ); - static void __TBB_EXPORTED_FUNC set_tls( tls_key_t &k, void * value ); - static void * __TBB_EXPORTED_FUNC get_tls( tls_key_t &k ); - }; - - // empty template for following specializations - template - struct tls_manager {}; - - //! Struct that uses the internal key manager - template <> - struct tls_manager { - typedef tls_single_key_manager_v4::tls_key_t tls_key_t; - static inline void create_key( tls_key_t &k) { internal::tls_single_key_manager_v4::create_key(k); } - static inline void destroy_key( tls_key_t &k ) { internal::tls_single_key_manager_v4::destroy_key(k); } - static inline void set_tls( tls_key_t &k, void * value ) { - internal::tls_single_key_manager_v4::set_tls(k, value); - } - static inline void * get_tls( tls_key_t &k ) { return internal::tls_single_key_manager_v4::get_tls(k); } - }; - - - //! Struct to use native TLS support directly - template <> - struct tls_manager { -#if _WIN32||_WIN64 - typedef DWORD tls_key_t; - static inline void create_key( tls_key_t &k) { k = TlsAlloc(); } - static inline void destroy_key( tls_key_t &k) { TlsFree(k); } - static inline void set_tls( tls_key_t &k, void * value) { TlsSetValue(k, (LPVOID)value); } - static inline void * get_tls( tls_key_t &k ) { return (void *)TlsGetValue(k); } -#else - typedef pthread_key_t tls_key_t; - static inline void create_key( tls_key_t &k) { pthread_key_create(&k, NULL); } - static inline void destroy_key( tls_key_t &k) { pthread_key_delete(k); } - static inline void set_tls( tls_key_t &k, void * value) { pthread_setspecific(k, value); } - static inline void * get_tls( tls_key_t &k ) { return pthread_getspecific(k); } -#endif - }; - - } // namespace internal - //! @endcond - - //! The thread local class template - template , - ets_key_usage_type ETS_key_type=ets_single_key > - class enumerable_thread_specific { - - typedef internal::tls_manager< ETS_key_type > my_tls_manager; - - //! The padded elements; padded to avoid false sharing - struct padded_element { - T value; - char padding[ ( (sizeof(T) - 1) / internal::NFS_MaxLineSize + 1 ) * internal::NFS_MaxLineSize - sizeof(T) ]; - padded_element(const T &v) : value(v) {} - padded_element() {} - }; - - //! A generic range, used to create range objects from the iterators - template - class generic_range_type: public blocked_range { - public: - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef I iterator; - typedef ptrdiff_t difference_type; - generic_range_type( I begin_, I end_, size_t grainsize = 1) : blocked_range(begin_,end_,grainsize) {} - template - generic_range_type( const generic_range_type& r) : blocked_range(r.begin(),r.end(),r.grainsize()) {} - generic_range_type( generic_range_type& r, split ) : blocked_range(r,split()) {} - }; - - typedef typename Allocator::template rebind< padded_element >::other padded_allocator_type; - typedef tbb::concurrent_vector< padded_element, padded_allocator_type > internal_collection_type; - - typename my_tls_manager::tls_key_t my_key; - padded_element my_exemplar; - internal_collection_type my_locals; - - public: - - //! Basic types - typedef Allocator allocator_type; - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef T* pointer; - typedef typename internal_collection_type::size_type size_type; - typedef typename internal_collection_type::difference_type difference_type; - - // Iterator types - typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator; - typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator; - - // Parallel range types - typedef generic_range_type< iterator > range_type; - typedef generic_range_type< const_iterator > const_range_type; - - //! Default constructor, which leads to default construction of local copies - enumerable_thread_specific() { - my_tls_manager::create_key(my_key); - } - - //! Constuction with exemplar, which leads to copy construction of local copies - enumerable_thread_specific(const T &_exemplar) : my_exemplar(_exemplar) { - my_tls_manager::create_key(my_key); - } - - //! Destructor - ~enumerable_thread_specific() { - my_tls_manager::destroy_key(my_key); - } - - - //! Returns reference to calling thread's local copy, creating one if necessary - reference local() { - if ( pointer local_ptr = static_cast< pointer >(my_tls_manager::get_tls(my_key)) ) { - return *local_ptr; - } else { - typename internal_collection_type::size_type local_index = my_locals.push_back( my_exemplar ); - reference local_ref = my_locals[local_index].value; - my_tls_manager::set_tls( my_key, static_cast(&local_ref) ); - return local_ref; - } - } - - //! Get the number of local copies - size_type size() const { return my_locals.size(); } - - //! true if there have been no local copies created - bool empty() const { return my_locals.empty(); } - - //! begin iterator - iterator begin() { return iterator( my_locals, 0 ); } - //! end iterator - iterator end() { return iterator(my_locals, my_locals.size() ); } - - //! begin const iterator - const_iterator begin() const { return const_iterator(my_locals, 0); } - - //! end const iterator - const_iterator end() const { return const_iterator(my_locals, my_locals.size()); } - - //! Get range for parallel algorithms - range_type range( size_t grainsize=1 ) { return range_type( begin(), end(), grainsize ); } - - //! Get const range for parallel algorithms - const_range_type range( size_t grainsize=1 ) const { return const_range_type( begin(), end(), grainsize ); } - - //! Destroys local copies - void clear() { - my_locals.clear(); - my_tls_manager::destroy_key(my_key); - my_tls_manager::create_key(my_key); - } - - }; - - template< typename Container > - class flattened2d { - - // This intermediate typedef is to address issues with VC7.1 compilers - typedef typename Container::value_type conval_type; - - public: - - //! Basic types - typedef typename conval_type::size_type size_type; - typedef typename conval_type::difference_type difference_type; - typedef typename conval_type::allocator_type allocator_type; - typedef typename conval_type::value_type value_type; - typedef typename conval_type::reference reference; - typedef typename conval_type::const_reference const_reference; - typedef typename conval_type::pointer pointer; - typedef typename conval_type::const_pointer const_pointer; - - typedef typename internal::segmented_iterator iterator; - typedef typename internal::segmented_iterator const_iterator; - - flattened2d( const Container &c, typename Container::const_iterator b, typename Container::const_iterator e ) : - my_container(const_cast(&c)), my_begin(b), my_end(e) { } - - flattened2d( const Container &c ) : - my_container(const_cast(&c)), my_begin(c.begin()), my_end(c.end()) { } - - iterator begin() { return iterator(*my_container) = my_begin; } - iterator end() { return iterator(*my_container) = my_end; } - const_iterator begin() const { return const_iterator(*my_container) = my_begin; } - const_iterator end() const { return const_iterator(*my_container) = my_end; } - - size_type size() const { - size_type tot_size = 0; - for(typename Container::const_iterator i = my_begin; i != my_end; ++i) { - tot_size += i->size(); - } - return tot_size; - } - - private: - - Container *my_container; - typename Container::const_iterator my_begin; - typename Container::const_iterator my_end; - - }; - - template - flattened2d flatten2d(const Container &c, const typename Container::const_iterator b, const typename Container::const_iterator e) { - return flattened2d(c, b, e); - } - - template - flattened2d flatten2d(const Container &c) { - return flattened2d(c); - } - -} // namespace tbb - -#endif diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/ibm_aix51.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/ibm_aix51.h deleted file mode 100644 index 4390115406..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/ibm_aix51.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#define __TBB_WORDSIZE 8 -#define __TBB_BIG_ENDIAN 1 - -#include -#include -#include - -extern "C" { - -int32_t __TBB_machine_cas_32 (volatile void* ptr, int32_t value, int32_t comparand); -int64_t __TBB_machine_cas_64 (volatile void* ptr, int64_t value, int64_t comparand); -#define __TBB_fence_for_acquire() __TBB_machine_flush () -#define __TBB_fence_for_release() __TBB_machine_flush () - -} - -#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cas_32(P,V,C) -#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cas_64(P,V,C) -#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cas_64(P,V,C) -#define __TBB_Yield() sched_yield() diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_common.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_common.h deleted file mode 100644 index 35bff25922..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_common.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#include -#include -#include - -// Definition of __TBB_Yield() -#define __TBB_Yield() sched_yield() - -/* Futex definitions */ -#include - -#if defined(SYS_futex) - -#define __TBB_USE_FUTEX 1 -#include -#include -// Unfortunately, some versions of Linux do not have a header that defines FUTEX_WAIT and FUTEX_WAKE. - -#ifdef FUTEX_WAIT -#define __TBB_FUTEX_WAIT FUTEX_WAIT -#else -#define __TBB_FUTEX_WAIT 0 -#endif - -#ifdef FUTEX_WAKE -#define __TBB_FUTEX_WAKE FUTEX_WAKE -#else -#define __TBB_FUTEX_WAKE 1 -#endif - -#ifndef __TBB_ASSERT -#error machine specific headers must be included after tbb_stddef.h -#endif - -namespace tbb { - -namespace internal { - -inline int futex_wait( void *futex, int comparand ) { - int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAIT,comparand,NULL,NULL,0 ); -#if TBB_USE_ASSERT - int e = errno; - __TBB_ASSERT( r==0||r==EWOULDBLOCK||(r==-1&&(e==EAGAIN||e==EINTR)), "futex_wait failed." ); -#endif /* TBB_USE_ASSERT */ - return r; -} - -inline int futex_wakeup_one( void *futex ) { - int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAKE,1,NULL,NULL,0 ); - __TBB_ASSERT( r==0||r==1, "futex_wakeup_one: more than one thread woken up?" ); - return r; -} - -inline int futex_wakeup_all( void *futex ) { - int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAKE,INT_MAX,NULL,NULL,0 ); - __TBB_ASSERT( r>=0, "futex_wakeup_all: error in waking up threads" ); - return r; -} - -} /* namespace internal */ - -} /* namespace tbb */ - -#endif /* SYS_futex */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_em64t.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_em64t.h deleted file mode 100644 index 9e955d647c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_em64t.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#include "linux_common.h" - -#define __TBB_WORDSIZE 8 -#define __TBB_BIG_ENDIAN 0 - -#define __TBB_fence_for_acquire() __asm__ __volatile__("": : :"memory") -#define __TBB_fence_for_release() __asm__ __volatile__("": : :"memory") - -#define __MACHINE_DECL_ATOMICS(S,T,X) \ -static inline T __TBB_machine_cmpswp##S (volatile void *ptr, T value, T comparand ) \ -{ \ - T result; \ - \ - __asm__ __volatile__("lock\ncmpxchg" X " %2,%1" \ - : "=a"(result), "=m"(*(T *)ptr) \ - : "q"(value), "0"(comparand), "m"(*(T *)ptr) \ - : "memory"); \ - return result; \ -} \ - \ -static inline T __TBB_machine_fetchadd##S(volatile void *ptr, T addend) \ -{ \ - T result; \ - __asm__ __volatile__("lock\nxadd" X " %0,%1" \ - : "=r"(result),"=m"(*(T *)ptr) \ - : "0"(addend), "m"(*(T *)ptr) \ - : "memory"); \ - return result; \ -} \ - \ -static inline T __TBB_machine_fetchstore##S(volatile void *ptr, T value) \ -{ \ - T result; \ - __asm__ __volatile__("lock\nxchg" X " %0,%1" \ - : "=r"(result),"=m"(*(T *)ptr) \ - : "0"(value), "m"(*(T *)ptr) \ - : "memory"); \ - return result; \ -} \ - -__MACHINE_DECL_ATOMICS(1,int8_t,"") -__MACHINE_DECL_ATOMICS(2,int16_t,"") -__MACHINE_DECL_ATOMICS(4,int32_t,"") -__MACHINE_DECL_ATOMICS(8,int64_t,"q") - -static inline int64_t __TBB_machine_lg( uint64_t x ) { - int64_t j; - __asm__ ("bsr %1,%0" : "=r"(j) : "r"(x)); - return j; -} - -static inline void __TBB_machine_or( volatile void *ptr, uint64_t addend ) { - __asm__ __volatile__("lock\norq %1,%0" : "=m"(*(uint64_t *)ptr) : "r"(addend), "m"(*(uint64_t *)ptr) : "memory"); -} - -static inline void __TBB_machine_and( volatile void *ptr, uint64_t addend ) { - __asm__ __volatile__("lock\nandq %1,%0" : "=m"(*(uint64_t *)ptr) : "r"(addend), "m"(*(uint64_t *)ptr) : "memory"); -} - -static inline void __TBB_machine_pause( int32_t delay ) { - for (int32_t i = 0; i < delay; i++) { - __asm__ __volatile__("pause;"); - } - return; -} - -// Machine specific atomic operations - -#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C) -#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C) -#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) -#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) -#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp8(P,V,C) - -#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V) -#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V) -#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V) -#define __TBB_FetchAndAdd8(P,V) __TBB_machine_fetchadd8(P,V) -#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd8(P,V) - -#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V) -#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V) -#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V) -#define __TBB_FetchAndStore8(P,V) __TBB_machine_fetchstore8(P,V) -#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore8(P,V) - -#define __TBB_Store8(P,V) (*P = V) -#define __TBB_Load8(P) (*P) - -#define __TBB_AtomicOR(P,V) __TBB_machine_or(P,V) -#define __TBB_AtomicAND(P,V) __TBB_machine_and(P,V) - -// Definition of other functions -#define __TBB_Pause(V) __TBB_machine_pause(V) -#define __TBB_Log2(V) __TBB_machine_lg(V) - -// Special atomic functions -#define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAddW(P,V) -#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAddW(P,1) -#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAddW(P,-1) - -// Definition of Lock functions -#undef __TBB_TryLockByte -#undef __TBB_LockByte - -#define __TBB_cpuid -static inline void __TBB_x86_cpuid( int32_t buffer[4], int32_t mode ) { - // NOTE: gcc sometimes fails to compile the following asm. But icc always succeeds. - __asm__ ("cpuid" : "=a"(buffer[0]), - "=b"(buffer[1]), - "=c"(buffer[2]), - "=d"(buffer[3]) : "0"(mode) : "memory" ); -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_ia32.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_ia32.h deleted file mode 100644 index b9030f9f22..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_ia32.h +++ /dev/null @@ -1,264 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#include "linux_common.h" - -#define __TBB_WORDSIZE 4 -#define __TBB_BIG_ENDIAN 0 - - -#define __MACHINE_DECL_ATOMICS(S,T,X) \ -static inline T __TBB_machine_cmpswp##S (volatile void *ptr, T value, T comparand ) \ -{ \ - T result; \ - \ - __asm__ __volatile__("lock\ncmpxchg" X " %2,%1" \ - : "=a"(result), "=m"(*(T *)ptr) \ - : "q"(value), "0"(comparand), "m"(*(T *)ptr) \ - : "memory"); \ - return result; \ -} \ - \ -static inline T __TBB_machine_fetchadd##S(volatile void *ptr, T addend) \ -{ \ - T result; \ - __asm__ __volatile__("lock\nxadd" X " %0,%1" \ - : "=r"(result), "=m"(*(T *)ptr) \ - : "0"(addend), "m"(*(T *)ptr) \ - : "memory"); \ - return result; \ -} \ - \ -static inline T __TBB_machine_fetchstore##S(volatile void *ptr, T value) \ -{ \ - T result; \ - __asm__ __volatile__("lock\nxchg" X " %0,%1" \ - : "=r"(result), "=m"(*(T *)ptr) \ - : "0"(value), "m"(*(T *)ptr) \ - : "memory"); \ - return result; \ -} \ - -__MACHINE_DECL_ATOMICS(1,int8_t,"") -__MACHINE_DECL_ATOMICS(2,int16_t,"") -__MACHINE_DECL_ATOMICS(4,int32_t,"l") - -static inline int64_t __TBB_machine_cmpswp8 (volatile void *ptr, int64_t value, int64_t comparand ) -{ - int64_t result; -#if __PIC__ - /* compiling position-independent code */ - // EBX register preserved for compliancy with position-independent code rules on IA32 - __asm__ __volatile__ ( - "pushl %%ebx\n\t" - "movl (%%ecx),%%ebx\n\t" - "movl 4(%%ecx),%%ecx\n\t" - "lock\n\t cmpxchg8b %1\n\t" - "popl %%ebx" - : "=A"(result), "=m"(*(int64_t *)ptr) - : "m"(*(int64_t *)ptr) - , "0"(comparand) - , "c"(&value) - : "memory", "esp" -#if __INTEL_COMPILER - ,"ebx" -#endif - ); -#else /* !__PIC__ */ - union { - int64_t i64; - int32_t i32[2]; - }; - i64 = value; - __asm__ __volatile__ ( - "lock\n\t cmpxchg8b %1\n\t" - : "=A"(result), "=m"(*(int64_t *)ptr) - : "m"(*(int64_t *)ptr) - , "0"(comparand) - , "b"(i32[0]), "c"(i32[1]) - : "memory" - ); -#endif /* __PIC__ */ - return result; -} - -static inline int32_t __TBB_machine_lg( uint32_t x ) { - int32_t j; - __asm__ ("bsr %1,%0" : "=r"(j) : "r"(x)); - return j; -} - -static inline void __TBB_machine_or( volatile void *ptr, uint32_t addend ) { - __asm__ __volatile__("lock\norl %1,%0" : "=m"(*(uint32_t *)ptr) : "r"(addend), "m"(*(uint32_t *)ptr) : "memory"); -} - -static inline void __TBB_machine_and( volatile void *ptr, uint32_t addend ) { - __asm__ __volatile__("lock\nandl %1,%0" : "=m"(*(uint32_t *)ptr) : "r"(addend), "m"(*(uint32_t *)ptr) : "memory"); -} - -static inline void __TBB_machine_pause( int32_t delay ) { - for (int32_t i = 0; i < delay; i++) { - __asm__ __volatile__("pause;"); - } - return; -} - -static inline int64_t __TBB_machine_load8 (const volatile void *ptr) { - int64_t result; - if( ((uint32_t)ptr&7u)==0 ) { - // Aligned load - __asm__ __volatile__ ( "fildq %1\n\t" - "fistpq %0" : "=m"(result) : "m"(*(uint64_t *)ptr) : "memory" ); - } else { - // Unaligned load - result = __TBB_machine_cmpswp8((void*)ptr,0,0); - } - return result; -} - -//! Handles misaligned 8-byte store -/** Defined in tbb_misc.cpp */ -extern "C" void __TBB_machine_store8_slow( volatile void *ptr, int64_t value ); -extern "C" void __TBB_machine_store8_slow_perf_warning( volatile void *ptr ); - -static inline void __TBB_machine_store8(volatile void *ptr, int64_t value) { - if( ((uint32_t)ptr&7u)==0 ) { - // Aligned store - __asm__ __volatile__ ( "fildq %1\n\t" - "fistpq %0" : "=m"(*(int64_t *)ptr) : "m"(value) : "memory" ); - } else { - // Unaligned store -#if TBB_USE_PERFORMANCE_WARNINGS - __TBB_machine_store8_slow_perf_warning(ptr); -#endif /* TBB_USE_PERFORMANCE_WARNINGS */ - __TBB_machine_store8_slow(ptr,value); - } -} - -template -struct __TBB_machine_load_store { - static inline T load_with_acquire(const volatile T& location) { - T to_return = location; - __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards - return to_return; - } - - static inline void store_with_release(volatile T &location, T value) { - __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards - location = value; - } -}; - -template -struct __TBB_machine_load_store { - static inline T load_with_acquire(const volatile T& location) { - T to_return = __TBB_machine_load8((volatile void *)&location); - __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards - return to_return; - } - - static inline void store_with_release(volatile T &location, T value) { - __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating downwards - __TBB_machine_store8((volatile void *)&location,(int64_t)value); - } -}; - -template -inline T __TBB_machine_load_with_acquire(const volatile T &location) { - return __TBB_machine_load_store::load_with_acquire(location); -} - -template -inline void __TBB_machine_store_with_release(volatile T &location, V value) { - __TBB_machine_load_store::store_with_release(location,value); -} - -#define __TBB_load_with_acquire(L) __TBB_machine_load_with_acquire((L)) -#define __TBB_store_with_release(L,V) __TBB_machine_store_with_release((L),(V)) - -// Machine specific atomic operations - -#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C) -#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C) -#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) -#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) -#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C) - -#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V) -#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V) -#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V) -#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd4(P,V) - -#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V) -#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V) -#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V) -#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore4(P,V) - -#define __TBB_Store8(P,V) __TBB_machine_store8(P,V) -#define __TBB_Load8(P) __TBB_machine_load8(P) - -#define __TBB_AtomicOR(P,V) __TBB_machine_or(P,V) -#define __TBB_AtomicAND(P,V) __TBB_machine_and(P,V) - - -// Those we chose not to implement (they will be implemented generically using CMPSWP8) -#undef __TBB_FetchAndAdd8 -#undef __TBB_FetchAndStore8 - -// Definition of other functions -#define __TBB_Pause(V) __TBB_machine_pause(V) -#define __TBB_Log2(V) __TBB_machine_lg(V) - -// Special atomic functions -#define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAddW(P,V) -#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAddW(P,1) -#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAddW(P,-1) - -// Definition of Lock functions -#undef __TBB_TryLockByte -#undef __TBB_LockByte - -#define __TBB_cpuid -static inline void __TBB_x86_cpuid( int32_t buffer[4], int32_t mode ) { - // EBX register saved for compliancy with position-independent code (PIC) rules on IA32 - __asm__ ("pushl %%ebx\n\t" - "cpuid\n\t" - "movl %%ebx,%1\n\t" - "popl %%ebx" - : "=a"(buffer[0]), - "=S"(buffer[1]), - "=c"(buffer[2]), - "=d"(buffer[3]) - : "0"(mode) - : "memory" ); -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_itanium.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_itanium.h deleted file mode 100644 index cc4ae75f50..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/linux_itanium.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#include "linux_common.h" -#include - -#define __TBB_WORDSIZE 8 -#define __TBB_BIG_ENDIAN 0 -#define __TBB_DECL_FENCED_ATOMICS 1 - -// Most of the functions will be in a .s file - -extern "C" { - int8_t __TBB_machine_cmpswp1__TBB_full_fence (volatile void *ptr, int8_t value, int8_t comparand); - int8_t __TBB_machine_fetchadd1__TBB_full_fence (volatile void *ptr, int8_t addend); - int8_t __TBB_machine_fetchadd1acquire(volatile void *ptr, int8_t addend); - int8_t __TBB_machine_fetchadd1release(volatile void *ptr, int8_t addend); - int8_t __TBB_machine_fetchstore1acquire(volatile void *ptr, int8_t value); - int8_t __TBB_machine_fetchstore1release(volatile void *ptr, int8_t value); - - int16_t __TBB_machine_cmpswp2__TBB_full_fence (volatile void *ptr, int16_t value, int16_t comparand); - int16_t __TBB_machine_fetchadd2__TBB_full_fence (volatile void *ptr, int16_t addend); - int16_t __TBB_machine_fetchadd2acquire(volatile void *ptr, int16_t addend); - int16_t __TBB_machine_fetchadd2release(volatile void *ptr, int16_t addend); - int16_t __TBB_machine_fetchstore2acquire(volatile void *ptr, int16_t value); - int16_t __TBB_machine_fetchstore2release(volatile void *ptr, int16_t value); - - int32_t __TBB_machine_fetchstore4__TBB_full_fence (volatile void *ptr, int32_t value); - int32_t __TBB_machine_fetchstore4acquire(volatile void *ptr, int32_t value); - int32_t __TBB_machine_fetchstore4release(volatile void *ptr, int32_t value); - int32_t __TBB_machine_fetchadd4acquire(volatile void *ptr, int32_t addend); - int32_t __TBB_machine_fetchadd4release(volatile void *ptr, int32_t addend); - - int64_t __TBB_machine_cmpswp8__TBB_full_fence (volatile void *ptr, int64_t value, int64_t comparand); - int64_t __TBB_machine_fetchstore8__TBB_full_fence (volatile void *ptr, int64_t value); - int64_t __TBB_machine_fetchstore8acquire(volatile void *ptr, int64_t value); - int64_t __TBB_machine_fetchstore8release(volatile void *ptr, int64_t value); - int64_t __TBB_machine_fetchadd8acquire(volatile void *ptr, int64_t addend); - int64_t __TBB_machine_fetchadd8release(volatile void *ptr, int64_t addend); - - int8_t __TBB_machine_cmpswp1acquire(volatile void *ptr, int8_t value, int8_t comparand); - int8_t __TBB_machine_cmpswp1release(volatile void *ptr, int8_t value, int8_t comparand); - int8_t __TBB_machine_fetchstore1__TBB_full_fence (volatile void *ptr, int8_t value); - - int16_t __TBB_machine_cmpswp2acquire(volatile void *ptr, int16_t value, int16_t comparand); - int16_t __TBB_machine_cmpswp2release(volatile void *ptr, int16_t value, int16_t comparand); - int16_t __TBB_machine_fetchstore2__TBB_full_fence (volatile void *ptr, int16_t value); - - int32_t __TBB_machine_cmpswp4__TBB_full_fence (volatile void *ptr, int32_t value, int32_t comparand); - int32_t __TBB_machine_cmpswp4acquire(volatile void *ptr, int32_t value, int32_t comparand); - int32_t __TBB_machine_cmpswp4release(volatile void *ptr, int32_t value, int32_t comparand); - int32_t __TBB_machine_fetchadd4__TBB_full_fence (volatile void *ptr, int32_t value); - - int64_t __TBB_machine_cmpswp8acquire(volatile void *ptr, int64_t value, int64_t comparand); - int64_t __TBB_machine_cmpswp8release(volatile void *ptr, int64_t value, int64_t comparand); - int64_t __TBB_machine_fetchadd8__TBB_full_fence (volatile void *ptr, int64_t value); - - int64_t __TBB_machine_lg(uint64_t value); - void __TBB_machine_pause(int32_t delay); - bool __TBB_machine_trylockbyte( volatile unsigned char &ptr ); - int64_t __TBB_machine_lockbyte( volatile unsigned char &ptr ); - - //! Retrieves the current RSE backing store pointer. IA64 specific. - void* __TBB_get_bsp(); -} - -#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1__TBB_full_fence(P,V,C) -#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2__TBB_full_fence(P,V,C) - -#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1__TBB_full_fence(P,V) -#define __TBB_FetchAndAdd1acquire(P,V) __TBB_machine_fetchadd1acquire(P,V) -#define __TBB_FetchAndAdd1release(P,V) __TBB_machine_fetchadd1release(P,V) -#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2__TBB_full_fence(P,V) -#define __TBB_FetchAndAdd2acquire(P,V) __TBB_machine_fetchadd2acquire(P,V) -#define __TBB_FetchAndAdd2release(P,V) __TBB_machine_fetchadd2release(P,V) -#define __TBB_FetchAndAdd4acquire(P,V) __TBB_machine_fetchadd4acquire(P,V) -#define __TBB_FetchAndAdd4release(P,V) __TBB_machine_fetchadd4release(P,V) -#define __TBB_FetchAndAdd8acquire(P,V) __TBB_machine_fetchadd8acquire(P,V) -#define __TBB_FetchAndAdd8release(P,V) __TBB_machine_fetchadd8release(P,V) - -#define __TBB_FetchAndStore1acquire(P,V) __TBB_machine_fetchstore1acquire(P,V) -#define __TBB_FetchAndStore1release(P,V) __TBB_machine_fetchstore1release(P,V) -#define __TBB_FetchAndStore2acquire(P,V) __TBB_machine_fetchstore2acquire(P,V) -#define __TBB_FetchAndStore2release(P,V) __TBB_machine_fetchstore2release(P,V) -#define __TBB_FetchAndStore4acquire(P,V) __TBB_machine_fetchstore4acquire(P,V) -#define __TBB_FetchAndStore4release(P,V) __TBB_machine_fetchstore4release(P,V) -#define __TBB_FetchAndStore8acquire(P,V) __TBB_machine_fetchstore8acquire(P,V) -#define __TBB_FetchAndStore8release(P,V) __TBB_machine_fetchstore8release(P,V) - -#define __TBB_CompareAndSwap1acquire(P,V,C) __TBB_machine_cmpswp1acquire(P,V,C) -#define __TBB_CompareAndSwap1release(P,V,C) __TBB_machine_cmpswp1release(P,V,C) -#define __TBB_CompareAndSwap2acquire(P,V,C) __TBB_machine_cmpswp2acquire(P,V,C) -#define __TBB_CompareAndSwap2release(P,V,C) __TBB_machine_cmpswp2release(P,V,C) -#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4__TBB_full_fence(P,V,C) -#define __TBB_CompareAndSwap4acquire(P,V,C) __TBB_machine_cmpswp4acquire(P,V,C) -#define __TBB_CompareAndSwap4release(P,V,C) __TBB_machine_cmpswp4release(P,V,C) -#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8__TBB_full_fence(P,V,C) -#define __TBB_CompareAndSwap8acquire(P,V,C) __TBB_machine_cmpswp8acquire(P,V,C) -#define __TBB_CompareAndSwap8release(P,V,C) __TBB_machine_cmpswp8release(P,V,C) - -#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4__TBB_full_fence(P,V) -#define __TBB_FetchAndAdd8(P,V) __TBB_machine_fetchadd8__TBB_full_fence(P,V) - -#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1__TBB_full_fence(P,V) -#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2__TBB_full_fence(P,V) -#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4__TBB_full_fence(P,V) -#define __TBB_FetchAndStore8(P,V) __TBB_machine_fetchstore8__TBB_full_fence(P,V) - -#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAdd8acquire(P,1) -#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAdd8release(P,-1) - -#ifndef __INTEL_COMPILER -/* Even though GCC imbues volatile loads with acquire semantics, - it sometimes moves loads over the acquire fence. The - fences defined here stop such incorrect code motion. */ -#define __TBB_fence_for_release() __asm__ __volatile__("": : :"memory") -#define __TBB_fence_for_acquire() __asm__ __volatile__("": : :"memory") -#endif - -// Special atomic functions -#define __TBB_CompareAndSwapW(P,V,C) __TBB_CompareAndSwap8(P,V,C) -#define __TBB_FetchAndStoreW(P,V) __TBB_FetchAndStore8(P,V) -#define __TBB_FetchAndAddW(P,V) __TBB_FetchAndAdd8(P,V) -#define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAdd8release(P,V) - -// Not needed -#undef __TBB_Store8 -#undef __TBB_Load8 - -// Definition of Lock functions -#define __TBB_TryLockByte(P) __TBB_machine_trylockbyte(P) -#define __TBB_LockByte(P) __TBB_machine_lockbyte(P) - -// Definition of other utility functions -#define __TBB_Pause(V) __TBB_machine_pause(V) -#define __TBB_Log2(V) __TBB_machine_lg(V) - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/mac_ppc.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/mac_ppc.h deleted file mode 100644 index a950137ac1..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/mac_ppc.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#include -#include - -#include // sched_yield - -inline int32_t __TBB_machine_cmpswp4 (volatile void *ptr, int32_t value, int32_t comparand ) -{ - int32_t result; - - __asm__ __volatile__("sync\n" - "0: lwarx %0,0,%2\n\t" /* load w/ reservation */ - "cmpw %0,%4\n\t" /* compare against comparand */ - "bne- 1f\n\t" /* exit if not same */ - "stwcx. %3,0,%2\n\t" /* store new_value */ - "bne- 0b\n" /* retry if reservation lost */ - "1: sync" /* the exit */ - : "=&r"(result), "=m"(* (int32_t*) ptr) - : "r"(ptr), "r"(value), "r"(comparand), "m"(* (int32_t*) ptr) - : "cr0"); - return result; -} - -inline int64_t __TBB_machine_cmpswp8 (volatile void *ptr, int64_t value, int64_t comparand ) -{ - int64_t result; - __asm__ __volatile__("sync\n" - "0: ldarx %0,0,%2\n\t" /* load w/ reservation */ - "cmpd %0,%4\n\t" /* compare against comparand */ - "bne- 1f\n\t" /* exit if not same */ - "stdcx. %3,0,%2\n\t" /* store new_value */ - "bne- 0b\n" /* retry if reservation lost */ - "1: sync" /* the exit */ - : "=&b"(result), "=m"(* (int64_t*) ptr) - : "r"(ptr), "r"(value), "r"(comparand), "m"(* (int64_t*) ptr) - : "cr0"); - return result; -} - -#define __TBB_BIG_ENDIAN 1 - -#if defined(powerpc64) || defined(__powerpc64__) || defined(__ppc64__) -#define __TBB_WORDSIZE 8 -#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp8(P,V,C) -#else -#define __TBB_WORDSIZE 4 -#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C) -#endif - -#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) -#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) -#define __TBB_Yield() sched_yield() -#define __TBB_fence_for_acquire() __asm__ __volatile__("sync": : :"memory") -#define __TBB_fence_for_release() __asm__ __volatile__("sync": : :"memory") diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_em64t.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_em64t.h deleted file mode 100644 index 7a63f7f7d7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_em64t.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#include -#if !defined(__INTEL_COMPILER) -#pragma intrinsic(_InterlockedOr64) -#pragma intrinsic(_InterlockedAnd64) -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedCompareExchange64) -#pragma intrinsic(_InterlockedExchangeAdd) -#pragma intrinsic(_InterlockedExchangeAdd64) -#pragma intrinsic(_InterlockedExchange) -#pragma intrinsic(_InterlockedExchange64) -#endif /* !defined(__INTEL_COMPILER) */ - -#if defined(__INTEL_COMPILER) -#define __TBB_fence_for_acquire() __asm { __asm nop } -#define __TBB_fence_for_release() __asm { __asm nop } -#elif _MSC_VER >= 1300 -extern "C" void _ReadWriteBarrier(); -#pragma intrinsic(_ReadWriteBarrier) -#define __TBB_fence_for_acquire() _ReadWriteBarrier() -#define __TBB_fence_for_release() _ReadWriteBarrier() -#endif - -#define __TBB_WORDSIZE 8 -#define __TBB_BIG_ENDIAN 0 - -// ATTENTION: if you ever change argument types in machine-specific primitives, -// please take care of atomic_word<> specializations in tbb/atomic.h -extern "C" { - __int8 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp1 (volatile void *ptr, __int8 value, __int8 comparand ); - __int8 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd1 (volatile void *ptr, __int8 addend ); - __int8 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore1 (volatile void *ptr, __int8 value ); - __int16 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp2 (volatile void *ptr, __int16 value, __int16 comparand ); - __int16 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd2 (volatile void *ptr, __int16 addend ); - __int16 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore2 (volatile void *ptr, __int16 value ); - void __TBB_EXPORTED_FUNC __TBB_machine_pause (__int32 delay ); -} - - -#if !__INTEL_COMPILER -extern "C" unsigned char _BitScanReverse64( unsigned long* i, unsigned __int64 w ); -#pragma intrinsic(_BitScanReverse64) -#endif - -inline __int64 __TBB_machine_lg( unsigned __int64 i ) { -#if __INTEL_COMPILER - unsigned __int64 j; - __asm - { - bsr rax, i - mov j, rax - } -#else - unsigned long j; - _BitScanReverse64( &j, i ); -#endif - return j; -} - -inline void __TBB_machine_OR( volatile void *operand, intptr_t addend ) { - _InterlockedOr64((__int64*)operand, addend); -} - -inline void __TBB_machine_AND( volatile void *operand, intptr_t addend ) { - _InterlockedAnd64((__int64*)operand, addend); -} - -#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C) -#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C) -#define __TBB_CompareAndSwap4(P,V,C) _InterlockedCompareExchange( (long*) P , V , C ) -#define __TBB_CompareAndSwap8(P,V,C) _InterlockedCompareExchange64( (__int64*) P , V , C ) -#define __TBB_CompareAndSwapW(P,V,C) _InterlockedCompareExchange64( (__int64*) P , V , C ) - -#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V) -#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V) -#define __TBB_FetchAndAdd4(P,V) _InterlockedExchangeAdd((long*) P , V ) -#define __TBB_FetchAndAdd8(P,V) _InterlockedExchangeAdd64((__int64*) P , V ) -#define __TBB_FetchAndAddW(P,V) _InterlockedExchangeAdd64((__int64*) P , V ) - -#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V) -#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V) -#define __TBB_FetchAndStore4(P,V) _InterlockedExchange((long*) P , V ) -#define __TBB_FetchAndStore8(P,V) _InterlockedExchange64((__int64*) P , V ) -#define __TBB_FetchAndStoreW(P,V) _InterlockedExchange64((__int64*) P , V ) - -// Not used if wordsize == 8 -#undef __TBB_Store8 -#undef __TBB_Load8 - -#define __TBB_AtomicOR(P,V) __TBB_machine_OR(P,V) -#define __TBB_AtomicAND(P,V) __TBB_machine_AND(P,V) - -extern "C" __declspec(dllimport) int __stdcall SwitchToThread( void ); -#define __TBB_Yield() SwitchToThread() -#define __TBB_Pause(V) __TBB_machine_pause(V) -#define __TBB_Log2(V) __TBB_machine_lg(V) - -#if !__INTEL_COMPILER -extern "C" void __cpuid( int cpuinfo[4], int mode ); -#pragma intrinsic(__cpuid) -#endif - -#define __TBB_cpuid -inline void __TBB_x86_cpuid( __int32 buffer[4], __int32 mode ) { -#if __INTEL_COMPILER - __asm - { - mov eax,mode - cpuid - mov rdi,buffer - mov [rdi+0],eax - mov [rdi+4],ebx - mov [rdi+8],ecx - mov [rdi+12],edx - } -#else - __cpuid(buffer, mode); -#endif -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32.h deleted file mode 100644 index 1e8735ee0d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#if defined(__INTEL_COMPILER) -#define __TBB_fence_for_acquire() __asm { __asm nop } -#define __TBB_fence_for_release() __asm { __asm nop } -#elif _MSC_VER >= 1300 -extern "C" void _ReadWriteBarrier(); -#pragma intrinsic(_ReadWriteBarrier) -#define __TBB_fence_for_acquire() _ReadWriteBarrier() -#define __TBB_fence_for_release() _ReadWriteBarrier() -#endif - -#define __TBB_WORDSIZE 4 -#define __TBB_BIG_ENDIAN 0 - -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (push) - #pragma warning (disable: 4244 4267) -#endif - -extern "C" { - __int64 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp8 (volatile void *ptr, __int64 value, __int64 comparand ); - __int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd8 (volatile void *ptr, __int64 addend ); - __int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore8 (volatile void *ptr, __int64 value ); - void __TBB_EXPORTED_FUNC __TBB_machine_store8 (volatile void *ptr, __int64 value ); - __int64 __TBB_EXPORTED_FUNC __TBB_machine_load8 (const volatile void *ptr); - bool __TBB_EXPORTED_FUNC __TBB_machine_trylockbyte ( volatile unsigned char& flag ); -} - -template -struct __TBB_machine_load_store { - static inline T load_with_acquire(const volatile T& location) { - T to_return = location; -#ifdef __TBB_fence_for_acquire - __TBB_fence_for_acquire(); -#endif /* __TBB_fence_for_acquire */ - return to_return; - } - - static inline void store_with_release(volatile T &location, T value) { -#ifdef __TBB_fence_for_release - __TBB_fence_for_release(); -#endif /* __TBB_fence_for_release */ - location = value; - } -}; - -template -struct __TBB_machine_load_store { - static inline T load_with_acquire(const volatile T& location) { - return __TBB_machine_load8((volatile void *)&location); - } - - static inline void store_with_release(T &location, T value) { - __TBB_machine_store8((volatile void *)&location,(__int64)value); - } -}; - -template -inline T __TBB_machine_load_with_acquire(const volatile T &location) { - return __TBB_machine_load_store::load_with_acquire(location); -} - -template -inline void __TBB_machine_store_with_release(T& location, V value) { - __TBB_machine_load_store::store_with_release(location,value); -} - -//! Overload that exists solely to avoid /Wp64 warnings. -inline void __TBB_machine_store_with_release(size_t& location, size_t value) { - __TBB_machine_load_store::store_with_release(location,value); -} - -#define __TBB_load_with_acquire(L) __TBB_machine_load_with_acquire((L)) -#define __TBB_store_with_release(L,V) __TBB_machine_store_with_release((L),(V)) - -#define __TBB_DEFINE_ATOMICS(S,T,U,A,C) \ -static inline T __TBB_machine_cmpswp##S ( volatile void * ptr, U value, U comparand ) { \ - T result; \ - volatile T *p = (T *)ptr; \ - __asm \ - { \ - __asm mov edx, p \ - __asm mov C , value \ - __asm mov A , comparand \ - __asm lock cmpxchg [edx], C \ - __asm mov result, A \ - } \ - __TBB_load_with_acquire(*(T *)ptr); \ - return result; \ -} \ -\ -static inline T __TBB_machine_fetchadd##S ( volatile void * ptr, U addend ) { \ - T result; \ - volatile T *p = (T *)ptr; \ - __asm \ - { \ - __asm mov edx, p \ - __asm mov A, addend \ - __asm lock xadd [edx], A \ - __asm mov result, A \ - } \ - __TBB_load_with_acquire(*(T *)ptr); \ - return result; \ -}\ -\ -static inline T __TBB_machine_fetchstore##S ( volatile void * ptr, U value ) { \ - T result; \ - volatile T *p = (T *)ptr; \ - __asm \ - { \ - __asm mov edx, p \ - __asm mov A, value \ - __asm lock xchg [edx], A \ - __asm mov result, A \ - } \ - __TBB_load_with_acquire(*(T *)ptr); \ - return result; \ -} - -__TBB_DEFINE_ATOMICS(1, __int8, __int8, al, cl) -__TBB_DEFINE_ATOMICS(2, __int16, __int16, ax, cx) -__TBB_DEFINE_ATOMICS(4, __int32, ptrdiff_t, eax, ecx) - -static inline __int32 __TBB_machine_lg( unsigned __int64 i ) { - unsigned __int32 j; - __asm - { - bsr eax, i - mov j, eax - } - return j; -} - -static inline void __TBB_machine_OR( volatile void *operand, __int32 addend ) { - __asm - { - mov eax, addend - mov edx, [operand] - lock or [edx], eax - } -} - -static inline void __TBB_machine_AND( volatile void *operand, __int32 addend ) { - __asm - { - mov eax, addend - mov edx, [operand] - lock and [edx], eax - } -} - -static inline void __TBB_machine_pause (__int32 delay ) { - _asm - { - mov eax, delay - L1: - pause - add eax, -1 - jne L1 - } - return; -} - -#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C) -#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C) -#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) -#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) -#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C) - -#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V) -#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V) -#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V) -#define __TBB_FetchAndAdd8(P,V) __TBB_machine_fetchadd8(P,V) -#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd4(P,V) - -#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V) -#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V) -#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V) -#define __TBB_FetchAndStore8(P,V) __TBB_machine_fetchstore8(P,V) -#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore4(P,V) - -// Should define this: -#define __TBB_Store8(P,V) __TBB_machine_store8(P,V) -#define __TBB_Load8(P) __TBB_machine_load8(P) -#define __TBB_AtomicOR(P,V) __TBB_machine_OR(P,V) -#define __TBB_AtomicAND(P,V) __TBB_machine_AND(P,V) - -// Definition of other functions -extern "C" __declspec(dllimport) int __stdcall SwitchToThread( void ); -#define __TBB_Yield() SwitchToThread() -#define __TBB_Pause(V) __TBB_machine_pause(V) -#define __TBB_Log2(V) __TBB_machine_lg(V) - -#define __TBB_TryLockByte(F) __TBB_machine_trylockbyte(F) - -#define __TBB_cpuid -static inline void __TBB_x86_cpuid( __int32 buffer[4], __int32 mode ) { - __asm - { - mov eax,mode - cpuid - mov edi,buffer - mov [edi+0],eax - mov [edi+4],ebx - mov [edi+8],ecx - mov [edi+12],edx - } -} - -#if defined(_MSC_VER)&&_MSC_VER<1400 - static inline void* __TBB_machine_get_current_teb () { - void* pteb; - __asm mov eax, fs:[0x18] - __asm mov pteb, eax - return pteb; - } -#endif - -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif // warnings 4244, 4267 are back diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32_inline.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32_inline.h deleted file mode 100644 index 90095c2fb0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/machine/windows_ia32_inline.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#error Do not include this file directly; include tbb_machine.h instead -#endif - -#include - -#define __TBB_WORDSIZE 4 -#define __TBB_BIG_ENDIAN 0 - -#define DEFINE_ATOMICS(S,T,A,C) \ -static inline T __TBB_machine_cmpswp##S ( volatile void * ptr, T value, T comparand ) { \ - T result; \ - T *p = (T *)ptr; \ - __asm \ - { \ - __asm mov edx, p \ - __asm mov C , value \ - __asm mov A , comparand \ - __asm lock cmpxchg [edx], C \ - __asm mov result, A \ - } \ - return result; \ -} \ -\ -static inline T __TBB_machine_fetchadd##S ( volatile void * ptr, T addend ) { \ - T result; \ - T *p = (T *)ptr; \ - __asm \ - { \ - __asm mov edx, p \ - __asm mov A, addend \ - __asm lock xadd [edx], A \ - __asm mov result, A \ - } \ - return result; \ -}\ -\ -static inline T __TBB_machine_fetchstore##S ( volatile void * ptr, T value ) { \ - T result; \ - T *p = (T *)ptr; \ - __asm \ - { \ - __asm mov edx, p \ - __asm mov A, value \ - __asm lock xchg [edx], A \ - __asm mov result, A \ - } \ - return result; \ -} - -DEFINE_ATOMICS(1, __int8, al, cl) -DEFINE_ATOMICS(2, __int16, ax, cx) -DEFINE_ATOMICS(4, __int32, eax, ecx) - -static inline __int64 __TBB_machine_cmpswp8 (volatile void *ptr, __int64 value, __int64 comparand ) { - __int32 comparand_lo = comparand; - __int32 comparand_hi = comparand>>32; - __int32 value_lo = value; - __int32 value_hi = value>>32; - - __int64 *p = (__int64 *)ptr; - - // EDX:EAX is comparand, ECX:EBX is value, EDX:EAX is result - __asm - { - mov edx, comparand_hi - mov eax, comparand_lo - mov ecx, value_hi - mov ebx, value_lo - lock cmpxchg8b [p] - } -} - - -static inline __int32 __TBB_machine_lg( unsigned __int64 i ) { - unsigned __int32 j; - __asm - { - bsr eax, i - mov j, eax - } - return j; -} - -static inline void __TBB_machine_OR( volatile void *operand, unsigned __int32 addend ) { - __asm - { - mov eax, addend - mov edx, [operand] - lock or [edx], eax - } -} - -static inline void __TBB_machine_AND( volatile void *operand, unsigned __int32 addend ) { - __asm - { - mov eax, addend - mov edx, [operand] - lock and [edx], eax - } -} - -static inline void __TBB_machine_pause (__int32 delay ) { - _asm - { - mov eax, delay - L1: - pause - add eax, -1 - jne L1 - } - return; -} - -#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C) -#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C) -#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) -#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) -#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C) - -#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V) -#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V) -#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V) -#undef __TBB_FetchAndAdd8 -#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd4(P,V) - -#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V) -#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V) -#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V) -#undef __TBB_FetchAndStore8 -#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore4(P,V) - -// Should define this: -#undef __TBB_Store8 -#undef __TBB_Load8 - -#define __TBB_AtomicOR(P,V) __TBB_machine_OR(P,V) -#define __TBB_AtomicAND(P,V) __TBB_machine_AND(P,V) - -// Definition of other functions -#if !defined(_WIN32_WINNT) -extern "C" BOOL WINAPI SwitchToThread(void); -#endif -#define __TBB_Yield() SwitchToThread() -#define __TBB_Pause(V) __TBB_machine_pause(V) -#define __TBB_Log2(V) __TBB_machine_lg(V) - -#define __TBB_cpuid -static inline void __TBB_x86_cpuid( __int32 buffer[4], __int32 mode ) { - __asm - { - mov eax,mode - cpuid - mov edi,buffer - mov [edi+0],eax - mov [edi+4],ebx - mov [edi+8],ecx - mov [edi+12],edx - } -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/mutex.h deleted file mode 100644 index 6308e42d95..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/mutex.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_mutex_H -#define __TBB_mutex_H - -#if _WIN32||_WIN64 -#include -#if !defined(_WIN32_WINNT) -// The following Windows API function is declared explicitly; -// otherwise any user would have to specify /D_WIN32_WINNT=0x0400 -extern "C" BOOL WINAPI TryEnterCriticalSection( LPCRITICAL_SECTION ); -#endif - -#else /* if not _WIN32||_WIN64 */ -#include -namespace tbb { namespace internal { -// Use this internal TBB function to throw an exception -extern void handle_perror( int error_code, const char* what ); -} } //namespaces -#endif /* _WIN32||_WIN64 */ - -#include "tbb_stddef.h" -#include "tbb_profiling.h" - -namespace tbb { - -//! Wrapper around the platform's native reader-writer lock. -/** For testing purposes only. - @ingroup synchronization */ -class mutex { -public: - //! Construct unacquired mutex. - mutex() { -#if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS - internal_construct(); -#else - #if _WIN32||_WIN64 - InitializeCriticalSection(&impl); - #else - int error_code = pthread_mutex_init(&impl,NULL); - if( error_code ) - tbb::internal::handle_perror(error_code,"mutex: pthread_mutex_init failed"); - #endif /* _WIN32||_WIN64*/ -#endif /* TBB_USE_ASSERT */ - }; - - ~mutex() { -#if TBB_USE_ASSERT - internal_destroy(); -#else - #if _WIN32||_WIN64 - DeleteCriticalSection(&impl); - #else - pthread_mutex_destroy(&impl); - - #endif /* _WIN32||_WIN64 */ -#endif /* TBB_USE_ASSERT */ - }; - - class scoped_lock; - friend class scoped_lock; - - //! The scoped locking pattern - /** It helps to avoid the common problem of forgetting to release lock. - It also nicely provides the "node" for queuing locks. */ - class scoped_lock : internal::no_copy { - public: - //! Construct lock that has not acquired a mutex. - scoped_lock() : my_mutex(NULL) {}; - - //! Acquire lock on given mutex. - /** Upon entry, *this should not be in the "have acquired a mutex" state. */ - scoped_lock( mutex& mutex ) { - acquire( mutex ); - } - - //! Release lock (if lock is held). - ~scoped_lock() { - if( my_mutex ) - release(); - } - - //! Acquire lock on given mutex. - void acquire( mutex& mutex ) { -#if TBB_USE_ASSERT - internal_acquire(mutex); -#else - my_mutex = &mutex; - #if _WIN32||_WIN64 - EnterCriticalSection(&mutex.impl); - #else - pthread_mutex_lock(&mutex.impl); - #endif /* _WIN32||_WIN64 */ -#endif /* TBB_USE_ASSERT */ - } - - //! Try acquire lock on given mutex. - bool try_acquire( mutex& mutex ) { -#if TBB_USE_ASSERT - return internal_try_acquire (mutex); -#else - bool result; - #if _WIN32||_WIN64 - result = TryEnterCriticalSection(&mutex.impl)!=0; - #else - result = pthread_mutex_trylock(&mutex.impl)==0; - #endif /* _WIN32||_WIN64 */ - if( result ) - my_mutex = &mutex; - return result; -#endif /* TBB_USE_ASSERT */ - } - - //! Release lock - void release() { -#if TBB_USE_ASSERT - internal_release (); -#else - #if _WIN32||_WIN64 - LeaveCriticalSection(&my_mutex->impl); - #else - pthread_mutex_unlock(&my_mutex->impl); - #endif /* _WIN32||_WIN64 */ - my_mutex = NULL; -#endif /* TBB_USE_ASSERT */ - } - - private: - //! The pointer to the current mutex to work - mutex* my_mutex; - - //! All checks from acquire using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_acquire( mutex& m ); - - //! All checks from try_acquire using mutex.state were moved here - bool __TBB_EXPORTED_METHOD internal_try_acquire( mutex& m ); - - //! All checks from release using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_release(); - }; - - // Mutex traits - static const bool is_rw_mutex = false; - static const bool is_recursive_mutex = false; - static const bool is_fair_mutex = false; - -private: -#if _WIN32||_WIN64 - CRITICAL_SECTION impl; - enum state_t { - INITIALIZED=0x1234, - DESTROYED=0x789A, - HELD=0x56CD - } state; -#else - pthread_mutex_t impl; -#endif /* _WIN32||_WIN64 */ - - //! All checks from mutex constructor using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_construct(); - - //! All checks from mutex destructor using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_destroy(); -}; - -__TBB_DEFINE_PROFILING_SET_NAME(mutex) - -} // namespace tbb - -#endif /* __TBB_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_mutex.h deleted file mode 100644 index 0993f0bebf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_mutex.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_null_mutex_H -#define __TBB_null_mutex_H - -namespace tbb { - -class null_mutex { - //! Deny assignment and copy construction - null_mutex( const null_mutex& ); - void operator=( const null_mutex& ); -public: - class scoped_lock { - public: - scoped_lock() {} - scoped_lock( null_mutex& ) {} - ~scoped_lock() {} - void acquire( null_mutex& ) {} - bool try_acquire( null_mutex& ) { return true; } - void release() {} - }; - - null_mutex() {} - - // Mutex traits - static const bool is_rw_mutex = false; - static const bool is_recursive_mutex = true; - static const bool is_fair_mutex = true; -}; - -} - -#endif /* __TBB_null_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_rw_mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_rw_mutex.h deleted file mode 100644 index d5580524e2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/null_rw_mutex.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_null_rw_mutex_H -#define __TBB_null_rw_mutex_H - -namespace tbb { - -class null_rw_mutex { - //! Deny assignment and copy construction - null_rw_mutex( const null_rw_mutex& ); - void operator=( const null_rw_mutex& ); -public: - class scoped_lock { - public: - scoped_lock() {} - scoped_lock( null_rw_mutex& , bool = true ) {} - ~scoped_lock() {} - void acquire( null_rw_mutex& , bool = true ) {} - bool upgrade_to_writer() { return true; } - bool downgrade_to_reader() { return true; } - bool try_acquire( null_rw_mutex& , bool = true ) { return true; } - void release() {} - }; - - null_rw_mutex() {} - - // Mutex traits - static const bool is_rw_mutex = true; - static const bool is_recursive_mutex = true; - static const bool is_fair_mutex = true; -}; - -} - -#endif /* __TBB_null_rw_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_do.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_do.h deleted file mode 100644 index 922c9684ac..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_do.h +++ /dev/null @@ -1,508 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_parallel_do_H -#define __TBB_parallel_do_H - -#include "task.h" -#include "aligned_space.h" -#include - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - template class parallel_do_feeder_impl; - template class do_group_task; - - //! Strips its template type argument from 'cv' and '&' qualifiers - template - struct strip { typedef T type; }; - template - struct strip { typedef T type; }; - template - struct strip { typedef T type; }; - template - struct strip { typedef T type; }; - template - struct strip { typedef T type; }; - // Most of the compilers remove cv-qualifiers from non-reference function argument types. - // But unfortunately there are those that don't. - template - struct strip { typedef T type; }; - template - struct strip { typedef T type; }; - template - struct strip { typedef T type; }; -} // namespace internal -//! @endcond - -//! Class the user supplied algorithm body uses to add new tasks -/** \param Item Work item type **/ -template -class parallel_do_feeder: internal::no_copy -{ - parallel_do_feeder() {} - virtual ~parallel_do_feeder () {} - virtual void internal_add( const Item& item ) = 0; - template friend class internal::parallel_do_feeder_impl; -public: - //! Add a work item to a running parallel_do. - void add( const Item& item ) {internal_add(item);} -}; - -//! @cond INTERNAL -namespace internal { - //! For internal use only. - /** Selects one of the two possible forms of function call member operator. - @ingroup algorithms **/ - template - class parallel_do_operator_selector - { - typedef parallel_do_feeder Feeder; - template - static void internal_call( const Body& obj, A1& arg1, A2&, void (Body::*)(CvItem) const ) { - obj(arg1); - } - template - static void internal_call( const Body& obj, A1& arg1, A2& arg2, void (Body::*)(CvItem, parallel_do_feeder&) const ) { - obj(arg1, arg2); - } - - public: - template - static void call( const Body& obj, A1& arg1, A2& arg2 ) - { - internal_call( obj, arg1, arg2, &Body::operator() ); - } - }; - - //! For internal use only. - /** Executes one iteration of a do. - @ingroup algorithms */ - template - class do_iteration_task: public task - { - typedef parallel_do_feeder_impl feeder_type; - - Item my_value; - feeder_type& my_feeder; - - do_iteration_task( const Item& value, feeder_type& feeder ) : - my_value(value), my_feeder(feeder) - {} - - /*override*/ - task* execute() - { - parallel_do_operator_selector::call(*my_feeder.my_body, my_value, my_feeder); - return NULL; - } - - template friend class parallel_do_feeder_impl; - }; // class do_iteration_task - - template - class do_iteration_task_iter: public task - { - typedef parallel_do_feeder_impl feeder_type; - - Iterator my_iter; - feeder_type& my_feeder; - - do_iteration_task_iter( const Iterator& iter, feeder_type& feeder ) : - my_iter(iter), my_feeder(feeder) - {} - - /*override*/ - task* execute() - { - parallel_do_operator_selector::call(*my_feeder.my_body, *my_iter, my_feeder); - return NULL; - } - - template friend class do_group_task_forward; - template friend class do_group_task_input; - template friend class do_task_iter; - }; // class do_iteration_task_iter - - //! For internal use only. - /** Implements new task adding procedure. - @ingroup algorithms **/ - template - class parallel_do_feeder_impl : public parallel_do_feeder - { - /*override*/ - void internal_add( const Item& item ) - { - typedef do_iteration_task iteration_type; - - iteration_type& t = *new (task::self().allocate_additional_child_of(*my_barrier)) iteration_type(item, *this); - - t.spawn( t ); - } - public: - const Body* my_body; - empty_task* my_barrier; - - parallel_do_feeder_impl() - { - my_barrier = new( task::allocate_root() ) empty_task(); - __TBB_ASSERT(my_barrier, "root task allocation failed"); - } - -#if __TBB_EXCEPTIONS - parallel_do_feeder_impl(tbb::task_group_context &context) - { - my_barrier = new( task::allocate_root(context) ) empty_task(); - __TBB_ASSERT(my_barrier, "root task allocation failed"); - } -#endif - - ~parallel_do_feeder_impl() - { - my_barrier->destroy(*my_barrier); - } - }; // class parallel_do_feeder_impl - - - //! For internal use only - /** Unpacks a block of iterations. - @ingroup algorithms */ - - template - class do_group_task_forward: public task - { - static const size_t max_arg_size = 4; - - typedef parallel_do_feeder_impl feeder_type; - - feeder_type& my_feeder; - Iterator my_first; - size_t my_size; - - do_group_task_forward( Iterator first, size_t size, feeder_type& feeder ) - : my_feeder(feeder), my_first(first), my_size(size) - {} - - /*override*/ task* execute() - { - typedef do_iteration_task_iter iteration_type; - __TBB_ASSERT( my_size>0, NULL ); - task_list list; - task* t; - size_t k=0; - for(;;) { - t = new( allocate_child() ) iteration_type( my_first, my_feeder ); - ++my_first; - if( ++k==my_size ) break; - list.push_back(*t); - } - set_ref_count(int(k+1)); - spawn(list); - spawn_and_wait_for_all(*t); - return NULL; - } - - template friend class do_task_iter; - }; // class do_group_task_forward - - template - class do_group_task_input: public task - { - static const size_t max_arg_size = 4; - - typedef parallel_do_feeder_impl feeder_type; - - feeder_type& my_feeder; - size_t my_size; - aligned_space my_arg; - - do_group_task_input( feeder_type& feeder ) - : my_feeder(feeder), my_size(0) - {} - - /*override*/ task* execute() - { - typedef do_iteration_task_iter iteration_type; - __TBB_ASSERT( my_size>0, NULL ); - task_list list; - task* t; - size_t k=0; - for(;;) { - t = new( allocate_child() ) iteration_type( my_arg.begin() + k, my_feeder ); - if( ++k==my_size ) break; - list.push_back(*t); - } - set_ref_count(int(k+1)); - spawn(list); - spawn_and_wait_for_all(*t); - return NULL; - } - - ~do_group_task_input(){ - for( size_t k=0; k~Item(); - } - - template friend class do_task_iter; - }; // class do_group_task_input - - //! For internal use only. - /** Gets block of iterations and packages them into a do_group_task. - @ingroup algorithms */ - template - class do_task_iter: public task - { - typedef parallel_do_feeder_impl feeder_type; - - public: - do_task_iter( Iterator first, Iterator last , feeder_type& feeder ) : - my_first(first), my_last(last), my_feeder(feeder) - {} - - private: - Iterator my_first; - Iterator my_last; - feeder_type& my_feeder; - - /* Do not merge run(xxx) and run_xxx() methods. They are separated in order - to make sure that compilers will eliminate unused argument of type xxx - (that is will not put it on stack). The sole purpose of this argument - is overload resolution. - - An alternative could be using template functions, but explicit specialization - of member function templates is not supported for non specialized class - templates. Besides template functions would always fall back to the least - efficient variant (the one for input iterators) in case of iterators having - custom tags derived from basic ones. */ - /*override*/ task* execute() - { - typedef typename std::iterator_traits::iterator_category iterator_tag; - return run( (iterator_tag*)NULL ); - } - - /** This is the most restricted variant that operates on input iterators or - iterators with unknown tags (tags not derived from the standard ones). **/ - inline task* run( void* ) { return run_for_input_iterator(); } - - task* run_for_input_iterator() { - typedef do_group_task_input block_type; - - block_type& t = *new( allocate_additional_child_of(*my_feeder.my_barrier) ) block_type(my_feeder); - size_t k=0; - while( !(my_first == my_last) ) { - new (t.my_arg.begin() + k) Item(*my_first); - ++my_first; - if( ++k==block_type::max_arg_size ) { - if ( !(my_first == my_last) ) - recycle_to_reexecute(); - break; - } - } - if( k==0 ) { - destroy(t); - return NULL; - } else { - t.my_size = k; - return &t; - } - } - - inline task* run( std::forward_iterator_tag* ) { return run_for_forward_iterator(); } - - task* run_for_forward_iterator() { - typedef do_group_task_forward block_type; - - Iterator first = my_first; - size_t k=0; - while( !(my_first==my_last) ) { - ++my_first; - if( ++k==block_type::max_arg_size ) { - if ( !(my_first==my_last) ) - recycle_to_reexecute(); - break; - } - } - return k==0 ? NULL : new( allocate_additional_child_of(*my_feeder.my_barrier) ) block_type(first, k, my_feeder); - } - - inline task* run( std::random_access_iterator_tag* ) { return run_for_random_access_iterator(); } - - task* run_for_random_access_iterator() { - typedef do_group_task_forward block_type; - typedef do_iteration_task_iter iteration_type; - - size_t k = static_cast(my_last-my_first); - if( k > block_type::max_arg_size ) { - Iterator middle = my_first + k/2; - - empty_task& c = *new( allocate_continuation() ) empty_task; - do_task_iter& b = *new( c.allocate_child() ) do_task_iter(middle, my_last, my_feeder); - recycle_as_child_of(c); - - my_last = middle; - c.set_ref_count(2); - c.spawn(b); - return this; - }else if( k != 0 ) { - task_list list; - task* t; - size_t k1=0; - for(;;) { - t = new( allocate_child() ) iteration_type(my_first, my_feeder); - ++my_first; - if( ++k1==k ) break; - list.push_back(*t); - } - set_ref_count(int(k+1)); - spawn(list); - spawn_and_wait_for_all(*t); - } - return NULL; - } - }; // class do_task_iter - - //! For internal use only. - /** Implements parallel iteration over a range. - @ingroup algorithms */ - template - void run_parallel_do( Iterator first, Iterator last, const Body& body -#if __TBB_EXCEPTIONS - , task_group_context& context -#endif - ) - { - typedef do_task_iter root_iteration_task; -#if __TBB_EXCEPTIONS - parallel_do_feeder_impl feeder(context); -#else - parallel_do_feeder_impl feeder; -#endif - feeder.my_body = &body; - - root_iteration_task &t = *new( feeder.my_barrier->allocate_child() ) root_iteration_task(first, last, feeder); - - feeder.my_barrier->set_ref_count(2); - feeder.my_barrier->spawn_and_wait_for_all(t); - } - - //! For internal use only. - /** Detects types of Body's operator function arguments. - @ingroup algorithms **/ - template - void select_parallel_do( Iterator first, Iterator last, const Body& body, void (Body::*)(Item) const -#if __TBB_EXCEPTIONS - , task_group_context& context -#endif // __TBB_EXCEPTIONS - ) - { - run_parallel_do::type>( first, last, body -#if __TBB_EXCEPTIONS - , context -#endif // __TBB_EXCEPTIONS - ); - } - - //! For internal use only. - /** Detects types of Body's operator function arguments. - @ingroup algorithms **/ - template - void select_parallel_do( Iterator first, Iterator last, const Body& body, void (Body::*)(Item, parallel_do_feeder<_Item>&) const -#if __TBB_EXCEPTIONS - , task_group_context& context -#endif // __TBB_EXCEPTIONS - ) - { - run_parallel_do::type>( first, last, body -#if __TBB_EXCEPTIONS - , context -#endif // __TBB_EXCEPTIONS - ); - } - -} // namespace internal -//! @endcond - - -/** \page parallel_do_body_req Requirements on parallel_do body - Class \c Body implementing the concept of parallel_do body must define: - - \code - B::operator()( - cv_item_type item, - parallel_do_feeder& feeder - ) const - - OR - - B::operator()( cv_item_type& item ) const - \endcode Process item. - May be invoked concurrently for the same \c this but different \c item. - - - \code item_type( const item_type& ) \endcode - Copy a work item. - - \code ~item_type() \endcode Destroy a work item -**/ - -/** \name parallel_do - See also requirements on \ref parallel_do_body_req "parallel_do Body". **/ -//@{ -//! Parallel iteration over a range, with optional addition of more work. -/** @ingroup algorithms */ -template -void parallel_do( Iterator first, Iterator last, const Body& body ) -{ - if ( first == last ) - return; -#if __TBB_EXCEPTIONS - task_group_context context; -#endif // __TBB_EXCEPTIONS - internal::select_parallel_do( first, last, body, &Body::operator() -#if __TBB_EXCEPTIONS - , context -#endif // __TBB_EXCEPTIONS - ); -} - -#if __TBB_EXCEPTIONS -//! Parallel iteration over a range, with optional addition of more work and user-supplied context -/** @ingroup algorithms */ -template -void parallel_do( Iterator first, Iterator last, const Body& body, task_group_context& context ) -{ - if ( first == last ) - return; - internal::select_parallel_do( first, last, body, &Body::operator(), context ); -} -#endif // __TBB_EXCEPTIONS - -//@} - -} // namespace - -#endif /* __TBB_parallel_do_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_for.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_for.h deleted file mode 100644 index 62efd2814c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_for.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_parallel_for_H -#define __TBB_parallel_for_H - -#include "task.h" -#include "partitioner.h" -#include - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - - //! Task type used in parallel_for - /** @ingroup algorithms */ - template - class start_for: public task { - Range my_range; - const Body my_body; - typename Partitioner::partition_type my_partition; - /*override*/ task* execute(); - - //! Constructor for root task. - start_for( const Range& range, const Body& body, Partitioner& partitioner ) : - my_range(range), - my_body(body), - my_partition(partitioner) - { - } - //! Splitting constructor used to generate children. - /** this becomes left child. Newly constructed object is right child. */ - start_for( start_for& parent, split ) : - my_range(parent.my_range,split()), - my_body(parent.my_body), - my_partition(parent.my_partition,split()) - { - my_partition.set_affinity(*this); - } - //! Update affinity info, if any. - /*override*/ void note_affinity( affinity_id id ) { - my_partition.note_affinity( id ); - } - public: - static void run( const Range& range, const Body& body, const Partitioner& partitioner ) { - if( !range.empty() ) { -#if !__TBB_EXCEPTIONS || TBB_JOIN_OUTER_TASK_GROUP - start_for& a = *new(task::allocate_root()) start_for(range,body,const_cast(partitioner)); -#else - // Bound context prevents exceptions from body to affect nesting or sibling algorithms, - // and allows users to handle exceptions safely by wrapping parallel_for in the try-block. - task_group_context context; - start_for& a = *new(task::allocate_root(context)) start_for(range,body,const_cast(partitioner)); -#endif /* __TBB_EXCEPTIONS && !TBB_JOIN_OUTER_TASK_GROUP */ - task::spawn_root_and_wait(a); - } - } -#if __TBB_EXCEPTIONS - static void run( const Range& range, const Body& body, const Partitioner& partitioner, task_group_context& context ) { - if( !range.empty() ) { - start_for& a = *new(task::allocate_root(context)) start_for(range,body,const_cast(partitioner)); - task::spawn_root_and_wait(a); - } - } -#endif /* __TBB_EXCEPTIONS */ - }; - - template - task* start_for::execute() { - if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) { - my_body( my_range ); - return my_partition.continue_after_execute_range(*this); - } else { - empty_task& c = *new( this->allocate_continuation() ) empty_task; - recycle_as_child_of(c); - c.set_ref_count(2); - bool delay = my_partition.decide_whether_to_delay(); - start_for& b = *new( c.allocate_child() ) start_for(*this,split()); - my_partition.spawn_or_delay(delay,*this,b); - return this; - } - } -} // namespace internal -//! @endcond - - -// Requirements on Range concept are documented in blocked_range.h - -/** \page parallel_for_body_req Requirements on parallel_for body - Class \c Body implementing the concept of parallel_for body must define: - - \code Body::Body( const Body& ); \endcode Copy constructor - - \code Body::~Body(); \endcode Destructor - - \code void Body::operator()( Range& r ) const; \endcode Function call operator applying the body to range \c r. -**/ - -/** \name parallel_for - See also requirements on \ref range_req "Range" and \ref parallel_for_body_req "parallel_for Body". **/ -//@{ - -//! Parallel iteration over range with simple partitioner, or default partitioner if no partitioner is specified. -/** @ingroup algorithms **/ -template -void parallel_for( const Range& range, const Body& body, const simple_partitioner& partitioner=simple_partitioner() ) { - internal::start_for::run(range,body,partitioner); -} - -//! Parallel iteration over range with auto_partitioner. -/** @ingroup algorithms **/ -template -void parallel_for( const Range& range, const Body& body, const auto_partitioner& partitioner ) { - internal::start_for::run(range,body,partitioner); -} - -//! Parallel iteration over range with affinity_partitioner. -/** @ingroup algorithms **/ -template -void parallel_for( const Range& range, const Body& body, affinity_partitioner& partitioner ) { - internal::start_for::run(range,body,partitioner); -} - -#if __TBB_EXCEPTIONS -//! Parallel iteration over range with simple partitioner and user-supplied context. -/** @ingroup algorithms **/ -template -void parallel_for( const Range& range, const Body& body, const simple_partitioner& partitioner, task_group_context& context ) { - internal::start_for::run(range, body, partitioner, context); -} - -//! Parallel iteration over range with auto_partitioner and user-supplied context. -/** @ingroup algorithms **/ -template -void parallel_for( const Range& range, const Body& body, const auto_partitioner& partitioner, task_group_context& context ) { - internal::start_for::run(range, body, partitioner, context); -} - -//! Parallel iteration over range with affinity_partitioner and user-supplied context. -/** @ingroup algorithms **/ -template -void parallel_for( const Range& range, const Body& body, affinity_partitioner& partitioner, task_group_context& context ) { - internal::start_for::run(range,body,partitioner, context); -} -#endif /* __TBB_EXCEPTIONS */ -//@} - -} // namespace tbb - -#endif /* __TBB_parallel_for_H */ - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_invoke.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_invoke.h deleted file mode 100644 index 36b3d30a61..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_invoke.h +++ /dev/null @@ -1,333 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_parallel_invoke_H -#define __TBB_parallel_invoke_H - -#include "task.h" - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - // Simple task object, executing user method - template - class function_invoker : public task{ - public: - function_invoker(function& _function) : my_function(_function) {} - private: - function &my_function; - /*override*/ - task* execute() - { - my_function(); - return NULL; - } - }; - - // The class spawns two or three child tasks - template - class spawner : public task { - private: - function1& my_func1; - function2& my_func2; - function3& my_func3; - bool is_recycled; - - task* execute (){ - if(is_recycled){ - return NULL; - }else{ - __TBB_ASSERT(N==2 || N==3, "Number of arguments passed to spawner is wrong"); - set_ref_count(N); - recycle_as_safe_continuation(); - internal::function_invoker* invoker2 = new (allocate_child()) internal::function_invoker(my_func2); - __TBB_ASSERT(invoker2, "Child task allocation failed"); - spawn(*invoker2); - size_t n = N; // To prevent compiler warnings - if (n>2) { - internal::function_invoker* invoker3 = new (allocate_child()) internal::function_invoker(my_func3); - __TBB_ASSERT(invoker3, "Child task allocation failed"); - spawn(*invoker3); - } - my_func1(); - is_recycled = true; - return NULL; - } - } // execute - - public: - spawner(function1& _func1, function2& _func2, function3& _func3) : my_func1(_func1), my_func2(_func2), my_func3(_func3), is_recycled(false) {} - }; - - // Creates and spawns child tasks - class parallel_invoke_helper : public empty_task { - public: - // Dummy functor class - class parallel_invoke_noop { - public: - void operator() () const {} - }; - // Creates a helper object with user-defined number of children expected - parallel_invoke_helper(int number_of_children) - { - set_ref_count(number_of_children + 1); - } - // Adds child task and spawns it - template - void add_child (function &_func) - { - internal::function_invoker* invoker = new (allocate_child()) internal::function_invoker(_func); - __TBB_ASSERT(invoker, "Child task allocation failed"); - spawn(*invoker); - } - - // Adds a task with multiple child tasks and spawns it - // two arguments - template - void add_children (function1& _func1, function2& _func2) - { - // The third argument is dummy, it is ignored actually. - parallel_invoke_noop noop; - internal::spawner<2, function1, function2, parallel_invoke_noop>& sub_root = *new(allocate_child())internal::spawner<2, function1, function2, parallel_invoke_noop>(_func1, _func2, noop); - spawn(sub_root); - } - // three arguments - template - void add_children (function1& _func1, function2& _func2, function3& _func3) - { - internal::spawner<3, function1, function2, function3>& sub_root = *new(allocate_child())internal::spawner<3, function1, function2, function3>(_func1, _func2, _func3); - spawn(sub_root); - } - - // Waits for all child tasks - template - void run_and_finish(F0& f0) - { - internal::function_invoker* invoker = new (allocate_child()) internal::function_invoker(f0); - __TBB_ASSERT(invoker, "Child task allocation failed"); - spawn_and_wait_for_all(*invoker); - } - }; - // The class destroys root if exception occured as well as in normal case - class parallel_invoke_cleaner: internal::no_copy { - public: - parallel_invoke_cleaner(int number_of_children, tbb::task_group_context& context) : root(*new(task::allocate_root(context)) internal::parallel_invoke_helper(number_of_children)) - {} - ~parallel_invoke_cleaner(){ - root.destroy(root); - } - internal::parallel_invoke_helper& root; - }; -} // namespace internal -//! @endcond - -/** \name parallel_invoke - **/ -//@{ -//! Executes a list of tasks in parallel and waits for all tasks to complete. -/** @ingroup algorithms */ - -// parallel_invoke with user-defined context -// two arguments -template -void parallel_invoke(F0& f0, F1& f1, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(2, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_child(f1); - - root.run_and_finish(f0); -} - -// three arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(3, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_child(f2); - root.add_child(f1); - - root.run_and_finish(f0); -} - -// four arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(4, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_child(f3); - root.add_child(f2); - root.add_child(f1); - - root.run_and_finish(f0); -} - -// five arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(3, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_children(f4, f3); - root.add_children(f2, f1); - - root.run_and_finish(f0); -} - -// six arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(3, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_children(f5, f4, f3); - root.add_children(f2, f1); - - root.run_and_finish(f0); -} - -// seven arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(3, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_children(f6, f5, f4); - root.add_children(f3, f2, f1); - - root.run_and_finish(f0); -} - -// eight arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(4, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_children(f7, f6, f5); - root.add_children(f4, f3); - root.add_children(f2, f1); - - root.run_and_finish(f0); -} - -// nine arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(4, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_children(f8, f7, f6); - root.add_children(f5, f4, f3); - root.add_children(f2, f1); - - root.run_and_finish(f0); -} - -// ten arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8, F9 &f9, tbb::task_group_context& context) { - internal::parallel_invoke_cleaner cleaner(4, context); - internal::parallel_invoke_helper& root = cleaner.root; - - root.add_children(f9, f8, f7); - root.add_children(f6, f5, f4); - root.add_children(f3, f2, f1); - - root.run_and_finish(f0); -} - -// two arguments -template -void parallel_invoke(F0& f0, F1& f1) { - task_group_context context; - parallel_invoke(f0, f1, context); -} -// three arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2) { - task_group_context context; - parallel_invoke(f0, f1, f2, context); -} -// four arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3) { - task_group_context context; - parallel_invoke(f0, f1, f2, f3, context); -} -// five arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4) { - task_group_context context; - parallel_invoke(f0, f1, f2, f3, f4, context); -} -// six arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5) { - task_group_context context; - parallel_invoke(f0, f1, f2, f3, f4, f5, context); -} -// seven arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6) { - task_group_context context; - parallel_invoke(f0, f1, f2, f3, f4, f5, f6, context); -} -// eigth arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7) { - task_group_context context; - parallel_invoke(f0, f1, f2, f3, f4, f5, f6, f7, context); -} -// nine arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8) { - task_group_context context; - parallel_invoke(f0, f1, f2, f3, f4, f5, f6, f7, f8, context); -} -// ten arguments -template -void parallel_invoke(F0& f0, F1& f1, F2& f2, F3& f3, F4& f4, F5& f5, F6& f6, F7& f7, F8& f8, F9& f9) { - task_group_context context; - parallel_invoke(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, context); -} - -//@} - -} // namespace - -#endif /* __TBB_parallel_invoke_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_reduce.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_reduce.h deleted file mode 100644 index e6ded7f036..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_reduce.h +++ /dev/null @@ -1,466 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_parallel_reduce_H -#define __TBB_parallel_reduce_H - -#include "task.h" -#include "aligned_space.h" -#include "partitioner.h" -#include - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - - //! ITT instrumented routine that stores src into location pointed to by dst. - void __TBB_EXPORTED_FUNC itt_store_pointer_with_release_v3( void* dst, void* src ); - - //! ITT instrumented routine that loads pointer from location pointed to by src. - void* __TBB_EXPORTED_FUNC itt_load_pointer_with_acquire_v3( const void* src ); - - template inline void parallel_reduce_store_body( T*& dst, T* src ) { -#if TBB_USE_THREADING_TOOLS - itt_store_pointer_with_release_v3(&dst,src); -#else - __TBB_store_with_release(dst,src); -#endif /* TBB_USE_THREADING_TOOLS */ - } - - template inline T* parallel_reduce_load_body( T*& src ) { -#if TBB_USE_THREADING_TOOLS - return static_cast(itt_load_pointer_with_acquire_v3(&src)); -#else - return __TBB_load_with_acquire(src); -#endif /* TBB_USE_THREADING_TOOLS */ - } - - //! Task type use to combine the partial results of parallel_reduce. - /** @ingroup algorithms */ - template - class finish_reduce: public task { - Body* const my_body; - bool has_right_zombie; - aligned_space zombie_space; - finish_reduce( Body* body ) : - my_body(body), - has_right_zombie(false) - { - } - task* execute() { - if( has_right_zombie ) { - // Right child was stolen. - Body* s = zombie_space.begin(); - my_body->join( *s ); - s->~Body(); - } - return NULL; - } - template - friend class start_reduce; - }; - - //! Task type used to split the work of parallel_reduce. - /** @ingroup algorithms */ - template - class start_reduce: public task { - typedef finish_reduce finish_type; - Body* my_body; - Range my_range; - typename Partitioner::partition_type my_partition; - /*override*/ task* execute(); - template - friend class finish_reduce; - - //! Constructor used for root task - start_reduce( const Range& range, Body* body, const Partitioner &partitioner ) : - my_body(body), - my_range(range), - my_partition(partitioner) - { - } - //! Splitting constructor used to generate children. - /** this becomes left child. Newly constructed object is right child. */ - start_reduce( start_reduce& parent, split ) : - my_body(parent.my_body), - my_range(parent.my_range,split()), - my_partition(parent.my_partition,split()) - { - } - //! Process a steal. - /** Affinity is never set, so if this method is called, it must arise because this is stolen. */ - /*override*/ void note_affinity( affinity_id /*id*/ ) { - finish_type* p = static_cast(parent() ); - Body* body = new( p->zombie_space.begin() ) Body(*my_body,split()); - p->has_right_zombie = true; - my_body = body; - } - public: -#if !__TBB_EXCEPTIONS - static void run( const Range& range, Body& body, const Partitioner &partitioner ) { - if( !range.empty() ) - task::spawn_root_and_wait( *new(task::allocate_root()) start_reduce(range,&body,partitioner) ); - } -#else /* __TBB_EXCEPTIONS */ - static void run( const Range& range, Body& body, const Partitioner &partitioner ) { - // Bound context prevents exceptions from body to affect nesting or sibling algorithms, - // and allows users to handle exceptions safely by wrapping parallel_for in the try-block. - if( !range.empty() ) { - task_group_context context; - task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce(range,&body,partitioner) ); - } - } - static void run( const Range& range, Body& body, const Partitioner &partitioner, task_group_context& context ) { - if( !range.empty() ) - task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce(range,&body,partitioner) ); - } -#endif /* __TBB_EXCEPTIONS */ - }; - - template - task* start_reduce::execute() { - if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) { - (*my_body)( my_range ); - return NULL; - } else { - finish_type& c = *new( allocate_continuation()) finish_type(my_body); - recycle_as_child_of(c); - c.set_ref_count(2); - start_reduce& b = *new( c.allocate_child() ) start_reduce(*this,split()); - spawn(b); - return this; - } - } - - //! 0 if root, 1 if a left child, 2 if a right child. - /** Represented as a char, not enum, for compactness. */ - typedef char reduction_context; - - //! Task type use to combine the partial results of parallel_reduce with affinity_partitioner. - /** @ingroup algorithms */ - template - class finish_reduce_with_affinity: public task { - //! Pointer to body, or NULL if the left child has not yet finished. - Body* my_body; - bool has_right_zombie; - const reduction_context my_context; - aligned_space zombie_space; - finish_reduce_with_affinity( char context ) : - my_body(NULL), - has_right_zombie(false), - my_context(context) - { - } - task* execute() { - if( has_right_zombie ) { - // Right child was stolen. - Body* s = zombie_space.begin(); - my_body->join( *s ); - s->~Body(); - } - if( my_context==1 ) - parallel_reduce_store_body( static_cast(parent())->my_body, my_body ); - return NULL; - } - template - friend class start_reduce_with_affinity; - }; - - //! Task type used to split the work of parallel_reduce with affinity_partitioner. - /** @ingroup algorithms */ - template - class start_reduce_with_affinity: public task { - typedef finish_reduce_with_affinity finish_type; - Body* my_body; - Range my_range; - typename affinity_partitioner::partition_type my_partition; - reduction_context my_context; - /*override*/ task* execute(); - template - friend class finish_reduce_with_affinity; - - //! Constructor used for root task - start_reduce_with_affinity( const Range& range, Body* body, affinity_partitioner& partitioner ) : - my_body(body), - my_range(range), - my_partition(partitioner), - my_context(0) - { - } - //! Splitting constructor used to generate children. - /** this becomes left child. Newly constructed object is right child. */ - start_reduce_with_affinity( start_reduce_with_affinity& parent, split ) : - my_body(parent.my_body), - my_range(parent.my_range,split()), - my_partition(parent.my_partition,split()), - my_context(2) - { - my_partition.set_affinity(*this); - parent.my_context = 1; - } - //! Update affinity info, if any - /*override*/ void note_affinity( affinity_id id ) { - my_partition.note_affinity( id ); - } - -public: - static void run( const Range& range, Body& body, affinity_partitioner& partitioner ) { - if( !range.empty() ) { -#if !__TBB_EXCEPTIONS || TBB_JOIN_OUTER_TASK_GROUP - task::spawn_root_and_wait( *new(task::allocate_root()) start_reduce_with_affinity(range,&body,partitioner) ); -#else - // Bound context prevents exceptions from body to affect nesting or sibling algorithms, - // and allows users to handle exceptions safely by wrapping parallel_for in the try-block. - task_group_context context; - task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce_with_affinity(range,&body,partitioner) ); -#endif /* __TBB_EXCEPTIONS && !TBB_JOIN_OUTER_TASK_GROUP */ - } - } -#if __TBB_EXCEPTIONS - static void run( const Range& range, Body& body, affinity_partitioner& partitioner, task_group_context& context ) { - if( !range.empty() ) - task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce_with_affinity(range,&body,partitioner) ); - } -#endif /* __TBB_EXCEPTIONS */ - }; - - template - task* start_reduce_with_affinity::execute() { - if( my_context==2 ) { - finish_type* p = static_cast(parent() ); - if( !parallel_reduce_load_body(p->my_body) ) { - my_body = new( p->zombie_space.begin() ) Body(*my_body,split()); - p->has_right_zombie = true; - } - } - if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) { - (*my_body)( my_range ); - if( my_context==1 ) - parallel_reduce_store_body(static_cast(parent())->my_body, my_body ); - return my_partition.continue_after_execute_range(*this); - } else { - finish_type& c = *new( allocate_continuation()) finish_type(my_context); - recycle_as_child_of(c); - c.set_ref_count(2); - bool delay = my_partition.decide_whether_to_delay(); - start_reduce_with_affinity& b = *new( c.allocate_child() ) start_reduce_with_affinity(*this,split()); - my_partition.spawn_or_delay(delay,*this,b); - return this; - } - } - - //! Auxiliary class for parallel_reduce; for internal use only. - /** The adaptor class that implements \ref parallel_reduce_body_req "parallel_reduce Body" - using given \ref parallel_reduce_lambda_req "anonymous function objects". - **/ - /** @ingroup algorithms */ - template - class lambda_reduce_body { - -//FIXME: decide if my_real_body, my_reduction, and identity_element should be copied or referenced -// (might require some performance measurements) - - const Value& identity_element; - const RealBody& my_real_body; - const Reduction& my_reduction; - Value my_value; - public: - lambda_reduce_body( const Value& identity, const RealBody& body, const Reduction& reduction ) - : identity_element(identity) - , my_real_body(body) - , my_reduction(reduction) - , my_value(identity) - { } - lambda_reduce_body( const lambda_reduce_body& other ) - : identity_element(other.identity_element) - , my_real_body(other.my_real_body) - , my_reduction(other.my_reduction) - , my_value(other.my_value) - { } - lambda_reduce_body( lambda_reduce_body& other, tbb::split ) - : identity_element(other.identity_element) - , my_real_body(other.my_real_body) - , my_reduction(other.my_reduction) - , my_value(other.identity_element) - { } - void operator()(Range& range) { - my_value = my_real_body(range, const_cast(my_value)); - } - void join( lambda_reduce_body& rhs ) { - my_value = my_reduction(const_cast(my_value), const_cast(rhs.my_value)); - } - Value result() const { - return my_value; - } - }; - -} // namespace internal -//! @endcond - -// Requirements on Range concept are documented in blocked_range.h - -/** \page parallel_reduce_body_req Requirements on parallel_reduce body - Class \c Body implementing the concept of parallel_reduce body must define: - - \code Body::Body( Body&, split ); \endcode Splitting constructor. - Must be able to run concurrently with operator() and method \c join - - \code Body::~Body(); \endcode Destructor - - \code void Body::operator()( Range& r ); \endcode Function call operator applying body to range \c r - and accumulating the result - - \code void Body::join( Body& b ); \endcode Join results. - The result in \c b should be merged into the result of \c this -**/ - -/** \page parallel_reduce_lambda_req Requirements on parallel_reduce anonymous function objects (lambda functions) - TO BE DOCUMENTED -**/ - -/** \name parallel_reduce - See also requirements on \ref range_req "Range" and \ref parallel_reduce_body_req "parallel_reduce Body". **/ -//@{ - -//! Parallel iteration with reduction and simple_partitioner, or no partitioner specified. -/** @ingroup algorithms **/ -template -void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner = simple_partitioner() ) { - internal::start_reduce::run( range, body, partitioner ); -} - -//! Parallel iteration with reduction and auto_partitioner -/** @ingroup algorithms **/ -template -void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner ) { - internal::start_reduce::run( range, body, partitioner ); -} - -//! Parallel iteration with reduction and affinity_partitioner -/** @ingroup algorithms **/ -template -void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner ) { - internal::start_reduce_with_affinity::run( range, body, partitioner ); -} - -#if __TBB_EXCEPTIONS -//! Parallel iteration with reduction, simple partitioner and user-supplied context. -/** @ingroup algorithms **/ -template -void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner, task_group_context& context ) { - internal::start_reduce::run( range, body, partitioner, context ); -} - -//! Parallel iteration with reduction, auto_partitioner and user-supplied context -/** @ingroup algorithms **/ -template -void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner, task_group_context& context ) { - internal::start_reduce::run( range, body, partitioner, context ); -} - -//! Parallel iteration with reduction, affinity_partitioner and user-supplied context -/** @ingroup algorithms **/ -template -void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner, task_group_context& context ) { - internal::start_reduce_with_affinity::run( range, body, partitioner, context ); -} -#endif /* __TBB_EXCEPTIONS */ - -/** parallel_reduce overloads that work with anonymous function objects - (see also \ref parallel_reduce_lambda_req "requirements on parallel_reduce anonymous function objects"). **/ - -//! Parallel iteration with reduction and simple_partitioner, or no partitioner specified. -/** @ingroup algorithms **/ -template -Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction, - const simple_partitioner& partitioner = simple_partitioner() ) { - internal::lambda_reduce_body body(identity, real_body, reduction); - internal::start_reduce,simple_partitioner> - ::run(range, body, partitioner ); - return body.result(); -} - -//! Parallel iteration with reduction and auto_partitioner -/** @ingroup algorithms **/ -template -Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction, - const auto_partitioner& partitioner ) { - internal::lambda_reduce_body body(identity, real_body, reduction); - internal::start_reduce,auto_partitioner> - ::run( range, body, partitioner ); - return body.result(); -} - -//! Parallel iteration with reduction and affinity_partitioner -/** @ingroup algorithms **/ -template -Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction, - affinity_partitioner& partitioner ) { - internal::lambda_reduce_body body(identity, real_body, reduction); - internal::start_reduce_with_affinity > - ::run( range, body, partitioner ); - return body.result(); -} - -#if __TBB_EXCEPTIONS -//! Parallel iteration with reduction, simple partitioner and user-supplied context. -/** @ingroup algorithms **/ -template -Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction, - const simple_partitioner& partitioner, task_group_context& context ) { - internal::lambda_reduce_body body(identity, real_body, reduction); - internal::start_reduce,simple_partitioner> - ::run( range, body, partitioner, context ); - return body.result(); -} - -//! Parallel iteration with reduction, auto_partitioner and user-supplied context -/** @ingroup algorithms **/ -template -Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction, - const auto_partitioner& partitioner, task_group_context& context ) { - internal::lambda_reduce_body body(identity, real_body, reduction); - internal::start_reduce,auto_partitioner> - ::run( range, body, partitioner, context ); - return body.result(); -} - -//! Parallel iteration with reduction, affinity_partitioner and user-supplied context -/** @ingroup algorithms **/ -template -Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction, - affinity_partitioner& partitioner, task_group_context& context ) { - internal::lambda_reduce_body body(identity, real_body, reduction); - internal::start_reduce_with_affinity > - ::run( range, body, partitioner, context ); - return body.result(); -} -#endif /* __TBB_EXCEPTIONS */ -//@} - -} // namespace tbb - -#endif /* __TBB_parallel_reduce_H */ - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_scan.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_scan.h deleted file mode 100644 index e670cf7a25..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_scan.h +++ /dev/null @@ -1,344 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_parallel_scan_H -#define __TBB_parallel_scan_H - -#include "task.h" -#include "aligned_space.h" -#include -#include "partitioner.h" - -namespace tbb { - -//! Used to indicate that the initial scan is being performed. -/** @ingroup algorithms */ -struct pre_scan_tag { - static bool is_final_scan() {return false;} -}; - -//! Used to indicate that the final scan is being performed. -/** @ingroup algorithms */ -struct final_scan_tag { - static bool is_final_scan() {return true;} -}; - -//! @cond INTERNAL -namespace internal { - - //! Performs final scan for a leaf - /** @ingroup algorithms */ - template - class final_sum: public task { - public: - Body body; - private: - aligned_space range; - //! Where to put result of last subrange, or NULL if not last subrange. - Body* stuff_last; - public: - final_sum( Body& body_ ) : - body(body_,split()) - { - poison_pointer(stuff_last); - } - ~final_sum() { - range.begin()->~Range(); - } - void finish_construction( const Range& range_, Body* stuff_last_ ) { - new( range.begin() ) Range(range_); - stuff_last = stuff_last_; - } - private: - /*override*/ task* execute() { - body( *range.begin(), final_scan_tag() ); - if( stuff_last ) - stuff_last->assign(body); - return NULL; - } - }; - - //! Split work to be done in the scan. - /** @ingroup algorithms */ - template - class sum_node: public task { - typedef final_sum final_sum_type; - public: - final_sum_type *incoming; - final_sum_type *body; - Body *stuff_last; - private: - final_sum_type *left_sum; - sum_node *left; - sum_node *right; - bool left_is_final; - Range range; - sum_node( const Range range_, bool left_is_final_ ) : - left_sum(NULL), - left(NULL), - right(NULL), - left_is_final(left_is_final_), - range(range_) - { - // Poison fields that will be set by second pass. - poison_pointer(body); - poison_pointer(incoming); - } - task* create_child( const Range& range, final_sum_type& f, sum_node* n, final_sum_type* incoming, Body* stuff_last ) { - if( !n ) { - f.recycle_as_child_of( *this ); - f.finish_construction( range, stuff_last ); - return &f; - } else { - n->body = &f; - n->incoming = incoming; - n->stuff_last = stuff_last; - return n; - } - } - /*override*/ task* execute() { - if( body ) { - if( incoming ) - left_sum->body.reverse_join( incoming->body ); - recycle_as_continuation(); - sum_node& c = *this; - task* b = c.create_child(Range(range,split()),*left_sum,right,left_sum,stuff_last); - task* a = left_is_final ? NULL : c.create_child(range,*body,left,incoming,NULL); - set_ref_count( (a!=NULL)+(b!=NULL) ); - body = NULL; - if( a ) spawn(*b); - else a = b; - return a; - } else { - return NULL; - } - } - template - friend class start_scan; - - template - friend class finish_scan; - }; - - //! Combine partial results - /** @ingroup algorithms */ - template - class finish_scan: public task { - typedef sum_node sum_node_type; - typedef final_sum final_sum_type; - final_sum_type** const sum; - sum_node_type*& return_slot; - public: - final_sum_type* right_zombie; - sum_node_type& result; - - /*override*/ task* execute() { - __TBB_ASSERT( result.ref_count()==(result.left!=NULL)+(result.right!=NULL), NULL ); - if( result.left ) - result.left_is_final = false; - if( right_zombie && sum ) - ((*sum)->body).reverse_join(result.left_sum->body); - __TBB_ASSERT( !return_slot, NULL ); - if( right_zombie || result.right ) { - return_slot = &result; - } else { - destroy( result ); - } - if( right_zombie && !sum && !result.right ) destroy(*right_zombie); - return NULL; - } - - finish_scan( sum_node_type*& return_slot_, final_sum_type** sum_, sum_node_type& result_ ) : - sum(sum_), - return_slot(return_slot_), - right_zombie(NULL), - result(result_) - { - __TBB_ASSERT( !return_slot, NULL ); - } - }; - - //! Initial task to split the work - /** @ingroup algorithms */ - template - class start_scan: public task { - typedef sum_node sum_node_type; - typedef final_sum final_sum_type; - final_sum_type* body; - /** Non-null if caller is requesting total. */ - final_sum_type** sum; - sum_node_type** return_slot; - /** Null if computing root. */ - sum_node_type* parent_sum; - bool is_final; - bool is_right_child; - Range range; - typename Partitioner::partition_type partition; - /*override*/ task* execute(); - public: - start_scan( sum_node_type*& return_slot_, start_scan& parent, sum_node_type* parent_sum_ ) : - body(parent.body), - sum(parent.sum), - return_slot(&return_slot_), - parent_sum(parent_sum_), - is_final(parent.is_final), - is_right_child(false), - range(parent.range,split()), - partition(parent.partition,split()) - { - __TBB_ASSERT( !*return_slot, NULL ); - } - - start_scan( sum_node_type*& return_slot_, const Range& range_, final_sum_type& body_, const Partitioner& partitioner_) : - body(&body_), - sum(NULL), - return_slot(&return_slot_), - parent_sum(NULL), - is_final(true), - is_right_child(false), - range(range_), - partition(partitioner_) - { - __TBB_ASSERT( !*return_slot, NULL ); - } - - static void run( const Range& range, Body& body, const Partitioner& partitioner ) { - if( !range.empty() ) { - typedef internal::start_scan start_pass1_type; - internal::sum_node* root = NULL; - typedef internal::final_sum final_sum_type; - final_sum_type* temp_body = new(task::allocate_root()) final_sum_type( body ); - start_pass1_type& pass1 = *new(task::allocate_root()) start_pass1_type( - /*return_slot=*/root, - range, - *temp_body, - partitioner ); - task::spawn_root_and_wait( pass1 ); - if( root ) { - root->body = temp_body; - root->incoming = NULL; - root->stuff_last = &body; - task::spawn_root_and_wait( *root ); - } else { - body.assign(temp_body->body); - temp_body->finish_construction( range, NULL ); - temp_body->destroy(*temp_body); - } - } - } - }; - - template - task* start_scan::execute() { - typedef internal::finish_scan finish_pass1_type; - finish_pass1_type* p = parent_sum ? static_cast( parent() ) : NULL; - // Inspecting p->result.left_sum would ordinarily be a race condition. - // But we inspect it only if we are not a stolen task, in which case we - // know that task assigning to p->result.left_sum has completed. - bool treat_as_stolen = is_right_child && (is_stolen_task() || body!=p->result.left_sum); - if( treat_as_stolen ) { - // Invocation is for right child that has been really stolen or needs to be virtually stolen - p->right_zombie = body = new( allocate_root() ) final_sum_type(body->body); - is_final = false; - } - task* next_task = NULL; - if( (is_right_child && !treat_as_stolen) || !range.is_divisible() || partition.should_execute_range(*this) ) { - if( is_final ) - (body->body)( range, final_scan_tag() ); - else if( sum ) - (body->body)( range, pre_scan_tag() ); - if( sum ) - *sum = body; - __TBB_ASSERT( !*return_slot, NULL ); - } else { - sum_node_type* result; - if( parent_sum ) - result = new(allocate_additional_child_of(*parent_sum)) sum_node_type(range,/*left_is_final=*/is_final); - else - result = new(task::allocate_root()) sum_node_type(range,/*left_is_final=*/is_final); - finish_pass1_type& c = *new( allocate_continuation()) finish_pass1_type(*return_slot,sum,*result); - // Split off right child - start_scan& b = *new( c.allocate_child() ) start_scan( /*return_slot=*/result->right, *this, result ); - b.is_right_child = true; - // Left child is recycling of *this. Must recycle this before spawning b, - // otherwise b might complete and decrement c.ref_count() to zero, which - // would cause c.execute() to run prematurely. - recycle_as_child_of(c); - c.set_ref_count(2); - c.spawn(b); - sum = &result->left_sum; - return_slot = &result->left; - is_right_child = false; - next_task = this; - parent_sum = result; - __TBB_ASSERT( !*return_slot, NULL ); - } - return next_task; - } -} // namespace internal -//! @endcond - -// Requirements on Range concept are documented in blocked_range.h - -/** \page parallel_scan_body_req Requirements on parallel_scan body - Class \c Body implementing the concept of parallel_reduce body must define: - - \code Body::Body( Body&, split ); \endcode Splitting constructor. - Split \c b so that \c this and \c b can accumulate separately - - \code Body::~Body(); \endcode Destructor - - \code void Body::operator()( const Range& r, pre_scan_tag ); \endcode - Preprocess iterations for range \c r - - \code void Body::operator()( const Range& r, final_scan_tag ); \endcode - Do final processing for iterations of range \c r - - \code void Body::reverse_join( Body& a ); \endcode - Merge preprocessing state of \c a into \c this, where \c a was - created earlier from \c b by b's splitting constructor -**/ - -/** \name parallel_scan - See also requirements on \ref range_req "Range" and \ref parallel_scan_body_req "parallel_scan Body". **/ -//@{ - -//! Parallel prefix with simple_partitioner -/** @ingroup algorithms **/ -template -void parallel_scan( const Range& range, Body& body, const simple_partitioner& partitioner=simple_partitioner() ) { - internal::start_scan::run(range,body,partitioner); -} - -//! Parallel prefix with auto_partitioner -/** @ingroup algorithms **/ -template -void parallel_scan( const Range& range, Body& body, const auto_partitioner& partitioner ) { - internal::start_scan::run(range,body,partitioner); -} -//@} - -} // namespace tbb - -#endif /* __TBB_parallel_scan_H */ - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_sort.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_sort.h deleted file mode 100644 index 38b380dea3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_sort.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_parallel_sort_H -#define __TBB_parallel_sort_H - -#include "parallel_for.h" -#include "blocked_range.h" -#include -#include -#include - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - -//! Range used in quicksort to split elements into subranges based on a value. -/** The split operation selects a splitter and places all elements less than or equal - to the value in the first range and the remaining elements in the second range. - @ingroup algorithms */ -template -class quick_sort_range: private no_assign { - - inline size_t median_of_three(const RandomAccessIterator &array, size_t l, size_t m, size_t r) const { - return comp(array[l], array[m]) ? ( comp(array[m], array[r]) ? m : ( comp( array[l], array[r]) ? r : l ) ) - : ( comp(array[r], array[m]) ? m : ( comp( array[r], array[l] ) ? r : l ) ); - } - - inline size_t pseudo_median_of_nine( const RandomAccessIterator &array, const quick_sort_range &range ) const { - size_t offset = range.size/8u; - return median_of_three(array, - median_of_three(array, 0, offset, offset*2), - median_of_three(array, offset*3, offset*4, offset*5), - median_of_three(array, offset*6, offset*7, range.size - 1) ); - - } - -public: - - static const size_t grainsize = 500; - const Compare ∁ - RandomAccessIterator begin; - size_t size; - - quick_sort_range( RandomAccessIterator begin_, size_t size_, const Compare &comp_ ) : - comp(comp_), begin(begin_), size(size_) {} - - bool empty() const {return size==0;} - bool is_divisible() const {return size>=grainsize;} - - quick_sort_range( quick_sort_range& range, split ) : comp(range.comp) { - RandomAccessIterator array = range.begin; - RandomAccessIterator key0 = range.begin; - size_t m = pseudo_median_of_nine(array, range); - if (m) std::swap ( array[0], array[m] ); - - size_t i=0; - size_t j=range.size; - // Partition interval [i+1,j-1] with key *key0. - for(;;) { - __TBB_ASSERT( i -class quick_sort_pretest_body : internal::no_assign { - const Compare ∁ - -public: - quick_sort_pretest_body(const Compare &_comp) : comp(_comp) {} - - void operator()( const blocked_range& range ) const { - task &my_task = task::self(); - RandomAccessIterator my_end = range.end(); - - int i = 0; - for (RandomAccessIterator k = range.begin(); k != my_end; ++k, ++i) { - if ( i%64 == 0 && my_task.is_cancelled() ) break; - - // The k-1 is never out-of-range because the first chunk starts at begin+serial_cutoff+1 - if ( comp( *(k), *(k-1) ) ) { - my_task.cancel_group_execution(); - break; - } - } - } - -}; - -//! Body class used to sort elements in a range that is smaller than the grainsize. -/** @ingroup algorithms */ -template -struct quick_sort_body { - void operator()( const quick_sort_range& range ) const { - //SerialQuickSort( range.begin, range.size, range.comp ); - std::sort( range.begin, range.begin + range.size, range.comp ); - } -}; - -//! Wrapper method to initiate the sort by calling parallel_for. -/** @ingroup algorithms */ -template -void parallel_quick_sort( RandomAccessIterator begin, RandomAccessIterator end, const Compare& comp ) { - task_group_context my_context; - const int serial_cutoff = 9; - - __TBB_ASSERT( begin + serial_cutoff < end, "min_parallel_size is smaller than serial cutoff?" ); - RandomAccessIterator k; - for ( k = begin ; k != begin + serial_cutoff; ++k ) { - if ( comp( *(k+1), *k ) ) { - goto do_parallel_quick_sort; - } - } - - parallel_for( blocked_range(k+1, end), - quick_sort_pretest_body(comp), - auto_partitioner(), - my_context); - - if (my_context.is_group_execution_cancelled()) -do_parallel_quick_sort: - parallel_for( quick_sort_range(begin, end-begin, comp ), - quick_sort_body(), - auto_partitioner() ); -} - -} // namespace internal -//! @endcond - -/** \page parallel_sort_iter_req Requirements on iterators for parallel_sort - Requirements on value type \c T of \c RandomAccessIterator for \c parallel_sort: - - \code void swap( T& x, T& y ) \endcode Swaps \c x and \c y - - \code bool Compare::operator()( const T& x, const T& y ) \endcode - True if x comes before y; -**/ - -/** \name parallel_sort - See also requirements on \ref parallel_sort_iter_req "iterators for parallel_sort". **/ -//@{ - -//! Sorts the data in [begin,end) using the given comparator -/** The compare function object is used for all comparisons between elements during sorting. - The compare object must define a bool operator() function. - @ingroup algorithms **/ -template -void parallel_sort( RandomAccessIterator begin, RandomAccessIterator end, const Compare& comp) { - const int min_parallel_size = 500; - if( end > begin ) { - if (end - begin < min_parallel_size) { - std::sort(begin, end, comp); - } else { - internal::parallel_quick_sort(begin, end, comp); - } - } -} - -//! Sorts the data in [begin,end) with a default comparator \c std::less -/** @ingroup algorithms **/ -template -inline void parallel_sort( RandomAccessIterator begin, RandomAccessIterator end ) { - parallel_sort( begin, end, std::less< typename std::iterator_traits::value_type >() ); -} - -//! Sorts the data in the range \c [begin,end) with a default comparator \c std::less -/** @ingroup algorithms **/ -template -inline void parallel_sort( T * begin, T * end ) { - parallel_sort( begin, end, std::less< T >() ); -} -//@} - - -} // namespace tbb - -#endif - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_while.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_while.h deleted file mode 100644 index a4ad9e6e2e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/parallel_while.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_parallel_while -#define __TBB_parallel_while - -#include "task.h" -#include - -namespace tbb { - -template -class parallel_while; - -//! @cond INTERNAL -namespace internal { - - template class while_task; - - //! For internal use only. - /** Executes one iteration of a while. - @ingroup algorithms */ - template - class while_iteration_task: public task { - const Body& my_body; - typename Body::argument_type my_value; - /*override*/ task* execute() { - my_body(my_value); - return NULL; - } - while_iteration_task( const typename Body::argument_type& value, const Body& body ) : - my_body(body), my_value(value) - {} - template friend class while_group_task; - friend class tbb::parallel_while; - }; - - //! For internal use only - /** Unpacks a block of iterations. - @ingroup algorithms */ - template - class while_group_task: public task { - static const size_t max_arg_size = 4; - const Body& my_body; - size_t size; - typename Body::argument_type my_arg[max_arg_size]; - while_group_task( const Body& body ) : my_body(body), size(0) {} - /*override*/ task* execute() { - typedef while_iteration_task iteration_type; - __TBB_ASSERT( size>0, NULL ); - task_list list; - task* t; - size_t k=0; - for(;;) { - t = new( allocate_child() ) iteration_type(my_arg[k],my_body); - if( ++k==size ) break; - list.push_back(*t); - } - set_ref_count(int(k+1)); - spawn(list); - spawn_and_wait_for_all(*t); - return NULL; - } - template friend class while_task; - }; - - //! For internal use only. - /** Gets block of iterations from a stream and packages them into a while_group_task. - @ingroup algorithms */ - template - class while_task: public task { - Stream& my_stream; - const Body& my_body; - empty_task& my_barrier; - /*override*/ task* execute() { - typedef while_group_task block_type; - block_type& t = *new( allocate_additional_child_of(my_barrier) ) block_type(my_body); - size_t k=0; - while( my_stream.pop_if_present(t.my_arg[k]) ) { - if( ++k==block_type::max_arg_size ) { - // There might be more iterations. - recycle_to_reexecute(); - break; - } - } - if( k==0 ) { - destroy(t); - return NULL; - } else { - t.size = k; - return &t; - } - } - while_task( Stream& stream, const Body& body, empty_task& barrier ) : - my_stream(stream), - my_body(body), - my_barrier(barrier) - {} - friend class tbb::parallel_while; - }; - -} // namespace internal -//! @endcond - -//! Parallel iteration over a stream, with optional addition of more work. -/** The Body b has the requirement: \n - "b(v)" \n - "b.argument_type" \n - where v is an argument_type - @ingroup algorithms */ -template -class parallel_while: internal::no_copy { -public: - //! Construct empty non-running parallel while. - parallel_while() : my_body(NULL), my_barrier(NULL) {} - - //! Destructor cleans up data members before returning. - ~parallel_while() { - if( my_barrier ) { - my_barrier->destroy(*my_barrier); - my_barrier = NULL; - } - } - - //! Type of items - typedef typename Body::argument_type value_type; - - //! Apply body.apply to each item in the stream. - /** A Stream s has the requirements \n - "S::value_type" \n - "s.pop_if_present(value) is convertible to bool */ - template - void run( Stream& stream, const Body& body ); - - //! Add a work item while running. - /** Should be executed only by body.apply or a thread spawned therefrom. */ - void add( const value_type& item ); - -private: - const Body* my_body; - empty_task* my_barrier; -}; - -template -template -void parallel_while::run( Stream& stream, const Body& body ) { - using namespace internal; - empty_task& barrier = *new( task::allocate_root() ) empty_task(); - my_body = &body; - my_barrier = &barrier; - my_barrier->set_ref_count(2); - while_task& w = *new( my_barrier->allocate_child() ) while_task( stream, body, barrier ); - my_barrier->spawn_and_wait_for_all(w); - my_barrier->destroy(*my_barrier); - my_barrier = NULL; - my_body = NULL; -} - -template -void parallel_while::add( const value_type& item ) { - __TBB_ASSERT(my_barrier,"attempt to add to parallel_while that is not running"); - typedef internal::while_iteration_task iteration_type; - iteration_type& i = *new( task::self().allocate_additional_child_of(*my_barrier) ) iteration_type(item,*my_body); - task::self().spawn( i ); -} - -} // namespace - -#endif /* __TBB_parallel_while */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/partitioner.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/partitioner.h deleted file mode 100644 index 4529760db9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/partitioner.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_partitioner_H -#define __TBB_partitioner_H - -#include "task.h" - -namespace tbb { -class affinity_partitioner; - -//! @cond INTERNAL -namespace internal { -size_t __TBB_EXPORTED_FUNC get_initial_auto_partitioner_divisor(); - -//! Defines entry points into tbb run-time library; -/** The entry points are the constructor and destructor. */ -class affinity_partitioner_base_v3: no_copy { - friend class tbb::affinity_partitioner; - //! Array that remembers affinities of tree positions to affinity_id. - /** NULL if my_size==0. */ - affinity_id* my_array; - //! Number of elements in my_array. - size_t my_size; - //! Zeros the fields. - affinity_partitioner_base_v3() : my_array(NULL), my_size(0) {} - //! Deallocates my_array. - ~affinity_partitioner_base_v3() {resize(0);} - //! Resize my_array. - /** Retains values if resulting size is the same. */ - void __TBB_EXPORTED_METHOD resize( unsigned factor ); - friend class affinity_partition_type; -}; - -//! Provides default methods for partition objects without affinity. -class partition_type_base { -public: - void set_affinity( task & ) {} - void note_affinity( task::affinity_id ) {} - task* continue_after_execute_range( task& ) {return NULL;} - bool decide_whether_to_delay() {return false;} - void spawn_or_delay( bool, task& a, task& b ) { - a.spawn(b); - } -}; - -class affinity_partition_type; - -template class start_for; -template class start_reduce; -template class start_reduce_with_affinity; -template class start_scan; - -} // namespace internal -//! @endcond - -//! A simple partitioner -/** Divides the range until the range is not divisible. - @ingroup algorithms */ -class simple_partitioner { -public: - simple_partitioner() {} -private: - template friend class internal::start_for; - template friend class internal::start_reduce; - template friend class internal::start_scan; - - class partition_type: public internal::partition_type_base { - public: - bool should_execute_range(const task& ) {return false;} - partition_type( const simple_partitioner& ) {} - partition_type( const partition_type&, split ) {} - }; -}; - -//! An auto partitioner -/** The range is initial divided into several large chunks. - Chunks are further subdivided into VICTIM_CHUNKS pieces if they are stolen and divisible. - @ingroup algorithms */ -class auto_partitioner { -public: - auto_partitioner() {} - -private: - template friend class internal::start_for; - template friend class internal::start_reduce; - template friend class internal::start_scan; - - class partition_type: public internal::partition_type_base { - size_t num_chunks; - static const size_t VICTIM_CHUNKS = 4; -public: - bool should_execute_range(const task &t) { - if( num_chunks friend class internal::start_for; - template friend class internal::start_reduce_with_affinity; - template friend class internal::start_scan; - - typedef internal::affinity_partition_type partition_type; - friend class internal::affinity_partition_type; -}; - -//! @cond INTERNAL -namespace internal { - -class affinity_partition_type: public no_copy { - //! Must be power of two - static const unsigned factor = 16; - static const size_t VICTIM_CHUNKS = 4; - - internal::affinity_id* my_array; - task_list delay_list; - unsigned map_begin, map_end; - size_t num_chunks; -public: - affinity_partition_type( affinity_partitioner& ap ) { - __TBB_ASSERT( (factor&(factor-1))==0, "factor must be power of two" ); - ap.resize(factor); - my_array = ap.my_array; - map_begin = 0; - map_end = unsigned(ap.my_size); - num_chunks = internal::get_initial_auto_partitioner_divisor(); - } - affinity_partition_type(affinity_partition_type& p, split) : my_array(p.my_array) { - __TBB_ASSERT( p.map_end-p.map_beginfactor ) - d &= 0u-factor; - map_end = e; - map_begin = p.map_end = e-d; - } - - bool should_execute_range(const task &t) { - if( num_chunks < VICTIM_CHUNKS && t.is_stolen_task() ) - num_chunks = VICTIM_CHUNKS; - return num_chunks == 1; - } - - void set_affinity( task &t ) { - if( map_begin - -namespace tbb { - -class pipeline; -class filter; - -//! @cond INTERNAL -namespace internal { - -// The argument for PIPELINE_VERSION should be an integer between 2 and 9 -#define __TBB_PIPELINE_VERSION(x) (unsigned char)(x-2)<<1 - -typedef unsigned long Token; -typedef long tokendiff_t; -class stage_task; -class ordered_buffer; - -} // namespace internal -//! @endcond - -//! A stage in a pipeline. -/** @ingroup algorithms */ -class filter: internal::no_copy { -private: - //! Value used to mark "not in pipeline" - static filter* not_in_pipeline() {return reinterpret_cast(internal::intptr(-1));} - - //! The lowest bit 0 is for parallel vs. serial - static const unsigned char filter_is_serial = 0x1; - - //! 4th bit distinguish ordered vs unordered - // The bit was not set for parallel filters in TBB 2.1 and earlier, - // but is_ordered() function always treats parallel filters as out of order - static const unsigned char filter_is_out_of_order = 0x1<<4; - - static const unsigned char current_version = __TBB_PIPELINE_VERSION(4); - static const unsigned char version_mask = 0x7<<1; // bits 1-3 are for version -public: - enum mode { - //! processes multiple items in parallel and in no particular order - parallel = current_version | filter_is_out_of_order, - //! processes items one at a time; all such filters process items in the same order - serial_in_order = current_version | filter_is_serial, - //! processes items one at a time and in no particular order - serial_out_of_order = current_version | filter_is_serial | filter_is_out_of_order, - //! @deprecated use serial_in_order instead - serial = serial_in_order - }; -protected: - filter( bool is_serial_ ) : - next_filter_in_pipeline(not_in_pipeline()), - input_buffer(NULL), - my_filter_mode(static_cast(is_serial_ ? serial : parallel)), - prev_filter_in_pipeline(not_in_pipeline()), - my_pipeline(NULL) - {} - - filter( mode filter_mode ) : - next_filter_in_pipeline(not_in_pipeline()), - input_buffer(NULL), - my_filter_mode(static_cast(filter_mode)), - prev_filter_in_pipeline(not_in_pipeline()), - my_pipeline(NULL) - {} - -public: - //! True if filter is serial. - bool is_serial() const { - return bool( my_filter_mode & filter_is_serial ); - } - - // ! True if filter must receive stream in order. - bool is_ordered() const { - return (my_filter_mode & (filter_is_out_of_order|filter_is_serial))==filter_is_serial; - } - - //! Operate on an item from the input stream, and return item for output stream. - /** Returns NULL if filter is a sink. */ - virtual void* operator()( void* item ) = 0; - - //! Destroy filter. - /** If the filter was added to a pipeline, the pipeline must be destroyed first. */ - virtual __TBB_EXPORTED_METHOD ~filter(); - -#if __TBB_EXCEPTIONS - //! Destroys item if pipeline is cancelled - /** Required to prevent memory leaks - Note it can be called concurrently even for serial filters.*/ - virtual void finalize( void* /*item*/ ) {}; -#endif - -private: - //! Pointer to next filter in the pipeline. - filter* next_filter_in_pipeline; - - //! Input buffer for filter that requires serial input; NULL otherwise. */ - internal::ordered_buffer* input_buffer; - - friend class internal::stage_task; - friend class pipeline; - - //! Internal storage for is_serial() - const unsigned char my_filter_mode; - - //! Pointer to previous filter in the pipeline. - filter* prev_filter_in_pipeline; - - //! Pointer to the pipeline - pipeline* my_pipeline; -}; - -//! A processing pipeling that applies filters to items. -/** @ingroup algorithms */ -class pipeline { -public: - //! Construct empty pipeline. - __TBB_EXPORTED_METHOD pipeline(); - - /** Though the current implementation declares the destructor virtual, do not rely on this - detail. The virtualness is deprecated and may disappear in future versions of TBB. */ - virtual __TBB_EXPORTED_METHOD ~pipeline(); - - //! Add filter to end of pipeline. - void __TBB_EXPORTED_METHOD add_filter( filter& filter_ ); - - //! Run the pipeline to completion. - void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens ); - -#if __TBB_EXCEPTIONS - //! Run the pipeline to completion with user-supplied context - void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens, tbb::task_group_context& context ); -#endif - - //! Remove all filters from the pipeline - void __TBB_EXPORTED_METHOD clear(); - -private: - friend class internal::stage_task; - friend class filter; - - //! Pointer to first filter in the pipeline. - filter* filter_list; - - //! Pointer to location where address of next filter to be added should be stored. - filter* filter_end; - - //! task who's reference count is used to determine when all stages are done. - empty_task* end_counter; - - //! Number of idle tokens waiting for input stage. - atomic input_tokens; - - //! Number of tokens created so far. - internal::Token token_counter; - - //! False until fetch_input returns NULL. - bool end_of_input; - - //! Remove filter from pipeline. - void remove_filter( filter& filter_ ); - - //! Not used, but retained to satisfy old export files. - void __TBB_EXPORTED_METHOD inject_token( task& self ); - -#if __TBB_EXCEPTIONS - //! Does clean up if pipeline is cancelled or exception occured - void clear_filters(); -#endif -}; - -} // tbb - -#endif /* __TBB_pipeline_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_mutex.h deleted file mode 100644 index a7cb71c1b9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_mutex.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_queuing_mutex_H -#define __TBB_queuing_mutex_H - -#include -#include "atomic.h" -#include "tbb_profiling.h" - -namespace tbb { - -//! Queuing lock with local-only spinning. -/** @ingroup synchronization */ -class queuing_mutex { -public: - //! Construct unacquired mutex. - queuing_mutex() { - q_tail = NULL; -#if TBB_USE_THREADING_TOOLS - internal_construct(); -#endif - } - - //! The scoped locking pattern - /** It helps to avoid the common problem of forgetting to release lock. - It also nicely provides the "node" for queuing locks. */ - class scoped_lock: internal::no_copy { - //! Initialize fields to mean "no lock held". - void initialize() { - mutex = NULL; -#if TBB_USE_ASSERT - internal::poison_pointer(next); -#endif /* TBB_USE_ASSERT */ - } - public: - //! Construct lock that has not acquired a mutex. - /** Equivalent to zero-initialization of *this. */ - scoped_lock() {initialize();} - - //! Acquire lock on given mutex. - /** Upon entry, *this should not be in the "have acquired a mutex" state. */ - scoped_lock( queuing_mutex& m ) { - initialize(); - acquire(m); - } - - //! Release lock (if lock is held). - ~scoped_lock() { - if( mutex ) release(); - } - - //! Acquire lock on given mutex. - void __TBB_EXPORTED_METHOD acquire( queuing_mutex& m ); - - //! Acquire lock on given mutex if free (i.e. non-blocking) - bool __TBB_EXPORTED_METHOD try_acquire( queuing_mutex& m ); - - //! Release lock. - void __TBB_EXPORTED_METHOD release(); - - private: - //! The pointer to the mutex owned, or NULL if not holding a mutex. - queuing_mutex* mutex; - - //! The pointer to the next competitor for a mutex - scoped_lock *next; - - //! The local spin-wait variable - /** Inverted (0 - blocked, 1 - acquired the mutex) for the sake of - zero-initialization. Defining it as an entire word instead of - a byte seems to help performance slightly. */ - internal::uintptr going; - }; - - void __TBB_EXPORTED_METHOD internal_construct(); - - // Mutex traits - static const bool is_rw_mutex = false; - static const bool is_recursive_mutex = false; - static const bool is_fair_mutex = true; - - friend class scoped_lock; -private: - //! The last competitor requesting the lock - atomic q_tail; - -}; - -__TBB_DEFINE_PROFILING_SET_NAME(queuing_mutex) - -} // namespace tbb - -#endif /* __TBB_queuing_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_rw_mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_rw_mutex.h deleted file mode 100644 index 27456f6851..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/queuing_rw_mutex.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_queuing_rw_mutex_H -#define __TBB_queuing_rw_mutex_H - -#include -#include "atomic.h" -#include "tbb_profiling.h" - -namespace tbb { - -//! Reader-writer lock with local-only spinning. -/** Adapted from Krieger, Stumm, et al. pseudocode at - http://www.eecg.toronto.edu/parallel/pubs_abs.html#Krieger_etal_ICPP93 - @ingroup synchronization */ -class queuing_rw_mutex { -public: - //! Construct unacquired mutex. - queuing_rw_mutex() { - q_tail = NULL; -#if TBB_USE_THREADING_TOOLS - internal_construct(); -#endif - } - - //! Destructor asserts if the mutex is acquired, i.e. q_tail is non-NULL - ~queuing_rw_mutex() { -#if TBB_USE_ASSERT - __TBB_ASSERT( !q_tail, "destruction of an acquired mutex"); -#endif - } - - class scoped_lock; - friend class scoped_lock; - - //! The scoped locking pattern - /** It helps to avoid the common problem of forgetting to release lock. - It also nicely provides the "node" for queuing locks. */ - class scoped_lock: internal::no_copy { - //! Initialize fields - void initialize() { - mutex = NULL; -#if TBB_USE_ASSERT - state = 0xFF; // Set to invalid state - internal::poison_pointer(next); - internal::poison_pointer(prev); -#endif /* TBB_USE_ASSERT */ - } - public: - //! Construct lock that has not acquired a mutex. - /** Equivalent to zero-initialization of *this. */ - scoped_lock() {initialize();} - - //! Acquire lock on given mutex. - /** Upon entry, *this should not be in the "have acquired a mutex" state. */ - scoped_lock( queuing_rw_mutex& m, bool write=true ) { - initialize(); - acquire(m,write); - } - - //! Release lock (if lock is held). - ~scoped_lock() { - if( mutex ) release(); - } - - //! Acquire lock on given mutex. - void acquire( queuing_rw_mutex& m, bool write=true ); - - //! Try acquire lock on given mutex. - bool try_acquire( queuing_rw_mutex& m, bool write=true ); - - //! Release lock. - void release(); - - //! Upgrade reader to become a writer. - /** Returns true if the upgrade happened without re-acquiring the lock and false if opposite */ - bool upgrade_to_writer(); - - //! Downgrade writer to become a reader. - bool downgrade_to_reader(); - - private: - //! The pointer to the current mutex to work - queuing_rw_mutex* mutex; - - //! The pointer to the previous and next competitors for a mutex - scoped_lock * prev, * next; - - typedef unsigned char state_t; - - //! State of the request: reader, writer, active reader, other service states - atomic state; - - //! The local spin-wait variable - /** Corresponds to "spin" in the pseudocode but inverted for the sake of zero-initialization */ - unsigned char going; - - //! A tiny internal lock - unsigned char internal_lock; - - //! Acquire the internal lock - void acquire_internal_lock(); - - //! Try to acquire the internal lock - /** Returns true if lock was successfully acquired. */ - bool try_acquire_internal_lock(); - - //! Release the internal lock - void release_internal_lock(); - - //! Wait for internal lock to be released - void wait_for_release_of_internal_lock(); - - //! A helper function - void unblock_or_wait_on_internal_lock( uintptr_t ); - }; - - void __TBB_EXPORTED_METHOD internal_construct(); - - // Mutex traits - static const bool is_rw_mutex = true; - static const bool is_recursive_mutex = false; - static const bool is_fair_mutex = true; - -private: - //! The last competitor requesting the lock - atomic q_tail; - -}; - -__TBB_DEFINE_PROFILING_SET_NAME(queuing_rw_mutex) - -} // namespace tbb - -#endif /* __TBB_queuing_rw_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/recursive_mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/recursive_mutex.h deleted file mode 100644 index 886a319213..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/recursive_mutex.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_recursive_mutex_H -#define __TBB_recursive_mutex_H - -#if _WIN32||_WIN64 - -#include -#if !defined(_WIN32_WINNT) -// The following Windows API function is declared explicitly; -// otherwise any user would have to specify /D_WIN32_WINNT=0x0400 -extern "C" BOOL WINAPI TryEnterCriticalSection( LPCRITICAL_SECTION ); -#endif - -#else /* if not _WIN32||_WIN64 */ - -#include -namespace tbb { namespace internal { -// Use this internal TBB function to throw an exception - extern void handle_perror( int error_code, const char* what ); -} } //namespaces - -#endif /* _WIN32||_WIN64 */ - -#include "tbb_stddef.h" -#include "tbb_profiling.h" - -namespace tbb { -//! Mutex that allows recursive mutex acquisition. -/** Mutex that allows recursive mutex acquisition. - @ingroup synchronization */ -class recursive_mutex { -public: - //! Construct unacquired recursive_mutex. - recursive_mutex() { -#if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS - internal_construct(); -#else - #if _WIN32||_WIN64 - InitializeCriticalSection(&impl); - #else - pthread_mutexattr_t mtx_attr; - int error_code = pthread_mutexattr_init( &mtx_attr ); - if( error_code ) - tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutexattr_init failed"); - - pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE ); - error_code = pthread_mutex_init( &impl, &mtx_attr ); - if( error_code ) - tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutex_init failed"); - - pthread_mutexattr_destroy( &mtx_attr ); - #endif /* _WIN32||_WIN64*/ -#endif /* TBB_USE_ASSERT */ - }; - - ~recursive_mutex() { -#if TBB_USE_ASSERT - internal_destroy(); -#else - #if _WIN32||_WIN64 - DeleteCriticalSection(&impl); - #else - pthread_mutex_destroy(&impl); - - #endif /* _WIN32||_WIN64 */ -#endif /* TBB_USE_ASSERT */ - }; - - class scoped_lock; - friend class scoped_lock; - - //! The scoped locking pattern - /** It helps to avoid the common problem of forgetting to release lock. - It also nicely provides the "node" for queuing locks. */ - class scoped_lock: internal::no_copy { - public: - //! Construct lock that has not acquired a recursive_mutex. - scoped_lock() : my_mutex(NULL) {}; - - //! Acquire lock on given mutex. - /** Upon entry, *this should not be in the "have acquired a mutex" state. */ - scoped_lock( recursive_mutex& mutex ) { - acquire( mutex ); - } - - //! Release lock (if lock is held). - ~scoped_lock() { - if( my_mutex ) - release(); - } - - //! Acquire lock on given mutex. - void acquire( recursive_mutex& mutex ) { -#if TBB_USE_ASSERT - internal_acquire( mutex ); -#else - my_mutex = &mutex; - #if _WIN32||_WIN64 - EnterCriticalSection(&mutex.impl); - #else - pthread_mutex_lock( &mutex.impl ); - #endif /* _WIN32||_WIN64 */ -#endif /* TBB_USE_ASSERT */ - } - - //! Try acquire lock on given recursive_mutex. - bool try_acquire( recursive_mutex& mutex ) { -#if TBB_USE_ASSERT - return internal_try_acquire( mutex ); -#else - bool result; - #if _WIN32||_WIN64 - result = TryEnterCriticalSection(&mutex.impl)!=0; - #else - result = pthread_mutex_trylock(&mutex.impl)==0; - #endif /* _WIN32||_WIN64 */ - if( result ) - my_mutex = &mutex; - - return result; -#endif /* TBB_USE_ASSERT */ - } - - //! Release lock - void release() { -#if TBB_USE_ASSERT - internal_release (); -#else - #if _WIN32||_WIN64 - LeaveCriticalSection(&my_mutex->impl); - #else - pthread_mutex_unlock(&my_mutex->impl); - #endif /* _WIN32||_WIN64 */ - my_mutex = NULL; -#endif /* TBB_USE_ASSERT */ - } - - private: - //! The pointer to the current recursive_mutex to work - recursive_mutex* my_mutex; - - //! All checks from acquire using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_acquire( recursive_mutex& m ); - - //! All checks from try_acquire using mutex.state were moved here - bool __TBB_EXPORTED_METHOD internal_try_acquire( recursive_mutex& m ); - - //! All checks from release using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_release(); - }; - - // Mutex traits - static const bool is_rw_mutex = false; - static const bool is_recursive_mutex = true; - static const bool is_fair_mutex = false; - -private: -#if _WIN32||_WIN64 - CRITICAL_SECTION impl; - enum state_t { - INITIALIZED=0x1234, - DESTROYED=0x789A, - } state; -#else - pthread_mutex_t impl; -#endif /* _WIN32||_WIN64 */ - - //! All checks from mutex constructor using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_construct(); - - //! All checks from mutex destructor using mutex.state were moved here - void __TBB_EXPORTED_METHOD internal_destroy(); -}; - -__TBB_DEFINE_PROFILING_SET_NAME(recursive_mutex) - -} // namespace tbb - -#endif /* __TBB_recursive_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/scalable_allocator.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/scalable_allocator.h deleted file mode 100644 index c8fd2d13bb..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/scalable_allocator.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_scalable_allocator_H -#define __TBB_scalable_allocator_H -/** @file */ - -#include /* Need ptrdiff_t and size_t from here. */ - -#if !defined(__cplusplus) && __ICC==1100 - #pragma warning (push) - #pragma warning (disable: 991) -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#if _MSC_VER >= 1400 -#define __TBB_EXPORTED_FUNC __cdecl -#else -#define __TBB_EXPORTED_FUNC -#endif - -/** The "malloc" analogue to allocate block of memory of size bytes. - * @ingroup memory_allocation */ -void * __TBB_EXPORTED_FUNC scalable_malloc (size_t size); - -/** The "free" analogue to discard a previously allocated piece of memory. - @ingroup memory_allocation */ -void __TBB_EXPORTED_FUNC scalable_free (void* ptr); - -/** The "realloc" analogue complementing scalable_malloc. - @ingroup memory_allocation */ -void * __TBB_EXPORTED_FUNC scalable_realloc (void* ptr, size_t size); - -/** The "calloc" analogue complementing scalable_malloc. - @ingroup memory_allocation */ -void * __TBB_EXPORTED_FUNC scalable_calloc (size_t nobj, size_t size); - -/** The "posix_memalign" analogue. - @ingroup memory_allocation */ -int __TBB_EXPORTED_FUNC scalable_posix_memalign (void** memptr, size_t alignment, size_t size); - -/** The "_aligned_malloc" analogue. - @ingroup memory_allocation */ -void * __TBB_EXPORTED_FUNC scalable_aligned_malloc (size_t size, size_t alignment); - -/** The "_aligned_realloc" analogue. - @ingroup memory_allocation */ -void * __TBB_EXPORTED_FUNC scalable_aligned_realloc (void* ptr, size_t size, size_t alignment); - -/** The "_aligned_free" analogue. - @ingroup memory_allocation */ -void __TBB_EXPORTED_FUNC scalable_aligned_free (void* ptr); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#ifdef __cplusplus - -#include /* To use new with the placement argument */ - -/* Ensure that including this header does not cause implicit linkage with TBB */ -#ifndef __TBB_NO_IMPLICIT_LINKAGE - #define __TBB_NO_IMPLICIT_LINKAGE 1 - #include "tbb_stddef.h" - #undef __TBB_NO_IMPLICIT_LINKAGE -#else - #include "tbb_stddef.h" -#endif - - -namespace tbb { - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Workaround for erroneous "unreferenced parameter" warning in method destroy. - #pragma warning (push) - #pragma warning (disable: 4100) -#endif - -//! Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5 -/** The members are ordered the same way they are in section 20.4.1 - of the ISO C++ standard. - @ingroup memory_allocation */ -template -class scalable_allocator { -public: - typedef typename internal::allocator_type::value_type value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - template struct rebind { - typedef scalable_allocator other; - }; - - scalable_allocator() throw() {} - scalable_allocator( const scalable_allocator& ) throw() {} - template scalable_allocator(const scalable_allocator&) throw() {} - - pointer address(reference x) const {return &x;} - const_pointer address(const_reference x) const {return &x;} - - //! Allocate space for n objects. - pointer allocate( size_type n, const void* /*hint*/ =0 ) { - return static_cast( scalable_malloc( n * sizeof(value_type) ) ); - } - - //! Free previously allocated block of memory - void deallocate( pointer p, size_type ) { - scalable_free( p ); - } - - //! Largest value for which method allocate might succeed. - size_type max_size() const throw() { - size_type absolutemax = static_cast(-1) / sizeof (value_type); - return (absolutemax > 0 ? absolutemax : 1); - } - void construct( pointer p, const value_type& val ) { new(static_cast(p)) value_type(val); } - void destroy( pointer p ) {p->~value_type();} -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif // warning 4100 is back - -//! Analogous to std::allocator, as defined in ISO C++ Standard, Section 20.4.1 -/** @ingroup memory_allocation */ -template<> -class scalable_allocator { -public: - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - template struct rebind { - typedef scalable_allocator other; - }; -}; - -template -inline bool operator==( const scalable_allocator&, const scalable_allocator& ) {return true;} - -template -inline bool operator!=( const scalable_allocator&, const scalable_allocator& ) {return false;} - -} // namespace tbb - -#if _MSC_VER - #if __TBB_BUILD && !defined(__TBBMALLOC_NO_IMPLICIT_LINKAGE) - #define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1 - #endif - - #if !__TBBMALLOC_NO_IMPLICIT_LINKAGE - #ifdef _DEBUG - #pragma comment(lib, "tbbmalloc_debug.lib") - #else - #pragma comment(lib, "tbbmalloc.lib") - #endif - #endif - - -#endif - -#endif /* __cplusplus */ - -#if !defined(__cplusplus) && __ICC==1100 - #pragma warning (pop) -#endif // ICC 11.0 warning 991 is back - -#endif /* __TBB_scalable_allocator_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_mutex.h deleted file mode 100644 index 8e73c13477..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_mutex.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_spin_mutex_H -#define __TBB_spin_mutex_H - -#include -#include "tbb_stddef.h" -#include "tbb_machine.h" -#include "tbb_profiling.h" - -namespace tbb { - -//! A lock that occupies a single byte. -/** A spin_mutex is a spin mutex that fits in a single byte. - It should be used only for locking short critical sections - (typically <20 instructions) when fairness is not an issue. - If zero-initialized, the mutex is considered unheld. - @ingroup synchronization */ -class spin_mutex { - //! 0 if lock is released, 1 if lock is acquired. - unsigned char flag; - -public: - //! Construct unacquired lock. - /** Equivalent to zero-initialization of *this. */ - spin_mutex() : flag(0) { -#if TBB_USE_THREADING_TOOLS - internal_construct(); -#endif - } - - //! Represents acquisition of a mutex. - class scoped_lock : internal::no_copy { - private: - //! Points to currently held mutex, or NULL if no lock is held. - spin_mutex* my_mutex; - - //! Value to store into spin_mutex::flag to unlock the mutex. - internal::uintptr my_unlock_value; - - //! Like acquire, but with ITT instrumentation. - void __TBB_EXPORTED_METHOD internal_acquire( spin_mutex& m ); - - //! Like try_acquire, but with ITT instrumentation. - bool __TBB_EXPORTED_METHOD internal_try_acquire( spin_mutex& m ); - - //! Like release, but with ITT instrumentation. - void __TBB_EXPORTED_METHOD internal_release(); - - public: - //! Construct without acquiring a mutex. - scoped_lock() : my_mutex(NULL), my_unlock_value(0) {} - - //! Construct and acquire lock on a mutex. - scoped_lock( spin_mutex& m ) { -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - my_mutex=NULL; - internal_acquire(m); -#else - my_unlock_value = __TBB_LockByte(m.flag); - my_mutex=&m; -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/ - } - - //! Acquire lock. - void acquire( spin_mutex& m ) { -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - internal_acquire(m); -#else - my_unlock_value = __TBB_LockByte(m.flag); - my_mutex = &m; -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/ - } - - //! Try acquiring lock (non-blocking) - bool try_acquire( spin_mutex& m ) { -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - return internal_try_acquire(m); -#else - bool result = __TBB_TryLockByte(m.flag); - if( result ) { - my_unlock_value = 0; - my_mutex = &m; - } - return result; -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/ - } - - //! Release lock - void release() { -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - internal_release(); -#else - __TBB_store_with_release(my_mutex->flag, static_cast(my_unlock_value)); - my_mutex = NULL; -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ - } - - //! Destroy lock. If holding a lock, releases the lock first. - ~scoped_lock() { - if( my_mutex ) { -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - internal_release(); -#else - __TBB_store_with_release(my_mutex->flag, static_cast(my_unlock_value)); -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ - } - } - }; - - void __TBB_EXPORTED_METHOD internal_construct(); - - // Mutex traits - static const bool is_rw_mutex = false; - static const bool is_recursive_mutex = false; - static const bool is_fair_mutex = false; - - friend class scoped_lock; -}; - -__TBB_DEFINE_PROFILING_SET_NAME(spin_mutex) - -} // namespace tbb - -#endif /* __TBB_spin_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_rw_mutex.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_rw_mutex.h deleted file mode 100644 index de6cacd9dc..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/spin_rw_mutex.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_spin_rw_mutex_H -#define __TBB_spin_rw_mutex_H - -#include "tbb_stddef.h" -#include "tbb_machine.h" -#include "tbb_profiling.h" - -namespace tbb { - -class spin_rw_mutex_v3; -typedef spin_rw_mutex_v3 spin_rw_mutex; - -//! Fast, unfair, spinning reader-writer lock with backoff and writer-preference -/** @ingroup synchronization */ -class spin_rw_mutex_v3 { - //! @cond INTERNAL - - //! Internal acquire write lock. - bool __TBB_EXPORTED_METHOD internal_acquire_writer(); - - //! Out of line code for releasing a write lock. - /** This code is has debug checking and instrumentation for Intel(R) Thread Checker and Intel(R) Thread Profiler. */ - void __TBB_EXPORTED_METHOD internal_release_writer(); - - //! Internal acquire read lock. - void __TBB_EXPORTED_METHOD internal_acquire_reader(); - - //! Internal upgrade reader to become a writer. - bool __TBB_EXPORTED_METHOD internal_upgrade(); - - //! Out of line code for downgrading a writer to a reader. - /** This code is has debug checking and instrumentation for Intel(R) Thread Checker and Intel(R) Thread Profiler. */ - void __TBB_EXPORTED_METHOD internal_downgrade(); - - //! Internal release read lock. - void __TBB_EXPORTED_METHOD internal_release_reader(); - - //! Internal try_acquire write lock. - bool __TBB_EXPORTED_METHOD internal_try_acquire_writer(); - - //! Internal try_acquire read lock. - bool __TBB_EXPORTED_METHOD internal_try_acquire_reader(); - - //! @endcond -public: - //! Construct unacquired mutex. - spin_rw_mutex_v3() : state(0) { -#if TBB_USE_THREADING_TOOLS - internal_construct(); -#endif - } - -#if TBB_USE_ASSERT - //! Destructor asserts if the mutex is acquired, i.e. state is zero. - ~spin_rw_mutex_v3() { - __TBB_ASSERT( !state, "destruction of an acquired mutex"); - }; -#endif /* TBB_USE_ASSERT */ - - //! The scoped locking pattern - /** It helps to avoid the common problem of forgetting to release lock. - It also nicely provides the "node" for queuing locks. */ - class scoped_lock : internal::no_copy { - public: - //! Construct lock that has not acquired a mutex. - /** Equivalent to zero-initialization of *this. */ - scoped_lock() : mutex(NULL) {} - - //! Acquire lock on given mutex. - /** Upon entry, *this should not be in the "have acquired a mutex" state. */ - scoped_lock( spin_rw_mutex& m, bool write = true ) : mutex(NULL) { - acquire(m, write); - } - - //! Release lock (if lock is held). - ~scoped_lock() { - if( mutex ) release(); - } - - //! Acquire lock on given mutex. - void acquire( spin_rw_mutex& m, bool write = true ) { - __TBB_ASSERT( !mutex, "holding mutex already" ); - is_writer = write; - mutex = &m; - if( write ) mutex->internal_acquire_writer(); - else mutex->internal_acquire_reader(); - } - - //! Upgrade reader to become a writer. - /** Returns true if the upgrade happened without re-acquiring the lock and false if opposite */ - bool upgrade_to_writer() { - __TBB_ASSERT( mutex, "lock is not acquired" ); - __TBB_ASSERT( !is_writer, "not a reader" ); - is_writer = true; - return mutex->internal_upgrade(); - } - - //! Release lock. - void release() { - __TBB_ASSERT( mutex, "lock is not acquired" ); - spin_rw_mutex *m = mutex; - mutex = NULL; -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - if( is_writer ) m->internal_release_writer(); - else m->internal_release_reader(); -#else - if( is_writer ) __TBB_AtomicAND( &m->state, READERS ); - else __TBB_FetchAndAddWrelease( &m->state, -(intptr_t)ONE_READER); -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ - } - - //! Downgrade writer to become a reader. - bool downgrade_to_reader() { -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - __TBB_ASSERT( mutex, "lock is not acquired" ); - __TBB_ASSERT( is_writer, "not a writer" ); - mutex->internal_downgrade(); -#else - __TBB_FetchAndAddW( &mutex->state, ((intptr_t)ONE_READER-WRITER)); -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ - is_writer = false; - - return true; - } - - //! Try acquire lock on given mutex. - bool try_acquire( spin_rw_mutex& m, bool write = true ) { - __TBB_ASSERT( !mutex, "holding mutex already" ); - bool result; - is_writer = write; - result = write? m.internal_try_acquire_writer() - : m.internal_try_acquire_reader(); - if( result ) - mutex = &m; - return result; - } - - private: - //! The pointer to the current mutex that is held, or NULL if no mutex is held. - spin_rw_mutex* mutex; - - //! If mutex!=NULL, then is_writer is true if holding a writer lock, false if holding a reader lock. - /** Not defined if not holding a lock. */ - bool is_writer; - }; - - // Mutex traits - static const bool is_rw_mutex = true; - static const bool is_recursive_mutex = false; - static const bool is_fair_mutex = false; - -private: - typedef intptr_t state_t; - static const state_t WRITER = 1; - static const state_t WRITER_PENDING = 2; - static const state_t READERS = ~(WRITER | WRITER_PENDING); - static const state_t ONE_READER = 4; - static const state_t BUSY = WRITER | READERS; - //! State of lock - /** Bit 0 = writer is holding lock - Bit 1 = request by a writer to acquire lock (hint to readers to wait) - Bit 2..N = number of readers holding lock */ - state_t state; - - void __TBB_EXPORTED_METHOD internal_construct(); -}; - -__TBB_DEFINE_PROFILING_SET_NAME(spin_rw_mutex) - -} // namespace tbb - -#endif /* __TBB_spin_rw_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task.h deleted file mode 100644 index e8bc54f393..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task.h +++ /dev/null @@ -1,730 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_task_H -#define __TBB_task_H - -#include "tbb_stddef.h" - -#if __TBB_EXCEPTIONS -#include "cache_aligned_allocator.h" -#endif /* __TBB_EXCEPTIONS */ - -namespace tbb { - -class task; -class task_list; -#if __TBB_EXCEPTIONS -class task_group_context; -class tbb_exception; -#endif /* __TBB_EXCEPTIONS */ - -//! @cond INTERNAL -namespace internal { - - class scheduler: no_copy { - public: - //! For internal use only - virtual void spawn( task& first, task*& next ) = 0; - - //! For internal use only - virtual void wait_for_all( task& parent, task* child ) = 0; - - //! For internal use only - virtual void spawn_root_and_wait( task& first, task*& next ) = 0; - - //! Pure virtual destructor; - // Have to have it just to shut up overzealous compilation warnings - virtual ~scheduler() = 0; - }; - - //! A reference count - /** Should always be non-negative. A signed type is used so that underflow can be detected. */ - typedef intptr reference_count; - - //! An id as used for specifying affinity. - typedef unsigned short affinity_id; - -#if __TBB_EXCEPTIONS - struct context_list_node_t { - context_list_node_t *my_prev, - *my_next; - }; - - class allocate_root_with_context_proxy: no_assign { - task_group_context& my_context; - public: - allocate_root_with_context_proxy ( task_group_context& ctx ) : my_context(ctx) {} - task& __TBB_EXPORTED_METHOD allocate( size_t size ) const; - void __TBB_EXPORTED_METHOD free( task& ) const; - }; -#endif /* __TBB_EXCEPTIONS */ - - class allocate_root_proxy: no_assign { - public: - static task& __TBB_EXPORTED_FUNC allocate( size_t size ); - static void __TBB_EXPORTED_FUNC free( task& ); - }; - - class allocate_continuation_proxy: no_assign { - public: - task& __TBB_EXPORTED_METHOD allocate( size_t size ) const; - void __TBB_EXPORTED_METHOD free( task& ) const; - }; - - class allocate_child_proxy: no_assign { - public: - task& __TBB_EXPORTED_METHOD allocate( size_t size ) const; - void __TBB_EXPORTED_METHOD free( task& ) const; - }; - - class allocate_additional_child_of_proxy: no_assign { - task& self; - task& parent; - public: - allocate_additional_child_of_proxy( task& self_, task& parent_ ) : self(self_), parent(parent_) {} - task& __TBB_EXPORTED_METHOD allocate( size_t size ) const; - void __TBB_EXPORTED_METHOD free( task& ) const; - }; - - //! Memory prefix to a task object. - /** This class is internal to the library. - Do not reference it directly, except within the library itself. - Fields are ordered in way that preserves backwards compatibility and yields - good packing on typical 32-bit and 64-bit platforms. - @ingroup task_scheduling */ - class task_prefix { - private: - friend class tbb::task; - friend class tbb::task_list; - friend class internal::scheduler; - friend class internal::allocate_root_proxy; - friend class internal::allocate_child_proxy; - friend class internal::allocate_continuation_proxy; - friend class internal::allocate_additional_child_of_proxy; - -#if __TBB_EXCEPTIONS - //! Shared context that is used to communicate asynchronous state changes - /** Currently it is used to broadcast cancellation requests generated both - by users and as the result of unhandled exceptions in the task::execute() - methods. */ - task_group_context *context; -#endif /* __TBB_EXCEPTIONS */ - - //! The scheduler that allocated the task, or NULL if the task is big. - /** Small tasks are pooled by the scheduler that allocated the task. - If a scheduler needs to free a small task allocated by another scheduler, - it returns the task to that other scheduler. This policy avoids - memory space blowup issues for memory allocators that allocate from - thread-specific pools. */ - scheduler* origin; - - //! The scheduler that owns the task. - scheduler* owner; - - //! The task whose reference count includes me. - /** In the "blocking style" of programming, this field points to the parent task. - In the "continuation-passing style" of programming, this field points to the - continuation of the parent. */ - tbb::task* parent; - - //! Reference count used for synchronization. - /** In the "continuation-passing style" of programming, this field is - the difference of the number of allocated children minus the - number of children that have completed. - In the "blocking style" of programming, this field is one more than the difference. */ - reference_count ref_count; - - //! Scheduling depth - int depth; - - //! A task::state_type, stored as a byte for compactness. - /** This state is exposed to users via method task::state(). */ - unsigned char state; - - //! Miscellaneous state that is not directly visible to users, stored as a byte for compactness. - /** 0x0 -> version 1.0 task - 0x1 -> version 3.0 task - 0x2 -> task_proxy - 0x40 -> task has live ref_count */ - unsigned char extra_state; - - affinity_id affinity; - - //! "next" field for list of task - tbb::task* next; - - //! The task corresponding to this task_prefix. - tbb::task& task() {return *reinterpret_cast(this+1);} - }; - -} // namespace internal -//! @endcond - -#if __TBB_EXCEPTIONS - - -//! Used to form groups of tasks -/** @ingroup task_scheduling - The context services explicit cancellation requests from user code, and unhandled - exceptions intercepted during tasks execution. Intercepting an exception results - in generating internal cancellation requests (which is processed in exactly the - same way as external ones). - - The context is associated with one or more root tasks and defines the cancellation - group that includes all the descendants of the corresponding root task(s). Association - is established when a context object is passed as an argument to the task::allocate_root() - method. See task_group_context::task_group_context for more details. - - The context can be bound to another one, and other contexts can be bound to it, - forming a tree-like structure: parent -> this -> children. Arrows here designate - cancellation propagation direction. If a task in a cancellation group is canceled - all the other tasks in this group and groups bound to it (as children) get canceled too. **/ -class task_group_context : internal::no_copy -{ -public: - enum kind_type { - isolated, - bound - }; - -private: - union { - //! Flavor of this context: bound or isolated. - kind_type my_kind; - uintptr_t _my_kind_aligner; - }; - - //! Pointer to the context of the parent cancellation group. NULL for isolated contexts. - task_group_context *my_parent; - - //! Used to form the thread specific list of contexts without additional memory allocation. - /** A context is included into the list of the current thread when its binding to - its parent happens. Any context can be present in the list of one thread only. **/ - internal::context_list_node_t my_node; - - //! Leading padding protecting accesses to frequently used members from false sharing. - /** Read accesses to the field my_cancellation_requested are on the hot path inside - the scheduler. This padding ensures that this field never shares the same cache - line with a local variable that is frequently written to. **/ - char _leading_padding[internal::NFS_MaxLineSize - 2 * sizeof(uintptr_t)- sizeof(void*) - sizeof(internal::context_list_node_t)]; - - //! Specifies whether cancellation was request for this task group. - uintptr_t my_cancellation_requested; - - //! Version for run-time checks. - /** Run-time version checks may become necessary in the scheduler implementation - if in the future the meaning of the existing members will be changed or - new members requiring non-zero initialization. **/ - uintptr_t my_version; - - //! Pointer to the exception being propagated across this task group. - tbb_exception *my_exception; - - //! Scheduler that registered this context in its thread specific list. - /** This field is not terribly necessary, but it allows to get a small performance - benefit by getting us rid of using thread local storage. We do not care - about extra memory it takes since this data structure is excessively padded anyway. **/ - void *my_owner; - - //! Trailing padding protecting accesses to frequently used members from false sharing - /** \sa _leading_padding **/ - char _trailing_padding[internal::NFS_MaxLineSize - sizeof(intptr_t) - 2 * sizeof(void*)]; - -public: - - - //! Default & binding constructor. - /** By default a bound context is created. That is this context will be bound - (as child) to the context of the task calling task::allocate_root(this_context) - method. Cancellation requests passed to the parent context are propagated - to all the contexts bound to it. - - If task_group_context::isolated is used as the argument, then the tasks associated - with this context will never be affected by events in any other context. - - Creating isolated context is involves much less overhead, but they have limited - utility. Normally when an exception occur in an algorithm that has nested - algorithms running one would want all the nested ones canceled as well. Such - behavior requires nested algorithms to use bound contexts. - - There is one good place where using isolated algorithms is beneficial. It is - a master thread. That is if a particular algorithm is invoked directly from - the master thread (not from a TBB task), supplying it with explicitly - created isolated context will result in a faster algorithm startup. */ - task_group_context ( kind_type relation_with_parent = bound ) - : my_kind(relation_with_parent) - , my_version(0) - { - init(); - } - - __TBB_EXPORTED_METHOD ~task_group_context (); - - //! Forcefully reinitializes context object after an algorithm it was used with finished. - /** Because the method assumes that the all the tasks that used to be associated with - this context have already finished, you must be extremely careful to not invalidate - the context while it is still in use somewhere in the task hierarchy. - - IMPORTANT: It is assumed that this method is not used concurrently! - - The method does not change the context's parent if it is set. **/ - void __TBB_EXPORTED_METHOD reset (); - - //! Initiates cancellation of all tasks in this cancellation group and its subordinate groups. - /** \return false if cancellation has already been requested, true otherwise. - - Note that canceling never fails. When false is returned, it just means that - another thread (or this one) has already sent cancellation request to this - context or to one of its ancestors (if this context is bound). It is guaranteed - that when this method is called on the same context, true may be returned by - at most one invocation. **/ - bool __TBB_EXPORTED_METHOD cancel_group_execution (); - - //! Returns true if the context received cancellation request. - bool __TBB_EXPORTED_METHOD is_group_execution_cancelled () const; - -protected: - //! Out-of-line part of the constructor. - /** Separated to facilitate future support for backward binary compatibility. **/ - void __TBB_EXPORTED_METHOD init (); - -private: - friend class task; - friend class internal::allocate_root_with_context_proxy; - - static const kind_type binding_required = bound; - static const kind_type binding_completed = kind_type(bound+1); - - //! Checks if any of the ancestors has a cancellation request outstanding, - //! and propagates it back to descendants. - void propagate_cancellation_from_ancestors (); -}; // class task_group_context - -#endif /* __TBB_EXCEPTIONS */ - -//! Base class for user-defined tasks. -/** @ingroup task_scheduling */ -class task: internal::no_copy { - //! Set reference count - void __TBB_EXPORTED_METHOD internal_set_ref_count( int count ); - -protected: - //! Default constructor. - task() {prefix().extra_state=1;} - -public: - //! Destructor. - virtual ~task() {} - - //! Should be overridden by derived classes. - virtual task* execute() = 0; - - //! Enumeration of task states that the scheduler considers. - enum state_type { - //! task is running, and will be destroyed after method execute() completes. - executing, - //! task to be rescheduled. - reexecute, - //! task is in ready pool, or is going to be put there, or was just taken off. - ready, - //! task object is freshly allocated or recycled. - allocated, - //! task object is on free list, or is going to be put there, or was just taken off. - freed, - //! task to be recycled as continuation - recycle - }; - - //------------------------------------------------------------------------ - // Allocating tasks - //------------------------------------------------------------------------ - - //! Returns proxy for overloaded new that allocates a root task. - static internal::allocate_root_proxy allocate_root() { - return internal::allocate_root_proxy(); - } - -#if __TBB_EXCEPTIONS - //! Returns proxy for overloaded new that allocates a root task associated with user supplied context. - static internal::allocate_root_with_context_proxy allocate_root( task_group_context& ctx ) { - return internal::allocate_root_with_context_proxy(ctx); - } -#endif /* __TBB_EXCEPTIONS */ - - //! Returns proxy for overloaded new that allocates a continuation task of *this. - /** The continuation's parent becomes the parent of *this. */ - internal::allocate_continuation_proxy& allocate_continuation() { - return *reinterpret_cast(this); - } - - //! Returns proxy for overloaded new that allocates a child task of *this. - internal::allocate_child_proxy& allocate_child() { - return *reinterpret_cast(this); - } - - //! Like allocate_child, except that task's parent becomes "t", not this. - /** Typically used in conjunction with schedule_to_reexecute to implement while loops. - Atomically increments the reference count of t.parent() */ - internal::allocate_additional_child_of_proxy allocate_additional_child_of( task& t ) { - return internal::allocate_additional_child_of_proxy(*this,t); - } - - //! Destroy a task. - /** Usually, calling this method is unnecessary, because a task is - implicitly deleted after its execute() method runs. However, - sometimes a task needs to be explicitly deallocated, such as - when a root task is used as the parent in spawn_and_wait_for_all. */ - void __TBB_EXPORTED_METHOD destroy( task& victim ); - - //------------------------------------------------------------------------ - // Recycling of tasks - //------------------------------------------------------------------------ - - //! Change this to be a continuation of its former self. - /** The caller must guarantee that the task's refcount does not become zero until - after the method execute() returns. Typically, this is done by having - method execute() return a pointer to a child of the task. If the guarantee - cannot be made, use method recycle_as_safe_continuation instead. - - Because of the hazard, this method may be deprecated in the future. */ - void recycle_as_continuation() { - __TBB_ASSERT( prefix().state==executing, "execute not running?" ); - prefix().state = allocated; - } - - //! Recommended to use, safe variant of recycle_as_continuation - /** For safety, it requires additional increment of ref_count. */ - void recycle_as_safe_continuation() { - __TBB_ASSERT( prefix().state==executing, "execute not running?" ); - prefix().state = recycle; - } - - //! Change this to be a child of new_parent. - void recycle_as_child_of( task& new_parent ) { - internal::task_prefix& p = prefix(); - __TBB_ASSERT( prefix().state==executing||prefix().state==allocated, "execute not running, or already recycled" ); - __TBB_ASSERT( prefix().ref_count==0, "no child tasks allowed when recycled as a child" ); - __TBB_ASSERT( p.parent==NULL, "parent must be null" ); - __TBB_ASSERT( new_parent.prefix().state<=recycle, "corrupt parent's state" ); - __TBB_ASSERT( new_parent.prefix().state!=freed, "parent already freed" ); - p.state = allocated; - p.parent = &new_parent; - p.depth = new_parent.prefix().depth+1; -#if __TBB_EXCEPTIONS - p.context = new_parent.prefix().context; -#endif /* __TBB_EXCEPTIONS */ - } - - //! Schedule this for reexecution after current execute() returns. - /** Requires that this.execute() be running. */ - void recycle_to_reexecute() { - __TBB_ASSERT( prefix().state==executing, "execute not running, or already recycled" ); - __TBB_ASSERT( prefix().ref_count==0, "no child tasks allowed when recycled for reexecution" ); - prefix().state = reexecute; - } - -#if __TBB_TASK_DEQUE - // All depth-related methods are obsolete, and are retained for the sake - // of backward source compatibility only - intptr_t depth() const {return 0;} - void set_depth( intptr_t ) {} - void add_to_depth( int ) {} - -#else /* !__TBB_TASK_DEQUE */ - //! A scheduling depth. - /** Guaranteed to be a signed integral type. */ - typedef internal::intptr depth_type; - - //! Scheduling depth - depth_type depth() const {return prefix().depth;} - - //! Set scheduling depth to given value. - /** The depth must be non-negative */ - void set_depth( depth_type new_depth ) { - __TBB_ASSERT( state()!=ready, "cannot change depth of ready task" ); - __TBB_ASSERT( new_depth>=0, "depth cannot be negative" ); - __TBB_ASSERT( new_depth==int(new_depth), "integer overflow error"); - prefix().depth = int(new_depth); - } - - //! Change scheduling depth by given amount. - /** The resulting depth must be non-negative. */ - void add_to_depth( int delta ) { - __TBB_ASSERT( state()!=ready, "cannot change depth of ready task" ); - __TBB_ASSERT( prefix().depth>=-delta, "depth cannot be negative" ); - prefix().depth+=delta; - } -#endif /* !__TBB_TASK_DEQUE */ - - //------------------------------------------------------------------------ - // Spawning and blocking - //------------------------------------------------------------------------ - - //! Set reference count - void set_ref_count( int count ) { -#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT - internal_set_ref_count(count); -#else - prefix().ref_count = count; -#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ - } - - //! Schedule task for execution when a worker becomes available. - /** After all children spawned so far finish their method task::execute, - their parent's method task::execute may start running. Therefore, it - is important to ensure that at least one child has not completed until - the parent is ready to run. */ - void spawn( task& child ) { - __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" ); - prefix().owner->spawn( child, child.prefix().next ); - } - - //! Spawn multiple tasks and clear list. - /** All of the tasks must be at the same depth. */ - void spawn( task_list& list ); - - //! Similar to spawn followed by wait_for_all, but more efficient. - void spawn_and_wait_for_all( task& child ) { - __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" ); - prefix().owner->wait_for_all( *this, &child ); - } - - //! Similar to spawn followed by wait_for_all, but more efficient. - void __TBB_EXPORTED_METHOD spawn_and_wait_for_all( task_list& list ); - - //! Spawn task allocated by allocate_root, wait for it to complete, and deallocate it. - /** The thread that calls spawn_root_and_wait must be the same thread - that allocated the task. */ - static void spawn_root_and_wait( task& root ) { - __TBB_ASSERT( root.is_owned_by_current_thread(), "root not owned by current thread" ); - root.prefix().owner->spawn_root_and_wait( root, root.prefix().next ); - } - - //! Spawn root tasks on list and wait for all of them to finish. - /** If there are more tasks than worker threads, the tasks are spawned in - order of front to back. */ - static void spawn_root_and_wait( task_list& root_list ); - - //! Wait for reference count to become one, and set reference count to zero. - /** Works on tasks while waiting. */ - void wait_for_all() { - __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" ); - prefix().owner->wait_for_all( *this, NULL ); - } - - //! The innermost task being executed or destroyed by the current thread at the moment. - static task& __TBB_EXPORTED_FUNC self(); - - //! task on whose behalf this task is working, or NULL if this is a root. - task* parent() const {return prefix().parent;} - - //! True if task is owned by different thread than thread that owns its parent. - bool is_stolen_task() const { - internal::task_prefix& p = prefix(); - internal::task_prefix& q = parent()->prefix(); - return p.owner!=q.owner; - } - - //------------------------------------------------------------------------ - // Debugging - //------------------------------------------------------------------------ - - //! Current execution state - state_type state() const {return state_type(prefix().state);} - - //! The internal reference count. - int ref_count() const { -#if TBB_USE_ASSERT - internal::reference_count ref_count = prefix().ref_count; - __TBB_ASSERT( ref_count==int(ref_count), "integer overflow error"); -#endif - return int(prefix().ref_count); - } - - //! True if this task is owned by the calling thread; false otherwise. - bool __TBB_EXPORTED_METHOD is_owned_by_current_thread() const; - - //------------------------------------------------------------------------ - // Affinity - //------------------------------------------------------------------------ - - //! An id as used for specifying affinity. - /** Guaranteed to be integral type. Value of 0 means no affinity. */ - typedef internal::affinity_id affinity_id; - - //! Set affinity for this task. - void set_affinity( affinity_id id ) {prefix().affinity = id;} - - //! Current affinity of this task - affinity_id affinity() const {return prefix().affinity;} - - //! Invoked by scheduler to notify task that it ran on unexpected thread. - /** Invoked before method execute() runs, if task is stolen, or task has - affinity but will be executed on another thread. - - The default action does nothing. */ - virtual void __TBB_EXPORTED_METHOD note_affinity( affinity_id id ); - -#if __TBB_EXCEPTIONS - //! Initiates cancellation of all tasks in this cancellation group and its subordinate groups. - /** \return false if cancellation has already been requested, true otherwise. **/ - bool cancel_group_execution () { return prefix().context->cancel_group_execution(); } - - //! Returns true if the context received cancellation request. - bool is_cancelled () const { return prefix().context->is_group_execution_cancelled(); } -#endif /* __TBB_EXCEPTIONS */ - -private: - friend class task_list; - friend class internal::scheduler; - friend class internal::allocate_root_proxy; -#if __TBB_EXCEPTIONS - friend class internal::allocate_root_with_context_proxy; -#endif /* __TBB_EXCEPTIONS */ - friend class internal::allocate_continuation_proxy; - friend class internal::allocate_child_proxy; - friend class internal::allocate_additional_child_of_proxy; - - //! Get reference to corresponding task_prefix. - /** Version tag prevents loader on Linux from using the wrong symbol in debug builds. **/ - internal::task_prefix& prefix( internal::version_tag* = NULL ) const { - return reinterpret_cast(const_cast(this))[-1]; - } -}; // class task - -//! task that does nothing. Useful for synchronization. -/** @ingroup task_scheduling */ -class empty_task: public task { - /*override*/ task* execute() { - return NULL; - } -}; - -//! A list of children. -/** Used for method task::spawn_children - @ingroup task_scheduling */ -class task_list: internal::no_copy { -private: - task* first; - task** next_ptr; - friend class task; -public: - //! Construct empty list - task_list() : first(NULL), next_ptr(&first) {} - - //! Destroys the list, but does not destroy the task objects. - ~task_list() {} - - //! True if list if empty; false otherwise. - bool empty() const {return !first;} - - //! Push task onto back of list. - void push_back( task& task ) { - task.prefix().next = NULL; - *next_ptr = &task; - next_ptr = &task.prefix().next; - } - - //! Pop the front task from the list. - task& pop_front() { - __TBB_ASSERT( !empty(), "attempt to pop item from empty task_list" ); - task* result = first; - first = result->prefix().next; - if( !first ) next_ptr = &first; - return *result; - } - - //! Clear the list - void clear() { - first=NULL; - next_ptr=&first; - } -}; - -inline void task::spawn( task_list& list ) { - __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" ); - if( task* t = list.first ) { - prefix().owner->spawn( *t, *list.next_ptr ); - list.clear(); - } -} - -inline void task::spawn_root_and_wait( task_list& root_list ) { - if( task* t = root_list.first ) { - __TBB_ASSERT( t->is_owned_by_current_thread(), "'this' not owned by current thread" ); - t->prefix().owner->spawn_root_and_wait( *t, *root_list.next_ptr ); - root_list.clear(); - } -} - -} // namespace tbb - -inline void *operator new( size_t bytes, const tbb::internal::allocate_root_proxy& ) { - return &tbb::internal::allocate_root_proxy::allocate(bytes); -} - -inline void operator delete( void* task, const tbb::internal::allocate_root_proxy& ) { - tbb::internal::allocate_root_proxy::free( *static_cast(task) ); -} - -#if __TBB_EXCEPTIONS -inline void *operator new( size_t bytes, const tbb::internal::allocate_root_with_context_proxy& p ) { - return &p.allocate(bytes); -} - -inline void operator delete( void* task, const tbb::internal::allocate_root_with_context_proxy& p ) { - p.free( *static_cast(task) ); -} -#endif /* __TBB_EXCEPTIONS */ - -inline void *operator new( size_t bytes, const tbb::internal::allocate_continuation_proxy& p ) { - return &p.allocate(bytes); -} - -inline void operator delete( void* task, const tbb::internal::allocate_continuation_proxy& p ) { - p.free( *static_cast(task) ); -} - -inline void *operator new( size_t bytes, const tbb::internal::allocate_child_proxy& p ) { - return &p.allocate(bytes); -} - -inline void operator delete( void* task, const tbb::internal::allocate_child_proxy& p ) { - p.free( *static_cast(task) ); -} - -inline void *operator new( size_t bytes, const tbb::internal::allocate_additional_child_of_proxy& p ) { - return &p.allocate(bytes); -} - -inline void operator delete( void* task, const tbb::internal::allocate_additional_child_of_proxy& p ) { - p.free( *static_cast(task) ); -} - -#endif /* __TBB_task_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_init.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_init.h deleted file mode 100644 index f817ccc371..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_init.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_task_scheduler_init_H -#define __TBB_task_scheduler_init_H - -#include "tbb_stddef.h" - -namespace tbb { - -typedef std::size_t stack_size_type; - -//! @cond INTERNAL -namespace internal { - //! Internal to library. Should not be used by clients. - /** @ingroup task_scheduling */ - class scheduler; -} // namespace internal -//! @endcond - -//! Class representing reference to tbb scheduler. -/** A thread must construct a task_scheduler_init, and keep it alive, - during the time that it uses the services of class task. - @ingroup task_scheduling */ -class task_scheduler_init: internal::no_copy { - /** NULL if not currently initialized. */ - internal::scheduler* my_scheduler; -public: - - //! Typedef for number of threads that is automatic. - static const int automatic = -1; - - //! Argument to initialize() or constructor that causes initialization to be deferred. - static const int deferred = -2; - - //! Ensure that scheduler exists for this thread - /** A value of -1 lets tbb decide on the number of threads, which is typically - the number of hardware threads. For production code, the default value of -1 - should be used, particularly if the client code is mixed with third party clients - that might also use tbb. - - The number_of_threads is ignored if any other task_scheduler_inits - currently exist. A thread may construct multiple task_scheduler_inits. - Doing so does no harm because the underlying scheduler is reference counted. */ - void __TBB_EXPORTED_METHOD initialize( int number_of_threads=automatic ); - - //! The overloaded method with stack size parameter - /** Overloading is necessary to preserve ABI compatibility */ - void __TBB_EXPORTED_METHOD initialize( int number_of_threads, stack_size_type thread_stack_size ); - - //! Inverse of method initialize. - void __TBB_EXPORTED_METHOD terminate(); - - //! Shorthand for default constructor followed by call to intialize(number_of_threads). - task_scheduler_init( int number_of_threads=automatic, stack_size_type thread_stack_size=0 ) : my_scheduler(NULL) { - initialize( number_of_threads, thread_stack_size ); - } - - //! Destroy scheduler for this thread if thread has no other live task_scheduler_inits. - ~task_scheduler_init() { - if( my_scheduler ) - terminate(); - internal::poison_pointer( my_scheduler ); - } - //! Returns the number of threads tbb scheduler would create if initialized by default. - /** Result returned by this method does not depend on whether the scheduler - has already been initialized. - - Because tbb 2.0 does not support blocking tasks yet, you may use this method - to boost the number of threads in the tbb's internal pool, if your tasks are - doing I/O operations. The optimal number of additional threads depends on how - much time your tasks spend in the blocked state. */ - static int __TBB_EXPORTED_FUNC default_num_threads (); - - //! Returns true if scheduler is active (initialized); false otherwise - bool is_active() const { return my_scheduler != NULL; } -}; - -} // namespace tbb - -#endif /* __TBB_task_scheduler_init_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_observer.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_observer.h deleted file mode 100644 index ee8bd5df28..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/task_scheduler_observer.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_task_scheduler_observer_H -#define __TBB_task_scheduler_observer_H - -#include "atomic.h" - -#if __TBB_SCHEDULER_OBSERVER - -namespace tbb { - -namespace internal { - -class observer_proxy; - -class task_scheduler_observer_v3 { - friend class observer_proxy; - observer_proxy* my_proxy; - atomic my_busy_count; -public: - //! Enable or disable observation - void __TBB_EXPORTED_METHOD observe( bool state=true ); - - //! True if observation is enables; false otherwise. - bool is_observing() const {return my_proxy!=NULL;} - - //! Construct observer with observation disabled. - task_scheduler_observer_v3() : my_proxy(NULL) {my_busy_count=0;} - - //! Called by thread before first steal since observation became enabled - virtual void on_scheduler_entry( bool /*is_worker*/ ) {} - - //! Called by thread when it no longer takes part in task stealing. - virtual void on_scheduler_exit( bool /*is_worker*/ ) {} - - //! Destructor - virtual ~task_scheduler_observer_v3() {observe(false);} -}; - -} // namespace internal - -typedef internal::task_scheduler_observer_v3 task_scheduler_observer; - -} // namespace tbb - -#endif /* __TBB_SCHEDULER_OBSERVER */ - -#endif /* __TBB_task_scheduler_observer_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_allocator.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_allocator.h deleted file mode 100644 index d7474271dc..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_allocator.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_tbb_allocator_H -#define __TBB_tbb_allocator_H - -#include -#include "tbb_stddef.h" - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - - //! Deallocates memory using FreeHandler - /** The function uses scalable_free if scalable allocator is available and free if not*/ - void __TBB_EXPORTED_FUNC deallocate_via_handler_v3( void *p ); - - //! Allocates memory using MallocHandler - /** The function uses scalable_malloc if scalable allocator is available and malloc if not*/ - void* __TBB_EXPORTED_FUNC allocate_via_handler_v3( size_t n ); - - //! Returns true if standard malloc/free are used to work with memory. - bool __TBB_EXPORTED_FUNC is_malloc_used_v3(); -} -//! @endcond - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Workaround for erroneous "unreferenced parameter" warning in method destroy. - #pragma warning (push) - #pragma warning (disable: 4100) -#endif - -//! Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5 -/** The class selects the best memory allocation mechanism available - from scalable_malloc and standard malloc. - The members are ordered the same way they are in section 20.4.1 - of the ISO C++ standard. - @ingroup memory_allocation */ -template -class tbb_allocator { -public: - typedef typename internal::allocator_type::value_type value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - template struct rebind { - typedef tbb_allocator other; - }; - - //! Specifies current allocator - enum malloc_type { - scalable, - standard - }; - - tbb_allocator() throw() {} - tbb_allocator( const tbb_allocator& ) throw() {} - template tbb_allocator(const tbb_allocator&) throw() {} - - pointer address(reference x) const {return &x;} - const_pointer address(const_reference x) const {return &x;} - - //! Allocate space for n objects. - pointer allocate( size_type n, const void* /*hint*/ = 0) { - return pointer(internal::allocate_via_handler_v3( n * sizeof(value_type) )); - } - - //! Free previously allocated block of memory. - void deallocate( pointer p, size_type ) { - internal::deallocate_via_handler_v3(p); - } - - //! Largest value for which method allocate might succeed. - size_type max_size() const throw() { - size_type max = static_cast(-1) / sizeof (value_type); - return (max > 0 ? max : 1); - } - - //! Copy-construct value at location pointed to by p. - void construct( pointer p, const value_type& value ) {new(static_cast(p)) value_type(value);} - - //! Destroy value at location pointed to by p. - void destroy( pointer p ) {p->~value_type();} - - //! Returns current allocator - static malloc_type allocator_type() { - return internal::is_malloc_used_v3() ? standard : scalable; - } -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif // warning 4100 is back - -//! Analogous to std::allocator, as defined in ISO C++ Standard, Section 20.4.1 -/** @ingroup memory_allocation */ -template<> -class tbb_allocator { -public: - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - template struct rebind { - typedef tbb_allocator other; - }; -}; - -template -inline bool operator==( const tbb_allocator&, const tbb_allocator& ) {return true;} - -template -inline bool operator!=( const tbb_allocator&, const tbb_allocator& ) {return false;} - -} // namespace tbb - -#endif /* __TBB_tbb_allocator_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_config.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_config.h deleted file mode 100644 index dd82114659..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_config.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_tbb_config_H -#define __TBB_tbb_config_H - -/** This header is supposed to contain macro definitions and C style comments only. - The macros defined here are intended to control such aspects of TBB build as - - compilation modes - - feature sets - - workarounds presence -**/ - -/** Compilation modes **/ - -#ifndef TBB_USE_DEBUG -#ifdef TBB_DO_ASSERT -#define TBB_USE_DEBUG TBB_DO_ASSERT -#else -#define TBB_USE_DEBUG 0 -#endif /* TBB_DO_ASSERT */ -#else -#define TBB_DO_ASSERT TBB_USE_DEBUG -#endif /* TBB_USE_DEBUG */ - -#ifndef TBB_USE_ASSERT -#ifdef TBB_DO_ASSERT -#define TBB_USE_ASSERT TBB_DO_ASSERT -#else -#define TBB_USE_ASSERT TBB_USE_DEBUG -#endif /* TBB_DO_ASSERT */ -#endif /* TBB_USE_ASSERT */ - -#ifndef TBB_USE_THREADING_TOOLS -#ifdef TBB_DO_THREADING_TOOLS -#define TBB_USE_THREADING_TOOLS TBB_DO_THREADING_TOOLS -#else -#define TBB_USE_THREADING_TOOLS TBB_USE_DEBUG -#endif /* TBB_DO_THREADING_TOOLS */ -#endif /* TBB_USE_THREADING_TOOLS */ - -#ifndef TBB_USE_PERFORMANCE_WARNINGS -#ifdef TBB_PERFORMANCE_WARNINGS -#define TBB_USE_PERFORMANCE_WARNINGS TBB_PERFORMANCE_WARNINGS -#else -#define TBB_USE_PERFORMANCE_WARNINGS TBB_USE_DEBUG -#endif /* TBB_PEFORMANCE_WARNINGS */ -#endif /* TBB_USE_PERFORMANCE_WARNINGS */ - - -/** Feature sets **/ - -#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__SUNPRO_CC) -#ifndef __TBB_EXCEPTIONS -#define __TBB_EXCEPTIONS 1 -#endif /* __TBB_EXCEPTIONS */ -#endif - -#ifndef __TBB_SCHEDULER_OBSERVER -#define __TBB_SCHEDULER_OBSERVER 1 -#endif /* __TBB_SCHEDULER_OBSERVER */ - -#ifndef __TBB_TASK_SCHEDULER_AUTO_INIT -#define __TBB_TASK_SCHEDULER_AUTO_INIT 1 -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - -#ifndef __TBB_TASK_DEQUE -#define __TBB_TASK_DEQUE 1 -#endif /* !__TBB_TASK_DEQUE */ - -#ifndef __TBB_NEW_ITT_NOTIFY -#define __TBB_NEW_ITT_NOTIFY 0 -#endif /* !__TBB_NEW_ITT_NOTIFY */ - - -/** Workarounds presence **/ - -/** Macros of the form __TBB_XXX_BROKEN denote known issues that are caused by - the bugs in compilers, standard or OS specific libraries. They should be - removed as soon as the corresponding bugs are fixed or the buggy OS/compiler - versions go out of the support list. -**/ -#if __GLIBC__==2 && __GLIBC_MINOR__==3 - /** Some older versions of glibc crash when exception handling happens concurrently. **/ - #define __TBB_EXCEPTION_HANDLING_BROKEN 1 -#endif - -#if __FreeBSD__ - /** The bug in FreeBSD 8.0 results in kernel panic when there is contention - on a mutex created with this attribute. **/ - #define __TBB_PRIO_INHERIT_BROKEN 1 - - /** A bug in FreeBSD 8.0 results in test hanging when an exception occurs - during (concurrent?) object construction by means of placement new operator. **/ - #define __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN 1 -#endif /* __FreeBSD__ */ - - -#endif /* __TBB_tbb_config_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_exception.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_exception.h deleted file mode 100644 index 5c1f5e7cc2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_exception.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_exception_H -#define __TBB_exception_H - -#include "tbb_stddef.h" -#include - -namespace tbb { - -//! Exception for concurrent containers -class bad_last_alloc : public std::bad_alloc { -public: - virtual const char* what() const throw() { return "bad allocation in previous or concurrent attempt"; } - virtual ~bad_last_alloc() throw() {} -}; - -} // namespace tbb - -#if __TBB_EXCEPTIONS -#include "tbb_allocator.h" -#include -#include -#include - -namespace tbb { - -//! Interface to be implemented by all exceptions TBB recognizes and propagates across the threads. -/** If an unhandled exception of the type derived from tbb::tbb_exception is intercepted - by the TBB scheduler in one of the worker threads, it is delivered to and re-thrown in - the root thread. The root thread is the thread that has started the outermost algorithm - or root task sharing the same task_group_context with the guilty algorithm/task (the one - that threw the exception first). - - Note: when documentation mentions workers with respect to exception handling, - masters are implied as well, because they are completely equivalent in this context. - Consequently a root thread can be master or worker thread. - - NOTE: In case of nested algorithms or complex task hierarchies when the nested - levels share (explicitly or by means of implicit inheritance) the task group - context of the outermost level, the exception may be (re-)thrown multiple times - (ultimately - in each worker on each nesting level) before reaching the root - thread at the outermost level. IMPORTANT: if you intercept an exception derived - from this class on a nested level, you must re-throw it in the catch block by means - of the "throw;" operator. - - TBB provides two implementations of this interface: tbb::captured_exception and - template class tbb::movable_exception. See their declarations for more info. **/ -class tbb_exception : public std::exception { -public: - //! Creates and returns pointer to the deep copy of this exception object. - /** Move semantics is allowed. **/ - virtual tbb_exception* move () throw() = 0; - - //! Destroys objects created by the move() method. - /** Frees memory and calls destructor for this exception object. - Can and must be used only on objects created by the move method. **/ - virtual void destroy () throw() = 0; - - //! Throws this exception object. - /** Make sure that if you have several levels of derivation from this interface - you implement or override this method on the most derived level. The implementation - is as simple as "throw *this;". Failure to do this will result in exception - of a base class type being thrown. **/ - virtual void throw_self () = 0; - - //! Returns RTTI name of the originally intercepted exception - virtual const char* name() const throw() = 0; - - //! Returns the result of originally intercepted exception's what() method. - virtual const char* what() const throw() = 0; -}; - -//! This class is used by TBB to propagate information about unhandled exceptions into the root thread. -/** Exception of this type is thrown by TBB in the root thread (thread that started a parallel - algorithm ) if an unhandled exception was intercepted during the algorithm execution in one - of the workers. - \sa tbb::tbb_exception **/ -class captured_exception : public tbb_exception -{ -public: - captured_exception ( const captured_exception& src ) - : my_dynamic(false) - { - set(src.my_exception_name, src.my_exception_info); - } - - captured_exception ( const char* name, const char* info ) - : my_dynamic(false) - { - set(name, info); - } - - __TBB_EXPORTED_METHOD ~captured_exception () throw() { - clear(); - } - - captured_exception& operator= ( const captured_exception& src ) { - if ( this != &src ) { - clear(); - set(src.my_exception_name, src.my_exception_info); - } - return *this; - } - - /*override*/ - captured_exception* move () throw(); - - /*override*/ - void destroy () throw(); - - /*override*/ - void throw_self () { throw *this; } - - /*override*/ - const char* __TBB_EXPORTED_METHOD name() const throw(); - - /*override*/ - const char* __TBB_EXPORTED_METHOD what() const throw(); - -private: - //! Used only by method clone(). - captured_exception() {} - - //! Functionally equivalent to {captured_exception e(name,info); return c.clone();} - static captured_exception* allocate ( const char* name, const char* info ); - - void set ( const char* name, const char* info ) throw(); - void clear () throw(); - - bool my_dynamic; - const char* my_exception_name; - const char* my_exception_info; -}; - -//! Template that can be used to implement exception that transfers arbitrary ExceptionData to the root thread -/** Code using TBB can instantiate this template with an arbitrary ExceptionData type - and throw this exception object. Such exceptions are intercepted by the TBB scheduler - and delivered to the root thread (). - \sa tbb::tbb_exception **/ -template -class movable_exception : public tbb_exception -{ - typedef movable_exception self_type; - -public: - movable_exception ( const ExceptionData& data ) - : my_exception_data(data) - , my_dynamic(false) - , my_exception_name(typeid(self_type).name()) - {} - - movable_exception ( const movable_exception& src ) throw () - : my_exception_data(src.my_exception_data) - , my_dynamic(false) - , my_exception_name(src.my_exception_name) - {} - - ~movable_exception () throw() {} - - const movable_exception& operator= ( const movable_exception& src ) { - if ( this != &src ) { - my_exception_data = src.my_exception_data; - my_exception_name = src.my_exception_name; - } - return *this; - } - - ExceptionData& data () throw() { return my_exception_data; } - - const ExceptionData& data () const throw() { return my_exception_data; } - - /*override*/ const char* name () const throw() { return my_exception_name; } - - /*override*/ const char* what () const throw() { return "tbb::movable_exception"; } - - /*override*/ - movable_exception* move () throw() { - void* e = internal::allocate_via_handler_v3(sizeof(movable_exception)); - if ( e ) { - new (e) movable_exception(*this); - ((movable_exception*)e)->my_dynamic = true; - } - return (movable_exception*)e; - } - /*override*/ - void destroy () throw() { - __TBB_ASSERT ( my_dynamic, "Method destroy can be called only on dynamically allocated movable_exceptions" ); - if ( my_dynamic ) { - this->~movable_exception(); - internal::deallocate_via_handler_v3(this); - } - } - /*override*/ - void throw_self () { - throw *this; - } - -protected: - //! User data - ExceptionData my_exception_data; - -private: - //! Flag specifying whether this object has been dynamically allocated (by the move method) - bool my_dynamic; - - //! RTTI name of this class - /** We rely on the fact that RTTI names are static string constants. **/ - const char* my_exception_name; -}; - -} // namespace tbb - -#endif /* __TBB_EXCEPTIONS */ - -#endif /* __TBB_exception_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_machine.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_machine.h deleted file mode 100644 index a0ef58c947..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_machine.h +++ /dev/null @@ -1,573 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_machine_H -#define __TBB_machine_H - -#include "tbb_stddef.h" - -#if _WIN32||_WIN64 - -#ifdef _MANAGED -#pragma managed(push, off) -#endif - -#if defined(_M_IX86) -#include "machine/windows_ia32.h" -#elif defined(_M_AMD64) -#include "machine/windows_em64t.h" -#else -#error Unsupported platform -#endif - -#ifdef _MANAGED -#pragma managed(pop) -#endif - -#elif __linux__ || __FreeBSD__ - -#if __i386__ -#include "machine/linux_ia32.h" -#elif __x86_64__ -#include "machine/linux_em64t.h" -#elif __ia64__ -#include "machine/linux_itanium.h" -#endif - -#elif __APPLE__ - -#if __i386__ -#include "machine/linux_ia32.h" -#elif __x86_64__ -#include "machine/linux_em64t.h" -#elif __POWERPC__ -#include "machine/mac_ppc.h" -#endif - -#elif _AIX - -#include "machine/ibm_aix51.h" - -#elif __sun || __SUNPRO_CC - -#define __asm__ asm -#define __volatile__ volatile -#if __i386 || __i386__ -#include "machine/linux_ia32.h" -#elif __x86_64__ -#include "machine/linux_em64t.h" -#endif - -#endif - -#if !defined(__TBB_CompareAndSwap4) || !defined(__TBB_CompareAndSwap8) || !defined(__TBB_Yield) -#error Minimal requirements for tbb_machine.h not satisfied -#endif - -#ifndef __TBB_load_with_acquire - //! Load with acquire semantics; i.e., no following memory operation can move above the load. - template - inline T __TBB_load_with_acquire(const volatile T& location) { - T temp = location; -#ifdef __TBB_fence_for_acquire - __TBB_fence_for_acquire(); -#endif /* __TBB_fence_for_acquire */ - return temp; - } -#endif - -#ifndef __TBB_store_with_release - //! Store with release semantics; i.e., no prior memory operation can move below the store. - template - inline void __TBB_store_with_release(volatile T& location, V value) { -#ifdef __TBB_fence_for_release - __TBB_fence_for_release(); -#endif /* __TBB_fence_for_release */ - location = T(value); - } -#endif - -#ifndef __TBB_Pause - inline void __TBB_Pause(int32_t) { - __TBB_Yield(); - } -#endif - -namespace tbb { -namespace internal { - -//! Class that implements exponential backoff. -/** See implementation of SpinwaitWhileEq for an example. */ -class AtomicBackoff { - //! Time delay, in units of "pause" instructions. - /** Should be equal to approximately the number of "pause" instructions - that take the same time as an context switch. */ - static const int32_t LOOPS_BEFORE_YIELD = 16; - int32_t count; -public: - AtomicBackoff() : count(1) {} - - //! Pause for a while. - void pause() { - if( count<=LOOPS_BEFORE_YIELD ) { - __TBB_Pause(count); - // Pause twice as long the next time. - count*=2; - } else { - // Pause is so long that we might as well yield CPU to scheduler. - __TBB_Yield(); - } - } - - // pause for a few times and then return false immediately. - bool bounded_pause() { - if( count<=LOOPS_BEFORE_YIELD ) { - __TBB_Pause(count); - // Pause twice as long the next time. - count*=2; - return true; - } else { - return false; - } - } - - void reset() { - count = 1; - } -}; - -// T should be unsigned, otherwise sign propagation will break correctness of bit manipulations. -// S should be either 1 or 2, for the mask calculation to work correctly. -// Together, these rules limit applicability of Masked CAS to unsigned char and unsigned short. -template -inline T __TBB_MaskedCompareAndSwap (volatile T *ptr, T value, T comparand ) { - volatile uint32_t * base = (uint32_t*)( (uintptr_t)ptr & ~(uintptr_t)0x3 ); -#if __TBB_BIG_ENDIAN - const uint8_t bitoffset = uint8_t( 8*( 4-S - (uintptr_t(ptr) & 0x3) ) ); -#else - const uint8_t bitoffset = uint8_t( 8*((uintptr_t)ptr & 0x3) ); -#endif - const uint32_t mask = ( (1<<(S*8)) - 1 )<> bitoffset); -} - -template -inline T __TBB_CompareAndSwapGeneric (volatile void *ptr, T value, T comparand ) { - return __TBB_CompareAndSwapW((T *)ptr,value,comparand); -} - -template<> -inline uint8_t __TBB_CompareAndSwapGeneric <1,uint8_t> (volatile void *ptr, uint8_t value, uint8_t comparand ) { -#ifdef __TBB_CompareAndSwap1 - return __TBB_CompareAndSwap1(ptr,value,comparand); -#else - return __TBB_MaskedCompareAndSwap<1,uint8_t>((volatile uint8_t *)ptr,value,comparand); -#endif -} - -template<> -inline uint16_t __TBB_CompareAndSwapGeneric <2,uint16_t> (volatile void *ptr, uint16_t value, uint16_t comparand ) { -#ifdef __TBB_CompareAndSwap2 - return __TBB_CompareAndSwap2(ptr,value,comparand); -#else - return __TBB_MaskedCompareAndSwap<2,uint16_t>((volatile uint16_t *)ptr,value,comparand); -#endif -} - -template<> -inline uint32_t __TBB_CompareAndSwapGeneric <4,uint32_t> (volatile void *ptr, uint32_t value, uint32_t comparand ) { - return __TBB_CompareAndSwap4(ptr,value,comparand); -} - -template<> -inline uint64_t __TBB_CompareAndSwapGeneric <8,uint64_t> (volatile void *ptr, uint64_t value, uint64_t comparand ) { - return __TBB_CompareAndSwap8(ptr,value,comparand); -} - -template -inline T __TBB_FetchAndAddGeneric (volatile void *ptr, T addend) { - AtomicBackoff b; - T result; - for(;;) { - result = *reinterpret_cast(ptr); - // __TBB_CompareAndSwapGeneric presumed to have full fence. - if( __TBB_CompareAndSwapGeneric ( ptr, result+addend, result )==result ) - break; - b.pause(); - } - return result; -} - -template -inline T __TBB_FetchAndStoreGeneric (volatile void *ptr, T value) { - AtomicBackoff b; - T result; - for(;;) { - result = *reinterpret_cast(ptr); - // __TBB_CompareAndSwapGeneric presumed to have full fence. - if( __TBB_CompareAndSwapGeneric ( ptr, value, result )==result ) - break; - b.pause(); - } - return result; -} - -// Macro __TBB_TypeWithAlignmentAtLeastAsStrict(T) should be a type with alignment at least as -// strict as type T. Type type should have a trivial default constructor and destructor, so that -// arrays of that type can be declared without initializers. -// It is correct (but perhaps a waste of space) if __TBB_TypeWithAlignmentAtLeastAsStrict(T) expands -// to a type bigger than T. -// The default definition here works on machines where integers are naturally aligned and the -// strictest alignment is 16. -#ifndef __TBB_TypeWithAlignmentAtLeastAsStrict - -#if __GNUC__ || __SUNPRO_CC -struct __TBB_machine_type_with_strictest_alignment { - int member[4]; -} __attribute__((aligned(16))); -#elif _MSC_VER -__declspec(align(16)) struct __TBB_machine_type_with_strictest_alignment { - int member[4]; -}; -#else -#error Must define __TBB_TypeWithAlignmentAtLeastAsStrict(T) or __TBB_machine_type_with_strictest_alignment -#endif - -template struct type_with_alignment {__TBB_machine_type_with_strictest_alignment member;}; -template<> struct type_with_alignment<1> { char member; }; -template<> struct type_with_alignment<2> { uint16_t member; }; -template<> struct type_with_alignment<4> { uint32_t member; }; -template<> struct type_with_alignment<8> { uint64_t member; }; - -#if _MSC_VER||defined(__GNUC__)&&__GNUC__==3 && __GNUC_MINOR__<=2 -//! Work around for bug in GNU 3.2 and MSVC compilers. -/** Bug is that compiler sometimes returns 0 for __alignof(T) when T has not yet been instantiated. - The work-around forces instantiation by forcing computation of sizeof(T) before __alignof(T). */ -template -struct work_around_alignment_bug { -#if _MSC_VER - static const size_t alignment = __alignof(T); -#else - static const size_t alignment = __alignof__(T); -#endif -}; -#define __TBB_TypeWithAlignmentAtLeastAsStrict(T) tbb::internal::type_with_alignment::alignment> -#elif __GNUC__ || __SUNPRO_CC -#define __TBB_TypeWithAlignmentAtLeastAsStrict(T) tbb::internal::type_with_alignment<__alignof__(T)> -#else -#define __TBB_TypeWithAlignmentAtLeastAsStrict(T) __TBB_machine_type_with_strictest_alignment -#endif -#endif /* ____TBB_TypeWithAlignmentAtLeastAsStrict */ - -} // namespace internal -} // namespace tbb - -#ifndef __TBB_CompareAndSwap1 -#define __TBB_CompareAndSwap1 tbb::internal::__TBB_CompareAndSwapGeneric<1,uint8_t> -#endif - -#ifndef __TBB_CompareAndSwap2 -#define __TBB_CompareAndSwap2 tbb::internal::__TBB_CompareAndSwapGeneric<2,uint16_t> -#endif - -#ifndef __TBB_CompareAndSwapW -#define __TBB_CompareAndSwapW tbb::internal::__TBB_CompareAndSwapGeneric -#endif - -#ifndef __TBB_FetchAndAdd1 -#define __TBB_FetchAndAdd1 tbb::internal::__TBB_FetchAndAddGeneric<1,uint8_t> -#endif - -#ifndef __TBB_FetchAndAdd2 -#define __TBB_FetchAndAdd2 tbb::internal::__TBB_FetchAndAddGeneric<2,uint16_t> -#endif - -#ifndef __TBB_FetchAndAdd4 -#define __TBB_FetchAndAdd4 tbb::internal::__TBB_FetchAndAddGeneric<4,uint32_t> -#endif - -#ifndef __TBB_FetchAndAdd8 -#define __TBB_FetchAndAdd8 tbb::internal::__TBB_FetchAndAddGeneric<8,uint64_t> -#endif - -#ifndef __TBB_FetchAndAddW -#define __TBB_FetchAndAddW tbb::internal::__TBB_FetchAndAddGeneric -#endif - -#ifndef __TBB_FetchAndStore1 -#define __TBB_FetchAndStore1 tbb::internal::__TBB_FetchAndStoreGeneric<1,uint8_t> -#endif - -#ifndef __TBB_FetchAndStore2 -#define __TBB_FetchAndStore2 tbb::internal::__TBB_FetchAndStoreGeneric<2,uint16_t> -#endif - -#ifndef __TBB_FetchAndStore4 -#define __TBB_FetchAndStore4 tbb::internal::__TBB_FetchAndStoreGeneric<4,uint32_t> -#endif - -#ifndef __TBB_FetchAndStore8 -#define __TBB_FetchAndStore8 tbb::internal::__TBB_FetchAndStoreGeneric<8,uint64_t> -#endif - -#ifndef __TBB_FetchAndStoreW -#define __TBB_FetchAndStoreW tbb::internal::__TBB_FetchAndStoreGeneric -#endif - -#if __TBB_DECL_FENCED_ATOMICS - -#ifndef __TBB_CompareAndSwap1__TBB_full_fence -#define __TBB_CompareAndSwap1__TBB_full_fence __TBB_CompareAndSwap1 -#endif -#ifndef __TBB_CompareAndSwap1acquire -#define __TBB_CompareAndSwap1acquire __TBB_CompareAndSwap1__TBB_full_fence -#endif -#ifndef __TBB_CompareAndSwap1release -#define __TBB_CompareAndSwap1release __TBB_CompareAndSwap1__TBB_full_fence -#endif - -#ifndef __TBB_CompareAndSwap2__TBB_full_fence -#define __TBB_CompareAndSwap2__TBB_full_fence __TBB_CompareAndSwap2 -#endif -#ifndef __TBB_CompareAndSwap2acquire -#define __TBB_CompareAndSwap2acquire __TBB_CompareAndSwap2__TBB_full_fence -#endif -#ifndef __TBB_CompareAndSwap2release -#define __TBB_CompareAndSwap2release __TBB_CompareAndSwap2__TBB_full_fence -#endif - -#ifndef __TBB_CompareAndSwap4__TBB_full_fence -#define __TBB_CompareAndSwap4__TBB_full_fence __TBB_CompareAndSwap4 -#endif -#ifndef __TBB_CompareAndSwap4acquire -#define __TBB_CompareAndSwap4acquire __TBB_CompareAndSwap4__TBB_full_fence -#endif -#ifndef __TBB_CompareAndSwap4release -#define __TBB_CompareAndSwap4release __TBB_CompareAndSwap4__TBB_full_fence -#endif - -#ifndef __TBB_CompareAndSwap8__TBB_full_fence -#define __TBB_CompareAndSwap8__TBB_full_fence __TBB_CompareAndSwap8 -#endif -#ifndef __TBB_CompareAndSwap8acquire -#define __TBB_CompareAndSwap8acquire __TBB_CompareAndSwap8__TBB_full_fence -#endif -#ifndef __TBB_CompareAndSwap8release -#define __TBB_CompareAndSwap8release __TBB_CompareAndSwap8__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndAdd1__TBB_full_fence -#define __TBB_FetchAndAdd1__TBB_full_fence __TBB_FetchAndAdd1 -#endif -#ifndef __TBB_FetchAndAdd1acquire -#define __TBB_FetchAndAdd1acquire __TBB_FetchAndAdd1__TBB_full_fence -#endif -#ifndef __TBB_FetchAndAdd1release -#define __TBB_FetchAndAdd1release __TBB_FetchAndAdd1__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndAdd2__TBB_full_fence -#define __TBB_FetchAndAdd2__TBB_full_fence __TBB_FetchAndAdd2 -#endif -#ifndef __TBB_FetchAndAdd2acquire -#define __TBB_FetchAndAdd2acquire __TBB_FetchAndAdd2__TBB_full_fence -#endif -#ifndef __TBB_FetchAndAdd2release -#define __TBB_FetchAndAdd2release __TBB_FetchAndAdd2__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndAdd4__TBB_full_fence -#define __TBB_FetchAndAdd4__TBB_full_fence __TBB_FetchAndAdd4 -#endif -#ifndef __TBB_FetchAndAdd4acquire -#define __TBB_FetchAndAdd4acquire __TBB_FetchAndAdd4__TBB_full_fence -#endif -#ifndef __TBB_FetchAndAdd4release -#define __TBB_FetchAndAdd4release __TBB_FetchAndAdd4__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndAdd8__TBB_full_fence -#define __TBB_FetchAndAdd8__TBB_full_fence __TBB_FetchAndAdd8 -#endif -#ifndef __TBB_FetchAndAdd8acquire -#define __TBB_FetchAndAdd8acquire __TBB_FetchAndAdd8__TBB_full_fence -#endif -#ifndef __TBB_FetchAndAdd8release -#define __TBB_FetchAndAdd8release __TBB_FetchAndAdd8__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndStore1__TBB_full_fence -#define __TBB_FetchAndStore1__TBB_full_fence __TBB_FetchAndStore1 -#endif -#ifndef __TBB_FetchAndStore1acquire -#define __TBB_FetchAndStore1acquire __TBB_FetchAndStore1__TBB_full_fence -#endif -#ifndef __TBB_FetchAndStore1release -#define __TBB_FetchAndStore1release __TBB_FetchAndStore1__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndStore2__TBB_full_fence -#define __TBB_FetchAndStore2__TBB_full_fence __TBB_FetchAndStore2 -#endif -#ifndef __TBB_FetchAndStore2acquire -#define __TBB_FetchAndStore2acquire __TBB_FetchAndStore2__TBB_full_fence -#endif -#ifndef __TBB_FetchAndStore2release -#define __TBB_FetchAndStore2release __TBB_FetchAndStore2__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndStore4__TBB_full_fence -#define __TBB_FetchAndStore4__TBB_full_fence __TBB_FetchAndStore4 -#endif -#ifndef __TBB_FetchAndStore4acquire -#define __TBB_FetchAndStore4acquire __TBB_FetchAndStore4__TBB_full_fence -#endif -#ifndef __TBB_FetchAndStore4release -#define __TBB_FetchAndStore4release __TBB_FetchAndStore4__TBB_full_fence -#endif - -#ifndef __TBB_FetchAndStore8__TBB_full_fence -#define __TBB_FetchAndStore8__TBB_full_fence __TBB_FetchAndStore8 -#endif -#ifndef __TBB_FetchAndStore8acquire -#define __TBB_FetchAndStore8acquire __TBB_FetchAndStore8__TBB_full_fence -#endif -#ifndef __TBB_FetchAndStore8release -#define __TBB_FetchAndStore8release __TBB_FetchAndStore8__TBB_full_fence -#endif - -#endif // __TBB_DECL_FENCED_ATOMICS - -// Special atomic functions -#ifndef __TBB_FetchAndAddWrelease -#define __TBB_FetchAndAddWrelease __TBB_FetchAndAddW -#endif - -#ifndef __TBB_FetchAndIncrementWacquire -#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAddW(P,1) -#endif - -#ifndef __TBB_FetchAndDecrementWrelease -#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAddW(P,(-1)) -#endif - -#if __TBB_WORDSIZE==4 -// On 32-bit platforms, "atomic.h" requires definition of __TBB_Store8 and __TBB_Load8 -#ifndef __TBB_Store8 -inline void __TBB_Store8 (volatile void *ptr, int64_t value) { - tbb::internal::AtomicBackoff b; - for(;;) { - int64_t result = *(int64_t *)ptr; - if( __TBB_CompareAndSwap8(ptr,value,result)==result ) break; - b.pause(); - } -} -#endif - -#ifndef __TBB_Load8 -inline int64_t __TBB_Load8 (const volatile void *ptr) { - int64_t result = *(int64_t *)ptr; - result = __TBB_CompareAndSwap8((volatile void *)ptr,result,result); - return result; -} -#endif -#endif /* __TBB_WORDSIZE==4 */ - -#ifndef __TBB_Log2 -inline intptr_t __TBB_Log2( uintptr_t x ) { - if( x==0 ) return -1; - intptr_t result = 0; - uintptr_t tmp; -#if __TBB_WORDSIZE>=8 - if( (tmp = x>>32) ) { x=tmp; result += 32; } -#endif - if( (tmp = x>>16) ) { x=tmp; result += 16; } - if( (tmp = x>>8) ) { x=tmp; result += 8; } - if( (tmp = x>>4) ) { x=tmp; result += 4; } - if( (tmp = x>>2) ) { x=tmp; result += 2; } - return (x&2)? result+1: result; -} -#endif - -#ifndef __TBB_AtomicOR -inline void __TBB_AtomicOR( volatile void *operand, uintptr_t addend ) { - tbb::internal::AtomicBackoff b; - for(;;) { - uintptr_t tmp = *(volatile uintptr_t *)operand; - uintptr_t result = __TBB_CompareAndSwapW(operand, tmp|addend, tmp); - if( result==tmp ) break; - b.pause(); - } -} -#endif - -#ifndef __TBB_AtomicAND -inline void __TBB_AtomicAND( volatile void *operand, uintptr_t addend ) { - tbb::internal::AtomicBackoff b; - for(;;) { - uintptr_t tmp = *(volatile uintptr_t *)operand; - uintptr_t result = __TBB_CompareAndSwapW(operand, tmp&addend, tmp); - if( result==tmp ) break; - b.pause(); - } -} -#endif - -#ifndef __TBB_TryLockByte -inline bool __TBB_TryLockByte( unsigned char &flag ) { - return __TBB_CompareAndSwap1(&flag,1,0)==0; -} -#endif - -#ifndef __TBB_LockByte -inline uintptr_t __TBB_LockByte( unsigned char& flag ) { - if ( !__TBB_TryLockByte(flag) ) { - tbb::internal::AtomicBackoff b; - do { - b.pause(); - } while ( !__TBB_TryLockByte(flag) ); - } - return 0; -} -#endif - -#endif /* __TBB_machine_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_profiling.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_profiling.h deleted file mode 100644 index 77dbf8e4b4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_profiling.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_profiling_H -#define __TBB_profiling_H - -// Check if the tools support is enabled -#if (_WIN32||_WIN64||__linux__) && TBB_USE_THREADING_TOOLS - -#if _WIN32||_WIN64 -#include /* mbstowcs_s */ -#endif -#include "tbb/tbb_stddef.h" - -namespace tbb { - namespace internal { -#if _WIN32||_WIN64 - void __TBB_EXPORTED_FUNC itt_set_sync_name_v3( void *obj, const wchar_t* name ); - inline size_t multibyte_to_widechar( wchar_t* wcs, const char* mbs, size_t bufsize) { -#if _MSC_VER>=1400 - size_t len; - mbstowcs_s( &len, wcs, bufsize, mbs, _TRUNCATE ); - return len; // mbstowcs_s counts null terminator -#else - size_t len = mbstowcs( wcs, mbs, bufsize ); - if(wcs && len!=size_t(-1) ) - wcs[lenModules (groups of functionality) implemented by the library - * - Classes provided by the library - * - Files constituting the library. - * . - * Please note that significant part of TBB functionality is implemented in the form of - * template functions, descriptions of which are not accessible on the Classes - * tab. Use Modules or Namespace/Namespace Members - * tabs to find them. - * - * Additional pieces of information can be found here - * - \subpage concepts - * . - */ - -/** \page concepts TBB concepts - - A concept is a set of requirements to a type, which are necessary and sufficient - for the type to model a particular behavior or a set of behaviors. Some concepts - are specific to a particular algorithm (e.g. algorithm body), while other ones - are common to several algorithms (e.g. range concept). - - All TBB algorithms make use of different classes implementing various concepts. - Implementation classes are supplied by the user as type arguments of template - parameters and/or as objects passed as function call arguments. The library - provides predefined implementations of some concepts (e.g. several kinds of - \ref range_req "ranges"), while other ones must always be implemented by the user. - - TBB defines a set of minimal requirements each concept must conform to. Here is - the list of different concepts hyperlinked to the corresponding requirements specifications: - - \subpage range_req - - \subpage parallel_do_body_req - - \subpage parallel_for_body_req - - \subpage parallel_reduce_body_req - - \subpage parallel_scan_body_req - - \subpage parallel_sort_iter_req -**/ - -// Define preprocessor symbols used to determine architecture -#if _WIN32||_WIN64 -# if defined(_M_AMD64) -# define __TBB_x86_64 1 -# elif defined(_M_IA64) -# define __TBB_ipf 1 -# elif defined(_M_IX86) -# define __TBB_x86_32 1 -# endif -#else /* Assume generic Unix */ -# if !__linux__ && !__APPLE__ -# define __TBB_generic_os 1 -# endif -# if __x86_64__ -# define __TBB_x86_64 1 -# elif __ia64__ -# define __TBB_ipf 1 -# elif __i386__||__i386 // __i386 is for Sun OS -# define __TBB_x86_32 1 -# else -# define __TBB_generic_arch 1 -# endif -#endif - -#if _WIN32||_WIN64 -// define the parts of stdint.h that are needed, but put them inside tbb::internal -namespace tbb { -namespace internal { - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; -} // namespace internal -} // namespace tbb -#else -#include -#endif - -#if _MSC_VER >=1400 -#define __TBB_EXPORTED_FUNC __cdecl -#define __TBB_EXPORTED_METHOD __thiscall -#else -#define __TBB_EXPORTED_FUNC -#define __TBB_EXPORTED_METHOD -#endif - -#include /* Need size_t and ptrdiff_t (the latter on Windows only) from here. */ - -#if _WIN32||_WIN64 -#define __TBB_tbb_windef_H -#include "_tbb_windef.h" -#undef __TBB_tbb_windef_H -#endif /* _WIN32||_WIN64 */ - -#include "tbb_config.h" - -namespace tbb { - //! Type for an assertion handler - typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment ); -} - -#if TBB_USE_ASSERT - -//! Assert that x is true. -/** If x is false, print assertion failure message. - If the comment argument is not NULL, it is printed as part of the failure message. - The comment argument has no other effect. */ -#define __TBB_ASSERT(predicate,message) ((predicate)?((void)0):tbb::assertion_failure(__FILE__,__LINE__,#predicate,message)) -#define __TBB_ASSERT_EX __TBB_ASSERT - -namespace tbb { - //! Set assertion handler and return previous value of it. - assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler ); - - //! Process an assertion failure. - /** Normally called from __TBB_ASSERT macro. - If assertion handler is null, print message for assertion failure and abort. - Otherwise call the assertion handler. */ - void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment ); -} // namespace tbb - -#else - -//! No-op version of __TBB_ASSERT. -#define __TBB_ASSERT(predicate,comment) ((void)0) -//! "Extended" version is useful to suppress warnings if a variable is only used with an assert -#define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate))) - -#endif /* TBB_USE_ASSERT */ - -//! The namespace tbb contains all components of the library. -namespace tbb { - -//! The function returns the interface version of the TBB shared library being used. -/** - * The version it returns is determined at runtime, not at compile/link time. - * So it can be different than the value of TBB_INTERFACE_VERSION obtained at compile time. - */ -extern "C" int __TBB_EXPORTED_FUNC TBB_runtime_interface_version(); - -//! Dummy type that distinguishes splitting constructor from copy constructor. -/** - * See description of parallel_for and parallel_reduce for example usages. - * @ingroup algorithms - */ -class split { -}; - -/** - * @cond INTERNAL - * @brief Identifiers declared inside namespace internal should never be used directly by client code. - */ -namespace internal { - -using std::size_t; - -//! An unsigned integral type big enough to hold a pointer. -/** There's no guarantee by the C++ standard that a size_t is really big enough, - but it happens to be for all platforms of interest. */ -typedef size_t uintptr; - -//! A signed integral type big enough to hold a pointer. -/** There's no guarantee by the C++ standard that a ptrdiff_t is really big enough, - but it happens to be for all platforms of interest. */ -typedef std::ptrdiff_t intptr; - -//! Report a runtime warning. -void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... ); - -#if TBB_USE_ASSERT -//! Set p to invalid pointer value. -template -inline void poison_pointer( T* & p ) { - p = reinterpret_cast(-1); -} -#else -template -inline void poison_pointer( T* ) {/*do nothing*/} -#endif /* TBB_USE_ASSERT */ - -//! Base class for types that should not be assigned. -class no_assign { - // Deny assignment - void operator=( const no_assign& ); -public: -#if __GNUC__ - //! Explicitly define default construction, because otherwise gcc issues gratuitous warning. - no_assign() {} -#endif /* __GNUC__ */ -}; - -//! Base class for types that should not be copied or assigned. -class no_copy: no_assign { - //! Deny copy construction - no_copy( const no_copy& ); -public: - //! Allow default construction - no_copy() {} -}; - -//! Class for determining type of std::allocator::value_type. -template -struct allocator_type { - typedef T value_type; -}; - -#if _WIN32||_WIN64 -//! Microsoft std::allocator has non-standard extension that strips const from a type. -template -struct allocator_type { - typedef T value_type; -}; -#endif /* _WIN32||_WIN64 */ - -// Struct to be used as a version tag for inline functions. -/** Version tag can be necessary to prevent loader on Linux from using the wrong - symbol in debug builds (when inline functions are compiled as out-of-line). **/ -struct version_tag_v3 {}; - -typedef version_tag_v3 version_tag; - -} // internal -//! @endcond - -} // tbb - -#endif /* RC_INVOKED */ -#endif /* __TBB_tbb_stddef_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_thread.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_thread.h deleted file mode 100644 index 6b40a9c049..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbb_thread.h +++ /dev/null @@ -1,294 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_tbb_thread_H -#define __TBB_tbb_thread_H - -#if _WIN32||_WIN64 -#include -#define __TBB_NATIVE_THREAD_ROUTINE unsigned WINAPI -#define __TBB_NATIVE_THREAD_ROUTINE_PTR(r) unsigned (WINAPI* r)( void* ) -#else -#define __TBB_NATIVE_THREAD_ROUTINE void* -#define __TBB_NATIVE_THREAD_ROUTINE_PTR(r) void* (*r)( void* ) -#include -#endif // _WIN32||_WIN64 - -#include -#include // Need std::terminate from here. -#include "tbb_stddef.h" -#include "tick_count.h" - -namespace tbb { - -//! @cond INTERNAL -namespace internal { - - class tbb_thread_v3; - -} // namespace internal - -void swap( internal::tbb_thread_v3& t1, internal::tbb_thread_v3& t2 ); - -namespace internal { - - //! Allocate a closure - void* __TBB_EXPORTED_FUNC allocate_closure_v3( size_t size ); - //! Free a closure allocated by allocate_closure_v3 - void __TBB_EXPORTED_FUNC free_closure_v3( void* ); - - struct thread_closure_base { - void* operator new( size_t size ) {return allocate_closure_v3(size);} - void operator delete( void* ptr ) {free_closure_v3(ptr);} - }; - - template struct thread_closure_0: thread_closure_base { - F function; - - static __TBB_NATIVE_THREAD_ROUTINE start_routine( void* c ) { - thread_closure_0 *self = static_cast(c); - try { - self->function(); - } catch ( ... ) { - std::terminate(); - } - delete self; - return 0; - } - thread_closure_0( const F& f ) : function(f) {} - }; - //! Structure used to pass user function with 1 argument to thread. - template struct thread_closure_1: thread_closure_base { - F function; - X arg1; - //! Routine passed to Windows's _beginthreadex by thread::internal_start() inside tbb.dll - static __TBB_NATIVE_THREAD_ROUTINE start_routine( void* c ) { - thread_closure_1 *self = static_cast(c); - try { - self->function(self->arg1); - } catch ( ... ) { - std::terminate(); - } - delete self; - return 0; - } - thread_closure_1( const F& f, const X& x ) : function(f), arg1(x) {} - }; - template struct thread_closure_2: thread_closure_base { - F function; - X arg1; - Y arg2; - //! Routine passed to Windows's _beginthreadex by thread::internal_start() inside tbb.dll - static __TBB_NATIVE_THREAD_ROUTINE start_routine( void* c ) { - thread_closure_2 *self = static_cast(c); - try { - self->function(self->arg1, self->arg2); - } catch ( ... ) { - std::terminate(); - } - delete self; - return 0; - } - thread_closure_2( const F& f, const X& x, const Y& y ) : function(f), arg1(x), arg2(y) {} - }; - - //! Versioned thread class. - class tbb_thread_v3 { - tbb_thread_v3(const tbb_thread_v3&); // = delete; // Deny access - public: -#if _WIN32||_WIN64 - typedef HANDLE native_handle_type; -#else - typedef pthread_t native_handle_type; -#endif // _WIN32||_WIN64 - - class id; - //! Constructs a thread object that does not represent a thread of execution. - tbb_thread_v3() : my_handle(0) -#if _WIN32||_WIN64 - , my_thread_id(0) -#endif // _WIN32||_WIN64 - {} - - //! Constructs an object and executes f() in a new thread - template explicit tbb_thread_v3(F f) { - typedef internal::thread_closure_0 closure_type; - internal_start(closure_type::start_routine, new closure_type(f)); - } - //! Constructs an object and executes f(x) in a new thread - template tbb_thread_v3(F f, X x) { - typedef internal::thread_closure_1 closure_type; - internal_start(closure_type::start_routine, new closure_type(f,x)); - } - //! Constructs an object and executes f(x,y) in a new thread - template tbb_thread_v3(F f, X x, Y y) { - typedef internal::thread_closure_2 closure_type; - internal_start(closure_type::start_routine, new closure_type(f,x,y)); - } - - tbb_thread_v3& operator=(tbb_thread_v3& x) { - if (joinable()) detach(); - my_handle = x.my_handle; - x.my_handle = 0; -#if _WIN32||_WIN64 - my_thread_id = x.my_thread_id; - x.my_thread_id = 0; -#endif // _WIN32||_WIN64 - return *this; - } - bool joinable() const {return my_handle!=0; } - //! The completion of the thread represented by *this happens before join() returns. - void __TBB_EXPORTED_METHOD join(); - //! When detach() returns, *this no longer represents the possibly continuing thread of execution. - void __TBB_EXPORTED_METHOD detach(); - ~tbb_thread_v3() {if( joinable() ) detach();} - inline id get_id() const; - native_handle_type native_handle() { return my_handle; } - - //! The number of hardware thread contexts. - static unsigned __TBB_EXPORTED_FUNC hardware_concurrency(); - private: - native_handle_type my_handle; -#if _WIN32||_WIN64 - DWORD my_thread_id; -#endif // _WIN32||_WIN64 - - /** Runs start_routine(closure) on another thread and sets my_handle to the handle of the created thread. */ - void __TBB_EXPORTED_METHOD internal_start( __TBB_NATIVE_THREAD_ROUTINE_PTR(start_routine), - void* closure ); - friend void __TBB_EXPORTED_FUNC move_v3( tbb_thread_v3& t1, tbb_thread_v3& t2 ); - friend void tbb::swap( tbb_thread_v3& t1, tbb_thread_v3& t2 ); - }; - - class tbb_thread_v3::id { -#if _WIN32||_WIN64 - DWORD my_id; - id( DWORD my_id ) : my_id(my_id) {} -#else - pthread_t my_id; - id( pthread_t my_id ) : my_id(my_id) {} -#endif // _WIN32||_WIN64 - friend class tbb_thread_v3; - public: - id() : my_id(0) {} - - friend bool operator==( tbb_thread_v3::id x, tbb_thread_v3::id y ); - friend bool operator!=( tbb_thread_v3::id x, tbb_thread_v3::id y ); - friend bool operator<( tbb_thread_v3::id x, tbb_thread_v3::id y ); - friend bool operator<=( tbb_thread_v3::id x, tbb_thread_v3::id y ); - friend bool operator>( tbb_thread_v3::id x, tbb_thread_v3::id y ); - friend bool operator>=( tbb_thread_v3::id x, tbb_thread_v3::id y ); - - template - friend std::basic_ostream& - operator<< (std::basic_ostream &out, - tbb_thread_v3::id id) - { - out << id.my_id; - return out; - } - friend tbb_thread_v3::id __TBB_EXPORTED_FUNC thread_get_id_v3(); - }; // tbb_thread_v3::id - - tbb_thread_v3::id tbb_thread_v3::get_id() const { -#if _WIN32||_WIN64 - return id(my_thread_id); -#else - return id(my_handle); -#endif // _WIN32||_WIN64 - } - void __TBB_EXPORTED_FUNC move_v3( tbb_thread_v3& t1, tbb_thread_v3& t2 ); - tbb_thread_v3::id __TBB_EXPORTED_FUNC thread_get_id_v3(); - void __TBB_EXPORTED_FUNC thread_yield_v3(); - void __TBB_EXPORTED_FUNC thread_sleep_v3(const tick_count::interval_t &i); - - inline bool operator==(tbb_thread_v3::id x, tbb_thread_v3::id y) - { - return x.my_id == y.my_id; - } - inline bool operator!=(tbb_thread_v3::id x, tbb_thread_v3::id y) - { - return x.my_id != y.my_id; - } - inline bool operator<(tbb_thread_v3::id x, tbb_thread_v3::id y) - { - return x.my_id < y.my_id; - } - inline bool operator<=(tbb_thread_v3::id x, tbb_thread_v3::id y) - { - return x.my_id <= y.my_id; - } - inline bool operator>(tbb_thread_v3::id x, tbb_thread_v3::id y) - { - return x.my_id > y.my_id; - } - inline bool operator>=(tbb_thread_v3::id x, tbb_thread_v3::id y) - { - return x.my_id >= y.my_id; - } - -} // namespace internal; - -//! Users reference thread class by name tbb_thread -typedef internal::tbb_thread_v3 tbb_thread; - -using internal::operator==; -using internal::operator!=; -using internal::operator<; -using internal::operator>; -using internal::operator<=; -using internal::operator>=; - -inline void move( tbb_thread& t1, tbb_thread& t2 ) { - internal::move_v3(t1, t2); -} - -inline void swap( internal::tbb_thread_v3& t1, internal::tbb_thread_v3& t2 ) { - tbb::tbb_thread::native_handle_type h = t1.my_handle; - t1.my_handle = t2.my_handle; - t2.my_handle = h; -#if _WIN32||_WIN64 - DWORD i = t1.my_thread_id; - t1.my_thread_id = t2.my_thread_id; - t2.my_thread_id = i; -#endif /* _WIN32||_WIN64 */ -} - -namespace this_tbb_thread { - inline tbb_thread::id get_id() { return internal::thread_get_id_v3(); } - //! Offers the operating system the opportunity to schedule another thread. - inline void yield() { internal::thread_yield_v3(); } - //! The current thread blocks at least until the time specified. - inline void sleep(const tick_count::interval_t &i) { - internal::thread_sleep_v3(i); - } -} // namespace this_tbb_thread - -} // namespace tbb - -#endif /* __TBB_tbb_thread_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbbmalloc_proxy.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbbmalloc_proxy.h deleted file mode 100644 index 87f406b000..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tbbmalloc_proxy.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -/* -Replacing the standard memory allocation routines in Microsoft* C/C++ RTL -(malloc/free, global new/delete, etc.) with the TBB memory allocator. - -Include the following header to a source of any binary which is loaded during -application startup - -#include "tbb/tbbmalloc_proxy.h" - -or add following parameters to the linker options for the binary which is -loaded during application startup. It can be either exe-file or dll. - -For win32 -tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy" -win64 -tbbmalloc_proxy.lib /INCLUDE:"__TBB_malloc_proxy" -*/ - -#ifndef __TBB_tbbmalloc_proxy_H -#define __TBB_tbbmalloc_proxy_H - -#ifdef _DEBUG - #pragma comment(lib, "tbbmalloc_proxy_debug.lib") -#else - #pragma comment(lib, "tbbmalloc_proxy.lib") -#endif - -#if defined(_WIN64) - #pragma comment(linker, "/include:__TBB_malloc_proxy") -#else - #pragma comment(linker, "/include:___TBB_malloc_proxy") -#endif - -#endif //__TBB_tbbmalloc_proxy_H diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tick_count.h b/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tick_count.h deleted file mode 100644 index 4956182782..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/include/tbb/tick_count.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_tick_count_H -#define __TBB_tick_count_H - -#include "tbb_stddef.h" - -#if _WIN32||_WIN64 -#include -#elif __linux__ -#include -#else /* generic Unix */ -#include -#endif /* (choice of OS) */ - -namespace tbb { - -//! Absolute timestamp -/** @ingroup timing */ -class tick_count { -public: - //! Relative time interval. - class interval_t { - long long value; - explicit interval_t( long long value_ ) : value(value_) {} - public: - //! Construct a time interval representing zero time duration - interval_t() : value(0) {}; - - //! Construct a time interval representing sec seconds time duration - explicit interval_t( double sec ); - - //! Return the length of a time interval in seconds - double seconds() const; - - friend class tbb::tick_count; - - //! Extract the intervals from the tick_counts and subtract them. - friend interval_t operator-( const tick_count& t1, const tick_count& t0 ); - - //! Add two intervals. - friend interval_t operator+( const interval_t& i, const interval_t& j ) { - return interval_t(i.value+j.value); - } - - //! Subtract two intervals. - friend interval_t operator-( const interval_t& i, const interval_t& j ) { - return interval_t(i.value-j.value); - } - - //! Accumulation operator - interval_t& operator+=( const interval_t& i ) {value += i.value; return *this;} - - //! Subtraction operator - interval_t& operator-=( const interval_t& i ) {value -= i.value; return *this;} - }; - - //! Construct an absolute timestamp initialized to zero. - tick_count() : my_count(0) {}; - - //! Return current time. - static tick_count now(); - - //! Subtract two timestamps to get the time interval between - friend interval_t operator-( const tick_count& t1, const tick_count& t0 ); - -private: - long long my_count; -}; - -inline tick_count tick_count::now() { - tick_count result; -#if _WIN32||_WIN64 - LARGE_INTEGER qpcnt; - QueryPerformanceCounter(&qpcnt); - result.my_count = qpcnt.QuadPart; -#elif __linux__ - struct timespec ts; -#if TBB_USE_ASSERT - int status = -#endif /* TBB_USE_ASSERT */ - clock_gettime( CLOCK_REALTIME, &ts ); - __TBB_ASSERT( status==0, "CLOCK_REALTIME not supported" ); - result.my_count = static_cast(1000000000UL)*static_cast(ts.tv_sec) + static_cast(ts.tv_nsec); -#else /* generic Unix */ - struct timeval tv; -#if TBB_USE_ASSERT - int status = -#endif /* TBB_USE_ASSERT */ - gettimeofday(&tv, NULL); - __TBB_ASSERT( status==0, "gettimeofday failed" ); - result.my_count = static_cast(1000000)*static_cast(tv.tv_sec) + static_cast(tv.tv_usec); -#endif /*(choice of OS) */ - return result; -} - -inline tick_count::interval_t::interval_t( double sec ) -{ -#if _WIN32||_WIN64 - LARGE_INTEGER qpfreq; - QueryPerformanceFrequency(&qpfreq); - value = static_cast(sec*qpfreq.QuadPart); -#elif __linux__ - value = static_cast(sec*1E9); -#else /* generic Unix */ - value = static_cast(sec*1E6); -#endif /* (choice of OS) */ -} - -inline tick_count::interval_t operator-( const tick_count& t1, const tick_count& t0 ) { - return tick_count::interval_t( t1.my_count-t0.my_count ); -} - -inline double tick_count::interval_t::seconds() const { -#if _WIN32||_WIN64 - LARGE_INTEGER qpfreq; - QueryPerformanceFrequency(&qpfreq); - return value/(double)qpfreq.QuadPart; -#elif __linux__ - return value*1E-9; -#else /* generic Unix */ - return value*1E-6; -#endif /* (choice of OS) */ -} - -} // namespace tbb - -#endif /* __TBB_tick_count_H */ - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/index.html b/deal.II/contrib/tbb/tbb21_20090313oss/index.html deleted file mode 100644 index 96373a5cba..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - -

Overview

-Top level directory for Threading Building Blocks (TBB). -

-To build TBB, use the top-level Makefile; see also the build directions. -To port TBB to a new platform, operating system or architecture, see the porting directions. -

- -

Files

-
-
Makefile -
Top-level Makefile for TBB. See also the build directions. -
- -

Directories

-
-
doc -
Documentation for the library. -
include -
Include files required for compiling code that uses the library. -
examples -
Examples of how to use the library. -
src -
Source code for the library. -
build -
Internal Makefile infrastructure for TBB. Do not use directly; see the build directions. -
ia32, em64t, itanium -
Platform-specific binary files for the library. -
- -
-

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. - - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/Makefile b/deal.II/contrib/tbb/tbb21_20090313oss/src/Makefile deleted file mode 100644 index a559230392..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/Makefile +++ /dev/null @@ -1,192 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -tbb_root?=.. -examples_root:=$(tbb_root)/examples -include $(tbb_root)/build/common.inc -.PHONY: all tbb tbbmalloc test test_no_depends release debug examples clean - -all: release debug examples - -tbb: tbb_release tbb_debug - -tbbmalloc: tbbmalloc_release tbbmalloc_debug - -rml: rml_release rml_debug - -test: tbbmalloc_test_release test_release tbbmalloc_test_debug test_debug - -test_no_depends: tbbmalloc_test_release_no_depends test_release_no_depends tbbmalloc_test_debug_no_depends test_debug_no_depends - @echo done - -release: tbb_release tbbmalloc_release -release: $(call cross_cfg,tbbmalloc_test_release) $(call cross_cfg,test_release) - -debug: tbb_debug tbbmalloc_debug -debug: $(call cross_cfg,tbbmalloc_test_debug) $(call cross_cfg, test_debug) - -examples: tbb tbbmalloc examples_debug clean_examples examples_release - -clean: clean_release clean_debug clean_examples - @echo clean done - -.PHONY: full -full: - $(MAKE) -s -i -r --no-print-directory -f Makefile tbb_root=. clean all -ifeq ($(tbb_os),windows) - $(MAKE) -s -i -r --no-print-directory -f Makefile tbb_root=. compiler=icl clean all native_examples -else - $(MAKE) -s -i -r --no-print-directory -f Makefile tbb_root=. compiler=icc clean all native_examples -endif -ifeq ($(arch),em64t) - $(MAKE) -s -i -r --no-print-directory -f Makefile tbb_root=. arch=ia32 clean all -endif -# it doesn't test compiler=icc arch=ia32 on em64t systems due to enviroment settings of icc - -native_examples: tbb tbbmalloc - $(MAKE) -C $(examples_root) -r -f Makefile tbb_root=.. compiler=$(native_compiler) tbb_build_prefix=$(tbb_build_prefix) debug test - $(MAKE) -C $(examples_root) -r -f Makefile tbb_root=.. compiler=$(native_compiler) tbb_build_prefix=$(tbb_build_prefix) clean release test - -../examples/% examples/%:: - $(MAKE) -C $(examples_root) -r -f Makefile tbb_root=.. $(subst examples/,,$(subst ../,,$@)) - -debug_%:: cfg?=debug -debug_%:: run_cmd=$(debugger) -test_% stress_% time_%:: cfg?=release -debug_% test_% stress_% time_%:: - $(MAKE) -C "$(work_dir)_$(cfg)" -r -f $(tbb_root)/build/Makefile.test cfg=$(cfg) run_cmd=$(run_cmd) tbb_root=$(tbb_root) $@ - -clean_%:: -ifeq ($(cfg),) - @$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root) $@ - @$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root) $@ -else - @$(MAKE) -C "$(work_dir)_$(cfg)" -r -f $(tbb_root)/build/Makefile.test cfg=$(cfg) tbb_root=$(tbb_root) $@ -endif - -.PHONY: tbb_release tbb_debug test_release test_debug test_release_no_depends test_debug_no_depends - -# do not delete double-space after -C option -tbb_release: mkdir_release - $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release tbb_root=$(tbb_root) - -tbb_debug: mkdir_debug - $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbb cfg=debug tbb_root=$(tbb_root) - -rml_release: mkdir_release - $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.rml cfg=release tbb_root=$(tbb_root) - -rml_debug: mkdir_debug - $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.rml cfg=debug tbb_root=$(tbb_root) - -test_release: $(call cross_cfg,mkdir_release) $(call cross_cfg,tbb_release) test_release_no_depends -test_release_no_depends: - -$(MAKE) -C "$(call cross_cfg,$(work_dir)_release)" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root) - -test_debug: $(call cross_cfg,mkdir_debug) $(call cross_cfg,tbb_debug) test_debug_no_depends -test_debug_no_depends: - -$(MAKE) -C "$(call cross_cfg,$(work_dir)_debug)" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root) - -test_release_no_ignore: - $(MAKE) -C "$(call cross_cfg,$(work_dir)_release)" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root) - -test_debug_no_ignore: - $(MAKE) -C "$(call cross_cfg,$(work_dir)_debug)" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root) - -.PHONY: tbbmalloc_release tbbmalloc_debug tbbmalloc_test_release tbbmalloc_test_debug -.PHONY: tbbmalloc_test_release_no_depends tbbmalloc_test_debug_no_depends - -tbbmalloc_release: mkdir_release - $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc tbb_root=$(tbb_root) - -tbbmalloc_debug: mkdir_debug - $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc tbb_root=$(tbb_root) - -tbbmalloc_dll_release: mkdir_release - $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_dll tbb_root=$(tbb_root) - -tbbmalloc_proxy_dll_release: mkdir_release - $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_proxy_dll tbb_root=$(tbb_root) - -tbbmalloc_dll_debug: mkdir_debug - $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_dll tbb_root=$(tbb_root) - -tbbmalloc_proxy_dll_debug: mkdir_debug - $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_proxy_dll tbb_root=$(tbb_root) - -tbbmalloc_test_release: $(call cross_cfg,mkdir_release) $(call cross_cfg,tbbmalloc_release) tbbmalloc_test_release_no_depends -tbbmalloc_test_release_no_depends: - -$(MAKE) -C "$(call cross_cfg,$(work_dir)_release)" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_test tbb_root=$(tbb_root) - -tbbmalloc_test_debug: $(call cross_cfg,mkdir_debug) $(call cross_cfg,tbbmalloc_debug) tbbmalloc_test_debug_no_depends -tbbmalloc_test_debug_no_depends: - -$(MAKE) -C "$(call cross_cfg,$(work_dir)_debug)" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_test tbb_root=$(tbb_root) - -.PHONY: examples_release examples_debug - -examples_release: tbb_release tbbmalloc_release - $(MAKE) -C $(examples_root) -r -f Makefile tbb_root=.. release test - -examples_debug: tbb_debug tbbmalloc_debug - $(MAKE) -C $(examples_root) -r -f Makefile tbb_root=.. debug test - -.PHONY: clean_release clean_debug clean_examples - -clean_release: - $(shell $(RM) $(work_dir)_release$(SLASH)*.* >$(NUL) 2>$(NUL)) - $(shell $(RD) $(work_dir)_release >$(NUL) 2>$(NUL)) - -clean_debug: - $(shell $(RM) $(work_dir)_debug$(SLASH)*.* >$(NUL) 2>$(NUL)) - $(shell $(RD) $(work_dir)_debug >$(NUL) 2>$(NUL)) - -clean_examples: - $(shell $(MAKE) -s -i -r -C $(examples_root) -f Makefile tbb_root=.. clean >$(NUL) 2>$(NUL)) - -.PHONY: mkdir_release mkdir_debug codecov do_codecov info - -mkdir_release: - $(shell $(MD) "$(work_dir)_release" >$(NUL) 2>$(NUL)) - $(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_release" && $(MAKE_TBBVARS) $(tbb_build_prefix)_release) - -mkdir_debug: - $(shell $(MD) "$(work_dir)_debug" >$(NUL) 2>$(NUL)) - $(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_debug" && $(MAKE_TBBVARS) $(tbb_build_prefix)_debug) - -codecov: - $(MAKE) tbb_root=.. compiler=$(if $(findstring windows,$(tbb_os)),icl,icc) codecov=yes do_codecov - -do_codecov: - $(MAKE) tbbmalloc_test_release test_release - $(RM) $(work_dir)_release$(SLASH)test_*.* >$(NUL) 2>$(NUL) - $(MAKE) crosstest=yes tbbmalloc_test_debug test_debug - -info: - @echo OS: $(tbb_os) - @echo arch=$(arch) - @echo compiler=$(compiler) - @echo runtime=$(runtime) - @echo tbb_build_prefix=$(tbb_build_prefix) diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/index.html b/deal.II/contrib/tbb/tbb21_20090313oss/src/index.html deleted file mode 100644 index e45ad6812c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -

Overview

-This directory contains the source code and unit tests for Threading Building Blocks. - -

Directories

-
-
tbb -
Source code of the TBB library core. -
tbbmalloc -
Source code of the TBB scalable memory allocator. -
test -
Source code of the TBB unit tests. -
old -
Source code of deprecated TBB entities that are still shipped as part of the TBB library for the sake of backward compatibility. -
- -
-Up to parent directory -

-Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -

-Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -

-* Other names and brands may be claimed as the property of others. - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.cpp deleted file mode 100644 index 066b39b1f6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "concurrent_queue_v2.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/spin_mutex.h" -#include "tbb/atomic.h" -#include "../tbb/tbb_misc.h" -#include -#include - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (disable: 4267) -#endif - -#define RECORD_EVENTS 0 - -using namespace std; - -namespace tbb { - -namespace internal { - -class concurrent_queue_rep; - -//! A queue using simple locking. -/** For efficient, this class has no constructor. - The caller is expected to zero-initialize it. */ -struct micro_queue { - typedef concurrent_queue_base::page page; - typedef size_t ticket; - - atomic head_page; - atomic head_counter; - - atomic tail_page; - atomic tail_counter; - - spin_mutex page_mutex; - - class push_finalizer: no_copy { - ticket my_ticket; - micro_queue& my_queue; - public: - push_finalizer( micro_queue& queue, ticket k ) : - my_ticket(k), my_queue(queue) - {} - ~push_finalizer() { - my_queue.tail_counter = my_ticket; - } - }; - - void push( const void* item, ticket k, concurrent_queue_base& base ); - - class pop_finalizer: no_copy { - ticket my_ticket; - micro_queue& my_queue; - page* my_page; - public: - pop_finalizer( micro_queue& queue, ticket k, page* p ) : - my_ticket(k), my_queue(queue), my_page(p) - {} - ~pop_finalizer() { - page* p = my_page; - if( p ) { - spin_mutex::scoped_lock lock( my_queue.page_mutex ); - page* q = p->next; - my_queue.head_page = q; - if( !q ) { - my_queue.tail_page = NULL; - } - } - my_queue.head_counter = my_ticket; - if( p ) - operator delete(p); - } - }; - - bool pop( void* dst, ticket k, concurrent_queue_base& base ); -}; - -//! Internal representation of a ConcurrentQueue. -/** For efficient, this class has no constructor. - The caller is expected to zero-initialize it. */ -class concurrent_queue_rep { -public: - typedef size_t ticket; - -private: - friend struct micro_queue; - - //! Approximately n_queue/golden ratio - static const size_t phi = 3; - -public: - //! Must be power of 2 - static const size_t n_queue = 8; - - //! Map ticket to an array index - static size_t index( ticket k ) { - return k*phi%n_queue; - } - - atomic head_counter; - char pad1[NFS_MaxLineSize-sizeof(size_t)]; - - atomic tail_counter; - char pad2[NFS_MaxLineSize-sizeof(ticket)]; - micro_queue array[n_queue]; - - micro_queue& choose( ticket k ) { - // The formula here approximates LRU in a cache-oblivious way. - return array[index(k)]; - } - - //! Value for effective_capacity that denotes unbounded queue. - static const ptrdiff_t infinite_capacity = ptrdiff_t(~size_t(0)/2); -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // unary minus operator applied to unsigned type, result still unsigned - #pragma warning( push ) - #pragma warning( disable: 4146 ) -#endif - -//------------------------------------------------------------------------ -// micro_queue -//------------------------------------------------------------------------ -void micro_queue::push( const void* item, ticket k, concurrent_queue_base& base ) { - k &= -concurrent_queue_rep::n_queue; - page* p = NULL; - size_t index = (k/concurrent_queue_rep::n_queue & base.items_per_page-1); - if( !index ) { - size_t n = sizeof(page) + base.items_per_page*base.item_size; - p = static_cast(operator new( n )); - p->mask = 0; - p->next = NULL; - } - { - push_finalizer finalizer( *this, k+concurrent_queue_rep::n_queue ); - SpinwaitUntilEq( tail_counter, k ); - if( p ) { - spin_mutex::scoped_lock lock( page_mutex ); - if( page* q = tail_page ) - q->next = p; - else - head_page = p; - tail_page = p; - } else { - p = tail_page; - } - base.copy_item( *p, index, item ); - // If no exception was thrown, mark item as present. - p->mask |= uintptr(1)<1 ? item_size : 2); - my_rep = cache_aligned_allocator().allocate(1); - __TBB_ASSERT( (size_t)my_rep % NFS_GetLineSize()==0, "alignment error" ); - __TBB_ASSERT( (size_t)&my_rep->head_counter % NFS_GetLineSize()==0, "alignment error" ); - __TBB_ASSERT( (size_t)&my_rep->tail_counter % NFS_GetLineSize()==0, "alignment error" ); - __TBB_ASSERT( (size_t)&my_rep->array % NFS_GetLineSize()==0, "alignment error" ); - memset(my_rep,0,sizeof(concurrent_queue_rep)); - this->item_size = item_size; -} - -concurrent_queue_base::~concurrent_queue_base() { - size_t nq = my_rep->n_queue; - for( size_t i=0; iarray[i].tail_page; - __TBB_ASSERT( my_rep->array[i].head_page==tp, "at most one page should remain" ); - if( tp!=NULL ) - delete tp; - } - cache_aligned_allocator().deallocate(my_rep,1); -} - -void concurrent_queue_base::internal_push( const void* src ) { - concurrent_queue_rep& r = *my_rep; - concurrent_queue_rep::ticket k = r.tail_counter++; - ptrdiff_t e = my_capacity; - if( e(my_capacity); - } - } - r.choose(k).push(src,k,*this); -} - -void concurrent_queue_base::internal_pop( void* dst ) { - concurrent_queue_rep& r = *my_rep; - concurrent_queue_rep::ticket k; - do { - k = r.head_counter++; - } while( !r.choose(k).pop(dst,k,*this) ); -} - -bool concurrent_queue_base::internal_pop_if_present( void* dst ) { - concurrent_queue_rep& r = *my_rep; - concurrent_queue_rep::ticket k; - do { - ExponentialBackoff backoff; - for(;;) { - k = r.head_counter; - if( r.tail_counter<=k ) { - // Queue is empty - return false; - } - // Queue had item with ticket k when we looked. Attempt to get that item. - if( r.head_counter.compare_and_swap(k+1,k)==k ) { - break; - } - // Another thread snatched the item, so pause and retry. - backoff.pause(); - } - } while( !r.choose(k).pop(dst,k,*this) ); - return true; -} - -bool concurrent_queue_base::internal_push_if_not_full( const void* src ) { - concurrent_queue_rep& r = *my_rep; - ExponentialBackoff backoff; - concurrent_queue_rep::ticket k; - for(;;) { - k = r.tail_counter; - if( (ptrdiff_t)(k-r.head_counter)>=my_capacity ) { - // Queue is full - return false; - } - // Queue had empty slot with ticket k when we looked. Attempt to claim that slot. - if( r.tail_counter.compare_and_swap(k+1,k)==k ) - break; - // Another thread claimed the slot, so pause and retry. - backoff.pause(); - } - r.choose(k).push(src,k,*this); - return true; -} - -ptrdiff_t concurrent_queue_base::internal_size() const { - __TBB_ASSERT( sizeof(ptrdiff_t)<=sizeof(size_t), NULL ); - return ptrdiff_t(my_rep->tail_counter-my_rep->head_counter); -} - -void concurrent_queue_base::internal_set_capacity( ptrdiff_t capacity, size_t /*item_size*/ ) { - my_capacity = capacity<0 ? concurrent_queue_rep::infinite_capacity : capacity; -} - -//------------------------------------------------------------------------ -// concurrent_queue_iterator_rep -//------------------------------------------------------------------------ -class concurrent_queue_iterator_rep: no_assign { -public: - typedef concurrent_queue_rep::ticket ticket; - ticket head_counter; - const concurrent_queue_base& my_queue; - concurrent_queue_base::page* array[concurrent_queue_rep::n_queue]; - concurrent_queue_iterator_rep( const concurrent_queue_base& queue ) : - head_counter(queue.my_rep->head_counter), - my_queue(queue) - { - const concurrent_queue_rep& rep = *queue.my_rep; - for( size_t k=0; ktail_counter ) - return NULL; - else { - concurrent_queue_base::page* p = array[concurrent_queue_rep::index(k)]; - __TBB_ASSERT(p,NULL); - size_t i = k/concurrent_queue_rep::n_queue & my_queue.items_per_page-1; - return static_cast(static_cast(p+1)) + my_queue.item_size*i; - } - } -}; - -//------------------------------------------------------------------------ -// concurrent_queue_iterator_base -//------------------------------------------------------------------------ -concurrent_queue_iterator_base::concurrent_queue_iterator_base( const concurrent_queue_base& queue ) { - my_rep = new concurrent_queue_iterator_rep(queue); - my_item = my_rep->choose(my_rep->head_counter); -} - -void concurrent_queue_iterator_base::assign( const concurrent_queue_iterator_base& other ) { - if( my_rep!=other.my_rep ) { - if( my_rep ) { - delete my_rep; - my_rep = NULL; - } - if( other.my_rep ) { - my_rep = new concurrent_queue_iterator_rep( *other.my_rep ); - } - } - my_item = other.my_item; -} - -void concurrent_queue_iterator_base::advance() { - __TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" ); - size_t k = my_rep->head_counter; - const concurrent_queue_base& queue = my_rep->my_queue; - __TBB_ASSERT( my_item==my_rep->choose(k), NULL ); - size_t i = k/concurrent_queue_rep::n_queue & queue.items_per_page-1; - if( i==queue.items_per_page-1 ) { - concurrent_queue_base::page*& root = my_rep->array[concurrent_queue_rep::index(k)]; - root = root->next; - } - my_rep->head_counter = k+1; - my_item = my_rep->choose(k+1); -} - -concurrent_queue_iterator_base::~concurrent_queue_iterator_base() { - delete my_rep; - my_rep = NULL; -} - -} // namespace internal - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.h deleted file mode 100644 index 862384e32c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_queue_v2.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_concurrent_queue_H -#define __TBB_concurrent_queue_H - -#include "tbb/tbb_stddef.h" -#include - -namespace tbb { - -template class concurrent_queue; - -//! @cond INTERNAL -namespace internal { - -class concurrent_queue_rep; -class concurrent_queue_iterator_rep; -class concurrent_queue_iterator_base; -template class concurrent_queue_iterator; - -//! For internal use only. -/** Type-independent portion of concurrent_queue. - @ingroup containers */ -class concurrent_queue_base: no_copy { - //! Internal representation - concurrent_queue_rep* my_rep; - - friend class concurrent_queue_rep; - friend struct micro_queue; - friend class concurrent_queue_iterator_rep; - friend class concurrent_queue_iterator_base; -protected: - //! Prefix on a page - struct page { - page* next; - uintptr mask; - }; - - //! Capacity of the queue - ptrdiff_t my_capacity; - - //! Always a power of 2 - size_t items_per_page; - - //! Size of an item - size_t item_size; -private: - virtual void copy_item( page& dst, size_t index, const void* src ) = 0; - virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) = 0; -protected: - __TBB_EXPORTED_METHOD concurrent_queue_base( size_t item_size ); - virtual __TBB_EXPORTED_METHOD ~concurrent_queue_base(); - - //! Enqueue item at tail of queue - void __TBB_EXPORTED_METHOD internal_push( const void* src ); - - //! Dequeue item from head of queue - void __TBB_EXPORTED_METHOD internal_pop( void* dst ); - - //! Attempt to enqueue item onto queue. - bool __TBB_EXPORTED_METHOD internal_push_if_not_full( const void* src ); - - //! Attempt to dequeue item from queue. - /** NULL if there was no item to dequeue. */ - bool __TBB_EXPORTED_METHOD internal_pop_if_present( void* dst ); - - //! Get size of queue - ptrdiff_t __TBB_EXPORTED_METHOD internal_size() const; - - void __TBB_EXPORTED_METHOD internal_set_capacity( ptrdiff_t capacity, size_t element_size ); -}; - -//! Type-independent portion of concurrent_queue_iterator. -/** @ingroup containers */ -class concurrent_queue_iterator_base { - //! Concurrentconcurrent_queue over which we are iterating. - /** NULL if one past last element in queue. */ - concurrent_queue_iterator_rep* my_rep; - - template - friend bool operator==( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ); - - template - friend bool operator!=( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ); -protected: - //! Pointer to current item - mutable void* my_item; - - //! Default constructor - __TBB_EXPORTED_METHOD concurrent_queue_iterator_base() : my_rep(NULL), my_item(NULL) {} - - //! Copy constructor - concurrent_queue_iterator_base( const concurrent_queue_iterator_base& i ) : my_rep(NULL), my_item(NULL) { - assign(i); - } - - //! Construct iterator pointing to head of queue. - concurrent_queue_iterator_base( const concurrent_queue_base& queue ); - - //! Assignment - void __TBB_EXPORTED_METHOD assign( const concurrent_queue_iterator_base& i ); - - //! Advance iterator one step towards tail of queue. - void __TBB_EXPORTED_METHOD advance(); - - //! Destructor - __TBB_EXPORTED_METHOD ~concurrent_queue_iterator_base(); -}; - -//! Meets requirements of a forward iterator for STL. -/** Value is either the T or const T type of the container. - @ingroup containers */ -template -class concurrent_queue_iterator: public concurrent_queue_iterator_base { -#if !defined(_MSC_VER) || defined(__INTEL_COMPILER) - template - friend class ::tbb::concurrent_queue; -#else -public: // workaround for MSVC -#endif - //! Construct iterator pointing to head of queue. - concurrent_queue_iterator( const concurrent_queue_base& queue ) : - concurrent_queue_iterator_base(queue) - { - } -public: - concurrent_queue_iterator() {} - - /** If Value==Container::value_type, then this routine is the copy constructor. - If Value==const Container::value_type, then this routine is a conversion constructor. */ - concurrent_queue_iterator( const concurrent_queue_iterator& other ) : - concurrent_queue_iterator_base(other) - {} - - //! Iterator assignment - concurrent_queue_iterator& operator=( const concurrent_queue_iterator& other ) { - assign(other); - return *this; - } - - //! Reference to current item - Value& operator*() const { - return *static_cast(my_item); - } - - Value* operator->() const {return &operator*();} - - //! Advance to next item in queue - concurrent_queue_iterator& operator++() { - advance(); - return *this; - } - - //! Post increment - Value* operator++(int) { - Value* result = &operator*(); - operator++(); - return result; - } -}; // concurrent_queue_iterator - -template -bool operator==( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ) { - return i.my_item==j.my_item; -} - -template -bool operator!=( const concurrent_queue_iterator& i, const concurrent_queue_iterator& j ) { - return i.my_item!=j.my_item; -} - -} // namespace internal; -//! @endcond - -//! A high-performance thread-safe queue. -/** Multiple threads may each push and pop concurrently. - Assignment and copy construction are not allowed. - @ingroup containers */ -template -class concurrent_queue: public internal::concurrent_queue_base { - template friend class internal::concurrent_queue_iterator; - - //! Class used to ensure exception-safety of method "pop" - class destroyer { - T& my_value; - public: - destroyer( T& value ) : my_value(value) {} - ~destroyer() {my_value.~T();} - }; - - T& get_ref( page& page, size_t index ) { - __TBB_ASSERT( index(static_cast(&page+1))[index]; - } - - /*override*/ virtual void copy_item( page& dst, size_t index, const void* src ) { - new( &get_ref(dst,index) ) T(*static_cast(src)); - } - - /*override*/ virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) { - T& from = get_ref(src,index); - destroyer d(from); - *static_cast(dst) = from; - } - -public: - //! Element type in the queue. - typedef T value_type; - - //! Reference type - typedef T& reference; - - //! Const reference type - typedef const T& const_reference; - - //! Integral type for representing size of the queue. - /** Notice that the size_type is a signed integral type. - This is because the size can be negative if there are pending pops without corresponding pushes. */ - typedef std::ptrdiff_t size_type; - - //! Difference type for iterator - typedef std::ptrdiff_t difference_type; - - //! Construct empty queue - concurrent_queue() : - concurrent_queue_base( sizeof(T) ) - { - } - - //! Destroy queue - ~concurrent_queue(); - - //! Enqueue an item at tail of queue. - void push( const T& source ) { - internal_push( &source ); - } - - //! Dequeue item from head of queue. - /** Block until an item becomes available, and then dequeue it. */ - void pop( T& destination ) { - internal_pop( &destination ); - } - - //! Enqueue an item at tail of queue if queue is not already full. - /** Does not wait for queue to become not full. - Returns true if item is pushed; false if queue was already full. */ - bool push_if_not_full( const T& source ) { - return internal_push_if_not_full( &source ); - } - - //! Attempt to dequeue an item from head of queue. - /** Does not wait for item to become available. - Returns true if successful; false otherwise. */ - bool pop_if_present( T& destination ) { - return internal_pop_if_present( &destination ); - } - - //! Return number of pushes minus number of pops. - /** Note that the result can be negative if there are pops waiting for the - corresponding pushes. The result can also exceed capacity() if there - are push operations in flight. */ - size_type size() const {return internal_size();} - - //! Equivalent to size()<=0. - bool empty() const {return size()<=0;} - - //! Maximum number of allowed elements - size_type capacity() const { - return my_capacity; - } - - //! Set the capacity - /** Setting the capacity to 0 causes subsequent push_if_not_full operations to always fail, - and subsequent push operations to block forever. */ - void set_capacity( size_type capacity ) { - internal_set_capacity( capacity, sizeof(T) ); - } - - typedef internal::concurrent_queue_iterator iterator; - typedef internal::concurrent_queue_iterator const_iterator; - - //------------------------------------------------------------------------ - // The iterators are intended only for debugging. They are slow and not thread safe. - //------------------------------------------------------------------------ - iterator begin() {return iterator(*this);} - iterator end() {return iterator();} - const_iterator begin() const {return const_iterator(*this);} - const_iterator end() const {return const_iterator();} - -}; - -template -concurrent_queue::~concurrent_queue() { - while( !empty() ) { - T value; - internal_pop(&value); - } -} - -} // namespace tbb - -#endif /* __TBB_concurrent_queue_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.cpp deleted file mode 100644 index 000ca9fab8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "concurrent_vector_v2.h" -#include "../tbb/tbb_misc.h" -#include -#include "../tbb/itt_notify.h" -#include "tbb/task.h" -#include - - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (disable: 4267) -#endif - -namespace tbb { - -namespace internal { - -void concurrent_vector_base::internal_grow_to_at_least( size_type new_size, size_type element_size, internal_array_op1 init ) { - size_type e = my_early_size; - while( e=pointers_per_short_segment && v.my_segment==v.my_storage ) { - extend_segment(v); - } - } -}; - -void concurrent_vector_base::helper::extend_segment( concurrent_vector_base& v ) { - const size_t pointers_per_long_segment = sizeof(void*)==4 ? 32 : 64; - segment_t* s = (segment_t*)NFS_Allocate( pointers_per_long_segment, sizeof(segment_t), NULL ); - std::memset( s, 0, pointers_per_long_segment*sizeof(segment_t) ); - // If other threads are trying to set pointers in the short segment, wait for them to finish their - // assigments before we copy the short segment to the long segment. - ExponentialBackoff backoff; - while( !v.my_storage[0].array || !v.my_storage[1].array ) { - backoff.pause(); - } - s[0] = v.my_storage[0]; - s[1] = v.my_storage[1]; - if( v.my_segment.compare_and_swap( s, v.my_storage )!=v.my_storage ) - NFS_Free(s); -} - -concurrent_vector_base::size_type concurrent_vector_base::internal_capacity() const { - return segment_base( helper::find_segment_end(*this) ); -} - -void concurrent_vector_base::internal_reserve( size_type n, size_type element_size, size_type max_size ) { - if( n>max_size ) { - throw std::length_error("argument to ConcurrentVector::reserve exceeds ConcurrentVector::max_size()"); - } - for( segment_index_t k = helper::find_segment_end(*this); segment_base(k)n-b ) m = n-b; - copy( my_segment[k].array, src.my_segment[k].array, m ); - } - } -} - -void concurrent_vector_base::internal_assign( const concurrent_vector_base& src, size_type element_size, internal_array_op1 destroy, internal_array_op2 assign, internal_array_op2 copy ) { - size_type n = src.my_early_size; - while( my_early_size>n ) { - segment_index_t k = segment_index_of( my_early_size-1 ); - size_type b=segment_base(k); - size_type new_end = b>=n ? b : n; - __TBB_ASSERT( my_early_size>new_end, NULL ); - destroy( (char*)my_segment[k].array+element_size*(new_end-b), my_early_size-new_end ); - my_early_size = new_end; - } - size_type dst_initialized_size = my_early_size; - my_early_size = n; - size_type b; - for( segment_index_t k=0; (b=segment_base(k))n-b ) m = n-b; - size_type a = 0; - if( dst_initialized_size>b ) { - a = dst_initialized_size-b; - if( a>m ) a = m; - assign( my_segment[k].array, src.my_segment[k].array, a ); - m -= a; - a *= element_size; - } - if( m>0 ) - copy( (char*)my_segment[k].array+a, (char*)src.my_segment[k].array+a, m ); - } - __TBB_ASSERT( src.my_early_size==n, "detected use of ConcurrentVector::operator= with right side that was concurrently modified" ); -} - -void* concurrent_vector_base::internal_push_back( size_type element_size, size_type& index ) { - __TBB_ASSERT( sizeof(my_early_size)==sizeof(reference_count), NULL ); - //size_t tmp = __TBB_FetchAndIncrementWacquire(*(tbb::internal::reference_count*)&my_early_size); - size_t tmp = __TBB_FetchAndIncrementWacquire((tbb::internal::reference_count*)&my_early_size); - index = tmp; - segment_index_t k_old = segment_index_of( tmp ); - size_type base = segment_base(k_old); - helper::extend_segment_if_necessary(*this,k_old); - segment_t& s = my_segment[k_old]; - void* array = s.array; - if( !array ) { - // FIXME - consider factoring this out and share with internal_grow_by - if( base==tmp ) { - __TBB_ASSERT( !s.array, NULL ); - size_t n = segment_size(k_old); - array = NFS_Allocate( n, element_size, NULL ); - ITT_NOTIFY( sync_releasing, &s.array ); - s.array = array; - } else { - ITT_NOTIFY(sync_prepare, &s.array); - internal::SpinwaitWhileEq( s.array, (void*)0 ); - ITT_NOTIFY(sync_acquired, &s.array); - array = s.array; - } - } - size_type j_begin = tmp-base; - return (void*)((char*)array+element_size*j_begin); -} - -concurrent_vector_base::size_type concurrent_vector_base::internal_grow_by( size_type delta, size_type element_size, internal_array_op1 init ) { - size_type result = my_early_size.fetch_and_add(delta); - internal_grow( result, result+delta, element_size, init ); - return result; -} - -void concurrent_vector_base::internal_grow( const size_type start, size_type finish, size_type element_size, internal_array_op1 init ) { - __TBB_ASSERT( start finish-base ? finish-base : n; - (*init)( (void*)((char*)array+element_size*j_begin), j_end-j_begin ); - tmp = base+j_end; - } while( tmp0 ) { - segment_index_t k_old = segment_index_of(finish-1); - segment_t& s = my_segment[k_old]; - __TBB_ASSERT( s.array, NULL ); - size_type base = segment_base(k_old); - size_type j_end = finish-base; - __TBB_ASSERT( j_end, NULL ); - (*destroy)( s.array, j_end ); - finish = base; - } - - // Free the arrays - if( reclaim_storage ) { - size_t k = helper::find_segment_end(*this); - while( k>0 ) { - --k; - segment_t& s = my_segment[k]; - void* array = s.array; - s.array = NULL; - NFS_Free( array ); - } - // Clear short segment. - my_storage[0].array = NULL; - my_storage[1].array = NULL; - segment_t* s = my_segment; - if( s!=my_storage ) { - my_segment = my_storage; - NFS_Free( s ); - } - } -} - -} // namespace internal - -} // tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.h deleted file mode 100644 index a9c3a3be4b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/concurrent_vector_v2.h +++ /dev/null @@ -1,512 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_concurrent_vector_H -#define __TBB_concurrent_vector_H - -#include "tbb/tbb_stddef.h" -#include -#include -#include "tbb/atomic.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/blocked_range.h" - -#include "tbb/tbb_machine.h" - -namespace tbb { - -template -class concurrent_vector; - -//! @cond INTERNAL -namespace internal { - - //! Base class of concurrent vector implementation. - /** @ingroup containers */ - class concurrent_vector_base { - protected: - typedef unsigned long segment_index_t; - - //! Log2 of "min_segment_size". - static const int lg_min_segment_size = 4; - - //! Minimum size (in physical items) of a segment. - static const int min_segment_size = segment_index_t(1)<>1< my_early_size; - - /** Can be zero-initialized. */ - struct segment_t { - /** Declared volatile because in weak memory model, must have ld.acq/st.rel */ - void* volatile array; -#if TBB_DO_ASSERT - ~segment_t() { - __TBB_ASSERT( !array, "should have been set to NULL by clear" ); - } -#endif /* TBB_DO_ASSERT */ - }; - - atomic my_segment; - - segment_t my_storage[2]; - - concurrent_vector_base() { - my_early_size = 0; - my_storage[0].array = NULL; - my_storage[1].array = NULL; - my_segment = my_storage; - } - - //! An operation on an n-lement array starting at begin. - typedef void(__TBB_EXPORTED_FUNC *internal_array_op1)(void* begin, size_type n ); - - //! An operation on n-element destination array and n-element source array. - typedef void(__TBB_EXPORTED_FUNC *internal_array_op2)(void* dst, const void* src, size_type n ); - - void __TBB_EXPORTED_METHOD internal_grow_to_at_least( size_type new_size, size_type element_size, internal_array_op1 init ); - void internal_grow( size_type start, size_type finish, size_type element_size, internal_array_op1 init ); - size_type __TBB_EXPORTED_METHOD internal_grow_by( size_type delta, size_type element_size, internal_array_op1 init ); - void* __TBB_EXPORTED_METHOD internal_push_back( size_type element_size, size_type& index ); - void __TBB_EXPORTED_METHOD internal_clear( internal_array_op1 destroy, bool reclaim_storage ); - void __TBB_EXPORTED_METHOD internal_copy( const concurrent_vector_base& src, size_type element_size, internal_array_op2 copy ); - void __TBB_EXPORTED_METHOD internal_assign( const concurrent_vector_base& src, size_type element_size, - internal_array_op1 destroy, internal_array_op2 assign, internal_array_op2 copy ); -private: - //! Private functionality that does not cross DLL boundary. - class helper; - - friend class helper; - }; - - //! Meets requirements of a forward iterator for STL and a Value for a blocked_range.*/ - /** Value is either the T or const T type of the container. - @ingroup containers */ - template - class vector_iterator -#if defined(_WIN64) && defined(_MSC_VER) - // Ensure that Microsoft's internal template function _Val_type works correctly. - : public std::iterator -#endif /* defined(_WIN64) && defined(_MSC_VER) */ - { - //! concurrent_vector over which we are iterating. - Container* my_vector; - - //! Index into the vector - size_t my_index; - - //! Caches my_vector->internal_subscript(my_index) - /** NULL if cached value is not available */ - mutable Value* my_item; - - template - friend bool operator==( const vector_iterator& i, const vector_iterator& j ); - - template - friend bool operator<( const vector_iterator& i, const vector_iterator& j ); - - template - friend ptrdiff_t operator-( const vector_iterator& i, const vector_iterator& j ); - - template - friend class internal::vector_iterator; - -#if !defined(_MSC_VER) || defined(__INTEL_COMPILER) - template - friend class tbb::concurrent_vector; -#else -public: // workaround for MSVC -#endif - - vector_iterator( const Container& vector, size_t index ) : - my_vector(const_cast(&vector)), - my_index(index), - my_item(NULL) - {} - - public: - //! Default constructor - vector_iterator() : my_vector(NULL), my_index(~size_t(0)), my_item(NULL) {} - - vector_iterator( const vector_iterator& other ) : - my_vector(other.my_vector), - my_index(other.my_index), - my_item(other.my_item) - {} - - vector_iterator operator+( ptrdiff_t offset ) const { - return vector_iterator( *my_vector, my_index+offset ); - } - friend vector_iterator operator+( ptrdiff_t offset, const vector_iterator& v ) { - return vector_iterator( *v.my_vector, v.my_index+offset ); - } - vector_iterator operator+=( ptrdiff_t offset ) { - my_index+=offset; - my_item = NULL; - return *this; - } - vector_iterator operator-( ptrdiff_t offset ) const { - return vector_iterator( *my_vector, my_index-offset ); - } - vector_iterator operator-=( ptrdiff_t offset ) { - my_index-=offset; - my_item = NULL; - return *this; - } - Value& operator*() const { - Value* item = my_item; - if( !item ) { - item = my_item = &my_vector->internal_subscript(my_index); - } - __TBB_ASSERT( item==&my_vector->internal_subscript(my_index), "corrupt cache" ); - return *item; - } - Value& operator[]( ptrdiff_t k ) const { - return my_vector->internal_subscript(my_index+k); - } - Value* operator->() const {return &operator*();} - - //! Pre increment - vector_iterator& operator++() { - size_t k = ++my_index; - if( my_item ) { - // Following test uses 2's-complement wizardry and fact that - // min_segment_size is a power of 2. - if( (k& k-concurrent_vector::min_segment_size)==0 ) { - // k is a power of two that is at least k-min_segment_size - my_item= NULL; - } else { - ++my_item; - } - } - return *this; - } - - //! Pre decrement - vector_iterator& operator--() { - __TBB_ASSERT( my_index>0, "operator--() applied to iterator already at beginning of concurrent_vector" ); - size_t k = my_index--; - if( my_item ) { - // Following test uses 2's-complement wizardry and fact that - // min_segment_size is a power of 2. - if( (k& k-concurrent_vector::min_segment_size)==0 ) { - // k is a power of two that is at least k-min_segment_size - my_item= NULL; - } else { - --my_item; - } - } - return *this; - } - - //! Post increment - vector_iterator operator++(int) { - vector_iterator result = *this; - operator++(); - return result; - } - - //! Post decrement - vector_iterator operator--(int) { - vector_iterator result = *this; - operator--(); - return result; - } - - // STL support - - typedef ptrdiff_t difference_type; - typedef Value value_type; - typedef Value* pointer; - typedef Value& reference; - typedef std::random_access_iterator_tag iterator_category; - }; - - template - bool operator==( const vector_iterator& i, const vector_iterator& j ) { - return i.my_index==j.my_index; - } - - template - bool operator!=( const vector_iterator& i, const vector_iterator& j ) { - return !(i==j); - } - - template - bool operator<( const vector_iterator& i, const vector_iterator& j ) { - return i.my_index - bool operator>( const vector_iterator& i, const vector_iterator& j ) { - return j - bool operator>=( const vector_iterator& i, const vector_iterator& j ) { - return !(i - bool operator<=( const vector_iterator& i, const vector_iterator& j ) { - return !(j - ptrdiff_t operator-( const vector_iterator& i, const vector_iterator& j ) { - return ptrdiff_t(i.my_index)-ptrdiff_t(j.my_index); - } - -} // namespace internal -//! @endcond - -//! Concurrent vector -/** @ingroup containers */ -template -class concurrent_vector: private internal::concurrent_vector_base { -public: - using internal::concurrent_vector_base::size_type; -private: - template - class generic_range_type: public blocked_range { - public: - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef I iterator; - typedef ptrdiff_t difference_type; - generic_range_type( I begin_, I end_, size_t grainsize ) : blocked_range(begin_,end_,grainsize) {} - generic_range_type( generic_range_type& r, split ) : blocked_range(r,split()) {} - }; - - template - friend class internal::vector_iterator; -public: - typedef T& reference; - typedef const T& const_reference; - - //! Construct empty vector. - concurrent_vector() {} - - //! Copy a vector. - concurrent_vector( const concurrent_vector& vector ) {internal_copy(vector,sizeof(T),©_array);} - - //! Assignment - concurrent_vector& operator=( const concurrent_vector& vector ) { - if( this!=&vector ) - internal_assign(vector,sizeof(T),&destroy_array,&assign_array,©_array); - return *this; - } - - //! Clear and destroy vector. - ~concurrent_vector() {internal_clear(&destroy_array,/*reclaim_storage=*/true);} - - //------------------------------------------------------------------------ - // Concurrent operations - //------------------------------------------------------------------------ - //! Grow by "delta" elements. - /** Returns old size. */ - size_type grow_by( size_type delta ) { - return delta ? internal_grow_by( delta, sizeof(T), &initialize_array ) : my_early_size; - } - - //! Grow array until it has at least n elements. - void grow_to_at_least( size_type n ) { - if( my_early_size iterator; - typedef internal::vector_iterator const_iterator; - -#if !defined(_MSC_VER) || _CPPLIB_VER>=300 - // Assume ISO standard definition of std::reverse_iterator - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; -#else - // Use non-standard std::reverse_iterator - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; -#endif /* defined(_MSC_VER) && (_MSC_VER<1300) */ - - typedef generic_range_type range_type; - typedef generic_range_type const_range_type; - - range_type range( size_t grainsize = 1 ) { - return range_type( begin(), end(), grainsize ); - } - - const_range_type range( size_t grainsize = 1 ) const { - return const_range_type( begin(), end(), grainsize ); - } - - //------------------------------------------------------------------------ - // Capacity - //------------------------------------------------------------------------ - //! Return size of vector. - size_type size() const {return my_early_size;} - - //! Return size of vector. - bool empty() const {return !my_early_size;} - - //! Maximum size to which array can grow without allocating more memory. - size_type capacity() const {return internal_capacity();} - - //! Allocate enough space to grow to size n without having to allocate more memory later. - /** Like most of the methods provided for STL compatibility, this method is *not* thread safe. - The capacity afterwards may be bigger than the requested reservation. */ - void reserve( size_type n ) { - if( n ) - internal_reserve(n, sizeof(T), max_size()); - } - - //! Upper bound on argument to reserve. - size_type max_size() const {return (~size_t(0))/sizeof(T);} - - //------------------------------------------------------------------------ - // STL support - //------------------------------------------------------------------------ - - typedef T value_type; - typedef ptrdiff_t difference_type; - - iterator begin() {return iterator(*this,0);} - iterator end() {return iterator(*this,size());} - const_iterator begin() const {return const_iterator(*this,0);} - const_iterator end() const {return const_iterator(*this,size());} - - reverse_iterator rbegin() {return reverse_iterator(end());} - reverse_iterator rend() {return reverse_iterator(begin());} - const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} - const_reverse_iterator rend() const {return const_reverse_iterator(begin());} - - //! Not thread safe - /** Does not change capacity. */ - void clear() {internal_clear(&destroy_array,/*reclaim_storage=*/false);} -private: - //! Get reference to element at given index. - T& internal_subscript( size_type index ) const; - - //! Construct n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC initialize_array( void* begin, size_type n ); - - //! Construct n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC copy_array( void* dst, const void* src, size_type n ); - - //! Assign n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC assign_array( void* dst, const void* src, size_type n ); - - //! Destroy n instances of T, starting at "begin". - static void __TBB_EXPORTED_FUNC destroy_array( void* begin, size_type n ); -}; - -template -T& concurrent_vector::internal_subscript( size_type index ) const { - __TBB_ASSERT( index(my_segment[k].array)[j]; -} - -template -void concurrent_vector::initialize_array( void* begin, size_type n ) { - T* array = static_cast(begin); - for( size_type j=0; j -void concurrent_vector::copy_array( void* dst, const void* src, size_type n ) { - T* d = static_cast(dst); - const T* s = static_cast(src); - for( size_type j=0; j -void concurrent_vector::assign_array( void* dst, const void* src, size_type n ) { - T* d = static_cast(dst); - const T* s = static_cast(src); - for( size_type j=0; j -void concurrent_vector::destroy_array( void* begin, size_type n ) { - T* array = static_cast(begin); - for( size_type j=n; j>0; --j ) - array[j-1].~T(); -} - -} // namespace tbb - -#endif /* __TBB_concurrent_vector_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.cpp deleted file mode 100644 index 8a73e02e0e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "spin_rw_mutex_v2.h" -#include "tbb/tbb_machine.h" -#include "../tbb/tbb_misc.h" -#include "../tbb/itt_notify.h" - -namespace tbb { - -using namespace internal; - -static inline bool CAS(volatile uintptr &addr, uintptr newv, uintptr oldv) { - return __TBB_CompareAndSwapW((volatile void *)&addr, (intptr)newv, (intptr)oldv) == (intptr)oldv; -} - -//! Signal that write lock is released -void spin_rw_mutex::internal_itt_releasing(spin_rw_mutex *mutex) { - ITT_NOTIFY(sync_releasing, mutex); -#if !DO_ITT_NOTIFY - (void)mutex; -#endif -} - -bool spin_rw_mutex::internal_acquire_writer(spin_rw_mutex *mutex) -{ - ITT_NOTIFY(sync_prepare, mutex); - ExponentialBackoff backoff; - for(;;) { - state_t s = mutex->state; - if( !(s & BUSY) ) { // no readers, no writers - if( CAS(mutex->state, WRITER, s) ) - break; // successfully stored writer flag - backoff.reset(); // we could be very close to complete op. - } else if( !(s & WRITER_PENDING) ) { // no pending writers - __TBB_AtomicOR(&mutex->state, WRITER_PENDING); - } - backoff.pause(); - } - ITT_NOTIFY(sync_acquired, mutex); - __TBB_ASSERT( (mutex->state & BUSY)==WRITER, "invalid state of a write lock" ); - return false; -} - -//! Signal that write lock is released -void spin_rw_mutex::internal_release_writer(spin_rw_mutex *mutex) { - __TBB_ASSERT( (mutex->state & BUSY)==WRITER, "invalid state of a write lock" ); - ITT_NOTIFY(sync_releasing, mutex); - mutex->state = 0; -} - -//! Acquire lock on given mutex. -void spin_rw_mutex::internal_acquire_reader(spin_rw_mutex *mutex) { - ITT_NOTIFY(sync_prepare, mutex); - ExponentialBackoff backoff; - for(;;) { - state_t s = mutex->state; - if( !(s & (WRITER|WRITER_PENDING)) ) { // no writer or write requests - if( CAS(mutex->state, s+ONE_READER, s) ) - break; // successfully stored increased number of readers - backoff.reset(); // we could be very close to complete op. - } - backoff.pause(); - } - ITT_NOTIFY(sync_acquired, mutex); - __TBB_ASSERT( mutex->state & READERS, "invalid state of a read lock: no readers" ); - __TBB_ASSERT( !(mutex->state & WRITER), "invalid state of a read lock: active writer" ); -} - -//! Upgrade reader to become a writer. -/** Returns true if the upgrade happened without re-acquiring the lock and false if opposite */ -bool spin_rw_mutex::internal_upgrade(spin_rw_mutex *mutex) { - state_t s = mutex->state; - __TBB_ASSERT( s & READERS, "invalid state before upgrade: no readers " ); - __TBB_ASSERT( !(s & WRITER), "invalid state before upgrade: active writer " ); - // check and set writer-pending flag - // required conditions: either no pending writers, or we are the only reader - // (with multiple readers and pending writer, another upgrade could have been requested) - while( (s & READERS)==ONE_READER || !(s & WRITER_PENDING) ) { - if( CAS(mutex->state, s | WRITER_PENDING, s) ) - { - ExponentialBackoff backoff; - ITT_NOTIFY(sync_prepare, mutex); - while( (mutex->state & READERS) != ONE_READER ) // more than 1 reader - backoff.pause(); - // the state should be 0...0110, i.e. 1 reader and waiting writer; - // both new readers and writers are blocked - __TBB_ASSERT(mutex->state == (ONE_READER | WRITER_PENDING),"invalid state when upgrading to writer"); - mutex->state = WRITER; - ITT_NOTIFY(sync_acquired, mutex); - __TBB_ASSERT( (mutex->state & BUSY) == WRITER, "invalid state after upgrade" ); - return true; // successfully upgraded - } else { - s = mutex->state; // re-read - } - } - // slow reacquire - internal_release_reader(mutex); - return internal_acquire_writer(mutex); // always returns false -} - -void spin_rw_mutex::internal_downgrade(spin_rw_mutex *mutex) { - __TBB_ASSERT( (mutex->state & BUSY) == WRITER, "invalid state before downgrade" ); - ITT_NOTIFY(sync_releasing, mutex); - mutex->state = ONE_READER; - __TBB_ASSERT( mutex->state & READERS, "invalid state after downgrade: no readers" ); - __TBB_ASSERT( !(mutex->state & WRITER), "invalid state after downgrade: active writer" ); -} - -void spin_rw_mutex::internal_release_reader(spin_rw_mutex *mutex) -{ - __TBB_ASSERT( mutex->state & READERS, "invalid state of a read lock: no readers" ); - __TBB_ASSERT( !(mutex->state & WRITER), "invalid state of a read lock: active writer" ); - ITT_NOTIFY(sync_releasing, mutex); // release reader - __TBB_FetchAndAddWrelease((volatile void *)&(mutex->state),-(intptr)ONE_READER); -} - -bool spin_rw_mutex::internal_try_acquire_writer( spin_rw_mutex * mutex ) -{ -// for a writer: only possible to acquire if no active readers or writers - state_t s = mutex->state; // on Itanium, this volatile load has acquire semantic - if( !(s & BUSY) ) // no readers, no writers; mask is 1..1101 - if( CAS(mutex->state, WRITER, s) ) { - ITT_NOTIFY(sync_acquired, mutex); - return true; // successfully stored writer flag - } - return false; -} - -bool spin_rw_mutex::internal_try_acquire_reader( spin_rw_mutex * mutex ) -{ -// for a reader: acquire if no active or waiting writers - state_t s = mutex->state; // on Itanium, a load of volatile variable has acquire semantic - while( !(s & (WRITER|WRITER_PENDING)) ) // no writers - if( CAS(mutex->state, s+ONE_READER, s) ) { - ITT_NOTIFY(sync_acquired, mutex); - return true; // successfully stored increased number of readers - } - return false; -} - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.h deleted file mode 100644 index 3285e8ee5f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/spin_rw_mutex_v2.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_spin_rw_mutex_H -#define __TBB_spin_rw_mutex_H - -#include "tbb/tbb_stddef.h" - -namespace tbb { - -//! Fast, unfair, spinning reader-writer lock with backoff and writer-preference -/** @ingroup synchronization */ -class spin_rw_mutex { - //! @cond INTERNAL - - //! Present so that 1.0 headers work with 1.1 dynamic library. - static void __TBB_EXPORTED_FUNC internal_itt_releasing(spin_rw_mutex *); - - //! Internal acquire write lock. - static bool __TBB_EXPORTED_FUNC internal_acquire_writer(spin_rw_mutex *); - - //! Out of line code for releasing a write lock. - /** This code is has debug checking and instrumentation for Intel(R) Thread Checker and Intel(R) Thread Profiler. */ - static void __TBB_EXPORTED_FUNC internal_release_writer(spin_rw_mutex *); - - //! Internal acquire read lock. - static void __TBB_EXPORTED_FUNC internal_acquire_reader(spin_rw_mutex *); - - //! Internal upgrade reader to become a writer. - static bool __TBB_EXPORTED_FUNC internal_upgrade(spin_rw_mutex *); - - //! Out of line code for downgrading a writer to a reader. - /** This code is has debug checking and instrumentation for Intel(R) Thread Checker and Intel(R) Thread Profiler. */ - static void __TBB_EXPORTED_FUNC internal_downgrade(spin_rw_mutex *); - - //! Internal release read lock. - static void __TBB_EXPORTED_FUNC internal_release_reader(spin_rw_mutex *); - - //! Internal try_acquire write lock. - static bool __TBB_EXPORTED_FUNC internal_try_acquire_writer(spin_rw_mutex *); - - //! Internal try_acquire read lock. - static bool __TBB_EXPORTED_FUNC internal_try_acquire_reader(spin_rw_mutex *); - - //! @endcond -public: - //! Construct unacquired mutex. - spin_rw_mutex() : state(0) {} - -#if TBB_DO_ASSERT - //! Destructor asserts if the mutex is acquired, i.e. state is zero. - ~spin_rw_mutex() { - __TBB_ASSERT( !state, "destruction of an acquired mutex"); - }; -#endif /* TBB_DO_ASSERT */ - - //! The scoped locking pattern - /** It helps to avoid the common problem of forgetting to release lock. - It also nicely provides the "node" for queuing locks. */ - class scoped_lock : private internal::no_copy { - public: - //! Construct lock that has not acquired a mutex. - /** Equivalent to zero-initialization of *this. */ - scoped_lock() : mutex(NULL) {} - - //! Acquire lock on given mutex. - /** Upon entry, *this should not be in the "have acquired a mutex" state. */ - scoped_lock( spin_rw_mutex& m, bool write = true ) : mutex(NULL) { - acquire(m, write); - } - - //! Release lock (if lock is held). - ~scoped_lock() { - if( mutex ) release(); - } - - //! Acquire lock on given mutex. - void acquire( spin_rw_mutex& m, bool write = true ) { - __TBB_ASSERT( !mutex, "holding mutex already" ); - is_writer = write; - mutex = &m; - if( write ) internal_acquire_writer(mutex); - else internal_acquire_reader(mutex); - } - - //! Upgrade reader to become a writer. - /** Returns true if the upgrade happened without re-acquiring the lock and false if opposite */ - bool upgrade_to_writer() { - __TBB_ASSERT( mutex, "lock is not acquired" ); - __TBB_ASSERT( !is_writer, "not a reader" ); - is_writer = true; - return internal_upgrade(mutex); - } - - //! Release lock. - void release() { - __TBB_ASSERT( mutex, "lock is not acquired" ); - spin_rw_mutex *m = mutex; - mutex = NULL; - if( is_writer ) { -#if TBB_DO_THREADING_TOOLS||TBB_DO_ASSERT - internal_release_writer(m); -#else - m->state = 0; -#endif /* TBB_DO_THREADING_TOOLS||TBB_DO_ASSERT */ - } else { - internal_release_reader(m); - } - }; - - //! Downgrade writer to become a reader. - bool downgrade_to_reader() { -#if TBB_DO_THREADING_TOOLS||TBB_DO_ASSERT - __TBB_ASSERT( mutex, "lock is not acquired" ); - __TBB_ASSERT( is_writer, "not a writer" ); - internal_downgrade(mutex); -#else - mutex->state = 4; // Bit 2 - reader, 00..00100 -#endif - is_writer = false; - - return true; - } - - //! Try acquire lock on given mutex. - bool try_acquire( spin_rw_mutex& m, bool write = true ) { - __TBB_ASSERT( !mutex, "holding mutex already" ); - bool result; - is_writer = write; - result = write? internal_try_acquire_writer(&m) - : internal_try_acquire_reader(&m); - if( result ) mutex = &m; - return result; - } - - private: - //! The pointer to the current mutex that is held, or NULL if no mutex is held. - spin_rw_mutex* mutex; - - //! True if holding a writer lock, false if holding a reader lock. - /** Not defined if not holding a lock. */ - bool is_writer; - }; - -private: - typedef internal::uintptr state_t; - static const state_t WRITER = 1; - static const state_t WRITER_PENDING = 2; - static const state_t READERS = ~(WRITER | WRITER_PENDING); - static const state_t ONE_READER = 4; - static const state_t BUSY = WRITER | READERS; - /** Bit 0 = writer is holding lock - Bit 1 = request by a writer to acquire lock (hint to readers to wait) - Bit 2..N = number of readers holding lock */ - volatile state_t state; -}; - -} // namespace ThreadingBuildingBlocks - -#endif /* __TBB_spin_rw_mutex_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_queue_v2.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_queue_v2.cpp deleted file mode 100644 index 4443b592c2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_queue_v2.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/concurrent_queue.h" -#include "tbb/atomic.h" -#include "tbb/tick_count.h" - -#include "../test/harness_assert.h" -#include "../test/harness.h" - -static tbb::atomic FooConstructed; -static tbb::atomic FooDestroyed; - -class Foo { - enum state_t{ - LIVE=0x1234, - DEAD=0xDEAD - }; - state_t state; -public: - int thread_id; - int serial; - Foo() : state(LIVE) { - ++FooConstructed; - } - Foo( const Foo& item ) : state(LIVE) { - ASSERT( item.state==LIVE, NULL ); - ++FooConstructed; - thread_id = item.thread_id; - serial = item.serial; - } - ~Foo() { - ASSERT( state==LIVE, NULL ); - ++FooDestroyed; - state=DEAD; - thread_id=0xDEAD; - serial=0xDEAD; - } - void operator=( Foo& item ) { - ASSERT( item.state==LIVE, NULL ); - ASSERT( state==LIVE, NULL ); - thread_id = item.thread_id; - serial = item.serial; - } - bool is_const() {return false;} - bool is_const() const {return true;} -}; - -const size_t MAXTHREAD = 256; - -static int Sum[MAXTHREAD]; - -//! Count of various pop operations -/** [0] = pop_if_present that failed - [1] = pop_if_present that succeeded - [2] = pop */ -static tbb::atomic PopKind[3]; - -const int M = 10000; - -struct Body { - tbb::concurrent_queue* queue; - const int nthread; - Body( int nthread_ ) : nthread(nthread_) {} - void operator()( long thread_id ) const { - long pop_kind[3] = {0,0,0}; - int serial[MAXTHREAD+1]; - memset( serial, 0, nthread*sizeof(unsigned) ); - ASSERT( thread_idpop_if_present(f); - ++pop_kind[prepopped]; - } - Foo g; - g.thread_id = thread_id; - g.serial = j+1; - queue->push( g ); - if( !prepopped ) { - queue->pop(f); - ++pop_kind[2]; - } - ASSERT( f.thread_id<=nthread, NULL ); - ASSERT( f.thread_id==nthread || serial[f.thread_id]0, "nthread must be positive" ); - if( prefill+1>=capacity ) - return; - bool success = false; - for( int k=0; k<3; ++k ) - PopKind[k] = 0; - for( int trial=0; !success; ++trial ) { - FooConstructed = 0; - FooDestroyed = 0; - Body body(nthread); - tbb::concurrent_queue queue; - queue.set_capacity( capacity ); - body.queue = &queue; - for( int i=0; i=0; ) { - ASSERT( !queue.empty(), NULL ); - Foo f; - queue.pop(f); - ASSERT( queue.size()==i, NULL ); - sum += f.serial-1; - } - ASSERT( queue.empty(), NULL ); - ASSERT( queue.size()==0, NULL ); - if( sum!=expected ) - printf("sum=%d expected=%d\n",sum,expected); - ASSERT( FooConstructed==FooDestroyed, NULL ); - - success = true; - if( nthread>1 && prefill==0 ) { - // Check that pop_if_present got sufficient exercise - for( int k=0; k<2; ++k ) { -#if (_WIN32||_WIN64) - // The TBB library on Windows seems to have a tough time generating - // the desired interleavings for pop_if_present, so the code tries longer, and settles - // for fewer desired interleavings. - const int max_trial = 100; - const int min_requirement = 20; -#else - const int min_requirement = 100; - const int max_trial = 20; -#endif /* _WIN32||_WIN64 */ - if( PopKind[k]=max_trial ) { - if( Verbose ) - printf("Warning: %d threads had only %ld pop_if_present operations %s after %d trials (expected at least %d). " - "This problem may merely be unlucky scheduling. " - "Investigate only if it happens repeatedly.\n", - nthread, long(PopKind[k]), k==0?"failed":"succeeded", max_trial, min_requirement); - else - printf("Warning: the number of %s pop_if_present operations is less than expected for %d threads. Investigate if it happens repeatedly.\n", - k==0?"failed":"succeeded", nthread ); - } else { - success = false; - } - } - } - } - } -} - -template -void TestIteratorAux( Iterator1 i, Iterator2 j, int size ) { - // Now test iteration - Iterator1 old_i; - for( int k=0; k" - ASSERT( k+2==i->serial, NULL ); - } - // Test assignment - old_i = i; - } - ASSERT( k+1==f.serial, NULL ); - } - ASSERT( !(i!=j), NULL ); - ASSERT( i==j, NULL ); -} - -template -void TestIteratorAssignment( Iterator2 j ) { - Iterator1 i(j); - ASSERT( i==j, NULL ); - ASSERT( !(i!=j), NULL ); - Iterator1 k; - k = j; - ASSERT( k==j, NULL ); - ASSERT( !(k!=j), NULL ); -} - -//! Test the iterators for concurrent_queue -void TestIterator() { - tbb::concurrent_queue queue; - tbb::concurrent_queue& const_queue = queue; - for( int j=0; j<500; ++j ) { - TestIteratorAux( queue.begin(), queue.end(), j ); - TestIteratorAux( const_queue.begin(), const_queue.end(), j ); - TestIteratorAux( const_queue.begin(), queue.end(), j ); - TestIteratorAux( queue.begin(), const_queue.end(), j ); - Foo f; - f.serial = j+1; - queue.push(f); - } - TestIteratorAssignment::const_iterator>( const_queue.begin() ); - TestIteratorAssignment::const_iterator>( queue.begin() ); - TestIteratorAssignment::iterator>( queue.begin() ); -} - -void TestConcurrenetQueueType() { - AssertSameType( tbb::concurrent_queue::value_type(), Foo() ); - Foo f; - const Foo g; - tbb::concurrent_queue::reference r = f; - ASSERT( &r==&f, NULL ); - ASSERT( !r.is_const(), NULL ); - tbb::concurrent_queue::const_reference cr = g; - ASSERT( &cr==&g, NULL ); - ASSERT( cr.is_const(), NULL ); -} - -template -void TestEmptyQueue() { - const tbb::concurrent_queue queue; - ASSERT( queue.size()==0, NULL ); - ASSERT( queue.capacity()>0, NULL ); - ASSERT( size_t(queue.capacity())>=size_t(-1)/(sizeof(void*)+sizeof(T)), NULL ); -} - -void TestFullQueue() { - for( int n=0; n<10; ++n ) { - FooConstructed = 0; - FooDestroyed = 0; - tbb::concurrent_queue queue; - queue.set_capacity(n); - for( int i=0; i<=n; ++i ) { - Foo f; - f.serial = i; - bool result = queue.push_if_not_full( f ); - ASSERT( result==(i -struct TestNegativeQueueBody { - tbb::concurrent_queue& queue; - const int nthread; - TestNegativeQueueBody( tbb::concurrent_queue& q, int n ) : queue(q), nthread(n) {} - void operator()( int k ) const { - if( k==0 ) { - int number_of_pops = nthread-1; - // Wait for all pops to pend. - while( queue.size()>-number_of_pops ) { - __TBB_Yield(); - } - for( int i=0; ; ++i ) { - ASSERT( queue.size()==i-number_of_pops, NULL ); - ASSERT( queue.empty()==(queue.size()<=0), NULL ); - if( i==number_of_pops ) break; - // Satisfy another pop - queue.push( T() ); - } - } else { - // Pop item from queue - T item; - queue.pop(item); - } - } -}; - -//! Test a queue with a negative size. -template -void TestNegativeQueue( int nthread ) { - tbb::concurrent_queue queue; - NativeParallelFor( nthread, TestNegativeQueueBody(queue,nthread) ); -} - -int main( int argc, char* argv[] ) { - // Set default for minimum number of threads. - MinThread = 1; - ParseCommandLine(argc,argv); - - TestEmptyQueue(); - TestEmptyQueue(); - TestFullQueue(); - TestConcurrenetQueueType(); - TestIterator(); - - // Test concurrent operations - for( int nthread=MinThread; nthread<=MaxThread; ++nthread ) { - TestNegativeQueue(nthread); - for( int prefill=0; prefill<64; prefill+=(1+prefill/3) ) { - TestPushPop(prefill,ptrdiff_t(-1),nthread); - TestPushPop(prefill,ptrdiff_t(1),nthread); - TestPushPop(prefill,ptrdiff_t(2),nthread); - TestPushPop(prefill,ptrdiff_t(10),nthread); - TestPushPop(prefill,ptrdiff_t(100),nthread); - } - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_vector_v2.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_vector_v2.cpp deleted file mode 100644 index 68a73115be..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_concurrent_vector_v2.cpp +++ /dev/null @@ -1,570 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "concurrent_vector_v2.h" -#include -#include -#include "../test/harness_assert.h" - -tbb::atomic FooCount; - -//! Problem size -const size_t N = 500000; - -struct Foo { - int my_bar; -public: - enum State { - DefaultInitialized=0x1234, - CopyInitialized=0x89ab, - Destroyed=0x5678 - } state; - int& bar() { - ASSERT( state==DefaultInitialized||state==CopyInitialized, NULL ); - return my_bar; - } - int bar() const { - ASSERT( state==DefaultInitialized||state==CopyInitialized, NULL ); - return my_bar; - } - static const int initial_value_of_bar = 42; - Foo() { - state = DefaultInitialized; - ++FooCount; - my_bar = initial_value_of_bar; - } - Foo( const Foo& foo ) { - state = CopyInitialized; - ++FooCount; - my_bar = foo.my_bar; - } - ~Foo() { - ASSERT( state==DefaultInitialized||state==CopyInitialized, NULL ); - state = Destroyed; - my_bar = ~initial_value_of_bar; - --FooCount; - } - bool is_const() const {return true;} - bool is_const() {return false;} -}; - -class FooWithAssign: public Foo { -public: - void operator=( const FooWithAssign& x ) { - ASSERT( x.state==DefaultInitialized||x.state==CopyInitialized, NULL ); - ASSERT( state==DefaultInitialized||state==CopyInitialized, NULL ); - my_bar = x.my_bar; - } -}; - -inline void NextSize( int& s ) { - if( s<=32 ) ++s; - else s += s/10; -} - -static void CheckVector( const tbb::concurrent_vector& cv, size_t expected_size, size_t old_size ) { - ASSERT( cv.size()==expected_size, NULL ); - ASSERT( cv.empty()==(expected_size==0), NULL ); - for( int j=0; j vector_t; - for( int old_size=0; old_size<=128; NextSize( old_size ) ) { - for( int new_size=old_size; new_size<=128; NextSize( new_size ) ) { - long count = FooCount; - vector_t v; - ASSERT( count==FooCount, NULL ); - v.grow_by(old_size); - ASSERT( count+old_size==FooCount, NULL ); - for( int j=0; j vector_t; - vector_t v; - v.reserve( old_size ); - ASSERT( v.capacity()>=old_size, NULL ); - v.reserve( new_size ); - ASSERT( v.capacity()>=old_size, NULL ); - ASSERT( v.capacity()>=new_size, NULL ); - for( size_t i=0; i<2*new_size; ++i ) { - ASSERT( size_t(FooCount)==count+i, NULL ); - size_t j = v.grow_by(1); - ASSERT( j==i, NULL ); - } - } - ASSERT( FooCount==count, NULL ); - } - } -} - -struct AssignElement { - typedef tbb::concurrent_vector::range_type::iterator iterator; - iterator base; - void operator()( const tbb::concurrent_vector::range_type& range ) const { - for( iterator i=range.begin(); i!=range.end(); ++i ) { - if( *i!=0 ) - std::printf("ERROR for v[%ld]\n", long(i-base)); - *i = int(i-base); - } - } - AssignElement( iterator base_ ) : base(base_) {} -}; - -struct CheckElement { - typedef tbb::concurrent_vector::const_range_type::iterator iterator; - iterator base; - void operator()( const tbb::concurrent_vector::const_range_type& range ) const { - for( iterator i=range.begin(); i!=range.end(); ++i ) - if( *i != int(i-base) ) - std::printf("ERROR for v[%ld]\n", long(i-base)); - } - CheckElement( iterator base_ ) : base(base_) {} -}; - -#include "tbb/tick_count.h" -#include "tbb/parallel_for.h" -#include "../test/harness.h" - -void TestParallelFor( int nthread ) { - typedef tbb::concurrent_vector vector_t; - vector_t v; - v.grow_to_at_least(N); - tbb::tick_count t0 = tbb::tick_count::now(); - if( Verbose ) - std::printf("Calling parallel_for.h with %ld threads\n",long(nthread)); - tbb::parallel_for( v.range(10000), AssignElement(v.begin()) ); - tbb::tick_count t1 = tbb::tick_count::now(); - const vector_t& u = v; - tbb::parallel_for( u.range(10000), CheckElement(u.begin()) ); - tbb::tick_count t2 = tbb::tick_count::now(); - if( Verbose ) - std::printf("Time for parallel_for.h: assign time = %8.5f, check time = %8.5f\n", - (t1-t0).seconds(),(t2-t1).seconds()); - for( long i=0; size_t(i) -void TestIteratorAssignment( Iterator2 j ) { - Iterator1 i(j); - ASSERT( i==j, NULL ); - ASSERT( !(i!=j), NULL ); - Iterator1 k; - k = j; - ASSERT( k==j, NULL ); - ASSERT( !(k!=j), NULL ); -} - -template -void TestIteratorTraits() { - AssertSameType( static_cast(0), static_cast(0) ); - AssertSameType( static_cast(0), static_cast(0) ); - AssertSameType( static_cast(0), static_cast(0) ); - AssertSameType( static_cast(0), static_cast(0) ); - T x; - typename Iterator::reference xr = x; - typename Iterator::pointer xp = &x; - ASSERT( &xr==xp, NULL ); -} - -template -void CheckConstIterator( const Vector& u, int i, const Iterator& cp ) { - typename Vector::const_reference pref = *cp; - if( pref.bar()!=i ) - std::printf("ERROR for u[%ld] using const_iterator\n", long(i)); - typename Vector::difference_type delta = cp-u.begin(); - ASSERT( delta==i, NULL ); - if( u[i].bar()!=i ) - std::printf("ERROR for u[%ld] using subscripting\n", long(i)); - ASSERT( u.begin()[i].bar()==i, NULL ); -} - -template -void CheckIteratorComparison( V& u ) { - Iterator1 i = u.begin(); - for( int i_count=0; i_count<100; ++i_count ) { - Iterator2 j = u.begin(); - for( int j_count=0; j_count<100; ++j_count ) { - ASSERT( (i==j)==(i_count==j_count), NULL ); - ASSERT( (i!=j)==(i_count!=j_count), NULL ); - ASSERT( (i-j)==(i_count-j_count), NULL ); - ASSERT( (ij)==(i_count>j_count), NULL ); - ASSERT( (i<=j)==(i_count<=j_count), NULL ); - ASSERT( (i>=j)==(i_count>=j_count), NULL ); - ++j; - } - ++i; - } -} - -//! Test sequential iterators for vector type V. -/** Also does timing. */ -template -void TestSequentialFor() { - V v; - v.grow_by(N); - - // Check iterator - tbb::tick_count t0 = tbb::tick_count::now(); - typename V::iterator p = v.begin(); - ASSERT( !(*p).is_const(), NULL ); - ASSERT( !p->is_const(), NULL ); - for( int i=0; size_t(i)is_const(), NULL ); - for( int i=0; size_t(i)0; ) { - --i; - --cp; - if( i>0 ) { - typename V::const_iterator cp_old = cp--; - int here = (*cp_old).bar(); - ASSERT( here==u[i].bar(), NULL ); - typename V::const_iterator cp_new = cp++; - int prev = (*cp_new).bar(); - ASSERT( prev==u[i-1].bar(), NULL ); - } - CheckConstIterator(u,i,cp); - } - - // Now go forwards and backwards - cp = u.begin(); - ptrdiff_t j = 0; - for( size_t i=0; i(v); - CheckIteratorComparison(v); - CheckIteratorComparison(v); - CheckIteratorComparison(v); - - TestIteratorAssignment( u.begin() ); - TestIteratorAssignment( v.begin() ); - TestIteratorAssignment( v.begin() ); - - // Check reverse_iterator - typename V::reverse_iterator rp = v.rbegin(); - for( size_t i=v.size(); i>0; --i, ++rp ) { - typename V::reference pref = *rp; - ASSERT( size_t(pref.bar())==i-1, NULL ); - ASSERT( rp!=v.rend(), NULL ); - } - ASSERT( rp==v.rend(), NULL ); - - // Check const_reverse_iterator - typename V::const_reverse_iterator crp = u.rbegin(); - for( size_t i=v.size(); i>0; --i, ++crp ) { - typename V::const_reference cpref = *crp; - ASSERT( size_t(cpref.bar())==i-1, NULL ); - ASSERT( crp!=u.rend(), NULL ); - } - ASSERT( crp==u.rend(), NULL ); - - TestIteratorAssignment( u.rbegin() ); - TestIteratorAssignment( v.rbegin() ); -} - -static const size_t Modulus = 7; - -typedef tbb::concurrent_vector MyVector; - -class GrowToAtLeast { - MyVector& my_vector; -public: - void operator()( const tbb::blocked_range& range ) const { - for( size_t i=range.begin(); i!=range.end(); ++i ) { - size_t n = my_vector.size(); - size_t k = n==0 ? 0 : i % (2*n+1); - my_vector.grow_to_at_least(k+1); - ASSERT( my_vector.size()>=k+1, NULL ); - } - } - GrowToAtLeast( MyVector& vector ) : my_vector(vector) {} -}; - -void TestConcurrentGrowToAtLeast() { - MyVector v; - for( size_t s=1; s<1000; s*=10 ) { - tbb::parallel_for( tbb::blocked_range(0,1000000,100), GrowToAtLeast(v) ); - } -} - -//! Test concurrent invocations of method concurrent_vector::grow_by -class GrowBy { - MyVector& my_vector; -public: - void operator()( const tbb::blocked_range& range ) const { - for( int i=range.begin(); i!=range.end(); ++i ) { - if( i%3 ) { - Foo& element = my_vector[my_vector.grow_by(1)]; - element.bar() = i; - } else { - Foo f; - f.bar() = i; - size_t k = my_vector.push_back( f ); - ASSERT( my_vector[k].bar()==i, NULL ); - } - } - } - GrowBy( MyVector& vector ) : my_vector(vector) {} -}; - -//! Test concurrent invocations of method concurrent_vector::grow_by -void TestConcurrentGrowBy( int nthread ) { - int m = 100000; - MyVector v; - tbb::parallel_for( tbb::blocked_range(0,m,1000), GrowBy(v) ); - ASSERT( v.size()==size_t(m), NULL ); - - // Verify that v is a permutation of 0..m - int inversions = 0; - bool* found = new bool[m]; - memset( found, 0, m ); - for( int i=0; i0 ) - inversions += v[i].bar()1 || v[i].bar()==i, "sequential execution is wrong" ); - } - delete[] found; - if( nthread>1 && inversions vector_t; - for( int dst_size=1; dst_size<=128; NextSize( dst_size ) ) { - for( int src_size=2; src_size<=128; NextSize( src_size ) ) { - vector_t u; - u.grow_to_at_least(src_size); - for( int i=0; i - -typedef unsigned long Number; - -static tbb::concurrent_vector Primes; - -class FindPrimes { - bool is_prime( Number val ) const { - int limit, factor = 3; - if( val<5u ) - return val==2; - else { - limit = long(sqrtf(float(val))+0.5f); - while( factor<=limit && val % factor ) - ++factor; - return factor>limit; - } - } -public: - void operator()( const tbb::blocked_range& r ) const { - for( Number i=r.begin(); i!=r.end(); ++i ) { - if( i%2 && is_prime(i) ) { - Primes[Primes.grow_by(1)] = i; - } - } - } -}; - -static double TimeFindPrimes( int nthread ) { - Primes.clear(); - tbb::task_scheduler_init init(nthread); - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for( tbb::blocked_range(0,1000000,500), FindPrimes() ); - tbb::tick_count t1 = tbb::tick_count::now(); - return (t1-t0).seconds(); -} - -static void TestFindPrimes() { - // Time fully subscribed run. - double t2 = TimeFindPrimes( tbb::task_scheduler_init::automatic ); - - // Time parallel run that is very likely oversubscribed. - double t128 = TimeFindPrimes(128); - - if( Verbose ) - std::printf("TestFindPrimes: t2==%g t128=%g\n", t2, t128 ); - - // We allow the 128-thread run a little extra time to allow for thread overhead. - // Theoretically, following test will fail on machine with >128 processors. - // But that situation is not going to come up in the near future, - // and the generalization to fix the issue is not worth the trouble. - if( t128>1.10*t2 ) { - std::printf("Warning: grow_by is pathetically slow: t2==%g t128=%g\n", t2, t128); - } -} - -//------------------------------------------------------------------------ -// Test compatibility with STL sort. -//------------------------------------------------------------------------ - -#include - -void TestSort() { - for( int n=1; n<100; n*=3 ) { - tbb::concurrent_vector array; - array.grow_by( n ); - for( int i=0; i::iterator,Foo>(); - TestIteratorTraits::const_iterator,const Foo>(); - TestSequentialFor > (); - TestResizeAndCopy(); - TestAssign(); - TestCapacity(); - for( int nthread=MinThread; nthread<=MaxThread; ++nthread ) { - tbb::task_scheduler_init init( nthread ); - TestParallelFor( nthread ); - TestConcurrentGrowToAtLeast(); - TestConcurrentGrowBy( nthread ); - } - TestFindPrimes(); - TestSort(); - std::printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_mutex_v2.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_mutex_v2.cpp deleted file mode 100644 index 4e2a1ef72d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/old/test_mutex_v2.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -//------------------------------------------------------------------------ -// Test TBB mutexes when used with parallel_for.h -// -// Usage: test_Mutex.exe [-v] nthread -// -// The -v option causes timing information to be printed. -// -// Compile with _OPENMP and -openmp -//------------------------------------------------------------------------ -#include "tbb/atomic.h" -#include "tbb/blocked_range.h" -#include "tbb/parallel_for.h" -#include "tbb/tick_count.h" -#include "../test/harness.h" -#include "spin_rw_mutex_v2.h" -#include -#include - -#if __linux__ -#define STD std -#else -#define STD /* Cater to broken Windows compilers that are missing "std". */ -#endif /* __linux__ */ - -// This test deliberately avoids a "using tbb" statement, -// so that the error of putting types in the wrong namespace will be caught. - -template -struct Counter { - typedef M mutex_type; - M mutex; - volatile long value; -}; - -//! Function object for use with parallel_for.h. -template -struct AddOne { - C& counter; - /** Increments counter once for each iteration in the iteration space. */ - void operator()( tbb::blocked_range& range ) const { - for( size_t i=range.begin(); i!=range.end(); ++i ) { - if( i&1 ) { - // Try implicit acquire and explicit release - typename C::mutex_type::scoped_lock lock(counter.mutex); - counter.value = counter.value+1; - lock.release(); - } else { - // Try explicit acquire and implicit release - typename C::mutex_type::scoped_lock lock; - lock.acquire(counter.mutex); - counter.value = counter.value+1; - } - } - } - AddOne( C& counter_ ) : counter(counter_) {} -}; - -//! Generic test of a TBB mutex type M. -/** Does not test features specific to reader-writer locks. */ -template -void Test( const char * name ) { - if( Verbose ) { - printf("%s time = ",name); - fflush(stdout); - } - Counter counter; - counter.value = 0; - const int n = 100000; - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for(tbb::blocked_range(0,n,10000),AddOne >(counter)); - tbb::tick_count t1 = tbb::tick_count::now(); - if( Verbose ) - printf("%g usec\n",(t1-t0).seconds()); - if( counter.value!=n ) - STD::printf("ERROR for %s: counter.value=%ld\n",name,counter.value); -} - -template -struct Invariant { - typedef M mutex_type; - M mutex; - const char* mutex_name; - volatile long value[N]; - volatile long single_value; - Invariant( const char* mutex_name_ ) : - mutex_name(mutex_name_) - { - single_value = 0; - for( size_t k=0; k -struct TwiddleInvariant { - I& invariant; - /** Increments counter once for each iteration in the iteration space. */ - void operator()( tbb::blocked_range& range ) const { - for( size_t i=range.begin(); i!=range.end(); ++i ) { - //! Every 8th access is a write access - bool write = (i%8)==7; - bool okay = true; - bool lock_kept = true; - if( (i/8)&1 ) { - // Try implicit acquire and explicit release - typename I::mutex_type::scoped_lock lock(invariant.mutex,write); - if( write ) { - long my_value = invariant.value[0]; - invariant.update(); - if( i%16==7 ) { - lock_kept = lock.downgrade_to_reader(); - if( !lock_kept ) - my_value = invariant.value[0] - 1; - okay = invariant.value_is(my_value+1); - } - } else { - okay = invariant.is_okay(); - if( i%8==3 ) { - long my_value = invariant.value[0]; - lock_kept = lock.upgrade_to_writer(); - if( !lock_kept ) - my_value = invariant.value[0]; - invariant.update(); - okay = invariant.value_is(my_value+1); - } - } - lock.release(); - } else { - // Try explicit acquire and implicit release - typename I::mutex_type::scoped_lock lock; - lock.acquire(invariant.mutex,write); - if( write ) { - long my_value = invariant.value[0]; - invariant.update(); - if( i%16==7 ) { - lock_kept = lock.downgrade_to_reader(); - if( !lock_kept ) - my_value = invariant.value[0] - 1; - okay = invariant.value_is(my_value+1); - } - } else { - okay = invariant.is_okay(); - if( i%8==3 ) { - long my_value = invariant.value[0]; - lock_kept = lock.upgrade_to_writer(); - if( !lock_kept ) - my_value = invariant.value[0]; - invariant.update(); - okay = invariant.value_is(my_value+1); - } - } - } - if( !okay ) { - STD::printf( "ERROR for %s at %ld: %s %s %s %s\n",invariant.mutex_name, long(i), - write?"write,":"read,", write?(i%16==7?"downgrade,":""):(i%8==3?"upgrade,":""), - lock_kept?"lock kept,":"lock not kept,", (i/8)&1?"imp/exp":"exp/imp" ); - } - } - } - TwiddleInvariant( I& invariant_ ) : invariant(invariant_) {} -}; - -/** This test is generic so that we can test any other kinds of ReaderWriter locks we write later. */ -template -void TestReaderWriterLock( const char * mutex_name ) { - if( Verbose ) { - printf("%s readers & writers time = ",mutex_name); - fflush(stdout); - } - Invariant invariant(mutex_name); - const size_t n = 500000; - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for(tbb::blocked_range(0,n,5000),TwiddleInvariant >(invariant)); - tbb::tick_count t1 = tbb::tick_count::now(); - // There is either a writer or a reader upgraded to a writer for each 4th iteration - long expected_value = n/4; - if( !invariant.value_is(expected_value) ) - STD::printf("ERROR for %s: final invariant value is wrong\n",mutex_name); - if( Verbose ) - printf("%g usec\n",(t1-t0).seconds()); -} - -/** Test try_acquire functionality of a non-reenterable mutex */ -template -void TestTryAcquire_OneThread( const char * mutex_name ) { - M tested_mutex; - typename M::scoped_lock lock1; - if( lock1.try_acquire(tested_mutex) ) - lock1.release(); - else - STD::printf("ERROR for %s: try_acquire failed though it should not\n", mutex_name); - { - typename M::scoped_lock lock2(tested_mutex); - if( lock1.try_acquire(tested_mutex) ) - STD::printf("ERROR for %s: try_acquire succeeded though it should not\n", mutex_name); - } - if( lock1.try_acquire(tested_mutex) ) - lock1.release(); - else - STD::printf("ERROR for %s: try_acquire failed though it should not\n", mutex_name); -} - -#include "tbb/task_scheduler_init.h" - -int main( int argc, char * argv[] ) { - ParseCommandLine( argc, argv ); - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init( p ); - if( Verbose ) - printf( "testing with %d workers\n", static_cast(p) ); - // Run each test 3 times. - for( int i=0; i<3; ++i ) { - Test( "Spin RW Mutex" ); - - TestTryAcquire_OneThread("Spin RW Mutex"); // only tests try_acquire for writers - TestReaderWriterLock( "Spin RW Mutex" ); - if( Verbose ) - printf( "calling destructor for task_scheduler_init\n" ); - } - } - STD::printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/perf_util.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/perf_util.h deleted file mode 100644 index 812f5d6c80..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/perf_util.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/task_scheduler_init.h" -#include "tbb/tick_count.h" -#include -#include -#include -#include -#include -#include - -#include "../src/test/harness.h" - -#if __linux__ || __APPLE__ || __FreeBSD__ - #include -#endif /* __APPLE__ */ - -// The code, performance of which is to be measured, is surrounded by the StartSimpleTiming -// and StopSimpleTiming macros. It is called "target code" or "code of interest" hereafter. -// -// The target code is executed inside the nested loop. Nesting is necessary to allow -// measurements on arrays that fit cache of a particular level, while making the load -// big enough to eliminate the influence of random deviations. -// -// Macro StartSimpleTiming defines reduction variable "util::anchor", which may be modified (usually -// by adding to) by the target code. This can be necessary to prevent optimizing compilers -// from throwing out the code of interest. Besides, if the target code is complex enough, -// make sure that all its branches contribute (directly or indirectly) to the value -// being added to the "util::anchor" variable. -// -// To factor out overhead introduced by the measurement infra code it is recommended to make -// a calibration run with target code replaced by a no-op (but still modifying "sum"), and -// store the resulting time in the "util::base" variable. -// -// A generally good approach is to make the target code use elements of a preliminary -// initialized array. Then for calibration run you just need to add vector elements -// to the "sum" variable. To get rid of memory access delays make the array small -// enough to fit L2 or L1 cache (play with StartSimpleTiming arguments if necessary). -// -// Macro CalibrateSimpleTiming performs default calibration using "util::anchor += i;" operation. -// -// Macro ANCHOR_TYPE defines the type of the reduction variable. If it was not -// defined before including this header, it is defined as size_t. Depending on -// the target code modern super scalar architectures may blend reduction operation -// and instructions of interest differently for different target alternatives. So -// you may play with the type to minimize out-of-order and parallel execution impact -// on the calibration time veracity. You may even end up with different reduction -// variable types (and different calibration times) for different measurements. - - -namespace util { - -typedef std::vector durations_t; - - void trace_histogram ( const durations_t& t, char* histogramFileName ) - { - FILE* f = histogramFileName ? fopen(histogramFileName, "wt") : stdout; - size_t n = t.size(); - const size_t num_buckets = 100; - double min_val = *std::min_element(t.begin(), t.end()), - max_val = *std::max_element(t.begin(), t.end()), - bucket_size = (max_val - min_val) / num_buckets; - std::vector hist(num_buckets + 1, 0); - for ( size_t i = 0; i < n; ++i ) - ++hist[size_t((t[i]-min_val)/bucket_size)]; - fprintf (f, "Histogram: nvals = %u, min = %g, max = %g, nbuckets = %u\n", (unsigned)n, min_val, max_val, (unsigned)num_buckets); - double bucket = min_val; - for ( size_t i = 0; i <= num_buckets; ++i, bucket+=bucket_size ) - fprintf (f, "%12g\t%u\n", bucket, (unsigned)hist[i]); - fclose(f); - } - - double average ( const durations_t& d, double& variation_percent, double& std_dev_percent ) - { - durations_t t = d; - if ( t.size() > 5 ) { - t.erase(std::min_element(t.begin(), t.end())); - t.erase(std::max_element(t.begin(), t.end())); - } - size_t n = t.size(); - double sum = 0, - min_val = *std::min_element(t.begin(), t.end()), - max_val = *std::max_element(t.begin(), t.end()); - for ( size_t i = 0; i < n; ++i ) - sum += t[i]; - double avg = sum / n, - std_dev = 0; - for ( size_t i = 0; i < n; ++i ) { - double dev = fabs(t[i] - avg); - std_dev += dev * dev; - } - std_dev = sqrt(std_dev / n); - std_dev_percent = std_dev / avg * 100; - variation_percent = 100 * (max_val - min_val) / avg; - return avg; - } - - static int num_threads; - - static double base = 0, - base_dev = 0, - base_dev_percent = 0; - - static char *empty_fmt = ""; - static int rate_field_len = 11; - -#if !defined(ANCHOR_TYPE) - #define ANCHOR_TYPE size_t -#endif - - static ANCHOR_TYPE anchor = 0; - - static double sequential_time = 0; - - -#define StartSimpleTiming(nOuter, nInner) { \ - tbb::tick_count t1, t0 = tbb::tick_count::now(); \ - for ( size_t j = 0; l < nOuter; ++l ) { \ - for ( size_t i = 0; i < nInner; ++i ) { - -#define StopSimpleTiming(res) \ - } \ - util::anchor += (ANCHOR_TYPE)l; \ - } \ - t1 = tbb::tick_count::now(); \ - printf (util::empty_fmt, util::anchor); \ - res = (t1-t0).seconds() - util::base; \ -} - -#define CalibrateSimpleTiming(T, nOuter, nInner) \ - StartSimpleTiming(nOuter, nInner); \ - util::anchor += (ANCHOR_TYPE)i; \ - StopSimpleTiming(util::base); - - -#define StartTimingImpl(nRuns, nOuter, nInner) \ - tbb::tick_count t1, t0; \ - for ( size_t k = 0; k < nRuns; ++k ) { \ - t0 = tbb::tick_count::now(); \ - for ( size_t l = 0; l < nOuter; ++l ) { \ - for ( size_t i = 0; i < nInner; ++i ) { - -#define StartTiming(nRuns, nOuter, nInner) { \ - util::durations_t t_(nRuns); \ - StartTimingImpl(nRuns, nOuter, nInner) - -#define StartTimingEx(vDurations, nRuns, nOuter, nInner) { \ - util::durations_t &t_ = vDurations; \ - vDurations.resize(nRuns); \ - StartTimingImpl(nRuns, nOuter, nInner) - -#define StopTiming(Avg, StdDev, StdDevPercent) \ - } \ - util::anchor += (ANCHOR_TYPE)l; \ - } \ - t1 = tbb::tick_count::now(); \ - t_[k] = (t1 - t0).seconds()/nrep; \ - } \ - printf (util::empty_fmt, util::anchor); \ - Avg = util::average(t_, StdDev, StdDevPercent); \ -} - -#define CalibrateTiming(nRuns, nOuter, nInner) \ - StartTiming(nRuns, nOuter, nInner); \ - util::anchor += (ANCHOR_TYPE)i; \ - StopTiming(util::base, util::base_dev, util::base_dev_percent); - -} // namespace util - - -#ifndef NRUNS - #define NRUNS 7 -#endif - -#ifndef ONE_TEST_DURATION - #define ONE_TEST_DURATION 0.01 -#endif - -#define no_histogram ((char*)-1) - -inline -double RunTestImpl ( const char* title, void (*pfn)(), char* histogramFileName = no_histogram ) { - double time = 0, variation = 0, deviation = 0; - size_t nrep = 1; - for (;;) { - CalibrateTiming(NRUNS, 1, nrep); - StartTiming(NRUNS, 1, nrep); - pfn(); - StopTiming(time, variation, deviation); - time -= util::base; - if ( time > 1e-6 ) - break; - nrep *= 2; - } - nrep *= (size_t)ceil(ONE_TEST_DURATION/time); - CalibrateTiming(NRUNS, 1, nrep); // sets util::base - util::durations_t t; - StartTimingEx(t, NRUNS, 1, nrep); - pfn(); - StopTiming(time, variation, deviation); - if ( histogramFileName != (char*)-1 ) - util::trace_histogram(t, histogramFileName); - double clean_time = time - util::base; - if ( title ) { - // Deviation (in percent) is calculated for the Gross time - printf ("\n%-34s %.2e %5.1f ", title, clean_time, deviation); - if ( util::sequential_time != 0 ) - //printf ("% .2e ", clean_time - util::sequential_time); - printf ("% 10.1f ", 100*(clean_time - util::sequential_time)/util::sequential_time); - else - printf ("%*s ", util::rate_field_len, ""); - printf ("%-9u %1.6f |", (unsigned)nrep, time * nrep); - } - return clean_time; -} - - -/// Runs the test function, does statistical processing, and, if title is nonzero, prints results. -/** If histogramFileName is a string, the histogram of individual runs is generated and stored - in a file with the given name. If it is NULL then the histogram is printed on the console. - By default no histogram is generated. - The histogram format is: "rate bucket start" "number of tests in this bucket". **/ -inline -void RunTest ( const char* title_fmt, size_t workload_param, void (*pfn_test)(), char* histogramFileName = no_histogram ) { - char title[1024]; - sprintf(title, title_fmt, (long)workload_param); - RunTestImpl(title, pfn_test, histogramFileName); -} - -inline -void CalcSequentialTime ( void (*pfn)() ) { - util::sequential_time = RunTestImpl(NULL, pfn) / util::num_threads; -} - -inline -void ResetSequentialTime () { - util::sequential_time = 0; -} - - -inline void PrintTitle() { - //printf ("%-32s %-*s Std Dev,%% %-*s Repeats Gross time Infra time | NRUNS = %u", - // "Test name", util::rate_field_len, "Rate", util::rate_field_len, "Overhead", NRUNS); - printf ("%-34s %-*s Std Dev,%% Par.overhead,%% Repeats Gross time | Nruns %u, Nthreads %d", - "Test name", util::rate_field_len, "Rate", NRUNS, util::num_threads); -} - -void Test(); - -inline -int test_main( int argc, char* argv[] ) { - MinThread = 1; - MaxThread = tbb::task_scheduler_init::default_num_threads(); - ParseCommandLine( argc, argv ); - char buf[128]; - util::rate_field_len = 2 + sprintf(buf, "%.1e", 1.1); - for ( int i = MinThread; i <= MaxThread; ++i ) { - tbb::task_scheduler_init init (i); - util::num_threads = i; - PrintTitle(); - Test(); - printf("\n"); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.cpp deleted file mode 100644 index db31bee923..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "statistics.h" -#include "statistics_xml.h" - -#define COUNT_PARAMETERS 3 - -#ifdef _WIN32 -#define snprintf _snprintf -#endif - -void GetTime(char* buff,int size_buff) -{ - tm *newtime; - time_t timer; - time(&timer); - newtime=localtime(&timer); - strftime(buff,size_buff,"%H:%M:%S",newtime); -} - -void GetDate(char* buff,int size_buff) -{ - tm *newtime; - time_t timer; - time(&timer); - newtime=localtime(&timer); - strftime(buff,size_buff,"%Y-%m-%d",newtime); -} - - -StatisticsCollector::TestCase StatisticsCollector::SetTestCase(const char *name, const char *mode, int threads) -{ - string KeyName(name); - switch (SortMode) - { - case ByThreads: KeyName += Format("_%02d_%s", threads, mode); break; - default: - case ByAlg: KeyName += Format("_%s_%02d", mode, threads); break; - } - CurrentKey = Statistics[KeyName]; - if(!CurrentKey) { - CurrentKey = new StatisticResults; - CurrentKey->Mode = mode; - CurrentKey->Name = name; - CurrentKey->Threads = threads; - CurrentKey->Results.reserve(RoundTitles.size()); - Statistics[KeyName] = CurrentKey; - } - return TestCase(CurrentKey); -} - -StatisticsCollector::~StatisticsCollector() -{ - for(Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - delete i->second; -} - -void StatisticsCollector::ReserveRounds(size_t index) -{ - size_t i = RoundTitles.size(); - if (i > index) return; - char buf[16]; - RoundTitles.resize(index+1); - for(; i <= index; i++) { - snprintf( buf, 15, "%u", unsigned(i+1) ); - RoundTitles[i] = buf; - } - for(Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) { - if(!i->second) printf("!!!'%s' = NULL\n", i->first.c_str()); - else i->second->Results.reserve(index+1); - } -} - -void StatisticsCollector::AddRoundResult(const TestCase &key, value_t v) -{ - ReserveRounds(key.access->Results.size()); - key.access->Results.push_back(v); -} - -void StatisticsCollector::SetRoundTitle(size_t index, const char *fmt, ...) -{ - vargf2buff(buff, 128, fmt); - ReserveRounds(index); - RoundTitles[index] = buff; -} - -void StatisticsCollector::AddStatisticValue(const TestCase &key, const char *type, const char *fmt, ...) -{ - vargf2buff(buff, 128, fmt); - AnalysisTitles.insert(type); - key.access->Analysis[type] = buff; -} - -void StatisticsCollector::AddStatisticValue(const char *type, const char *fmt, ...) -{ - vargf2buff(buff, 128, fmt); - AnalysisTitles.insert(type); - CurrentKey->Analysis[type] = buff; -} - -void StatisticsCollector::SetStatisticFormula(const char *name, const char *formula) -{ - Formulas[name] = formula; -} - -void StatisticsCollector::SetTitle(const char *fmt, ...) -{ - vargf2buff(buff, 256, fmt); - Title = buff; -} - -string ExcelFormula(const string &fmt, size_t place, size_t rounds, bool is_horizontal) -{ - char buff[16]; - if(is_horizontal) - snprintf(buff, 15, "RC[%u]:RC[%u]", unsigned(place), unsigned(place+rounds-1)); - else - snprintf(buff, 15, "R[%u]C:R[%u]C", unsigned(place+1), unsigned(place+rounds)); - string result(fmt); size_t pos = 0; - while ( (pos = result.find("ROUNDS", pos, 6)) != string::npos ) - result.replace(pos, 6, buff); - return result; -} - -void StatisticsCollector::Print(int dataOutput, const char *ModeName) -{ - FILE *OutputFile; - if (dataOutput & StatisticsCollector::Stdout) - { - printf("\n-=# %s #=-\n", Title.c_str()); - if(SortMode == ByThreads) - printf(" Name | # | %s ", ModeName); - else - printf(" Name | %s | # ", ModeName); - for (AnalysisTitles_t::iterator i = AnalysisTitles.begin(); i != AnalysisTitles.end(); i++) - printf("|%s", i->c_str()+1); - - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - { - if(SortMode == ByThreads) - printf("\n%12s|% 5d|%6s", i->second->Name.c_str(), i->second->Threads, i->second->Mode.c_str()); - else - printf("\n%12s|%6s|% 5d", i->second->Name.c_str(), i->second->Mode.c_str(), i->second->Threads); - Analysis_t &analisis = i->second->Analysis; - AnalysisTitles_t::iterator t = AnalysisTitles.begin(); - for (Analysis_t::iterator a = analisis.begin(); a != analisis.end(); t++) - { - char fmt[8]; snprintf(fmt, 7, "|%% %us", unsigned(max(size_t(3), t->size()))); - if(*t != a->first) - printf(fmt, ""); - else { - printf(fmt, a->second.c_str()); a++; - } - } - } - printf("\n"); - } - if (dataOutput & StatisticsCollector::HTMLFile) - { - if ((OutputFile = fopen((Name+".html").c_str(), "w+t")) != NULL) - { - char TimerBuff[100], DateBuff[100]; - GetTime(TimerBuff,sizeof(TimerBuff)); - GetDate(DateBuff,sizeof(DateBuff)); - fprintf(OutputFile, "\n%s\n\n", Title.c_str()); - //----------------------- - fprintf(OutputFile, "\n"); - fprintf(OutputFile, "" - "", - DateBuff, TimerBuff, unsigned(AnalysisTitles.size() + RoundTitles.size()), Title.c_str()); - fprintf(OutputFile, "\n", ModeName); - for (AnalysisTitles_t::iterator i = AnalysisTitles.begin(); i != AnalysisTitles.end(); i++) - fprintf(OutputFile, "", i->c_str()+1); - for (size_t i = 0; i < RoundTitles.size(); i++) - fprintf(OutputFile, "", RoundTitles[i].c_str()); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - { - fprintf(OutputFile, "\n", - i->second->Name.c_str(), i->second->Threads, i->second->Mode.c_str()); - //statistics - AnalysisTitles_t::iterator t = AnalysisTitles.begin(); - for (Analysis_t::iterator j = i->second->Analysis.begin(); j != i->second->Analysis.end(); t++) - { - fprintf(OutputFile, "", (*t != j->first)?" ":(i->second->Analysis[j->first]).c_str()); - if(*t == j->first) j++; - } - //data - Results_t &r = i->second->Results; - for (size_t k = 0; k < r.size(); k++) - { - fprintf(OutputFile, ""); - } - } - fprintf(OutputFile, "\n
Flip[H]%s%s%s
NameThreads%s%s%s
%s%d%4s%s"); - fprintf(OutputFile, ResultsFmt, r[k]); - fprintf(OutputFile, "
\n"); - ////////////////////////////////////////////////////// - fprintf(OutputFile, "\n"); - fprintf(OutputFile, "\n" - "", - DateBuff, TimerBuff, unsigned(max(Statistics.size()-2,size_t(1))), Title.c_str()); - - fprintf(OutputFile, "\n"); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - fprintf(OutputFile, "", i->second->Name.c_str()); - fprintf(OutputFile, "\n"); - for (Statistics_t::iterator n = Statistics.begin(); n != Statistics.end(); n++) - fprintf(OutputFile, "", n->second->Threads); - fprintf(OutputFile, "\n", ModeName); - for (Statistics_t::iterator m = Statistics.begin(); m != Statistics.end(); m++) - fprintf(OutputFile, "", m->second->Mode.c_str()); - - for (AnalysisTitles_t::iterator t = AnalysisTitles.begin(); t != AnalysisTitles.end(); t++) - { - fprintf(OutputFile, "\n", t->c_str()+1); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - fprintf(OutputFile, "", i->second->Analysis.count(*t)?i->second->Analysis[*t].c_str():" "); - } - - for (size_t r = 0; r < RoundTitles.size(); r++) - { - fprintf(OutputFile, "\n", RoundTitles[r].c_str()); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - { - Results_t &result = i->second->Results; - fprintf(OutputFile, ""); - } - } - fprintf(OutputFile, "\n
Flip[V]%s%s%s
Name%s
Threads%d
%s%s
%s%s
%s"); - if(result.size() > r) - fprintf(OutputFile, ResultsFmt, result[r]); - fprintf(OutputFile, "
\n\n"); - fclose(OutputFile); - } - } - if (dataOutput & StatisticsCollector::ExcelXML) - { - if ((OutputFile = fopen((Name+".xml").c_str(), "w+t")) == NULL) { - printf("Can't open .xml file\n"); - } else { - //vector *TmpVect; - //Statistics_t::iterator ii, i = Statistics.begin(); - //Analysis_t::iterator jj, j = i->second.Analysis.begin(); - char UserName[100]; - char SheetName[20]; - char TimerBuff[100], DateBuff[100]; -#if _WIN32 || _WIN64 - strcpy(UserName,getenv("USERNAME")); -#else - strcpy(UserName,getenv("USER")); -#endif - //-------------------------------- - strcpy(SheetName,"Horizontal"); - GetTime(TimerBuff,sizeof(TimerBuff)); - GetDate(DateBuff,sizeof(DateBuff)); - //-------------------------- - fprintf(OutputFile, XMLHead, UserName, TimerBuff); - fprintf(OutputFile, XMLStyles); - fprintf(OutputFile, XMLBeginSheet, SheetName); - fprintf(OutputFile, XMLNames,1,1,1,int(AnalysisTitles.size()+Formulas.size()+COUNT_PARAMETERS)); - fprintf(OutputFile, XMLBeginTable, int(RoundTitles.size()+Formulas.size()+AnalysisTitles.size()+COUNT_PARAMETERS+1/*title*/), int(Statistics.size()+1)); - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLCellTopName); - fprintf(OutputFile, XMLCellTopThread); - fprintf(OutputFile, XMLCellTopMode, ModeName); - for (AnalysisTitles_t::iterator j = AnalysisTitles.begin(); j != AnalysisTitles.end(); j++) - fprintf(OutputFile, XMLAnalysisTitle, j->c_str()+1); - for (Formulas_t::iterator j = Formulas.begin(); j != Formulas.end(); j++) - fprintf(OutputFile, XMLAnalysisTitle, j->first.c_str()+1); - for (RoundTitles_t::iterator j = RoundTitles.begin(); j != RoundTitles.end(); j++) - fprintf(OutputFile, XMLAnalysisTitle, j->c_str()); - fprintf(OutputFile, XMLCellEmptyWhite, Title.c_str()); - fprintf(OutputFile, XMLERow); - //------------------------ - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - { - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLCellName, i->second->Name.c_str()); - fprintf(OutputFile, XMLCellThread,i->second->Threads); - fprintf(OutputFile, XMLCellMode, i->second->Mode.c_str()); - //statistics - AnalysisTitles_t::iterator at = AnalysisTitles.begin(); - for (Analysis_t::iterator j = i->second->Analysis.begin(); j != i->second->Analysis.end(); at++) - { - fprintf(OutputFile, XMLCellAnalysis, (*at != j->first)?"":(i->second->Analysis[j->first]).c_str()); - if(*at == j->first) j++; - } - //formulas - size_t place = 0; - Results_t &v = i->second->Results; - for (Formulas_t::iterator f = Formulas.begin(); f != Formulas.end(); f++, place++) - fprintf(OutputFile, XMLCellFormula, ExcelFormula(f->second, Formulas.size()-place, v.size(), true).c_str()); - //data - for (size_t k = 0; k < v.size(); k++) - { - fprintf(OutputFile, XMLCellData, v[k]); - } - if(v.size() < RoundTitles.size()) - fprintf(OutputFile, XMLMergeRow, int(RoundTitles.size() - v.size())); - fprintf(OutputFile, XMLERow); - } - //------------------------ - fprintf(OutputFile, XMLEndTable); - fprintf(OutputFile, XMLWorkSheetProperties,1,1,3,3,int(RoundTitles.size()+AnalysisTitles.size()+Formulas.size()+COUNT_PARAMETERS)); - fprintf(OutputFile, XMLAutoFilter,1,1,1,int(AnalysisTitles.size()+Formulas.size()+COUNT_PARAMETERS)); - fprintf(OutputFile, XMLEndWorkSheet); - //---------------------------------------- - strcpy(SheetName,"Vertical"); - fprintf(OutputFile, XMLBeginSheet, SheetName); - fprintf(OutputFile, XMLNames, int(Formulas.size()+AnalysisTitles.size()+COUNT_PARAMETERS+2),2,int(AnalysisTitles.size()+Formulas.size()+COUNT_PARAMETERS+2),int(Statistics.size()+1)); - fprintf(OutputFile, XMLBeginTable, int(max(Statistics.size()+1, size_t(7))), int(RoundTitles.size()+AnalysisTitles.size()+Formulas.size()+COUNT_PARAMETERS+2)); - //fprintf(OutputFile, XMLColumsVerticalTable, Statistics.size()+1); - //---------------------------------------- - - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLNameAndTime, Name.c_str(), TimerBuff, DateBuff); - fprintf(OutputFile, XMLTableParamAndTitle, int(Statistics.size()), int(AnalysisTitles.size()), int(RoundTitles.size()), Title.c_str()); - fprintf(OutputFile, XMLERow); - fprintf(OutputFile, XMLBRow); - //------------------- - fprintf(OutputFile, XMLCellTopName); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - fprintf(OutputFile, XMLCellName, i->second->Name.c_str()); - fprintf(OutputFile, XMLERow); - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLCellTopThread); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - fprintf(OutputFile, XMLCellThread, i->second->Threads); - fprintf(OutputFile, XMLERow); - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLCellTopMode, ModeName); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - fprintf(OutputFile, XMLCellMode, i->second->Mode.c_str()); - fprintf(OutputFile, XMLERow); - //----------------- - for (AnalysisTitles_t::iterator t = AnalysisTitles.begin(); t != AnalysisTitles.end(); t++) - { - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLAnalysisTitle, t->c_str()+1); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - fprintf(OutputFile, XMLCellAnalysis, i->second->Analysis.count(*t)?(i->second->Analysis[*t]).c_str():""); - fprintf(OutputFile, XMLERow); - } - //------------------------------------- - for (Formulas_t::iterator t = Formulas.begin(); t != Formulas.end(); t++) - { - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLAnalysisTitle, t->first.c_str()+1); - size_t place = 0; - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - fprintf(OutputFile, XMLCellAnalysis, ExcelFormula(t->second, Formulas.size()-place, i->second->Results.size(), false).c_str()); - fprintf(OutputFile, XMLERow); - } - //-------------------------------------- - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLCellEmptyWhite, "Result"); - fprintf(OutputFile, XMLERow); - - for (size_t k = 0; k < RoundTitles.size(); k++) - { - fprintf(OutputFile, XMLBRow); - fprintf(OutputFile, XMLAnalysisTitle, RoundTitles[k].c_str()); - for (Statistics_t::iterator i = Statistics.begin(); i != Statistics.end(); i++) - if(i->second->Results.size() > k) - fprintf(OutputFile, XMLCellData, i->second->Results[k]); - else - fprintf(OutputFile, XMLCellEmptyWhite, ""); - fprintf(OutputFile, XMLERow); - } - fprintf(OutputFile, XMLEndTable); - //---------------------------------------- - fprintf(OutputFile, XMLWorkSheetProperties, int(Formulas.size()+AnalysisTitles.size()+COUNT_PARAMETERS+2), int(Formulas.size()+AnalysisTitles.size()+COUNT_PARAMETERS+2),1,1,6); - fprintf(OutputFile, XMLAutoFilter, int(Formulas.size()+AnalysisTitles.size()+COUNT_PARAMETERS+2),2, int(Formulas.size()+AnalysisTitles.size()+COUNT_PARAMETERS+2), int(Statistics.size()+1)); - //---------------------------------------- - fprintf(OutputFile, XMLEndWorkSheet); - fprintf(OutputFile, XMLEndWorkbook); - fclose(OutputFile); - } - } -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.h deleted file mode 100644 index 3066190d03..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Internal Intel tool - -#ifndef __STATISTICS_H__ -#define __STATISTICS_H__ - -#define _CRT_SECURE_NO_DEPRECATE 1 - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -typedef double value_t; - -/* - Statistical collector class. - - Resulting table output: - +---------------------------------------------------------------------------+ - | [Date] ... | - +----------+----v----+--v---+----------------+------------+-..-+------------+ - | TestName | Threads | Mode | Rounds results | Stat_type1 | .. | Stat_typeN | - +----------+---------+------+-+-+-+-..-+-+-+-+------------+-..-+------------+ - | | | | | | | .. | | | | | | | - .. ... ... .................. ...... .. - | | | | | | | .. | | | | | | | - +----------+---------+------+-+-+-+-..-+-+-+-+------------+-..-+------------+ - - Iterating table output: - +---------------------------------------------------------------------------+ - | [Date] <TestName>, Threads: <N>, Mode: <M>; for <Title>... | - +----------+----v----+--v---+----------------+------------+-..-+------------+ - -*/ - -class StatisticsCollector -{ -public: - typedef map<string, string> Analysis_t; - typedef vector<value_t> Results_t; - -protected: - StatisticsCollector(const StatisticsCollector &); - - struct StatisticResults - { - string Name; - string Mode; - int Threads; - Results_t Results; - Analysis_t Analysis; - }; - - // internal members - //bool OpenFile; - StatisticResults *CurrentKey; - string Title; - const char /**Name,*/ *ResultsFmt; - string Name; - //! Data - typedef map<string, StatisticResults*> Statistics_t; - Statistics_t Statistics; - typedef vector<string> RoundTitles_t; - RoundTitles_t RoundTitles; - //TODO: merge those into one structure - typedef map<string, string> Formulas_t; - Formulas_t Formulas; - typedef set<string> AnalysisTitles_t; - AnalysisTitles_t AnalysisTitles; - -public: - struct TestCase { - StatisticResults *access; - TestCase() : access(0) {} - TestCase(StatisticResults *link) : access(link) {} - const char *getName() const { return access->Name.c_str(); } - const char *getMode() const { return access->Mode.c_str(); } - int getThreads() const { return access->Threads; } - const Results_t &getResults() const { return access->Results; } - const Analysis_t &getAnalysis() const { return access->Analysis; } - }; - - enum Sorting { - ByThreads, ByAlg - }; - - //! Data and output types - enum DataOutput { - // Verbosity level enumeration - Statistic = 1, //< Analytical data - computed after all iterations and rounds passed - Result = 2, //< Testing data - collected after all iterations passed - Iteration = 3, //< Verbose data - collected at each iteration (for each size - in case of containers) - // ExtraVerbose is not applicabe yet :) be happy, but flexibility is always welcome - - // Next constants are bit-fields - Stdout = 1<<8, //< Output to the console - TextFile = 1<<9, //< Output to plain text file "name.txt" (delimiter is TAB by default) - ExcelXML = 1<<10, //< Output to Excel-readable XML-file "name.xml" - HTMLFile = 1<<11 //< Output to HTML file "name.html" - }; - - //! Constructor. Specify tests set name which used as name of output files - StatisticsCollector(const char *name, Sorting mode = ByThreads, const char *fmt = "%g") - : CurrentKey(NULL), ResultsFmt(fmt), Name(name), SortMode(mode) {} - - ~StatisticsCollector(); - - //! Set tests set title, supporting printf-like arguments - void SetTitle(const char *fmt, ...); - - //! Specify next test key - TestCase SetTestCase(const char *name, const char *mode, int threads); - //! Specify next test key - void SetTestCase(const TestCase &t) { SetTestCase(t.getName(), t.getMode(), t.getThreads()); } - //! Reserve specified number of rounds. Use for effeciency. Used mostly internally - void ReserveRounds(size_t index); - //! Add result of the measure - void AddRoundResult(const TestCase &, value_t v); - //! Add result of the current measure - void AddRoundResult(value_t v) { if(CurrentKey) AddRoundResult(TestCase(CurrentKey), v); } - //! Add title of round - void SetRoundTitle(size_t index, const char *fmt, ...); - //! Add numbered title of round - void SetRoundTitle(size_t index, int num) { SetRoundTitle(index, "%d", num); } - //! Get number of rounds - size_t GetRoundsCount() const { return RoundTitles.size(); } - // Set statistic value for the test - void AddStatisticValue(const TestCase &, const char *type, const char *fmt, ...); - // Set statistic value for the current test - void AddStatisticValue(const char *type, const char *fmt, ...); - //! Add Excel-processing formulas. @arg formula can contain more than one instances of - //! ROUNDS template which transforms into the range of cells with result values - //TODO://! #1 .. #n templates represent data cells from the first to the last - //TODO: merge with Analisis - void SetStatisticFormula(const char *name, const char *formula); - - //! Data output - void Print(int dataOutput, const char *ModeName = "Mode"); - -private: - Sorting SortMode; -}; - -//! using: Func(const char *fmt, ...) { vargf2buff(buff, 128, fmt);... -#define vargf2buff(name, size, fmt) char name[size]; memset(name, 0, size); va_list args; va_start(args, fmt); vsnprintf( name, size-1, fmt, args) - -inline std::string Format(const char *fmt, ...) { - vargf2buff(buf, 1024, fmt); // from statistics.h - return std::string(buf); -} - -#ifdef STATISTICS_INLINE -#include "statistics.cpp" -#endif -#endif //__STATISTICS_H__ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics_xml.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics_xml.h deleted file mode 100644 index 7521825be8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/statistics_xml.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -const char XMLBRow[]= -" <Row>\n"; - -const char XMLERow[]= -" </Row>\n"; - -const char XMLHead[]= -"<?xml version=\"1.0\"?>\n" -"<?mso-application progid=\"Excel.Sheet\"?>\n\ -<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"\n\ - xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n\ - xmlns:x=\"urn:schemas-microsoft-com:office:excel\"\n\ - xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"\n\ - xmlns:html=\"http://www.w3.org/TR/REC-html40\">\n\ - <DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">\n\ - <Author>%s</Author>\n\ - <Created>%s</Created>\n\ - <Company>Intel Corporation</Company>\n\ - </DocumentProperties>\n\ - <ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\">\n\ - <RefModeR1C1/>\n\ - </ExcelWorkbook>\n"; - - const char XMLStyles[]= - " <Styles>\n\ - <Style ss:ID=\"Default\" ss:Name=\"Normal\">\n\ - <Alignment ss:Vertical=\"Bottom\" ss:Horizontal=\"Left\" ss:WrapText=\"0\"/>\n\ - </Style>\n\ - <Style ss:ID=\"s26\">\n\ - <Alignment ss:Vertical=\"Top\" ss:Horizontal=\"Left\" ss:WrapText=\"0\"/>\n\ - <Borders>\n\ - <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - </Borders>\n\ - <Interior ss:Color=\"#FFFF99\" ss:Pattern=\"Solid\"/>\n\ - </Style>\n\ - <Style ss:ID=\"s25\">\n\ - <Alignment ss:Vertical=\"Top\" ss:Horizontal=\"Left\" ss:WrapText=\"0\"/>\n\ - <Borders>\n\ - <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - </Borders>\n\ - <Interior ss:Color=\"#CCFFFF\" ss:Pattern=\"Solid\"/>\n\ - </Style>\n\ - <Style ss:ID=\"s24\">\n\ - <Alignment ss:Vertical=\"Top\" ss:Horizontal=\"Left\" ss:WrapText=\"0\"/>\n\ - <Borders>\n\ - <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - </Borders>\n\ - <Interior ss:Color=\"#CCFFCC\" ss:Pattern=\"Solid\"/>\n\ - </Style>\n\ - <Style ss:ID=\"s23\">\n\ - <Alignment ss:Vertical=\"Top\" ss:Horizontal=\"Left\" ss:WrapText=\"0\"/>\n\ - <Borders>\n\ - <Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - <Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>\n\ - </Borders>\n\ - </Style>\n\ - </Styles>\n"; - -const char XMLBeginSheet[]= -" <Worksheet ss:Name=\"%s\">\n"; - -const char XMLNames[]= -" <Names>\n\ - <NamedRange ss:Name=\"_FilterDatabase\" ss:RefersTo=\"R%dC%d:R%dC%d\" ss:Hidden=\"1\"/>\n\ - </Names>\n"; - -const char XMLBeginTable[]= -" <Table ss:ExpandedColumnCount=\"%d\" ss:ExpandedRowCount=\"%d\" x:FullColumns=\"1\"\n\ - x:FullRows=\"1\">\n"; - -const char XMLColumsHorizontalTable[]= -" <Column ss:Index=\"1\" ss:Width=\"108.75\"/>\n\ - <Column ss:Index=\"%d\" ss:Width=\"77.25\" ss:Span=\"%d\"/>\n"; - -const char XMLColumsVerticalTable[]= -" <Column ss:Index=\"1\" ss:Width=\"77.25\" ss:Span=\"%d\"/>\n"; - -const char XMLNameAndTime[]= -" <Cell><Data ss:Type=\"String\">%s</Data></Cell>\n\ - <Cell><Data ss:Type=\"String\">%s</Data></Cell>\n\ - <Cell><Data ss:Type=\"String\">%s</Data></Cell>\n"; - -const char XMLTableParamAndTitle[]= -" <Cell><Data ss:Type=\"Number\">%d</Data></Cell>\n\ - <Cell><Data ss:Type=\"Number\">%d</Data></Cell>\n\ - <Cell><Data ss:Type=\"Number\">%d</Data></Cell>\n\ - <Cell><Data ss:Type=\"String\">%s</Data></Cell>\n"; - -//-------------- -const char XMLCellTopName[]= -" <Cell ss:StyleID=\"s25\"><Data ss:Type=\"String\">Name</Data></Cell>\n"; -const char XMLCellTopThread[]= -" <Cell ss:StyleID=\"s25\"><Data ss:Type=\"String\">Threads</Data></Cell>\n"; -const char XMLCellTopMode[]= -" <Cell ss:StyleID=\"s25\"><Data ss:Type=\"String\">%s</Data></Cell>\n"; -//--------------------- -const char XMLAnalysisTitle[]= -" <Cell ss:StyleID=\"s25\"><Data ss:Type=\"String\">%s</Data></Cell>\n"; - -const char XMLCellName[]= -" <Cell ss:StyleID=\"s24\"><Data ss:Type=\"String\">%s</Data></Cell>\n"; - -const char XMLCellThread[]= -" <Cell ss:StyleID=\"s24\"><Data ss:Type=\"Number\">%d</Data></Cell>\n"; - -const char XMLCellMode[]= -" <Cell ss:StyleID=\"s24\"><Data ss:Type=\"String\">%s</Data></Cell>\n"; - -const char XMLCellAnalysis[]= -" <Cell ss:StyleID=\"s26\"><Data ss:Type=\"String\">%s</Data></Cell>\n"; - -const char XMLCellFormula[]= -" <Cell ss:StyleID=\"s26\" ss:Formula=\"%s\"><Data ss:Type=\"Number\"></Data></Cell>\n"; - -const char XMLCellData[]= -" <Cell ss:StyleID=\"s23\"><Data ss:Type=\"Number\">%g</Data></Cell>\n"; - -const char XMLMergeRow[]= -" <Cell ss:StyleID=\"s23\" ss:MergeAcross=\"%d\" ><Data ss:Type=\"String\"></Data></Cell>\n"; - -const char XMLCellEmptyWhite[]= -" <Cell><Data ss:Type=\"String\">%s</Data></Cell>\n"; - -const char XMLCellEmptyTitle[]= -" <Cell ss:StyleID=\"s25\"><Data ss:Type=\"String\"></Data></Cell>\n"; - -const char XMLEndTable[]= -" </Table>\n"; - -const char XMLAutoFilter[]= -" <AutoFilter x:Range=\"R%dC%d:R%dC%d\" xmlns=\"urn:schemas-microsoft-com:office:excel\">\n\ - </AutoFilter>\n"; - -const char XMLEndWorkSheet[]= - " </Worksheet>\n"; - -const char XMLWorkSheetProperties[]= -" <WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\">\n\ - <Unsynced/>\n\ - <Selected/>\n\ - <FreezePanes/>\n\ - <FrozenNoSplit/>\n\ - <SplitHorizontal>%d</SplitHorizontal>\n\ - <TopRowBottomPane>%d</TopRowBottomPane>\n\ - <SplitVertical>%d</SplitVertical>\n\ - <LeftColumnRightPane>%d</LeftColumnRightPane>\n\ - <ActivePane>0</ActivePane>\n\ - <Panes>\n\ - <Pane>\n\ - <Number>3</Number>\n\ - </Pane>\n\ - <Pane>\n\ - <Number>1</Number>\n\ - </Pane>\n\ - <Pane>\n\ - <Number>2</Number>\n\ - </Pane>\n\ - <Pane>\n\ - <Number>0</Number>\n\ - <ActiveRow>0</ActiveRow>\n\ - <ActiveCol>%d</ActiveCol>\n\ - </Pane>\n\ - </Panes>\n\ - <ProtectObjects>False</ProtectObjects>\n\ - <ProtectScenarios>False</ProtectScenarios>\n\ - </WorksheetOptions>\n"; - -const char XMLEndWorkbook[]= - "</Workbook>\n"; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_base.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_base.cpp deleted file mode 100644 index 78cbef2e19..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_base.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/blocked_range.h" -#include "tbb/parallel_for.h" -#include "tbb/parallel_reduce.h" - - -#define NRUNS 10 -#define ONE_TEST_DURATION 0.01 - -#include "perf_util.h" - - -#define NUM_CHILD_TASKS 128 -#define NUM_ROOT_TASKS 16 - -#define N 1000000 -#define FINE_GRAIN 50 -#define MED_GRAIN 500 -#define COARSE_GRAIN 10000 - - -typedef ANCHOR_TYPE count_type; -typedef tbb::blocked_range<count_type> range_type; - -const count_type NUM_leaf_tasks = NUM_CHILD_TASKS * NUM_ROOT_TASKS; - -const count_type N_finest = (count_type)(N/log((double)N)/10); -const count_type N_fine = N_finest * 10; - - -class static_task_holder { -public: - tbb::task *my_simple_leaf_task_ptr; - - static_task_holder (); -}; - -static static_task_holder s_tasks; - - -static size_t s_num_iterations = 0; - - -class simple_leaf_task : public tbb::task -{ - task* execute () { - for ( size_t i=0; i < s_num_iterations; ++i ) - util::anchor += i; - //util::anchor += size_t(log10((double)util::anchor)*10); - return NULL; - } -}; - -class simple_root_task : public tbb::task -{ - task* execute () { - set_ref_count(NUM_leaf_tasks + 1); - for ( size_t i = 0; i < NUM_leaf_tasks; ++i ) { - simple_leaf_task &t = *new( allocate_child() ) simple_leaf_task; - spawn(t); - } - wait_for_all(); - return NULL; - } -}; - -void Work1 () { - for ( size_t i=0; i < NUM_leaf_tasks; ++i ) - s_tasks.my_simple_leaf_task_ptr->execute(); -} - -void Test1_1 () { - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - r.set_ref_count(NUM_leaf_tasks + 1); - for ( size_t i = 0; i < NUM_leaf_tasks; ++i ) { - simple_leaf_task &t = *new( r.allocate_child() ) simple_leaf_task; - r.spawn(t); - } - r.wait_for_all(); - r.destroy(r); -} - -void Test1_2 () -{ - simple_root_task &r = *new( tbb::task::allocate_root() ) simple_root_task; - tbb::task::spawn_root_and_wait(r); -} - - -class children_launcher_task : public tbb::task -{ - task* execute () { - set_ref_count(NUM_CHILD_TASKS + 1); - for ( size_t i = 0; i < NUM_CHILD_TASKS; ++i ) { - simple_leaf_task &t = *new( allocate_child() ) simple_leaf_task; - spawn(t); - } - wait_for_all(); - return NULL; - } -}; - -class root_launcher_task : public tbb::task -{ - task* execute () { - children_launcher_task &r = *new( allocate_root() ) children_launcher_task; - spawn_root_and_wait(r); - return NULL; - } -}; - -class hierarchy_root_task : public tbb::task -{ - task* execute () { - tbb::task_list tl; - for ( size_t i = 0; i < NUM_ROOT_TASKS; ++i ) { - root_launcher_task &r = *new( allocate_root() ) root_launcher_task; - tl.push_back(r); - } - spawn_root_and_wait(tl); - return NULL; - } -}; - -void Test1_3 () -{ - hierarchy_root_task &r = *new( tbb::task::allocate_root() ) hierarchy_root_task; - tbb::task::spawn_root_and_wait(r); -} - - -static size_t s_range = N, - s_grain = 1; - -class simple_pfor_body { -public: - void operator()( const range_type& r ) const { - count_type end = r.end(); - for( count_type i = r.begin(); i < end; ++i ) - util::anchor += i; - } -}; - -void Work2 () { - simple_pfor_body body; - range_type range(0, s_range, s_grain); - body(range); -} - -void Test2 () { - tbb::parallel_for( range_type(0, s_range, s_grain), simple_pfor_body() ); -} - -void Test2_0 () { - volatile count_type zero = 0; - tbb::parallel_for( range_type(0, zero, 1), simple_pfor_body() ); -} - - -class simple_preduce_body { -public: - count_type my_sum; - simple_preduce_body () : my_sum(0) {} - simple_preduce_body ( simple_preduce_body&, tbb::split ) : my_sum(0) {} - void join( simple_preduce_body& rhs ) { my_sum += rhs.my_sum;} - void operator()( const range_type& r ) { - count_type end = r.end(); - for( count_type i = r.begin(); i < end; ++i ) - util::anchor += i; - my_sum = util::anchor; - } -}; - -void Work3 () { - simple_preduce_body body; - range_type range(0, s_range, s_grain); - body(range); -} - -void Test3 () { - simple_preduce_body body; - tbb::parallel_reduce( range_type(0, s_range, s_grain), body ); -} - -void Test3_0 () { - volatile count_type zero = 0; - simple_preduce_body body; - tbb::parallel_reduce( range_type(0, zero, 1), body ); -} - - -static_task_holder::static_task_holder () { - static simple_leaf_task s_t1; - my_simple_leaf_task_ptr = &s_t1; -} - -void Test () { - const size_t num_task_tree_workloads = 4; - size_t task_tree_workloads[num_task_tree_workloads] = {0, 50, 500, 10000}; - for (size_t i = 0; i < num_task_tree_workloads; ++i ) { - size_t n = task_tree_workloads[i]; - s_num_iterations = n; - CalcSequentialTime(Work1); - RunTest ("Bunch of leaves: %d adds/task", n, Test1_1); - RunTest ("Simple task tree: %d adds/task", n, Test1_2); - RunTest ("Complex task tree: %d adds/task", n, Test1_3); - } - - // Using N_fine constant in the body of this function results in incorrect code - // generation by icl 10.1.014 - const size_t num_alg_workloads = 4; - size_t alg_ranges[num_alg_workloads] = {N_fine/10, N_fine, N, N}; - size_t alg_grains[num_alg_workloads] = {1, FINE_GRAIN, MED_GRAIN, COARSE_GRAIN}; - - //RunTest ("Empty pfor", 0, Test2_0); - for (size_t i = 0; i < num_alg_workloads; ++i ) { - s_range = alg_ranges[i]; - s_grain = alg_grains[i]; - CalcSequentialTime(Work2); - RunTest ("pfor: %d adds/body", s_grain, Test2); - } - - //RunTest ("Empty preduce", Test3_0); - for (size_t i = 0; i < num_alg_workloads; ++i ) { - s_range = alg_ranges[i]; - s_grain = alg_grains[i]; - CalcSequentialTime(Work3); - RunTest ("preduce: %d adds/body", s_grain, Test3); - } -} - -int main( int argc, char* argv[] ) { - test_main(argc, argv); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_framework.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_framework.h deleted file mode 100644 index 6a149b694e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_framework.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TIME_FRAMEWORK_H__ -#define __TIME_FRAMEWORK_H__ - -#include <cstdlib> -#include <math.h> -#include <vector> -#include <string> -#include <sstream> -#include "tbb/tbb_stddef.h" -#include "tbb/task_scheduler_init.h" -#include "tbb/tick_count.h" -#include "../test/harness.h" -#include "../test/harness_barrier.h" -#define STATISTICS_INLINE -#include "statistics.h" - -#ifndef ARG_TYPE -typedef intptr_t arg_t; -#else -typedef ARG_TYPE arg_t; -#endif - -class Timer { - tbb::tick_count tick; -public: - Timer() { tick = tbb::tick_count::now(); } - double get_time() { return (tbb::tick_count::now() - tick).seconds(); } - double diff_time(const Timer &newer) { return (newer.tick - tick).seconds(); } - double mark_time() { tbb::tick_count t1(tbb::tick_count::now()), t2(tick); tick = t1; return (t1 - t2).seconds(); } - double mark_time(const Timer &newer) { tbb::tick_count t(tick); tick = newer.tick; return (tick - t).seconds(); } -}; - -class TesterBase /*: public tbb::internal::no_copy*/ { -protected: - friend class TestProcessor; - friend class TestRunner; - - //! it is barrier for synchronizing between threads - Harness::SpinBarrier *barrier; - - //! number of tests per this tester - const int tests_count; - - //! number of threads to operate - int threads_count; - - //! some value for tester - arg_t value; - - // avoid false sharing - char pad[128 - sizeof(arg_t) - sizeof(int)*2 - sizeof(void*) ]; - -public: - //! init tester base. @arg ntests is number of embeded tests in this tester. - TesterBase(int ntests) - : barrier(NULL), tests_count(ntests) - {} - virtual ~TesterBase() {} - - //! internal function - void base_init(arg_t v, int t, Harness::SpinBarrier &b) { - threads_count = t; - barrier = &b; - value = v; - init(); - } - - //! optionally override to init after value and threads count were set. - virtual void init() { } - - //! Override to provide your names - virtual std::string get_name(int testn) { - return Format("test %d", testn); - } - - //! Override to provide main test's entry function returns a value to record - virtual value_t test(int testn, int threadn) = 0; - - //! Type of aggregation from results of threads - enum result_t { - SUM, AVG, MIN, MAX - }; - - //! Override to change result type for the test. Return postfix for test name or 0 if result type is not needed. - virtual const char *get_result_type(int /*testn*/, result_t type) const { - return type == AVG ? "" : 0; // only average result by default - } -}; - -/***** -a user's tester concept: - -class tester: public TesterBase { -public: - //! init tester with known amount of work - tester() : TesterBase(<user-specified tests count>) { ... } - - //! run a test with sequental number @arg test_number for @arg thread. - / *override* / value_t test(int test_number, int thread); -}; - -******/ - -template<typename Tester, int scale = 1> -class TimeTest : public Tester { - /*override*/ value_t test(int testn, int threadn) { - Timer timer; - Tester::test(testn, threadn); - return timer.get_time() * double(scale); - } -}; - -template<typename Tester> -class NanosecPerValue : public Tester { - /*override*/ value_t test(int testn, int threadn) { - Timer timer; - Tester::test(testn, threadn); - // return time (ns) per value - return timer.get_time()*1000000.0/double(Tester::value); - } -}; - -// operate with single tester -class TestRunner { - friend class TestProcessor; - friend struct RunArgsBody; - TestRunner(const TestRunner &); // don't copy - - const char *tester_name; - StatisticsCollector *stat; - std::vector<std::vector<StatisticsCollector::TestCase> > keys; - -public: - TesterBase &tester; - - template<typename Test> - TestRunner(const char *name, Test *test) - : tester_name(name), tester(*static_cast<TesterBase*>(test)) - {} - - ~TestRunner() { delete &tester; } - - void init(arg_t value, int threads, Harness::SpinBarrier &barrier, StatisticsCollector *s) { - tester.base_init(value, threads, barrier); - stat = s; - keys.resize(tester.tests_count); - for(int testn = 0; testn < tester.tests_count; testn++) { - keys[testn].resize(threads); - std::string test_name(tester.get_name(testn)); - for(int threadn = 0; threadn < threads; threadn++) - keys[testn][threadn] = stat->SetTestCase(tester_name, test_name.c_str(), threadn); - } - } - - void run_test(int threadn) { - for(int testn = 0; testn < tester.tests_count; testn++) { - tester.barrier->wait(); // <<<<<<<<<<<<<<<<< Barrier before running test mode - value_t result = tester.test(testn, threadn); - stat->AddRoundResult(keys[testn][threadn], result); - } - } - - void post_process(StatisticsCollector &report) { - const int threads = tester.threads_count; - for(int testn = 0; testn < tester.tests_count; testn++) { - size_t coln = keys[testn][0].getResults().size()-1; - value_t rsum = keys[testn][0].getResults()[coln]; - value_t rmin = rsum, rmax = rsum; - for(int threadn = 1; threadn < threads; threadn++) { - value_t result = keys[testn][threadn].getResults()[coln]; - rsum += result; // for both SUM or AVG - if(rmin > result) rmin = result; - if(rmax < result) rmax = result; - } - std::string test_name(tester.get_name(testn)); - const char *rname = tester.get_result_type(testn, TesterBase::SUM); - if( rname ) { - report.SetTestCase(tester_name, (test_name+rname).c_str(), threads); - report.AddRoundResult(rsum); - } - rname = tester.get_result_type(testn, TesterBase::MIN); - if( rname ) { - report.SetTestCase(tester_name, (test_name+rname).c_str(), threads); - report.AddRoundResult(rmin); - } - rname = tester.get_result_type(testn, TesterBase::AVG); - if( rname ) { - report.SetTestCase(tester_name, (test_name+rname).c_str(), threads); - report.AddRoundResult(rsum / threads); - } - rname = tester.get_result_type(testn, TesterBase::MAX); - if( rname ) { - report.SetTestCase(tester_name, (test_name+rname).c_str(), threads); - report.AddRoundResult(rmax); - } - } - } -}; - -struct RunArgsBody { - const vector<TestRunner*> &run_list; - RunArgsBody(const vector<TestRunner*> &a) : run_list(a) { } -#ifndef __TBB_parallel_for_H - void operator()(int thread) const { -#else - void operator()(const tbb::blocked_range<int> &r) const { - ASSERT( r.begin() + 1 == r.end(), 0); - int thread = r.begin(); -#endif - for(size_t i = 0; i < run_list.size(); i++) - run_list[i]->run_test(thread); - } -}; - -//! Main test processor. -/** Override or use like this: - class MyTestCollection : public TestProcessor { - void factory(arg_t value, int threads) { - process( value, threads, - run("my1", new tester<my1>() ), - run("my2", new tester<my2>() ), - end ); - if(value == threads) - stat->Print(); - } -}; -*/ - -class TestProcessor { - friend class TesterBase; - - // <threads, collector> - typedef std::map<int, StatisticsCollector *> statistics_collection; - statistics_collection stat_by_threads; - -protected: - // Members - const char *collection_name; - // current stat - StatisticsCollector *stat; - // token - size_t end; - -public: - StatisticsCollector report; - - // token of tests list - template<typename Test> - TestRunner *run(const char *name, Test *test) { - return new TestRunner(name, test); - } - - // iteration processing - void process(arg_t value, int threads, ...) { - // prepare items - stat = stat_by_threads[threads]; - if(!stat) { - stat_by_threads[threads] = stat = new StatisticsCollector((collection_name + Format("@%d", threads)).c_str(), StatisticsCollector::ByAlg); - stat->SetTitle("Detailed log of %s running with %d threads.", collection_name, threads); - } - Harness::SpinBarrier barrier(threads); - // init args - va_list args; va_start(args, threads); - vector<TestRunner*> run_list; run_list.reserve(16); - while(true) { - TestRunner *item = va_arg(args, TestRunner*); - if( !item ) break; - item->init(value, threads, barrier, stat); - run_list.push_back(item); - } - va_end(args); - std::ostringstream buf; - buf << value; - const size_t round_number = stat->GetRoundsCount(); - stat->SetRoundTitle(round_number, buf.str().c_str()); - report.SetRoundTitle(round_number, buf.str().c_str()); - // run them -#ifndef __TBB_parallel_for_H - NativeParallelFor(threads, RunArgsBody(run_list)); -#else - tbb::parallel_for(tbb::blocked_range<int>(0,threads,1), RunArgsBody(run_list)); -#endif - // destroy args - for(size_t i = 0; i < run_list.size(); i++) { - run_list[i]->post_process(report); - delete run_list[i]; - } - } - -public: - TestProcessor(const char *name, StatisticsCollector::Sorting sort_by = StatisticsCollector::ByAlg) - : collection_name(name), stat(NULL), end(0), report(collection_name, sort_by) - { } - - ~TestProcessor() { - for(statistics_collection::iterator i = stat_by_threads.begin(); i != stat_by_threads.end(); i++) - delete i->second; - } -}; - -#endif// __TIME_FRAMEWORK_H__ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_hash_map.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_hash_map.cpp deleted file mode 100644 index df48e89760..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_hash_map.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// configuration: - -//! enable/disable std::map tests -#define STDTABLE 1 - -//! enable/disable old implementation tests (correct include file also) -#define OLDTABLE 0 -#define OLDTABLEHEADER "tbb/concurrent_hash_map-4078.h"//-4329 - -//! enable/disable experimental implementation tests (correct include file also) - -#define TESTTABLE 0 -#define TESTTABLEHEADER "tbb/concurrent_unordered_map.h" - -////////////////////////////////////////////////////////////////////////////////// - -#include <cstdlib> -#include <math.h> -#include "tbb/tbb_stddef.h" -#include <vector> -#include <map> -// needed by hash_maps -#include <stdexcept> -#include <iterator> -#include <algorithm> // std::swap -#include <utility> // Need std::pair from here -#include "tbb/cache_aligned_allocator.h" -#include "tbb/tbb_allocator.h" -#include "tbb/spin_rw_mutex.h" -#include "tbb/aligned_space.h" -#include "tbb/atomic.h" -#include "../tbb/tbb_misc.h" // tbb::internal::ExponentialBackoff -// for test -#include "tbb/spin_mutex.h" -#include "time_framework.h" - - -using namespace tbb; -using namespace tbb::internal; - -struct IntHashCompare { - size_t operator() ( int x ) const { return x; } - bool operator() ( int x, int y ) const { return x==y; } - static long hash( int x ) { return x; } - bool equal( int x, int y ) const { return x==y; } -}; - -namespace version_current { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } - #include "tbb/concurrent_hash_map.h" -} -typedef version_current::tbb::concurrent_hash_map<int,int,IntHashCompare> IntTable; - -#if OLDTABLE -#undef __TBB_concurrent_hash_map_H -namespace version_base { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } - #include OLDTABLEHEADER -} -typedef version_base::tbb::concurrent_hash_map<int,int,IntHashCompare> OldTable; -#endif - -#if TESTTABLE -#undef __TBB_concurrent_hash_map_H -namespace version_new { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } - #include TESTTABLEHEADER -} -typedef version_new::tbb::concurrent_unordered_map<int,int,IntHashCompare,IntHashCompare> TestTable; -#define TESTTABLE 1 -#endif - -/////////////////////////////////////// - -static const char *map_testnames[] = { - "1.insert", "2.count(w/rehash)", "3.find/wr", "4.erase" -}; - -template<typename TableType> -struct TestTBBMap : TesterBase { - typedef typename TableType::accessor accessor; - typedef typename TableType::const_accessor const_accessor; - TableType Table; - int n_items; - - TestTBBMap() : TesterBase(4) {} - void init() { n_items = value/threads_count; } - - std::string get_name(int testn) { - return std::string(map_testnames[testn]); - } - - double test(int test, int t) - { - switch(test) { - case 0: // fill - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - accessor a; - Table.insert( a, i ); - a->second = 0; - } - break; - case 1: // work1 - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - size_t c = Table.count( i ); - ASSERT( c == 1, NULL); - } - break; - case 2: // work2 - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - accessor a; - Table.find( a, i ); - ASSERT( !a->second, "A key should be incremented only once"); - a->second += 1; - } - break; - case 3: // clean - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - ASSERT( Table.erase( i ), NULL); - } - } - return 0; - } -}; - -template<typename M> -struct TestSTLMap : TesterBase { - std::map<int, int> Table; - M mutex; - - int n_items; - TestSTLMap() : TesterBase(4) {} - void init() { n_items = value/threads_count; } - - std::string get_name(int testn) { - return std::string(map_testnames[testn]); - } - - double test(int test, int t) - { - switch(test) { - case 0: // fill - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - typename M::scoped_lock with(mutex); - Table[i] = 0; - } - break; - case 1: // work1 - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - typename M::scoped_lock with(mutex); - size_t c = Table.count(i); - ASSERT( c == 1, NULL); - } - break; - case 2: // work2 - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - typename M::scoped_lock with(mutex); - Table[i] += 1; - } - break; - case 3: // clean - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - typename M::scoped_lock with(mutex); - Table.erase(i); - } - } - return 0; - } -}; - -class fake_mutex { - int a; -public: - class scoped_lock { - fake_mutex *p; - - public: - scoped_lock() {} - scoped_lock( fake_mutex &m ) { p = &m; } - ~scoped_lock() { p->a = 0; } - void acquire( fake_mutex &m ) { p = &m; } - void release() { } - }; -}; - -class test_hash_map : public TestProcessor { -public: - test_hash_map() : TestProcessor("test_hash_map") {} - void factory(int value, int threads) { - if(Verbose) printf("Processing with %d threads: %d...\n", threads, value); - process( value, threads, -#if STDTABLE - run("std::map ", new NanosecPerValue<TestSTLMap<spin_mutex> >() ), -#endif -#if OLDTABLE - run("old::hmap", new NanosecPerValue<TestTBBMap<OldTable> >() ), -#endif - run("tbb::hmap", new NanosecPerValue<TestTBBMap<IntTable> >() ), -#if TESTTABLE - run("new::hmap", new NanosecPerValue<TestTBBMap<TestTable> >() ), -#endif - end ); - //stat->Print(StatisticsCollector::Stdout); - if(value >= 2097152) stat->Print(StatisticsCollector::HTMLFile); - } -}; - -///////////////////////////////////////////////////////////////////////////////////////// -template<typename TableType> -struct TestHashMapFind : TesterBase { - typedef typename TableType::accessor accessor; - typedef typename TableType::const_accessor const_accessor; - TableType Table; - int n_items; - - std::string get_name(int testn) { - return std::string(!testn?"find":"insert"); - } - - TestHashMapFind() : TesterBase(2) {} - void init() { - n_items = value/threads_count; - for(int i = 0; i < value; i++) { - accessor a; Table.insert( a, i ); - } - } - - double test(int test, int t) - { - switch(test) { - case 0: // find - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - accessor a; - Table.find( a, i ); - a->second = i; - } - break; - case 1: // insert - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - accessor a; - Table.insert( a, i ); - a->second = -i; - } - break; - } - return 0; - } -}; - -const int test2_size = 65536; -int Data[test2_size]; - -template<typename TableType> -struct TestHashCountStrings : TesterBase { - typedef typename TableType::accessor accessor; - typedef typename TableType::const_accessor const_accessor; - TableType Table; - int n_items; - - std::string get_name(int testn) { - return !testn?"insert":"find"; - } - - TestHashCountStrings() : TesterBase(2) {} - void init() { - n_items = value/threads_count; - } - - double test(int testn, int t) - { - if(!testn) { - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - accessor a; Table.insert( a, Data[i] ); - } - } else { // - for(int i = t*n_items, e = (t+1)*n_items; i < e; i++) { - accessor a; Table.find( a, Data[i] ); - } - } - return 0; - } -}; - -class test_hash_map_find : public TestProcessor { -public: - test_hash_map_find() : TestProcessor("test_hash_map_find") {} - void factory(int value, int threads) { - if(Verbose) printf("Processing with %d threads: %d...\n", threads, value); - process( value, threads, -#if OLDTABLE - run("Filled old::hashmap", new NanosecPerValue<TestHashMapFind<OldTable> >() ), -#endif - run("Filled tbb::hashmap", new NanosecPerValue<TestHashMapFind<IntTable> >() ), -#if TESTTABLE - run("Filled new::hashmap", new NanosecPerValue<TestHashMapFind<TestTable> >() ), -#endif -#if OLDTABLE - run("CountStr old::hashmap", new TimeTest<TestHashCountStrings<OldTable> >() ), -#endif - run("CountStr tbb::hashmap", new TimeTest<TestHashCountStrings<IntTable> >() ), -#if TESTTABLE - run("CountStr new::hashmap", new TimeTest<TestHashCountStrings<TestTable> >() ), -#endif - end ); - //stat->Print(StatisticsCollector::HTMLFile); - } -}; - -///////////////////////////////////////////////////////////////////////////////////////// - -int main(int argc, char* argv[]) { - if(argc>1) Verbose = true; - //if(argc>2) ExtraVerbose = true; - MinThread = 1; MaxThread = task_scheduler_init::default_num_threads(); - ParseCommandLine( argc, argv ); - - ASSERT(tbb_allocator<int>::allocator_type() == tbb_allocator<int>::scalable, "expecting scalable allocator library to be loaded. Please build it by:\n\t\tmake tbbmalloc"); - - { - test_hash_map_find test_find; int o = test2_size; - for(int i = 0; i < o; i++) - Data[i] = i%60; - for( int t=MinThread; t <= MaxThread; t++) - test_find.factory(o, t); - test_find.report.SetTitle("Nanoseconds per operation of finding operation (Mode) for %d items", o); - test_find.report.Print(StatisticsCollector::HTMLFile|StatisticsCollector::ExcelXML); - } - { - test_hash_map the_test; - for( int t=MinThread; t <= MaxThread; t*=2) - for( int o=/*2048*/(1<<8)*8; o<2200000; o*=2 ) - the_test.factory(o, t); - the_test.report.SetTitle("Nanoseconds per operation of (Mode) for N items in container (Name)"); - the_test.report.SetStatisticFormula("1AVG per size", "=AVERAGE(ROUNDS)"); - the_test.report.Print(StatisticsCollector::HTMLFile|StatisticsCollector::ExcelXML); - } - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_locked_work.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_locked_work.cpp deleted file mode 100644 index 62b9f38a6c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_locked_work.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -////// Test configuration //////////////////////////////////////////////////// -#define SECONDS_RATIO 1000000 // microseconds - -#ifndef REPEAT_K -#define REPEAT_K 50 // repeat coefficient -#endif - -int outer_work[] = {/*256,*/ 64, 16, 4, 0}; -int inner_work[] = {32, 8, 0 }; - -// keep it to calibrate the time of work without synchronization -#define BOX1 "baseline" -#define BOX1TEST TimeTest< TBB_Mutex<tbb::null_mutex>, SECONDS_RATIO > - -// enable/disable tests for: -#define BOX2 "spin_mutex" -#define BOX2TEST TimeTest< TBB_Mutex<tbb::spin_mutex>, SECONDS_RATIO > - -// enable/disable tests for: -#define BOX3 "spin_rw_mutex" -#define BOX3TEST TimeTest< TBB_Mutex<tbb::spin_rw_mutex>, SECONDS_RATIO > - -// enable/disable tests for: -#define BOX4 "queuing_mutex" -#define BOX4TEST TimeTest< TBB_Mutex<tbb::queuing_mutex>, SECONDS_RATIO > - -// enable/disable tests for: -//#define BOX5 "queuing_rw_mutex" -#define BOX5TEST TimeTest< TBB_Mutex<tbb::queuing_rw_mutex>, SECONDS_RATIO > - -////////////////////////////////////////////////////////////////////////////// - -#include <cstdlib> -#include <math.h> -#include <algorithm> // std::swap -#include <utility> // Need std::pair from here -#include <sstream> -#include "tbb/tbb_stddef.h" -#include "tbb/null_mutex.h" -#include "tbb/spin_rw_mutex.h" -#include "tbb/spin_mutex.h" -#include "tbb/queuing_mutex.h" -#include "tbb/queuing_rw_mutex.h" -#include "tbb/mutex.h" - -#if INTEL_TRIAL==2 -#include "tbb/parallel_for.h" // enable threading by TBB scheduler -#include "tbb/task_scheduler_init.h" -#include "tbb/blocked_range.h" -#endif -// for test -#include "time_framework.h" - -using namespace tbb; -using namespace tbb::internal; - -///////////////////////////////////////////////////////////////////////////////////////// - -//! base class for tests family -struct TestLocks : TesterBase { - // Inherits "value", "threads_count", and other variables - TestLocks() : TesterBase(/*number of modes*/sizeof(outer_work)/sizeof(int)) {} - //! returns name of test part/mode - /*override*/std::string get_name(int testn) { - std::ostringstream buf; - buf.width(4); buf.fill('0'); - buf << outer_work[testn]; // mode number - return buf.str(); - } - //! enables results types and returns theirs suffixes - /*override*/const char *get_result_type(int, result_t type) const { - switch(type) { - case MIN: return " min"; - case MAX: return " max"; - default: return 0; - } - } - //! repeats count - int repeat_until(int /*test_n*/) const { - return REPEAT_K*100;//TODO: suggest better? - } - //! fake work - void do_work(int work) volatile { - for(int i = 0; i < work; i++) { - volatile int x = i; - __TBB_Pause(0); // just to call inline assembler - x *= work/threads_count; - } - } -}; - -//! template test unit for any of TBB mutexes -template<typename M> -struct TBB_Mutex : TestLocks { - M mutex; - - double test(int testn, int /*threadn*/) - { - for(int r = 0; r < repeat_until(testn); ++r) { - do_work(outer_work[testn]); - { - typename M::scoped_lock with(mutex); - do_work(/*inner work*/value); - } - } - return 0; - } -}; - -///////////////////////////////////////////////////////////////////////////////////////// - -//Using BOX declarations -#include "time_sandbox.h" - -// run tests for each of inner work value -void RunLoops(test_sandbox &the_test, int thread) { - for( unsigned i=0; i<sizeof(inner_work)/sizeof(int); ++i ) - the_test.factory(inner_work[i], thread); -} - -int main(int argc, char* argv[]) { - if(argc>1) Verbose = true; - int DefThread = task_scheduler_init::default_num_threads(); - MinThread = 1; MaxThread = DefThread+1; - ParseCommandLine( argc, argv ); - ASSERT(MinThread <= MaxThread, 0); -#if INTEL_TRIAL && defined(__TBB_parallel_for_H) - task_scheduler_init me(MaxThread); -#endif - { - test_sandbox the_test("time_locked_work", StatisticsCollector::ByThreads); - //TODO: refactor this out as RunThreads(test&) - for( int t = MinThread; t < DefThread && t <= MaxThread; t *= 2) - RunLoops( the_test, t ); // execute undersubscribed threads - if( DefThread > MinThread && DefThread <= MaxThread ) - RunLoops( the_test, DefThread ); // execute on all hw threads - if( DefThread < MaxThread) - RunLoops( the_test, MaxThread ); // execute requested oversubscribed threads - - the_test.report.SetTitle("Time of lock/unlock for mutex Name with Outer and Inner work"); - //the_test.report.SetStatisticFormula("1AVG per size", "=AVERAGE(ROUNDS)"); - the_test.report.Print(StatisticsCollector::HTMLFile|StatisticsCollector::ExcelXML, /*ModeName*/ "Outer work"); - } - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_sandbox.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_sandbox.h deleted file mode 100644 index 158ebe7462..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_sandbox.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TIME_FRAMEWORK_H__ -#error time_framework.h must be included -#endif - -#ifdef BOX1 -namespace sandbox1 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX1HEADER -# include BOX1HEADER -# endif - typedef ::BOX1TEST testbox; -} -#endif -#ifdef BOX2 -namespace sandbox2 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX2HEADER -# include BOX2HEADER -# endif - typedef ::BOX2TEST testbox; -} -#endif -#ifdef BOX3 -namespace sandbox3 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX3HEADER -# include BOX3HEADER -# endif - typedef ::BOX3TEST testbox; -} -#endif -#ifdef BOX4 -namespace sandbox4 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX4HEADER -# include BOX4HEADER -# endif - typedef ::BOX4TEST testbox; -} -#endif -#ifdef BOX5 -namespace sandbox5 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX5HEADER -# include BOX5HEADER -# endif - typedef ::BOX5TEST testbox; -} -#endif -#ifdef BOX6 -namespace sandbox6 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX6HEADER -# include BOX6HEADER -# endif - typedef ::BOX6TEST testbox; -} -#endif -#ifdef BOX7 -namespace sandbox7 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX7HEADER -# include BOX7HEADER -# endif - typedef ::BOX7TEST testbox; -} -#endif -#ifdef BOX8 -namespace sandbox8 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX8HEADER -# include BOX8HEADER -# endif - typedef ::BOX8TEST testbox; -} -#endif -#ifdef BOX9 -namespace sandbox9 { - namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } } -# ifdef BOX9HEADER -# include BOX9HEADER -# endif - typedef ::BOX9TEST testbox; -} -#endif - -//if harness.h included -#if defined(ASSERT) && !HARNESS_NO_PARSE_COMMAND_LINE -#ifndef TEST_PREFIX -#define TEST_PREFIX if(Verbose) printf("Processing with %d threads: %ld...\n", threads, value); -#endif -#endif//harness included - -#ifndef TEST_PROCESSOR_NAME -#define TEST_PROCESSOR_NAME test_sandbox -#endif - -class TEST_PROCESSOR_NAME : public TestProcessor { -public: - TEST_PROCESSOR_NAME(const char *name, StatisticsCollector::Sorting sort_by = StatisticsCollector::ByAlg) - : TestProcessor(name, sort_by) {} - void factory(arg_t value, int threads) { -#ifdef TEST_PREFIX - TEST_PREFIX -#endif - process( value, threads, -#define RUNBOX(n) run(#n"."BOX##n, new sandbox##n::testbox() ) -#ifdef BOX1 - RUNBOX(1), -#endif -#ifdef BOX2 - RUNBOX(2), -#endif -#ifdef BOX3 - RUNBOX(3), -#endif -#ifdef BOX4 - RUNBOX(4), -#endif -#ifdef BOX5 - RUNBOX(5), -#endif -#ifdef BOX6 - RUNBOX(6), -#endif -#ifdef BOX7 - RUNBOX(7), -#endif -#ifdef BOX8 - RUNBOX(8), -#endif -#ifdef BOX9 - RUNBOX(9), -#endif - end ); -#ifdef TEST_POSTFIX - TEST_POSTFIX -#endif - } -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_unit.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_unit.cpp deleted file mode 100644 index 8d8162dc42..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_unit.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/task_scheduler_init.h" -#include "tbb/tick_count.h" -#include <cmath> -#include <cstdlib> -#include <cerrno> -#include <cfloat> -#include <vector> -#include <algorithm> - -#include "../src/test/harness.h" - -#if __linux__ || __APPLE__ || __FreeBSD__ - #include <sys/resource.h> -#endif /* __APPLE__ */ - -// The code, performance of which is to be measured, is surrounded by the StartSimpleTiming -// and StopSimpleTiming macros. It is called "target code" or "code of interest" hereafter. -// -// The target code is executed inside the nested loop. Nesting is necessary to allow -// measurements on arrays that fit cache of a particular level, while making the load -// big enough to eliminate the influence of random deviations. -// -// Macro StartSimpleTiming defines reduction variable "util::anchor", which may be modified (usually -// by adding to) by the target code. This can be necessary to prevent optimizing compilers -// from throwing out the code of interest. Besides, if the target code is complex enough, -// make sure that all its branches contribute (directly or indirectly) to the value -// being added to the "util::anchor" variable. -// -// To factor out overhead introduced by the measurement infra code it is recommended to make -// a calibration run with target code replaced by a no-op (but still modifying "sum"), and -// store the resulting time in the "util::base" variable. -// -// A generally good approach is to make the target code use elements of a preliminary -// initialized array. Then for calibration run you just need to add vector elements -// to the "sum" variable. To get rid of memory access delays make the array small -// enough to fit L2 or L1 cache (play with StartSimpleTiming arguments if necessary). -// -// Macro CalibrateSimpleTiming performs default calibration using "util::anchor += i;" operation. -// -// Macro ANCHOR_TYPE defines the type of the reduction variable. If it was not -// defined before including this header, it is defined as size_t. Depending on -// the target code modern super scalar architectures may blend reduction operation -// and instructions of interest differently for different target alternatives. So -// you may play with the type to minimize out-of-order and parallel execution impact -// on the calibration time veracity. You may even end up with different reduction -// variable types (and different calibration times) for different measurements. - - -namespace util { - -typedef std::vector<double> durations_t; - - void trace_histogram ( const durations_t& t, char* histogramFileName ) - { - FILE* f = histogramFileName ? fopen(histogramFileName, "wt") : stdout; - size_t n = t.size(); - const size_t num_buckets = 100; - double min_val = *std::min_element(t.begin(), t.end()), - max_val = *std::max_element(t.begin(), t.end()), - bucket_size = (max_val - min_val) / num_buckets; - std::vector<size_t> hist(num_buckets + 1, 0); - for ( size_t i = 0; i < n; ++i ) - ++hist[size_t((t[i]-min_val)/bucket_size)]; - fprintf (f, "Histogram: nvals = %u, min = %g, max = %g, nbuckets = %u\n", (unsigned)n, min_val, max_val, (unsigned)num_buckets); - double bucket = min_val; - for ( size_t i = 0; i <= num_buckets; ++i, bucket+=bucket_size ) - fprintf (f, "%12g\t%u\n", bucket, (unsigned)hist[i]); - fclose(f); - } - - double average ( const durations_t& d, double& variation_percent, double& std_dev_percent ) - { - durations_t t = d; - if ( t.size() > 5 ) { - t.erase(std::min_element(t.begin(), t.end())); - t.erase(std::max_element(t.begin(), t.end())); - } - size_t n = t.size(); - double sum = 0, - min_val = *std::min_element(t.begin(), t.end()), - max_val = *std::max_element(t.begin(), t.end()); - for ( size_t i = 0; i < n; ++i ) - sum += t[i]; - double avg = sum / n, - std_dev = 0; - for ( size_t i = 0; i < n; ++i ) { - double dev = fabs(t[i] - avg); - std_dev += dev * dev; - } - std_dev = sqrt(std_dev / n); - std_dev_percent = std_dev / avg * 100; - variation_percent = 100 * (max_val - min_val) / avg; - return avg; - } - - static int num_threads; - - static double base = 0, - base_dev = 0, - base_dev_percent = 0; - - static char *empty_fmt = ""; - static int rate_field_len = 11; - -#if !defined(ANCHOR_TYPE) - #define ANCHOR_TYPE size_t -#endif - - static ANCHOR_TYPE anchor = 0; - - static double sequential_time = 0; - - -#define StartSimpleTiming(nOuter, nInner) { \ - tbb::tick_count t1, t0 = tbb::tick_count::now(); \ - for ( size_t j = 0; l < nOuter; ++l ) { \ - for ( size_t i = 0; i < nInner; ++i ) { - -#define StopSimpleTiming(res) \ - } \ - util::anchor += (ANCHOR_TYPE)l; \ - } \ - t1 = tbb::tick_count::now(); \ - printf (util::empty_fmt, util::anchor); \ - res = (t1-t0).seconds() - util::base; \ -} - -#define CalibrateSimpleTiming(T, nOuter, nInner) \ - StartSimpleTiming(nOuter, nInner); \ - util::anchor += (ANCHOR_TYPE)i; \ - StopSimpleTiming(util::base); - - -#define StartTimingImpl(nRuns, nOuter, nInner) \ - tbb::tick_count t1, t0; \ - for ( size_t k = 0; k < nRuns; ++k ) { \ - t0 = tbb::tick_count::now(); \ - for ( size_t l = 0; l < nOuter; ++l ) { \ - for ( size_t i = 0; i < nInner; ++i ) { - -#define StartTiming(nRuns, nOuter, nInner) { \ - util::durations_t t_(nRuns); \ - StartTimingImpl(nRuns, nOuter, nInner) - -#define StartTimingEx(vDurations, nRuns, nOuter, nInner) { \ - util::durations_t &t_ = vDurations; \ - vDurations.resize(nRuns); \ - StartTimingImpl(nRuns, nOuter, nInner) - -#define StopTiming(Avg, StdDev, StdDevPercent) \ - } \ - util::anchor += (ANCHOR_TYPE)l; \ - } \ - t1 = tbb::tick_count::now(); \ - t_[k] = (t1 - t0).seconds()/nrep; \ - } \ - printf (util::empty_fmt, util::anchor); \ - Avg = util::average(t_, StdDev, StdDevPercent); \ -} - -#define CalibrateTiming(nRuns, nOuter, nInner) \ - StartTiming(nRuns, nOuter, nInner); \ - util::anchor += (ANCHOR_TYPE)i; \ - StopTiming(util::base, util::base_dev, util::base_dev_percent); - -} // namespace util - - -#ifndef NRUNS - #define NRUNS 7 -#endif - -#ifndef ONE_TEST_DURATION - #define ONE_TEST_DURATION 0.01 -#endif - -#define no_histogram ((char*)-1) - -inline -double RunTestImpl ( const char* title, void (*pfn)(), char* histogramFileName = no_histogram ) { - double time = 0, variation = 0, deviation = 0; - size_t nrep = 1; - while (true) { - CalibrateTiming(NRUNS, 1, nrep); - StartTiming(NRUNS, 1, nrep); - pfn(); - StopTiming(time, variation, deviation); - time -= util::base; - if ( time > 1e-6 ) - break; - nrep *= 2; - } - nrep *= (size_t)ceil(ONE_TEST_DURATION/time); - CalibrateTiming(NRUNS, 1, nrep); // sets util::base - util::durations_t t; - StartTimingEx(t, NRUNS, 1, nrep); - pfn(); - StopTiming(time, variation, deviation); - if ( histogramFileName != (char*)-1 ) - util::trace_histogram(t, histogramFileName); - double clean_time = time - util::base; - if ( title ) { - // Deviation (in percent) is calulated for the Gross time - printf ("\n%-34s %.2e %5.1f ", title, clean_time, deviation); - if ( util::sequential_time != 0 ) - //printf ("% .2e ", clean_time - util::sequential_time); - printf ("% 10.1f ", 100*(clean_time - util::sequential_time)/util::sequential_time); - else - printf ("%*s ", util::rate_field_len, ""); - printf ("%-9u %1.6f |", (unsigned)nrep, time * nrep); - } - return clean_time; -} - - -/// Runs the test function, does statistical processing, and, if title is nonzero, prints results. -/** If histogramFileName is a string, the histogram of individual runs is generated and stored - in a file with the given name. If it is NULL then the histogram is printed on the console. - By default no histogram is generated. - The histogram format is: "rate bucket start" "number of tests in this bucket". **/ -inline -void RunTest ( const char* title_fmt, size_t workload_param, void (*pfn_test)(), char* histogramFileName = no_histogram ) { - char title[1024]; - sprintf(title, title_fmt, (long)workload_param); - RunTestImpl(title, pfn_test, histogramFileName); -} - -inline -void CalcSequentialTime ( void (*pfn)() ) { - util::sequential_time = RunTestImpl(NULL, pfn) / util::num_threads; -} - -inline -void ResetSequentialTime () { - util::sequential_time = 0; -} - - -inline void PrintTitle() { - //printf ("%-32s %-*s Std Dev,%% %-*s Repeats Gross time Infra time | NRUNS = %u", - // "Test name", util::rate_field_len, "Rate", util::rate_field_len, "Overhead", NRUNS); - printf ("%-34s %-*s Std Dev,%% Par.overhead,%% Repeats Gross time | Nruns %u, Nthreads %d", - "Test name", util::rate_field_len, "Rate", NRUNS, util::num_threads); -} - -void Test(); - -inline -int test_main( int argc, char* argv[] ) { - ParseCommandLine( argc, argv ); - ASSERT (MinThread>=2, "Minimal number of threads must be 2 or more"); - char buf[128]; - util::rate_field_len = 2 + sprintf(buf, "%.1e", 1.1); - for ( int i = MinThread; i <= MaxThread; ++i ) { - tbb::task_scheduler_init init (i); - util::num_threads = i; - PrintTitle(); - Test(); - printf("\n"); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_vector.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_vector.cpp deleted file mode 100644 index f2d86725d5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/perf/time_vector.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -//#define DO_SCALABLEALLOC - -#include <cstdlib> -#include <cmath> -#include <vector> -#include <algorithm> -#include <functional> -#include <numeric> -#include "tbb/tbb_stddef.h" -#include "tbb/spin_mutex.h" -#ifdef DO_SCALABLEALLOC -#include "tbb/scalable_allocator.h" -#endif -#include "tbb/concurrent_vector.h" -#include "tbb/tbb_allocator.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/task_scheduler_init.h" -#include "tbb/parallel_for.h" -#include "tbb/tick_count.h" -#include "tbb/blocked_range.h" -#include "../test/harness.h" -//#include "harness_barrier.h" -#include "../test/harness_allocator.h" -#define STATISTICS_INLINE -#include "statistics.h" - -using namespace tbb; -bool ExtraVerbose = false; - -class Timer { - tbb::tick_count tick; -public: - Timer() { tick = tbb::tick_count::now(); } - double get_time() { return (tbb::tick_count::now() - tick).seconds(); } - double diff_time(const Timer &newer) { return (newer.tick - tick).seconds(); } - double mark_time() { tick_count t1(tbb::tick_count::now()), t2(tick); tick = t1; return (t1 - t2).seconds(); } - double mark_time(const Timer &newer) { tick_count t(tick); tick = newer.tick; return (tick - t).seconds(); } -}; - -/************************************************************************/ -/* TEST1 */ -/************************************************************************/ -#define mk_vector_test1(v, a) vector_test1<v<Timer, static_counting_allocator<a<Timer> > >, v<double, static_counting_allocator<a<double> > > > -template<class timers_vector_t, class values_vector_t> -class vector_test1 { - const char *mode; - StatisticsCollector &stat; - StatisticsCollector::TestCase key[16]; - -public: - vector_test1(const char *m, StatisticsCollector &s) : mode(m), stat(s) {} - - vector_test1 &operator()(size_t len) { - if(Verbose) printf("test1<%s>(%u): collecting timing statistics\n", mode, unsigned(len)); - __TBB_ASSERT(sizeof(Timer) == sizeof(double), NULL); - static const char *test_names[] = { - "b)creation wholly", - "a)creation by push", - "c)operation time per item", - 0 }; - for(int i = 0; test_names[i]; ++i) key[i] = stat.SetTestCase(test_names[i], mode, len); - - Timer timer0; timers_vector_t::allocator_type::init_counters(); - timers_vector_t tv(len); - Timer timer1; values_vector_t::allocator_type::init_counters(); - values_vector_t dv; - for (size_t i = 0; i < len; ++i) - dv.push_back( i ); - Timer timer2; - for (size_t i = 0; i < len; ++i) - { - dv[len-i-1] = timer0.diff_time(tv[i]); - tv[i].mark_time(); - } - stat.AddStatisticValue( key[2], "1total, ms", "%.3f", timer2.get_time()*1000.0 ); - stat.AddStatisticValue( key[1], "1total, ms", "%.3f", timer1.diff_time(timer2)*1000.0 ); - stat.AddStatisticValue( key[0], "1total, ms", "%.3f", timer0.diff_time(timer1)*1000.0 ); - //allocator statistics - stat.AddStatisticValue( key[0], "2total allocations", "%d", int(timers_vector_t::allocator_type::allocations) ); - stat.AddStatisticValue( key[1], "2total allocations", "%d", int(values_vector_t::allocator_type::allocations) ); - stat.AddStatisticValue( key[2], "2total allocations", "%d", 0); - stat.AddStatisticValue( key[0], "3total alloc#items", "%d", int(timers_vector_t::allocator_type::items_allocated) ); - stat.AddStatisticValue( key[1], "3total alloc#items", "%d", int(values_vector_t::allocator_type::items_allocated) ); - stat.AddStatisticValue( key[2], "3total alloc#items", "%d", 0); - //remarks - stat.AddStatisticValue( key[0], "9note", "segment creation time, ns:"); - stat.AddStatisticValue( key[2], "9note", "average op-time per item, ns:"); - Timer last_timer(timer2); double last_value = 0; - for (size_t j = 0, i = 2; i < len; i *= 2, j++) { - stat.AddRoundResult( key[0], (dv[len-i-1]-last_value)*1000000.0 ); - last_value = dv[len-i-1]; - stat.AddRoundResult( key[2], last_timer.diff_time(tv[i])/double(i)*1000000.0 ); - last_timer = tv[i]; - stat.SetRoundTitle(j, i); - } - tv.clear(); dv.clear(); - //__TBB_ASSERT(timers_vector_t::allocator_type::items_allocated == timers_vector_t::allocator_type::items_freed, NULL); - //__TBB_ASSERT(values_vector_t::allocator_type::items_allocated == values_vector_t::allocator_type::items_freed, NULL); - return *this; - } -}; - -/************************************************************************/ -/* TEST2 */ -/************************************************************************/ -#define mk_vector_test2(v, a) vector_test2<v<size_t, a<size_t> > > -template<class vector_t> -class vector_test2 { - const char *mode; - static const int ntrial = 10; - StatisticsCollector &stat; - -public: - vector_test2(const char *m, StatisticsCollector &s) : mode(m), stat(s) {} - - vector_test2 &operator()(size_t len) { - if(Verbose) printf("test2<%s>(%u): performing standard transformation sequence on vector\n", mode, unsigned(len)); - StatisticsCollector::TestCase init_key = stat.SetTestCase("allocate", mode, len); - StatisticsCollector::TestCase fill_key = stat.SetTestCase("fill", mode, len); - StatisticsCollector::TestCase proc_key = stat.SetTestCase("process", mode, len); - StatisticsCollector::TestCase full_key = stat.SetTestCase("total time", mode, len); - for (int i = 0; i < ntrial; i++) { - Timer timer0; - vector_t v1(len); - vector_t v2(len); - Timer timer1; - std::generate(v1.begin(), v1.end(), values(0)); - std::generate(v2.begin(), v2.end(), values(size_t(-len))); - Timer timer2; - std::reverse(v1.rbegin(), v1.rend()); - std::inner_product(v1.begin(), v1.end(), v2.rbegin(), 1); - std::sort(v1.rbegin(), v1.rend()); - std::sort(v2.rbegin(), v2.rend()); - std::set_intersection(v1.begin(), v1.end(), v2.rbegin(), v2.rend(), v1.begin()); - Timer timer3; - stat.AddRoundResult( proc_key, timer2.diff_time(timer3)*1000.0 ); - stat.AddRoundResult( fill_key, timer1.diff_time(timer2)*1000.0 ); - stat.AddRoundResult( init_key, timer0.diff_time(timer1)*1000.0 ); - stat.AddRoundResult( full_key, timer0.diff_time(timer3)*1000.0 ); - } - stat.SetStatisticFormula("1Average", "=AVERAGE(ROUNDS)"); - stat.SetStatisticFormula("2+/-", "=(MAX(ROUNDS)-MIN(ROUNDS))/2"); - return *this; - } - - class values - { - size_t value; - public: - values(size_t i) : value(i) {} - size_t operator()() { - return value++%(1|(value^55)); - } - }; -}; - -/************************************************************************/ -/* TEST3 */ -/************************************************************************/ -#define mk_vector_test3(v, a) vector_test3<v<char, local_counting_allocator<a<char>, size_t > > > -template<class vector_t> -class vector_test3 { - const char *mode; - StatisticsCollector &stat; - -public: - vector_test3(const char *m, StatisticsCollector &s) : mode(m), stat(s) {} - - vector_test3 &operator()(size_t len) { - if(Verbose) printf("test3<%s>(%u): collecting allocator statistics\n", mode, unsigned(len)); - static const size_t sz = 1024; - vector_t V[sz]; - StatisticsCollector::TestCase vinst_key = stat.SetTestCase("instances number", mode, len); - StatisticsCollector::TestCase count_key = stat.SetTestCase("allocations count", mode, len); - StatisticsCollector::TestCase items_key = stat.SetTestCase("allocated items", mode, len); - //stat.ReserveRounds(sz-1); - for (size_t c = 0, i = 0, s = sz/2; s >= 1 && i < sz; s /= 2, c++) - { - const size_t count = c? 1<<(c-1) : 0; - for (size_t e = i+s; i < e; i++) { - //if(count >= 16) V[i].reserve(count); - for (size_t j = 0; j < count; j++) - V[i].push_back(j); - } - stat.SetRoundTitle ( c, count ); - stat.AddRoundResult( vinst_key, s ); - stat.AddRoundResult( count_key, V[i-1].get_allocator().allocations ); - stat.AddRoundResult( items_key, V[i-1].get_allocator().items_allocated ); - } - return *this; - } -}; - -/************************************************************************/ -/* TYPES SET FOR TESTS */ -/************************************************************************/ -#define types_set(n, title, op) { StatisticsCollector Collector("time_vector"#n); Collector.SetTitle title; \ - {mk_vector_test##n(tbb::concurrent_vector, tbb::cache_aligned_allocator) ("TBB:NFS", Collector)op;} \ - {mk_vector_test##n(tbb::concurrent_vector, tbb::tbb_allocator) ("TBB:TBB", Collector)op;} \ - {mk_vector_test##n(tbb::concurrent_vector, std::allocator) ("TBB:STD", Collector)op;} \ - {mk_vector_test##n(std::vector, tbb::cache_aligned_allocator) ("STL:NFS", Collector)op;} \ - {mk_vector_test##n(std::vector, tbb::tbb_allocator) ("STL:TBB", Collector)op;} \ - {mk_vector_test##n(std::vector, std::allocator) ("STL:STD", Collector)op;} \ - Collector.Print(StatisticsCollector::Stdout|StatisticsCollector::HTMLFile|StatisticsCollector::ExcelXML); } - - -/************************************************************************/ -/* MAIN DRIVER */ -/************************************************************************/ -int main(int argc, char* argv[]) { - if(argc>1) Verbose = true; - if(argc>2) ExtraVerbose = true; - MinThread = 0; MaxThread = 500000; // use in another meaning - test#:problem size - ParseCommandLine( argc, argv ); - - ASSERT(tbb_allocator<int>::allocator_type() == tbb_allocator<int>::scalable, "expecting scalable allocator library to be loaded"); - - if(!MinThread || MinThread == 1) - types_set(1, ("Vectors performance test #1 for %d", MaxThread), (MaxThread) ) - if(!MinThread || MinThread == 2) - types_set(2, ("Vectors performance test #2 for %d", MaxThread), (MaxThread) ) - if(!MinThread || MinThread == 3) - types_set(3, ("Vectors performance test #3 for %d", MaxThread), (MaxThread) ) - - if(!Verbose) printf("done\n"); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/cache_aligned_allocator.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/cache_aligned_allocator.cpp deleted file mode 100644 index 9edf3b2376..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/cache_aligned_allocator.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/cache_aligned_allocator.h" -#include "tbb/tbb_allocator.h" -#include "tbb_misc.h" -#include "dynamic_link.h" -#include <cstdlib> - -#if _WIN32||_WIN64 -#include <windows.h> -#else -#include <dlfcn.h> -#endif /* _WIN32||_WIN64 */ - -using namespace std; - -#if __TBB_WEAK_SYMBOLS - -#pragma weak scalable_malloc -#pragma weak scalable_free - -extern "C" { - void* scalable_malloc( size_t ); - void scalable_free( void* ); -} - -#endif /* __TBB_WEAK_SYMBOLS */ - -#define __TBB_IS_SCALABLE_MALLOC_FIX_READY 0 - -namespace tbb { - -namespace internal { - -//! Dummy routine used for first indirect call via MallocHandler. -static void* DummyMalloc( size_t size ); - -//! Dummy routine used for first indirect call via FreeHandler. -static void DummyFree( void * ptr ); - -//! Handler for memory allocation -static void* (*MallocHandler)( size_t size ) = &DummyMalloc; - -//! Handler for memory deallocation -static void (*FreeHandler)( void* pointer ) = &DummyFree; - -//! Table describing the how to link the handlers. -static const dynamic_link_descriptor MallocLinkTable[] = { - DLD(scalable_malloc, MallocHandler), - DLD(scalable_free, FreeHandler), -}; - -#if __TBB_IS_SCALABLE_MALLOC_FIX_READY -//! Dummy routine used for first indirect call via padded_allocate_handler. -static void* dummy_padded_allocate( size_t bytes, size_t alignment ); - -//! Dummy routine used for first indirect call via padded_free_handler. -static void dummy_padded_free( void * ptr ); - -// ! Allocates memory using standard malloc. It is used when scalable_allocator is not available -static void* padded_allocate( size_t bytes, size_t alignment ); - -// ! Allocates memory using scalable_malloc -static void* padded_allocate_via_scalable_malloc( size_t bytes, size_t alignment ); - -// ! Allocates memory using standard free. It is used when scalable_allocator is not available -static void padded_free( void* p ); - -//! Handler for padded memory allocation -static void* (*padded_allocate_handler)( size_t bytes, size_t alignment ) = &dummy_padded_allocate; - -//! Handler for padded memory deallocation -static void (*padded_free_handler)( void* p ) = &dummy_padded_free; - -#endif // #if __TBB_IS_SCALABLE_MALLOC_FIX_READY - - -#if TBB_USE_DEBUG -#define DEBUG_SUFFIX "_debug" -#else -#define DEBUG_SUFFIX -#endif /* TBB_USE_DEBUG */ - -// MALLOCLIB_NAME is the name of the TBB memory allocator library. -#if _WIN32||_WIN64 -#define MALLOCLIB_NAME "tbbmalloc" DEBUG_SUFFIX ".dll" -#elif __APPLE__ -#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".dylib" -#elif __linux__ -#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX __TBB_STRING(.so.TBB_COMPATIBLE_INTERFACE_VERSION) -#elif __FreeBSD__ || __sun -#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so" -#else -#error Unknown OS -#endif - -//! Initialize the allocation/free handler pointers. -/** Caller is responsible for ensuring this routine is called exactly once. - The routine attempts to dynamically link with the TBB memory allocator. - If that allocator is not found, it links to malloc and free. */ -void initialize_cache_aligned_allocator() { - __TBB_ASSERT( MallocHandler==&DummyMalloc, NULL ); - bool success = dynamic_link( MALLOCLIB_NAME, MallocLinkTable, 2 ); - if( !success ) { - // If unsuccessful, set the handlers to the default routines. - // This must be done now, and not before FillDynanmicLinks runs, because if other - // threads call the handlers, we want them to go through the DoOneTimeInitializations logic, - // which forces them to wait. - FreeHandler = &free; - MallocHandler = &malloc; -#if __TBB_IS_SCALABLE_MALLOC_FIX_READY - padded_allocate_handler = &padded_allocate; - padded_free_handler = &padded_free; - }else{ - padded_allocate_handler = &padded_allocate_via_scalable_malloc; - __TBB_ASSERT(FreeHandler != &free && FreeHandler != &DummyFree, NULL); - padded_free_handler = FreeHandler; -#endif // __TBB_IS_SCALABLE_MALLOC_FIX_READY - } - PrintExtraVersionInfo( "ALLOCATOR", success?"scalable_malloc":"malloc" ); -} - -//! Defined in task.cpp -extern void DoOneTimeInitializations(); - -//! Executed on very first call throught MallocHandler -static void* DummyMalloc( size_t size ) { - DoOneTimeInitializations(); - __TBB_ASSERT( MallocHandler!=&DummyMalloc, NULL ); - return (*MallocHandler)( size ); -} - -//! Executed on very first call throught FreeHandler -static void DummyFree( void * ptr ) { - DoOneTimeInitializations(); - __TBB_ASSERT( FreeHandler!=&DummyFree, NULL ); - (*FreeHandler)( ptr ); -} - -#if __TBB_IS_SCALABLE_MALLOC_FIX_READY -//! Executed on very first call throught padded_allocate_handler -static void* dummy_padded_allocate( size_t bytes, size_t alignment ) { - DoOneTimeInitializations(); - __TBB_ASSERT( padded_allocate_handler!=&dummy_padded_allocate, NULL ); - return (*padded_allocate_handler)(bytes, alignment); -} - -//! Executed on very first call throught padded_free_handler -static void dummy_padded_free( void * ptr ) { - DoOneTimeInitializations(); - __TBB_ASSERT( padded_free_handler!=&dummy_padded_free, NULL ); - (*padded_free_handler)( ptr ); -} -#endif // __TBB_IS_SCALABLE_MALLOC_FIX_READY - -static size_t NFS_LineSize = 128; - -size_t NFS_GetLineSize() { - return NFS_LineSize; -} - -//! Requests for blocks this size and higher are handled via malloc/free, -const size_t BigSize = 4096; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // unary minus operator applied to unsigned type, result still unsigned - #pragma warning( disable: 4146 4706 ) -#endif - -void* NFS_Allocate( size_t n, size_t element_size, void* /*hint*/ ) { - size_t m = NFS_LineSize; - __TBB_ASSERT( m<=NFS_MaxLineSize, "illegal value for NFS_LineSize" ); - __TBB_ASSERT( (m & m-1)==0, "must be power of two" ); - size_t bytes = n*element_size; -#if __TBB_IS_SCALABLE_MALLOC_FIX_READY - - if (bytes<n || bytes+m<bytes) { - // Overflow - throw bad_alloc(); - } - - void* result = (*padded_allocate_handler)( bytes, m ); -#else - unsigned char* base; - if( bytes<n || bytes+m<bytes || !(base=(unsigned char*)(bytes>=BigSize?malloc(m+bytes):(*MallocHandler)(m+bytes))) ) { - // Overflow - throw bad_alloc(); - } - // Round up to next line - unsigned char* result = (unsigned char*)((uintptr)(base+m)&-m); - // Record where block actually starts. Use low order bit to record whether we used malloc or MallocHandler. - ((uintptr*)result)[-1] = uintptr(base)|(bytes>=BigSize); -#endif // __TBB_IS_SCALABLE_MALLOC_FIX_READY - /** The test may fail with TBB_IS_SCALABLE_MALLOC_FIX_READY = 1 - because scalable_malloc returns addresses aligned to 64 when large block is allocated */ - __TBB_ASSERT( ((size_t)result&(m-1)) == 0, "The address returned isn't aligned to cache line size" ); - return result; -} - -void NFS_Free( void* p ) { -#if __TBB_IS_SCALABLE_MALLOC_FIX_READY - (*padded_free_handler)( p ); -#else - if( p ) { - __TBB_ASSERT( (uintptr)p>=0x4096, "attempt to free block not obtained from cache_aligned_allocator" ); - // Recover where block actually starts - unsigned char* base = ((unsigned char**)p)[-1]; - __TBB_ASSERT( (void*)((uintptr)(base+NFS_LineSize)&-NFS_LineSize)==p, "not allocated by NFS_Allocate?" ); - if( uintptr(base)&1 ) { - // Is a big block - use free - free(base-1); - } else { - // Is a small block - use scalable allocator - (*FreeHandler)( base ); - } - } -#endif // __TBB_IS_SCALABLE_MALLOC_FIX_READY -} - -#if __TBB_IS_SCALABLE_MALLOC_FIX_READY -static void* padded_allocate_via_scalable_malloc( size_t bytes, size_t alignment ) { - unsigned char* base; - if( !(base=(unsigned char*)(*MallocHandler)((bytes+alignment)&-alignment))) { - throw bad_alloc(); - } - return base; // scalable_malloc returns aligned pointer -} - -static void* padded_allocate( size_t bytes, size_t alignment ) { - unsigned char* base; - if( !(base=(unsigned char*)malloc(alignment+bytes)) ) { - throw bad_alloc(); - } - // Round up to the next line - unsigned char* result = (unsigned char*)((uintptr)(base+alignment)&-alignment); - // Record where block actually starts. - ((uintptr*)result)[-1] = uintptr(base); - return result; -} - -static void padded_free( void* p ) { - if( p ) { - __TBB_ASSERT( (uintptr)p>=0x4096, "attempt to free block not obtained from cache_aligned_allocator" ); - // Recover where block actually starts - unsigned char* base = ((unsigned char**)p)[-1]; - __TBB_ASSERT( (void*)((uintptr)(base+NFS_LineSize)&-NFS_LineSize)==p, "not allocated by NFS_Allocate?" ); - free(base); - } -} -#endif // #if __TBB_IS_SCALABLE_MALLOC_FIX_READY - -void* __TBB_EXPORTED_FUNC allocate_via_handler_v3( size_t n ) { - void* result; - result = (*MallocHandler) (n); - if (!result) { - // Overflow - throw bad_alloc(); - } - return result; -} - -void __TBB_EXPORTED_FUNC deallocate_via_handler_v3( void *p ) { - if( p ) { - (*FreeHandler)( p ); - } -} - -bool __TBB_EXPORTED_FUNC is_malloc_used_v3() { - if (MallocHandler == &DummyMalloc) { - void* void_ptr = (*MallocHandler)(1); - (*FreeHandler)(void_ptr); - } - __TBB_ASSERT( MallocHandler!=&DummyMalloc && FreeHandler!=&DummyFree, NULL ); - __TBB_ASSERT(MallocHandler==&malloc && FreeHandler==&free || - MallocHandler!=&malloc && FreeHandler!=&free, NULL ); - return MallocHandler == &malloc; -} - -} // namespace internal - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_hash_map.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_hash_map.cpp deleted file mode 100644 index 4d476c64bc..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_hash_map.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/concurrent_hash_map.h" - -namespace tbb { - -namespace internal { - -bool hash_map_segment_base::internal_grow_predicate() const { - // Intel(R) Thread Checker considers the following reads to be races, so we hide them in the - // library so that Intel(R) Thread Checker will ignore them. The reads are used in a double-check - // context, so the program is nonetheless correct despite the race. - return my_logical_size >= my_physical_size && my_physical_size < internal::hash_map_base::max_physical_size; -} - -} // namespace internal - -} // namespace tbb - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_queue.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_queue.cpp deleted file mode 100644 index 7776238c1e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_queue.cpp +++ /dev/null @@ -1,842 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include <cstring> -#include <cstdio> - -#include "tbb/tbb_machine.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/spin_mutex.h" -#include "tbb/atomic.h" -#include "tbb/concurrent_queue.h" -#include "tbb/tbb_exception.h" -#include "tbb_misc.h" -#include "itt_notify.h" -#if __SUNPRO_CC -#include <memory.h> -#endif - -using namespace std; - -// enable sleep support -#define __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE 1 - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (disable: 4267) -#endif - -#define RECORD_EVENTS 0 - - -#if __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE -#if !_WIN32&&!_WIN64 -#include <pthread.h> -#endif -#endif - -namespace tbb { - -namespace internal { - -class concurrent_queue_rep; - -typedef size_t ticket; - -//! A queue using simple locking. -/** For efficient, this class has no constructor. - The caller is expected to zero-initialize it. */ -struct micro_queue { - typedef concurrent_queue_base::page page; - - friend class micro_queue_pop_finalizer; - - atomic<page*> head_page; - atomic<ticket> head_counter; - - atomic<page*> tail_page; - atomic<ticket> tail_counter; - - spin_mutex page_mutex; - - void push( const void* item, ticket k, concurrent_queue_base& base ); - - bool pop( void* dst, ticket k, concurrent_queue_base& base ); - - micro_queue& assign( const micro_queue& src, concurrent_queue_base& base ); - - page* make_copy ( concurrent_queue_base& base, const page* src_page, size_t begin_in_page, size_t end_in_page, ticket& g_index ) ; - - void make_invalid( ticket k ); -}; - -// we need to yank it out of micro_queue because of concurrent_queue_base::deallocate_page being virtual. -class micro_queue_pop_finalizer: no_copy { - typedef concurrent_queue_base::page page; - ticket my_ticket; - micro_queue& my_queue; - page* my_page; - concurrent_queue_base &base; -public: - micro_queue_pop_finalizer( micro_queue& queue, concurrent_queue_base& b, ticket k, page* p ) : - my_ticket(k), my_queue(queue), my_page(p), base(b) - {} - ~micro_queue_pop_finalizer() { - page* p = my_page; - if( p ) { - spin_mutex::scoped_lock lock( my_queue.page_mutex ); - page* q = p->next; - my_queue.head_page = q; - if( !q ) { - my_queue.tail_page = NULL; - } - } - my_queue.head_counter = my_ticket; - if( p ) - base.deallocate_page( p ); - } -}; - -//! Internal representation of a ConcurrentQueue. -/** For efficient, this class has no constructor. - The caller is expected to zero-initialize it. */ -class concurrent_queue_rep { -public: -#if __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE -# if _WIN32||_WIN64 - typedef HANDLE waitvar_t; - typedef CRITICAL_SECTION mutexvar_t; -# else - typedef pthread_cond_t waitvar_t; - typedef pthread_mutex_t mutexvar_t; -# endif -#endif /* __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ -private: - friend struct micro_queue; - - //! Approximately n_queue/golden ratio - static const size_t phi = 3; - -public: - //! Must be power of 2 - static const size_t n_queue = 8; - - //! Map ticket to an array index - static size_t index( ticket k ) { - return k*phi%n_queue; - } - -#if __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE - atomic<ticket> head_counter; - waitvar_t var_wait_for_items; - mutexvar_t mtx_items_avail; - atomic<size_t> n_invalid_entries; - atomic<uint32_t> n_waiting_consumers; -#if _WIN32||_WIN64 - uint32_t consumer_wait_generation; - uint32_t n_consumers_to_wakeup; - char pad1[NFS_MaxLineSize-((sizeof(atomic<ticket>)+sizeof(waitvar_t)+sizeof(mutexvar_t)+sizeof(size_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t))&(NFS_MaxLineSize-1))]; -#else - char pad1[NFS_MaxLineSize-((sizeof(atomic<ticket>)+sizeof(waitvar_t)+sizeof(mutexvar_t)+sizeof(size_t)+sizeof(uint32_t))&(NFS_MaxLineSize-1))]; -#endif - - atomic<ticket> tail_counter; - waitvar_t var_wait_for_slots; - mutexvar_t mtx_slots_avail; - atomic<uint32_t> n_waiting_producers; -#if _WIN32||_WIN64 - uint32_t producer_wait_generation; - uint32_t n_producers_to_wakeup; - char pad2[NFS_MaxLineSize-((sizeof(atomic<ticket>)+sizeof(waitvar_t)+sizeof(mutexvar_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t))&(NFS_MaxLineSize-1))]; -#else - char pad2[NFS_MaxLineSize-((sizeof(atomic<ticket>)+sizeof(waitvar_t)+sizeof(mutexvar_t)+sizeof(uint32_t))&(NFS_MaxLineSize-1))]; -#endif -#else /* !__TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ - atomic<ticket> head_counter; - atomic<size_t> n_invalid_entries; - char pad1[NFS_MaxLineSize-sizeof(atomic<ticket>)-sizeof(size_t)]; - atomic<ticket> tail_counter; - char pad2[NFS_MaxLineSize-sizeof(atomic<ticket>)]; -#endif /* __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ - micro_queue array[n_queue]; - - micro_queue& choose( ticket k ) { - // The formula here approximates LRU in a cache-oblivious way. - return array[index(k)]; - } - - //! Value for effective_capacity that denotes unbounded queue. - static const ptrdiff_t infinite_capacity = ptrdiff_t(~size_t(0)/2); -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // unary minus operator applied to unsigned type, result still unsigned - #pragma warning( push ) - #pragma warning( disable: 4146 ) -#endif - - -static void* invalid_page; - -//------------------------------------------------------------------------ -// micro_queue -//------------------------------------------------------------------------ -void micro_queue::push( const void* item, ticket k, concurrent_queue_base& base ) { - k &= -concurrent_queue_rep::n_queue; - page* p = NULL; - size_t index = k/concurrent_queue_rep::n_queue & (base.items_per_page-1); - if( !index ) { - try { - p = base.allocate_page(); - } catch (...) { - ++base.my_rep->n_invalid_entries; - make_invalid( k ); - } - p->mask = 0; - p->next = NULL; - } - - if( tail_counter!=k ) { - ExponentialBackoff backoff; - do { - backoff.pause(); - // no memory. throws an exception; assumes concurrent_queue_rep::n_queue>1 - if( tail_counter&0x1 ) { - ++base.my_rep->n_invalid_entries; - throw bad_last_alloc(); - } - } while( tail_counter!=k ) ; - } - - if( p ) { - spin_mutex::scoped_lock lock( page_mutex ); - if( page* q = tail_page ) - q->next = p; - else - head_page = p; - tail_page = p; - } else { - p = tail_page; - } - ITT_NOTIFY( sync_acquired, p ); - - try { - base.copy_item( *p, index, item ); - ITT_NOTIFY( sync_releasing, p ); - // If no exception was thrown, mark item as present. - p->mask |= uintptr(1)<<index; - tail_counter += concurrent_queue_rep::n_queue; - } catch (...) { - ++base.my_rep->n_invalid_entries; - tail_counter += concurrent_queue_rep::n_queue; - throw; - } -} - -bool micro_queue::pop( void* dst, ticket k, concurrent_queue_base& base ) { - k &= -concurrent_queue_rep::n_queue; - SpinwaitUntilEq( head_counter, k ); - SpinwaitWhileEq( tail_counter, k ); - page& p = *head_page; - __TBB_ASSERT( &p, NULL ); - size_t index = k/concurrent_queue_rep::n_queue & (base.items_per_page-1); - bool success = false; - { - micro_queue_pop_finalizer finalizer( *this, base, k+concurrent_queue_rep::n_queue, index==base.items_per_page-1 ? &p : NULL ); - if( p.mask & uintptr(1)<<index ) { - success = true; -#if DO_ITT_NOTIFY - if( ((intptr_t)dst&1) ) { - dst = (void*) ((intptr_t)dst&~1); - ITT_NOTIFY( sync_acquired, dst ); - } -#endif - ITT_NOTIFY( sync_acquired, head_page ); - base.assign_and_destroy_item( dst, p, index ); - ITT_NOTIFY( sync_releasing, head_page ); - } else { - --base.my_rep->n_invalid_entries; - } - } - return success; -} - -micro_queue& micro_queue::assign( const micro_queue& src, concurrent_queue_base& base ) -{ - head_counter = src.head_counter; - tail_counter = src.tail_counter; - page_mutex = src.page_mutex; - - const page* srcp = src.head_page; - if( srcp ) { - ticket g_index = head_counter; - try { - size_t n_items = (tail_counter-head_counter)/concurrent_queue_rep::n_queue; - size_t index = (head_counter/concurrent_queue_rep::n_queue & base.items_per_page-1); - size_t end_in_first_page = (index+n_items<base.items_per_page)?(index+n_items):base.items_per_page; - - head_page = make_copy( base, srcp, index, end_in_first_page, g_index ); - page* cur_page = head_page; - - if( srcp != src.tail_page ) { - for( srcp = srcp->next; srcp!=src.tail_page; srcp=srcp->next ) { - cur_page->next = make_copy( base, srcp, 0, base.items_per_page, g_index ); - cur_page = cur_page->next; - } - - __TBB_ASSERT( srcp==src.tail_page, NULL ); - - size_t last_index = tail_counter/concurrent_queue_rep::n_queue & (base.items_per_page-1); - if( last_index==0 ) last_index = base.items_per_page; - - cur_page->next = make_copy( base, srcp, 0, last_index, g_index ); - cur_page = cur_page->next; - } - tail_page = cur_page; - } catch (...) { - make_invalid( g_index ); - } - } else { - head_page = tail_page = NULL; - } - return *this; -} - -concurrent_queue_base::page* micro_queue::make_copy( concurrent_queue_base& base, const concurrent_queue_base::page* src_page, size_t begin_in_page, size_t end_in_page, ticket& g_index ) -{ - page* new_page = base.allocate_page(); - new_page->next = NULL; - new_page->mask = src_page->mask; - for( ; begin_in_page!=end_in_page; ++begin_in_page, ++g_index ) - if( new_page->mask & uintptr(1)<<begin_in_page ) - base.copy_page_item( *new_page, begin_in_page, *src_page, begin_in_page ); - return new_page; -} - -void micro_queue::make_invalid( ticket k ) -{ - static concurrent_queue_base::page dummy = {static_cast<page*>((void*)1), 0}; - // mark it so that no more pushes are allowed. - invalid_page = &dummy; - { - spin_mutex::scoped_lock lock( page_mutex ); - tail_counter = k+concurrent_queue_rep::n_queue+1; - if( page* q = tail_page ) - q->next = static_cast<page*>(invalid_page); - else - head_page = static_cast<page*>(invalid_page); - tail_page = static_cast<page*>(invalid_page); - } - throw; -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif // warning 4146 is back - -//------------------------------------------------------------------------ -// concurrent_queue_base -//------------------------------------------------------------------------ -concurrent_queue_base_v3::concurrent_queue_base_v3( size_t item_size ) { - items_per_page = item_size<=8 ? 32 : - item_size<=16 ? 16 : - item_size<=32 ? 8 : - item_size<=64 ? 4 : - item_size<=128 ? 2 : - 1; - my_capacity = size_t(-1)/(item_size>1 ? item_size : 2); - my_rep = cache_aligned_allocator<concurrent_queue_rep>().allocate(1); - __TBB_ASSERT( (size_t)my_rep % NFS_GetLineSize()==0, "alignment error" ); - __TBB_ASSERT( (size_t)&my_rep->head_counter % NFS_GetLineSize()==0, "alignment error" ); - __TBB_ASSERT( (size_t)&my_rep->tail_counter % NFS_GetLineSize()==0, "alignment error" ); - __TBB_ASSERT( (size_t)&my_rep->array % NFS_GetLineSize()==0, "alignment error" ); - memset(my_rep,0,sizeof(concurrent_queue_rep)); - this->item_size = item_size; -#if __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE -#if _WIN32||_WIN64 - my_rep->var_wait_for_items = CreateEvent( NULL, TRUE/*manual reset*/, FALSE/*not signalled initially*/, NULL); - my_rep->var_wait_for_slots = CreateEvent( NULL, TRUE/*manual reset*/, FALSE/*not signalled initially*/, NULL); - InitializeCriticalSection( &my_rep->mtx_items_avail ); - InitializeCriticalSection( &my_rep->mtx_slots_avail ); -#else - // initialize pthread_mutex_t, and pthread_cond_t - pthread_mutexattr_t m_attr; - pthread_mutexattr_init( &m_attr ); -#if defined(PTHREAD_PRIO_INHERIT) && !__TBB_PRIO_INHERIT_BROKEN - pthread_mutexattr_setprotocol( &m_attr, PTHREAD_PRIO_INHERIT ); -#endif - pthread_mutex_init( &my_rep->mtx_items_avail, &m_attr ); - pthread_mutex_init( &my_rep->mtx_slots_avail, &m_attr ); - pthread_mutexattr_destroy( &m_attr ); - - pthread_condattr_t c_attr; - pthread_condattr_init( &c_attr ); - pthread_cond_init( &my_rep->var_wait_for_items, &c_attr ); - pthread_cond_init( &my_rep->var_wait_for_slots, &c_attr ); - pthread_condattr_destroy( &c_attr ); -#endif -#endif /* __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ -} - -concurrent_queue_base_v3::~concurrent_queue_base_v3() { - size_t nq = my_rep->n_queue; - for( size_t i=0; i<nq; i++ ) - __TBB_ASSERT( my_rep->array[i].tail_page==NULL, "pages were not freed properly" ); -#if __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE -# if _WIN32||_WIN64 - CloseHandle( my_rep->var_wait_for_items ); - CloseHandle( my_rep->var_wait_for_slots ); - DeleteCriticalSection( &my_rep->mtx_items_avail ); - DeleteCriticalSection( &my_rep->mtx_slots_avail ); -# else - pthread_mutex_destroy( &my_rep->mtx_items_avail ); - pthread_mutex_destroy( &my_rep->mtx_slots_avail ); - pthread_cond_destroy( &my_rep->var_wait_for_items ); - pthread_cond_destroy( &my_rep->var_wait_for_slots ); -# endif -#endif /* __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ - cache_aligned_allocator<concurrent_queue_rep>().deallocate(my_rep,1); -} - -void concurrent_queue_base_v3::internal_push( const void* src ) { - concurrent_queue_rep& r = *my_rep; -#if !__TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE - ticket k = r.tail_counter++; - ptrdiff_t e = my_capacity; - if( e<concurrent_queue_rep::infinite_capacity ) { - AtomicBackoff backoff; - for(;;) { - if( (ptrdiff_t)(k-r.head_counter)<e ) break; - backoff.pause(); - e = const_cast<volatile ptrdiff_t&>(my_capacity); - } - } - r.choose(k).push(src,k,*this); -#elif _WIN32||_WIN64 - ticket k = r.tail_counter++; - ptrdiff_t e = my_capacity; - AtomicBackoff backoff; -#if DO_ITT_NOTIFY - bool sync_prepare_done = false; -#endif - - while( (ptrdiff_t)(k-r.head_counter)>=e ) { -#if DO_ITT_NOTIFY - if( !sync_prepare_done ) { - ITT_NOTIFY( sync_prepare, &sync_prepare_done ); - sync_prepare_done = true; - } -#endif - if( !backoff.bounded_pause() ) { - EnterCriticalSection( &r.mtx_slots_avail ); - r.n_waiting_producers++; - while( (ptrdiff_t)(k-r.head_counter)>=const_cast<volatile ptrdiff_t&>(my_capacity) ) { - uint32_t my_generation = r.producer_wait_generation; - for( ;; ) { - LeaveCriticalSection( &r.mtx_slots_avail ); - WaitForSingleObject( r.var_wait_for_slots, INFINITE ); - EnterCriticalSection( &r.mtx_slots_avail ); - if( r.n_producers_to_wakeup > 0 && r.producer_wait_generation != my_generation ) - break; - } - if( --r.n_producers_to_wakeup == 0 ) - ResetEvent( r.var_wait_for_slots ); - } - --r.n_waiting_producers; - LeaveCriticalSection( &r.mtx_slots_avail ); - break; - } - e = const_cast<volatile ptrdiff_t&>(my_capacity); - } -#if DO_ITT_NOTIFY - if( sync_prepare_done ) - ITT_NOTIFY( sync_acquired, &sync_prepare_done ); -#endif - - r.choose( k ).push( src, k, *this ); - - if( r.n_waiting_consumers>0 ) { - EnterCriticalSection( &r.mtx_items_avail ); - if( r.n_waiting_consumers>0 ) { - r.consumer_wait_generation++; - r.n_consumers_to_wakeup = r.n_waiting_consumers; - SetEvent( r.var_wait_for_items ); - } - LeaveCriticalSection( &r.mtx_items_avail ); - } -#else - ticket k = r.tail_counter++; - ptrdiff_t e = my_capacity; - AtomicBackoff backoff; -#if DO_ITT_NOTIFY - bool sync_prepare_done = false; -#endif - while( (ptrdiff_t)(k-r.head_counter)>=e ) { -#if DO_ITT_NOTIFY - if( !sync_prepare_done ) { - ITT_NOTIFY( sync_prepare, &sync_prepare_done ); - sync_prepare_done = true; - } -#endif - if( !backoff.bounded_pause() ) { - // queue is full. go to sleep. let them go to sleep in order. - pthread_mutex_lock( &r.mtx_slots_avail ); - r.n_waiting_producers++; - while( (ptrdiff_t)(k-r.head_counter)>=const_cast<volatile ptrdiff_t&>(my_capacity) ) { - pthread_cond_wait( &r.var_wait_for_slots, &r.mtx_slots_avail ); - } - --r.n_waiting_producers; - pthread_mutex_unlock( &r.mtx_slots_avail ); - break; - } - e = const_cast<volatile ptrdiff_t&>(my_capacity); - } -#if DO_ITT_NOTIFY - if( sync_prepare_done ) - ITT_NOTIFY( sync_acquired, &sync_prepare_done ); -#endif - r.choose( k ).push( src, k, *this ); - - if( r.n_waiting_consumers>0 ) { - pthread_mutex_lock( &r.mtx_items_avail ); - // pthread_cond_broadcast() wakes up all consumers. - if( r.n_waiting_consumers>0 ) - pthread_cond_broadcast( &r.var_wait_for_items ); - pthread_mutex_unlock( &r.mtx_items_avail ); - } -#endif /* !__TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ -} - -void concurrent_queue_base_v3::internal_pop( void* dst ) { - concurrent_queue_rep& r = *my_rep; -#if !__TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE - ticket k; - do { - k = r.head_counter++; - } while( !r.choose(k).pop(dst,k,*this) ); -#elif _WIN32||_WIN64 - ticket k; - AtomicBackoff backoff; -#if DO_ITT_NOTIFY - bool sync_prepare_done = false; -#endif - do { - k=r.head_counter++; - while( r.tail_counter<=k ) { -#if DO_ITT_NOTIFY - if( !sync_prepare_done ) { - ITT_NOTIFY( sync_prepare, dst ); - dst = (void*) ((intptr_t)dst | 1); - sync_prepare_done = true; - } -#endif - // Queue is empty; pause and re-try a few times - if( !backoff.bounded_pause() ) { - // it is really empty.. go to sleep - EnterCriticalSection( &r.mtx_items_avail ); - r.n_waiting_consumers++; - while( r.tail_counter<=k ) { - uint32_t my_generation = r.consumer_wait_generation; - for( ;; ) { - LeaveCriticalSection( &r.mtx_items_avail ); - WaitForSingleObject( r.var_wait_for_items, INFINITE ); - EnterCriticalSection( &r.mtx_items_avail ); - if( r.n_consumers_to_wakeup > 0 && r.consumer_wait_generation != my_generation ) - break; - } - if( --r.n_consumers_to_wakeup == 0 ) - ResetEvent( r.var_wait_for_items ); - } - --r.n_waiting_consumers; - LeaveCriticalSection( &r.mtx_items_avail ); - backoff.reset(); - break; // break from inner while - } - } // break to here - } while( !r.choose(k).pop(dst,k,*this) ); - - // wake up a producer.. - if( r.n_waiting_producers>0 ) { - EnterCriticalSection( &r.mtx_slots_avail ); - if( r.n_waiting_producers>0 ) { - r.producer_wait_generation++; - r.n_producers_to_wakeup = r.n_waiting_producers; - SetEvent( r.var_wait_for_slots ); - } - LeaveCriticalSection( &r.mtx_slots_avail ); - } -#else - ticket k; - AtomicBackoff backoff; -#if DO_ITT_NOTIFY - bool sync_prepare_done = false; -#endif - do { - k = r.head_counter++; - while( r.tail_counter<=k ) { -#if DO_ITT_NOTIFY - if( !sync_prepare_done ) { - ITT_NOTIFY( sync_prepare, dst ); - dst = (void*) ((intptr_t)dst | 1); - sync_prepare_done = true; - } -#endif - // Queue is empty; pause and re-try a few times - if( !backoff.bounded_pause() ) { - // it is really empty.. go to sleep - pthread_mutex_lock( &r.mtx_items_avail ); - r.n_waiting_consumers++; - while( r.tail_counter<=k ) - pthread_cond_wait( &r.var_wait_for_items, &r.mtx_items_avail ); - --r.n_waiting_consumers; - pthread_mutex_unlock( &r.mtx_items_avail ); - backoff.reset(); - break; - } - } - } while( !r.choose(k).pop(dst,k,*this) ); - - if( r.n_waiting_producers>0 ) { - pthread_mutex_lock( &r.mtx_slots_avail ); - if( r.n_waiting_producers>0 ) - pthread_cond_broadcast( &r.var_wait_for_slots ); - pthread_mutex_unlock( &r.mtx_slots_avail ); - } -#endif /* !__TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ -} - -bool concurrent_queue_base_v3::internal_pop_if_present( void* dst ) { - concurrent_queue_rep& r = *my_rep; - ticket k; - do { - k = r.head_counter; - for(;;) { - if( r.tail_counter<=k ) { - // Queue is empty - return false; - } - // Queue had item with ticket k when we looked. Attempt to get that item. - ticket tk=k; - k = r.head_counter.compare_and_swap( tk+1, tk ); - if( k==tk ) - break; - // Another thread snatched the item, retry. - } - } while( !r.choose( k ).pop( dst, k, *this ) ); - -#if __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE -#if _WIN32||_WIN64 - // wake up a producer.. - if( r.n_waiting_producers>0 ) { - EnterCriticalSection( &r.mtx_slots_avail ); - if( r.n_waiting_producers>0 ) { - r.producer_wait_generation++; - r.n_producers_to_wakeup = r.n_waiting_producers; - SetEvent( r.var_wait_for_slots ); - } - LeaveCriticalSection( &r.mtx_slots_avail ); - } -#else /* including MacOS */ - if( r.n_waiting_producers>0 ) { - pthread_mutex_lock( &r.mtx_slots_avail ); - if( r.n_waiting_producers>0 ) - pthread_cond_broadcast( &r.var_wait_for_slots ); - pthread_mutex_unlock( &r.mtx_slots_avail ); - } -#endif -#endif /* __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ - - return true; -} - -bool concurrent_queue_base_v3::internal_push_if_not_full( const void* src ) { - concurrent_queue_rep& r = *my_rep; - ticket k = r.tail_counter; - for(;;) { - if( (ptrdiff_t)(k-r.head_counter)>=my_capacity ) { - // Queue is full - return false; - } - // Queue had empty slot with ticket k when we looked. Attempt to claim that slot. - ticket tk=k; - k = r.tail_counter.compare_and_swap( tk+1, tk ); - if( k==tk ) - break; - // Another thread claimed the slot, so retry. - } - r.choose(k).push(src,k,*this); - -#if __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE -#if _WIN32||_WIN64 - if( r.n_waiting_consumers>0 ) { - EnterCriticalSection( &r.mtx_items_avail ); - if( r.n_waiting_consumers>0 ) { - r.consumer_wait_generation++; - r.n_consumers_to_wakeup = r.n_waiting_consumers; - SetEvent( r.var_wait_for_items ); - } - LeaveCriticalSection( &r.mtx_items_avail ); - } -#else /* including MacOS */ - if( r.n_waiting_consumers>0 ) { - pthread_mutex_lock( &r.mtx_items_avail ); - if( r.n_waiting_consumers>0 ) - pthread_cond_broadcast( &r.var_wait_for_items ); - pthread_mutex_unlock( &r.mtx_items_avail ); - } -#endif -#endif /* __TBB_NO_BUSY_WAIT_IN_CONCURRENT_QUEUE */ - return true; -} - -ptrdiff_t concurrent_queue_base_v3::internal_size() const { - __TBB_ASSERT( sizeof(ptrdiff_t)<=sizeof(size_t), NULL ); - __TBB_ASSERT( ptrdiff_t(my_rep->tail_counter-my_rep->head_counter)>=0 || my_rep->n_invalid_entries==0, NULL ); - return ptrdiff_t(my_rep->tail_counter-my_rep->head_counter-my_rep->n_invalid_entries); -} - -void concurrent_queue_base_v3::internal_set_capacity( ptrdiff_t capacity, size_t /*item_size*/ ) { - my_capacity = capacity<0 ? concurrent_queue_rep::infinite_capacity : capacity; -} - -void concurrent_queue_base_v3::internal_finish_clear() { - size_t nq = my_rep->n_queue; - for( size_t i=0; i<nq; ++i ) { - page* tp = my_rep->array[i].tail_page; - __TBB_ASSERT( my_rep->array[i].head_page==tp, "at most one page should remain" ); - if( tp!=NULL) { - if( tp!=invalid_page ) deallocate_page( tp ); - my_rep->array[i].tail_page = NULL; - } - } -} - -void concurrent_queue_base_v3::internal_throw_exception() const { - throw bad_alloc(); -} - -void concurrent_queue_base_v3::assign( const concurrent_queue_base_v3& src ) { - items_per_page = src.items_per_page; - my_capacity = src.my_capacity; - - // copy concurrent_queue_rep. - my_rep->head_counter = src.my_rep->head_counter; - my_rep->tail_counter = src.my_rep->tail_counter; - my_rep->n_invalid_entries = src.my_rep->n_invalid_entries; - - // copy micro_queues - for( size_t i = 0; i<my_rep->n_queue; ++i ) - my_rep->array[i].assign( src.my_rep->array[i], *this); - - __TBB_ASSERT( my_rep->head_counter==src.my_rep->head_counter && my_rep->tail_counter==src.my_rep->tail_counter, - "the source concurrent queue should not be concurrently modified." ); -} - -//------------------------------------------------------------------------ -// concurrent_queue_iterator_rep -//------------------------------------------------------------------------ -class concurrent_queue_iterator_rep: no_assign { -public: - ticket head_counter; - const concurrent_queue_base& my_queue; - concurrent_queue_base::page* array[concurrent_queue_rep::n_queue]; - concurrent_queue_iterator_rep( const concurrent_queue_base& queue ) : - head_counter(queue.my_rep->head_counter), - my_queue(queue) - { - const concurrent_queue_rep& rep = *queue.my_rep; - for( size_t k=0; k<concurrent_queue_rep::n_queue; ++k ) - array[k] = rep.array[k].head_page; - } - //! Set item to point to kth element. Return true if at end of queue or item is marked valid; false otherwise. - bool get_item( void*& item, size_t k ) { - if( k==my_queue.my_rep->tail_counter ) { - item = NULL; - return true; - } else { - concurrent_queue_base::page* p = array[concurrent_queue_rep::index(k)]; - __TBB_ASSERT(p,NULL); - size_t i = k/concurrent_queue_rep::n_queue & my_queue.items_per_page-1; - item = static_cast<unsigned char*>(static_cast<void*>(p+1)) + my_queue.item_size*i; - return (p->mask & uintptr(1)<<i)!=0; - } - } -}; - -//------------------------------------------------------------------------ -// concurrent_queue_iterator_base -//------------------------------------------------------------------------ -concurrent_queue_iterator_base_v3::concurrent_queue_iterator_base_v3( const concurrent_queue_base& queue ) { - my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep>().allocate(1); - new( my_rep ) concurrent_queue_iterator_rep(queue); - size_t k = my_rep->head_counter; - if( !my_rep->get_item(my_item, k) ) advance(); -} - -void concurrent_queue_iterator_base_v3::assign( const concurrent_queue_iterator_base& other ) { - if( my_rep!=other.my_rep ) { - if( my_rep ) { - cache_aligned_allocator<concurrent_queue_iterator_rep>().deallocate(my_rep, 1); - my_rep = NULL; - } - if( other.my_rep ) { - my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep>().allocate(1); - new( my_rep ) concurrent_queue_iterator_rep( *other.my_rep ); - } - } - my_item = other.my_item; -} - -void concurrent_queue_iterator_base_v3::advance() { - __TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" ); - size_t k = my_rep->head_counter; - const concurrent_queue_base& queue = my_rep->my_queue; -#if TBB_USE_ASSERT - void* tmp; - my_rep->get_item(tmp,k); - __TBB_ASSERT( my_item==tmp, NULL ); -#endif /* TBB_USE_ASSERT */ - size_t i = k/concurrent_queue_rep::n_queue & (queue.items_per_page-1); - if( i==queue.items_per_page-1 ) { - concurrent_queue_base::page*& root = my_rep->array[concurrent_queue_rep::index(k)]; - root = root->next; - } - // advance k - my_rep->head_counter = ++k; - if( !my_rep->get_item(my_item, k) ) advance(); -} - -concurrent_queue_iterator_base_v3::~concurrent_queue_iterator_base_v3() { - //delete my_rep; - cache_aligned_allocator<concurrent_queue_iterator_rep>().deallocate(my_rep, 1); - my_rep = NULL; -} - -} // namespace internal - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_vector.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_vector.cpp deleted file mode 100644 index ce7fba930c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/concurrent_vector.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/concurrent_vector.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/tbb_exception.h" -#include "tbb_misc.h" -#include "itt_notify.h" -#include <cstring> - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (disable: 4267) -#endif - -using namespace std; - -namespace tbb { - -namespace internal { -class concurrent_vector_base_v3::helper { -public: - //! memory page size - static const size_type page_size = 4096; - - inline static bool incompact_predicate(size_type size) { // assert size != 0, see source/test/test_vector_layout.cpp - return size < page_size || ((size-1)%page_size < page_size/2 && size < page_size * 128); // for more details - } - - inline static size_type find_segment_end(const concurrent_vector_base_v3 &v) { - segment_index_t u = v.my_segment==(&(v.my_storage[0])) ? pointers_per_short_table - : pointers_per_long_table; - segment_index_t k = 0; - while( k < u && v.my_segment[k].array ) - ++k; - return k; - } - - //! assign first segment size. k - is index of last segment to be allocated, not a count of segments - static void assign_first_segment_if_neccessary(concurrent_vector_base_v3 &v, segment_index_t k, size_type /*element_size*/) { - if( !v.my_first_block ) { - v.my_first_block.compare_and_swap(k+1, 0); // store number of segments - } - } - - inline static void *allocate_segment(concurrent_vector_base_v3 &v, size_type n) { - void *ptr = v.vector_allocator_ptr(v, n); - if(!ptr) throw bad_alloc(); // check for bad allocation, throw exception - return ptr; - } - - //! Publish segment so other threads can see it. - inline static void publish_segment( segment_t& s, void* rhs ) { - //TODO: see also itt_store_pointer_with_release_v3() - ITT_NOTIFY( sync_releasing, &s.array ); - __TBB_store_with_release( s.array, rhs ); - } - - inline static size_type enable_segment(concurrent_vector_base_v3 &v, size_type k, size_type element_size) { - __TBB_ASSERT( !v.my_segment[k].array, "concurrent operation during growth?" ); - if( !k ) { - assign_first_segment_if_neccessary(v, default_initial_segments-1, element_size); - try { - publish_segment(v.my_segment[0], allocate_segment(v, segment_size(v.my_first_block) ) ); - } catch(...) { // intercept exception here, assign __TBB_BAD_ALLOC value, re-throw exception - publish_segment(v.my_segment[0], __TBB_BAD_ALLOC); throw; - } - return 2; - } - size_type m = segment_size(k); - if( !v.my_first_block ) - internal::SpinwaitWhileEq( v.my_first_block, segment_index_t(0) ); - if( k < v.my_first_block ) { - segment_t* s = v.my_segment; - // s[0].array is changed only once ( 0 -> !0 ) and points to uninitialized memory - void *array0 = __TBB_load_with_acquire(s[0].array); - if( !array0 ) { - // sync_prepare called only if there is a wait - ITT_NOTIFY(sync_prepare, &s[0].array ); - internal::SpinwaitWhileEq( s[0].array, (void*)0 ); - array0 = __TBB_load_with_acquire(s[0].array); - } - ITT_NOTIFY(sync_acquired, &s[0].array); - if( array0 <= __TBB_BAD_ALLOC ) { // check for __TBB_BAD_ALLOC of initial segment - publish_segment(s[k], __TBB_BAD_ALLOC); // and assign __TBB_BAD_ALLOC here - throw bad_last_alloc(); // throw custom exception - } - publish_segment( s[k], - static_cast<void*>( static_cast<char*>(array0) + segment_base(k)*element_size ) - ); - } else { - try { - publish_segment(v.my_segment[k], allocate_segment(v, m)); - } catch(...) { // intercept exception here, assign __TBB_BAD_ALLOC value, re-throw exception - publish_segment(v.my_segment[k], __TBB_BAD_ALLOC); throw; - } - } - return m; - } - - inline static void extend_table_if_necessary(concurrent_vector_base_v3 &v, size_type k) { - if(k >= pointers_per_short_table && v.my_segment == v.my_storage) - extend_segment_table(v); - } - - static void extend_segment_table(concurrent_vector_base_v3 &v) { - segment_t* s = (segment_t*)NFS_Allocate( pointers_per_long_table, sizeof(segment_t), NULL ); - // if( !s ) throw bad_alloc() -- implemented in NFS_Allocate - memset( s, 0, pointers_per_long_table*sizeof(segment_t) ); - // If other threads are trying to set pointers in the short segment, wait for them to finish their - // assigments before we copy the short segment to the long segment. - for(segment_index_t i = 0; i < pointers_per_short_table; i++) - if(!v.my_storage[i].array) - internal::SpinwaitWhileEq(v.my_storage[i].array, (void*)0); - - for( segment_index_t i = 0; i < pointers_per_short_table; i++) - s[i] = v.my_storage[i]; - if( v.my_segment.compare_and_swap( s, v.my_storage ) != v.my_storage ) - NFS_Free( s ); - } -}; - -concurrent_vector_base_v3::~concurrent_vector_base_v3() { - segment_t* s = my_segment; - if( s != my_storage ) { - // Clear short segment. - for( segment_index_t i = 0; i < pointers_per_short_table; i++) - my_storage[i].array = NULL; - my_segment = my_storage; - NFS_Free( s ); - } -} - -concurrent_vector_base_v3::size_type concurrent_vector_base_v3::internal_capacity() const { - return segment_base( helper::find_segment_end(*this) ); -} - -void concurrent_vector_base_v3::internal_throw_exception(size_type t) const { - switch(t) { - case 0: throw out_of_range("Index out of range"); - case 1: throw out_of_range("Index out of segments table range"); - case 2: throw range_error ("Index is inside segment which failed to be allocated"); - } -} - -void concurrent_vector_base_v3::internal_reserve( size_type n, size_type element_size, size_type max_size ) { - if( n>max_size ) { - throw length_error("argument to ConcurrentVector::reserve exceeds ConcurrentVector::max_size()"); - } - helper::assign_first_segment_if_neccessary(*this, segment_index_of(n-1), element_size); - for( segment_index_t k = helper::find_segment_end(*this); segment_base(k)<n; ++k ) { - try { - helper::extend_table_if_necessary(*this, k); - helper::enable_segment(*this, k, element_size); - } catch(...) { // intercept exception here - my_segment[k].array = NULL; throw; // repair and rethrow - } - } -} - -void concurrent_vector_base_v3::internal_copy( const concurrent_vector_base_v3& src, size_type element_size, internal_array_op2 copy ) { - size_type n = src.my_early_size; - my_early_size = n; - my_segment = my_storage; - if( n ) { - helper::assign_first_segment_if_neccessary(*this, segment_index_of(n), element_size); - size_type b; - for( segment_index_t k=0; (b=segment_base(k))<n; ++k ) { - if( (src.my_segment == (segment_t*)src.my_storage && k >= pointers_per_short_table) - || src.my_segment[k].array <= __TBB_BAD_ALLOC ) { - my_early_size = b; break; - } - helper::extend_table_if_necessary(*this, k); - size_type m = helper::enable_segment(*this, k, element_size); - if( m > n-b ) m = n-b; - copy( my_segment[k].array, src.my_segment[k].array, m ); - } - } -} - -void concurrent_vector_base_v3::internal_assign( const concurrent_vector_base_v3& src, size_type element_size, internal_array_op1 destroy, internal_array_op2 assign, internal_array_op2 copy ) { - size_type n = src.my_early_size; - while( my_early_size>n ) { - segment_index_t k = segment_index_of( my_early_size-1 ); - size_type b=segment_base(k); - size_type new_end = b>=n ? b : n; - __TBB_ASSERT( my_early_size>new_end, NULL ); - if( my_segment[k].array <= __TBB_BAD_ALLOC) // check vector was broken before - throw bad_last_alloc(); // throw custom exception - // destructors are supposed to not throw any exceptions - destroy( (char*)my_segment[k].array+element_size*(new_end-b), my_early_size-new_end ); - my_early_size = new_end; - } - size_type dst_initialized_size = my_early_size; - my_early_size = n; - helper::assign_first_segment_if_neccessary(*this, segment_index_of(n), element_size); - size_type b; - for( segment_index_t k=0; (b=segment_base(k))<n; ++k ) { - helper::extend_table_if_necessary(*this, k); - if(!my_segment[k].array) - helper::enable_segment(*this, k, element_size); - if( (src.my_segment == (segment_t*)src.my_storage && k >= pointers_per_short_table) - || src.my_segment[k].array <= __TBB_BAD_ALLOC ) { // if source is damaged - my_early_size = b; break; - } - size_type m = k? segment_size(k) : 2; - if( m > n-b ) m = n-b; - size_type a = 0; - if( dst_initialized_size>b ) { - a = dst_initialized_size-b; - if( a>m ) a = m; - assign( my_segment[k].array, src.my_segment[k].array, a ); - m -= a; - a *= element_size; - } - if( m>0 ) - copy( (char*)my_segment[k].array+a, (char*)src.my_segment[k].array+a, m ); - } - __TBB_ASSERT( src.my_early_size==n, "detected use of ConcurrentVector::operator= with right side that was concurrently modified" ); -} - -void* concurrent_vector_base_v3::internal_push_back( size_type element_size, size_type& index ) { - __TBB_ASSERT( sizeof(my_early_size)==sizeof(uintptr), NULL ); - size_type tmp = __TBB_FetchAndIncrementWacquire(&my_early_size); - index = tmp; - segment_index_t k_old = segment_index_of( tmp ); - size_type base = segment_base(k_old); - helper::extend_table_if_necessary(*this, k_old); - segment_t& s = my_segment[k_old]; - if( !__TBB_load_with_acquire(s.array) ) { // do not check for __TBB_BAD_ALLOC because it's hard to recover after __TBB_BAD_ALLOC correctly - if( base==tmp ) { - helper::enable_segment(*this, k_old, element_size); - } else { - ITT_NOTIFY(sync_prepare, &s.array); - internal::SpinwaitWhileEq( s.array, (void*)0 ); - ITT_NOTIFY(sync_acquired, &s.array); - } - } else { - ITT_NOTIFY(sync_acquired, &s.array); - } - if( s.array <= __TBB_BAD_ALLOC ) // check for __TBB_BAD_ALLOC - throw bad_last_alloc(); // throw custom exception - size_type j_begin = tmp-base; - return (void*)((char*)s.array+element_size*j_begin); -} - -void concurrent_vector_base_v3::internal_grow_to_at_least( size_type new_size, size_type element_size, internal_array_op2 init, const void *src ) { - size_type e = my_early_size; - while( e<new_size ) { - size_type f = my_early_size.compare_and_swap(new_size,e); - if( f==e ) { - internal_grow( e, new_size, element_size, init, src ); - return; - } - e = f; - } -} - -concurrent_vector_base_v3::size_type concurrent_vector_base_v3::internal_grow_by( size_type delta, size_type element_size, internal_array_op2 init, const void *src ) { - size_type result = my_early_size.fetch_and_add(delta); - internal_grow( result, result+delta, element_size, init, src ); - return result; -} - -void concurrent_vector_base_v3::internal_grow( const size_type start, size_type finish, size_type element_size, internal_array_op2 init, const void *src ) { - __TBB_ASSERT( start<finish, "start must be less than finish" ); - size_type tmp = start; - helper::assign_first_segment_if_neccessary(*this, segment_index_of(finish), element_size); - do { - segment_index_t k_old = segment_index_of( tmp ); - size_type base = segment_base(k_old); - helper::extend_table_if_necessary(*this, k_old); - segment_t& s = my_segment[k_old]; - if( !__TBB_load_with_acquire(s.array) ) { // do not check for __TBB_BAD_ALLOC because it's hard to recover after __TBB_BAD_ALLOC correctly - if( base==tmp ) { - helper::enable_segment(*this, k_old, element_size); - } else { - ITT_NOTIFY(sync_prepare, &s.array); - internal::SpinwaitWhileEq( s.array, (void*)0 ); - ITT_NOTIFY(sync_acquired, &s.array); - } - } else { - ITT_NOTIFY(sync_acquired, &s.array); - } - if( s.array <= __TBB_BAD_ALLOC ) // check for __TBB_BAD_ALLOC - throw bad_last_alloc(); // throw custom exception - size_type n = k_old?segment_size(k_old):2; - size_type j_begin = tmp-base; - size_type j_end = n > finish-base ? finish-base : n; - init( (void*)((char*)s.array+element_size*j_begin), src, j_end-j_begin ); - tmp = base+j_end; - } while( tmp<finish ); -} - -concurrent_vector_base_v3::segment_index_t concurrent_vector_base_v3::internal_clear( internal_array_op1 destroy ) { - __TBB_ASSERT( my_segment, NULL ); - const size_type k_end = helper::find_segment_end(*this); - size_type finish = my_early_size; - // Set "my_early_size" early, so that subscripting errors can be caught. - my_early_size = 0; - while( finish > 0 ) { - segment_index_t k_old = segment_index_of(finish-1); - size_type base = segment_base(k_old); - size_type j_end = finish-base; - finish = base; - if( k_old <= k_end ) { - segment_t& s = my_segment[k_old]; - __TBB_ASSERT( j_end, NULL ); - if( s.array > __TBB_BAD_ALLOC) - destroy( s.array, j_end ); // destructors are supposed to not throw any exceptions - } - } - return k_end; -} - -void *concurrent_vector_base_v3::internal_compact( size_type element_size, void *table, internal_array_op1 destroy, internal_array_op2 copy ) -{ - const size_type my_size = my_early_size; - const segment_index_t k_end = helper::find_segment_end(*this); // allocated segments - const segment_index_t k_stop = my_size? segment_index_of(my_size-1) + 1 : 0; // number of segments to store existing items: 0=>0; 1,2=>1; 3,4=>2; [5-8]=>3;.. - const segment_index_t first_block = my_first_block; // number of merged segments, getting values from atomics - - segment_index_t k = first_block; - if(k_stop < first_block) - k = k_stop; - else - while (k < k_stop && helper::incompact_predicate(segment_size( k ) * element_size) ) k++; - if(k_stop == k_end && k == first_block) - return NULL; - - segment_t *const segment_table = my_segment; - internal_segments_table &old = *static_cast<internal_segments_table*>( table ); - memset(&old, 0, sizeof(old)); - - if ( k != first_block && k ) // first segment optimization - { - // exception can occur here - void *seg = old.table[0] = helper::allocate_segment( *this, segment_size(k) ); - old.first_block = k; // fill info for freeing new segment if exception occurs - // copy items to the new segment - size_type my_segment_size = segment_size( first_block ); - for (segment_index_t i = 0, j = 0; i < k && j < my_size; j = my_segment_size) { - __TBB_ASSERT( segment_table[i].array > __TBB_BAD_ALLOC, NULL); - void *s = static_cast<void*>( - static_cast<char*>(seg) + segment_base(i)*element_size ); - if(j + my_segment_size >= my_size) my_segment_size = my_size - j; - // exception can occur here - copy( s, segment_table[i].array, my_segment_size ); - my_segment_size = i? segment_size( ++i ) : segment_size( i = first_block ); - } - // commit the changes - memcpy(old.table, segment_table, k * sizeof(segment_t)); - for (segment_index_t i = 0; i < k; i++) { - segment_table[i].array = static_cast<void*>( - static_cast<char*>(seg) + segment_base(i)*element_size ); - } - old.first_block = first_block; my_first_block = k; // now, first_block != my_first_block - // destroy original copies - my_segment_size = segment_size( first_block ); // old.first_block actually - for (segment_index_t i = 0, j = 0; i < k && j < my_size; j = my_segment_size) { - if(j + my_segment_size >= my_size) my_segment_size = my_size - j; - // destructors are supposed to not throw any exceptions - destroy( old.table[i], my_segment_size ); - my_segment_size = i? segment_size( ++i ) : segment_size( i = first_block ); - } - } - // free unnecessary segments allocated by reserve() call - if ( k_stop < k_end ) { - old.first_block = first_block; - memcpy(old.table+k_stop, segment_table+k_stop, (k_end-k_stop) * sizeof(segment_t)); - memset(segment_table+k_stop, 0, (k_end-k_stop) * sizeof(segment_t)); - if( !k ) my_first_block = 0; - } - return table; -} - -void concurrent_vector_base_v3::internal_swap(concurrent_vector_base_v3& v) -{ - size_type my_sz = my_early_size, v_sz = v.my_early_size; - if(!my_sz && !v_sz) return; - size_type tmp = my_first_block; my_first_block = v.my_first_block; v.my_first_block = tmp; - bool my_short = (my_segment == my_storage), v_short = (v.my_segment == v.my_storage); - if ( my_short && v_short ) { // swap both tables - char tbl[pointers_per_short_table * sizeof(segment_t)]; - memcpy(tbl, my_storage, pointers_per_short_table * sizeof(segment_t)); - memcpy(my_storage, v.my_storage, pointers_per_short_table * sizeof(segment_t)); - memcpy(v.my_storage, tbl, pointers_per_short_table * sizeof(segment_t)); - } - else if ( my_short ) { // my -> v - memcpy(v.my_storage, my_storage, pointers_per_short_table * sizeof(segment_t)); - my_segment = v.my_segment; v.my_segment = v.my_storage; - } - else if ( v_short ) { // v -> my - memcpy(my_storage, v.my_storage, pointers_per_short_table * sizeof(segment_t)); - v.my_segment = my_segment; my_segment = my_storage; - } else { - segment_t *ptr = my_segment; my_segment = v.my_segment; v.my_segment = ptr; - } - my_early_size = v_sz; v.my_early_size = my_sz; -} - -} // namespace internal - -} // tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.cpp deleted file mode 100644 index 801d2c241c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "dynamic_link.h" - -#ifndef LIBRARY_ASSERT -#include "tbb/tbb_stddef.h" -#define LIBRARY_ASSERT(x,y) __TBB_ASSERT(x,y) -#endif /* LIBRARY_ASSERT */ - -#if _WIN32||_WIN64 - #include <windows.h> - #include <malloc.h> /* alloca */ -#else - #include <dlfcn.h> -#if __FreeBSD__ - #include <stdlib.h> /* alloca */ -#else - #include <alloca.h> -#endif -#endif - -OPEN_INTERNAL_NAMESPACE - -#if __TBB_WEAK_SYMBOLS - -bool dynamic_link( const char* /*library*/, const dynamic_link_descriptor descriptors[], size_t n, size_t required ) -{ - if ( required == ~(size_t)0 ) - required = n; - LIBRARY_ASSERT( required<=n, "Number of required entry points exceeds their total number" ); - size_t k = 0; - // Check if the first required entries are present in what was loaded into our process - while ( k < required && descriptors[k].ptr ) - ++k; - if ( k < required ) - return false; - // Commit all the entry points. - for ( k = 0; k < n; ++k ) - *descriptors[k].handler = (pointer_to_handler) descriptors[k].ptr; - return true; -} - -#else /* !__TBB_WEAK_SYMBOLS */ - -bool dynamic_link( void* module, const dynamic_link_descriptor descriptors[], size_t n, size_t required ) -{ - pointer_to_handler *h = (pointer_to_handler*)alloca(n * sizeof(pointer_to_handler)); - if ( required == ~(size_t)0 ) - required = n; - LIBRARY_ASSERT( required<=n, "Number of required entry points exceeds their total number" ); - size_t k = 0; - for ( ; k < n; ++k ) { -#if _WIN32||_WIN64 - // Lvalue casting is used for consistency (see below) - (void *&)h[k] = GetProcAddress( (HMODULE)module, descriptors[k].name ); -#else - // Lvalue casting is used; this way icc -strict-ansi does not warn about nonstandard pointer conversion - (void *&)h[k] = dlsym( module, descriptors[k].name ); -#endif /* _WIN32||_WIN64 */ - if ( !h[k] && k < required ) - return false; - } - LIBRARY_ASSERT( k == n, "if required entries are initialized, all entries are expected to be walked"); - // Commit the entry points. - // Cannot use memset here, because the writes must be atomic. - for( k = 0; k < n; ++k ) - *descriptors[k].handler = h[k]; - return true; -} - -bool dynamic_link( const char* library, const dynamic_link_descriptor descriptors[], size_t n, size_t required ) -{ -#if _WIN32||_WIN64 - if ( dynamic_link( GetModuleHandle(NULL), descriptors, n, required ) ) - // Target library was statically linked into this executable - return true; - // Prevent Windows from displaying silly message boxes if it fails to load library - // (e.g. because of MS runtime problems - one of those crazy manifest related ones) - UINT prev_mode = SetErrorMode (SEM_FAILCRITICALERRORS); - void* module = LoadLibrary (library); - SetErrorMode (prev_mode); -#else - void* module = dlopen( library, RTLD_LAZY ); -#endif /* _WIN32||_WIN64 */ - // Return true if the library is there and it contains all the expected entry points. - return module != NULL && dynamic_link( module, descriptors, n, required ); -} - -#endif /* !__TBB_WEAK_SYMBOLS */ - -CLOSE_INTERNAL_NAMESPACE diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.h deleted file mode 100644 index 7e1eb36c05..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/dynamic_link.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_dynamic_link -#define __TBB_dynamic_link - -// Support for dynamically linking to a shared library. -// By default, the symbols defined here go in namespace tbb::internal. -// The symbols can be put in another namespace by defining the preprocessor -// symbols OPEN_INTERNAL_NAMESPACE and CLOSE_INTERNAL_NAMESPACE to open and -// close the other namespace. See default definition below for an example. - -#ifndef OPEN_INTERNAL_NAMESPACE -#define OPEN_INTERNAL_NAMESPACE namespace tbb { namespace internal { -#define CLOSE_INTERNAL_NAMESPACE }} -#endif /* OPEN_INTERNAL_NAMESPACE */ - -#include <stddef.h> - -OPEN_INTERNAL_NAMESPACE - -//! Type definition for a pointer to a void somefunc(void) -typedef void (*pointer_to_handler)(); - -// Double cast through the void* from func_ptr in DLD macro is necessary to -// prevent warnings from some compilers (g++ 4.1) -#if __TBB_WEAK_SYMBOLS - -#define DLD(s,h) {(pointer_to_handler)&s, (pointer_to_handler*)(void*)(&h)} -//! Association between a handler name and location of pointer to it. -struct dynamic_link_descriptor { - //! pointer to the handler - pointer_to_handler ptr; - //! Pointer to the handler - pointer_to_handler* handler; -}; - -#else /* !__TBB_WEAK_SYMBOLS */ - -#define DLD(s,h) {#s, (pointer_to_handler*)(void*)(&h)} -//! Association between a handler name and location of pointer to it. -struct dynamic_link_descriptor { - //! Name of the handler - const char* name; - //! Pointer to the handler - pointer_to_handler* handler; -}; - -#endif /* !__TBB_WEAK_SYMBOLS */ - -//! Fill in dynamically linked handlers. -/** 'n' is the length of the array descriptors[]. - 'required' is the number of the initial entries in the array descriptors[] - that have to be found in order for the call to succeed. If the library and - all the required handlers are found, then the corresponding handler pointers - are set. Otherwise the original array of descriptors is left untouched. **/ -bool dynamic_link( const char* libraryname, - const dynamic_link_descriptor descriptors[], - size_t n, - size_t required = ~(size_t)0 ); - -CLOSE_INTERNAL_NAMESPACE - -#endif /* __TBB_dynamic_link */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/em64t-masm/atomic_support.asm b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/em64t-masm/atomic_support.asm deleted file mode 100644 index 86a240864e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/em64t-masm/atomic_support.asm +++ /dev/null @@ -1,80 +0,0 @@ -; Copyright 2005-2009 Intel Corporation. All Rights Reserved. -; -; This file is part of Threading Building Blocks. -; -; Threading Building Blocks is free software; you can redistribute it -; and/or modify it under the terms of the GNU General Public License -; version 2 as published by the Free Software Foundation. -; -; Threading Building Blocks is distributed in the hope that it will be -; useful, but WITHOUT ANY WARRANTY; without even the implied warranty -; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with Threading Building Blocks; if not, write to the Free Software -; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -; -; As a special exception, you may use this file as part of a free software -; library without restriction. Specifically, if other files instantiate -; templates or use macros or inline functions from this file, or you compile -; this file and link it with other files to produce an executable, this -; file does not by itself cause the resulting executable to be covered by -; the GNU General Public License. This exception does not however -; invalidate any other reasons why the executable file might be covered by -; the GNU General Public License. - -; DO NOT EDIT - AUTOMATICALLY GENERATED FROM .s FILE -.code - ALIGN 8 - PUBLIC __TBB_machine_fetchadd1 -__TBB_machine_fetchadd1: - mov rax,rdx - lock xadd [rcx],al - ret -.code - ALIGN 8 - PUBLIC __TBB_machine_fetchstore1 -__TBB_machine_fetchstore1: - mov rax,rdx - lock xchg [rcx],al - ret -.code - ALIGN 8 - PUBLIC __TBB_machine_cmpswp1 -__TBB_machine_cmpswp1: - mov rax,r8 - lock cmpxchg [rcx],dl - ret -.code - ALIGN 8 - PUBLIC __TBB_machine_fetchadd2 -__TBB_machine_fetchadd2: - mov rax,rdx - lock xadd [rcx],ax - ret -.code - ALIGN 8 - PUBLIC __TBB_machine_fetchstore2 -__TBB_machine_fetchstore2: - mov rax,rdx - lock xchg [rcx],ax - ret -.code - ALIGN 8 - PUBLIC __TBB_machine_cmpswp2 -__TBB_machine_cmpswp2: - mov rax,r8 - lock cmpxchg [rcx],dx - ret -.code - ALIGN 8 - PUBLIC __TBB_machine_pause -__TBB_machine_pause: -L1: - dw 090f3H; pause - add ecx,-1 - jne L1 - ret -end - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/enumerable_thread_specific.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/enumerable_thread_specific.cpp deleted file mode 100644 index f576fb3b63..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/enumerable_thread_specific.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/enumerable_thread_specific.h" -#include "tbb/concurrent_queue.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/atomic.h" -#include "tbb/spin_mutex.h" - -namespace tbb { - - namespace internal { - - // Manages fake TLS keys and fake TLS space - // Uses only a single native TLS key through use of an enumerable_thread_specific< ... , ets_key_per_instance > - class tls_single_key_manager { - - // Typedefs - typedef concurrent_vector<void *> local_vector_type; - typedef enumerable_thread_specific< local_vector_type, cache_aligned_allocator<local_vector_type>, ets_key_per_instance > my_ets_type; - typedef local_vector_type::size_type fake_key_t; - - // The fake TLS space - my_ets_type my_vectors; - - // The next never-yet-assigned fake TLS key - atomic< fake_key_t > next_key; - - // A Q of fake TLS keys that can be reused - typedef spin_mutex free_mutex_t; - free_mutex_t free_mutex; - - struct free_node_t { - fake_key_t key; - free_node_t *next; - }; - - cache_aligned_allocator< free_node_t > my_allocator; - free_node_t *free_stack; - - bool pop_if_present( fake_key_t &k ) { - free_node_t *n = NULL; - { - free_mutex_t::scoped_lock(free_mutex); - n = free_stack; - if (n) free_stack = n->next; - } - if ( n ) { - k = n->key; - my_allocator.deallocate(n,1); - return true; - } - return false; - } - - void push( fake_key_t &k ) { - free_node_t *n = my_allocator.allocate(1); - n->key = k; - { - free_mutex_t::scoped_lock(free_mutex); - n->next = free_stack; - free_stack = n; - } - } - - public: - - tls_single_key_manager() : free_stack(NULL) { - next_key = 0; - } - - ~tls_single_key_manager() { - free_node_t *n = free_stack; - while (n != NULL) { - free_node_t *next = n->next; - my_allocator.deallocate(n,1); - n = next; - } - } - - // creates or finds an available fake TLS key - inline void create_key( fake_key_t &k ) { - if ( !(free_stack && pop_if_present( k )) ) { - k = next_key.fetch_and_add(1); - } - } - - // resets the fake TLS space associated with the key and then recycles the key - inline void destroy_key( fake_key_t &k ) { - for ( my_ets_type::iterator i = my_vectors.begin(); i != my_vectors.end(); ++i ) { - local_vector_type &ivec = *i; - if (ivec.size() > k) - ivec[k] = NULL; - } - push(k); - } - - // sets the fake TLS space to point to the given value for this thread - inline void set_tls( fake_key_t &k, void *value ) { - local_vector_type &my_vector = my_vectors.local(); - local_vector_type::size_type size = my_vector.size(); - - if ( size <= k ) { - // We use grow_by so that we can initialize the pointers to NULL - my_vector.grow_by( k - size + 1, NULL ); - } - my_vector[k] = value; - } - - inline void *get_tls( fake_key_t &k ) { - local_vector_type &my_vector = my_vectors.local(); - if (my_vector.size() > k) - return my_vector[k]; - else - return NULL; - } - - }; - - // The single static instance of tls_single_key_manager - static tls_single_key_manager tls_key_manager; - - // The EXPORTED functions - void - tls_single_key_manager_v4::create_key( tls_key_t &k) { - tls_key_manager.create_key( k ); - } - - void - tls_single_key_manager_v4::destroy_key( tls_key_t &k) { - tls_key_manager.destroy_key( k ); - } - - void - tls_single_key_manager_v4::set_tls( tls_key_t &k, void *value) { - tls_key_manager.set_tls( k, value); - } - - void * - tls_single_key_manager_v4::get_tls( tls_key_t &k ) { - return tls_key_manager.get_tls( k ); - } - - } - -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/gate.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/gate.h deleted file mode 100644 index e4cf999c7e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/gate.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _TBB_Gate_H -#define _TBB_Gate_H - -#include "itt_notify.h" - -namespace tbb { - -namespace internal { - -# if __TBB_USE_FUTEX - -//! Implementation of Gate based on futex. -/** Use this futex-based implementation where possible, because it is the simplest and usually fastest. */ -class Gate { -public: - typedef intptr_t state_t; - - Gate() { - ITT_SYNC_CREATE(&state, SyncType_Scheduler, SyncObj_Gate); - } - - //! Get current state of gate - state_t get_state() const { - return state; - } - //! Update state=value if state==comparand (flip==false) or state!=comparand (flip==true) - void try_update( intptr_t value, intptr_t comparand, bool flip=false ) { - __TBB_ASSERT( comparand!=0 || value!=0, "either value or comparand must be non-zero" ); -retry: - state_t old_state = state; - // First test for condition without using atomic operation - if( flip ? old_state!=comparand : old_state==comparand ) { - // Now atomically retest condition and set. - state_t s = state.compare_and_swap( value, old_state ); - if( s==old_state ) { - // compare_and_swap succeeded - if( value!=0 ) - futex_wakeup_all( &state ); // Update was successful and new state is not SNAPSHOT_EMPTY - } else { - // compare_and_swap failed. But for != case, failure may be spurious for our purposes if - // the value there is nonetheless not equal to value. This is a fairly rare event, so - // there is no need for backoff. In event of such a failure, we must retry. - if( flip && s!=value ) - goto retry; - } - } - } - //! Wait for state!=0. - void wait() { - if( state==0 ) - futex_wait( &state, 0 ); - } -private: - atomic<state_t> state; -}; - -#elif USE_WINTHREAD - -class Gate { -public: - typedef intptr_t state_t; -private: - //! If state==0, then thread executing wait() suspend until state becomes non-zero. - state_t state; - CRITICAL_SECTION critical_section; - HANDLE event; -public: - //! Initialize with count=0 - Gate() : - state(0) - { - event = CreateEvent( NULL, true, false, NULL ); - InitializeCriticalSection( &critical_section ); - ITT_SYNC_CREATE(event, SyncType_Scheduler, SyncObj_Gate); - ITT_SYNC_CREATE(&critical_section, SyncType_Scheduler, SyncObj_GateLock); - } - ~Gate() { - CloseHandle( event ); - DeleteCriticalSection( &critical_section ); - } - //! Get current state of gate - state_t get_state() const { - return state; - } - //! Update state=value if state==comparand (flip==false) or state!=comparand (flip==true) - void try_update( intptr_t value, intptr_t comparand, bool flip=false ) { - __TBB_ASSERT( comparand!=0 || value!=0, "either value or comparand must be non-zero" ); - EnterCriticalSection( &critical_section ); - state_t old = state; - if( flip ? old!=comparand : old==comparand ) { - state = value; - if( !old ) - SetEvent( event ); - else if( !value ) - ResetEvent( event ); - } - LeaveCriticalSection( &critical_section ); - } - //! Wait for state!=0. - void wait() { - if( state==0 ) { - WaitForSingleObject( event, INFINITE ); - } - } -}; - -#elif USE_PTHREAD - -class Gate { -public: - typedef intptr_t state_t; -private: - //! If state==0, then thread executing wait() suspend until state becomes non-zero. - state_t state; - pthread_mutex_t mutex; - pthread_cond_t cond; -public: - //! Initialize with count=0 - Gate() : state(0) - { - pthread_mutex_init( &mutex, NULL ); - pthread_cond_init( &cond, NULL); - ITT_SYNC_CREATE(&cond, SyncType_Scheduler, SyncObj_Gate); - ITT_SYNC_CREATE(&mutex, SyncType_Scheduler, SyncObj_GateLock); - } - ~Gate() { - pthread_cond_destroy( &cond ); - pthread_mutex_destroy( &mutex ); - } - //! Get current state of gate - state_t get_state() const { - return state; - } - //! Update state=value if state==comparand (flip==false) or state!=comparand (flip==true) - void try_update( intptr_t value, intptr_t comparand, bool flip=false ) { - __TBB_ASSERT( comparand!=0 || value!=0, "either value or comparand must be non-zero" ); - pthread_mutex_lock( &mutex ); - state_t old = state; - if( flip ? old!=comparand : old==comparand ) { - state = value; - if( !old ) - pthread_cond_broadcast( &cond ); - } - pthread_mutex_unlock( &mutex ); - } - //! Wait for state!=0. - void wait() { - if( state==0 ) { - pthread_mutex_lock( &mutex ); - while( state==0 ) { - pthread_cond_wait( &cond, &mutex ); - } - pthread_mutex_unlock( &mutex ); - } - } -}; - -#else -#error Must define USE_PTHREAD or USE_WINTHREAD -#endif /* threading kind */ - -} // namespace Internal - -} // namespace ThreadingBuildingBlocks - -#endif /* _TBB_Gate_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/atomic_support.asm b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/atomic_support.asm deleted file mode 100644 index e22bc1cafb..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/atomic_support.asm +++ /dev/null @@ -1,196 +0,0 @@ -; Copyright 2005-2009 Intel Corporation. All Rights Reserved. -; -; This file is part of Threading Building Blocks. -; -; Threading Building Blocks is free software; you can redistribute it -; and/or modify it under the terms of the GNU General Public License -; version 2 as published by the Free Software Foundation. -; -; Threading Building Blocks is distributed in the hope that it will be -; useful, but WITHOUT ANY WARRANTY; without even the implied warranty -; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with Threading Building Blocks; if not, write to the Free Software -; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -; -; As a special exception, you may use this file as part of a free software -; library without restriction. Specifically, if other files instantiate -; templates or use macros or inline functions from this file, or you compile -; this file and link it with other files to produce an executable, this -; file does not by itself cause the resulting executable to be covered by -; the GNU General Public License. This exception does not however -; invalidate any other reasons why the executable file might be covered by -; the GNU General Public License. - -.686 -.model flat,c -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchadd1 -__TBB_machine_fetchadd1: - mov edx,4[esp] - mov eax,8[esp] - lock xadd [edx],al - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchstore1 -__TBB_machine_fetchstore1: - mov edx,4[esp] - mov eax,8[esp] - lock xchg [edx],al - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_cmpswp1 -__TBB_machine_cmpswp1: - mov edx,4[esp] - mov ecx,8[esp] - mov eax,12[esp] - lock cmpxchg [edx],cl - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchadd2 -__TBB_machine_fetchadd2: - mov edx,4[esp] - mov eax,8[esp] - lock xadd [edx],ax - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchstore2 -__TBB_machine_fetchstore2: - mov edx,4[esp] - mov eax,8[esp] - lock xchg [edx],ax - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_cmpswp2 -__TBB_machine_cmpswp2: - mov edx,4[esp] - mov ecx,8[esp] - mov eax,12[esp] - lock cmpxchg [edx],cx - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchadd4 -__TBB_machine_fetchadd4: - mov edx,4[esp] - mov eax,8[esp] - lock xadd [edx],eax - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchstore4 -__TBB_machine_fetchstore4: - mov edx,4[esp] - mov eax,8[esp] - lock xchg [edx],eax - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_cmpswp4 -__TBB_machine_cmpswp4: - mov edx,4[esp] - mov ecx,8[esp] - mov eax,12[esp] - lock cmpxchg [edx],ecx - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchadd8 -__TBB_machine_fetchadd8: - push ebx - push edi - mov edi,12[esp] - mov eax,[edi] - mov edx,4[edi] -__TBB_machine_fetchadd8_loop: - mov ebx,16[esp] - mov ecx,20[esp] - add ebx,eax - adc ecx,edx - lock cmpxchg8b qword ptr [edi] - jnz __TBB_machine_fetchadd8_loop - pop edi - pop ebx - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_fetchstore8 -__TBB_machine_fetchstore8: - push ebx - push edi - mov edi,12[esp] - mov ebx,16[esp] - mov ecx,20[esp] - mov eax,[edi] - mov edx,4[edi] -__TBB_machine_fetchstore8_loop: - lock cmpxchg8b qword ptr [edi] - jnz __TBB_machine_fetchstore8_loop - pop edi - pop ebx - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_cmpswp8 -__TBB_machine_cmpswp8: - push ebx - push edi - mov edi,12[esp] - mov ebx,16[esp] - mov ecx,20[esp] - mov eax,24[esp] - mov edx,28[esp] - lock cmpxchg8b qword ptr [edi] - pop edi - pop ebx - ret -.code - ALIGN 4 - PUBLIC c __TBB_machine_load8 -__TBB_machine_Load8: - ; If location is on stack, compiler may have failed to align it correctly, so we do dynamic check. - mov ecx,4[esp] - test ecx,7 - jne load_slow - ; Load within a cache line - sub esp,12 - fild qword ptr [ecx] - fistp qword ptr [esp] - mov eax,[esp] - mov edx,4[esp] - add esp,12 - ret -load_slow: - ; Load is misaligned. Use cmpxchg8b. - push ebx - push edi - mov edi,ecx - xor eax,eax - xor ebx,ebx - xor ecx,ecx - xor edx,edx - lock cmpxchg8b qword ptr [edi] - pop edi - pop ebx - ret -EXTRN __TBB_machine_store8_slow:PROC -.code - ALIGN 4 - PUBLIC c __TBB_machine_store8 -__TBB_machine_Store8: - ; If location is on stack, compiler may have failed to align it correctly, so we do dynamic check. - mov ecx,4[esp] - test ecx,7 - jne __TBB_machine_store8_slow ;; tail call to tbb_misc.cpp - fild qword ptr 8[esp] - fistp qword ptr [ecx] - ret -end diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/lock_byte.asm b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/lock_byte.asm deleted file mode 100644 index 4f560c487b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ia32-masm/lock_byte.asm +++ /dev/null @@ -1,46 +0,0 @@ -; Copyright 2005-2009 Intel Corporation. All Rights Reserved. -; -; This file is part of Threading Building Blocks. -; -; Threading Building Blocks is free software; you can redistribute it -; and/or modify it under the terms of the GNU General Public License -; version 2 as published by the Free Software Foundation. -; -; Threading Building Blocks is distributed in the hope that it will be -; useful, but WITHOUT ANY WARRANTY; without even the implied warranty -; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with Threading Building Blocks; if not, write to the Free Software -; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -; -; As a special exception, you may use this file as part of a free software -; library without restriction. Specifically, if other files instantiate -; templates or use macros or inline functions from this file, or you compile -; this file and link it with other files to produce an executable, this -; file does not by itself cause the resulting executable to be covered by -; the GNU General Public License. This exception does not however -; invalidate any other reasons why the executable file might be covered by -; the GNU General Public License. - -; DO NOT EDIT - AUTOMATICALLY GENERATED FROM .s FILE -.686 -.model flat,c -.code - ALIGN 4 - PUBLIC c __TBB_machine_trylockbyte -__TBB_machine_trylockbyte: - mov edx,4[esp] - mov al,[edx] - mov cl,1 - test al,1 - jnz __TBB_machine_trylockbyte_contended - lock cmpxchg [edx],cl - jne __TBB_machine_trylockbyte_contended - mov eax,1 - ret -__TBB_machine_trylockbyte_contended: - xor eax,eax - ret -end diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ibm_aix51/atomic_support.c b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ibm_aix51/atomic_support.c deleted file mode 100644 index 2e052d7725..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/ibm_aix51/atomic_support.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include <stdint.h> -#include <sys/atomic_op.h> - -/* This file must be compiled with gcc. The IBM compiler doesn't seem to - support inline assembly statements (October 2007). */ - -#ifdef __GNUC__ - -int32_t __TBB_machine_cas_32 (volatile void* ptr, int32_t value, int32_t comparand) { - __asm__ __volatile__ ("sync\n"); /* memory release operation */ - compare_and_swap ((atomic_p) ptr, &comparand, value); - __asm__ __volatile__ ("sync\n"); /* memory acquire operation */ - return comparand; -} - -int64_t __TBB_machine_cas_64 (volatile void* ptr, int64_t value, int64_t comparand) { - __asm__ __volatile__ ("sync\n"); /* memory release operation */ - compare_and_swaplp ((atomic_l) ptr, &comparand, value); - __asm__ __volatile__ ("sync\n"); /* memory acquire operation */ - return comparand; -} - -void __TBB_machine_flush () { - __asm__ __volatile__ ("sync\n"); -} - -#endif /* __GNUC__ */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/index.html b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/index.html deleted file mode 100644 index 7dd3ecd2c0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/index.html +++ /dev/null @@ -1,32 +0,0 @@ -<HTML> -<BODY> - -<H2>Overview</H2> -This directory contains the source code of the TBB core components. - -<H2>Directories</H2> -<DL> -<DT><A HREF="tools_api">tools_api</A> -<DD>Source code of the interface components provided by the Intel® Parallel Studio tools. -<DT><A HREF="em64t-masm">em64t-masm</A> -<DD>Assembly code for the Intel® 64 architecture. -<DT><A HREF="ia32-masm">ia32-masm</A> -<DD>Assembly code for IA32 architecture. -<DT><A HREF="itanium-gas">itanium-gas</A> -<DD>Assembly code for IA64 architecture. -<DT><A HREF="ibm_aix51">ibm_aix51</A> -<DD>Assembly code for AIX 5.1 port. -</DL> - -<HR> -<A HREF="../index.html">Up to parent directory</A> -<p></p> -Copyright © 2005-2009 Intel Corporation. All Rights Reserved. -<p></p> -Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are -registered trademarks or trademarks of Intel Corporation or its -subsidiaries in the United States and other countries. -<p></p> -* Other names and brands may be claimed as the property of others. -</BODY> -</HTML> diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/atomic_support.s b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/atomic_support.s deleted file mode 100644 index 17502894f5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/atomic_support.s +++ /dev/null @@ -1,678 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 - - - .proc __TBB_machine_fetchadd1__TBB_full_fence# - .global __TBB_machine_fetchadd1__TBB_full_fence# -__TBB_machine_fetchadd1__TBB_full_fence: -{ - mf - br __TBB_machine_fetchadd1acquire -} - .endp __TBB_machine_fetchadd1__TBB_full_fence# - - .proc __TBB_machine_fetchadd1acquire# - .global __TBB_machine_fetchadd1acquire# -__TBB_machine_fetchadd1acquire: - - - - - - - - ld1 r9=[r32] -;; -Retry_1acquire: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg1.acq r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_1acquire - br.ret.sptk.many b0 -# 49 "<stdin>" - .endp __TBB_machine_fetchadd1acquire# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore1__TBB_full_fence# - .global __TBB_machine_fetchstore1__TBB_full_fence# -__TBB_machine_fetchstore1__TBB_full_fence: - mf -;; - xchg1 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore1__TBB_full_fence# - - - .proc __TBB_machine_fetchstore1acquire# - .global __TBB_machine_fetchstore1acquire# -__TBB_machine_fetchstore1acquire: - xchg1 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore1acquire# -# 88 "<stdin>" - .section .text - .align 16 - - - .proc __TBB_machine_cmpswp1__TBB_full_fence# - .global __TBB_machine_cmpswp1__TBB_full_fence# -__TBB_machine_cmpswp1__TBB_full_fence: -{ - mf - br __TBB_machine_cmpswp1acquire -} - .endp __TBB_machine_cmpswp1__TBB_full_fence# - - .proc __TBB_machine_cmpswp1acquire# - .global __TBB_machine_cmpswp1acquire# -__TBB_machine_cmpswp1acquire: - - zxt1 r34=r34 -;; - - mov ar.ccv=r34 -;; - cmpxchg1.acq r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp1acquire# -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 - - - .proc __TBB_machine_fetchadd2__TBB_full_fence# - .global __TBB_machine_fetchadd2__TBB_full_fence# -__TBB_machine_fetchadd2__TBB_full_fence: -{ - mf - br __TBB_machine_fetchadd2acquire -} - .endp __TBB_machine_fetchadd2__TBB_full_fence# - - .proc __TBB_machine_fetchadd2acquire# - .global __TBB_machine_fetchadd2acquire# -__TBB_machine_fetchadd2acquire: - - - - - - - - ld2 r9=[r32] -;; -Retry_2acquire: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg2.acq r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_2acquire - br.ret.sptk.many b0 -# 49 "<stdin>" - .endp __TBB_machine_fetchadd2acquire# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore2__TBB_full_fence# - .global __TBB_machine_fetchstore2__TBB_full_fence# -__TBB_machine_fetchstore2__TBB_full_fence: - mf -;; - xchg2 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore2__TBB_full_fence# - - - .proc __TBB_machine_fetchstore2acquire# - .global __TBB_machine_fetchstore2acquire# -__TBB_machine_fetchstore2acquire: - xchg2 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore2acquire# -# 88 "<stdin>" - .section .text - .align 16 - - - .proc __TBB_machine_cmpswp2__TBB_full_fence# - .global __TBB_machine_cmpswp2__TBB_full_fence# -__TBB_machine_cmpswp2__TBB_full_fence: -{ - mf - br __TBB_machine_cmpswp2acquire -} - .endp __TBB_machine_cmpswp2__TBB_full_fence# - - .proc __TBB_machine_cmpswp2acquire# - .global __TBB_machine_cmpswp2acquire# -__TBB_machine_cmpswp2acquire: - - zxt2 r34=r34 -;; - - mov ar.ccv=r34 -;; - cmpxchg2.acq r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp2acquire# -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 - - - .proc __TBB_machine_fetchadd4__TBB_full_fence# - .global __TBB_machine_fetchadd4__TBB_full_fence# -__TBB_machine_fetchadd4__TBB_full_fence: -{ - mf - br __TBB_machine_fetchadd4acquire -} - .endp __TBB_machine_fetchadd4__TBB_full_fence# - - .proc __TBB_machine_fetchadd4acquire# - .global __TBB_machine_fetchadd4acquire# -__TBB_machine_fetchadd4acquire: - - cmp.eq p6,p0=1,r33 - cmp.eq p8,p0=-1,r33 - (p6) br.cond.dptk Inc_4acquire - (p8) br.cond.dpnt Dec_4acquire -;; - - ld4 r9=[r32] -;; -Retry_4acquire: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg4.acq r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_4acquire - br.ret.sptk.many b0 - -Inc_4acquire: - fetchadd4.acq r8=[r32],1 - br.ret.sptk.many b0 -Dec_4acquire: - fetchadd4.acq r8=[r32],-1 - br.ret.sptk.many b0 - - .endp __TBB_machine_fetchadd4acquire# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore4__TBB_full_fence# - .global __TBB_machine_fetchstore4__TBB_full_fence# -__TBB_machine_fetchstore4__TBB_full_fence: - mf -;; - xchg4 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore4__TBB_full_fence# - - - .proc __TBB_machine_fetchstore4acquire# - .global __TBB_machine_fetchstore4acquire# -__TBB_machine_fetchstore4acquire: - xchg4 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore4acquire# -# 88 "<stdin>" - .section .text - .align 16 - - - .proc __TBB_machine_cmpswp4__TBB_full_fence# - .global __TBB_machine_cmpswp4__TBB_full_fence# -__TBB_machine_cmpswp4__TBB_full_fence: -{ - mf - br __TBB_machine_cmpswp4acquire -} - .endp __TBB_machine_cmpswp4__TBB_full_fence# - - .proc __TBB_machine_cmpswp4acquire# - .global __TBB_machine_cmpswp4acquire# -__TBB_machine_cmpswp4acquire: - - zxt4 r34=r34 -;; - - mov ar.ccv=r34 -;; - cmpxchg4.acq r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp4acquire# -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 - - - .proc __TBB_machine_fetchadd8__TBB_full_fence# - .global __TBB_machine_fetchadd8__TBB_full_fence# -__TBB_machine_fetchadd8__TBB_full_fence: -{ - mf - br __TBB_machine_fetchadd8acquire -} - .endp __TBB_machine_fetchadd8__TBB_full_fence# - - .proc __TBB_machine_fetchadd8acquire# - .global __TBB_machine_fetchadd8acquire# -__TBB_machine_fetchadd8acquire: - - cmp.eq p6,p0=1,r33 - cmp.eq p8,p0=-1,r33 - (p6) br.cond.dptk Inc_8acquire - (p8) br.cond.dpnt Dec_8acquire -;; - - ld8 r9=[r32] -;; -Retry_8acquire: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg8.acq r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_8acquire - br.ret.sptk.many b0 - -Inc_8acquire: - fetchadd8.acq r8=[r32],1 - br.ret.sptk.many b0 -Dec_8acquire: - fetchadd8.acq r8=[r32],-1 - br.ret.sptk.many b0 - - .endp __TBB_machine_fetchadd8acquire# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore8__TBB_full_fence# - .global __TBB_machine_fetchstore8__TBB_full_fence# -__TBB_machine_fetchstore8__TBB_full_fence: - mf -;; - xchg8 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore8__TBB_full_fence# - - - .proc __TBB_machine_fetchstore8acquire# - .global __TBB_machine_fetchstore8acquire# -__TBB_machine_fetchstore8acquire: - xchg8 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore8acquire# -# 88 "<stdin>" - .section .text - .align 16 - - - .proc __TBB_machine_cmpswp8__TBB_full_fence# - .global __TBB_machine_cmpswp8__TBB_full_fence# -__TBB_machine_cmpswp8__TBB_full_fence: -{ - mf - br __TBB_machine_cmpswp8acquire -} - .endp __TBB_machine_cmpswp8__TBB_full_fence# - - .proc __TBB_machine_cmpswp8acquire# - .global __TBB_machine_cmpswp8acquire# -__TBB_machine_cmpswp8acquire: - - - - - mov ar.ccv=r34 -;; - cmpxchg8.acq r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp8acquire# -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 -# 19 "<stdin>" - .proc __TBB_machine_fetchadd1release# - .global __TBB_machine_fetchadd1release# -__TBB_machine_fetchadd1release: - - - - - - - - ld1 r9=[r32] -;; -Retry_1release: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg1.rel r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_1release - br.ret.sptk.many b0 -# 49 "<stdin>" - .endp __TBB_machine_fetchadd1release# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore1release# - .global __TBB_machine_fetchstore1release# -__TBB_machine_fetchstore1release: - mf -;; - xchg1 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore1release# -# 88 "<stdin>" - .section .text - .align 16 -# 101 "<stdin>" - .proc __TBB_machine_cmpswp1release# - .global __TBB_machine_cmpswp1release# -__TBB_machine_cmpswp1release: - - zxt1 r34=r34 -;; - - mov ar.ccv=r34 -;; - cmpxchg1.rel r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp1release# -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 -# 19 "<stdin>" - .proc __TBB_machine_fetchadd2release# - .global __TBB_machine_fetchadd2release# -__TBB_machine_fetchadd2release: - - - - - - - - ld2 r9=[r32] -;; -Retry_2release: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg2.rel r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_2release - br.ret.sptk.many b0 -# 49 "<stdin>" - .endp __TBB_machine_fetchadd2release# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore2release# - .global __TBB_machine_fetchstore2release# -__TBB_machine_fetchstore2release: - mf -;; - xchg2 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore2release# -# 88 "<stdin>" - .section .text - .align 16 -# 101 "<stdin>" - .proc __TBB_machine_cmpswp2release# - .global __TBB_machine_cmpswp2release# -__TBB_machine_cmpswp2release: - - zxt2 r34=r34 -;; - - mov ar.ccv=r34 -;; - cmpxchg2.rel r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp2release# -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 -# 19 "<stdin>" - .proc __TBB_machine_fetchadd4release# - .global __TBB_machine_fetchadd4release# -__TBB_machine_fetchadd4release: - - cmp.eq p6,p0=1,r33 - cmp.eq p8,p0=-1,r33 - (p6) br.cond.dptk Inc_4release - (p8) br.cond.dpnt Dec_4release -;; - - ld4 r9=[r32] -;; -Retry_4release: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg4.rel r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_4release - br.ret.sptk.many b0 - -Inc_4release: - fetchadd4.rel r8=[r32],1 - br.ret.sptk.many b0 -Dec_4release: - fetchadd4.rel r8=[r32],-1 - br.ret.sptk.many b0 - - .endp __TBB_machine_fetchadd4release# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore4release# - .global __TBB_machine_fetchstore4release# -__TBB_machine_fetchstore4release: - mf -;; - xchg4 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore4release# -# 88 "<stdin>" - .section .text - .align 16 -# 101 "<stdin>" - .proc __TBB_machine_cmpswp4release# - .global __TBB_machine_cmpswp4release# -__TBB_machine_cmpswp4release: - - zxt4 r34=r34 -;; - - mov ar.ccv=r34 -;; - cmpxchg4.rel r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp4release# -// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh -# 1 "<stdin>" -# 1 "<built-in>" -# 1 "<command line>" -# 1 "<stdin>" - - - - - - .section .text - .align 16 -# 19 "<stdin>" - .proc __TBB_machine_fetchadd8release# - .global __TBB_machine_fetchadd8release# -__TBB_machine_fetchadd8release: - - cmp.eq p6,p0=1,r33 - cmp.eq p8,p0=-1,r33 - (p6) br.cond.dptk Inc_8release - (p8) br.cond.dpnt Dec_8release -;; - - ld8 r9=[r32] -;; -Retry_8release: - mov ar.ccv=r9 - mov r8=r9; - add r10=r9,r33 -;; - cmpxchg8.rel r9=[r32],r10,ar.ccv -;; - cmp.ne p7,p0=r8,r9 - (p7) br.cond.dpnt Retry_8release - br.ret.sptk.many b0 - -Inc_8release: - fetchadd8.rel r8=[r32],1 - br.ret.sptk.many b0 -Dec_8release: - fetchadd8.rel r8=[r32],-1 - br.ret.sptk.many b0 - - .endp __TBB_machine_fetchadd8release# -# 62 "<stdin>" - .section .text - .align 16 - .proc __TBB_machine_fetchstore8release# - .global __TBB_machine_fetchstore8release# -__TBB_machine_fetchstore8release: - mf -;; - xchg8 r8=[r32],r33 - br.ret.sptk.many b0 - .endp __TBB_machine_fetchstore8release# -# 88 "<stdin>" - .section .text - .align 16 -# 101 "<stdin>" - .proc __TBB_machine_cmpswp8release# - .global __TBB_machine_cmpswp8release# -__TBB_machine_cmpswp8release: - - - - - mov ar.ccv=r34 -;; - cmpxchg8.rel r8=[r32],r33,ar.ccv - br.ret.sptk.many b0 - .endp __TBB_machine_cmpswp8release# diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/ia64_misc.s b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/ia64_misc.s deleted file mode 100644 index 999bfb9ba5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/ia64_misc.s +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - - // RSE backing store pointer retrieval - .section .text - .align 16 - .proc __TBB_get_bsp# - .global __TBB_get_bsp# -__TBB_get_bsp: - mov r8=ar.bsp - br.ret.sptk.many b0 - .endp __TBB_get_bsp# diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/lock_byte.s b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/lock_byte.s deleted file mode 100644 index e7f199d89e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/lock_byte.s +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - - // Support for class TinyLock - .section .text - .align 16 - // unsigned int __TBB_machine_trylockbyte( byte& flag ); - // r32 = address of flag - .proc __TBB_machine_trylockbyte# - .global __TBB_machine_trylockbyte# -ADDRESS_OF_FLAG=r32 -RETCODE=r8 -FLAG=r9 -BUSY=r10 -SCRATCH=r11 -__TBB_machine_trylockbyte: - ld1.acq FLAG=[ADDRESS_OF_FLAG] - mov BUSY=1 - mov RETCODE=0 -;; - cmp.ne p6,p0=0,FLAG - mov ar.ccv=r0 -(p6) br.ret.sptk.many b0 -;; - cmpxchg1.acq SCRATCH=[ADDRESS_OF_FLAG],BUSY,ar.ccv // Try to acquire lock -;; - cmp.eq p6,p0=0,SCRATCH -;; -(p6) mov RETCODE=1 - br.ret.sptk.many b0 - .endp __TBB_machine_trylockbyte# diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/log2.s b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/log2.s deleted file mode 100644 index 2a42888985..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/log2.s +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - - // Support for class ConcurrentVector - .section .text - .align 16 - // unsigned long __TBB_machine_lg( unsigned long x ); - // r32 = x - .proc __TBB_machine_lg# - .global __TBB_machine_lg# -__TBB_machine_lg: - shr r16=r32,1 // .x -;; - shr r17=r32,2 // ..x - or r32=r32,r16 // xx -;; - shr r16=r32,3 // ...xx - or r32=r32,r17 // xxx -;; - shr r17=r32,5 // .....xxx - or r32=r32,r16 // xxxxx -;; - shr r16=r32,8 // ........xxxxx - or r32=r32,r17 // xxxxxxxx -;; - shr r17=r32,13 - or r32=r32,r16 // 13x -;; - shr r16=r32,21 - or r32=r32,r17 // 21x -;; - shr r17=r32,34 - or r32=r32,r16 // 34x -;; - shr r16=r32,55 - or r32=r32,r17 // 55x -;; - or r32=r32,r16 // 64x -;; - popcnt r8=r32 -;; - add r8=-1,r8 - br.ret.sptk.many b0 - .endp __TBB_machine_lg# diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/pause.s b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/pause.s deleted file mode 100644 index bead89bcd3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itanium-gas/pause.s +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - - .section .text - .align 16 - // void __TBB_machine_pause( long count ); - // r32 = count - .proc __TBB_machine_pause# - .global __TBB_machine_pause# -count = r32 -__TBB_machine_pause: - hint.m 0 - add count=-1,count -;; - cmp.eq p6,p7=0,count -(p7) br.cond.dpnt __TBB_machine_pause -(p6) br.ret.sptk.many b0 - .endp __TBB_machine_pause# diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.cpp deleted file mode 100644 index 27ebbfff93..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "itt_notify.h" -#include "tbb/tbb_machine.h" - -#include <stdio.h> - -namespace tbb { - namespace internal { - -#if __TBB_NEW_ITT_NOTIFY -#if DO_ITT_NOTIFY - - extern "C" int __TBB_load_ittnotify(); - - bool InitializeITT () { - return __TBB_load_ittnotify() != 0; - } - - -#endif /* DO_ITT_NOTIFY */ -#endif /* __TBB_NEW_ITT_NOTIFY */ - - void itt_store_pointer_with_release_v3( void* dst, void* src ) { - ITT_NOTIFY(sync_releasing, dst); - __TBB_store_with_release(*static_cast<void**>(dst),src); - } - - void* itt_load_pointer_with_acquire_v3( const void* src ) { - void* result = __TBB_load_with_acquire(*static_cast<void*const*>(src)); - ITT_NOTIFY(sync_acquired, const_cast<void*>(src)); - return result; - } - - void* itt_load_pointer_v3( const void* src ) { - void* result = *static_cast<void*const*>(src); - return result; - } - - void itt_set_sync_name_v3( void* obj, const tchar* name) { - ITT_SYNC_RENAME(obj, name); - (void)obj, (void)name; // Prevents compiler warning when ITT support is switched off - } - - } // namespace internal -} // namespace tbb - - -#if !__TBB_NEW_ITT_NOTIFY - -#include "tbb_misc.h" -#include "dynamic_link.h" -#include "tbb/cache_aligned_allocator.h" /* NFS_MaxLineSize */ - -#if _WIN32||_WIN64 - #include <windows.h> -#else /* !WIN */ - #include <dlfcn.h> -#if __TBB_WEAK_SYMBOLS - #pragma weak __itt_notify_sync_prepare - #pragma weak __itt_notify_sync_acquired - #pragma weak __itt_notify_sync_releasing - #pragma weak __itt_notify_sync_cancel - #pragma weak __itt_thr_name_set - #pragma weak __itt_thread_set_name - #pragma weak __itt_sync_create - #pragma weak __itt_sync_rename - extern "C" { - void __itt_notify_sync_prepare(void *p); - void __itt_notify_sync_cancel(void *p); - void __itt_notify_sync_acquired(void *p); - void __itt_notify_sync_releasing(void *p); - int __itt_thr_name_set (void* p, int len); - void __itt_thread_set_name (const char* name); - void __itt_sync_create( void* obj, const char* name, const char* type, int attribute ); - void __itt_sync_rename( void* obj, const char* new_name ); - } -#endif /* __TBB_WEAK_SYMBOLS */ -#endif /* !WIN */ - -namespace tbb { -namespace internal { - -#if DO_ITT_NOTIFY - - -//! Table describing the __itt_notify handlers. -static const dynamic_link_descriptor ITT_HandlerTable[] = { - DLD( __itt_notify_sync_prepare, ITT_Handler_sync_prepare), - DLD( __itt_notify_sync_acquired, ITT_Handler_sync_acquired), - DLD( __itt_notify_sync_releasing, ITT_Handler_sync_releasing), - DLD( __itt_notify_sync_cancel, ITT_Handler_sync_cancel), -# if _WIN32||_WIN64 - DLD( __itt_thr_name_setW, ITT_Handler_thr_name_set), - DLD( __itt_thread_set_nameW, ITT_Handler_thread_set_name), -# else - DLD( __itt_thr_name_set, ITT_Handler_thr_name_set), - DLD( __itt_thread_set_name, ITT_Handler_thread_set_name), -# endif /* _WIN32 || _WIN64 */ - - -# if _WIN32||_WIN64 - DLD( __itt_sync_createW, ITT_Handler_sync_create), - DLD( __itt_sync_renameW, ITT_Handler_sync_rename) -# else - DLD( __itt_sync_create, ITT_Handler_sync_create), - DLD( __itt_sync_rename, ITT_Handler_sync_rename) -# endif -}; - -static const int ITT_HandlerTable_size = - sizeof(ITT_HandlerTable)/sizeof(dynamic_link_descriptor); - -// LIBITTNOTIFY_NAME is the name of the ITT notification library -# if _WIN32||_WIN64 -# define LIBITTNOTIFY_NAME "libittnotify.dll" -# elif __linux__ -# define LIBITTNOTIFY_NAME "libittnotify.so" -# else -# error Intel(R) Threading Tools not provided for this OS -# endif - -//! Performs tools support initialization. -/** Is called by DoOneTimeInitializations and ITT_DoOneTimeInitialization in - a protected (one-time) manner. Not to be invoked directly. **/ -bool InitializeITT() { - bool result = false; - // Check if we are running under a performance or correctness tool - bool t_checker = GetBoolEnvironmentVariable("KMP_FOR_TCHECK"); - bool t_profiler = GetBoolEnvironmentVariable("KMP_FOR_TPROFILE"); - __TBB_ASSERT(!(t_checker&&t_profiler), NULL); - if ( t_checker || t_profiler ) { - // Yes, we are in the tool mode. Try to load libittnotify library. - result = dynamic_link( LIBITTNOTIFY_NAME, ITT_HandlerTable, ITT_HandlerTable_size, 4 ); - } - if (result){ - if ( t_checker ) { - current_tool = ITC; - } else if ( t_profiler ) { - current_tool = ITP; - } - } else { - // Clear away the proxy (dummy) handlers - for (int i = 0; i < ITT_HandlerTable_size; i++) - *ITT_HandlerTable[i].handler = NULL; - current_tool = NONE; - } - PrintExtraVersionInfo( "ITT", result?"yes":"no" ); - return result; -} - -//! Performs one-time initialization of tools interoperability mechanisms. -/** Defined in task.cpp. Makes a protected do-once call to InitializeITT(). **/ -void ITT_DoOneTimeInitialization(); - -/** The following dummy_xxx functions are proxies that correspond to tool notification - APIs and are used to initialize corresponding pointers to the tool notifications - (ITT_Handler_xxx). When the first call to ITT_Handler_xxx takes place before - the whole library initialization (done by DoOneTimeInitializations) happened, - the proxy handler performs initialization of the tools support. After this - ITT_Handler_xxx will be set to either tool notification pointer or NULL. **/ -void dummy_sync_prepare( volatile void* ptr ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_sync_prepare!=&dummy_sync_prepare, NULL ); - if (ITT_Handler_sync_prepare) - (*ITT_Handler_sync_prepare) (ptr); -} - -void dummy_sync_acquired( volatile void* ptr ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_sync_acquired!=&dummy_sync_acquired, NULL ); - if (ITT_Handler_sync_acquired) - (*ITT_Handler_sync_acquired) (ptr); -} - -void dummy_sync_releasing( volatile void* ptr ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_sync_releasing!=&dummy_sync_releasing, NULL ); - if (ITT_Handler_sync_releasing) - (*ITT_Handler_sync_releasing) (ptr); -} - -void dummy_sync_cancel( volatile void* ptr ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_sync_cancel!=&dummy_sync_cancel, NULL ); - if (ITT_Handler_sync_cancel) - (*ITT_Handler_sync_cancel) (ptr); -} - -int dummy_thr_name_set( const tchar* str, int number ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_thr_name_set!=&dummy_thr_name_set, NULL ); - if (ITT_Handler_thr_name_set) - return (*ITT_Handler_thr_name_set) (str, number); - return -1; -} - -void dummy_thread_set_name( const tchar* name ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_thread_set_name!=&dummy_thread_set_name, NULL ); - if (ITT_Handler_thread_set_name) - (*ITT_Handler_thread_set_name)( name ); -} - -void dummy_sync_create( void* obj, const tchar* objname, const tchar* objtype, int /*attribute*/ ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_sync_create!=&dummy_sync_create, NULL ); - ITT_SYNC_CREATE( obj, objtype, objname ); -} - -void dummy_sync_rename( void* obj, const tchar* new_name ) { - ITT_DoOneTimeInitialization(); - __TBB_ASSERT( ITT_Handler_sync_rename!=&dummy_sync_rename, NULL ); - ITT_SYNC_RENAME(obj, new_name); -} - - - -//! Leading padding before the area where tool notification handlers are placed. -/** Prevents cache lines where the handler pointers are stored from thrashing. - Defined as extern to prevent compiler from placing the padding arrays separately - from the handler pointers (which are declared as extern). - Declared separately from definition to get rid of compiler warnings. **/ -extern char __ITT_Handler_leading_padding[NFS_MaxLineSize]; - -//! Trailing padding after the area where tool notification handlers are placed. -extern char __ITT_Handler_trailing_padding[NFS_MaxLineSize]; - -char __ITT_Handler_leading_padding[NFS_MaxLineSize] = {0}; -PointerToITT_Handler ITT_Handler_sync_prepare = &dummy_sync_prepare; -PointerToITT_Handler ITT_Handler_sync_acquired = &dummy_sync_acquired; -PointerToITT_Handler ITT_Handler_sync_releasing = &dummy_sync_releasing; -PointerToITT_Handler ITT_Handler_sync_cancel = &dummy_sync_cancel; -PointerToITT_thr_name_set ITT_Handler_thr_name_set = &dummy_thr_name_set; -PointerToITT_thread_set_name ITT_Handler_thread_set_name = &dummy_thread_set_name; -PointerToITT_sync_create ITT_Handler_sync_create = &dummy_sync_create; -PointerToITT_sync_rename ITT_Handler_sync_rename = &dummy_sync_rename; -char __ITT_Handler_trailing_padding[NFS_MaxLineSize] = {0}; - -target_tool current_tool = TO_BE_INITIALIZED; - -#endif /* DO_ITT_NOTIFY */ -} // namespace internal - -} // namespace tbb - -#endif /* !__TBB_NEW_ITT_NOTIFY */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.h deleted file mode 100644 index c5dc20b614..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _TBB_ITT_NOTIFY -#define _TBB_ITT_NOTIFY - -#include "tbb/tbb_stddef.h" - -#if DO_ITT_NOTIFY -#if __TBB_NEW_ITT_NOTIFY - -#if _WIN32||_WIN64 - #ifndef UNICODE - #define UNICODE - #endif -#endif /* WIN */ - -#include "tools_api/ittnotify.h" - -#if _WIN32||_WIN64 - #undef _T - #undef __itt_event_create - #define __itt_event_create __itt_event_createA -#endif /* WIN */ - -#endif /* __TBB_NEW_ITT_NOTIFY */ - -#endif /* DO_ITT_NOTIFY */ - -namespace tbb { -//! Unicode support -#if _WIN32||_WIN64 - //! Unicode character type. Always wchar_t on Windows. - /** We do not use typedefs from Windows TCHAR family to keep consistence of TBB coding style. **/ - typedef wchar_t tchar; - //! Standard Windows macro to markup the string literals. - #define _T(string_literal) L ## string_literal -#if !__TBB_NEW_ITT_NOTIFY - #define tstrlen wcslen -#endif /* !__TBB_NEW_ITT_NOTIFY */ -#else /* !WIN */ - typedef char tchar; - //! Standard Windows style macro to markup the string literals. - #define _T(string_literal) string_literal -#if !__TBB_NEW_ITT_NOTIFY - #define tstrlen strlen -#endif /* !__TBB_NEW_ITT_NOTIFY */ -#endif /* !WIN */ -} // namespace tbb - -#if DO_ITT_NOTIFY -namespace tbb { - //! Display names of internal synchronization types - extern const tchar - *SyncType_GlobalLock, - *SyncType_Scheduler; - //! Display names of internal synchronization components/scenarios - extern const tchar - *SyncObj_LibraryInitialization, - *SyncObj_SchedulerInitialization, - *SyncObj_SchedulersList, - *SyncObj_TaskStealingLoop, - *SyncObj_WorkerTaskPool, - *SyncObj_MasterTaskPool, - *SyncObj_GateLock, - *SyncObj_Gate, - *SyncObj_SchedulerTermination, - *SyncObj_ContextsList - ; - - namespace internal { - void __TBB_EXPORTED_FUNC itt_set_sync_name_v3( void* obj, const tchar* name); - - } // namespace internal - -} // namespace tbb - -#if __TBB_NEW_ITT_NOTIFY -// const_cast<void*>() is necessary to cast off volatility -#define ITT_NOTIFY(name,obj) __itt_notify_##name(const_cast<void*>(static_cast<volatile void*>(obj))) -#define ITT_THREAD_SET_NAME(name) __itt_thread_set_name(name) -#define ITT_SYNC_CREATE(obj, type, name) __itt_sync_create(obj, type, name, 2) -#define ITT_SYNC_RENAME(obj, name) __itt_sync_rename(obj, name) -#endif /* __TBB_NEW_ITT_NOTIFY */ - -#else /* !DO_ITT_NOTIFY */ - -#define ITT_NOTIFY(name,obj) ((void)0) -#define ITT_THREAD_SET_NAME(name) ((void)0) -#define ITT_SYNC_CREATE(obj, type, name) ((void)0) -#define ITT_SYNC_RENAME(obj, name) ((void)0) - -#endif /* !DO_ITT_NOTIFY */ - - -#if !__TBB_NEW_ITT_NOTIFY - -#if DO_ITT_NOTIFY - -namespace tbb { - -//! Identifies performance and correctness tools, which TBB sends special notifications to. -/** Enumerators must be ORable bit values. - - Initializing global tool indicator with TO_BE_INITIALIZED is required - to avoid bypassing early notification calls made through targeted macros until - initialization is performed from somewhere else. - - Yet this entails another problem. The first targeted calls that happen to go - into the proxy (dummy) handlers become promiscuous. **/ -enum target_tool { - NONE = 0ul, - ITC = 1ul, - ITP = 2ul, - TO_BE_INITIALIZED = ~0ul -}; - -namespace internal { - -//! Types of the tool notification functions (and corresponding proxy handlers). -typedef void (*PointerToITT_Handler)(volatile void*); -typedef int (*PointerToITT_thr_name_set)(const tchar*, int); -typedef void (*PointerToITT_thread_set_name)(const tchar*); - - -typedef void (*PointerToITT_sync_create)(void* obj, const tchar* type, const tchar* name, int attribute); -typedef void (*PointerToITT_sync_rename)(void* obj, const tchar* new_name); - -extern PointerToITT_Handler ITT_Handler_sync_prepare; -extern PointerToITT_Handler ITT_Handler_sync_acquired; -extern PointerToITT_Handler ITT_Handler_sync_releasing; -extern PointerToITT_Handler ITT_Handler_sync_cancel; -extern PointerToITT_thr_name_set ITT_Handler_thr_name_set; -extern PointerToITT_thread_set_name ITT_Handler_thread_set_name; -extern PointerToITT_sync_create ITT_Handler_sync_create; -extern PointerToITT_sync_rename ITT_Handler_sync_rename; - -extern target_tool current_tool; - -} // namespace internal - -} // namespace tbb - -//! Glues two tokens together. -#define ITT_HANDLER(name) tbb::internal::ITT_Handler_##name -#define CALL_ITT_HANDLER(name, arglist) ( ITT_HANDLER(name) ? (void)ITT_HANDLER(name)arglist : (void)0 ) - -//! Call routine itt_notify_(name) if corresponding handler is available. -/** For example, use ITT_NOTIFY(sync_releasing,x) to invoke __itt_notify_sync_releasing(x). - Ordinarily, preprocessor token gluing games should be avoided. - But here, it seemed to be the best way to handle the issue. */ -#define ITT_NOTIFY(name,obj) CALL_ITT_HANDLER(name,(obj)) -//! The same as ITT_NOTIFY but also checks if we are running under appropriate tool. -/** Parameter tools is an ORed set of target_tool enumerators. **/ -#define ITT_NOTIFY_TOOL(tools,name,obj) ( ITT_HANDLER(name) && ((tools) & tbb::internal::current_tool) ? ITT_HANDLER(name)(obj) : (void)0 ) - -#define ITT_THREAD_SET_NAME(name) ( \ - ITT_HANDLER(thread_set_name) ? ITT_HANDLER(thread_set_name)(name) \ - : CALL_ITT_HANDLER(thr_name_set,(name, tstrlen(name))) ) - - -/** 2 is the value of __itt_attr_mutex attribute. **/ -#define ITT_SYNC_CREATE(obj, type, name) CALL_ITT_HANDLER(sync_create,(obj, type, name, 2)) -#define ITT_SYNC_RENAME(obj, name) CALL_ITT_HANDLER(sync_rename,(obj, name)) - - - -#else /* !DO_ITT_NOTIFY */ - -#define ITT_NOTIFY_TOOL(tools,name,obj) ((void)0) - -#endif /* !DO_ITT_NOTIFY */ - -#if DO_ITT_QUIET -#define ITT_QUIET(x) (__itt_thr_mode_set(__itt_thr_prop_quiet,(x)?__itt_thr_state_set:__itt_thr_state_clr)) -#else -#define ITT_QUIET(x) ((void)0) -#endif /* DO_ITT_QUIET */ - -#endif /* !__TBB_NEW_ITT_NOTIFY */ - -#endif /* _TBB_ITT_NOTIFY */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify_proxy.c b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify_proxy.c deleted file mode 100644 index 9d4e67222e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/itt_notify_proxy.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tbb_config.h" - -/* This declaration in particular shuts up "empty translation unit" warning */ -extern int __TBB_load_ittnotify(); - -#if __TBB_NEW_ITT_NOTIFY -#if DO_ITT_NOTIFY - -#if _WIN32||_WIN64 - #ifndef UNICODE - #define UNICODE - #endif -#endif /* WIN */ - -extern void ITT_DoOneTimeInitialization(); - -#define ITT_SIMPLE_INIT 1 -#define __itt_init_lib_name ITT_DoOneTimeInitialization - -#include "tools_api/ittnotify_static.c" - -int __TBB_load_ittnotify() { - return __itt_init_lib(); -} - -#endif /* DO_ITT_NOTIFY */ -#endif /* __TBB_NEW_ITT_NOTIFY */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin32-tbb-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin32-tbb-export.def deleted file mode 100644 index 71d64d5ea4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin32-tbb-export.def +++ /dev/null @@ -1,310 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tbb_config.h" - -{ -global: - -/* cache_aligned_allocator.cpp */ -_ZN3tbb8internal12NFS_AllocateEjjPv; -_ZN3tbb8internal15NFS_GetLineSizeEv; -_ZN3tbb8internal8NFS_FreeEPv; -_ZN3tbb8internal23allocate_via_handler_v3Ej; -_ZN3tbb8internal25deallocate_via_handler_v3EPv; -_ZN3tbb8internal17is_malloc_used_v3Ev; - -/* task.cpp v3 */ -_ZN3tbb4task13note_affinityEt; -_ZN3tbb4task22internal_set_ref_countEi; -_ZN3tbb4task22spawn_and_wait_for_allERNS_9task_listE; -_ZN3tbb4task4selfEv; -_ZN3tbb4task7destroyERS0_; -_ZNK3tbb4task26is_owned_by_current_threadEv; -_ZN3tbb8internal19allocate_root_proxy4freeERNS_4taskE; -_ZN3tbb8internal19allocate_root_proxy8allocateEj; -_ZN3tbb8internal28affinity_partitioner_base_v36resizeEj; -_ZNK3tbb8internal20allocate_child_proxy4freeERNS_4taskE; -_ZNK3tbb8internal20allocate_child_proxy8allocateEj; -_ZNK3tbb8internal27allocate_continuation_proxy4freeERNS_4taskE; -_ZNK3tbb8internal27allocate_continuation_proxy8allocateEj; -_ZNK3tbb8internal34allocate_additional_child_of_proxy4freeERNS_4taskE; -_ZNK3tbb8internal34allocate_additional_child_of_proxy8allocateEj; -_ZTIN3tbb4taskE; -_ZTSN3tbb4taskE; -_ZTVN3tbb4taskE; -_ZN3tbb19task_scheduler_init19default_num_threadsEv; -_ZN3tbb19task_scheduler_init10initializeEij; -_ZN3tbb19task_scheduler_init10initializeEi; -_ZN3tbb19task_scheduler_init9terminateEv; -_ZN3tbb8internal26task_scheduler_observer_v37observeEb; -_ZN3tbb10empty_task7executeEv; -_ZN3tbb10empty_taskD0Ev; -_ZN3tbb10empty_taskD1Ev; -_ZTIN3tbb10empty_taskE; -_ZTSN3tbb10empty_taskE; -_ZTVN3tbb10empty_taskE; - -/* exception handling support */ -_ZNK3tbb8internal32allocate_root_with_context_proxy8allocateEj; -_ZNK3tbb8internal32allocate_root_with_context_proxy4freeERNS_4taskE; -_ZNK3tbb18task_group_context28is_group_execution_cancelledEv; -_ZN3tbb18task_group_context22cancel_group_executionEv; -_ZN3tbb18task_group_context5resetEv; -_ZN3tbb18task_group_context4initEv; -_ZN3tbb18task_group_contextD1Ev; -_ZN3tbb18task_group_contextD2Ev; -_ZNK3tbb18captured_exception4nameEv; -_ZNK3tbb18captured_exception4whatEv; -_ZN3tbb18captured_exception10throw_selfEv; -_ZN3tbb18captured_exception3setEPKcS2_; -_ZN3tbb18captured_exception4moveEv; -_ZN3tbb18captured_exception5clearEv; -_ZN3tbb18captured_exception7destroyEv; -_ZN3tbb18captured_exception8allocateEPKcS2_; -_ZN3tbb18captured_exceptionD0Ev; -_ZN3tbb18captured_exceptionD1Ev; -_ZTIN3tbb18captured_exceptionE; -_ZTSN3tbb18captured_exceptionE; -_ZTVN3tbb18captured_exceptionE; -_ZN3tbb13tbb_exceptionD2Ev; -_ZTIN3tbb13tbb_exceptionE; -_ZTSN3tbb13tbb_exceptionE; -_ZTVN3tbb13tbb_exceptionE; -_ZN3tbb14bad_last_allocD0Ev; -_ZN3tbb14bad_last_allocD1Ev; -_ZNK3tbb14bad_last_alloc4whatEv; -_ZTIN3tbb14bad_last_allocE; -_ZTSN3tbb14bad_last_allocE; -_ZTVN3tbb14bad_last_allocE; - -/* tbb_misc.cpp */ -_ZN3tbb17assertion_failureEPKciS1_S1_; -_ZN3tbb21set_assertion_handlerEPFvPKciS1_S1_E; -_ZN3tbb8internal36get_initial_auto_partitioner_divisorEv; -_ZN3tbb8internal13handle_perrorEiPKc; -_ZN3tbb8internal15runtime_warningEPKcz; -__TBB_machine_store8_slow_perf_warning; -__TBB_machine_store8_slow; -TBB_runtime_interface_version; - -/* itt_notify.cpp */ -_ZN3tbb8internal32itt_load_pointer_with_acquire_v3EPKv; -_ZN3tbb8internal33itt_store_pointer_with_release_v3EPvS1_; -_ZN3tbb8internal20itt_set_sync_name_v3EPvPKc; -_ZN3tbb8internal19itt_load_pointer_v3EPKv; - -/* pipeline.cpp */ -_ZTIN3tbb6filterE; -_ZTSN3tbb6filterE; -_ZTVN3tbb6filterE; -_ZN3tbb6filterD2Ev; -_ZN3tbb8pipeline10add_filterERNS_6filterE; -_ZN3tbb8pipeline12inject_tokenERNS_4taskE; -_ZN3tbb8pipeline13remove_filterERNS_6filterE; -_ZN3tbb8pipeline3runEj; -_ZN3tbb8pipeline3runEjRNS_18task_group_contextE; -_ZN3tbb8pipeline5clearEv; -_ZTIN3tbb8pipelineE; -_ZTSN3tbb8pipelineE; -_ZTVN3tbb8pipelineE; -_ZN3tbb8pipelineC1Ev; -_ZN3tbb8pipelineC2Ev; -_ZN3tbb8pipelineD0Ev; -_ZN3tbb8pipelineD1Ev; -_ZN3tbb8pipelineD2Ev; - -/* queuing_rw_mutex.cpp */ -_ZN3tbb16queuing_rw_mutex18internal_constructEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock17upgrade_to_writerEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock19downgrade_to_readerEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock7acquireERS0_b; -_ZN3tbb16queuing_rw_mutex11scoped_lock7releaseEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock11try_acquireERS0_b; - -#if !TBB_NO_LEGACY -/* spin_rw_mutex.cpp v2 */ -_ZN3tbb13spin_rw_mutex16internal_upgradeEPS0_; -_ZN3tbb13spin_rw_mutex22internal_itt_releasingEPS0_; -_ZN3tbb13spin_rw_mutex23internal_acquire_readerEPS0_; -_ZN3tbb13spin_rw_mutex23internal_acquire_writerEPS0_; -_ZN3tbb13spin_rw_mutex18internal_downgradeEPS0_; -_ZN3tbb13spin_rw_mutex23internal_release_readerEPS0_; -_ZN3tbb13spin_rw_mutex23internal_release_writerEPS0_; -_ZN3tbb13spin_rw_mutex27internal_try_acquire_readerEPS0_; -_ZN3tbb13spin_rw_mutex27internal_try_acquire_writerEPS0_; -#endif - -/* spin_rw_mutex v3 */ -_ZN3tbb16spin_rw_mutex_v318internal_constructEv; -_ZN3tbb16spin_rw_mutex_v316internal_upgradeEv; -_ZN3tbb16spin_rw_mutex_v318internal_downgradeEv; -_ZN3tbb16spin_rw_mutex_v323internal_acquire_readerEv; -_ZN3tbb16spin_rw_mutex_v323internal_acquire_writerEv; -_ZN3tbb16spin_rw_mutex_v323internal_release_readerEv; -_ZN3tbb16spin_rw_mutex_v323internal_release_writerEv; -_ZN3tbb16spin_rw_mutex_v327internal_try_acquire_readerEv; -_ZN3tbb16spin_rw_mutex_v327internal_try_acquire_writerEv; - -/* spin_mutex.cpp */ -_ZN3tbb10spin_mutex18internal_constructEv; -_ZN3tbb10spin_mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb10spin_mutex11scoped_lock16internal_releaseEv; -_ZN3tbb10spin_mutex11scoped_lock20internal_try_acquireERS0_; - -/* mutex.cpp */ -_ZN3tbb5mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb5mutex11scoped_lock16internal_releaseEv; -_ZN3tbb5mutex11scoped_lock20internal_try_acquireERS0_; -_ZN3tbb5mutex16internal_destroyEv; -_ZN3tbb5mutex18internal_constructEv; - -/* recursive_mutex.cpp */ -_ZN3tbb15recursive_mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb15recursive_mutex11scoped_lock16internal_releaseEv; -_ZN3tbb15recursive_mutex11scoped_lock20internal_try_acquireERS0_; -_ZN3tbb15recursive_mutex16internal_destroyEv; -_ZN3tbb15recursive_mutex18internal_constructEv; - -/* QueuingMutex.cpp */ -_ZN3tbb13queuing_mutex18internal_constructEv; -_ZN3tbb13queuing_mutex11scoped_lock7acquireERS0_; -_ZN3tbb13queuing_mutex11scoped_lock7releaseEv; -_ZN3tbb13queuing_mutex11scoped_lock11try_acquireERS0_; - -/* concurrent_hash_map */ -_ZNK3tbb8internal21hash_map_segment_base23internal_grow_predicateEv; - -#if !TBB_NO_LEGACY -/* concurrent_queue.cpp v2 */ -_ZN3tbb8internal21concurrent_queue_base12internal_popEPv; -_ZN3tbb8internal21concurrent_queue_base13internal_pushEPKv; -_ZN3tbb8internal21concurrent_queue_base21internal_set_capacityEij; -_ZN3tbb8internal21concurrent_queue_base23internal_pop_if_presentEPv; -_ZN3tbb8internal21concurrent_queue_base25internal_push_if_not_fullEPKv; -_ZN3tbb8internal21concurrent_queue_baseC2Ej; -_ZN3tbb8internal21concurrent_queue_baseD2Ev; -_ZTIN3tbb8internal21concurrent_queue_baseE; -_ZTSN3tbb8internal21concurrent_queue_baseE; -_ZTVN3tbb8internal21concurrent_queue_baseE; -_ZN3tbb8internal30concurrent_queue_iterator_base6assignERKS1_; -_ZN3tbb8internal30concurrent_queue_iterator_base7advanceEv; -_ZN3tbb8internal30concurrent_queue_iterator_baseC2ERKNS0_21concurrent_queue_baseE; -_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev; -_ZNK3tbb8internal21concurrent_queue_base13internal_sizeEv; -#endif - -/* concurrent_queue v3 */ -/* constructors */ -_ZN3tbb8internal24concurrent_queue_base_v3C2Ej; -_ZN3tbb8internal33concurrent_queue_iterator_base_v3C2ERKNS0_24concurrent_queue_base_v3E; -/* destructors */ -_ZN3tbb8internal24concurrent_queue_base_v3D2Ev; -_ZN3tbb8internal33concurrent_queue_iterator_base_v3D2Ev; -/* typeinfo */ -_ZTIN3tbb8internal24concurrent_queue_base_v3E; -_ZTSN3tbb8internal24concurrent_queue_base_v3E; -/* vtable */ -_ZTVN3tbb8internal24concurrent_queue_base_v3E; -/* methods */ -_ZN3tbb8internal33concurrent_queue_iterator_base_v37advanceEv; -_ZN3tbb8internal33concurrent_queue_iterator_base_v36assignERKS1_; -_ZN3tbb8internal24concurrent_queue_base_v313internal_pushEPKv; -_ZN3tbb8internal24concurrent_queue_base_v325internal_push_if_not_fullEPKv; -_ZN3tbb8internal24concurrent_queue_base_v312internal_popEPv; -_ZN3tbb8internal24concurrent_queue_base_v323internal_pop_if_presentEPv; -_ZN3tbb8internal24concurrent_queue_base_v321internal_set_capacityEij; -_ZNK3tbb8internal24concurrent_queue_base_v313internal_sizeEv; -_ZN3tbb8internal24concurrent_queue_base_v321internal_finish_clearEv; -_ZNK3tbb8internal24concurrent_queue_base_v324internal_throw_exceptionEv; -_ZN3tbb8internal24concurrent_queue_base_v36assignERKS1_; - -#if !TBB_NO_LEGACY -/* concurrent_vector.cpp v2 */ -_ZN3tbb8internal22concurrent_vector_base13internal_copyERKS1_jPFvPvPKvjE; -_ZN3tbb8internal22concurrent_vector_base14internal_clearEPFvPvjEb; -_ZN3tbb8internal22concurrent_vector_base15internal_assignERKS1_jPFvPvjEPFvS4_PKvjESA_; -_ZN3tbb8internal22concurrent_vector_base16internal_grow_byEjjPFvPvjE; -_ZN3tbb8internal22concurrent_vector_base16internal_reserveEjjj; -_ZN3tbb8internal22concurrent_vector_base18internal_push_backEjRj; -_ZN3tbb8internal22concurrent_vector_base25internal_grow_to_at_leastEjjPFvPvjE; -_ZNK3tbb8internal22concurrent_vector_base17internal_capacityEv; -#endif - -/* concurrent_vector v3 */ -_ZN3tbb8internal25concurrent_vector_base_v313internal_copyERKS1_jPFvPvPKvjE; -_ZN3tbb8internal25concurrent_vector_base_v314internal_clearEPFvPvjE; -_ZN3tbb8internal25concurrent_vector_base_v315internal_assignERKS1_jPFvPvjEPFvS4_PKvjESA_; -_ZN3tbb8internal25concurrent_vector_base_v316internal_grow_byEjjPFvPvPKvjES4_; -_ZN3tbb8internal25concurrent_vector_base_v316internal_reserveEjjj; -_ZN3tbb8internal25concurrent_vector_base_v318internal_push_backEjRj; -_ZN3tbb8internal25concurrent_vector_base_v325internal_grow_to_at_leastEjjPFvPvPKvjES4_; -_ZNK3tbb8internal25concurrent_vector_base_v317internal_capacityEv; -_ZN3tbb8internal25concurrent_vector_base_v316internal_compactEjPvPFvS2_jEPFvS2_PKvjE; -_ZN3tbb8internal25concurrent_vector_base_v313internal_swapERS1_; -_ZNK3tbb8internal25concurrent_vector_base_v324internal_throw_exceptionEj; -_ZN3tbb8internal25concurrent_vector_base_v3D2Ev; - -/* tbb_thread */ -_ZN3tbb8internal13tbb_thread_v314internal_startEPFPvS2_ES2_; -_ZN3tbb8internal13tbb_thread_v320hardware_concurrencyEv; -_ZN3tbb8internal13tbb_thread_v34joinEv; -_ZN3tbb8internal13tbb_thread_v36detachEv; -_ZN3tbb8internal15free_closure_v3EPv; -_ZN3tbb8internal15thread_sleep_v3ERKNS_10tick_count10interval_tE; -_ZN3tbb8internal15thread_yield_v3Ev; -_ZN3tbb8internal16thread_get_id_v3Ev; -_ZN3tbb8internal19allocate_closure_v3Ej; -_ZN3tbb8internal7move_v3ERNS0_13tbb_thread_v3ES2_; - -/* enumerable_thread_specific */ -_ZN3tbb8internal25tls_single_key_manager_v410create_keyERj; -_ZN3tbb8internal25tls_single_key_manager_v411destroy_keyERj; -_ZN3tbb8internal25tls_single_key_manager_v47get_tlsERj; -_ZN3tbb8internal25tls_single_key_manager_v47set_tlsERjPv; - -local: - -/* TBB symbols */ -*3tbb*; -*__TBB*; - -/* Intel Compiler (libirc) symbols */ -__intel_*; -_intel_*; -get_memcpy_largest_cachelinesize; -get_memcpy_largest_cache_size; -get_mem_ops_method; -init_mem_ops_method; -irc__get_msg; -irc__print; -override_mem_ops_method; -set_memcpy_largest_cachelinesize; -set_memcpy_largest_cache_size; - -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64-tbb-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64-tbb-export.def deleted file mode 100644 index 4e50c0c7c2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64-tbb-export.def +++ /dev/null @@ -1,305 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tbb_config.h" - -{ -global: - -/* cache_aligned_allocator.cpp */ -_ZN3tbb8internal12NFS_AllocateEmmPv; -_ZN3tbb8internal15NFS_GetLineSizeEv; -_ZN3tbb8internal8NFS_FreeEPv; -_ZN3tbb8internal23allocate_via_handler_v3Em; -_ZN3tbb8internal25deallocate_via_handler_v3EPv; -_ZN3tbb8internal17is_malloc_used_v3Ev; - -/* task.cpp v3 */ -_ZN3tbb4task13note_affinityEt; -_ZN3tbb4task22internal_set_ref_countEi; -_ZN3tbb4task22spawn_and_wait_for_allERNS_9task_listE; -_ZN3tbb4task4selfEv; -_ZN3tbb4task7destroyERS0_; -_ZNK3tbb4task26is_owned_by_current_threadEv; -_ZN3tbb8internal19allocate_root_proxy4freeERNS_4taskE; -_ZN3tbb8internal19allocate_root_proxy8allocateEm; -_ZN3tbb8internal28affinity_partitioner_base_v36resizeEj; -_ZNK3tbb8internal20allocate_child_proxy4freeERNS_4taskE; -_ZNK3tbb8internal20allocate_child_proxy8allocateEm; -_ZNK3tbb8internal27allocate_continuation_proxy4freeERNS_4taskE; -_ZNK3tbb8internal27allocate_continuation_proxy8allocateEm; -_ZNK3tbb8internal34allocate_additional_child_of_proxy4freeERNS_4taskE; -_ZNK3tbb8internal34allocate_additional_child_of_proxy8allocateEm; -_ZTIN3tbb4taskE; -_ZTSN3tbb4taskE; -_ZTVN3tbb4taskE; -_ZN3tbb19task_scheduler_init19default_num_threadsEv; -_ZN3tbb19task_scheduler_init10initializeEim; -_ZN3tbb19task_scheduler_init10initializeEi; -_ZN3tbb19task_scheduler_init9terminateEv; -_ZN3tbb8internal26task_scheduler_observer_v37observeEb; -_ZN3tbb10empty_task7executeEv; -_ZN3tbb10empty_taskD0Ev; -_ZN3tbb10empty_taskD1Ev; -_ZTIN3tbb10empty_taskE; -_ZTSN3tbb10empty_taskE; -_ZTVN3tbb10empty_taskE; - -/* exception handling support */ -_ZNK3tbb8internal32allocate_root_with_context_proxy8allocateEm; -_ZNK3tbb8internal32allocate_root_with_context_proxy4freeERNS_4taskE; -_ZNK3tbb18task_group_context28is_group_execution_cancelledEv; -_ZN3tbb18task_group_context22cancel_group_executionEv; -_ZN3tbb18task_group_context5resetEv; -_ZN3tbb18task_group_context4initEv; -_ZN3tbb18task_group_contextD1Ev; -_ZN3tbb18task_group_contextD2Ev; -_ZNK3tbb18captured_exception4nameEv; -_ZNK3tbb18captured_exception4whatEv; -_ZN3tbb18captured_exception10throw_selfEv; -_ZN3tbb18captured_exception3setEPKcS2_; -_ZN3tbb18captured_exception4moveEv; -_ZN3tbb18captured_exception5clearEv; -_ZN3tbb18captured_exception7destroyEv; -_ZN3tbb18captured_exception8allocateEPKcS2_; -_ZN3tbb18captured_exceptionD0Ev; -_ZN3tbb18captured_exceptionD1Ev; -_ZTIN3tbb18captured_exceptionE; -_ZTSN3tbb18captured_exceptionE; -_ZTVN3tbb18captured_exceptionE; -_ZN3tbb13tbb_exceptionD2Ev; -_ZTIN3tbb13tbb_exceptionE; -_ZTSN3tbb13tbb_exceptionE; -_ZTVN3tbb13tbb_exceptionE; -_ZN3tbb14bad_last_allocD0Ev; -_ZN3tbb14bad_last_allocD1Ev; -_ZNK3tbb14bad_last_alloc4whatEv; -_ZTIN3tbb14bad_last_allocE; -_ZTSN3tbb14bad_last_allocE; -_ZTVN3tbb14bad_last_allocE; - -/* tbb_misc.cpp */ -_ZN3tbb17assertion_failureEPKciS1_S1_; -_ZN3tbb21set_assertion_handlerEPFvPKciS1_S1_E; -_ZN3tbb8internal36get_initial_auto_partitioner_divisorEv; -_ZN3tbb8internal13handle_perrorEiPKc; -_ZN3tbb8internal15runtime_warningEPKcz; -TBB_runtime_interface_version; - -/* itt_notify.cpp */ -_ZN3tbb8internal32itt_load_pointer_with_acquire_v3EPKv; -_ZN3tbb8internal33itt_store_pointer_with_release_v3EPvS1_; -_ZN3tbb8internal20itt_set_sync_name_v3EPvPKc; -_ZN3tbb8internal19itt_load_pointer_v3EPKv; - -/* pipeline.cpp */ -_ZTIN3tbb6filterE; -_ZTSN3tbb6filterE; -_ZTVN3tbb6filterE; -_ZN3tbb6filterD2Ev; -_ZN3tbb8pipeline10add_filterERNS_6filterE; -_ZN3tbb8pipeline12inject_tokenERNS_4taskE; -_ZN3tbb8pipeline13remove_filterERNS_6filterE; -_ZN3tbb8pipeline3runEm; -_ZN3tbb8pipeline3runEmRNS_18task_group_contextE; -_ZN3tbb8pipeline5clearEv; -_ZTIN3tbb8pipelineE; -_ZTSN3tbb8pipelineE; -_ZTVN3tbb8pipelineE; -_ZN3tbb8pipelineC1Ev; -_ZN3tbb8pipelineC2Ev; -_ZN3tbb8pipelineD0Ev; -_ZN3tbb8pipelineD1Ev; -_ZN3tbb8pipelineD2Ev; - -/* queuing_rw_mutex.cpp */ -_ZN3tbb16queuing_rw_mutex18internal_constructEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock17upgrade_to_writerEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock19downgrade_to_readerEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock7acquireERS0_b; -_ZN3tbb16queuing_rw_mutex11scoped_lock7releaseEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock11try_acquireERS0_b; - -#if !TBB_NO_LEGACY -/* spin_rw_mutex.cpp v2 */ -_ZN3tbb13spin_rw_mutex16internal_upgradeEPS0_; -_ZN3tbb13spin_rw_mutex22internal_itt_releasingEPS0_; -_ZN3tbb13spin_rw_mutex23internal_acquire_readerEPS0_; -_ZN3tbb13spin_rw_mutex23internal_acquire_writerEPS0_; -_ZN3tbb13spin_rw_mutex18internal_downgradeEPS0_; -_ZN3tbb13spin_rw_mutex23internal_release_readerEPS0_; -_ZN3tbb13spin_rw_mutex23internal_release_writerEPS0_; -_ZN3tbb13spin_rw_mutex27internal_try_acquire_readerEPS0_; -_ZN3tbb13spin_rw_mutex27internal_try_acquire_writerEPS0_; -#endif - -/* spin_rw_mutex v3 */ -_ZN3tbb16spin_rw_mutex_v318internal_constructEv; -_ZN3tbb16spin_rw_mutex_v316internal_upgradeEv; -_ZN3tbb16spin_rw_mutex_v318internal_downgradeEv; -_ZN3tbb16spin_rw_mutex_v323internal_acquire_readerEv; -_ZN3tbb16spin_rw_mutex_v323internal_acquire_writerEv; -_ZN3tbb16spin_rw_mutex_v323internal_release_readerEv; -_ZN3tbb16spin_rw_mutex_v323internal_release_writerEv; -_ZN3tbb16spin_rw_mutex_v327internal_try_acquire_readerEv; -_ZN3tbb16spin_rw_mutex_v327internal_try_acquire_writerEv; - -/* spin_mutex.cpp */ -_ZN3tbb10spin_mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb10spin_mutex11scoped_lock16internal_releaseEv; -_ZN3tbb10spin_mutex11scoped_lock20internal_try_acquireERS0_; -_ZN3tbb10spin_mutex18internal_constructEv; - -/* mutex.cpp */ -_ZN3tbb5mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb5mutex11scoped_lock16internal_releaseEv; -_ZN3tbb5mutex11scoped_lock20internal_try_acquireERS0_; -_ZN3tbb5mutex16internal_destroyEv; -_ZN3tbb5mutex18internal_constructEv; - -/* recursive_mutex.cpp */ -_ZN3tbb15recursive_mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb15recursive_mutex11scoped_lock16internal_releaseEv; -_ZN3tbb15recursive_mutex11scoped_lock20internal_try_acquireERS0_; -_ZN3tbb15recursive_mutex16internal_destroyEv; -_ZN3tbb15recursive_mutex18internal_constructEv; - -/* QueuingMutex.cpp */ -_ZN3tbb13queuing_mutex18internal_constructEv; -_ZN3tbb13queuing_mutex11scoped_lock7acquireERS0_; -_ZN3tbb13queuing_mutex11scoped_lock7releaseEv; -_ZN3tbb13queuing_mutex11scoped_lock11try_acquireERS0_; - -/* concurrent_hash_map */ -_ZNK3tbb8internal21hash_map_segment_base23internal_grow_predicateEv; - -#if !TBB_NO_LEGACY -/* concurrent_queue.cpp v2 */ -_ZN3tbb8internal21concurrent_queue_base12internal_popEPv; -_ZN3tbb8internal21concurrent_queue_base13internal_pushEPKv; -_ZN3tbb8internal21concurrent_queue_base21internal_set_capacityElm; -_ZN3tbb8internal21concurrent_queue_base23internal_pop_if_presentEPv; -_ZN3tbb8internal21concurrent_queue_base25internal_push_if_not_fullEPKv; -_ZN3tbb8internal21concurrent_queue_baseC2Em; -_ZN3tbb8internal21concurrent_queue_baseD2Ev; -_ZTIN3tbb8internal21concurrent_queue_baseE; -_ZTSN3tbb8internal21concurrent_queue_baseE; -_ZTVN3tbb8internal21concurrent_queue_baseE; -_ZN3tbb8internal30concurrent_queue_iterator_base6assignERKS1_; -_ZN3tbb8internal30concurrent_queue_iterator_base7advanceEv; -_ZN3tbb8internal30concurrent_queue_iterator_baseC2ERKNS0_21concurrent_queue_baseE; -_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev; -_ZNK3tbb8internal21concurrent_queue_base13internal_sizeEv; -#endif - -/* concurrent_queue v3 */ -/* constructors */ -_ZN3tbb8internal24concurrent_queue_base_v3C2Em; -_ZN3tbb8internal33concurrent_queue_iterator_base_v3C2ERKNS0_24concurrent_queue_base_v3E; -/* destructors */ -_ZN3tbb8internal24concurrent_queue_base_v3D2Ev; -_ZN3tbb8internal33concurrent_queue_iterator_base_v3D2Ev; -/* typeinfo */ -_ZTIN3tbb8internal24concurrent_queue_base_v3E; -_ZTSN3tbb8internal24concurrent_queue_base_v3E; -/* vtable */ -_ZTVN3tbb8internal24concurrent_queue_base_v3E; -/* methods */ -_ZN3tbb8internal33concurrent_queue_iterator_base_v36assignERKS1_; -_ZN3tbb8internal33concurrent_queue_iterator_base_v37advanceEv; -_ZN3tbb8internal24concurrent_queue_base_v313internal_pushEPKv; -_ZN3tbb8internal24concurrent_queue_base_v325internal_push_if_not_fullEPKv; -_ZN3tbb8internal24concurrent_queue_base_v312internal_popEPv; -_ZN3tbb8internal24concurrent_queue_base_v323internal_pop_if_presentEPv; -_ZN3tbb8internal24concurrent_queue_base_v321internal_finish_clearEv; -_ZN3tbb8internal24concurrent_queue_base_v321internal_set_capacityElm; -_ZNK3tbb8internal24concurrent_queue_base_v313internal_sizeEv; -_ZNK3tbb8internal24concurrent_queue_base_v324internal_throw_exceptionEv; -_ZN3tbb8internal24concurrent_queue_base_v36assignERKS1_; - -#if !TBB_NO_LEGACY -/* concurrent_vector.cpp v2 */ -_ZN3tbb8internal22concurrent_vector_base13internal_copyERKS1_mPFvPvPKvmE; -_ZN3tbb8internal22concurrent_vector_base14internal_clearEPFvPvmEb; -_ZN3tbb8internal22concurrent_vector_base15internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_; -_ZN3tbb8internal22concurrent_vector_base16internal_grow_byEmmPFvPvmE; -_ZN3tbb8internal22concurrent_vector_base16internal_reserveEmmm; -_ZN3tbb8internal22concurrent_vector_base18internal_push_backEmRm; -_ZN3tbb8internal22concurrent_vector_base25internal_grow_to_at_leastEmmPFvPvmE; -_ZNK3tbb8internal22concurrent_vector_base17internal_capacityEv; -#endif - -/* concurrent_vector v3 */ -_ZN3tbb8internal25concurrent_vector_base_v313internal_copyERKS1_mPFvPvPKvmE; -_ZN3tbb8internal25concurrent_vector_base_v314internal_clearEPFvPvmE; -_ZN3tbb8internal25concurrent_vector_base_v315internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_; -_ZN3tbb8internal25concurrent_vector_base_v316internal_grow_byEmmPFvPvPKvmES4_; -_ZN3tbb8internal25concurrent_vector_base_v316internal_reserveEmmm; -_ZN3tbb8internal25concurrent_vector_base_v318internal_push_backEmRm; -_ZN3tbb8internal25concurrent_vector_base_v325internal_grow_to_at_leastEmmPFvPvPKvmES4_; -_ZNK3tbb8internal25concurrent_vector_base_v317internal_capacityEv; -_ZN3tbb8internal25concurrent_vector_base_v316internal_compactEmPvPFvS2_mEPFvS2_PKvmE; -_ZN3tbb8internal25concurrent_vector_base_v313internal_swapERS1_; -_ZNK3tbb8internal25concurrent_vector_base_v324internal_throw_exceptionEm; -_ZN3tbb8internal25concurrent_vector_base_v3D2Ev; - -/* tbb_thread */ -_ZN3tbb8internal13tbb_thread_v320hardware_concurrencyEv; -_ZN3tbb8internal13tbb_thread_v36detachEv; -_ZN3tbb8internal16thread_get_id_v3Ev; -_ZN3tbb8internal15free_closure_v3EPv; -_ZN3tbb8internal13tbb_thread_v34joinEv; -_ZN3tbb8internal13tbb_thread_v314internal_startEPFPvS2_ES2_; -_ZN3tbb8internal19allocate_closure_v3Em; -_ZN3tbb8internal7move_v3ERNS0_13tbb_thread_v3ES2_; -_ZN3tbb8internal15thread_yield_v3Ev; -_ZN3tbb8internal15thread_sleep_v3ERKNS_10tick_count10interval_tE; - -/* enumerable_thread_specific */ -_ZN3tbb8internal25tls_single_key_manager_v410create_keyERm; -_ZN3tbb8internal25tls_single_key_manager_v411destroy_keyERm; -_ZN3tbb8internal25tls_single_key_manager_v47get_tlsERm; -_ZN3tbb8internal25tls_single_key_manager_v47set_tlsERmPv; - -local: - -/* TBB symbols */ -*3tbb*; -*__TBB*; - -/* Intel Compiler (libirc) symbols */ -__intel_*; -_intel_*; -get_msg_buf; -get_text_buf; -message_catalog; -print_buf; -irc__get_msg; -irc__print; - -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64ipf-tbb-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64ipf-tbb-export.def deleted file mode 100644 index e511a833de..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/lin64ipf-tbb-export.def +++ /dev/null @@ -1,349 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tbb_config.h" - -{ -global: - -/* cache_aligned_allocator.cpp */ -_ZN3tbb8internal12NFS_AllocateEmmPv; -_ZN3tbb8internal15NFS_GetLineSizeEv; -_ZN3tbb8internal8NFS_FreeEPv; -_ZN3tbb8internal23allocate_via_handler_v3Em; -_ZN3tbb8internal25deallocate_via_handler_v3EPv; -_ZN3tbb8internal17is_malloc_used_v3Ev; - -/* task.cpp v3 */ -_ZN3tbb4task13note_affinityEt; -_ZN3tbb4task22internal_set_ref_countEi; -_ZN3tbb4task22spawn_and_wait_for_allERNS_9task_listE; -_ZN3tbb4task4selfEv; -_ZN3tbb4task7destroyERS0_; -_ZNK3tbb4task26is_owned_by_current_threadEv; -_ZN3tbb8internal19allocate_root_proxy4freeERNS_4taskE; -_ZN3tbb8internal19allocate_root_proxy8allocateEm; -_ZN3tbb8internal28affinity_partitioner_base_v36resizeEj; -_ZNK3tbb8internal20allocate_child_proxy4freeERNS_4taskE; -_ZNK3tbb8internal20allocate_child_proxy8allocateEm; -_ZNK3tbb8internal27allocate_continuation_proxy4freeERNS_4taskE; -_ZNK3tbb8internal27allocate_continuation_proxy8allocateEm; -_ZNK3tbb8internal34allocate_additional_child_of_proxy4freeERNS_4taskE; -_ZNK3tbb8internal34allocate_additional_child_of_proxy8allocateEm; -_ZTIN3tbb4taskE; -_ZTSN3tbb4taskE; -_ZTVN3tbb4taskE; -_ZN3tbb19task_scheduler_init19default_num_threadsEv; -_ZN3tbb19task_scheduler_init10initializeEim; -_ZN3tbb19task_scheduler_init10initializeEi; -_ZN3tbb19task_scheduler_init9terminateEv; -_ZN3tbb8internal26task_scheduler_observer_v37observeEb; -_ZN3tbb10empty_task7executeEv; -_ZN3tbb10empty_taskD0Ev; -_ZN3tbb10empty_taskD1Ev; -_ZTIN3tbb10empty_taskE; -_ZTSN3tbb10empty_taskE; -_ZTVN3tbb10empty_taskE; - -/* exception handling support */ -_ZNK3tbb8internal32allocate_root_with_context_proxy8allocateEm; -_ZNK3tbb8internal32allocate_root_with_context_proxy4freeERNS_4taskE; -_ZNK3tbb18task_group_context28is_group_execution_cancelledEv; -_ZN3tbb18task_group_context22cancel_group_executionEv; -_ZN3tbb18task_group_context5resetEv; -_ZN3tbb18task_group_context4initEv; -_ZN3tbb18task_group_contextD1Ev; -_ZN3tbb18task_group_contextD2Ev; -_ZNK3tbb18captured_exception4nameEv; -_ZNK3tbb18captured_exception4whatEv; -_ZN3tbb18captured_exception10throw_selfEv; -_ZN3tbb18captured_exception3setEPKcS2_; -_ZN3tbb18captured_exception4moveEv; -_ZN3tbb18captured_exception5clearEv; -_ZN3tbb18captured_exception7destroyEv; -_ZN3tbb18captured_exception8allocateEPKcS2_; -_ZN3tbb18captured_exceptionD0Ev; -_ZN3tbb18captured_exceptionD1Ev; -_ZTIN3tbb18captured_exceptionE; -_ZTSN3tbb18captured_exceptionE; -_ZTVN3tbb18captured_exceptionE; -_ZN3tbb13tbb_exceptionD2Ev; -_ZTIN3tbb13tbb_exceptionE; -_ZTSN3tbb13tbb_exceptionE; -_ZTVN3tbb13tbb_exceptionE; -_ZN3tbb14bad_last_allocD0Ev; -_ZN3tbb14bad_last_allocD1Ev; -_ZNK3tbb14bad_last_alloc4whatEv; -_ZTIN3tbb14bad_last_allocE; -_ZTSN3tbb14bad_last_allocE; -_ZTVN3tbb14bad_last_allocE; - -/* tbb_misc.cpp */ -_ZN3tbb17assertion_failureEPKciS1_S1_; -_ZN3tbb21set_assertion_handlerEPFvPKciS1_S1_E; -_ZN3tbb8internal36get_initial_auto_partitioner_divisorEv; -_ZN3tbb8internal13handle_perrorEiPKc; -_ZN3tbb8internal15runtime_warningEPKcz; -TBB_runtime_interface_version; - -/* itt_notify.cpp */ -_ZN3tbb8internal32itt_load_pointer_with_acquire_v3EPKv; -_ZN3tbb8internal33itt_store_pointer_with_release_v3EPvS1_; -_ZN3tbb8internal20itt_set_sync_name_v3EPvPKc; -_ZN3tbb8internal19itt_load_pointer_v3EPKv; - -/* pipeline.cpp */ -_ZTIN3tbb6filterE; -_ZTSN3tbb6filterE; -_ZTVN3tbb6filterE; -_ZN3tbb6filterD2Ev; -_ZN3tbb8pipeline10add_filterERNS_6filterE; -_ZN3tbb8pipeline12inject_tokenERNS_4taskE; -_ZN3tbb8pipeline13remove_filterERNS_6filterE; -_ZN3tbb8pipeline3runEm; -_ZN3tbb8pipeline3runEmRNS_18task_group_contextE; -_ZN3tbb8pipeline5clearEv; -_ZTIN3tbb8pipelineE; -_ZTSN3tbb8pipelineE; -_ZTVN3tbb8pipelineE; -_ZN3tbb8pipelineC1Ev; -_ZN3tbb8pipelineC2Ev; -_ZN3tbb8pipelineD0Ev; -_ZN3tbb8pipelineD1Ev; -_ZN3tbb8pipelineD2Ev; - -/* queuing_rw_mutex.cpp */ -_ZN3tbb16queuing_rw_mutex18internal_constructEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock17upgrade_to_writerEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock19downgrade_to_readerEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock7acquireERS0_b; -_ZN3tbb16queuing_rw_mutex11scoped_lock7releaseEv; -_ZN3tbb16queuing_rw_mutex11scoped_lock11try_acquireERS0_b; - -#if !TBB_NO_LEGACY -/* spin_rw_mutex.cpp v2 */ -_ZN3tbb13spin_rw_mutex16internal_upgradeEPS0_; -_ZN3tbb13spin_rw_mutex22internal_itt_releasingEPS0_; -_ZN3tbb13spin_rw_mutex23internal_acquire_readerEPS0_; -_ZN3tbb13spin_rw_mutex23internal_acquire_writerEPS0_; -_ZN3tbb13spin_rw_mutex18internal_downgradeEPS0_; -_ZN3tbb13spin_rw_mutex23internal_release_readerEPS0_; -_ZN3tbb13spin_rw_mutex23internal_release_writerEPS0_; -_ZN3tbb13spin_rw_mutex27internal_try_acquire_readerEPS0_; -_ZN3tbb13spin_rw_mutex27internal_try_acquire_writerEPS0_; -#endif - -/* spin_rw_mutex v3 */ -_ZN3tbb16spin_rw_mutex_v318internal_constructEv; -_ZN3tbb16spin_rw_mutex_v316internal_upgradeEv; -_ZN3tbb16spin_rw_mutex_v318internal_downgradeEv; -_ZN3tbb16spin_rw_mutex_v323internal_acquire_readerEv; -_ZN3tbb16spin_rw_mutex_v323internal_acquire_writerEv; -_ZN3tbb16spin_rw_mutex_v323internal_release_readerEv; -_ZN3tbb16spin_rw_mutex_v323internal_release_writerEv; -_ZN3tbb16spin_rw_mutex_v327internal_try_acquire_readerEv; -_ZN3tbb16spin_rw_mutex_v327internal_try_acquire_writerEv; - -/* spin_mutex.cpp */ -_ZN3tbb10spin_mutex18internal_constructEv; -_ZN3tbb10spin_mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb10spin_mutex11scoped_lock16internal_releaseEv; -_ZN3tbb10spin_mutex11scoped_lock20internal_try_acquireERS0_; - -/* mutex.cpp */ -_ZN3tbb5mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb5mutex11scoped_lock16internal_releaseEv; -_ZN3tbb5mutex11scoped_lock20internal_try_acquireERS0_; -_ZN3tbb5mutex16internal_destroyEv; -_ZN3tbb5mutex18internal_constructEv; - -/* recursive_mutex.cpp */ -_ZN3tbb15recursive_mutex11scoped_lock16internal_acquireERS0_; -_ZN3tbb15recursive_mutex11scoped_lock16internal_releaseEv; -_ZN3tbb15recursive_mutex11scoped_lock20internal_try_acquireERS0_; -_ZN3tbb15recursive_mutex16internal_destroyEv; -_ZN3tbb15recursive_mutex18internal_constructEv; - -/* QueuingMutex.cpp */ -_ZN3tbb13queuing_mutex18internal_constructEv; -_ZN3tbb13queuing_mutex11scoped_lock7acquireERS0_; -_ZN3tbb13queuing_mutex11scoped_lock7releaseEv; -_ZN3tbb13queuing_mutex11scoped_lock11try_acquireERS0_; - -/* concurrent_hash_map */ -_ZNK3tbb8internal21hash_map_segment_base23internal_grow_predicateEv; - -#if !TBB_NO_LEGACY -/* concurrent_queue.cpp v2 */ -_ZN3tbb8internal21concurrent_queue_base12internal_popEPv; -_ZN3tbb8internal21concurrent_queue_base13internal_pushEPKv; -_ZN3tbb8internal21concurrent_queue_base21internal_set_capacityElm; -_ZN3tbb8internal21concurrent_queue_base23internal_pop_if_presentEPv; -_ZN3tbb8internal21concurrent_queue_base25internal_push_if_not_fullEPKv; -_ZN3tbb8internal21concurrent_queue_baseC2Em; -_ZN3tbb8internal21concurrent_queue_baseD2Ev; -_ZTIN3tbb8internal21concurrent_queue_baseE; -_ZTSN3tbb8internal21concurrent_queue_baseE; -_ZTVN3tbb8internal21concurrent_queue_baseE; -_ZN3tbb8internal30concurrent_queue_iterator_base6assignERKS1_; -_ZN3tbb8internal30concurrent_queue_iterator_base7advanceEv; -_ZN3tbb8internal30concurrent_queue_iterator_baseC2ERKNS0_21concurrent_queue_baseE; -_ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev; -_ZNK3tbb8internal21concurrent_queue_base13internal_sizeEv; -#endif - -/* concurrent_queue v3 */ -/* constructors */ -_ZN3tbb8internal24concurrent_queue_base_v3C2Em; -_ZN3tbb8internal33concurrent_queue_iterator_base_v3C2ERKNS0_24concurrent_queue_base_v3E; -/* destructors */ -_ZN3tbb8internal24concurrent_queue_base_v3D2Ev; -_ZN3tbb8internal33concurrent_queue_iterator_base_v3D2Ev; -/* typeinfo */ -_ZTIN3tbb8internal24concurrent_queue_base_v3E; -_ZTSN3tbb8internal24concurrent_queue_base_v3E; -/* vtable */ -_ZTVN3tbb8internal24concurrent_queue_base_v3E; -/* methods */ -_ZN3tbb8internal33concurrent_queue_iterator_base_v36assignERKS1_; -_ZN3tbb8internal33concurrent_queue_iterator_base_v37advanceEv; -_ZN3tbb8internal24concurrent_queue_base_v313internal_pushEPKv; -_ZN3tbb8internal24concurrent_queue_base_v325internal_push_if_not_fullEPKv; -_ZN3tbb8internal24concurrent_queue_base_v312internal_popEPv; -_ZN3tbb8internal24concurrent_queue_base_v323internal_pop_if_presentEPv; -_ZN3tbb8internal24concurrent_queue_base_v321internal_finish_clearEv; -_ZN3tbb8internal24concurrent_queue_base_v321internal_set_capacityElm; -_ZNK3tbb8internal24concurrent_queue_base_v313internal_sizeEv; -_ZNK3tbb8internal24concurrent_queue_base_v324internal_throw_exceptionEv; -_ZN3tbb8internal24concurrent_queue_base_v36assignERKS1_; - -#if !TBB_NO_LEGACY -/* concurrent_vector.cpp v2 */ -_ZN3tbb8internal22concurrent_vector_base13internal_copyERKS1_mPFvPvPKvmE; -_ZN3tbb8internal22concurrent_vector_base14internal_clearEPFvPvmEb; -_ZN3tbb8internal22concurrent_vector_base15internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_; -_ZN3tbb8internal22concurrent_vector_base16internal_grow_byEmmPFvPvmE; -_ZN3tbb8internal22concurrent_vector_base16internal_reserveEmmm; -_ZN3tbb8internal22concurrent_vector_base18internal_push_backEmRm; -_ZN3tbb8internal22concurrent_vector_base25internal_grow_to_at_leastEmmPFvPvmE; -_ZNK3tbb8internal22concurrent_vector_base17internal_capacityEv; -#endif - -/* concurrent_vector v3 */ -_ZN3tbb8internal25concurrent_vector_base_v313internal_copyERKS1_mPFvPvPKvmE; -_ZN3tbb8internal25concurrent_vector_base_v314internal_clearEPFvPvmE; -_ZN3tbb8internal25concurrent_vector_base_v315internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_; -_ZN3tbb8internal25concurrent_vector_base_v316internal_grow_byEmmPFvPvPKvmES4_; -_ZN3tbb8internal25concurrent_vector_base_v316internal_reserveEmmm; -_ZN3tbb8internal25concurrent_vector_base_v318internal_push_backEmRm; -_ZN3tbb8internal25concurrent_vector_base_v325internal_grow_to_at_leastEmmPFvPvPKvmES4_; -_ZNK3tbb8internal25concurrent_vector_base_v317internal_capacityEv; -_ZN3tbb8internal25concurrent_vector_base_v316internal_compactEmPvPFvS2_mEPFvS2_PKvmE; -_ZN3tbb8internal25concurrent_vector_base_v313internal_swapERS1_; -_ZNK3tbb8internal25concurrent_vector_base_v324internal_throw_exceptionEm; -_ZN3tbb8internal25concurrent_vector_base_v3D2Ev; - -/* tbb_thread */ -_ZN3tbb8internal13tbb_thread_v320hardware_concurrencyEv; -_ZN3tbb8internal13tbb_thread_v36detachEv; -_ZN3tbb8internal16thread_get_id_v3Ev; -_ZN3tbb8internal15free_closure_v3EPv; -_ZN3tbb8internal13tbb_thread_v34joinEv; -_ZN3tbb8internal13tbb_thread_v314internal_startEPFPvS2_ES2_; -_ZN3tbb8internal19allocate_closure_v3Em; -_ZN3tbb8internal7move_v3ERNS0_13tbb_thread_v3ES2_; -_ZN3tbb8internal15thread_yield_v3Ev; -_ZN3tbb8internal15thread_sleep_v3ERKNS_10tick_count10interval_tE; - -/* enumerable_thread_specific */ -_ZN3tbb8internal25tls_single_key_manager_v410create_keyERm; -_ZN3tbb8internal25tls_single_key_manager_v411destroy_keyERm; -_ZN3tbb8internal25tls_single_key_manager_v47get_tlsERm; -_ZN3tbb8internal25tls_single_key_manager_v47set_tlsERmPv; - -/* asm functions */ -__TBB_machine_fetchadd1__TBB_full_fence; -__TBB_machine_fetchadd2__TBB_full_fence; -__TBB_machine_fetchadd4__TBB_full_fence; -__TBB_machine_fetchadd8__TBB_full_fence; -__TBB_machine_fetchstore1__TBB_full_fence; -__TBB_machine_fetchstore2__TBB_full_fence; -__TBB_machine_fetchstore4__TBB_full_fence; -__TBB_machine_fetchstore8__TBB_full_fence; -__TBB_machine_fetchadd1acquire; -__TBB_machine_fetchadd1release; -__TBB_machine_fetchadd2acquire; -__TBB_machine_fetchadd2release; -__TBB_machine_fetchadd4acquire; -__TBB_machine_fetchadd4release; -__TBB_machine_fetchadd8acquire; -__TBB_machine_fetchadd8release; -__TBB_machine_fetchstore1acquire; -__TBB_machine_fetchstore1release; -__TBB_machine_fetchstore2acquire; -__TBB_machine_fetchstore2release; -__TBB_machine_fetchstore4acquire; -__TBB_machine_fetchstore4release; -__TBB_machine_fetchstore8acquire; -__TBB_machine_fetchstore8release; -__TBB_machine_cmpswp1acquire; -__TBB_machine_cmpswp1release; -__TBB_machine_cmpswp1__TBB_full_fence; -__TBB_machine_cmpswp2acquire; -__TBB_machine_cmpswp2release; -__TBB_machine_cmpswp2__TBB_full_fence; -__TBB_machine_cmpswp4acquire; -__TBB_machine_cmpswp4release; -__TBB_machine_cmpswp4__TBB_full_fence; -__TBB_machine_cmpswp8acquire; -__TBB_machine_cmpswp8release; -__TBB_machine_cmpswp8__TBB_full_fence; -__TBB_machine_lg; -__TBB_machine_lockbyte; -__TBB_machine_pause; -__TBB_machine_trylockbyte; - -local: - -/* TBB symbols */ -*3tbb*; -*__TBB*; - -/* Intel Compiler (libirc) symbols */ -__intel_*; -_intel_*; -?0_memcopyA; -?0_memcopyDu; -?0_memcpyD; -?1__memcpy; -?1__memmove; -?1__serial_memmove; -memcpy; -memset; - -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac32-tbb-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac32-tbb-export.def deleted file mode 100644 index 264d3a97e3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac32-tbb-export.def +++ /dev/null @@ -1,292 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# cache_aligned_allocator.cpp -__ZN3tbb8internal12NFS_AllocateEmmPv -__ZN3tbb8internal15NFS_GetLineSizeEv -__ZN3tbb8internal8NFS_FreeEPv -__ZN3tbb8internal23allocate_via_handler_v3Em -__ZN3tbb8internal25deallocate_via_handler_v3EPv -__ZN3tbb8internal17is_malloc_used_v3Ev - -# task.cpp v3 -__ZN3tbb4task13note_affinityEt -__ZN3tbb4task22internal_set_ref_countEi -__ZN3tbb4task22spawn_and_wait_for_allERNS_9task_listE -__ZN3tbb4task4selfEv -__ZN3tbb4task7destroyERS0_ -__ZNK3tbb4task26is_owned_by_current_threadEv -__ZN3tbb8internal19allocate_root_proxy4freeERNS_4taskE -__ZN3tbb8internal19allocate_root_proxy8allocateEm -__ZN3tbb8internal28affinity_partitioner_base_v36resizeEj -__ZN3tbb8internal36get_initial_auto_partitioner_divisorEv -__ZNK3tbb8internal20allocate_child_proxy4freeERNS_4taskE -__ZNK3tbb8internal20allocate_child_proxy8allocateEm -__ZNK3tbb8internal27allocate_continuation_proxy4freeERNS_4taskE -__ZNK3tbb8internal27allocate_continuation_proxy8allocateEm -__ZNK3tbb8internal34allocate_additional_child_of_proxy4freeERNS_4taskE -__ZNK3tbb8internal34allocate_additional_child_of_proxy8allocateEm -__ZTIN3tbb4taskE -__ZTSN3tbb4taskE -__ZTVN3tbb4taskE -__ZN3tbb19task_scheduler_init19default_num_threadsEv -__ZN3tbb19task_scheduler_init10initializeEim -__ZN3tbb19task_scheduler_init10initializeEi -__ZN3tbb19task_scheduler_init9terminateEv -__ZN3tbb8internal26task_scheduler_observer_v37observeEb -__ZN3tbb10empty_task7executeEv -__ZN3tbb10empty_taskD0Ev -__ZN3tbb10empty_taskD1Ev -__ZTIN3tbb10empty_taskE -__ZTSN3tbb10empty_taskE -__ZTVN3tbb10empty_taskE - -# exception handling support -__ZNK3tbb8internal32allocate_root_with_context_proxy8allocateEm -__ZNK3tbb8internal32allocate_root_with_context_proxy4freeERNS_4taskE -__ZNK3tbb18task_group_context28is_group_execution_cancelledEv -__ZN3tbb18task_group_context22cancel_group_executionEv -__ZN3tbb18task_group_context5resetEv -__ZN3tbb18task_group_context4initEv -__ZN3tbb18task_group_contextD1Ev -__ZN3tbb18task_group_contextD2Ev -__ZNK3tbb18captured_exception4nameEv -__ZNK3tbb18captured_exception4whatEv -__ZN3tbb18captured_exception10throw_selfEv -__ZN3tbb18captured_exception3setEPKcS2_ -__ZN3tbb18captured_exception4moveEv -__ZN3tbb18captured_exception5clearEv -__ZN3tbb18captured_exception7destroyEv -__ZN3tbb18captured_exception8allocateEPKcS2_ -__ZN3tbb18captured_exceptionD0Ev -__ZN3tbb18captured_exceptionD1Ev -__ZTIN3tbb18captured_exceptionE -__ZTSN3tbb18captured_exceptionE -__ZTVN3tbb18captured_exceptionE -__ZTIN3tbb13tbb_exceptionE -__ZTSN3tbb13tbb_exceptionE -__ZTVN3tbb13tbb_exceptionE -__ZN3tbb14bad_last_allocD0Ev -__ZN3tbb14bad_last_allocD1Ev -__ZNK3tbb14bad_last_alloc4whatEv -__ZTIN3tbb14bad_last_allocE -__ZTSN3tbb14bad_last_allocE -__ZTVN3tbb14bad_last_allocE - -# Symbols for std exception classes thrown from TBB -__ZNSt11range_errorD1Ev -__ZNSt12length_errorD1Ev -__ZNSt12out_of_rangeD1Ev -__ZTISt11range_error -__ZTISt12length_error -__ZTISt12out_of_range -__ZTSSt11range_error -__ZTSSt12length_error -__ZTSSt12out_of_range - -# tbb_misc.cpp -__ZN3tbb17assertion_failureEPKciS1_S1_ -__ZN3tbb21set_assertion_handlerEPFvPKciS1_S1_E -__ZN3tbb8internal13handle_perrorEiPKc -__ZN3tbb8internal15runtime_warningEPKcz -___TBB_machine_store8_slow_perf_warning -___TBB_machine_store8_slow -_TBB_runtime_interface_version - -# itt_notify.cpp -__ZN3tbb8internal32itt_load_pointer_with_acquire_v3EPKv -__ZN3tbb8internal33itt_store_pointer_with_release_v3EPvS1_ -__ZN3tbb8internal19itt_load_pointer_v3EPKv -__ZN3tbb8internal20itt_set_sync_name_v3EPvPKc - -# pipeline.cpp -__ZTIN3tbb6filterE -__ZTSN3tbb6filterE -__ZTVN3tbb6filterE -__ZN3tbb6filterD2Ev -__ZN3tbb8pipeline10add_filterERNS_6filterE -__ZN3tbb8pipeline12inject_tokenERNS_4taskE -__ZN3tbb8pipeline13remove_filterERNS_6filterE -__ZN3tbb8pipeline3runEm -__ZN3tbb8pipeline3runEmRNS_18task_group_contextE -__ZN3tbb8pipeline5clearEv -__ZN3tbb8pipelineC1Ev -__ZN3tbb8pipelineC2Ev -__ZN3tbb8pipelineD0Ev -__ZN3tbb8pipelineD1Ev -__ZN3tbb8pipelineD2Ev -__ZTIN3tbb8pipelineE -__ZTSN3tbb8pipelineE -__ZTVN3tbb8pipelineE - -# queuing_rw_mutex.cpp -__ZN3tbb16queuing_rw_mutex11scoped_lock17upgrade_to_writerEv -__ZN3tbb16queuing_rw_mutex11scoped_lock19downgrade_to_readerEv -__ZN3tbb16queuing_rw_mutex11scoped_lock7acquireERS0_b -__ZN3tbb16queuing_rw_mutex11scoped_lock7releaseEv -__ZN3tbb16queuing_rw_mutex11scoped_lock11try_acquireERS0_b -__ZN3tbb16queuing_rw_mutex18internal_constructEv - -#if !TBB_NO_LEGACY -# spin_rw_mutex.cpp v2 -__ZN3tbb13spin_rw_mutex16internal_upgradeEPS0_ -__ZN3tbb13spin_rw_mutex22internal_itt_releasingEPS0_ -__ZN3tbb13spin_rw_mutex23internal_acquire_readerEPS0_ -__ZN3tbb13spin_rw_mutex23internal_acquire_writerEPS0_ -__ZN3tbb13spin_rw_mutex18internal_downgradeEPS0_ -__ZN3tbb13spin_rw_mutex23internal_release_readerEPS0_ -__ZN3tbb13spin_rw_mutex23internal_release_writerEPS0_ -__ZN3tbb13spin_rw_mutex27internal_try_acquire_readerEPS0_ -__ZN3tbb13spin_rw_mutex27internal_try_acquire_writerEPS0_ -#endif - -# spin_rw_mutex v3 -__ZN3tbb16spin_rw_mutex_v316internal_upgradeEv -__ZN3tbb16spin_rw_mutex_v318internal_downgradeEv -__ZN3tbb16spin_rw_mutex_v323internal_acquire_readerEv -__ZN3tbb16spin_rw_mutex_v323internal_acquire_writerEv -__ZN3tbb16spin_rw_mutex_v323internal_release_readerEv -__ZN3tbb16spin_rw_mutex_v323internal_release_writerEv -__ZN3tbb16spin_rw_mutex_v327internal_try_acquire_readerEv -__ZN3tbb16spin_rw_mutex_v327internal_try_acquire_writerEv -__ZN3tbb16spin_rw_mutex_v318internal_constructEv - -# spin_mutex.cpp -__ZN3tbb10spin_mutex11scoped_lock16internal_acquireERS0_ -__ZN3tbb10spin_mutex11scoped_lock16internal_releaseEv -__ZN3tbb10spin_mutex11scoped_lock20internal_try_acquireERS0_ -__ZN3tbb10spin_mutex18internal_constructEv - -# mutex.cpp -__ZN3tbb5mutex11scoped_lock16internal_acquireERS0_ -__ZN3tbb5mutex11scoped_lock16internal_releaseEv -__ZN3tbb5mutex11scoped_lock20internal_try_acquireERS0_ -__ZN3tbb5mutex16internal_destroyEv -__ZN3tbb5mutex18internal_constructEv - -# recursive_mutex.cpp -__ZN3tbb15recursive_mutex11scoped_lock16internal_acquireERS0_ -__ZN3tbb15recursive_mutex11scoped_lock16internal_releaseEv -__ZN3tbb15recursive_mutex11scoped_lock20internal_try_acquireERS0_ -__ZN3tbb15recursive_mutex16internal_destroyEv -__ZN3tbb15recursive_mutex18internal_constructEv - -# queuing_mutex.cpp -__ZN3tbb13queuing_mutex11scoped_lock7acquireERS0_ -__ZN3tbb13queuing_mutex11scoped_lock7releaseEv -__ZN3tbb13queuing_mutex11scoped_lock11try_acquireERS0_ -__ZN3tbb13queuing_mutex18internal_constructEv - -# concurrent_hash_map -__ZNK3tbb8internal21hash_map_segment_base23internal_grow_predicateEv - -#if !TBB_NO_LEGACY -# concurrent_queue.cpp v2 -__ZN3tbb8internal21concurrent_queue_base12internal_popEPv -__ZN3tbb8internal21concurrent_queue_base13internal_pushEPKv -__ZN3tbb8internal21concurrent_queue_base21internal_set_capacityEim -__ZN3tbb8internal21concurrent_queue_base23internal_pop_if_presentEPv -__ZN3tbb8internal21concurrent_queue_base25internal_push_if_not_fullEPKv -__ZN3tbb8internal21concurrent_queue_baseC2Em -__ZN3tbb8internal21concurrent_queue_baseD2Ev -__ZTIN3tbb8internal21concurrent_queue_baseE -__ZTSN3tbb8internal21concurrent_queue_baseE -__ZTVN3tbb8internal21concurrent_queue_baseE -__ZN3tbb8internal30concurrent_queue_iterator_base6assignERKS1_ -__ZN3tbb8internal30concurrent_queue_iterator_base7advanceEv -__ZN3tbb8internal30concurrent_queue_iterator_baseC2ERKNS0_21concurrent_queue_baseE -__ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev -__ZNK3tbb8internal21concurrent_queue_base13internal_sizeEv -#endif - -# concurrent_queue v3 -# constructors -__ZN3tbb8internal33concurrent_queue_iterator_base_v3C2ERKNS0_24concurrent_queue_base_v3E -__ZN3tbb8internal24concurrent_queue_base_v3C2Em -# destructors -__ZN3tbb8internal33concurrent_queue_iterator_base_v3D2Ev -__ZN3tbb8internal24concurrent_queue_base_v3D2Ev -# typeinfo -__ZTIN3tbb8internal24concurrent_queue_base_v3E -__ZTSN3tbb8internal24concurrent_queue_base_v3E -#vtable -__ZTVN3tbb8internal24concurrent_queue_base_v3E -# methods -__ZN3tbb8internal33concurrent_queue_iterator_base_v37advanceEv -__ZN3tbb8internal33concurrent_queue_iterator_base_v36assignERKS1_ -__ZN3tbb8internal24concurrent_queue_base_v313internal_pushEPKv -__ZN3tbb8internal24concurrent_queue_base_v325internal_push_if_not_fullEPKv -__ZN3tbb8internal24concurrent_queue_base_v312internal_popEPv -__ZN3tbb8internal24concurrent_queue_base_v323internal_pop_if_presentEPv -__ZN3tbb8internal24concurrent_queue_base_v321internal_set_capacityEim -__ZNK3tbb8internal24concurrent_queue_base_v313internal_sizeEv -__ZN3tbb8internal24concurrent_queue_base_v321internal_finish_clearEv -__ZNK3tbb8internal24concurrent_queue_base_v324internal_throw_exceptionEv -__ZN3tbb8internal24concurrent_queue_base_v36assignERKS1_ - -#if !TBB_NO_LEGACY -# concurrent_vector.cpp v2 -__ZN3tbb8internal22concurrent_vector_base13internal_copyERKS1_mPFvPvPKvmE -__ZN3tbb8internal22concurrent_vector_base14internal_clearEPFvPvmEb -__ZN3tbb8internal22concurrent_vector_base15internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_ -__ZN3tbb8internal22concurrent_vector_base16internal_grow_byEmmPFvPvmE -__ZN3tbb8internal22concurrent_vector_base16internal_reserveEmmm -__ZN3tbb8internal22concurrent_vector_base18internal_push_backEmRm -__ZN3tbb8internal22concurrent_vector_base25internal_grow_to_at_leastEmmPFvPvmE -__ZNK3tbb8internal22concurrent_vector_base17internal_capacityEv -#endif - -# concurrent_vector v3 -__ZN3tbb8internal25concurrent_vector_base_v313internal_copyERKS1_mPFvPvPKvmE -__ZN3tbb8internal25concurrent_vector_base_v314internal_clearEPFvPvmE -__ZN3tbb8internal25concurrent_vector_base_v315internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_ -__ZN3tbb8internal25concurrent_vector_base_v316internal_grow_byEmmPFvPvPKvmES4_ -__ZN3tbb8internal25concurrent_vector_base_v316internal_reserveEmmm -__ZN3tbb8internal25concurrent_vector_base_v318internal_push_backEmRm -__ZN3tbb8internal25concurrent_vector_base_v325internal_grow_to_at_leastEmmPFvPvPKvmES4_ -__ZNK3tbb8internal25concurrent_vector_base_v317internal_capacityEv -__ZN3tbb8internal25concurrent_vector_base_v316internal_compactEmPvPFvS2_mEPFvS2_PKvmE -__ZN3tbb8internal25concurrent_vector_base_v313internal_swapERS1_ -__ZNK3tbb8internal25concurrent_vector_base_v324internal_throw_exceptionEm -__ZN3tbb8internal25concurrent_vector_base_v3D2Ev - -# tbb_thread -__ZN3tbb8internal13tbb_thread_v314internal_startEPFPvS2_ES2_ -__ZN3tbb8internal13tbb_thread_v320hardware_concurrencyEv -__ZN3tbb8internal13tbb_thread_v34joinEv -__ZN3tbb8internal13tbb_thread_v36detachEv -__ZN3tbb8internal15free_closure_v3EPv -__ZN3tbb8internal15thread_sleep_v3ERKNS_10tick_count10interval_tE -__ZN3tbb8internal15thread_yield_v3Ev -__ZN3tbb8internal16thread_get_id_v3Ev -__ZN3tbb8internal19allocate_closure_v3Em -__ZN3tbb8internal7move_v3ERNS0_13tbb_thread_v3ES2_ - -# enumerable_thread_specific -__ZN3tbb8internal25tls_single_key_manager_v410create_keyERm -__ZN3tbb8internal25tls_single_key_manager_v411destroy_keyERm -__ZN3tbb8internal25tls_single_key_manager_v47get_tlsERm -__ZN3tbb8internal25tls_single_key_manager_v47set_tlsERmPv diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac64-tbb-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac64-tbb-export.def deleted file mode 100644 index 3ee7200590..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mac64-tbb-export.def +++ /dev/null @@ -1,290 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# cache_aligned_allocator.cpp -__ZN3tbb8internal12NFS_AllocateEmmPv -__ZN3tbb8internal15NFS_GetLineSizeEv -__ZN3tbb8internal8NFS_FreeEPv -__ZN3tbb8internal23allocate_via_handler_v3Em -__ZN3tbb8internal25deallocate_via_handler_v3EPv -__ZN3tbb8internal17is_malloc_used_v3Ev - -# task.cpp v3 -__ZN3tbb4task13note_affinityEt -__ZN3tbb4task22internal_set_ref_countEi -__ZN3tbb4task22spawn_and_wait_for_allERNS_9task_listE -__ZN3tbb4task4selfEv -__ZN3tbb4task7destroyERS0_ -__ZNK3tbb4task26is_owned_by_current_threadEv -__ZN3tbb8internal19allocate_root_proxy4freeERNS_4taskE -__ZN3tbb8internal19allocate_root_proxy8allocateEm -__ZN3tbb8internal28affinity_partitioner_base_v36resizeEj -__ZN3tbb8internal36get_initial_auto_partitioner_divisorEv -__ZNK3tbb8internal20allocate_child_proxy4freeERNS_4taskE -__ZNK3tbb8internal20allocate_child_proxy8allocateEm -__ZNK3tbb8internal27allocate_continuation_proxy4freeERNS_4taskE -__ZNK3tbb8internal27allocate_continuation_proxy8allocateEm -__ZNK3tbb8internal34allocate_additional_child_of_proxy4freeERNS_4taskE -__ZNK3tbb8internal34allocate_additional_child_of_proxy8allocateEm -__ZTIN3tbb4taskE -__ZTSN3tbb4taskE -__ZTVN3tbb4taskE -__ZN3tbb19task_scheduler_init19default_num_threadsEv -__ZN3tbb19task_scheduler_init10initializeEim -__ZN3tbb19task_scheduler_init10initializeEi -__ZN3tbb19task_scheduler_init9terminateEv -__ZN3tbb8internal26task_scheduler_observer_v37observeEb -__ZN3tbb10empty_task7executeEv -__ZN3tbb10empty_taskD0Ev -__ZN3tbb10empty_taskD1Ev -__ZTIN3tbb10empty_taskE -__ZTSN3tbb10empty_taskE -__ZTVN3tbb10empty_taskE - -# exception handling support -__ZNK3tbb8internal32allocate_root_with_context_proxy8allocateEm -__ZNK3tbb8internal32allocate_root_with_context_proxy4freeERNS_4taskE -__ZNK3tbb18task_group_context28is_group_execution_cancelledEv -__ZN3tbb18task_group_context22cancel_group_executionEv -__ZN3tbb18task_group_context5resetEv -__ZN3tbb18task_group_context4initEv -__ZN3tbb18task_group_contextD1Ev -__ZN3tbb18task_group_contextD2Ev -__ZNK3tbb18captured_exception4nameEv -__ZNK3tbb18captured_exception4whatEv -__ZN3tbb18captured_exception10throw_selfEv -__ZN3tbb18captured_exception3setEPKcS2_ -__ZN3tbb18captured_exception4moveEv -__ZN3tbb18captured_exception5clearEv -__ZN3tbb18captured_exception7destroyEv -__ZN3tbb18captured_exception8allocateEPKcS2_ -__ZN3tbb18captured_exceptionD0Ev -__ZN3tbb18captured_exceptionD1Ev -__ZTIN3tbb18captured_exceptionE -__ZTSN3tbb18captured_exceptionE -__ZTVN3tbb18captured_exceptionE -__ZTIN3tbb13tbb_exceptionE -__ZTSN3tbb13tbb_exceptionE -__ZTVN3tbb13tbb_exceptionE -__ZN3tbb14bad_last_allocD0Ev -__ZN3tbb14bad_last_allocD1Ev -__ZNK3tbb14bad_last_alloc4whatEv -__ZTIN3tbb14bad_last_allocE -__ZTSN3tbb14bad_last_allocE -__ZTVN3tbb14bad_last_allocE - -# Symbols for std exception classes thrown from TBB -__ZNSt11range_errorD1Ev -__ZNSt12length_errorD1Ev -__ZNSt12out_of_rangeD1Ev -__ZTISt11range_error -__ZTISt12length_error -__ZTISt12out_of_range -__ZTSSt11range_error -__ZTSSt12length_error -__ZTSSt12out_of_range - -# tbb_misc.cpp -__ZN3tbb17assertion_failureEPKciS1_S1_ -__ZN3tbb21set_assertion_handlerEPFvPKciS1_S1_E -__ZN3tbb8internal13handle_perrorEiPKc -__ZN3tbb8internal15runtime_warningEPKcz -_TBB_runtime_interface_version - -# itt_notify.cpp -__ZN3tbb8internal32itt_load_pointer_with_acquire_v3EPKv -__ZN3tbb8internal33itt_store_pointer_with_release_v3EPvS1_ -__ZN3tbb8internal19itt_load_pointer_v3EPKv -__ZN3tbb8internal20itt_set_sync_name_v3EPvPKc - -# pipeline.cpp -__ZTIN3tbb6filterE -__ZTSN3tbb6filterE -__ZTVN3tbb6filterE -__ZN3tbb6filterD2Ev -__ZN3tbb8pipeline10add_filterERNS_6filterE -__ZN3tbb8pipeline12inject_tokenERNS_4taskE -__ZN3tbb8pipeline13remove_filterERNS_6filterE -__ZN3tbb8pipeline3runEm -__ZN3tbb8pipeline3runEmRNS_18task_group_contextE -__ZN3tbb8pipeline5clearEv -__ZN3tbb8pipelineC1Ev -__ZN3tbb8pipelineC2Ev -__ZN3tbb8pipelineD0Ev -__ZN3tbb8pipelineD1Ev -__ZN3tbb8pipelineD2Ev -__ZTIN3tbb8pipelineE -__ZTSN3tbb8pipelineE -__ZTVN3tbb8pipelineE - -# queuing_rw_mutex.cpp -__ZN3tbb16queuing_rw_mutex11scoped_lock17upgrade_to_writerEv -__ZN3tbb16queuing_rw_mutex11scoped_lock19downgrade_to_readerEv -__ZN3tbb16queuing_rw_mutex11scoped_lock7acquireERS0_b -__ZN3tbb16queuing_rw_mutex11scoped_lock7releaseEv -__ZN3tbb16queuing_rw_mutex11scoped_lock11try_acquireERS0_b -__ZN3tbb16queuing_rw_mutex18internal_constructEv - -#if !TBB_NO_LEGACY -# spin_rw_mutex.cpp v2 -__ZN3tbb13spin_rw_mutex16internal_upgradeEPS0_ -__ZN3tbb13spin_rw_mutex22internal_itt_releasingEPS0_ -__ZN3tbb13spin_rw_mutex23internal_acquire_readerEPS0_ -__ZN3tbb13spin_rw_mutex23internal_acquire_writerEPS0_ -__ZN3tbb13spin_rw_mutex18internal_downgradeEPS0_ -__ZN3tbb13spin_rw_mutex23internal_release_readerEPS0_ -__ZN3tbb13spin_rw_mutex23internal_release_writerEPS0_ -__ZN3tbb13spin_rw_mutex27internal_try_acquire_readerEPS0_ -__ZN3tbb13spin_rw_mutex27internal_try_acquire_writerEPS0_ -#endif - -# spin_rw_mutex v3 -__ZN3tbb16spin_rw_mutex_v316internal_upgradeEv -__ZN3tbb16spin_rw_mutex_v318internal_downgradeEv -__ZN3tbb16spin_rw_mutex_v323internal_acquire_readerEv -__ZN3tbb16spin_rw_mutex_v323internal_acquire_writerEv -__ZN3tbb16spin_rw_mutex_v323internal_release_readerEv -__ZN3tbb16spin_rw_mutex_v323internal_release_writerEv -__ZN3tbb16spin_rw_mutex_v327internal_try_acquire_readerEv -__ZN3tbb16spin_rw_mutex_v327internal_try_acquire_writerEv -__ZN3tbb16spin_rw_mutex_v318internal_constructEv - -# spin_mutex.cpp -__ZN3tbb10spin_mutex11scoped_lock16internal_acquireERS0_ -__ZN3tbb10spin_mutex11scoped_lock16internal_releaseEv -__ZN3tbb10spin_mutex11scoped_lock20internal_try_acquireERS0_ -__ZN3tbb10spin_mutex18internal_constructEv - -# mutex.cpp -__ZN3tbb5mutex11scoped_lock16internal_acquireERS0_ -__ZN3tbb5mutex11scoped_lock16internal_releaseEv -__ZN3tbb5mutex11scoped_lock20internal_try_acquireERS0_ -__ZN3tbb5mutex16internal_destroyEv -__ZN3tbb5mutex18internal_constructEv - -# recursive_mutex.cpp -__ZN3tbb15recursive_mutex11scoped_lock16internal_acquireERS0_ -__ZN3tbb15recursive_mutex11scoped_lock16internal_releaseEv -__ZN3tbb15recursive_mutex11scoped_lock20internal_try_acquireERS0_ -__ZN3tbb15recursive_mutex16internal_destroyEv -__ZN3tbb15recursive_mutex18internal_constructEv - -# queuing_mutex.cpp -__ZN3tbb13queuing_mutex11scoped_lock7acquireERS0_ -__ZN3tbb13queuing_mutex11scoped_lock7releaseEv -__ZN3tbb13queuing_mutex11scoped_lock11try_acquireERS0_ -__ZN3tbb13queuing_mutex18internal_constructEv - -# concurrent_hash_map -__ZNK3tbb8internal21hash_map_segment_base23internal_grow_predicateEv - -#if !TBB_NO_LEGACY -# concurrent_queue.cpp v2 -__ZN3tbb8internal21concurrent_queue_base12internal_popEPv -__ZN3tbb8internal21concurrent_queue_base13internal_pushEPKv -__ZN3tbb8internal21concurrent_queue_base21internal_set_capacityElm -__ZN3tbb8internal21concurrent_queue_base23internal_pop_if_presentEPv -__ZN3tbb8internal21concurrent_queue_base25internal_push_if_not_fullEPKv -__ZN3tbb8internal21concurrent_queue_baseC2Em -__ZN3tbb8internal21concurrent_queue_baseD2Ev -__ZTIN3tbb8internal21concurrent_queue_baseE -__ZTSN3tbb8internal21concurrent_queue_baseE -__ZTVN3tbb8internal21concurrent_queue_baseE -__ZN3tbb8internal30concurrent_queue_iterator_base6assignERKS1_ -__ZN3tbb8internal30concurrent_queue_iterator_base7advanceEv -__ZN3tbb8internal30concurrent_queue_iterator_baseC2ERKNS0_21concurrent_queue_baseE -__ZN3tbb8internal30concurrent_queue_iterator_baseD2Ev -__ZNK3tbb8internal21concurrent_queue_base13internal_sizeEv -#endif - -# concurrent_queue v3 -# constructors -__ZN3tbb8internal33concurrent_queue_iterator_base_v3C2ERKNS0_24concurrent_queue_base_v3E -__ZN3tbb8internal24concurrent_queue_base_v3C2Em -# destructors -__ZN3tbb8internal33concurrent_queue_iterator_base_v3D2Ev -__ZN3tbb8internal24concurrent_queue_base_v3D2Ev -# typeinfo -__ZTIN3tbb8internal24concurrent_queue_base_v3E -__ZTSN3tbb8internal24concurrent_queue_base_v3E -#vtable -__ZTVN3tbb8internal24concurrent_queue_base_v3E -# methods -__ZN3tbb8internal33concurrent_queue_iterator_base_v36assignERKS1_ -__ZN3tbb8internal33concurrent_queue_iterator_base_v37advanceEv -__ZN3tbb8internal24concurrent_queue_base_v313internal_pushEPKv -__ZN3tbb8internal24concurrent_queue_base_v325internal_push_if_not_fullEPKv -__ZN3tbb8internal24concurrent_queue_base_v312internal_popEPv -__ZN3tbb8internal24concurrent_queue_base_v323internal_pop_if_presentEPv -__ZN3tbb8internal24concurrent_queue_base_v321internal_finish_clearEv -__ZN3tbb8internal24concurrent_queue_base_v321internal_set_capacityElm -__ZNK3tbb8internal24concurrent_queue_base_v313internal_sizeEv -__ZNK3tbb8internal24concurrent_queue_base_v324internal_throw_exceptionEv -__ZN3tbb8internal24concurrent_queue_base_v36assignERKS1_ - -#if !TBB_NO_LEGACY -# concurrent_vector.cpp v2 -__ZN3tbb8internal22concurrent_vector_base13internal_copyERKS1_mPFvPvPKvmE -__ZN3tbb8internal22concurrent_vector_base14internal_clearEPFvPvmEb -__ZN3tbb8internal22concurrent_vector_base15internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_ -__ZN3tbb8internal22concurrent_vector_base16internal_grow_byEmmPFvPvmE -__ZN3tbb8internal22concurrent_vector_base16internal_reserveEmmm -__ZN3tbb8internal22concurrent_vector_base18internal_push_backEmRm -__ZN3tbb8internal22concurrent_vector_base25internal_grow_to_at_leastEmmPFvPvmE -__ZNK3tbb8internal22concurrent_vector_base17internal_capacityEv -#endif - -# concurrent_vector v3 -__ZN3tbb8internal25concurrent_vector_base_v313internal_copyERKS1_mPFvPvPKvmE -__ZN3tbb8internal25concurrent_vector_base_v314internal_clearEPFvPvmE -__ZN3tbb8internal25concurrent_vector_base_v315internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_ -__ZN3tbb8internal25concurrent_vector_base_v316internal_grow_byEmmPFvPvPKvmES4_ -__ZN3tbb8internal25concurrent_vector_base_v316internal_reserveEmmm -__ZN3tbb8internal25concurrent_vector_base_v318internal_push_backEmRm -__ZN3tbb8internal25concurrent_vector_base_v325internal_grow_to_at_leastEmmPFvPvPKvmES4_ -__ZNK3tbb8internal25concurrent_vector_base_v317internal_capacityEv -__ZN3tbb8internal25concurrent_vector_base_v316internal_compactEmPvPFvS2_mEPFvS2_PKvmE -__ZN3tbb8internal25concurrent_vector_base_v313internal_swapERS1_ -__ZNK3tbb8internal25concurrent_vector_base_v324internal_throw_exceptionEm -__ZN3tbb8internal25concurrent_vector_base_v3D2Ev - -# tbb_thread -__ZN3tbb8internal13tbb_thread_v320hardware_concurrencyEv -__ZN3tbb8internal13tbb_thread_v36detachEv -__ZN3tbb8internal16thread_get_id_v3Ev -__ZN3tbb8internal15free_closure_v3EPv -__ZN3tbb8internal13tbb_thread_v34joinEv -__ZN3tbb8internal13tbb_thread_v314internal_startEPFPvS2_ES2_ -__ZN3tbb8internal19allocate_closure_v3Em -__ZN3tbb8internal7move_v3ERNS0_13tbb_thread_v3ES2_ -__ZN3tbb8internal15thread_yield_v3Ev -__ZN3tbb8internal15thread_sleep_v3ERKNS_10tick_count10interval_tE - -# enumerable_thread_specific -__ZN3tbb8internal25tls_single_key_manager_v47set_tlsERmPv -__ZN3tbb8internal25tls_single_key_manager_v47get_tlsERm -__ZN3tbb8internal25tls_single_key_manager_v410create_keyERm -__ZN3tbb8internal25tls_single_key_manager_v411destroy_keyERm diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mutex.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mutex.cpp deleted file mode 100644 index 3c619b69c8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/mutex.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/mutex.h" -#include "itt_notify.h" - -namespace tbb { - void mutex::scoped_lock::internal_acquire( mutex& m ) { - -#if _WIN32||_WIN64 - switch( m.state ) { - case INITIALIZED: - case HELD: - EnterCriticalSection( &m.impl ); - // If a thread comes here, and another thread holds the lock, it will block - // in EnterCriticalSection. When it returns from EnterCriticalSection, - // m.state must be set to INITIALIZED. If the same thread tries to acquire a lock it - // aleady holds, the the lock is in HELD state, thus will cause the assertion to fail. - __TBB_ASSERT(m.state!=HELD, "mutex::scoped_lock: deadlock caused by attempt to reacquire held mutex"); - m.state = HELD; - break; - case DESTROYED: - __TBB_ASSERT(false,"mutex::scoped_lock: mutex already destroyed"); - break; - default: - __TBB_ASSERT(false,"mutex::scoped_lock: illegal mutex state"); - break; - } -#else - int error_code = pthread_mutex_lock(&m.impl); - __TBB_ASSERT_EX(!error_code,"mutex::scoped_lock: pthread_mutex_lock failed"); -#endif /* _WIN32||_WIN64 */ - my_mutex = &m; - } - -void mutex::scoped_lock::internal_release() { - __TBB_ASSERT( my_mutex, "mutex::scoped_lock: not holding a mutex" ); -#if _WIN32||_WIN64 - switch( my_mutex->state ) { - case INITIALIZED: - __TBB_ASSERT(false,"mutex::scoped_lock: try to release the lock without acquisition"); - break; - case HELD: - my_mutex->state = INITIALIZED; - LeaveCriticalSection(&my_mutex->impl); - break; - case DESTROYED: - __TBB_ASSERT(false,"mutex::scoped_lock: mutex already destroyed"); - break; - default: - __TBB_ASSERT(false,"mutex::scoped_lock: illegal mutex state"); - break; - } -#else - int error_code = pthread_mutex_unlock(&my_mutex->impl); - __TBB_ASSERT_EX(!error_code, "mutex::scoped_lock: pthread_mutex_unlock failed"); -#endif /* _WIN32||_WIN64 */ - my_mutex = NULL; -} - -bool mutex::scoped_lock::internal_try_acquire( mutex& m ) { -#if _WIN32||_WIN64 - switch( m.state ) { - case INITIALIZED: - case HELD: - break; - case DESTROYED: - __TBB_ASSERT(false,"mutex::scoped_lock: mutex already destroyed"); - break; - default: - __TBB_ASSERT(false,"mutex::scoped_lock: illegal mutex state"); - break; - } -#endif /* _WIN32||_WIN64 */ - - bool result; -#if _WIN32||_WIN64 - result = TryEnterCriticalSection(&m.impl)!=0; - if( result ) { - __TBB_ASSERT(m.state!=HELD, "mutex::scoped_lock: deadlock caused by attempt to reacquire held mutex"); - m.state = HELD; - } -#else - result = pthread_mutex_trylock(&m.impl)==0; -#endif /* _WIN32||_WIN64 */ - if( result ) - my_mutex = &m; - return result; -} - -void mutex::internal_construct() { -#if _WIN32||_WIN64 - InitializeCriticalSection(&impl); - state = INITIALIZED; -#else - int error_code = pthread_mutex_init(&impl,NULL); - if( error_code ) - tbb::internal::handle_perror(error_code,"mutex: pthread_mutex_init failed"); -#endif /* _WIN32||_WIN64*/ - ITT_SYNC_CREATE(&impl, _T("tbb::mutex"), _T("")); -} - -void mutex::internal_destroy() { -#if _WIN32||_WIN64 - switch( state ) { - case INITIALIZED: - DeleteCriticalSection(&impl); - break; - case DESTROYED: - __TBB_ASSERT(false,"mutex: already destroyed"); - break; - default: - __TBB_ASSERT(false,"mutex: illegal state for destruction"); - break; - } - state = DESTROYED; -#else - int error_code = pthread_mutex_destroy(&impl); - __TBB_ASSERT_EX(!error_code,"mutex: pthread_mutex_destroy failed"); -#endif /* _WIN32||_WIN64 */ -} - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/pipeline.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/pipeline.cpp deleted file mode 100644 index 685987df4f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/pipeline.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/pipeline.h" -#include "tbb/spin_mutex.h" -#include "tbb/cache_aligned_allocator.h" -#include "itt_notify.h" - - -namespace tbb { - -namespace internal { - -//! This structure is used to store task information in ordered buffer -struct task_info{ - void* my_object; - Token my_token; - bool my_token_ready; - bool is_valid; -}; - -//! A buffer of ordered items. -/** Each item is a task, inserted into a position in the buffer corrsponding to a Token. */ -class ordered_buffer { - typedef Token size_type; - - //! Array of deferred tasks that cannot yet start executing. - task_info* array; - - //! Size of array - /** Always 0 or a power of 2 */ - size_type array_size; - - //! Lowest token that can start executing. - /** All prior Token have already been seen. */ - Token low_token; - - //! Serializes updates. - spin_mutex array_mutex; - - //! Resize "array". - /** Caller is responsible to acquiring a lock on "array_mutex". */ - void grow( size_type minimum_size ); - - //! Initial size for "array" - /** Must be a power of 2 */ - static const size_type initial_buffer_size = 4; - - //! Used only for out of order buffer. - Token high_token; - - //! True for ordered filter, false otherwise. - bool is_ordered; -public: - //! Construct empty buffer. - ordered_buffer( bool is_ordered_ ) : array(NULL), array_size(0), - low_token(0), high_token(0), is_ordered(is_ordered_) { - grow(initial_buffer_size); - __TBB_ASSERT( array, NULL ); - } - - //! Destroy the buffer. - ~ordered_buffer() { - __TBB_ASSERT( array, NULL ); - cache_aligned_allocator<task_info>().deallocate(array,array_size); - poison_pointer( array ); - } - - //! Put a token into the buffer. - /** If task information was placed into buffer, returns true; - otherwise returns false, informing the caller to create and spawn a task. - */ - // Using template to avoid explicit dependency on stage_task - template<typename StageTask> - bool put_token( StageTask& putter ) { - { - spin_mutex::scoped_lock lock( array_mutex ); - Token token = is_ordered ? putter.next_token_number() : high_token++; - if( token!=low_token ) { - // Trying to put token that is beyond low_token. - // Need to wait until low_token catches up before dispatching. - __TBB_ASSERT( (tokendiff_t)(token-low_token)>0, NULL ); - if( token-low_token>=array_size ) - grow( token-low_token+1 ); - ITT_NOTIFY( sync_releasing, this ); - putter.put_task_info(array[token&array_size-1]); - return true; - } - } - return false; - } - - //! Note that processing of a token is finished. - /** Fires up processing of the next token, if processing was deferred. */ - // Using template to avoid explicit dependency on stage_task - template<typename StageTask> - void note_done( Token token, StageTask& spawner ) { - task_info wakee = {NULL, 0, 0, false}; - { - spin_mutex::scoped_lock lock( array_mutex ); - if( !is_ordered || token==low_token ) { - // Wake the next task - task_info& item = array[++low_token & array_size-1]; - ITT_NOTIFY( sync_acquired, this ); - wakee = item; - item.is_valid = false; - } - } - if( wakee.is_valid ) - spawner.spawn_stage_task(wakee); - } - -#if __TBB_EXCEPTIONS - //! The method destroys all data in filters to prevent memory leaks - void clear( filter* my_filter ) { - long t=low_token; - for( size_type i=0; i<array_size; ++i, ++t ){ - task_info& temp = array[t&array_size-1]; - if (temp.is_valid ) { - my_filter->finalize(temp.my_object); - temp.is_valid = false; - } - } - } -#endif -}; - -void ordered_buffer::grow( size_type minimum_size ) { - size_type old_size = array_size; - size_type new_size = old_size ? 2*old_size : initial_buffer_size; - while( new_size<minimum_size ) - new_size*=2; - task_info* new_array = cache_aligned_allocator<task_info>().allocate(new_size); - task_info* old_array = array; - for( size_type i=0; i<new_size; ++i ) - new_array[i].is_valid = false; - long t=low_token; - for( size_type i=0; i<old_size; ++i, ++t ) - new_array[t&new_size-1] = old_array[t&old_size-1]; - array = new_array; - array_size = new_size; - if( old_array ) - cache_aligned_allocator<task_info>().deallocate(old_array,old_size); -} - -class stage_task: public task { -private: - friend class tbb::pipeline; - pipeline& my_pipeline; - void* my_object; - filter* my_filter; - //! Invalid until this task went through an ordered stage. - Token my_token; - //! False until my_token is set. - bool my_token_ready; - //! True if this task has not yet read the input. - bool my_at_start; -public: - //! Construct stage_task for first stage in a pipeline. - /** Such a stage has not read any input yet. */ - stage_task( pipeline& pipeline ) : - my_pipeline(pipeline), - my_object(NULL), - my_filter(pipeline.filter_list), - my_token_ready(false), - my_at_start(true) - {} - //! Construct stage_task for a subsequent stage in a pipeline. - stage_task( pipeline& pipeline, filter* filter_list ) : - my_pipeline(pipeline), - my_filter(filter_list), - my_token_ready(false), - my_at_start(false) - {} - //! Requests the pipeline for the next token number - /** It's not thread safe! Callers should guarantee exclusive execution */ - inline Token next_token_number () { - if(!my_token_ready) { - my_token = my_pipeline.token_counter++; - my_token_ready = true; - } - return my_token; - } - //! The virtual task execution method - /*override*/ task* execute(); -#if __TBB_EXCEPTIONS - ~stage_task() - { - if (my_filter && my_object && (my_filter->my_filter_mode & filter::version_mask) >= __TBB_PIPELINE_VERSION(4)) { - __TBB_ASSERT(is_cancelled(), "Tryning to finalize the task that wasn't cancelled"); - my_filter->finalize(my_object); - my_object = NULL; - } - } -#endif // __TBB_EXCEPTIONS - //! Creates and spawns stage_task from task_info - void spawn_stage_task(const task_info& info) - { - stage_task* clone = new( allocate_additional_child_of(*my_pipeline.end_counter) ) stage_task( my_pipeline, my_filter ); - clone->my_token = info.my_token; - clone->my_token_ready = info.my_token_ready; - clone->my_object = info.my_object; - - spawn(*clone); - } - //! Puts current task information - void put_task_info(task_info &where_to_put ) { - where_to_put.my_object = my_object; - where_to_put.my_token = my_token; - where_to_put.my_token_ready = my_token_ready; - where_to_put.is_valid = true; - } -}; - -task* stage_task::execute() { - __TBB_ASSERT( !my_at_start || !my_object, NULL ); - if( my_at_start ) { - if( my_filter->is_serial() ) { - my_object = (*my_filter)(my_object); - if( my_object ) { - my_token = my_pipeline.token_counter++; - my_token_ready = true; - ITT_NOTIFY( sync_releasing, &my_pipeline.input_tokens ); - if( --my_pipeline.input_tokens>0 ) - spawn( *new( allocate_additional_child_of(*my_pipeline.end_counter) ) stage_task( my_pipeline ) ); - } else { - my_pipeline.end_of_input = true; - return NULL; - } - } else /*not is_serial*/ { - if( my_pipeline.end_of_input ) - return NULL; - ITT_NOTIFY( sync_releasing, &my_pipeline.input_tokens ); - if( --my_pipeline.input_tokens>0 ) - spawn( *new( allocate_additional_child_of(*my_pipeline.end_counter) ) stage_task( my_pipeline ) ); - my_object = (*my_filter)(my_object); - if( !my_object ) { - my_pipeline.end_of_input = true; - return NULL; - } - } - my_at_start = false; - } else { - my_object = (*my_filter)(my_object); - if( ordered_buffer* input_buffer = my_filter->input_buffer ) - input_buffer->note_done(my_token, *this); - } - task* next = NULL; - my_filter = my_filter->next_filter_in_pipeline; - if( my_filter ) { - // There is another filter to execute. - // Crank up priority a notch. - add_to_depth(1); - if( ordered_buffer* input_buffer = my_filter->input_buffer ) { - // The next filter must execute tokens in order. - if (input_buffer->put_token(*this )){ - my_filter = NULL; // To prevent deleting my_object twice if exception occurs - return NULL; - } - } - /* A semi-hackish way to reexecute the same task object immediately without spawning. - recycle_as_continuation marks the task for future execution, - and then 'this' pointer is returned to bypass spawning. */ - recycle_as_continuation(); - next = this; - } else { - // Reached end of the pipe. Inject a new token. - // The token must be injected before execute() returns, in order to prevent the - // end_counter task's reference count from prematurely reaching 0. - set_depth( my_pipeline.end_counter->depth()+1 ); - if( ++my_pipeline.input_tokens==1 ) { - ITT_NOTIFY( sync_acquired, &my_pipeline.input_tokens ); - if( !my_pipeline.end_of_input ) - spawn( *new( allocate_additional_child_of(*my_pipeline.end_counter) ) stage_task( my_pipeline ) ); - } - } - return next; -} - -} // namespace internal - -void pipeline::inject_token( task& ) { - __TBB_ASSERT(0,"illegal call to inject_token"); -} - -#if __TBB_EXCEPTIONS -void pipeline::clear_filters() { - for( filter* f = filter_list; f; f = f->next_filter_in_pipeline ) { - if ((f->my_filter_mode & filter::version_mask) >= __TBB_PIPELINE_VERSION(4)) - if( internal::ordered_buffer* b = f->input_buffer ) - b->clear(f); - } -} -#endif - -pipeline::pipeline() : - filter_list(NULL), - filter_end(NULL), - end_counter(NULL), - token_counter(0), - end_of_input(false) -{ - input_tokens = 0; -} - -pipeline::~pipeline() { - clear(); -} - -void pipeline::clear() { - filter* next; - for( filter* f = filter_list; f; f=next ) { - if( internal::ordered_buffer* b = f->input_buffer ) { - delete b; - f->input_buffer = NULL; - } - next=f->next_filter_in_pipeline; - f->next_filter_in_pipeline = filter::not_in_pipeline(); - if ( (f->my_filter_mode & filter::version_mask) >= __TBB_PIPELINE_VERSION(3) ) { - f->prev_filter_in_pipeline = filter::not_in_pipeline(); - f->my_pipeline = NULL; - } - } - filter_list = filter_end = NULL; -} - -void pipeline::add_filter( filter& filter_ ) { -#if TBB_USE_ASSERT - if ( (filter_.my_filter_mode & filter::version_mask) >= __TBB_PIPELINE_VERSION(3) ) - __TBB_ASSERT( filter_.prev_filter_in_pipeline==filter::not_in_pipeline(), "filter already part of pipeline?" ); - __TBB_ASSERT( filter_.next_filter_in_pipeline==filter::not_in_pipeline(), "filter already part of pipeline?" ); - __TBB_ASSERT( !end_counter, "invocation of add_filter on running pipeline" ); -#endif - if( filter_.is_serial() ) { - filter_.input_buffer = new internal::ordered_buffer( filter_.is_ordered() ); - } - if ( (filter_.my_filter_mode & filter::version_mask) >= __TBB_PIPELINE_VERSION(3) ) { - filter_.my_pipeline = this; - filter_.prev_filter_in_pipeline = filter_end; - if ( filter_list == NULL) - filter_list = &filter_; - else - filter_end->next_filter_in_pipeline = &filter_; - filter_.next_filter_in_pipeline = NULL; - filter_end = &filter_; - } - else - { - if( !filter_end ) - filter_end = reinterpret_cast<filter*>(&filter_list); - - *reinterpret_cast<filter**>(filter_end) = &filter_; - filter_end = reinterpret_cast<filter*>(&filter_.next_filter_in_pipeline); - *reinterpret_cast<filter**>(filter_end) = NULL; - } -} - -void pipeline::remove_filter( filter& filter_ ) { - if (&filter_ == filter_list) - filter_list = filter_.next_filter_in_pipeline; - else { - __TBB_ASSERT( filter_.prev_filter_in_pipeline, "filter list broken?" ); - filter_.prev_filter_in_pipeline->next_filter_in_pipeline = filter_.next_filter_in_pipeline; - } - if (&filter_ == filter_end) - filter_end = filter_.prev_filter_in_pipeline; - else { - __TBB_ASSERT( filter_.next_filter_in_pipeline, "filter list broken?" ); - filter_.next_filter_in_pipeline->prev_filter_in_pipeline = filter_.prev_filter_in_pipeline; - } - if( internal::ordered_buffer* b = filter_.input_buffer ) { - delete b; - filter_.input_buffer = NULL; - } - filter_.next_filter_in_pipeline = filter_.prev_filter_in_pipeline = filter::not_in_pipeline(); - filter_.my_pipeline = NULL; -} - -void pipeline::run( size_t max_number_of_live_tokens -#if __TBB_EXCEPTIONS - , tbb::task_group_context& context -#endif - ) { - __TBB_ASSERT( max_number_of_live_tokens>0, "pipeline::run must have at least one token" ); - __TBB_ASSERT( !end_counter, "pipeline already running?" ); - // The class destroys end_counter and clears all ordered buffers if pipeline was cancelled. - class pipeline_cleaner: internal::no_copy { - pipeline& my_pipeline; - public: - pipeline_cleaner(pipeline& _pipeline) : my_pipeline(_pipeline) - {} - ~pipeline_cleaner(){ -#if __TBB_EXCEPTIONS - if (my_pipeline.end_counter->is_cancelled()) // Pipeline was cancelled - my_pipeline.clear_filters(); -#endif - my_pipeline.end_counter->destroy(*my_pipeline.end_counter); - my_pipeline.end_counter = NULL; - } - }; - if( filter_list ) { - if( filter_list->next_filter_in_pipeline || !filter_list->is_serial() ) { - pipeline_cleaner my_pipeline_cleaner(*this); - end_of_input = false; -#if __TBB_EXCEPTIONS - end_counter = new( task::allocate_root(context) ) empty_task; -#else - end_counter = new( task::allocate_root() ) empty_task; -#endif - // 2 = 1 for spawned child + 1 for wait - end_counter->set_ref_count(2); - input_tokens = internal::Token(max_number_of_live_tokens); - // Prime the pump with the non-waiter - end_counter->spawn_and_wait_for_all( *new( end_counter->allocate_child() ) internal::stage_task( *this ) ); - } else { - // There are no filters, and thus no parallelism is possible. - // Just drain the input stream. - while( (*filter_list)(NULL) ) - continue; - } - } -} - -#if __TBB_EXCEPTIONS -void pipeline::run( size_t max_number_of_live_tokens ) { - tbb::task_group_context context; - run(max_number_of_live_tokens, context); -} -#endif // __TBB_EXCEPTIONS - -filter::~filter() { - if ( (my_filter_mode & version_mask) >= __TBB_PIPELINE_VERSION(3) ) { - if ( next_filter_in_pipeline != filter::not_in_pipeline() ) { - __TBB_ASSERT( prev_filter_in_pipeline != filter::not_in_pipeline(), "probably filter list is broken" ); - my_pipeline->remove_filter(*this); - } else - __TBB_ASSERT( prev_filter_in_pipeline == filter::not_in_pipeline(), "probably filter list is broken" ); - } else { - __TBB_ASSERT( next_filter_in_pipeline==filter::not_in_pipeline(), "cannot destroy filter that is part of pipeline" ); - } -} - -} // tbb - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_mutex.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_mutex.cpp deleted file mode 100644 index 9d62867978..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_mutex.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tbb_machine.h" -#include "tbb/tbb_stddef.h" -#include "tbb_misc.h" -#include "tbb/queuing_mutex.h" -#include "itt_notify.h" - - -namespace tbb { - -using namespace internal; - -//! A method to acquire queuing_mutex lock -void queuing_mutex::scoped_lock::acquire( queuing_mutex& m ) -{ - __TBB_ASSERT( !this->mutex, "scoped_lock is already holding a mutex"); - - // Must set all fields before the fetch_and_store, because once the - // fetch_and_store executes, *this becomes accessible to other threads. - mutex = &m; - next = NULL; - going = 0; - - // The fetch_and_store must have release semantics, because we are - // "sending" the fields initialized above to other processors. - scoped_lock* pred = m.q_tail.fetch_and_store<tbb::release>(this); - if( pred ) { - ITT_NOTIFY(sync_prepare, mutex); - __TBB_ASSERT( !pred->next, "the predecessor has another successor!"); - pred->next = this; - SpinwaitWhileEq( going, 0ul ); - } - ITT_NOTIFY(sync_acquired, mutex); - - // Force acquire so that user's critical section receives correct values - // from processor that was previously in the user's critical section. - __TBB_load_with_acquire(going); -} - -//! A method to acquire queuing_mutex if it is free -bool queuing_mutex::scoped_lock::try_acquire( queuing_mutex& m ) -{ - __TBB_ASSERT( !this->mutex, "scoped_lock is already holding a mutex"); - - // Must set all fields before the fetch_and_store, because once the - // fetch_and_store executes, *this becomes accessible to other threads. - next = NULL; - going = 0; - - if( m.q_tail ) return false; - // The CAS must have release semantics, because we are - // "sending" the fields initialized above to other processors. - scoped_lock* pred = m.q_tail.compare_and_swap<tbb::release>(this, NULL); - - // Force acquire so that user's critical section receives correct values - // from processor that was previously in the user's critical section. - // try_acquire should always have acquire semantic, even if failed. - __TBB_load_with_acquire(going); - if( !pred ) { - mutex = &m; - ITT_NOTIFY(sync_acquired, mutex); - return true; - } else return false; -} - -//! A method to release queuing_mutex lock -void queuing_mutex::scoped_lock::release( ) -{ - __TBB_ASSERT(this->mutex!=NULL, "no lock acquired"); - - ITT_NOTIFY(sync_releasing, mutex); - if( !next ) { - if( this == mutex->q_tail.compare_and_swap<tbb::release>(NULL, this) ) { - // this was the only item in the queue, and the queue is now empty. - goto done; - } - // Someone in the queue - SpinwaitWhileEq( next, (scoped_lock*)0 ); - } - __TBB_ASSERT(next,NULL); - __TBB_store_with_release(next->going, 1); -done: - initialize(); -} - -void queuing_mutex::internal_construct() { - ITT_SYNC_CREATE(this, _T("tbb::queuing_mutex"), _T("")); -} - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_rw_mutex.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_rw_mutex.cpp deleted file mode 100644 index 5f367fee4f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/queuing_rw_mutex.cpp +++ /dev/null @@ -1,492 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -/** Before making any changes in the implementation, please emulate algorithmic changes - with SPIN tool using <TBB directory>/tools/spin_models/ReaderWriterMutex.pml. - There could be some code looking as "can be restructured" but its structure does matter! */ - -#include "tbb/tbb_machine.h" -#include "tbb/tbb_stddef.h" -#include "tbb_misc.h" -#include "tbb/queuing_rw_mutex.h" -#include "itt_notify.h" - - -namespace tbb { - -using namespace internal; - -//! Flag bits in a state_t that specify information about a locking request. -enum state_t_flags { - STATE_NONE = 0, - STATE_WRITER = 1, - STATE_READER = 1<<1, - STATE_READER_UNBLOCKNEXT = 1<<2, - STATE_COMBINED_WAITINGREADER = STATE_READER | STATE_READER_UNBLOCKNEXT, - STATE_ACTIVEREADER = 1<<3, - STATE_COMBINED_READER = STATE_COMBINED_WAITINGREADER | STATE_ACTIVEREADER, - STATE_UPGRADE_REQUESTED = 1<<4, - STATE_UPGRADE_WAITING = 1<<5, - STATE_UPGRADE_LOSER = 1<<6, - STATE_COMBINED_UPGRADING = STATE_UPGRADE_WAITING | STATE_UPGRADE_LOSER -}; - -const unsigned char RELEASED = 0; -const unsigned char ACQUIRED = 1; - -template<typename T> -inline atomic<T>& as_atomic( T& t ) { - return *(atomic<T>*)&t; -} - -inline bool queuing_rw_mutex::scoped_lock::try_acquire_internal_lock() -{ - return as_atomic(internal_lock).compare_and_swap<tbb::acquire>(ACQUIRED,RELEASED) == RELEASED; -} - -inline void queuing_rw_mutex::scoped_lock::acquire_internal_lock() -{ - // Usually, we would use the test-test-and-set idiom here, with exponential backoff. - // But so far, experiments indicate there is no value in doing so here. - while( !try_acquire_internal_lock() ) { - __TBB_Pause(1); - } -} - -inline void queuing_rw_mutex::scoped_lock::release_internal_lock() -{ - __TBB_store_with_release(internal_lock,RELEASED); -} - -inline void queuing_rw_mutex::scoped_lock::wait_for_release_of_internal_lock() -{ - SpinwaitUntilEq(internal_lock, RELEASED); -} - -inline void queuing_rw_mutex::scoped_lock::unblock_or_wait_on_internal_lock( uintptr_t flag ) { - if( flag ) - wait_for_release_of_internal_lock(); - else - release_internal_lock(); -} - -template<typename T> -class tricky_atomic_pointer: no_copy { -public: - typedef typename atomic_word<sizeof(T*)>::word word; - template<memory_semantics M> - static T* fetch_and_add( T* volatile * location, word addend ) { - return reinterpret_cast<T*>( atomic_traits<sizeof(T*),M>::fetch_and_add(location, addend) ); - } - template<memory_semantics M> - static T* fetch_and_store( T* volatile * location, T* value ) { - return reinterpret_cast<T*>( atomic_traits<sizeof(T*),M>::fetch_and_store(location, reinterpret_cast<word>(value)) ); - } - template<memory_semantics M> - static T* compare_and_swap( T* volatile * location, T* value, T* comparand ) { - return reinterpret_cast<T*>( - atomic_traits<sizeof(T*),M>::compare_and_swap(location, reinterpret_cast<word>(value), - reinterpret_cast<word>(comparand)) - ); - } - - T* & ref; - tricky_atomic_pointer( T*& original ) : ref(original) {}; - tricky_atomic_pointer( T* volatile & original ) : ref(original) {}; - T* operator&( word operand2 ) const { - return reinterpret_cast<T*>( reinterpret_cast<word>(ref) & operand2 ); - } - T* operator|( word operand2 ) const { - return reinterpret_cast<T*>( reinterpret_cast<word>(ref) | operand2 ); - } -}; - -typedef tricky_atomic_pointer<queuing_rw_mutex::scoped_lock> tricky_pointer; - -//! Mask for low order bit of a pointer. -static const tricky_pointer::word FLAG = 0x1; - -inline -uintptr get_flag( queuing_rw_mutex::scoped_lock* ptr ) { - return uintptr(tricky_pointer(ptr)&FLAG); -} - -//------------------------------------------------------------------------ -// Methods of queuing_rw_mutex::scoped_lock -//------------------------------------------------------------------------ - -void queuing_rw_mutex::scoped_lock::acquire( queuing_rw_mutex& m, bool write ) -{ - __TBB_ASSERT( !this->mutex, "scoped_lock is already holding a mutex"); - - // Must set all fields before the fetch_and_store, because once the - // fetch_and_store executes, *this becomes accessible to other threads. - mutex = &m; - prev = NULL; - next = NULL; - going = 0; - state = state_t(write ? STATE_WRITER : STATE_READER); - internal_lock = RELEASED; - - queuing_rw_mutex::scoped_lock* pred = m.q_tail.fetch_and_store<tbb::release>(this); - - if( write ) { // Acquiring for write - - if( pred ) { - ITT_NOTIFY(sync_prepare, mutex); - pred = tricky_pointer(pred) & ~FLAG; - __TBB_ASSERT( !( tricky_pointer(pred) & FLAG ), "use of corrupted pointer!" ); - __TBB_ASSERT( !pred->next, "the predecessor has another successor!"); - // ensure release semantics on IPF - __TBB_store_with_release(pred->next,this); - SpinwaitUntilEq(going, 1); - } - - } else { // Acquiring for read -#if DO_ITT_NOTIFY - bool sync_prepare_done = false; -#endif - if( pred ) { - unsigned short pred_state; - __TBB_ASSERT( !this->prev, "the predecessor is already set" ); - if( tricky_pointer(pred)&FLAG ) { - /* this is only possible if pred is an upgrading reader and it signals us to wait */ - pred_state = STATE_UPGRADE_WAITING; - pred = tricky_pointer(pred) & ~FLAG; - } else { - // Load pred->state now, because once pred->next becomes - // non-NULL, we must assume that *pred might be destroyed. - pred_state = pred->state.compare_and_swap<tbb::acquire>(STATE_READER_UNBLOCKNEXT, STATE_READER); - } - this->prev = pred; - __TBB_ASSERT( !( tricky_pointer(pred) & FLAG ), "use of corrupted pointer!" ); - __TBB_ASSERT( !pred->next, "the predecessor has another successor!"); - // ensure release semantics on IPF - __TBB_store_with_release(pred->next,this); - if( pred_state != STATE_ACTIVEREADER ) { -#if DO_ITT_NOTIFY - sync_prepare_done = true; - ITT_NOTIFY(sync_prepare, mutex); -#endif - SpinwaitUntilEq(going, 1); - } - } - unsigned short old_state = state.compare_and_swap<tbb::acquire>(STATE_ACTIVEREADER, STATE_READER); - if( old_state!=STATE_READER ) { -#if DO_ITT_NOTIFY - if( !sync_prepare_done ) - ITT_NOTIFY(sync_prepare, mutex); -#endif - // Failed to become active reader -> need to unblock the next waiting reader first - __TBB_ASSERT( state==STATE_READER_UNBLOCKNEXT, "unexpected state" ); - SpinwaitWhileEq(next, (scoped_lock*)NULL); - /* state should be changed before unblocking the next otherwise it might finish - and another thread can get our old state and left blocked */ - state = STATE_ACTIVEREADER; - // ensure release semantics on IPF - __TBB_store_with_release(next->going,1); - } - } - - ITT_NOTIFY(sync_acquired, mutex); - - // Force acquire so that user's critical section receives correct values - // from processor that was previously in the user's critical section. - __TBB_load_with_acquire(going); -} - -bool queuing_rw_mutex::scoped_lock::try_acquire( queuing_rw_mutex& m, bool write ) -{ - __TBB_ASSERT( !this->mutex, "scoped_lock is already holding a mutex"); - - // Must set all fields before the fetch_and_store, because once the - // fetch_and_store executes, *this becomes accessible to other threads. - prev = NULL; - next = NULL; - going = 0; - state = state_t(write ? STATE_WRITER : STATE_ACTIVEREADER); - internal_lock = RELEASED; - - if( m.q_tail ) return false; - // The CAS must have release semantics, because we are - // "sending" the fields initialized above to other processors. - queuing_rw_mutex::scoped_lock* pred = m.q_tail.compare_and_swap<tbb::release>(this, NULL); - - // Force acquire so that user's critical section receives correct values - // from processor that was previously in the user's critical section. - // try_acquire should always have acquire semantic, even if failed. - __TBB_load_with_acquire(going); - - if( !pred ) { - mutex = &m; - ITT_NOTIFY(sync_acquired, mutex); - return true; - } else return false; - -} - -void queuing_rw_mutex::scoped_lock::release( ) -{ - __TBB_ASSERT(this->mutex!=NULL, "no lock acquired"); - - ITT_NOTIFY(sync_releasing, mutex); - - if( state == STATE_WRITER ) { // Acquired for write - - // The logic below is the same as "writerUnlock", but restructured to remove "return" in the middle of routine. - // In the statement below, acquire semantics of reading 'next' is required - // so that following operations with fields of 'next' are safe. - scoped_lock* n = __TBB_load_with_acquire(next); - if( !n ) { - if( this == mutex->q_tail.compare_and_swap<tbb::release>(NULL, this) ) { - // this was the only item in the queue, and the queue is now empty. - goto done; - } - SpinwaitWhileEq( next, (scoped_lock*)NULL ); - n = next; - } - n->going = 2; // protect next queue node from being destroyed too early - if( n->state==STATE_UPGRADE_WAITING ) { - // the next waiting for upgrade means this writer was upgraded before. - acquire_internal_lock(); - queuing_rw_mutex::scoped_lock* tmp = tricky_pointer::fetch_and_store<tbb::release>(&(n->prev), NULL); - n->state = STATE_UPGRADE_LOSER; - __TBB_store_with_release(n->going,1); - unblock_or_wait_on_internal_lock(get_flag(tmp)); - } else { - __TBB_ASSERT( state & (STATE_COMBINED_WAITINGREADER | STATE_WRITER), "unexpected state" ); - __TBB_ASSERT( !( tricky_pointer(n->prev) & FLAG ), "use of corrupted pointer!" ); - n->prev = NULL; - // ensure release semantics on IPF - __TBB_store_with_release(n->going,1); - } - - } else { // Acquired for read - - queuing_rw_mutex::scoped_lock *tmp = NULL; -retry: - // Addition to the original paper: Mark this->prev as in use - queuing_rw_mutex::scoped_lock *pred = tricky_pointer::fetch_and_add<tbb::acquire>(&(this->prev), FLAG); - - if( pred ) { - if( !(pred->try_acquire_internal_lock()) ) - { - // Failed to acquire the lock on pred. The predecessor either unlinks or upgrades. - // In the second case, it could or could not know my "in use" flag - need to check - tmp = tricky_pointer::compare_and_swap<tbb::release>(&(this->prev), pred, tricky_pointer(pred)|FLAG ); - if( !(tricky_pointer(tmp)&FLAG) ) { - // Wait for the predecessor to change this->prev (e.g. during unlink) - SpinwaitWhileEq( this->prev, tricky_pointer(pred)|FLAG ); - // Now owner of pred is waiting for _us_ to release its lock - pred->release_internal_lock(); - } - else ; // The "in use" flag is back -> the predecessor didn't get it and will release itself; nothing to do - - tmp = NULL; - goto retry; - } - __TBB_ASSERT(pred && pred->internal_lock==ACQUIRED, "predecessor's lock is not acquired"); - this->prev = pred; - acquire_internal_lock(); - - __TBB_store_with_release(pred->next,reinterpret_cast<scoped_lock *>(NULL)); - - if( !next && this != mutex->q_tail.compare_and_swap<tbb::release>(pred, this) ) { - SpinwaitWhileEq( next, (void*)NULL ); - } - __TBB_ASSERT( !get_flag(next), "use of corrupted pointer" ); - - // ensure acquire semantics of reading 'next' - if( __TBB_load_with_acquire(next) ) { // I->next != nil - // Equivalent to I->next->prev = I->prev but protected against (prev[n]&FLAG)!=0 - tmp = tricky_pointer::fetch_and_store<tbb::release>(&(next->prev), pred); - // I->prev->next = I->next; - __TBB_ASSERT(this->prev==pred, ""); - __TBB_store_with_release(pred->next,next); - } - // Safe to release in the order opposite to acquiring which makes the code simplier - pred->release_internal_lock(); - - } else { // No predecessor when we looked - acquire_internal_lock(); // "exclusiveLock(&I->EL)" - // ensure acquire semantics of reading 'next' - scoped_lock* n = __TBB_load_with_acquire(next); - if( !n ) { - if( this != mutex->q_tail.compare_and_swap<tbb::release>(NULL, this) ) { - SpinwaitWhileEq( next, (scoped_lock*)NULL ); - n = next; - } else { - goto unlock_self; - } - } - n->going = 2; // protect next queue node from being destroyed too early - tmp = tricky_pointer::fetch_and_store<tbb::release>(&(n->prev), NULL); - // ensure release semantics on IPF - __TBB_store_with_release(n->going,1); - } -unlock_self: - unblock_or_wait_on_internal_lock(get_flag(tmp)); - } -done: - SpinwaitWhileEq( going, 2 ); - - initialize(); -} - -bool queuing_rw_mutex::scoped_lock::downgrade_to_reader() -{ - __TBB_ASSERT( state==STATE_WRITER, "no sense to downgrade a reader" ); - - ITT_NOTIFY(sync_releasing, mutex); - - // ensure acquire semantics of reading 'next' - if( ! __TBB_load_with_acquire(next) ) { - state = STATE_READER; - if( this==mutex->q_tail ) { - unsigned short old_state = state.compare_and_swap<tbb::release>(STATE_ACTIVEREADER, STATE_READER); - if( old_state==STATE_READER ) { - goto downgrade_done; - } - } - /* wait for the next to register */ - SpinwaitWhileEq( next, (void*)NULL ); - } - __TBB_ASSERT( next, "still no successor at this point!" ); - if( next->state & STATE_COMBINED_WAITINGREADER ) - __TBB_store_with_release(next->going,1); - else if( next->state==STATE_UPGRADE_WAITING ) - // the next waiting for upgrade means this writer was upgraded before. - next->state = STATE_UPGRADE_LOSER; - state = STATE_ACTIVEREADER; - -downgrade_done: - return true; -} - -bool queuing_rw_mutex::scoped_lock::upgrade_to_writer() -{ - __TBB_ASSERT( state==STATE_ACTIVEREADER, "only active reader can be upgraded" ); - - queuing_rw_mutex::scoped_lock * tmp; - queuing_rw_mutex::scoped_lock * me = this; - - ITT_NOTIFY(sync_releasing, mutex); - state = STATE_UPGRADE_REQUESTED; -requested: - __TBB_ASSERT( !( tricky_pointer(next) & FLAG ), "use of corrupted pointer!" ); - acquire_internal_lock(); - if( this != mutex->q_tail.compare_and_swap<tbb::release>(tricky_pointer(me)|FLAG, this) ) { - SpinwaitWhileEq( next, (void*)NULL ); - queuing_rw_mutex::scoped_lock * n; - n = tricky_pointer::fetch_and_add<tbb::acquire>(&(this->next), FLAG); - unsigned short n_state = n->state; - /* the next reader can be blocked by our state. the best thing to do is to unblock it */ - if( n_state & STATE_COMBINED_WAITINGREADER ) - __TBB_store_with_release(n->going,1); - tmp = tricky_pointer::fetch_and_store<tbb::release>(&(n->prev), this); - unblock_or_wait_on_internal_lock(get_flag(tmp)); - if( n_state & (STATE_COMBINED_READER | STATE_UPGRADE_REQUESTED) ) { - // save n|FLAG for simplicity of following comparisons - tmp = tricky_pointer(n)|FLAG; - ExponentialBackoff backoff; - while(next==tmp) { - if( state & STATE_COMBINED_UPGRADING ) { - if( __TBB_load_with_acquire(next)==tmp ) - next = n; - goto waiting; - } - backoff.pause(); - } - __TBB_ASSERT(next!=(tricky_pointer(n)|FLAG), NULL); - goto requested; - } else { - __TBB_ASSERT( n_state & (STATE_WRITER | STATE_UPGRADE_WAITING), "unexpected state"); - __TBB_ASSERT( (tricky_pointer(n)|FLAG)==next, NULL); - next = n; - } - } else { - /* We are in the tail; whoever comes next is blocked by q_tail&FLAG */ - release_internal_lock(); - } // if( this != mutex->q_tail... ) - state.compare_and_swap<tbb::acquire>(STATE_UPGRADE_WAITING, STATE_UPGRADE_REQUESTED); - -waiting: - __TBB_ASSERT( !( tricky_pointer(next) & FLAG ), "use of corrupted pointer!" ); - __TBB_ASSERT( state & STATE_COMBINED_UPGRADING, "wrong state at upgrade waiting_retry" ); - __TBB_ASSERT( me==this, NULL ); - ITT_NOTIFY(sync_prepare, mutex); - /* if noone was blocked by the "corrupted" q_tail, turn it back */ - mutex->q_tail.compare_and_swap<tbb::release>( this, tricky_pointer(me)|FLAG ); - queuing_rw_mutex::scoped_lock * pred; - pred = tricky_pointer::fetch_and_add<tbb::acquire>(&(this->prev), FLAG); - if( pred ) { - bool success = pred->try_acquire_internal_lock(); - pred->state.compare_and_swap<tbb::release>(STATE_UPGRADE_WAITING, STATE_UPGRADE_REQUESTED); - if( !success ) { - tmp = tricky_pointer::compare_and_swap<tbb::release>(&(this->prev), pred, tricky_pointer(pred)|FLAG ); - if( tricky_pointer(tmp)&FLAG ) { - SpinwaitWhileEq(this->prev, pred); - pred = this->prev; - } else { - SpinwaitWhileEq( this->prev, tricky_pointer(pred)|FLAG ); - pred->release_internal_lock(); - } - } else { - this->prev = pred; - pred->release_internal_lock(); - SpinwaitWhileEq(this->prev, pred); - pred = this->prev; - } - if( pred ) - goto waiting; - } else { - // restore the corrupted prev field for possible further use (e.g. if downgrade back to reader) - this->prev = pred; - } - __TBB_ASSERT( !pred && !this->prev, "" ); - - // additional lifetime issue prevention checks - // wait for the successor to finish working with my fields - wait_for_release_of_internal_lock(); - // now wait for the predecessor to finish working with my fields - SpinwaitWhileEq( going, 2 ); - // there is an acquire semantics statement in the end of SpinwaitWhileEq. - - bool result = ( state != STATE_UPGRADE_LOSER ); - state = STATE_WRITER; - going = 1; - - ITT_NOTIFY(sync_acquired, mutex); - return result; -} - -void queuing_rw_mutex::internal_construct() { - ITT_SYNC_CREATE(this, _T("tbb::queuing_rw_mutex"), _T("")); -} - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/recursive_mutex.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/recursive_mutex.cpp deleted file mode 100644 index 95e62906c9..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/recursive_mutex.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/recursive_mutex.h" -#include "itt_notify.h" - -namespace tbb { - -void recursive_mutex::scoped_lock::internal_acquire( recursive_mutex& m ) { -#if _WIN32||_WIN64 - switch( m.state ) { - case INITIALIZED: - // since we cannot look into the internal of the CriticalSection object - // we won't know how many times the lock has been acquired, and thus - // we won't know when we may safely set the state back to INITIALIZED - // if we change the state to HELD as in mutex.cpp. thus, we won't change - // the state for recursive_mutex - EnterCriticalSection( &m.impl ); - break; - case DESTROYED: - __TBB_ASSERT(false,"recursive_mutex::scoped_lock: mutex already destroyed"); - break; - default: - __TBB_ASSERT(false,"recursive_mutex::scoped_lock: illegal mutex state"); - break; - } -#else - int error_code = pthread_mutex_lock(&m.impl); - __TBB_ASSERT_EX(!error_code,"recursive_mutex::scoped_lock: pthread_mutex_lock failed"); -#endif /* _WIN32||_WIN64 */ - my_mutex = &m; -} - -void recursive_mutex::scoped_lock::internal_release() { - __TBB_ASSERT( my_mutex, "recursive_mutex::scoped_lock: not holding a mutex" ); -#if _WIN32||_WIN64 - switch( my_mutex->state ) { - case INITIALIZED: - LeaveCriticalSection( &my_mutex->impl ); - break; - case DESTROYED: - __TBB_ASSERT(false,"recursive_mutex::scoped_lock: mutex already destroyed"); - break; - default: - __TBB_ASSERT(false,"recursive_mutex::scoped_lock: illegal mutex state"); - break; - } -#else - int error_code = pthread_mutex_unlock(&my_mutex->impl); - __TBB_ASSERT_EX(!error_code, "recursive_mutex::scoped_lock: pthread_mutex_unlock failed"); -#endif /* _WIN32||_WIN64 */ - my_mutex = NULL; -} - -bool recursive_mutex::scoped_lock::internal_try_acquire( recursive_mutex& m ) { -#if _WIN32||_WIN64 - switch( m.state ) { - case INITIALIZED: - break; - case DESTROYED: - __TBB_ASSERT(false,"recursive_mutex::scoped_lock: mutex already destroyed"); - break; - default: - __TBB_ASSERT(false,"recursive_mutex::scoped_lock: illegal mutex state"); - break; - } -#endif /* _WIN32||_WIN64 */ - bool result; -#if _WIN32||_WIN64 - result = TryEnterCriticalSection(&m.impl)!=0; -#else - result = pthread_mutex_trylock(&m.impl)==0; -#endif /* _WIN32||_WIN64 */ - if( result ) - my_mutex = &m; - return result; -} - -void recursive_mutex::internal_construct() { -#if _WIN32||_WIN64 - InitializeCriticalSection(&impl); - state = INITIALIZED; -#else - pthread_mutexattr_t mtx_attr; - int error_code = pthread_mutexattr_init( &mtx_attr ); - if( error_code ) - tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutexattr_init failed"); - - pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE ); - error_code = pthread_mutex_init( &impl, &mtx_attr ); - if( error_code ) - tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutex_init failed"); - pthread_mutexattr_destroy( &mtx_attr ); -#endif /* _WIN32||_WIN64*/ - ITT_SYNC_CREATE(&impl, _T("tbb::recursive_mutex"), _T("")); -} - -void recursive_mutex::internal_destroy() { -#if _WIN32||_WIN64 - switch( state ) { - case INITIALIZED: - DeleteCriticalSection(&impl); - break; - case DESTROYED: - __TBB_ASSERT(false,"recursive_mutex: already destroyed"); - break; - default: - __TBB_ASSERT(false,"recursive_mutex: illegal state for destruction"); - break; - } - state = DESTROYED; -#else - int error_code = pthread_mutex_destroy(&impl); - __TBB_ASSERT_EX(!error_code,"recursive_mutex: pthread_mutex_destroy failed"); -#endif /* _WIN32||_WIN64 */ -} - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_mutex.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_mutex.cpp deleted file mode 100644 index e233ffb337..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_mutex.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tbb_machine.h" -#include "tbb/spin_mutex.h" -#include "itt_notify.h" -#include "tbb_misc.h" - -namespace tbb { - -void spin_mutex::scoped_lock::internal_acquire( spin_mutex& m ) { - __TBB_ASSERT( !my_mutex, "already holding a lock on a spin_mutex" ); - ITT_NOTIFY(sync_prepare, &m); - my_unlock_value = __TBB_LockByte(m.flag); - my_mutex = &m; - ITT_NOTIFY(sync_acquired, &m); -} - -void spin_mutex::scoped_lock::internal_release() { - __TBB_ASSERT( my_mutex, "release on spin_mutex::scoped_lock that is not holding a lock" ); - __TBB_ASSERT( !(my_unlock_value&1), "corrupted scoped_lock?" ); - - ITT_NOTIFY(sync_releasing, my_mutex); - __TBB_store_with_release(my_mutex->flag, static_cast<unsigned char>(my_unlock_value)); - my_mutex = NULL; -} - -bool spin_mutex::scoped_lock::internal_try_acquire( spin_mutex& m ) { - __TBB_ASSERT( !my_mutex, "already holding a lock on a spin_mutex" ); - bool result = bool( __TBB_TryLockByte(m.flag) ); - if( result ) { - my_unlock_value = 0; - my_mutex = &m; - ITT_NOTIFY(sync_acquired, &m); - } - return result; -} - -void spin_mutex::internal_construct() { - ITT_SYNC_CREATE(this, _T("tbb::spin_mutex"), _T("")); -} - -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_rw_mutex.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_rw_mutex.cpp deleted file mode 100644 index 2b80a18caa..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/spin_rw_mutex.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/spin_rw_mutex.h" -#include "tbb_misc.h" -#include "itt_notify.h" - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (disable: 4244) -#endif - -namespace tbb { - -template<typename T> // a template can work with private spin_rw_mutex::state_t -static inline T CAS(volatile T &addr, T newv, T oldv) { - // ICC (9.1 and 10.1 tried) unable to do implicit conversion - // from "volatile T*" to "volatile void*", so explicit cast added. - return T(__TBB_CompareAndSwapW((volatile void *)&addr, (intptr_t)newv, (intptr_t)oldv)); -} - -//! Acquire write lock on the given mutex. -bool spin_rw_mutex_v3::internal_acquire_writer() -{ - ITT_NOTIFY(sync_prepare, this); - internal::ExponentialBackoff backoff; - for(;;) { - state_t s = const_cast<volatile state_t&>(state); // ensure reloading - if( !(s & BUSY) ) { // no readers, no writers - if( CAS(state, WRITER, s)==s ) - break; // successfully stored writer flag - backoff.reset(); // we could be very close to complete op. - } else if( !(s & WRITER_PENDING) ) { // no pending writers - __TBB_AtomicOR(&state, WRITER_PENDING); - } - backoff.pause(); - } - ITT_NOTIFY(sync_acquired, this); - return false; -} - -//! Release writer lock on the given mutex -void spin_rw_mutex_v3::internal_release_writer() -{ - ITT_NOTIFY(sync_releasing, this); - __TBB_AtomicAND( &state, READERS ); -} - -//! Acquire read lock on given mutex. -void spin_rw_mutex_v3::internal_acquire_reader() -{ - ITT_NOTIFY(sync_prepare, this); - internal::ExponentialBackoff backoff; - for(;;) { - state_t s = const_cast<volatile state_t&>(state); // ensure reloading - if( !(s & (WRITER|WRITER_PENDING)) ) { // no writer or write requests - state_t t = (state_t)__TBB_FetchAndAddW( &state, (intptr_t) ONE_READER ); - if( !( t&WRITER )) - break; // successfully stored increased number of readers - // writer got there first, undo the increment - __TBB_FetchAndAddW( &state, -(intptr_t)ONE_READER ); - } - backoff.pause(); - } - - ITT_NOTIFY(sync_acquired, this); - __TBB_ASSERT( state & READERS, "invalid state of a read lock: no readers" ); -} - -//! Upgrade reader to become a writer. -/** Returns true if the upgrade happened without re-acquiring the lock and false if opposite */ -bool spin_rw_mutex_v3::internal_upgrade() -{ - state_t s = state; - __TBB_ASSERT( s & READERS, "invalid state before upgrade: no readers " ); - // check and set writer-pending flag - // required conditions: either no pending writers, or we are the only reader - // (with multiple readers and pending writer, another upgrade could have been requested) - while( (s & READERS)==ONE_READER || !(s & WRITER_PENDING) ) { - state_t old_s = s; - if( (s=CAS(state, s | WRITER | WRITER_PENDING, s))==old_s ) { - internal::ExponentialBackoff backoff; - ITT_NOTIFY(sync_prepare, this); - // the state should be 0...0111, i.e. 1 reader and waiting writer; - // both new readers and writers are blocked - while( (state & READERS) != ONE_READER ) // more than 1 reader - backoff.pause(); - __TBB_ASSERT((state&(WRITER_PENDING|WRITER))==(WRITER_PENDING|WRITER),"invalid state when upgrading to writer"); - - __TBB_FetchAndAddW( &state, - (intptr_t)(ONE_READER+WRITER_PENDING)); - ITT_NOTIFY(sync_acquired, this); - return true; // successfully upgraded - } - } - // slow reacquire - internal_release_reader(); - return internal_acquire_writer(); // always returns false -} - -//! Downgrade writer to a reader -void spin_rw_mutex_v3::internal_downgrade() { - ITT_NOTIFY(sync_releasing, this); - __TBB_FetchAndAddW( &state, (intptr_t)(ONE_READER-WRITER)); - __TBB_ASSERT( state & READERS, "invalid state after downgrade: no readers" ); -} - -//! Release read lock on the given mutex -void spin_rw_mutex_v3::internal_release_reader() -{ - __TBB_ASSERT( state & READERS, "invalid state of a read lock: no readers" ); - ITT_NOTIFY(sync_releasing, this); // release reader - __TBB_FetchAndAddWrelease( &state,-(intptr_t)ONE_READER); -} - -//! Try to acquire write lock on the given mutex -bool spin_rw_mutex_v3::internal_try_acquire_writer() -{ - // for a writer: only possible to acquire if no active readers or writers - state_t s = state; - if( !(s & BUSY) ) // no readers, no writers; mask is 1..1101 - if( CAS(state, WRITER, s)==s ) { - ITT_NOTIFY(sync_acquired, this); - return true; // successfully stored writer flag - } - return false; -} - -//! Try to acquire read lock on the given mutex -bool spin_rw_mutex_v3::internal_try_acquire_reader() -{ - // for a reader: acquire if no active or waiting writers - state_t s = state; - if( !(s & (WRITER|WRITER_PENDING)) ) { // no writers - state_t t = (state_t)__TBB_FetchAndAddW( &state, (intptr_t) ONE_READER ); - if( !( t&WRITER )) { // got the lock - ITT_NOTIFY(sync_acquired, this); - return true; // successfully stored increased number of readers - } - // writer got there first, undo the increment - __TBB_FetchAndAddW( &state, -(intptr_t)ONE_READER ); - } - return false; -} - - -void spin_rw_mutex_v3::internal_construct() { - ITT_SYNC_CREATE(this, _T("tbb::spin_rw_mutex"), _T("")); -} -} // namespace tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/task.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/task.cpp deleted file mode 100644 index af1e6fbedd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/task.cpp +++ /dev/null @@ -1,4426 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -/* This file contains the TBB task scheduler. There are many classes - lumped together here because very few are exposed to the outside - world, and by putting them in a single translation unit, the - compiler's optimizer might be able to do a better job. */ - -#if USE_PTHREAD - - // Some pthreads documentation says that <pthread.h> must be first header. - #include <pthread.h> - #define __TBB_THREAD_ROUTINE - -#elif USE_WINTHREAD - - #include <windows.h> - #include <process.h> /* Need _beginthreadex from there */ - #include <malloc.h> /* Need _alloca from there */ - #define __TBB_THREAD_ROUTINE WINAPI - -#else - - #error Must define USE_PTHREAD or USE_WINTHREAD - -#endif - -#include <cassert> -#include <cstddef> -#include <cstdlib> -#include <cstring> -#include <cstdio> -#include <new> -#include "tbb/tbb_stddef.h" - -/* Temporarily change "private" to "public" while including "tbb/task.h". - This hack allows us to avoid publishing internal types and methods - in the public header files just for sake of friend declarations. */ -#define private public -#include "tbb/task.h" -#if __TBB_EXCEPTIONS -#include "tbb/tbb_exception.h" -#endif /* __TBB_EXCEPTIONS */ -#undef private - -#include "tbb/task_scheduler_init.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/tbb_stddef.h" -#include "tbb/tbb_machine.h" -#include "tbb_misc.h" -#include "tbb/mutex.h" -#include "tbb/atomic.h" -#include "tbb/gate.h" -#if __TBB_SCHEDULER_OBSERVER -#include "tbb/task_scheduler_observer.h" -#include "tbb/spin_rw_mutex.h" -#include "tbb/aligned_space.h" -#endif /* __TBB_SCHEDULER_OBSERVER */ -#if __TBB_EXCEPTIONS -#include "tbb/spin_mutex.h" -#endif /* __TBB_EXCEPTIONS */ - -#include "tbb/partitioner.h" - - -#if DO_TBB_TRACE -#include <cstdio> -#define TBB_TRACE(x) ((void)std::printf x) -#else -#define TBB_TRACE(x) ((void)(0)) -#endif /* DO_TBB_TRACE */ - -#if TBB_USE_ASSERT -#define COUNT_TASK_NODES 1 -#endif /* TBB_USE_ASSERT */ - -/* If nonzero, then gather statistics */ -#ifndef STATISTICS -#define STATISTICS 0 -#endif /* STATISTICS */ - -#if STATISTICS -#define GATHER_STATISTIC(x) (x) -#else -#define GATHER_STATISTIC(x) ((void)0) -#endif /* STATISTICS */ - -#if __TBB_EXCEPTIONS -// The standard offsetof macro does not work for us since its usage is restricted -// by POD-types only. Using 0x1000 (not NULL) is necessary to appease GCC. -#define __TBB_offsetof(class_name, member_name) \ - ((ptrdiff_t)&(reinterpret_cast<class_name*>(0x1000)->member_name) - 0x1000) -// Returns address of the object containing a member with the given name and address -#define __TBB_get_object_addr(class_name, member_name, member_addr) \ - reinterpret_cast<class_name*>((char*)member_addr - __TBB_offsetof(class_name, member_name)) -#endif /* __TBB_EXCEPTIONS */ - -// Macro __TBB_ALLOC_TASK_ARGS is an attempt to get rid of ugly ifdefs -// in the main part of the code. It drops some of its arguments depending on -// whether the corresponding controlling macros are defined. -// The first argument is just a convenience allowing to keep comma before the macro usage. -#if __TBB_EXCEPTIONS -#if __TBB_TASK_DEQUE - #define __TBB_ALLOC_TASK_ARGS(arg1, depth, context) arg1, context -#else /* !__TBB_TASK_DEQUE */ - #define __TBB_ALLOC_TASK_ARGS(arg1, depth, context) arg1, depth, context -#endif /* !__TBB_TASK_DEQUE */ -#else /* !__TBB_EXCEPTIONS */ -#if __TBB_TASK_DEQUE - #define __TBB_ALLOC_TASK_ARGS(arg1, depth, context) arg1 -#else /* !__TBB_TASK_DEQUE */ - #define __TBB_ALLOC_TASK_ARGS(arg1, depth, context) arg1, depth -#endif /* !__TBB_TASK_DEQUE */ -#endif /* !__TBB_EXCEPTIONS */ - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Workaround for overzealous compiler warnings - // These particular warnings are so ubquitous that no attempt is made to narrow - // the scope of the warnings. - #pragma warning (disable: 4100 4127 4312 4244 4267 4706) -#endif - -#include "itt_notify.h" - -namespace tbb { - -using namespace std; - -#if DO_ITT_NOTIFY - const tchar - *SyncType_GlobalLock = _T("TbbGlobalLock"), - *SyncType_Scheduler = _T("TbbScheduler") - ; - const tchar - *SyncObj_LibraryInitialization = _T("TbbLibraryInitialization"), - *SyncObj_SchedulerInitialization = _T("TbbSchedulerInitialization"), - *SyncObj_SchedulersList = _T("TbbSchedulersList"), - *SyncObj_TaskStealingLoop = _T("TBB Scheduler"), - *SyncObj_WorkerTaskPool = _T("TBB Scheduler"), - *SyncObj_MasterTaskPool = _T("TBB Scheduler"), - *SyncObj_GateLock = _T("TBB Scheduler"), - *SyncObj_Gate = _T("TBB Scheduler"), - *SyncObj_ContextsList = _T("TBB Scheduler") - ; -#endif /* DO_ITT_NOTIFY */ - -namespace internal { - -const stack_size_type MByte = 1<<20; -#if !defined(__TBB_WORDSIZE) -const stack_size_type ThreadStackSize = 1*MByte; -#elif __TBB_WORDSIZE<=4 -const stack_size_type ThreadStackSize = 2*MByte; -#else -const stack_size_type ThreadStackSize = 4*MByte; -#endif - -#if USE_PTHREAD -typedef void* thread_routine_return_type; -#else -typedef unsigned thread_routine_return_type; -#endif - -#if __TBB_TASK_DEQUE -//------------------------------------------------------------------------ -// General utility section -//------------------------------------------------------------------------ - -#if TBB_USE_ASSERT - #define __TBB_POISON_DEQUE 1 -#endif /* TBB_USE_ASSERT */ - -#if __TBB_POISON_DEQUE - #if __ia64__ - task* const poisoned_taskptr = (task*)0xDDEEAADDDEADBEEF; - #elif _WIN64 - task* const poisoned_taskptr = (task*)0xDDEEAADDDEADBEEF; - #else - task* const poisoned_taskptr = (task*)0xDEADBEEF; - #endif - - #define __TBB_POISON_TASK_PTR(ptr) ptr = poisoned_taskptr - #define __TBB_ASSERT_VALID_TASK_PTR(ptr) __TBB_ASSERT( ptr != poisoned_taskptr, "task pointer in the deque is poisoned" ) -#else /* !__TBB_POISON_DEQUE */ - #define __TBB_POISON_TASK_PTR(ptr) ((void)0) - #define __TBB_ASSERT_VALID_TASK_PTR(ptr) ((void)0) -#endif /* !__TBB_POISON_DEQUE */ - - -//! Vector that grows without reallocations, and stores items in the reverse order. -/** Requires to initialize its first segment with a preallocated memory chunk - (usually it is static array or an array allocated on the stack). - The second template parameter specifies maximal number of segments. Each next - segment is twice as large as the previous one. **/ -template<typename T, size_t max_segments = 16> -class fast_reverse_vector -{ -public: - fast_reverse_vector ( T* initial_segment, size_t segment_size ) - : m_cur_segment(initial_segment) - , m_cur_segment_size(segment_size) - , m_pos(segment_size) - , m_num_segments(0) - , m_size(0) - { - __TBB_ASSERT ( initial_segment && segment_size, "Nonempty initial segment must be supplied"); - } - - ~fast_reverse_vector () - { - for ( size_t i = 1; i < m_num_segments; ++i ) - NFS_Free( m_segments[i] ); - } - - size_t size () const { return m_size + m_cur_segment_size - m_pos; } - - void push_back ( const T& val ) - { - if ( !m_pos ) { - m_segments[m_num_segments++] = m_cur_segment; - __TBB_ASSERT ( m_num_segments < max_segments, "Maximal capacity exceeded" ); - m_size += m_cur_segment_size; - m_cur_segment_size *= 2; - m_pos = m_cur_segment_size; - m_cur_segment = (T*)NFS_Allocate( m_cur_segment_size * sizeof(T), 1, NULL ); - } - m_cur_segment[--m_pos] = val; - } - - //! Copies the contents of the vector into the dst array. - /** Can only be used when T is a POD type, as copying does not invoke copy constructors. **/ - void copy_memory ( T* dst ) const - { - size_t size = m_cur_segment_size - m_pos; - memcpy( dst, m_cur_segment + m_pos, size * sizeof(T) ); - dst += size; - size = m_cur_segment_size / 2; - for ( long i = (long)m_num_segments - 1; i >= 0; --i ) { - memcpy( dst, m_segments[i], size * sizeof(T) ); - dst += size; - size /= 2; - } - } - -protected: - //! The current (not completely filled) segment - T *m_cur_segment; - - //! Capacity of m_cur_segment - size_t m_cur_segment_size; - - //! Insertion position in m_cur_segment - size_t m_pos; - - //! Array of filled segments (has fixed size specified by the second template parameter) - T *m_segments[max_segments]; - - //! Number of filled segments (the size of m_segments) - size_t m_num_segments; - - //! Number of items in the segments in m_segments - size_t m_size; - -}; // class fast_reverse_vector - -//------------------------------------------------------------------------ -// End of general utility section -//------------------------------------------------------------------------ -#endif /* __TBB_TASK_DEQUE */ - -//! Alignment for a task object -const size_t task_alignment = 16; - -//! Number of bytes reserved for a task prefix -/** If not exactly sizeof(task_prefix), the extra bytes *precede* the task_prefix. */ -const size_t task_prefix_reservation_size = ((sizeof(internal::task_prefix)-1)/task_alignment+1)*task_alignment; - -template<typename SchedulerTraits> class CustomScheduler; - -#if !__TBB_TASK_DEQUE -typedef task::depth_type depth_type; -#endif /* !__TBB_TASK_DEQUE */ - -class mail_outbox; - -struct task_proxy: public task { - static const intptr pool_bit = 1; - static const intptr mailbox_bit = 2; - /* All but two low-order bits represent a (task*). - Two low-order bits mean: - 1 = proxy is/was/will be in task pool - 2 = proxy is/was/will be in mailbox */ - intptr task_and_tag; - - //! Pointer to next task_proxy in a mailbox - task_proxy* next_in_mailbox; - - //! Mailbox to which this was mailed. - mail_outbox* outbox; -}; - -//! Internal representation of mail_outbox, without padding. -class unpadded_mail_outbox { -protected: - //! Pointer to first task_proxy in mailbox, or NULL if box is empty. - task_proxy* my_first; - - //! Pointer to last task_proxy in mailbox, or NULL if box is empty. - /** Low-order bit set to 1 to represent lock on the box. */ - task_proxy* my_last; - - //! Owner of mailbox is not executing a task, and has drained its own task pool. - bool my_is_idle; -}; - -//! Class representing where mail is put. -/** Padded to occupy a cache line. */ -class mail_outbox: unpadded_mail_outbox { - char pad[NFS_MaxLineSize-sizeof(unpadded_mail_outbox)]; - - //! Acquire lock on the box. - task_proxy* acquire() { - ExponentialBackoff backoff; - for(;;) { - // No fence on load, because subsequent compare-and-swap has the necessary fence. - intptr last = (intptr)my_last; - if( (last&1)==0 && __TBB_CompareAndSwapW(&my_last,last|1,last)==last) { - __TBB_ASSERT( (my_first==NULL)==((intptr(my_last)&~1)==0), NULL ); - return (task_proxy*)last; - } - backoff.pause(); - } - } - task_proxy* internal_pop() { - //! No fence on load of my_first, because if it is NULL, there's nothing further to read from another thread. - task_proxy* result = my_first; - if( result ) { - if( task_proxy* f = __TBB_load_with_acquire(result->next_in_mailbox) ) { - // No lock required - __TBB_store_with_release( my_first, f ); - } else { - // acquire() has the necessary fence. - task_proxy* l = acquire(); - __TBB_ASSERT(result==my_first,NULL); - if( !(my_first = result->next_in_mailbox) ) - l=0; - __TBB_store_with_release( my_last, l ); - } - } - return result; - } -public: - friend class mail_inbox; - - //! Push task_proxy onto the mailbox queue of another thread. - void push( task_proxy& t ) { - __TBB_ASSERT(&t!=NULL, NULL); - t.next_in_mailbox = NULL; - if( task_proxy* l = acquire() ) { - l->next_in_mailbox = &t; - } else { - my_first=&t; - } - // Fence required because caller is sending the task_proxy to another thread. - __TBB_store_with_release( my_last, &t ); - } -#if TBB_USE_ASSERT - //! Verify that *this is initialized empty mailbox. - /** Raise assertion if *this is not in initialized state, or sizeof(this) is wrong. - Instead of providing a constructor, we provide this assertion, because for - brevity and speed, we depend upon a memset to initialize instances of this class */ - void assert_is_initialized() const { - __TBB_ASSERT( sizeof(*this)==NFS_MaxLineSize, NULL ); - __TBB_ASSERT( !my_first, NULL ); - __TBB_ASSERT( !my_last, NULL ); - __TBB_ASSERT( !my_is_idle, NULL ); - } -#endif /* TBB_USE_ASSERT */ - - //! Drain the mailbox - intptr drain() { - intptr k = 0; - // No fences here because other threads have already quit. - for( ; task_proxy* t = my_first; ++k ) { - my_first = t->next_in_mailbox; - NFS_Free((char*)t-task_prefix_reservation_size); - } - return k; - } - - //! True if thread that owns this mailbox is looking for work. - bool recipient_is_idle() { - return my_is_idle; - } -}; - -//! Class representing source of mail. -class mail_inbox { - //! Corresponding sink where mail that we receive will be put. - mail_outbox* my_putter; -public: - //! Construct unattached inbox - mail_inbox() : my_putter(NULL) {} - - //! Attach inbox to a corresponding outbox. - void attach( mail_outbox& putter ) { - __TBB_ASSERT(!my_putter,"already attached"); - my_putter = &putter; - } - //! Detach inbox from its outbox - void detach() { - __TBB_ASSERT(my_putter,"not attached"); - my_putter = NULL; - } - //! Get next piece of mail, or NULL if mailbox is empty. - task_proxy* pop() { - return my_putter->internal_pop(); - } - void set_is_idle( bool value ) { - if( my_putter ) { - __TBB_ASSERT( my_putter->my_is_idle==!value, NULL ); - my_putter->my_is_idle = value; - } - } -#if DO_ITT_NOTIFY - //! Get pointer to corresponding outbox used for ITT_NOTIFY calls. - void* outbox() const {return my_putter;} -#endif /* DO_ITT_NOTIFY */ -}; - -#if __TBB_SCHEDULER_OBSERVER -//------------------------------------------------------------------------ -// observer_proxy -//------------------------------------------------------------------------ -class observer_proxy { - friend class task_scheduler_observer_v3; - //! Reference count used for garbage collection. - /** 1 for reference from my task_scheduler_observer. - 1 for each local_last_observer_proxy that points to me. - No accounting for predecessor in the global list. - No accounting for global_last_observer_proxy that points to me. */ - atomic<int> gc_ref_count; - //! Pointer to next task_scheduler_observer - /** Valid even when *this has been removed from the global list. */ - observer_proxy* next; - //! Pointer to previous task_scheduler_observer in global list. - observer_proxy* prev; - //! Associated observer - task_scheduler_observer* observer; - //! Account for removing reference from p. No effect if p is NULL. - void remove_ref_slow(); - void remove_from_list(); - observer_proxy( task_scheduler_observer_v3& wo ); -public: - static observer_proxy* process_list( observer_proxy* local_last, bool is_worker, bool is_entry ); -}; -#endif /* __TBB_SCHEDULER_OBSERVER */ - -#if !__TBB_TASK_DEQUE -//------------------------------------------------------------------------ -// TaskPool -//------------------------------------------------------------------------ - -//! Prefix to a TaskPool -class TaskPoolPrefix { - static const unsigned null_arena_index = ~0u; - - unsigned arena_index; - - //! Index of first non-empty element of TaskPool::array - depth_type steal_begin; - - friend class GenericScheduler; - friend class TaskPool; -}; // class TaskPoolPrefix - -//! Pool of tasks, organized as a deque. -class TaskPool { - typedef size_t size_type; - - static const size_type min_array_size = (NFS_MaxLineSize-sizeof(TaskPoolPrefix))/sizeof(task*); - - /** Must be last field, because it is really array of indeterminate length. */ - task* array[min_array_size]; - - //! Get reference to prefix portion - TaskPoolPrefix& prefix() const {return ((TaskPoolPrefix*)(void*)this)[-1];} - - //! Return number of bytes required to allocate a pool with given number of array elements. - static size_t byte_size( size_type array_size ) { - return sizeof(TaskPoolPrefix)+array_size*sizeof(task*); - } - - //! Allocate TaskPool object with given number of array elements. - static TaskPool* allocate_task_pool( size_type array_size ) { - __TBB_ASSERT( array_size>0, NULL ); - size_t n = byte_size(array_size); - unsigned char* storage = (unsigned char*)NFS_Allocate( n, 1, NULL ); - memset( storage, 0, n ); - return (TaskPool*)(storage+sizeof(TaskPoolPrefix)); - } - - //! Deallocate a TaskPool that was allocated by method allocate. - void free_task_pool() { - __TBB_ASSERT( this, "attempt to free NULL TaskPool" ); - NFS_Free( &prefix() ); - } - - friend class GenericScheduler; - template<typename SchedulerTraits> friend class internal::CustomScheduler; - -#if TBB_USE_ASSERT - bool assert_okay() const { - __TBB_ASSERT( this!=NULL, NULL ); - __TBB_ASSERT( prefix().steal_begin>=-4, NULL ); - return true; - } -#endif /* TBB_USE_ASSERT */ -}; // class TaskPool -#endif /* !__TBB_TASK_DEQUE */ - -//------------------------------------------------------------------------ -// Arena -//------------------------------------------------------------------------ - -class Arena; -class GenericScheduler; - -struct WorkerDescriptor { - //! NULL until worker is published. -1 if worker should not be published. - GenericScheduler* scheduler; - - Arena* arena; - - //! Start worker thread for this descriptor. - void start_one_worker_thread(); -}; - -//! The useful contents of an ArenaPrefix -class UnpaddedArenaPrefix: no_copy -{ - friend class GenericScheduler; - template<typename SchedulerTraits> friend class internal::CustomScheduler; - friend class Arena; - friend class Governor; - friend struct WorkerDescriptor; - -#if __TBB_TASK_DEQUE - //! Arena slot to try to acquire first for the next new master. - unsigned limit; -#else /* !__TBB_TASK_DEQUE */ - //! One more than index of highest arena slot currently in use. - atomic<size_t> limit; -#endif /* !__TBB_TASK_DEQUE */ - - //! Number of masters that own this arena. - /** This may be smaller than the number of masters who have entered the arena. */ - unsigned number_of_masters; - - //! Total number of slots in the arena - const unsigned number_of_slots; - - //! Number of workers that belong to this arena - const unsigned number_of_workers; - - //! Number of workers still using this arena (plus one if a master is still using the arena) - atomic<int> gc_ref_count; - - //! Stack size of worker threads - stack_size_type stack_size; - - //! Array of workers. - WorkerDescriptor* worker_list; - -#if COUNT_TASK_NODES - //! Net number of nodes that have been allocated from heap. - /** Updated each time a scheduler is destroyed. */ - atomic<intptr> task_node_count; -#endif /* COUNT_TASK_NODES */ - - //! Gate at which worker threads wait until a master spawns a task. - Gate gate; - -protected: - UnpaddedArenaPrefix( unsigned number_of_slots_, unsigned number_of_workers_ ) : - number_of_masters(1), - number_of_slots(number_of_slots_), - number_of_workers(number_of_workers_) - { -#if COUNT_TASK_NODES - task_node_count = 0; -#endif /* COUNT_TASK_NODES */ - limit = number_of_workers_; - gc_ref_count = number_of_workers_+1; - } -}; - -//! The prefix to Arena with padding. -class ArenaPrefix: public UnpaddedArenaPrefix { - //! Padding to fill out to multiple of cache line size. - char pad[(sizeof(UnpaddedArenaPrefix)/NFS_MaxLineSize+1)*NFS_MaxLineSize-sizeof(UnpaddedArenaPrefix)]; - -public: - ArenaPrefix( unsigned number_of_slots_, unsigned number_of_workers_ ) : - UnpaddedArenaPrefix(number_of_slots_,number_of_workers_) - { - } -}; - -#if __TBB_TASK_DEQUE - -struct ArenaSlot { - // Task pool (the deque of task pointers) of the scheduler that owns this slot - /** Also is used to specify if the slot is empty or locked: - 0 - empty - -1 - locked **/ - task** task_pool; - - //! Index of the first ready task in the deque. - /** Modified by thieves, and by the owner during compaction/reallocation **/ - size_t head; - - //! Padding to avoid false sharing caused by the thieves accessing this slot - char pad1[NFS_MaxLineSize - sizeof(size_t) - sizeof(task**)]; - - //! Index of the element following the last ready task in the deque. - /** Modified by the owner thread. **/ - size_t tail; - - //! Padding to avoid false sharing caused by the thieves accessing the next slot - char pad2[NFS_MaxLineSize - sizeof(size_t)]; -}; - -#else /* !__TBB_TASK_DEQUE */ - -struct UnpaddedArenaSlot { - //! Holds copy of task_pool->deepest and a lock bit - /** Computed as 2*task_pool->deepest+(is_locked). - I.e., the low order bit indicates whether the slot is locked. - -2 denotes an empty task pool - -3 denotes an unused arena slot that is locked - -4 denotes an unused arena slot that is unlocked */ - depth_type steal_end; - TaskPool* task_pool; - bool owner_waits; -}; - -struct ArenaSlot: UnpaddedArenaSlot { - char pad[NFS_MaxLineSize-sizeof(UnpaddedArenaSlot)]; -}; -#endif /* !__TBB_TASK_DEQUE */ - -class Arena { - friend class GenericScheduler; - template<typename SchedulerTraits> friend class internal::CustomScheduler; - friend class Governor; - friend struct WorkerDescriptor; - - //! Get reference to prefix portion - ArenaPrefix& prefix() const {return ((ArenaPrefix*)(void*)this)[-1];} - - //! Get reference to mailbox corresponding to given affinity_id. - mail_outbox& mailbox( affinity_id id ) { - __TBB_ASSERT( 0<id, "id must be positive integer" ); - __TBB_ASSERT( id <= prefix().number_of_slots, "id out of bounds" ); - return ((mail_outbox*)&prefix())[-(int)id]; - } - - //! Allocate an instance of Arena, and prepare everything to start workers. - static Arena* allocate_arena( unsigned number_of_slots, unsigned number_of_workers, stack_size_type stack_size ); - - void free_arena() { - // Drain mailboxes - // TODO: each scheduler should plug-and-drain its own mailbox when it terminates. - intptr drain_count = 0; - for( unsigned i=1; i<=prefix().number_of_slots; ++i ) - drain_count += mailbox(i).drain(); -#if COUNT_TASK_NODES - prefix().task_node_count -= drain_count; -#if !TEST_ASSEMBLY_ROUTINES - if( prefix().task_node_count ) { - fprintf(stderr,"warning: leaked %ld task objects\n", long(prefix().task_node_count)); - } -#endif /* !TEST_ASSEMBLY_ROUTINES */ -#endif /* COUNT_TASK_NODES */ - void* storage = &mailbox(prefix().number_of_slots); - delete[] prefix().worker_list; - prefix().~ArenaPrefix(); - NFS_Free( storage ); - } - - //! No tasks to steal since last snapshot was taken - static const Gate::state_t SNAPSHOT_EMPTY = 0; - - //! At least one task has been offered for stealing since the last snapshot started - static const Gate::state_t SNAPSHOT_FULL = -1; - - //! Gate is permanently open - static const Gate::state_t SNAPSHOT_PERMANENTLY_OPEN = -2; - - //! If necessary, inform gate that task was added to pool recently. - void mark_pool_full(); - - //! Wait while pool is empty - /** Return true if pool transitioned from non-empty to empty while thread was waiting. */ - bool wait_while_pool_is_empty(); - - //! Terminate worker threads - /** Wait for worker threads to complete. */ - void terminate_workers(); - - //! Remove a reference to the arena, and free the arena if no references remain. - void remove_gc_reference(); - -#if COUNT_TASK_NODES - //! Returns the number of task objects "living" in worker threads - inline intptr workers_task_node_count(); -#endif - - /** Must be last field */ - ArenaSlot slot[1]; -}; - -//------------------------------------------------------------------------ -//! Traits classes for scheduler -//------------------------------------------------------------------------ - -struct DefaultSchedulerTraits { - static const int id = 0; - static const bool itt_possible = true; - static const bool has_slow_atomic = false; -}; - -struct IntelSchedulerTraits { - static const int id = 1; - static const bool itt_possible = false; -#if __TBB_x86_32||__TBB_x86_64 - static const bool has_slow_atomic = true; -#else - static const bool has_slow_atomic = false; -#endif /* __TBB_x86_32||__TBB_x86_64 */ -}; - -//------------------------------------------------------------------------ -// Class __TBB_InitOnce -//------------------------------------------------------------------------ - -//! Class that supports TBB initialization. -/** It handles acquisition and release of global resources (e.g. TLS) during startup and shutdown, - as well as synchronization for DoOneTimeInitializations. */ -class __TBB_InitOnce { - friend void DoOneTimeInitializations(); - - static atomic<int> count; - - //! Platform specific code to acquire resources. - static void acquire_resources(); - - //! Platform specific code to release resources. - static void release_resources(); - - static bool InitializationDone; -#if USE_PTHREAD - static pthread_mutex_t InitializationLock; -public: - static void lock() { - int status = pthread_mutex_lock( &InitializationLock ); - if( status ) - handle_perror(status,"pthread_mutex_lock"); - } - static void unlock() { - int status = pthread_mutex_unlock( &InitializationLock ); - if( status ) - handle_perror(status,"pthread_mutex_unlock"); - } -#else /* USE_WINTHREAD */ - static CRITICAL_SECTION InitializationLock; -public: - static void lock() { EnterCriticalSection( &InitializationLock ); } - static void unlock() { LeaveCriticalSection( &InitializationLock ); } -#endif - - static bool initialization_done() { - return __TBB_load_with_acquire(InitializationDone); - } - - //! Add initial reference to resources. - /** We assume that dynamic loading of the library prevents any other threads from entering the library - until this constructor has finished running. */ - __TBB_InitOnce() { add_ref(); } - - //! Remove the initial reference to resources. - /** This is not necessarily the last reference if other threads are still running. - If the extra reference from DoOneTimeInitializations is present, remove it as well.*/ - ~__TBB_InitOnce(); - - //! Add reference to resources. If first reference added, acquire the resources. - static void add_ref() { - if( ++count==1 ) - acquire_resources(); - } - //! Remove reference to resources. If last reference removed, release the resources. - static void remove_ref() { - int k = --count; - __TBB_ASSERT(k>=0,"removed __TBB_InitOnce ref that was not added?"); - if( k==0 ) - release_resources(); - } -}; // class __TBB_InitOnce - -//------------------------------------------------------------------------ -// Class Governor -//------------------------------------------------------------------------ - -//! The class handles access to the single instance of Arena, and to TLS to keep scheduler instances. -/** It also supports automatic on-demand intialization of the TBB scheduler. - The class contains only static data members and methods.*/ -class Governor { - friend class __TBB_InitOnce; - - static tls<GenericScheduler*> theTLS; - static Arena* theArena; - static mutex theArenaMutex; - - //! Create key for thread-local storage. - static void create_tls() { -#if __TBB_TASK_SCHEDULER_AUTO_INIT && USE_PTHREAD - int status = theTLS.create(auto_terminate); -#else - int status = theTLS.create(); -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - if( status ) - handle_perror(status, "TBB failed to initialize TLS storage\n"); - } - - //! Destroy the thread-local storage key. - static void destroy_tls() { -#if TBB_USE_ASSERT - if( __TBB_InitOnce::initialization_done() && local_scheduler() ) - fprintf(stderr, "TBB is unloaded while tbb::task_scheduler_init object is alive?"); -#endif - int status = theTLS.destroy(); - if( status ) - handle_perror(status, "TBB failed to destroy TLS storage"); - } - -#if __TBB_TASK_SCHEDULER_AUTO_INIT - //! The internal routine to undo automatic initialization. - /** The signature is written with void* so that the routine - can be the destructor argument to pthread_key_create. */ - static void auto_terminate(void* scheduler); -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - -public: - //! Obtain the instance of arena to register a new master thread - /** If there is no active arena, create one. */ - static Arena* obtain_arena( int number_of_threads, stack_size_type thread_stack_size ) - { - Arena* a; - mutex::scoped_lock lock( theArenaMutex ); - a = theArena; - if( a ) { - a->prefix().number_of_masters += 1; - } else { - if( number_of_threads==task_scheduler_init::automatic ) - number_of_threads = task_scheduler_init::default_num_threads(); - a = Arena::allocate_arena( 2*number_of_threads, number_of_threads-1, - thread_stack_size?thread_stack_size:ThreadStackSize ); - __TBB_ASSERT( a->prefix().number_of_masters==1, NULL ); - // Publish the Arena. - // A memory release fence is not required here, because workers have not started yet, - // and concurrent masters inspect theArena while holding theArenaMutex. - __TBB_ASSERT( !theArena, NULL ); - theArena = a; - lock.release(); - // Attach threads to workers - if( number_of_threads>1 ) // there should be worker threads - a->prefix().worker_list[0].start_one_worker_thread(); - } - return a; - } - - //! Dereference arena when a master thread stops using TBB. - /** If no more masters in the arena, terminate workers and destroy it. */ - static void finish_with_arena() { - Arena* a; - { - mutex::scoped_lock lock( theArenaMutex ); - a = theArena; - __TBB_ASSERT( a, "theArena is missing" ); - if( --(a->prefix().number_of_masters) ) - a = NULL; - else - theArena = NULL; - } - if( a ) - a->terminate_workers(); - } - - static size_t number_of_workers_in_arena() { - __TBB_ASSERT( theArena, "thread did not activate a task_scheduler_init object?" ); - // No fence required to read theArena, because it does not change after the thread starts. - return theArena->prefix().number_of_workers; - } - - //! Register TBB scheduler instance in thread local storage. - inline static void sign_on(GenericScheduler* s); - - //! Unregister TBB scheduler instance from thread local storage. - inline static void sign_off(GenericScheduler* s); - - //! Obtain the thread local instance of TBB scheduler. - /** Returns NULL if this is the first time the thread has requested a scheduler. - It's the client's responsibility to check for the NULL, because in many - contexts, we can prove that it cannot be NULL. */ - static GenericScheduler* local_scheduler() { - __TBB_ASSERT( __TBB_InitOnce::initialization_done(), "thread did not activate a task_scheduler_init object?" ); - return theTLS.get(); - } - -#if __TBB_TASK_SCHEDULER_AUTO_INIT - //! Create a thread local instance of TBB scheduler on demand. - static GenericScheduler* local_scheduler_with_auto_init(); - - //! Undo automatic initialization if necessary; call when a thread exits. - static void terminate_auto_initialized_scheduler() { - auto_terminate(theTLS.get()); - } -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - -}; // class Governor - -//------------------------------------------------------------------------ -// Begin shared data layout. -// -// The following global data items are read-only after initialization. -// The first item is aligned on a 128 byte boundary so that it starts a new cache line. -//------------------------------------------------------------------------ - -tls<GenericScheduler*> Governor::theTLS; -Arena * Governor::theArena; -mutex Governor::theArenaMutex; - -//! Number of hardware threads -/** One more than the default number of workers. */ -static int DefaultNumberOfThreads; - -//! T::id for the scheduler traits type T to use for the scheduler -/** For example, the default value is DefaultSchedulerTraits::id. */ -static int SchedulerTraitsId; - -//! Counter of references to global shared resources such as TLS. -atomic<int> __TBB_InitOnce::count; - -#if USE_PTHREAD - pthread_mutex_t __TBB_InitOnce::InitializationLock = PTHREAD_MUTEX_INITIALIZER; -#else - CRITICAL_SECTION __TBB_InitOnce::InitializationLock; -#endif - -//! Flag that is set to true after one-time initializations are done. -bool __TBB_InitOnce::InitializationDone; - -#if DO_ITT_NOTIFY - static bool ITT_Present; - static bool ITT_InitializationDone; -#endif - -#if (__linux__ || __APPLE__) && __GNUC__ && !(__INTEL_COMPILER && __TBB_ipf) - // Use GCC-style attribute to set the highest initialization priority (the lowest possible number) - // ICC for IA-64 has a bug in handling init_priority so skipping in this case - static __TBB_InitOnce __TBB_InitOnceHiddenInstance __attribute__((init_priority (101))); -#elif !(_WIN32||_WIN64) || __TBB_TASK_CPP_DIRECTLY_INCLUDED - static __TBB_InitOnce __TBB_InitOnceHiddenInstance; -#endif - -#if __TBB_SCHEDULER_OBSERVER -typedef spin_rw_mutex::scoped_lock task_scheduler_observer_mutex_scoped_lock; -/** aligned_space used here to shut up warnings when mutex destructor is called while threads are still using it. */ -static aligned_space<spin_rw_mutex,1> the_task_scheduler_observer_mutex; -static observer_proxy* global_first_observer_proxy; -static observer_proxy* global_last_observer_proxy; -#endif /* __TBB_SCHEDULER_OBSERVER */ - -//! Table of primes used by fast random-number generator. -/** Also serves to keep anything else from being placed in the same - cache line as the global data items preceding it. */ -static const unsigned Primes[] = { - 0x9e3779b1, 0xffe6cc59, 0x2109f6dd, 0x43977ab5, - 0xba5703f5, 0xb495a877, 0xe1626741, 0x79695e6b, - 0xbc98c09f, 0xd5bee2b3, 0x287488f9, 0x3af18231, - 0x9677cd4d, 0xbe3a6929, 0xadc6a877, 0xdcf0674b, - 0xbe4d6fe9, 0x5f15e201, 0x99afc3fd, 0xf3f16801, - 0xe222cfff, 0x24ba5fdb, 0x0620452d, 0x79f149e3, - 0xc8b93f49, 0x972702cd, 0xb07dd827, 0x6c97d5ed, - 0x085a3d61, 0x46eb5ea7, 0x3d9910ed, 0x2e687b5b, - 0x29609227, 0x6eb081f1, 0x0954c4e1, 0x9d114db9, - 0x542acfa9, 0xb3e6bd7b, 0x0742d917, 0xe9f3ffa7, - 0x54581edb, 0xf2480f45, 0x0bb9288f, 0xef1affc7, - 0x85fa0ca7, 0x3ccc14db, 0xe6baf34b, 0x343377f7, - 0x5ca19031, 0xe6d9293b, 0xf0a9f391, 0x5d2e980b, - 0xfc411073, 0xc3749363, 0xb892d829, 0x3549366b, - 0x629750ad, 0xb98294e5, 0x892d9483, 0xc235baf3, - 0x3d2402a3, 0x6bdef3c9, 0xbec333cd, 0x40c9520f -}; - -#if STATISTICS -//! Class for collecting statistics -/** There should be only one instance of this class. - Results are written to a file "statistics.txt" in tab-separated format. */ -static class statistics { -public: - statistics() { - my_file = fopen("statistics.txt","w"); - if( !my_file ) { - perror("fopen(\"statistics.txt\"\")"); - exit(1); - } - fprintf(my_file,"%13s\t%13s\t%13s\t%13s\t%13s\t%13s\n", "execute", "steal", "mail", "proxy_execute", "proxy_steal", "proxy_bypass" ); - } - ~statistics() { - fclose(my_file); - } - void record( long execute_count, long steal_count, long mail_received_count, - long proxy_execute_count, long proxy_steal_count, long proxy_bypass_count ) { - mutex::scoped_lock lock(my_mutex); - fprintf (my_file,"%13ld\t%13ld\t%13ld\t%13ld\t%13ld\t%13ld\n", execute_count, steal_count, mail_received_count, - proxy_execute_count, proxy_steal_count, proxy_bypass_count ); - } -private: - //! File into which statistics are written. - FILE* my_file; - //! Mutex that serializes accesses to my_file - mutex my_mutex; -} the_statistics; -#endif /* STATISTICS */ - -#if __TBB_EXCEPTIONS - struct scheduler_list_node_t { - scheduler_list_node_t *my_prev, - *my_next; - }; - - //! Head of the list of master thread schedulers. - static scheduler_list_node_t the_scheduler_list_head; - - //! Mutex protecting access to the list of schedulers. - static mutex the_scheduler_list_mutex; - -//! Counter that is incremented whenever new cancellation signal is sent to a task group. -/** Together with GenericScheduler::local_cancel_count forms cross-thread signaling - mechanism that allows to avoid locking at the hot path of normal execution flow. - - When a descendant task group context is being registered or unregistered, - the global and local counters are compared. If they differ, it means that - a cancellation signal is being propagated, and registration/deregistration - routines take slower branch that may block (at most one thread of the pool - can be blocked at any moment). Otherwise the control path is lock-free and fast. **/ - static uintptr_t global_cancel_count = 0; - - //! Context to be associated with dummy tasks of worker threads schedulers. - /** It is never used for its direct purpose, and is introduced solely for the sake - of avoiding one extra conditional branch in the end of wait_for_all method. **/ - static task_group_context dummy_context(task_group_context::isolated); -#endif /* __TBB_EXCEPTIONS */ - -//------------------------------------------------------------------------ -// End of shared data layout -//------------------------------------------------------------------------ - -//! Amount of time to pause between steals. -/** The default values below were found to be best empirically for K-Means - on the 32-way Altix and 4-way (*2 for HT) fxqlin04. */ -#if __TBB_ipf -static const long PauseTime = 1500; -#else -static const long PauseTime = 80; -#endif - -//------------------------------------------------------------------------ -// One-time Initializations -//------------------------------------------------------------------------ - - -//! Defined in cache_aligned_allocator.cpp -extern void initialize_cache_aligned_allocator(); - -#if DO_ITT_NOTIFY -//! Performs initialization of tools support. -/** Defined in task.cpp. Must be called in a protected do-once manner. - \return true if notification hooks were installed, false otherwise. **/ -bool InitializeITT(); - -/** Calls tools interoperability mechanisms initialization routine in a protected - manner ensuring that it is done only once. - Used by dummy handlers only. **/ -#if __TBB_NEW_ITT_NOTIFY -extern "C" -#endif -void ITT_DoOneTimeInitialization() { -#if !TBB_USE_DEBUG - // In debug builds constructor of one of the static TBB mutexes is called - // first and invokes proxy ITT handler before our do-once mutex is initialized. - // Since this kind of initialization takes place under the loader lock, it is - // safe to omit synchronization here. - __TBB_InitOnce::lock(); -#endif - if ( !ITT_InitializationDone ) { - ITT_Present = InitializeITT(); - ITT_InitializationDone = true; - } -#if !TBB_USE_DEBUG - __TBB_InitOnce::unlock(); -#endif -} -#endif /* DO_ITT_NOTIFY */ - -//! Performs lazy one-time initializations. -void DoOneTimeInitializations() { - __TBB_InitOnce::lock(); - // No fence required for load of InitializationDone, because we are inside a critical section. - if( !__TBB_InitOnce::InitializationDone ) { - __TBB_InitOnce::add_ref(); - if( GetBoolEnvironmentVariable("TBB_VERSION") ) - PrintVersion(); - bool have_itt = false; -#if DO_ITT_NOTIFY - if ( !ITT_InitializationDone ) { - ITT_Present = InitializeITT(); - ITT_InitializationDone = true; - } - have_itt = ITT_Present; -#endif /* DO_ITT_NOTIFY */ - initialize_cache_aligned_allocator(); - if( !have_itt ) - SchedulerTraitsId = IntelSchedulerTraits::id; -#if __TBB_EXCEPTIONS - else { - ITT_SYNC_CREATE(&the_scheduler_list_mutex, SyncType_GlobalLock, SyncObj_SchedulersList); - } -#endif /* __TBB_EXCEPTIONS */ - PrintExtraVersionInfo( "SCHEDULER", - SchedulerTraitsId==IntelSchedulerTraits::id ? "Intel" : "default" ); -#if __TBB_EXCEPTIONS - the_scheduler_list_head.my_next = &the_scheduler_list_head; - the_scheduler_list_head.my_prev = &the_scheduler_list_head; -#endif /* __TBB_EXCEPTIONS */ - __TBB_InitOnce::InitializationDone = true; - } - __TBB_InitOnce::unlock(); -} - -//------------------------------------------------------------------------ -// Methods of class __TBB_InitOnce -//------------------------------------------------------------------------ - -__TBB_InitOnce::~__TBB_InitOnce() { - remove_ref(); - // It is assumed that InitializationDone is not set after file-scope destructors start running, - // and thus no race on InitializationDone is possible. - if( initialization_done() ) { - // Remove reference that we added in DoOneTimeInitializations. - remove_ref(); - } -} - -void __TBB_InitOnce::acquire_resources() { - Governor::create_tls(); -#if _WIN32||_WIN64 - InitializeCriticalSection(&InitializationLock); -#endif - ITT_SYNC_CREATE(&InitializationLock, SyncType_GlobalLock, SyncObj_LibraryInitialization); - ITT_SYNC_CREATE(&(Governor::theArenaMutex), SyncType_GlobalLock, SyncObj_SchedulerInitialization); -} - -void __TBB_InitOnce::release_resources() { -#if _WIN32||_WIN64 - DeleteCriticalSection(&InitializationLock); -#endif - Governor::destroy_tls(); -} - -#if (_WIN32||_WIN64) && !__TBB_TASK_CPP_DIRECTLY_INCLUDED -//! Windows "DllMain" that handles startup and shutdown of dynamic library. -extern "C" bool WINAPI DllMain( HANDLE /*hinstDLL*/, DWORD reason, LPVOID /*lpvReserved*/ ) { - switch( reason ) { - case DLL_PROCESS_ATTACH: - __TBB_InitOnce::add_ref(); - break; - case DLL_PROCESS_DETACH: - __TBB_InitOnce::remove_ref(); - // It is assumed that InitializationDone is not set after DLL_PROCESS_DETACH, - // and thus no race on InitializationDone is possible. - if( __TBB_InitOnce::initialization_done() ) { - // Remove reference that we added in DoOneTimeInitializations. - __TBB_InitOnce::remove_ref(); - } - break; -#if __TBB_TASK_SCHEDULER_AUTO_INIT - case DLL_THREAD_DETACH: - Governor::terminate_auto_initialized_scheduler(); - break; -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - } - return true; -} -#endif /* (_WIN32||_WIN64) && !__TBB_TASK_CPP_DIRECTLY_INCLUDED */ - -//------------------------------------------------------------------------ -// FastRandom -//------------------------------------------------------------------------ - -//! A fast random number generator. -/** Uses linear congruential method. */ -class FastRandom { - unsigned x, a; -public: - //! Get a random number. - unsigned short get() { - unsigned short r = x>>16; - x = x*a+1; - return r; - } - //! Construct a random number generator. - FastRandom( unsigned seed ) { - x = seed; - a = Primes[seed%(sizeof(Primes)/sizeof(Primes[0]))]; - } -}; - -//------------------------------------------------------------------------ -// GenericScheduler -//------------------------------------------------------------------------ - -// A pure virtual destructor should still have a body -// so the one for tbb::internal::scheduler::~scheduler() is provided here -scheduler::~scheduler( ) {} - -#if __TBB_TASK_DEQUE - #define EmptyTaskPool ((task**)0u) - #define LockedTaskPool ((task**)~0u) -#endif /* __TBB_TASK_DEQUE */ - -//! Cilk-style task scheduler. -/** None of the fields here are every read or written by threads other than - the thread that creates the instance. - - Class GenericScheduler is an abstract base class that contains most of the scheduler, - except for tweaks specific to processors and tools (e.g. VTune). - The derived template class CustomScheduler<SchedulerTraits> fills in the tweaks. */ -class GenericScheduler: public scheduler -{ -#if !__TBB_TASK_DEQUE - typedef task::depth_type depth_type; -#endif /* !__TBB_TASK_DEQUE */ - friend class tbb::task; - friend class tbb::task_scheduler_init; - friend struct WorkerDescriptor; - friend class Arena; - friend class allocate_root_proxy; - friend class Governor; -#if __TBB_EXCEPTIONS - friend class allocate_root_with_context_proxy; - friend class tbb::task_group_context; -#endif /* __TBB_EXCEPTIONS */ -#if __TBB_SCHEDULER_OBSERVER - friend class task_scheduler_observer_v3; -#endif /* __TBB_SCHEDULER_OBSERVER */ - friend class scheduler; - template<typename SchedulerTraits> friend class internal::CustomScheduler; - - //! If sizeof(task) is <=quick_task_size, it is handled on a free list instead of malloc'd. - static const size_t quick_task_size = 256-task_prefix_reservation_size; - - //! Definitions for bits in task_prefix::extra_state - enum internal_state_t { - //! Tag for TBB <3.0 tasks. - es_version_2_task = 0, - //! Tag for TBB 3.0 tasks. - es_version_3_task = 1, - //! Tag for TBB 3.0 task_proxy. - es_task_proxy = 2, - //! Set if ref_count might be changed by another thread. Used for debugging. - es_ref_count_active = 0x40, - //! Set if ref_count might be changed by another thread. - es_pending_exception = 0x80 - }; - - static bool is_version_3_task( task& t ) { - return (t.prefix().extra_state & 0x3F)==0x1; - } - -#if __TBB_TASK_DEQUE - //! Position in the call stack specifying its maximal filling when stealing is still allowed - uintptr_t my_stealing_threshold; -#if __TBB_ipf - //! Position in the RSE backup area specifying its maximal filling when stealing is still allowed - uintptr_t my_rsb_stealing_threshold; -#endif - - static const size_t null_arena_index = ~0u; - - //! Index of the arena slot the scheduler occupies now, or occupied last time. - size_t arena_index; - - //! Capacity of ready tasks deque (number of elements - pointers to task). - size_t task_pool_size; - - //! Dummy slot used when scheduler is not in arena - /** Only its "head" and "tail" members are ever used. The scheduler uses - the "task_pool" shortcut to access the task deque. **/ - ArenaSlot dummy_slot; - - //! Pointer to the slot in the arena we own at the moment. - /** When out of arena it points to this scheduler's dummy_slot. **/ - mutable ArenaSlot* arena_slot; - -#else /* !__TBB_TASK_DEQUE */ - - //! Deepest non-empty level. - /** Not read by thieves. -1 if array is empty. */ - depth_type deepest; - - //! The physical number of slots in "array". - TaskPool::size_type array_size; - - //! Dummy slot used when scheduler is not in arena - UnpaddedArenaSlot dummy_slot; - - //! Pointer to my slot in the arena - mutable UnpaddedArenaSlot* arena_slot; -#endif /* !__TBB_TASK_DEQUE */ - - bool in_arena () const { return arena_slot != &dummy_slot; } - - //! The arena that I own (if master) or belong to (if worker) - Arena* const arena; - - //! Random number generator used for picking a random victim from which to steal. - FastRandom random; - - //! Free list of small tasks that can be reused. - task* free_list; - - //! Innermost task whose task::execute() is running. - task* innermost_running_task; - - //! Fake root task created by slave threads. - /** The task is used as the "parent" argument to method wait_for_all. */ - task* dummy_task; - - //! Reference count for scheduler - /** Number of task_scheduler_init objects that point to this scheduler */ - long ref_count; - - mail_inbox inbox; - - void attach_mailbox( affinity_id id ) { - __TBB_ASSERT(id>0,NULL); - inbox.attach( arena->mailbox(id) ); - my_affinity_id = id; - } - - //! The mailbox id assigned to this scheduler. - /** The id is assigned upon first entry into the arena. - TODO: how are id's being garbage collected? - TODO: master thread may enter arena and leave and then reenter. - We want to give it the same affinity_id upon reentry, if practical. - */ - affinity_id my_affinity_id; - - /* A couple of bools can be located here because space is otherwise just padding after my_affinity_id. */ - - //! True if this is assigned to thread local storage by registering with Governor. - bool is_registered; - -#if __TBB_TASK_SCHEDULER_AUTO_INIT - //! True if *this was created by automatic TBB initialization - bool is_auto_initialized; -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - -#if __TBB_SCHEDULER_OBSERVER - //! Last observer_proxy processed by this scheduler - observer_proxy* local_last_observer_proxy; - - //! Notify any entry observers that have been created since the last call by this thread. - void notify_entry_observers() { - local_last_observer_proxy = observer_proxy::process_list(local_last_observer_proxy,is_worker(),/*is_entry=*/true); - } - - //! Notify all exit observers that this thread is no longer participating in task scheduling. - void notify_exit_observers( bool is_worker ) { - observer_proxy::process_list(local_last_observer_proxy,is_worker,/*is_entry=*/false); - } -#endif /* __TBB_SCHEDULER_OBSERVER */ - -#if COUNT_TASK_NODES - //! Net number of big task objects that have been allocated but not yet freed. - intptr task_node_count; -#endif /* COUNT_TASK_NODES */ - -#if STATISTICS - long current_active; - long current_length; - //! Number of big tasks that have been malloc'd. - /** To find total number of tasks malloc'd, compute (current_big_malloc+small_task_count) */ - long current_big_malloc; - long execute_count; - //! Number of tasks stolen - long steal_count; - //! Number of tasks received from mailbox - long mail_received_count; - long proxy_execute_count; - long proxy_steal_count; - long proxy_bypass_count; -#endif /* STATISTICS */ - -#if __TBB_TASK_DEQUE - //! Sets up the data necessary for the stealing limiting heuristics - void init_stack_info (); - - //! Returns true if stealing is allowed - bool can_steal () { - int anchor; -#if __TBB_ipf - return my_stealing_threshold < (uintptr_t)&anchor && (uintptr_t)__TBB_get_bsp() < my_rsb_stealing_threshold; -#else - return my_stealing_threshold < (uintptr_t)&anchor; -#endif - } - - //! Actions common to enter_arena and try_enter_arena - void do_enter_arena(); - - //! Used by workers to enter the arena - /** Does not lock the task pool in case if arena slot has been successfully grabbed. **/ - void enter_arena(); - - //! Used by masters to try to enter the arena - /** Does not lock the task pool in case if arena slot has been successfully grabbed. **/ - void try_enter_arena(); - - //! Leave the arena - void leave_arena(); - - //! Locks victim's task pool, and returns pointer to it. The pointer can be NULL. - task** lock_task_pool( ArenaSlot* victim_arena_slot ) const; - - //! Unlocks victim's task pool - void unlock_task_pool( ArenaSlot* victim_arena_slot, task** victim_task_pool ) const; - -#else /* !__TBB_TASK_DEQUE */ - - //! Try to enter the arena - /** On return, guarantees that task pool has been acquired. */ - void try_enter_arena(); - - //! Leave the arena - void leave_arena( bool compress ); -#endif /* !__TBB_TASK_DEQUE */ - - //! Locks the local task pool - void acquire_task_pool() const; - - //! Unlocks the local task pool - void release_task_pool() const; - - //! Get a task from the local pool. -#if __TBB_TASK_DEQUE - //! Checks if t is affinitized to another thread, and if so, bundles it as proxy. - /** Returns either t or proxy containing t. **/ - task* prepare_for_spawning( task* t ); - - /** Called only by the pool owner. - Returns the pointer to the task or NULL if the pool is empty. - In the latter case compacts the pool. **/ - task* get_task(); -#else /* !__TBB_TASK_DEQUE */ - /** Called only by the thread that owns *this. - Gets task only if there is one at depth d or deeper in the pool. - If successful, unlinks the task and returns a pointer to it. - Otherwise returns NULL. */ - task* get_task( depth_type d ); -#endif /* !__TBB_TASK_DEQUE */ - - //! Attempt to get a task from the mailbox. - /** Called only by the thread that owns *this. - Gets a task only if there is one not yet executed by another thread. - If successful, unlinks the task and returns a pointer to it. - Otherwise returns NULL. */ - task* get_mailbox_task(); - - //! True if t is a task_proxy - static bool is_proxy( const task& t ) { - return t.prefix().extra_state==es_task_proxy; - } - - //! Extracts task pointer from task_proxy, and frees the proxy. - /** Return NULL if underlying task was claimed by mailbox. */ - task* strip_proxy( task_proxy* result ); - - //! Steal task from another scheduler's ready pool. -#if __TBB_TASK_DEQUE - task* steal_task( ArenaSlot& victim_arena_slot ); -#else /* !__TBB_TASK_DEQUE */ - task* steal_task( UnpaddedArenaSlot& arena_slot, depth_type d ); -#endif /* !__TBB_TASK_DEQUE */ - -#if __TBB_TASK_DEQUE - /** Initial size of the task deque sufficient to serve without reallocation - 4 nested paralle_for calls with iteration space of 65535 grains each. **/ - static const size_t min_task_pool_size = 64; - - //! Allocate task pool containing at least n elements. - task** allocate_task_pool( size_t n ); - - //! Deallocate task pool that was allocated by means of allocate_task_pool. - static void free_task_pool( task** pool ) { - __TBB_ASSERT( pool, "attempt to free NULL TaskPool" ); - NFS_Free( pool ); - } - - //! Grow ready task deque to at least n elements. - void grow( size_t n ); -#else /* !__TBB_TASK_DEQUE */ - //! Grow "array" to at least "minimum_size" elements. - void grow( TaskPool::size_type minimum_size ); -#endif /* !__TBB_TASK_DEQUE */ - - //! Initialize a scheduler for a master thread. - static GenericScheduler* create_master( Arena* a ); - - //! Perform necessary cleanup when a master thread stops using TBB. - void cleanup_master(); - - //! Initialize a scheduler for a worker thread. - static GenericScheduler* create_worker( Arena& a, size_t index ); - - //! Initialize a heap (or subheap) of schedulers. - /** The workers are started up as a binary tree, where each vertex in the tree - starts any children it has. The tree is implicitly arranged like a binary heap. */ - static GenericScheduler* create_worker_heap( WorkerDescriptor& w ); - - //! Top-level routine for worker threads - /** Argument arg is a WorkerDescriptor*, cast to a (void*). */ - static thread_routine_return_type __TBB_THREAD_ROUTINE worker_routine( void* arg ); - - //! Perform necessary cleanup when a worker thread finishes. - static void cleanup_worker( void* arg ); - -protected: - GenericScheduler( Arena* arena ); - -#if TBB_USE_ASSERT - //! Check that internal data structures are in consistent state. - /** Raises __TBB_ASSERT failure if inconsistency is found. */ - bool assert_okay() const; -#endif /* TBB_USE_ASSERT */ - -public: - /*override*/ void spawn( task& first, task*& next ); - - /*override*/ void spawn_root_and_wait( task& first, task*& next ); - - //! Allocate and construct a scheduler object. - static GenericScheduler* allocate_scheduler( Arena* arena ); - - //! Destroy and deallocate scheduler that was created with method allocate. - void free_scheduler(); - - //! Allocate task object, either from the heap or a free list. - /** Returns uninitialized task object with initialized prefix. */ - task& allocate_task( size_t number_of_bytes, - __TBB_ALLOC_TASK_ARGS(task* parent, depth_type depth, task_group_context* context) ); - - //! Optimization hint to free_task that enables it omit unnecessary tests and code. - enum hint { - //! No hint - no_hint=0, - //! Task is known to have been allocated by this scheduler - is_local=1, - //! Task is known to be a small task. - /** Task should be returned to the free list of *some* scheduler, possibly not this scheduler. */ - is_small=2, - //! Bitwise-OR of is_local and is_small. - /** Task should be returned to free list of this scheduler. */ - is_small_local=3 - }; - - //! Put task on free list. - /** Does not call destructor. */ - template<hint h> - void free_task( task& t ); - - void free_task_proxy( task_proxy& tp ) { -#if TBB_USE_ASSERT - poison_pointer( tp.outbox ); - poison_pointer( tp.next_in_mailbox ); - tp.task_and_tag = 0xDEADBEEF; -#endif /* TBB_USE_ASSERT */ - free_task<is_small>(tp); - } - - //! Return task object to the memory allocator. - void deallocate_task( task& t ) { -#if TBB_USE_ASSERT - task_prefix& p = t.prefix(); - p.state = 0xFF; - p.extra_state = 0xFF; - poison_pointer(p.next); -#endif /* TBB_USE_ASSERT */ - NFS_Free((char*)&t-task_prefix_reservation_size); -#if COUNT_TASK_NODES - task_node_count -= 1; -#endif /* COUNT_TASK_NODES */ - } - - //! True if running on a worker thread, false otherwise. - inline bool is_worker() { -#if __TBB_TASK_DEQUE - return arena_index < arena->prefix().number_of_workers; -#else /* !__TBB_TASK_DEQUE */ - return (dummy_slot.task_pool->prefix().arena_index < arena->prefix().number_of_workers); -#endif /* !__TBB_TASK_DEQUE */ - } - -#if TEST_ASSEMBLY_ROUTINES - /** Defined in test_assembly.cpp */ - void test_assembly_routines(); -#endif /* TEST_ASSEMBLY_ROUTINES */ - -#if COUNT_TASK_NODES - intptr get_task_node_count( bool count_arena_workers = false ) { - return task_node_count + (count_arena_workers? arena->workers_task_node_count(): 0); - } -#endif /* COUNT_TASK_NODES */ - - //! Special value used to mark return_list as not taking any more entries. - static task* plugged_return_list() {return (task*)(intptr)(-1);} - - //! Number of small tasks that have been allocated by this scheduler. - intptr small_task_count; - - //! List of small tasks that have been returned to this scheduler by other schedulers. - task* return_list; - - //! Free a small task t that that was allocated by a different scheduler - void free_nonlocal_small_task( task& t ); - -#if __TBB_EXCEPTIONS - //! Padding isolating thread local members from members that can be written to by other threads. - char _padding1[NFS_MaxLineSize - sizeof(context_list_node_t)]; - - //! Head of the thread specific list of task group contexts. - context_list_node_t context_list_head; - - //! Mutex protecting access to the list of task group contexts. - spin_mutex context_list_mutex; - - //! Used to form the list of master thread schedulers. - scheduler_list_node_t my_node; - - //! Thread local counter of cancellation requests. - /** When this counter equals global_cancel_count, the cancellation state known - to this thread is synchronized with the global cancellation state. - \sa #global_cancel_count **/ - uintptr_t local_cancel_count; - - //! Propagates cancellation request to all descendants of the argument context. - void propagate_cancellation ( task_group_context* ctx ); - - //! Propagates cancellation request to contexts registered by this scheduler. - void propagate_cancellation (); -#endif /* __TBB_EXCEPTIONS */ -}; // class GenericScheduler - -#if __TBB_EXCEPTIONS -//------------------------------------------------------------------------ -// auto_empty_task -//------------------------------------------------------------------------ - -//! Smart holder for the empty task class with automatic destruction -class auto_empty_task { - task* my_task; - GenericScheduler* my_scheduler; -public: - auto_empty_task ( __TBB_ALLOC_TASK_ARGS(GenericScheduler *s, int depth, task_group_context* context) ) - : my_task( new(&s->allocate_task(sizeof(empty_task), __TBB_ALLOC_TASK_ARGS(NULL, depth, context))) empty_task ) - , my_scheduler(s) - {} - // empty_task has trivial destructor, so there's no need to call it. - ~auto_empty_task () { my_scheduler->free_task<GenericScheduler::is_small_local>(*my_task); } - - operator task& () { return *my_task; } - task* operator & () { return my_task; } - task_prefix& prefix () { return my_task->prefix(); } -}; // class auto_empty_task -#endif /* __TBB_EXCEPTIONS */ - -//------------------------------------------------------------------------ -// Methods of class Governor that need full definition of GenericScheduler -//------------------------------------------------------------------------ - -void Governor::sign_on(GenericScheduler* s) { - __TBB_ASSERT( !s->is_registered, NULL ); - s->is_registered = true; - __TBB_InitOnce::add_ref(); - theTLS.set(s); -} - -void Governor::sign_off(GenericScheduler* s) { - if( s->is_registered ) { - __TBB_ASSERT( theTLS.get()==s, "attempt to unregister a wrong scheduler instance" ); - theTLS.set(NULL); - s->is_registered = false; - __TBB_InitOnce::remove_ref(); - } -} - -#if __TBB_TASK_SCHEDULER_AUTO_INIT -GenericScheduler* Governor::local_scheduler_with_auto_init() { - GenericScheduler* s = theTLS.get(); - if( !s ) { -#if _WIN32||_WIN64 - // DllMain sets __TBB_InitOnce::InitializationDone before we can get here. -#else - if( !__TBB_InitOnce::initialization_done() ) - DoOneTimeInitializations(); -#endif - __TBB_ASSERT( __TBB_InitOnce::initialization_done(), "library initialization failed?" ); - // use the same argument values as default constructor of task_scheduler_init - s = GenericScheduler::create_master(obtain_arena(task_scheduler_init::automatic,0)); - s->is_auto_initialized = true; - TBB_TRACE(("Scheduler was initialized automatically: s=%p\n",s)); - } - __TBB_ASSERT(s, "somehow a scheduler object was not created?"); - return s; -} - -void Governor::auto_terminate(void* arg){ - GenericScheduler* s = static_cast<GenericScheduler*>(arg); - if( s && s->is_auto_initialized ) { - if( !--(s->ref_count) ) - s->cleanup_master(); - } -} -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - -//------------------------------------------------------------------------ -// GenericScheduler implementation -//------------------------------------------------------------------------ - -inline task& GenericScheduler::allocate_task( size_t number_of_bytes, - __TBB_ALLOC_TASK_ARGS(task* parent, depth_type depth, task_group_context* context) ) { - GATHER_STATISTIC(current_active+=1); - task* t = free_list; - if( number_of_bytes<=quick_task_size ) { - if( t ) { - GATHER_STATISTIC(current_length-=1); - __TBB_ASSERT( t->state()==task::freed, "free list of tasks is corrupted" ); - free_list = t->prefix().next; - } else if( return_list ) { - // No fence required for read of return_list above, because __TBB_FetchAndStoreW has a fence. - t = (task*)__TBB_FetchAndStoreW( &return_list, 0 ); - __TBB_ASSERT( t, "another thread emptied the return_list" ); - __TBB_ASSERT( t->prefix().origin==this, "task returned to wrong return_list" ); - ITT_NOTIFY( sync_acquired, &return_list ); - free_list = t->prefix().next; - } else { - t = (task*)((char*)NFS_Allocate( task_prefix_reservation_size+quick_task_size, 1, NULL ) + task_prefix_reservation_size ); -#if COUNT_TASK_NODES - ++task_node_count; -#endif /* COUNT_TASK_NODES */ - t->prefix().origin = this; - ++small_task_count; - } - } else { - GATHER_STATISTIC(current_big_malloc+=1); - t = (task*)((char*)NFS_Allocate( task_prefix_reservation_size+number_of_bytes, 1, NULL ) + task_prefix_reservation_size ); -#if COUNT_TASK_NODES - ++task_node_count; -#endif /* COUNT_TASK_NODES */ - t->prefix().origin = NULL; - } - task_prefix& p = t->prefix(); -#if __TBB_EXCEPTIONS - p.context = context; -#endif /* __TBB_EXCEPTIONS */ - p.owner = this; - p.ref_count = 0; -#if __TBB_TASK_DEQUE - // Assign some not outrageously out-of-place value for a while - p.depth = 0; -#else /* !__TBB_TASK_DEQUE */ - p.depth = int(depth); -#endif /* !__TBB_TASK_DEQUE */ - p.parent = parent; - // In TBB 3.0 and later, the constructor for task sets extra_state to indicate the version of the tbb/task.h header. - // In TBB 2.0 and earlier, the constructor leaves extra_state as zero. - p.extra_state = 0; - p.affinity = 0; - p.state = task::allocated; - return *t; -} - -template<GenericScheduler::hint h> -inline void GenericScheduler::free_task( task& t ) { - GATHER_STATISTIC(current_active-=1); - task_prefix& p = t.prefix(); - // Verify that optimization hints are correct. - __TBB_ASSERT( h!=is_small_local || p.origin==this, NULL ); - __TBB_ASSERT( !(h&is_small) || p.origin, NULL ); -#if TBB_USE_ASSERT - p.depth = 0xDEADBEEF; - p.ref_count = 0xDEADBEEF; - poison_pointer(p.owner); -#endif /* TBB_USE_ASSERT */ - __TBB_ASSERT( 1L<<t.state() & (1L<<task::executing|1L<<task::allocated), NULL ); - p.state = task::freed; - if( h==is_small_local || p.origin==this ) { - GATHER_STATISTIC(current_length+=1); - p.next = free_list; - free_list = &t; - } else if( !(h&is_local) && p.origin ) { - free_nonlocal_small_task(t); - } else { - deallocate_task(t); - } -} - -void GenericScheduler::free_nonlocal_small_task( task& t ) { - __TBB_ASSERT( t.state()==task::freed, NULL ); - GenericScheduler& s = *static_cast<GenericScheduler*>(t.prefix().origin); - __TBB_ASSERT( &s!=this, NULL ); - for(;;) { - task* old = s.return_list; - if( old==plugged_return_list() ) - break; - // Atomically insert t at head of s.return_list - t.prefix().next = old; - ITT_NOTIFY( sync_releasing, &s.return_list ); - if( __TBB_CompareAndSwapW( &s.return_list, (intptr)&t, (intptr)old )==(intptr)old ) - return; - } - deallocate_task(t); - if( __TBB_FetchAndDecrementWrelease( &s.small_task_count )==1 ) { - // We freed the last task allocated by scheduler s, so it's our responsibility - // to free the scheduler. - NFS_Free( &s ); - } -} - -//------------------------------------------------------------------------ -// CustomScheduler -//------------------------------------------------------------------------ - -//! A scheduler with a customized evaluation loop. -/** The customization can use SchedulerTraits to make decisions without needing a run-time check. */ -template<typename SchedulerTraits> -class CustomScheduler: private GenericScheduler { - //! Scheduler loop that dispatches tasks. - /** If child is non-NULL, it is dispatched first. - Then, until "parent" has a reference count of 1, other task are dispatched or stolen. */ - /*override*/void wait_for_all( task& parent, task* child ); - - typedef CustomScheduler<SchedulerTraits> scheduler_type; - - //! Construct a CustomScheduler - CustomScheduler( Arena* arena ) : GenericScheduler(arena) {} - -public: - static GenericScheduler* allocate_scheduler( Arena* arena ) { - __TBB_ASSERT( arena, "missing arena" ); - scheduler_type* s = (scheduler_type*)NFS_Allocate(sizeof(scheduler_type),1,NULL); - new( s ) scheduler_type( arena ); -#if __TBB_TASK_DEQUE - __TBB_ASSERT( s->assert_okay(), NULL ); -#else /* !__TBB_TASK_DEQUE */ - __TBB_ASSERT( s->dummy_slot.task_pool->assert_okay(), NULL ); -#endif /* !__TBB_TASK_DEQUE */ - return s; - } -}; - -//------------------------------------------------------------------------ -// AssertOkay -//------------------------------------------------------------------------ -#if TBB_USE_ASSERT -/** Logically, this method should be a member of class task. - But we do not want to publish it, so it is here instead. */ -static bool AssertOkay( const task& task ) { - __TBB_ASSERT( &task!=NULL, NULL ); - __TBB_ASSERT( (uintptr)&task % task_alignment == 0, "misaligned task" ); - __TBB_ASSERT( (unsigned)task.state()<=(unsigned)task::recycle, "corrupt task (invalid state)" ); -#if !__TBB_TASK_DEQUE - __TBB_ASSERT( task.prefix().depth<1L<<30, "corrupt task (absurd depth)" ); -#endif /* !__TBB_TASK_DEQUE */ - return true; -} -#endif /* TBB_USE_ASSERT */ - -//------------------------------------------------------------------------ -// Methods of Arena -//------------------------------------------------------------------------ -Arena* Arena::allocate_arena( unsigned number_of_slots, unsigned number_of_workers, stack_size_type stack_size) { - __TBB_ASSERT( sizeof(ArenaPrefix) % NFS_GetLineSize()==0, "ArenaPrefix not multiple of cache line size" ); - __TBB_ASSERT( sizeof(mail_outbox)==NFS_MaxLineSize, NULL ); - size_t n = sizeof(ArenaPrefix) + number_of_slots*(sizeof(mail_outbox)+sizeof(ArenaSlot)); - - unsigned char* storage = (unsigned char*)NFS_Allocate( n, 1, NULL ); - memset( storage, 0, n ); - Arena* a = (Arena*)(storage + sizeof(ArenaPrefix)+ number_of_slots*(sizeof(mail_outbox))); - __TBB_ASSERT( sizeof(a->slot[0]) % NFS_GetLineSize()==0, "Arena::slot size not multiple of cache line size" ); - __TBB_ASSERT( (uintptr)a % NFS_GetLineSize()==0, NULL ); - new( &a->prefix() ) ArenaPrefix( number_of_slots, number_of_workers ); - - // Allocate the worker_list - WorkerDescriptor * w = new WorkerDescriptor[number_of_workers]; - memset( w, 0, sizeof(WorkerDescriptor)*(number_of_workers)); - a->prefix().worker_list = w; - -#if TBB_USE_ASSERT - // Verify that earlier memset initialized the mailboxes. - for( unsigned j=1; j<=number_of_slots; ++j ) - a->mailbox(j).assert_is_initialized(); -#endif /* TBB_USE_ASSERT */ - - a->prefix().stack_size = stack_size; - size_t k; - // Mark each worker slot as locked and unused - for( k=0; k<number_of_workers; ++k ) { -#if __TBB_TASK_DEQUE - // All slots are set to null meaning that they are free -#else /* !__TBB_TASK_DEQUE */ - a->slot[k].steal_end = -3; -#endif /* !__TBB_TASK_DEQUE */ - w[k].arena = a; - ITT_SYNC_CREATE(a->slot + k, SyncType_Scheduler, SyncObj_WorkerTaskPool); - } -#if !__TBB_TASK_DEQUE - // Mark rest of slots as unused - for( ; k<number_of_slots; ++k ) { - a->slot[k].steal_end = -4; - ITT_SYNC_CREATE(a->slot + k, SyncType_Scheduler, SyncObj_MasterTaskPool); - } -#endif /* !__TBB_TASK_DEQUE */ - - return a; -} - -inline void Arena::mark_pool_full() { - // Double-check idiom that is deliberately sloppy about memory fences. - // Technically, to avoid missed wakeups, there should be a full memory fence between the point we - // released the task pool (i.e. spawned task) and read the gate's state. However, adding such a - // fence might hurt overall performance more than it helps, because the fence would be executed - // on every task pool release, even when stealing does not occur. Since TBB allows parallelism, - // but never promises parallelism, the missed wakeup is not a correctness problem. - Gate::state_t snapshot = prefix().gate.get_state(); - if( snapshot!=SNAPSHOT_FULL ) - prefix().gate.try_update( SNAPSHOT_FULL, SNAPSHOT_PERMANENTLY_OPEN, true ); -} - -bool Arena::wait_while_pool_is_empty() -{ - for(;;) { - Gate::state_t snapshot = prefix().gate.get_state(); - switch( snapshot ) { - case SNAPSHOT_EMPTY: - prefix().gate.wait(); - return true; - case SNAPSHOT_FULL: { - // Use unique id for "busy" in order to avoid ABA problems. - const Gate::state_t busy = Gate::state_t(this); - // Request permission to take snapshot - prefix().gate.try_update( busy, SNAPSHOT_FULL ); - if( prefix().gate.get_state()==busy ) { - // Got permission. Take the snapshot. - size_t n = prefix().limit; - size_t k; - for( k=0; k<n; ++k ) -#if __TBB_TASK_DEQUE - if( slot[k].task_pool != EmptyTaskPool && slot[k].head < slot[k].tail ) -#else /* !__TBB_TASK_DEQUE */ - if( slot[k].steal_end>=0 ) -#endif /* !__TBB_TASK_DEQUE */ - break; - // Test and test-and-set. - if( prefix().gate.get_state()==busy ) { - if( k>=n ) { - prefix().gate.try_update( SNAPSHOT_EMPTY, busy ); - continue; - } else { - prefix().gate.try_update( SNAPSHOT_FULL, busy ); - } - } - } - return false; - } - default: - // Another thread is taking a snapshot or gate is permanently open. - return false; - } - } -} - -void Arena::terminate_workers() { - int n = prefix().number_of_workers; - __TBB_ASSERT( n>=0, "negative number of workers; casting error?" ); - for( int i=n; --i>=0; ) { - WorkerDescriptor& w = prefix().worker_list[i]; - if( w.scheduler || __TBB_CompareAndSwapW( &w.scheduler, intptr(-1), intptr(0) ) ) { - // Worker published itself. Tell worker to quit. - ITT_NOTIFY(sync_acquired, &w.scheduler); - task* t = __TBB_load_with_acquire(w.scheduler)->dummy_task; - ITT_NOTIFY(sync_releasing, &t->prefix().ref_count); - t->prefix().ref_count = 1; - } else { - // Worker did not publish itself yet, and we have set w.scheduler to -1, - // which tells the worker that it should never publish itself. - } - } - // Permanently wake up sleeping workers - prefix().gate.try_update( SNAPSHOT_PERMANENTLY_OPEN, SNAPSHOT_PERMANENTLY_OPEN, true ); - remove_gc_reference(); -} - -void Arena::remove_gc_reference() { - __TBB_ASSERT( this, "attempt to remove reference to NULL Arena" ); - if( --prefix().gc_ref_count==0 ) { - free_arena(); - } -} - -#if COUNT_TASK_NODES -intptr Arena::workers_task_node_count() { - intptr result = 0; - for( unsigned i=0; i<prefix().number_of_workers; ++i ) { - GenericScheduler* s = prefix().worker_list[i].scheduler; - if( s ) - result += s->task_node_count; - } - return result; -} -#endif - -//------------------------------------------------------------------------ -// Methods of GenericScheduler -//------------------------------------------------------------------------ -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Suppress overzealous compiler warning about using 'this' in base initializer list. - #pragma warning(push) - #pragma warning(disable:4355) -#endif - -GenericScheduler::GenericScheduler( Arena* arena_ ) : -#if __TBB_TASK_DEQUE - arena_index(null_arena_index), - task_pool_size(0), -#else /* !__TBB_TASK_DEQUE */ - deepest(-1), - array_size(0), -#endif /* !__TBB_TASK_DEQUE */ - arena_slot(&dummy_slot), - arena(arena_), - random( unsigned(this-(GenericScheduler*)NULL) ), - free_list(NULL), - innermost_running_task(NULL), - dummy_task(NULL), - ref_count(1), - my_affinity_id(0), - is_registered(false), -#if __TBB_TASK_SCHEDULER_AUTO_INIT - is_auto_initialized(false), -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ -#if __TBB_SCHEDULER_OBSERVER - local_last_observer_proxy(NULL), -#endif /* __TBB_SCHEDULER_OBSERVER */ -#if COUNT_TASK_NODES - task_node_count(0), -#endif /* COUNT_TASK_NODES */ -#if STATISTICS - current_active(0), - current_length(0), - current_big_malloc(0), - execute_count(0), - steal_count(0), - mail_received_count(0), - proxy_execute_count(0), - proxy_steal_count(0), - proxy_bypass_count(0), -#endif /* STATISTICS */ - small_task_count(1), // Extra 1 is a guard reference - return_list(NULL) -{ -#if __TBB_TASK_DEQUE - dummy_slot.task_pool = allocate_task_pool( min_task_pool_size ); - dummy_slot.head = dummy_slot.tail = 0; -#else /* !__TBB_TASK_DEQUE */ - TaskPool* t = TaskPool::allocate_task_pool(TaskPool::min_array_size); - dummy_slot.task_pool = t; - t->prefix().steal_begin = depth_type(array_size); - t->prefix().arena_index = TaskPoolPrefix::null_arena_index; - dummy_slot.steal_end = -2; - dummy_slot.owner_waits = false; - array_size = TaskPool::min_array_size; -#endif /* !__TBB_TASK_DEQUE */ - dummy_task = &allocate_task( sizeof(task), __TBB_ALLOC_TASK_ARGS(NULL, -1, NULL) ); -#if __TBB_EXCEPTIONS - context_list_head.my_prev = &context_list_head; - context_list_head.my_next = &context_list_head; - ITT_SYNC_CREATE(&context_list_mutex, SyncType_Scheduler, SyncObj_ContextsList); -#endif /* __TBB_EXCEPTIONS */ - dummy_task->prefix().ref_count = 2; - __TBB_ASSERT( assert_okay(), "constructor error" ); -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning(pop) -#endif // warning 4355 is back - -#if TBB_USE_ASSERT -bool GenericScheduler::assert_okay() const { -#if TBB_USE_ASSERT>=2||TEST_ASSEMBLY_ROUTINES - acquire_task_pool(); -#if __TBB_TASK_DEQUE - task** tp = dummy_slot.task_pool; - __TBB_ASSERT( task_pool_size >= min_task_pool_size, NULL ); - __TBB_ASSERT( arena_slot->head <= arena_slot->tail, NULL ); - for ( size_t i = arena_slot->head; i < arena_slot->tail; ++i ) { - __TBB_ASSERT( (uintptr_t)tp[i] + 1 > 1u, "nil or invalid task pointer in the deque" ); - __TBB_ASSERT( tp[i]->prefix().state == task::ready || - tp[i]->prefix().extra_state == es_task_proxy, "task in the deque has invalid state" ); - } -#else /* !__TBB_TASK_DEQUE */ - __TBB_ASSERT( array_size>=TaskPool::min_array_size, NULL ); - TaskPool* tp = dummy_slot.task_pool; - __TBB_ASSERT( tp, NULL ); - for( depth_type k=0; k<depth_type(array_size); ++k ) { - for( task* t = tp->array[k]; t; t=t->prefix().next ) { - __TBB_ASSERT( deepest>=k, "deepest not set properly" ); - __TBB_ASSERT( t->prefix().depth==k, NULL ); - __TBB_ASSERT( t->prefix().owner==this, NULL ); - } - } -#endif /* !__TBB_TASK_DEQUE */ - release_task_pool(); -#endif /* TBB_USE_ASSERT>=2||TEST_ASSEMBLY_ROUTINES */ - return true; -} -#endif /* TBB_USE_ASSERT */ - -#if __TBB_EXCEPTIONS - -void GenericScheduler::propagate_cancellation () { - spin_mutex::scoped_lock lock(context_list_mutex); - // Acquire fence is necessary to ensure that the subsequent node->my_next load - // returned the correct value in case it was just inserted in another thread. - // The fence also ensures visibility of the correct my_parent value. - context_list_node_t *node = __TBB_load_with_acquire(context_list_head.my_next); - while ( node != &context_list_head ) { - task_group_context *ctx = __TBB_get_object_addr(task_group_context, my_node, node); - // The absence of acquire fence while reading my_cancellation_requested may result - // in repeated traversals of the same parents chain if another group (precedent or - // descendant) belonging to the tree being canceled sends cancellation request of - // its own around the same time. I assume that such situations are less frequent - // than uncontended cancellation, and cache coherency mechanisms are efficient enough - // to deliver updated values most of the time. - if ( !ctx->my_cancellation_requested ) - ctx->propagate_cancellation_from_ancestors(); - node = node->my_next; - } -} - -/** Propagates cancellation down the tree of dependent contexts by walking each - thread's local list of contexts **/ -void GenericScheduler::propagate_cancellation ( task_group_context* ctx ) { - __TBB_ASSERT ( ctx->my_cancellation_requested, "No cancellation request in the context" ); - // The whole propagation algorithm is under the lock in order to ensure correctness - // in case of parallel cancellations at the different levels of the context tree. - // See the note 2 at the bottom of the file. - mutex::scoped_lock lock(the_scheduler_list_mutex); - // Advance global cancellation state - __TBB_FetchAndAddWrelease(&global_cancel_count, 1); - // First propagate to workers using arena to access their context lists - size_t num_workers = arena->prefix().number_of_workers; - for ( size_t i = 0; i < num_workers; ++i ) { - // No fence is necessary here since the context list of worker's scheduler - // can contain anything of interest only after the first stealing was done - // by that worker. And doing it applies the necessary fence - GenericScheduler *s = arena->prefix().worker_list[i].scheduler; - // If the worker is in the middle of its startup sequence, skip it. - if ( s ) - s->propagate_cancellation(); - } - // Then propagate to masters using the global list of master's schedulers - scheduler_list_node_t *node = the_scheduler_list_head.my_next; - while ( node != &the_scheduler_list_head ) { - __TBB_get_object_addr(GenericScheduler, my_node, node)->propagate_cancellation(); - node = node->my_next; - } - // Now sync up the local counters - for ( size_t i = 0; i < num_workers; ++i ) { - GenericScheduler *s = arena->prefix().worker_list[i].scheduler; - // If the worker is in the middle of its startup sequence, skip it. - if ( s ) - s->local_cancel_count = global_cancel_count; - } - node = the_scheduler_list_head.my_next; - while ( node != &the_scheduler_list_head ) { - __TBB_get_object_addr(GenericScheduler, my_node, node)->local_cancel_count = global_cancel_count; - node = node->my_next; - } -} -#endif /* __TBB_EXCEPTIONS */ - - -#if __TBB_TASK_DEQUE - -void GenericScheduler::init_stack_info () { - // Stacks are growing top-down. Highest address is called "stack base", - // and the lowest is "stack limit". -#if USE_WINTHREAD -#if defined(_MSC_VER)&&_MSC_VER<1400 && !_WIN64 - NT_TIB *pteb = (NT_TIB*)__TBB_machine_get_current_teb(); -#else - NT_TIB *pteb = (NT_TIB*)NtCurrentTeb(); -#endif - __TBB_ASSERT( &pteb < pteb->StackBase && &pteb > pteb->StackLimit, "invalid stack info in TEB" ); - my_stealing_threshold = (uintptr_t)pteb->StackBase / 2 + (uintptr_t)pteb->StackLimit / 2; -#else /* USE_PTHREAD */ - // There is no portable way to get stack base address in Posix, so we use - // non-portable method (on all modern Linux) or the simplified approach - // based on the common sense assumptions. The most important assumption - // is that the main thread's stack size is not less than that of other threads. - size_t stack_size = arena->prefix().stack_size; - void *stack_base = &stack_size; -#if __TBB_ipf - void *rsb_base = __TBB_get_bsp(); -#endif -#if __linux__ - size_t np_stack_size = 0; - void *stack_limit = NULL; - pthread_attr_t attr_stack, np_attr_stack; - if( 0 == pthread_getattr_np(pthread_self(), &np_attr_stack) ) { - if ( 0 == pthread_attr_getstack(&np_attr_stack, &stack_limit, &np_stack_size) ) { - if ( 0 == pthread_attr_init(&attr_stack) ) { - if ( 0 == pthread_attr_getstacksize(&attr_stack, &stack_size) ) - { - stack_base = (char*)stack_limit + np_stack_size; - if ( np_stack_size < stack_size ) { - // We are in a secondary thread. Use reliable data. -#if __TBB_ipf - // IA64 stack is split into RSE backup and memory parts - rsb_base = stack_limit; - stack_size = np_stack_size/2; -#else - stack_size = np_stack_size; -#endif /* !__TBB_ipf */ - } - // We are either in the main thread or this thread stack - // is bigger that that of the main one. As we cannot discern - // these cases we fall back to the default (heuristic) values. - } - pthread_attr_destroy(&attr_stack); - } - } - pthread_attr_destroy(&np_attr_stack); - } -#endif /* __linux__ */ - my_stealing_threshold = (uintptr_t)((char*)stack_base - stack_size/2); -#if __TBB_ipf - my_rsb_stealing_threshold = (uintptr_t)((char*)rsb_base + stack_size/2); -#endif -#endif /* USE_PTHREAD */ -} - -task** GenericScheduler::allocate_task_pool( size_t n ) { - __TBB_ASSERT( n > task_pool_size, "Cannot shrink the task pool" ); - size_t byte_size = ((n * sizeof(task*) + NFS_MaxLineSize - 1) / NFS_MaxLineSize) * NFS_MaxLineSize; - task_pool_size = byte_size / sizeof(task*); - task** new_pool = (task**)NFS_Allocate( byte_size, 1, NULL ); - // No need to clear the fresh deque since valid items are designated by the head and tail members. -#if TBB_USE_ASSERT>=2 - // But clear it in the high vigilance debug mode - memset( new_pool, -1, n ); -#endif /* TBB_USE_ASSERT>=2 */ - return new_pool; -} - -void GenericScheduler::grow( size_t new_size ) { - __TBB_ASSERT( assert_okay(), NULL ); - if ( new_size < 2 * task_pool_size ) - new_size = 2 * task_pool_size; - task** new_pool = allocate_task_pool( new_size ); // updates task_pool_size - task** old_pool = dummy_slot.task_pool; - acquire_task_pool(); // requires the old dummy_slot.task_pool value - size_t new_tail = arena_slot->tail - arena_slot->head; - __TBB_ASSERT( new_tail <= task_pool_size, "new task pool is too short" ); - memcpy( new_pool, old_pool + arena_slot->head, arena_slot->tail * sizeof(task*) ); - arena_slot->head = 0; - arena_slot->tail = new_tail; - dummy_slot.task_pool = new_pool; - release_task_pool(); // updates the task pool pointer in our arena slot - free_task_pool( old_pool ); - __TBB_ASSERT( assert_okay(), NULL ); -} - -#else /* !__TBB_TASK_DEQUE */ - -void GenericScheduler::grow( TaskPool::size_type minimum_size ) { - __TBB_ASSERT( assert_okay(), NULL ); - TaskPool::size_type b_size = 2*minimum_size; - __TBB_ASSERT( b_size > array_size, "ready task pool cannot shrink" ); - TaskPool* new_pool = TaskPool::allocate_task_pool( b_size ); - __TBB_ASSERT( assert_okay(), NULL ); - acquire_task_pool(); - TaskPool* old_pool = dummy_slot.task_pool; - memcpy( &new_pool->prefix(), &old_pool->prefix(), TaskPool::byte_size(array_size) ); - arena_slot->task_pool = dummy_slot.task_pool = new_pool; - array_size = b_size; - release_task_pool(); - old_pool->free_task_pool(); - __TBB_ASSERT( assert_okay(), NULL ); -} -#endif /* !__TBB_TASK_DEQUE */ - -GenericScheduler* GenericScheduler::allocate_scheduler( Arena* arena ) { - switch( SchedulerTraitsId ) { - /* DefaultSchedulerTraits::id is listed explicitly as a case so that the host compiler - will issue an error message if it is the same as another id in the list. */ - default: - case DefaultSchedulerTraits::id: - return CustomScheduler<DefaultSchedulerTraits>::allocate_scheduler(arena); - case IntelSchedulerTraits::id: - return CustomScheduler<IntelSchedulerTraits>::allocate_scheduler(arena); - } -} - -void GenericScheduler::free_scheduler() { - if( in_arena() ) { -#if __TBB_TASK_DEQUE - acquire_task_pool(); - leave_arena(); -#else /* !__TBB_TASK_DEQUE */ - leave_arena(/*compress=*/false); -#endif /* !__TBB_TASK_DEQUE */ - } -#if __TBB_EXCEPTIONS - task_group_context* &context = dummy_task->prefix().context; - // Only master thread's dummy task has a context - if ( context != &dummy_context) { - //! \todo Add assertion that master's dummy task context does not have children - context->task_group_context::~task_group_context(); - NFS_Free(context); - { - mutex::scoped_lock lock(the_scheduler_list_mutex); - my_node.my_next->my_prev = my_node.my_prev; - my_node.my_prev->my_next = my_node.my_next; - } - } -#endif /* __TBB_EXCEPTIONS */ - free_task<is_small_local>( *dummy_task ); - - // k accounts for a guard reference and each task that we deallocate. - intptr k = 1; - for(;;) { - while( task* t = free_list ) { - free_list = t->prefix().next; - deallocate_task(*t); - ++k; - } - if( return_list==plugged_return_list() ) - break; - free_list = (task*)__TBB_FetchAndStoreW( &return_list, (intptr)plugged_return_list() ); - } - -#if COUNT_TASK_NODES - arena->prefix().task_node_count += task_node_count; -#endif /* COUNT_TASK_NODES */ -#if STATISTICS - the_statistics.record( execute_count, steal_count, mail_received_count, - proxy_execute_count, proxy_steal_count, proxy_bypass_count ); -#endif /* STATISTICS */ -#if __TBB_TASK_DEQUE - free_task_pool( dummy_slot.task_pool ); -#else /* !__TBB_TASK_DEQUE */ - dummy_slot.task_pool->free_task_pool(); -#endif /* !__TBB_TASK_DEQUE */ - dummy_slot.task_pool = NULL; - // Update small_task_count last. Doing so sooner might cause another thread to free *this. - __TBB_ASSERT( small_task_count>=k, "small_task_count corrupted" ); - Governor::sign_off(this); - if( __TBB_FetchAndAddW( &small_task_count, -k )==k ) - NFS_Free( this ); -} - -#if __TBB_TASK_DEQUE -/** ATTENTION: - This method is mostly the same as GenericScheduler::lock_task_pool(), with - a little different logic of slot state checks (slot is either locked or points - to our task pool). - Thus if either of them is changed, consider changing the counterpart as well. **/ -inline void GenericScheduler::acquire_task_pool() const { - if ( !in_arena() ) - return; // we are not in arena - nothing to lock - ExponentialBackoff backoff; - bool sync_prepare_done = false; - for(;;) { -#if TBB_USE_ASSERT - __TBB_ASSERT( arena_slot == arena->slot + arena_index, "invalid arena slot index" ); - // Local copy of the arena slot task pool pointer is necessary for the next - // assertion to work correctly to exclude asynchronous state transition effect. - task** tp = arena_slot->task_pool; - __TBB_ASSERT( tp == LockedTaskPool || tp == dummy_slot.task_pool, "slot ownership corrupt?" ); -#endif - if( arena_slot->task_pool != LockedTaskPool && - __TBB_CompareAndSwapW( &arena_slot->task_pool, (intptr_t)LockedTaskPool, - (intptr_t)dummy_slot.task_pool ) == (intptr_t)dummy_slot.task_pool ) - { - // We acquired our own slot - ITT_NOTIFY(sync_acquired, arena_slot); - break; - } - else if( !sync_prepare_done ) { - // Start waiting - ITT_NOTIFY(sync_prepare, arena_slot); - sync_prepare_done = true; - } - // Someone else acquired a lock, so pause and do exponential backoff. - backoff.pause(); -#if TEST_ASSEMBLY_ROUTINES - __TBB_ASSERT( arena_slot->task_pool == LockedTaskPool || - arena_slot->task_pool == dummy_slot.task_pool, NULL ); -#endif /* TEST_ASSEMBLY_ROUTINES */ - } - __TBB_ASSERT( arena_slot->task_pool == LockedTaskPool, "not really acquired task pool" ); -} // GenericScheduler::acquire_task_pool - -inline void GenericScheduler::release_task_pool() const { - if ( !in_arena() ) - return; // we are not in arena - nothing to unlock - __TBB_ASSERT( arena_slot, "we are not in arena" ); - __TBB_ASSERT( arena_slot->task_pool == LockedTaskPool, "arena slot is not locked" ); - ITT_NOTIFY(sync_releasing, arena_slot); - __TBB_store_with_release( arena_slot->task_pool, dummy_slot.task_pool ); -} - -/** ATTENTION: - This method is mostly the same as GenericScheduler::acquire_task_pool(), - with a little different logic of slot state checks (slot can be empty, locked - or point to any task pool other than ours, and asynchronous transitions between - all these states are possible). - Thus if any of them is changed, consider changing the counterpart as well **/ -inline task** GenericScheduler::lock_task_pool( ArenaSlot* victim_arena_slot ) const { - task** victim_task_pool; - ExponentialBackoff backoff; - bool sync_prepare_done = false; - for(;;) { - victim_task_pool = victim_arena_slot->task_pool; - // TODO: Investigate the effect of bailing out on the locked pool without trying to lock it. - // When doing this update assertion in the end of the method. - if ( victim_task_pool == EmptyTaskPool ) { - // The victim thread emptied its task pool - nothing to lock - if( sync_prepare_done ) - ITT_NOTIFY(sync_cancel, victim_arena_slot); - break; - } - if( victim_task_pool != LockedTaskPool && - __TBB_CompareAndSwapW( &victim_arena_slot->task_pool, - (intptr_t)LockedTaskPool, (intptr_t)victim_task_pool ) == (intptr_t)victim_task_pool ) - { - // We've locked victim's task pool - ITT_NOTIFY(sync_acquired, victim_arena_slot); - break; - } - else if( !sync_prepare_done ) { - // Start waiting - ITT_NOTIFY(sync_prepare, victim_arena_slot); - sync_prepare_done = true; - } - // Someone else acquired a lock, so pause and do exponential backoff. - backoff.pause(); - } - __TBB_ASSERT( victim_task_pool == EmptyTaskPool || - victim_arena_slot->task_pool == LockedTaskPool && victim_task_pool != LockedTaskPool, - "not really locked victim's task pool?" ); - return victim_task_pool; -} // GenericScheduler::lock_task_pool - -inline void GenericScheduler::unlock_task_pool( ArenaSlot* victim_arena_slot, - task** victim_task_pool ) const { - __TBB_ASSERT( victim_arena_slot, "empty victim arena slot pointer" ); - __TBB_ASSERT( victim_arena_slot->task_pool == LockedTaskPool, "victim arena slot is not locked" ); - ITT_NOTIFY(sync_releasing, victim_arena_slot); - __TBB_store_with_release( victim_arena_slot->task_pool, victim_task_pool ); -} - -#else /* !__TBB_TASK_DEQUE */ - -inline void GenericScheduler::acquire_task_pool() const { - __TBB_ASSERT( arena_slot, "arena_slot not set" ); - __TBB_ASSERT( deepest>=-1, NULL ); - __TBB_ASSERT( arena_slot->owner_waits==false, "slot ownership corrupt?" ); - ExponentialBackoff backoff; - bool sync_prepare_done = false; - for(;;) { -#if TEST_ASSEMBLY_ROUTINES - __TBB_ASSERT( (arena_slot->steal_end&1)==0, "already acquired" ); -#endif /* TEST_ASSEMBLY_ROUTINES */ - __TBB_ASSERT( !in_arena() || arena_slot==&arena->slot[dummy_slot.task_pool->prefix().arena_index], "slot ownership corrupt?" ); - __TBB_ASSERT( arena_slot->task_pool==dummy_slot.task_pool, "slot ownership corrupt?" ); - depth_type steal_end = arena_slot->steal_end; - if( (steal_end&1)==0 && (__TBB_CompareAndSwapW( &arena_slot->steal_end, steal_end|1, steal_end )&1)==0 ) { - // We acquired our own slot - ITT_NOTIFY(sync_acquired, arena_slot); - arena_slot->owner_waits = false; - break; - } else { - // Someone else acquired a lock, so pause and do exponential backoff. - if( !sync_prepare_done ) { - // Start waiting - ITT_NOTIFY(sync_prepare, arena_slot); - sync_prepare_done = true; - } else { - // after 2nd attempt, still can't acquire own pool; - // need notify others that the owner is waiting - arena_slot->owner_waits = true; - } - backoff.pause(); -#if TEST_ASSEMBLY_ROUTINES - __TBB_ASSERT( arena_slot->task_pool==dummy_slot.task_pool, NULL ); -#endif /* TEST_ASSEMBLY_ROUTINES */ - } - } - __TBB_ASSERT( arena_slot->steal_end>>1 <= depth_type(array_size), NULL ); - __TBB_ASSERT( dummy_slot.task_pool->prefix().steal_begin<=depth_type(array_size), NULL ); - __TBB_ASSERT( deepest<=depth_type(array_size), NULL ); -} // GenericScheduler::acquire_task_pool - -inline void GenericScheduler::release_task_pool() const { - __TBB_ASSERT( arena_slot->steal_end>>1 <= depth_type(array_size), NULL ); - __TBB_ASSERT( dummy_slot.task_pool->prefix().steal_begin<=depth_type(array_size), NULL ); - __TBB_ASSERT( deepest<=depth_type(array_size), NULL ); - ITT_NOTIFY(sync_releasing, arena_slot); - __TBB_store_with_release( arena_slot->steal_end, 2*deepest ); -} -#endif /* !__TBB_TASK_DEQUE */ - -#if __TBB_TASK_DEQUE -inline task* GenericScheduler::prepare_for_spawning( task* t ) { - __TBB_ASSERT( t->state()==task::allocated, "attempt to spawn task that is not in 'allocated' state" ); - t->prefix().owner = this; - t->prefix().state = task::ready; -#if TBB_USE_ASSERT - if( task* parent = t->parent() ) { - internal::reference_count ref_count = parent->prefix().ref_count; - __TBB_ASSERT( ref_count>=0, "attempt to spawn task whose parent has a ref_count<0" ); - __TBB_ASSERT( ref_count!=0, "attempt to spawn task whose parent has a ref_count==0 (forgot to set_ref_count?)" ); - parent->prefix().extra_state |= es_ref_count_active; - } -#endif /* TBB_USE_ASSERT */ - affinity_id dst_thread = t->prefix().affinity; - __TBB_ASSERT( dst_thread == 0 || is_version_3_task(*t), "backwards compatibility to TBB 2.0 tasks is broken" ); - if( dst_thread != 0 && dst_thread != my_affinity_id ) { - task_proxy& proxy = (task_proxy&)allocate_task( sizeof(task_proxy), - __TBB_ALLOC_TASK_ARGS(NULL, t->depth(), NULL) ); - // Mark as a proxy - proxy.prefix().extra_state = es_task_proxy; - proxy.outbox = &arena->mailbox(dst_thread); - proxy.task_and_tag = intptr(t)|3; - proxy.next_in_mailbox = NULL; - ITT_NOTIFY( sync_releasing, proxy.outbox ); - // Mail the proxy - after this point t may be destroyed by another thread at any moment. - proxy.outbox->push(proxy); - return &proxy; - } - return t; -} -#endif /* __TBB_TASK_DEQUE */ - -/** Conceptually, this method should be a member of class scheduler. - But doing so would force us to publish class scheduler in the headers. */ -void GenericScheduler::spawn( task& first, task*& next ) { - __TBB_ASSERT( assert_okay(), NULL ); - TBB_TRACE(("%p.internal_spawn enter\n", this )); - -#if __TBB_TASK_DEQUE - if ( &first.prefix().next == &next ) { - // Single task is being spawned - if ( arena_slot->tail == task_pool_size ) { - // 1 compensates for head possibly temporarily incremented by a thief - if ( arena_slot->head > 1 ) { - // Move the busy part of the deque to the beginning of the allocated space - acquire_task_pool(); - arena_slot->tail -= arena_slot->head; - memmove( dummy_slot.task_pool, dummy_slot.task_pool + arena_slot->head, arena_slot->tail * sizeof(task*) ); - arena_slot->head = 0; - release_task_pool(); - } - else { - grow( task_pool_size + 1 ); - } - } - dummy_slot.task_pool[arena_slot->tail] = prepare_for_spawning( &first ); - // The following store with release is required on ia64 only - size_t new_tail = arena_slot->tail + 1; - __TBB_store_with_release( arena_slot->tail, new_tail ); - __TBB_ASSERT ( arena_slot->tail <= task_pool_size, "task deque end was overwritten" ); - } - else { - // Task list is being spawned - const size_t initial_capacity = 64; - task *arr[initial_capacity]; - fast_reverse_vector<task*> tasks(arr, initial_capacity); - task *t_next = NULL; - for( task* t = &first; ; t = t_next ) { - // After prepare_for_spawning returns t may already have been destroyed. - // So milk it while it is alive. - bool end = &t->prefix().next == &next; - t_next = t->prefix().next; - tasks.push_back( prepare_for_spawning(t) ); - if( end ) - break; - } - size_t num_tasks = tasks.size(); - __TBB_ASSERT ( arena_index != null_arena_index, "invalid arena slot index" ); - if ( arena_slot->tail + num_tasks > task_pool_size ) { - // 1 compensates for head possibly temporarily incremented by a thief - size_t new_size = arena_slot->tail - arena_slot->head + num_tasks + 1; - if ( new_size <= task_pool_size ) { - // Move the busy part of the deque to the beginning of the allocated space - acquire_task_pool(); - arena_slot->tail -= arena_slot->head; - memmove( dummy_slot.task_pool, dummy_slot.task_pool + arena_slot->head, arena_slot->tail * sizeof(task*) ); - arena_slot->head = 0; - release_task_pool(); - } - else { - grow( new_size ); - } - } - tasks.copy_memory( dummy_slot.task_pool + arena_slot->tail ); - // The following store with release is required on ia64 only - size_t new_tail = arena_slot->tail + num_tasks; - __TBB_store_with_release( arena_slot->tail, new_tail ); - __TBB_ASSERT ( arena_slot->tail <= task_pool_size, "task deque end was overwritten" ); - } - if ( !in_arena() ) { - if ( is_worker() ) - enter_arena(); - else - try_enter_arena(); - } -#else /* !__TBB_TASK_DEQUE */ - task* first_ptr = &first; - task** link = &first_ptr; - for( task* t = first_ptr; ; t=*link ) { - __TBB_ASSERT( t->prefix().depth==first.prefix().depth, "tasks must have same depth" ); - __TBB_ASSERT( t->state()==task::allocated, "attempt to spawn task that is not in 'allocated' state" ); - t->prefix().owner = this; - t->prefix().state = task::ready; -#if TBB_USE_ASSERT - if( task* parent = t->parent() ) { - internal::reference_count ref_count = parent->prefix().ref_count; - __TBB_ASSERT( ref_count>=0, "attempt to spawn task whose parent has a ref_count<0" ); - __TBB_ASSERT( ref_count!=0, "attempt to spawn task whose parent has a ref_count==0 (forgot to set_ref_count?)" ); - parent->prefix().extra_state |= es_ref_count_active; - } -#endif /* TBB_USE_ASSERT */ - affinity_id dst_thread=t->prefix().affinity; - __TBB_ASSERT( dst_thread==0 || is_version_3_task(*t), "backwards compatibility to TBB 2.0 tasks is broken" ); - if( dst_thread!=0 && dst_thread!=my_affinity_id ) { - task_proxy& proxy = (task_proxy&)allocate_task( sizeof(task_proxy), - __TBB_ALLOC_TASK_ARGS(NULL, t->depth(), NULL) ); - // Mark as a proxy - proxy.prefix().extra_state = es_task_proxy; - proxy.outbox = &arena->mailbox(dst_thread); - proxy.task_and_tag = intptr(t)|3; - proxy.next_in_mailbox = NULL; - // Link proxy into list where the original task was. - *link = &proxy; - link = &proxy.prefix().next; - proxy.prefix().next = t->prefix().next; - ITT_NOTIFY( sync_releasing, proxy.outbox ); - // Mail the proxy - after this point, t->prefix().next may be changed by another thread. - proxy.outbox->push(proxy); - } else { - link = &t->prefix().next; - } - if( &t->prefix().next==&next ) - break; - } - task::depth_type d = first_ptr->prefix().depth; - __TBB_ASSERT(depth_type(array_size)>0, "casting overflow?"); - if( d>=depth_type(array_size) ) { - grow( d+1 ); - } - __TBB_ASSERT( assert_okay(), NULL ); - if( !in_arena() ) { - try_enter_arena(); - __TBB_ASSERT( arena_slot->steal_end&1, NULL ); - } else { - acquire_task_pool(); - } - TaskPool* tp = dummy_slot.task_pool; - - *link = tp->array[d]; - tp->array[d] = first_ptr; - - if( d>deepest ) - deepest = d; - if( d<tp->prefix().steal_begin ) - tp->prefix().steal_begin = d; - - release_task_pool(); -#endif /* !__TBB_TASK_DEQUE */ - - arena->mark_pool_full(); - __TBB_ASSERT( assert_okay(), NULL ); - - TBB_TRACE(("%p.internal_spawn exit\n", this )); -} - -void GenericScheduler::spawn_root_and_wait( task& first, task*& next ) { - __TBB_ASSERT( &first, NULL ); - auto_empty_task dummy( __TBB_ALLOC_TASK_ARGS(this, first.prefix().depth-1, first.prefix().context) ); - internal::reference_count n = 0; - for( task* t=&first; ; t=t->prefix().next ) { - ++n; - __TBB_ASSERT( t->is_owned_by_current_thread(), "root task not owned by current thread" ); - __TBB_ASSERT( !t->prefix().parent, "not a root task, or already running" ); - t->prefix().parent = &dummy; - if( &t->prefix().next==&next ) break; -#if __TBB_EXCEPTIONS - __TBB_ASSERT( t->prefix().context == t->prefix().next->prefix().context, - "all the root tasks in list must share the same context"); -#endif /* __TBB_EXCEPTIONS */ - } - dummy.prefix().ref_count = n+1; - if( n>1 ) - spawn( *first.prefix().next, next ); - TBB_TRACE(("spawn_root_and_wait((task_list*)%p): calling %p.loop\n",&first,this)); - wait_for_all( dummy, &first ); - TBB_TRACE(("spawn_root_and_wait((task_list*)%p): return\n",&first)); -} - -inline task* GenericScheduler::get_mailbox_task() { - __TBB_ASSERT( my_affinity_id>0, "not in arena" ); - task* result = NULL; - while( task_proxy* t = inbox.pop() ) { - intptr tat = __TBB_load_with_acquire(t->task_and_tag); - __TBB_ASSERT( tat==task_proxy::mailbox_bit || tat==(tat|3)&&tat!=3, NULL ); - if( tat!=task_proxy::mailbox_bit && __TBB_CompareAndSwapW( &t->task_and_tag, task_proxy::pool_bit, tat )==tat ) { - // Successfully grabbed the task, and left pool seeker with job of freeing the proxy. - ITT_NOTIFY( sync_acquired, inbox.outbox() ); - result = (task*)(tat & ~3); - result->prefix().owner = this; - break; - } - free_task_proxy( *t ); - } - return result; -} - -inline task* GenericScheduler::strip_proxy( task_proxy* tp ) { - __TBB_ASSERT( tp->prefix().extra_state==es_task_proxy, NULL ); - intptr tat = __TBB_load_with_acquire(tp->task_and_tag); - if( (tat&3)==3 ) { - // proxy is shared by a pool and a mailbox. - // Attempt to transition it to "empty proxy in mailbox" state. - if( __TBB_CompareAndSwapW( &tp->task_and_tag, task_proxy::mailbox_bit, tat )==tat ) { - // Successfully grabbed the task, and left the mailbox with the job of freeing the proxy. - return (task*)(tat&~3); - } - __TBB_ASSERT( tp->task_and_tag==task_proxy::pool_bit, NULL ); - } else { - // We have exclusive access to the proxy - __TBB_ASSERT( (tat&3)==task_proxy::pool_bit, "task did not come from pool?" ); - __TBB_ASSERT ( !(tat&~3), "Empty proxy in the pool contains non-zero task pointer" ); - } -#if TBB_USE_ASSERT - tp->prefix().state = task::allocated; -#endif - free_task_proxy( *tp ); - // Another thread grabbed the underlying task via their mailbox - return NULL; -} - -#if __TBB_TASK_DEQUE -inline task* GenericScheduler::get_task() { - task* result = NULL; -retry: - __TBB_FetchAndAddW(&arena_slot->tail, -1); - // FetchAndAdd provides the full memory fence that is required by the arbitration protocol - if ( (intptr_t)arena_slot->head > (intptr_t)arena_slot->tail ) { - acquire_task_pool(); - if ( (intptr_t)arena_slot->head <= (intptr_t)arena_slot->tail ) { - // The thief backed off - grab the task - __TBB_ASSERT_VALID_TASK_PTR( dummy_slot.task_pool[arena_slot->tail] ); - result = dummy_slot.task_pool[arena_slot->tail]; - __TBB_POISON_TASK_PTR( dummy_slot.task_pool[arena_slot->tail] ); - } - else { - __TBB_ASSERT ( arena_slot->head == arena_slot->tail + 1, "victim/thief arbitration algorithm failure" ); - } - if ( (intptr_t)arena_slot->head < (intptr_t)arena_slot->tail ) { - release_task_pool(); - } - else { - // In any case the deque is empty now, so compact it - arena_slot->head = arena_slot->tail = 0; - if ( in_arena() ) - leave_arena(); - } - } - else { - __TBB_ASSERT_VALID_TASK_PTR( dummy_slot.task_pool[arena_slot->tail] ); - result = dummy_slot.task_pool[arena_slot->tail]; - __TBB_POISON_TASK_PTR( dummy_slot.task_pool[arena_slot->tail] ); - } - if( result && is_proxy(*result) ) { - result = strip_proxy((task_proxy*)result); - if( !result ) { - goto retry; - } - GATHER_STATISTIC( ++proxy_execute_count ); - // Following assertion should be true because TBB 2.0 tasks never specify affinity, and hence are not proxied. - __TBB_ASSERT( is_version_3_task(*result), "backwards compatibility with TBB 2.0 broken" ); - // Task affinity has changed. - innermost_running_task = result; - result->note_affinity(my_affinity_id); - } - return result; -} // GenericScheduler::get_task - -task* GenericScheduler::steal_task( ArenaSlot& victim_slot ) { - task** victim_pool = lock_task_pool( &victim_slot ); - if ( !victim_pool ) - return NULL; - const size_t none = ~0u; - size_t first_skipped_proxy = none; - task* result = NULL; -retry: - __TBB_FetchAndAddW(&victim_slot.head, 1); - // FetchAndAdd provides the full memory fence that is required by the arbitration protocol - if ( (intptr_t)victim_slot.head > (intptr_t)victim_slot.tail ) { - --victim_slot.head; - } - else { - __TBB_ASSERT_VALID_TASK_PTR( victim_pool[victim_slot.head - 1]); - result = victim_pool[victim_slot.head - 1]; - if( is_proxy(*result) ) { - task_proxy& tp = *static_cast<task_proxy*>(result); - // If task will likely be grabbed by whom it was mailed to, skip it. - if( (tp.task_and_tag & 3) == 3 && tp.outbox->recipient_is_idle() ) { - if ( first_skipped_proxy == none ) - first_skipped_proxy = victim_slot.head - 1; - result = NULL; - goto retry; - } - } - __TBB_POISON_TASK_PTR(victim_pool[victim_slot.head - 1]); - } - if ( first_skipped_proxy != none ) { - if ( result ) { - victim_pool[victim_slot.head - 1] = victim_pool[first_skipped_proxy]; - __TBB_POISON_TASK_PTR( victim_pool[first_skipped_proxy] ); - __TBB_store_with_release( victim_slot.head, first_skipped_proxy + 1 ); - } - else - __TBB_store_with_release( victim_slot.head, first_skipped_proxy ); - } - unlock_task_pool( &victim_slot, victim_pool ); - return result; -} - -#else /* !__TBB_TASK_DEQUE */ - -inline task* GenericScheduler::get_task( depth_type d ) { - task* result = NULL; - // parallel_reduce has a subtle dependence on the order in which tasks are - // selected from the deque for execution. If the task selected is not the - // next immediate task -- i.e. there is a hole between the previous task and - // the task selected -- then the selected task must be treated as stolen and - // the body of the task split in order to ensure the correctness of the join - // operations. -retry: - if( deepest>=d ) { - acquire_task_pool(); - task** a = dummy_slot.task_pool->array; - depth_type i = deepest; - do { - if( (result = a[i]) ) { - if( !(a[i] = result->prefix().next) ) - --i; - break; - } - } while( --i>=d ); - deepest = i; - release_task_pool(); - } - if( result ) { - if( is_proxy(*result) ) { - result = strip_proxy((task_proxy*)result); - if( !result ) { - goto retry; - } - GATHER_STATISTIC( ++proxy_execute_count ); - // Following assertion should be true because TBB 2.0 tasks never specify affinity, and hence are not proxied. - __TBB_ASSERT( is_version_3_task(*result), "backwards compatibility with TBB 2.0 broken" ); - // Task affinity has changed. - innermost_running_task = result; - result->note_affinity(my_affinity_id); - } - } - return result; -} // GenericScheduler::get_task - -task* GenericScheduler::steal_task( UnpaddedArenaSlot& arena_slot, depth_type d ) { - task* result = NULL; - ExponentialBackoff backoff; - bool sync_prepare_done = false; - depth_type steal_end = arena_slot.steal_end; - for(;;) { - if( steal_end>>1<d ) { - // Nothing of interest to steal - if( sync_prepare_done ) - ITT_NOTIFY(sync_cancel, &arena_slot); - goto done; - } - if( steal_end&1 ) { - // Someone else has lock on it. - if( arena_slot.owner_waits ) { - // The pool owner is waiting for it, so need to abandon locking attempts - if( sync_prepare_done ) - ITT_NOTIFY(sync_cancel, &arena_slot); - goto done; - } - if( !sync_prepare_done ) { - ITT_NOTIFY(sync_prepare, &arena_slot); - sync_prepare_done = true; - } - // While waiting, do exponential backoff - backoff.pause(); - steal_end = arena_slot.steal_end; - } else { - depth_type tmp = steal_end; - steal_end = __TBB_CompareAndSwapW( &arena_slot.steal_end, steal_end+1, steal_end ); - if( tmp==steal_end ) { - ITT_NOTIFY(sync_acquired, &arena_slot); - break; - } - } - } -{ - TaskPool* tp = arena_slot.task_pool; - depth_type i = tp->prefix().steal_begin; - if( i<d ) - i = d; - for(; i<=steal_end>>1; ++i ) { - for( task** r = &tp->array[i]; (result=*r)!=NULL; r = &result->prefix().next ) { - if( is_proxy(*result) ) { - task_proxy& tp = *static_cast<task_proxy*>(result); - // If task will likely be grabbed by whom it was mailed to, skip it. - if( (tp.task_and_tag&3)==3 && tp.outbox->recipient_is_idle() ) - continue; - } - // Remove result from linked list - *r = result->prefix().next; - // Unlike get_task, we do not adjust i if array[i] becomes NULL. - // The reason is that it is a waste of time, because steal_task - // is relatively infrequent compared to insert_task, and the - // latter updates steal_begin too. - goto found; - } - } -found: - if( tp->prefix().steal_begin>=d ) { - tp->prefix().steal_begin = i; - if( i>steal_end>>1 ) { - // Pool is empty. This is important information for threads taking snapshots. - steal_end = -2; - } - } - // Release the task pool - ITT_NOTIFY(sync_releasing, &arena_slot); - __TBB_store_with_release( arena_slot.steal_end, steal_end ); -} -done: - return result; -} -#endif /* !__TBB_TASK_DEQUE */ - -#define CANCELLATION_INFO_PRESENT(t) __TBB_load_with_acquire(t->prefix().context->my_cancellation_requested) - -template<typename SchedulerTraits> -void CustomScheduler<SchedulerTraits>::wait_for_all( task& parent, task* child ) { - TBB_TRACE(("%p.wait_for_all(parent=%p,child=%p) enter\n", this, &parent, child)); -#if TBB_USE_ASSERT - __TBB_ASSERT( assert_okay(), NULL ); - if( child ) { - __TBB_ASSERT( child->prefix().owner==this, NULL ); - __TBB_ASSERT( parent.ref_count()>=2, "ref_count must be at least 2" ); - } else { - __TBB_ASSERT( parent.ref_count()>=1, "ref_count must be at least 1" ); - } - __TBB_ASSERT( assert_okay(), NULL ); -#endif /* TBB_USE_ASSERT */ - // Using parent's refcount in sync_prepare (in the stealing loop below) is - // a workaround for TP. We need to name it here to display correctly in Ampl. - if( SchedulerTraits::itt_possible ) - ITT_SYNC_CREATE(&parent.prefix().ref_count, SyncType_Scheduler, SyncObj_TaskStealingLoop); -#if __TBB_EXCEPTIONS - __TBB_ASSERT( parent.prefix().context || (is_worker() && &parent == dummy_task), "parent task does not have context" ); -#endif /* __TBB_EXCEPTIONS */ - task* t = child; -#if __TBB_TASK_DEQUE - // This is a nested blocking call or we are in the innermost dispatch loop of a master thread. - __TBB_ASSERT( innermost_running_task != dummy_task || !is_worker(), NULL ); -#else /* !__TBB_TASK_DEQUE */ - depth_type d; - if( innermost_running_task==dummy_task ) { - // We are in the innermost task dispatch loop of a master thread. - __TBB_ASSERT( !is_worker(), NULL ); - // Forcefully make this loop operate at zero depth. - d = 0; - } else { - d = parent.prefix().depth+1; - } -#endif /* !__TBB_TASK_DEQUE */ - task* old_innermost_running_task = innermost_running_task; -#if __TBB_EXCEPTIONS -exception_was_caught: - try { -#endif /* __TBB_EXCEPTIONS */ - // Outer loop steals tasks when necessary. - for(;;) { - // Middle loop evaluates tasks that are pulled off "array". - do { - // Inner loop evaluates tasks that are handed directly to us by other tasks. - while(t) { -#if TBB_USE_ASSERT - __TBB_ASSERT(!is_proxy(*t),"unexpected proxy"); - __TBB_ASSERT( t->prefix().owner==this, NULL ); -#if __TBB_EXCEPTIONS - if ( !t->prefix().context->my_cancellation_requested ) -#endif - __TBB_ASSERT( 1L<<t->state() & (1L<<task::allocated|1L<<task::ready|1L<<task::reexecute), NULL ); - __TBB_ASSERT(assert_okay(),NULL); -#endif /* TBB_USE_ASSERT */ - task* t_next = NULL; - innermost_running_task = t; - t->prefix().state = task::executing; -#if __TBB_EXCEPTIONS - if ( !t->prefix().context->my_cancellation_requested ) -#endif - { - TBB_TRACE(("%p.wait_for_all: %p.execute\n",this,t)); - GATHER_STATISTIC( ++execute_count ); - t_next = t->execute(); -#if STATISTICS - if (t_next) { - affinity_id next_affinity=t_next->prefix().affinity; - if (next_affinity != 0 && next_affinity != my_affinity_id) - GATHER_STATISTIC( ++proxy_bypass_count ); - } -#endif - } - if( t_next ) { - __TBB_ASSERT( t_next->state()==task::allocated, - "if task::execute() returns task, it must be marked as allocated" ); - // The store here has a subtle secondary effect - it fetches *t_next into cache. - t_next->prefix().owner = this; - } - __TBB_ASSERT(assert_okay(),NULL); - switch( task::state_type(t->prefix().state) ) { - case task::executing: { - // this block was copied below to case task::recycle - // when making changes, check it too - task* s = t->parent(); - __TBB_ASSERT( innermost_running_task==t, NULL ); - __TBB_ASSERT( t->prefix().ref_count==0, "Task still has children after it has been executed" ); - t->~task(); - if( s ) { - if( SchedulerTraits::itt_possible ) - ITT_NOTIFY(sync_releasing, &s->prefix().ref_count); - if( SchedulerTraits::has_slow_atomic && s->prefix().ref_count==1 ? (s->prefix().ref_count=0, true) : __TBB_FetchAndDecrementWrelease(&s->prefix().ref_count)==1 ) { - if( SchedulerTraits::itt_possible ) - ITT_NOTIFY(sync_acquired, &s->prefix().ref_count); -#if !__TBB_TASK_DEQUE - depth_type s_depth = __TBB_load_with_acquire(s->prefix().depth); -#endif /* !__TBB_TASK_DEQUE */ -#if TBB_USE_ASSERT - s->prefix().extra_state &= ~es_ref_count_active; -#endif /* TBB_USE_ASSERT */ - s->prefix().owner = this; -#if __TBB_TASK_DEQUE - if( !t_next ) { -#else /* !__TBB_TASK_DEQUE */ - if( !t_next && s_depth>=deepest && s_depth>=d ) { - // Eliminate spawn/get_task pair. - // The elimination is valid because the spawn would set deepest==s_depth, - // and the subsequent call to get_task(d) would grab task s and - // restore deepest to its former value. -#endif /* !__TBB_TASK_DEQUE */ - t_next = s; - } else { - CustomScheduler<SchedulerTraits>::spawn(*s, s->prefix().next ); - __TBB_ASSERT(assert_okay(),NULL); - } - } - } - free_task<no_hint>( *t ); - break; - } - - case task::recycle: { // state set by recycle_as_safe_continuation() - t->prefix().state = task::allocated; - // for safe continuation, need atomically decrement ref_count; - // the block was copied from above case task::executing, and changed. - // Use "s" here as name for t, so that code resembles case task::executing more closely. - task* const& s = t; - if( SchedulerTraits::itt_possible ) - ITT_NOTIFY(sync_releasing, &s->prefix().ref_count); - if( SchedulerTraits::has_slow_atomic && s->prefix().ref_count==1 ? (s->prefix().ref_count=0, true) : __TBB_FetchAndDecrementWrelease(&s->prefix().ref_count)==1 ) { - if( SchedulerTraits::itt_possible ) - ITT_NOTIFY(sync_acquired, &s->prefix().ref_count); - // Unused load is put here for sake of inserting an "acquire" fence. -#if !__TBB_TASK_DEQUE - (void)__TBB_load_with_acquire(s->prefix().depth); -#endif /* !__TBB_TASK_DEQUE */ -#if TBB_USE_ASSERT - s->prefix().extra_state &= ~es_ref_count_active; - __TBB_ASSERT( s->prefix().owner==this, "ownership corrupt?" ); -#if !__TBB_TASK_DEQUE - __TBB_ASSERT( s->prefix().depth>=d, NULL ); -#endif /* !__TBB_TASK_DEQUE */ -#endif /* TBB_USE_ASSERT */ - if( !t_next ) { - t_next = s; - } else { - CustomScheduler<SchedulerTraits>::spawn(*s, s->prefix().next ); - __TBB_ASSERT(assert_okay(),NULL); - } - } - break; - } - - case task::reexecute: // set by recycle_to_reexecute() - __TBB_ASSERT( t_next && t_next != t, "reexecution requires that method 'execute' return another task" ); - TBB_TRACE(("%p.wait_for_all: put task %p back into array",this,t)); - t->prefix().state = task::allocated; - CustomScheduler<SchedulerTraits>::spawn( *t, t->prefix().next ); - __TBB_ASSERT(assert_okay(),NULL); - break; -#if TBB_USE_ASSERT - case task::allocated: - break; - case task::ready: - __TBB_ASSERT( false, "task is in READY state upon return from method execute()" ); - break; - default: - __TBB_ASSERT( false, "illegal state" ); -#else - default: // just to shut up some compilation warnings - break; -#endif /* TBB_USE_ASSERT */ - } -#if !__TBB_TASK_DEQUE - __TBB_ASSERT( !t_next||t_next->prefix().depth>=d, NULL ); -#endif /* !__TBB_TASK_DEQUE */ - t = t_next; - } // end of scheduler bypass loop - __TBB_ASSERT(assert_okay(),NULL); - -#if __TBB_TASK_DEQUE - // If the parent's descendants are finished with and we are not in - // the innermost dispatch loop of a master thread, then we are done. - // This is necessary to prevent unbounded stack grows in case of deep - // wait_for_all nesting. - // Note that we cannot return from master's innermost dispatch loop - // until we process all the tasks in the local pool, since in case - // of multiple masters this could have left some of them forever - // waiting for their stolen children to be processed. - t = (parent.prefix().ref_count==1) && (old_innermost_running_task != dummy_task) ? NULL : get_task(); - -#else /* !__TBB_TASK_DEQUE */ - t = get_task( d ); -#endif /* !__TBB_TASK_DEQUE */ - __TBB_ASSERT(!t || !is_proxy(*t),"unexpected proxy"); -#if TBB_USE_ASSERT - __TBB_ASSERT(assert_okay(),NULL); - if(t) { - AssertOkay(*t); - __TBB_ASSERT( t->prefix().owner==this, "thread got task that it does not own" ); - } -#endif /* TBB_USE_ASSERT */ - } while( t ); // end of local task array processing loop - - inbox.set_is_idle( true ); - __TBB_ASSERT( arena->prefix().number_of_workers>0||parent.prefix().ref_count==1, "deadlock detected" ); - // The state "failure_count==-1" is used only when itt_possible is true, - // and denotes that a sync_prepare has not yet been issued. - for( int failure_count = -static_cast<int>(SchedulerTraits::itt_possible);; ++failure_count) { - if( parent.prefix().ref_count==1 ) { - if( SchedulerTraits::itt_possible ) { - if( failure_count!=-1 ) { - ITT_NOTIFY(sync_prepare, &parent.prefix().ref_count); - // Notify Intel(R) Thread Profiler that thread has stopped spinning. - ITT_NOTIFY(sync_acquired, this); - } - ITT_NOTIFY(sync_acquired, &parent.prefix().ref_count); - } - inbox.set_is_idle( false ); - goto done; - } - // Try to steal a task from a random victim. - size_t n = arena->prefix().limit; - if( n>1 ) { - if( !my_affinity_id || !(t=get_mailbox_task()) ) { -#if __TBB_TASK_DEQUE - if ( !can_steal() ) - goto fail; -#endif /* __TBB_TASK_DEQUE */ - size_t k = random.get() % (n-1); - ArenaSlot* victim = &arena->slot[k]; -#if __TBB_TASK_DEQUE - // The following condition excludes the master that might have - // already taken our previous place in the arena from the list . - // of potential victims. But since such a situation can take - // place only in case of significant oversubscription, keeping - // the checks simple seems to be preferable to complicating the code. - if( k >= arena_index ) - ++victim; // Adjusts random distribution to exclude self - t = steal_task( *victim ); -#else /* !__TBB_TASK_DEQUE */ - if( victim>=arena_slot ) - ++victim; // Adjusts random distribution to exclude self - t = steal_task( *victim, d ); -#endif /* !__TBB_TASK_DEQUE */ - if( !t ) goto fail; - if( is_proxy(*t) ) { - t = strip_proxy((task_proxy*)t); - if( !t ) goto fail; - GATHER_STATISTIC( ++proxy_steal_count ); - } - GATHER_STATISTIC( ++steal_count ); - if( is_version_3_task(*t) ) { - innermost_running_task = t; - t->note_affinity( my_affinity_id ); - } - } else { - GATHER_STATISTIC( ++mail_received_count ); - } - __TBB_ASSERT(t,NULL); -#if __TBB_SCHEDULER_OBSERVER - // No memory fence required for read of global_last_observer_proxy, because prior fence on steal/mailbox suffices. - if( local_last_observer_proxy!=global_last_observer_proxy ) { - notify_entry_observers(); - } -#endif /* __TBB_SCHEDULER_OBSERVER */ - { -#if !__TBB_TASK_DEQUE - __TBB_ASSERT( t->prefix().depth>=d, NULL ); -#endif /* !__TBB_TASK_DEQUE */ - if( SchedulerTraits::itt_possible ) { - if( failure_count!=-1 ) { - // FIXME - might be victim, or might be selected from a mailbox - // Notify Intel(R) Thread Profiler that thread has stopped spinning. - ITT_NOTIFY(sync_acquired, this); - // FIXME - might be victim, or might be selected from a mailbox - } - } - __TBB_ASSERT(t,NULL); - inbox.set_is_idle( false ); - break; - } - } -fail: - if( SchedulerTraits::itt_possible && failure_count==-1 ) { - // The first attempt to steal work failed, so notify Intel(R) Thread Profiler that - // the thread has started spinning. Ideally, we would do this notification - // *before* the first failed attempt to steal, but at that point we do not - // know that the steal will fail. - ITT_NOTIFY(sync_prepare, this); - failure_count = 0; - } - // Pause, even if we are going to yield, because the yield might return immediately. - __TBB_Pause(PauseTime); - int yield_threshold = 2*int(n); - if( failure_count>=yield_threshold ) { - __TBB_Yield(); - if( failure_count>=yield_threshold+100 ) { -#if __TBB_TASK_DEQUE - bool call_wait = !old_innermost_running_task; -#else - bool call_wait = d==0 && is_worker(); -#endif - if( call_wait && arena->wait_while_pool_is_empty() ) - failure_count = 0; - else - failure_count = yield_threshold; - } - } - } - __TBB_ASSERT(t,NULL); - __TBB_ASSERT(!is_proxy(*t),"unexpected proxy"); - t->prefix().owner = this; - } // end of stealing loop -#if __TBB_EXCEPTIONS - } catch ( tbb_exception& exc ) { - if ( t->prefix().context->cancel_group_execution() ) { - // We are the first to signal cancellation, so store the exception that caused it. - t->prefix().context->my_exception = exc.move(); - } - } catch ( std::exception& exc ) { - if ( t->prefix().context->cancel_group_execution() ) { - // We are the first to signal cancellation, so store the exception that caused it. - t->prefix().context->my_exception = captured_exception::allocate(typeid(exc).name(), exc.what()); - } - } catch ( ... ) { - if ( t->prefix().context->cancel_group_execution() ) { - // We are the first to signal cancellation, so store the exception that caused it. - t->prefix().context->my_exception = captured_exception::allocate("...", "Unidentified exception"); - } - } - if( task::state_type(t->prefix().state) == task::recycle ) { // state set by recycle_as_safe_continuation() - t->prefix().state = task::allocated; - // for safe continuation, need to atomically decrement ref_count; - if( SchedulerTraits::itt_possible ) - ITT_NOTIFY(sync_releasing, &t->prefix().ref_count); - if( __TBB_FetchAndDecrementWrelease(&t->prefix().ref_count)==1 ) { - if( SchedulerTraits::itt_possible ) - ITT_NOTIFY(sync_acquired, &t->prefix().ref_count); - }else{ - t = NULL; - } - } - goto exception_was_caught; -#endif /* __TBB_EXCEPTIONS */ -done: - parent.prefix().ref_count = 0; -#if TBB_USE_ASSERT - parent.prefix().extra_state &= ~es_ref_count_active; -#endif /* TBB_USE_ASSERT */ - innermost_running_task = old_innermost_running_task; -#if !__TBB_TASK_DEQUE - if( deepest<0 && innermost_running_task==dummy_task && in_arena() ) { - leave_arena(/*compress=*/true); - } -#endif /* !__TBB_TASK_DEQUE */ -#if __TBB_EXCEPTIONS - __TBB_ASSERT(parent.prefix().context && dummy_task->prefix().context, ""); - task_group_context* parent_ctx = parent.prefix().context; - if ( __TBB_load_with_acquire(parent_ctx->my_cancellation_requested) ) { - tbb_exception *e = __TBB_load_with_acquire(parent_ctx->my_exception); - if ( innermost_running_task == dummy_task && parent_ctx == dummy_task->prefix().context ) { - // We are in the innermost task dispatch loop of a master thread, and - // the whole task tree has been collapsed. So we may clear cancellation data. - __TBB_store_with_release(parent_ctx->my_cancellation_requested, 0); - __TBB_ASSERT(dummy_task->prefix().context == parent_ctx || !CANCELLATION_INFO_PRESENT(dummy_task), - "Unexpected exception or cancellation data in the dummy task"); - //! \todo Add assertion that master's dummy task context does not have children - } - if ( e ) - e->throw_self(); - } - __TBB_ASSERT(!is_worker() || !CANCELLATION_INFO_PRESENT(dummy_task), - "Worker's dummy task context modified"); - __TBB_ASSERT(innermost_running_task != dummy_task || !CANCELLATION_INFO_PRESENT(dummy_task), - "Unexpected exception or cancellation data in the master's dummy task"); -#endif /* __TBB_EXCEPTIONS */ - __TBB_ASSERT( assert_okay(), NULL ); - TBB_TRACE(("%p.wait_for_all(parent=%p): return\n",this,&parent)); -} - -#if __TBB_TASK_DEQUE -inline void GenericScheduler::do_enter_arena() { - arena_slot = &arena->slot[arena_index]; - __TBB_ASSERT ( arena_slot->head == 0 && arena_slot->tail == 0, "deque of a free slot must be empty" ); - arena_slot->head = dummy_slot.head; - arena_slot->tail = dummy_slot.tail; - __TBB_store_with_release( arena_slot->task_pool, dummy_slot.task_pool ); - // We'll leave arena only when it's empty, so clean up local instances of indices. - dummy_slot.head = dummy_slot.tail = 0; -} - -void GenericScheduler::enter_arena() { - __TBB_ASSERT ( is_worker(), "only workers should use enter_arena()" ); - __TBB_ASSERT ( arena, "no arena: initialization not completed?" ); - __TBB_ASSERT ( !in_arena(), "worker already in arena?" ); - __TBB_ASSERT ( arena_index < arena->prefix().number_of_workers, "invalid worker arena slot index" ); - __TBB_ASSERT ( arena->slot[arena_index].task_pool == EmptyTaskPool, "someone else grabbed my arena slot?" ); - do_enter_arena(); -} - -void GenericScheduler::try_enter_arena() { - __TBB_ASSERT ( !is_worker(), "only masters should use try_enter_arena()" ); - __TBB_ASSERT ( arena, "no arena: initialization not completed?" ); - __TBB_ASSERT ( !in_arena(), "master already in arena?" ); - __TBB_ASSERT ( arena_index >= arena->prefix().number_of_workers && - arena_index < arena->prefix().number_of_slots, "invalid arena slot hint value" ); - - - size_t h = arena_index; - // We do not lock task pool upon successful entering arena - if( arena->slot[h].task_pool != EmptyTaskPool || - __TBB_CompareAndSwapW( &arena->slot[h].task_pool, (intptr_t)LockedTaskPool, - (intptr_t)EmptyTaskPool ) != (intptr_t)EmptyTaskPool ) - { - // Hinted arena slot is already busy, try some of the others at random - unsigned first = arena->prefix().number_of_workers, - last = arena->prefix().number_of_slots; - unsigned n = last - first - 1; - /// \todo Is this limit reasonable? - size_t max_attempts = last - first; - for (;;) { - size_t k = first + random.get() % n; - if( k >= h ) - ++k; // Adjusts random distribution to exclude previously tried slot - h = k; - if( arena->slot[h].task_pool == EmptyTaskPool && - __TBB_CompareAndSwapW( &arena->slot[h].task_pool, (intptr_t)LockedTaskPool, - (intptr_t)EmptyTaskPool ) == (intptr_t)EmptyTaskPool ) - { - break; - } - if ( --max_attempts == 0 ) { - // After so many attempts we are still unable to find a vacant arena slot. - // Cease the vain effort and work outside of arena for a while. - return; - } - } - } - // Successfully claimed a slot in the arena. - ITT_NOTIFY(sync_acquired, &arena->slot[h]); - __TBB_ASSERT ( arena->slot[h].task_pool == LockedTaskPool, "Arena slot is not actually acquired" ); - arena_index = h; - do_enter_arena(); - attach_mailbox( affinity_id(h+1) ); -} - -void GenericScheduler::leave_arena() { - __TBB_ASSERT( in_arena(), "Not in arena" ); - // Do not reset arena_index. It will be used to (attempt to) re-acquire the slot next time - __TBB_ASSERT( &arena->slot[arena_index] == arena_slot, "Arena slot and slot index mismatch" ); - __TBB_ASSERT ( arena_slot->task_pool == LockedTaskPool, "Task pool must be locked when leaving arena" ); - __TBB_ASSERT ( arena_slot->head == 0 && arena_slot->tail == 0, "Cannot leave arena when the task pool is not empty" ); - if ( !is_worker() ) { - my_affinity_id = 0; - inbox.detach(); - } - ITT_NOTIFY(sync_releasing, &arena->slot[arena_index]); - __TBB_store_with_release( arena_slot->task_pool, EmptyTaskPool ); - arena_slot = &dummy_slot; -} - -#else /* !__TBB_TASK_DEQUE */ - -void GenericScheduler::try_enter_arena() { - __TBB_ASSERT( arena, NULL ); - __TBB_ASSERT( arena_slot, "arena_slot not set" ); - __TBB_ASSERT( !in_arena(), "already in arena?" ); - unsigned n = arena->prefix().number_of_slots; - unsigned j = unsigned(arena->prefix().limit); - for( unsigned k=j; k<n; ++k ) { - if( arena->slot[k].steal_end==-4 && __TBB_CompareAndSwapW( &arena->slot[k].steal_end, -4|1, -4 )==-4 ) { - __TBB_ASSERT( arena->slot[k].steal_end==-3, "slot not really acquired?" ); - ITT_NOTIFY(sync_acquired,&arena->slot[k]); - dummy_slot.task_pool->prefix().arena_index = k; - arena->slot[k].task_pool = dummy_slot.task_pool; - arena->slot[k].owner_waits = false; - arena_slot = &arena->slot[k]; - // Successfully claimed a spot in the arena. Update arena->prefix().limit. - do { - j = unsigned(arena->prefix().limit.compare_and_swap( k+1, j )); - } while( j<=k ); - attach_mailbox( k+1 ); - break; - } - } - __TBB_store_with_release( arena_slot->steal_end, 2*deepest+1 ); -} - -void GenericScheduler::leave_arena( bool compress ) { - __TBB_ASSERT( in_arena(), "not in arena" ); - // Remove myself from the arena. - acquire_task_pool(); -#if TBB_USE_ASSERT - for( depth_type i=0; i<deepest; ++i ) - __TBB_ASSERT( !dummy_slot.task_pool->array[i], "leaving arena, but have tasks to do" ); -#endif /* TBB_USE_ASSERT */ - size_t k = dummy_slot.task_pool->prefix().arena_index; - __TBB_ASSERT( &arena->slot[k]==arena_slot, NULL ); - arena_slot->task_pool = NULL; - my_affinity_id = 0; - inbox.detach(); - dummy_slot.task_pool->prefix().arena_index = TaskPoolPrefix::null_arena_index; - arena_slot = &dummy_slot; - arena_slot->owner_waits = false; - size_t n = arena->prefix().number_of_workers; - __TBB_ASSERT( !compress || k>=n, "must be master to compress" ); - size_t new_limit = arena->prefix().limit; - if( compress && new_limit==k+1 ) { - // Garbage collect some slots - for(;;) { - new_limit = arena->prefix().limit.compare_and_swap( k, k+1 ); - ITT_NOTIFY(sync_releasing, &arena->slot[k]); - __TBB_store_with_release( arena->slot[k].steal_end, -4 ); - if( new_limit!=k+1 ) break; - if( --k<n ) break; - if( arena->slot[k].steal_end==-4 && __TBB_CompareAndSwapW( &arena->slot[k].steal_end, -4|1, -4 )==-4 ) { - ITT_NOTIFY(sync_acquired,&arena->slot[k]); - } else { - break; - } - } - } else { - ITT_NOTIFY(sync_releasing, &arena->slot[k]); - __TBB_store_with_release( arena->slot[k].steal_end, -4 ); - } -} -#endif /* !__TBB_TASK_DEQUE */ - -GenericScheduler* GenericScheduler::create_worker( Arena& a, size_t index ) { - GenericScheduler* s = GenericScheduler::allocate_scheduler(&a); - - // Put myself into the arena -#if !__TBB_TASK_DEQUE - ArenaSlot& slot = a.slot[index]; - __TBB_ASSERT( slot.steal_end==-3, "slot not allocated as locked worker?" ); - s->arena_slot = &slot; -#endif /* !__TBB_TASK_DEQUE */ -#if __TBB_EXCEPTIONS - s->dummy_task->prefix().context = &dummy_context; - // Sync up the local cancellation state with the global one. No need for fence here. - s->local_cancel_count = global_cancel_count; -#endif /* __TBB_EXCEPTIONS */ - s->attach_mailbox( index+1 ); -#if __TBB_TASK_DEQUE - s->arena_index = index; - s->init_stack_info(); -#else /* !__TBB_TASK_DEQUE */ - TaskPool* t = s->dummy_slot.task_pool; - t->prefix().arena_index = index; - ITT_NOTIFY(sync_releasing, &slot); - slot.task_pool = t; - slot.steal_end = -2; - slot.owner_waits = false; -#endif /* !__TBB_TASK_DEQUE */ - - return s; -} - -GenericScheduler* GenericScheduler::create_worker_heap( WorkerDescriptor& w ) { - __TBB_ASSERT( (uintptr)w.scheduler+1<2u, NULL ); - unsigned n = w.arena->prefix().number_of_workers; - WorkerDescriptor* worker_list = w.arena->prefix().worker_list; - __TBB_ASSERT( &w >= worker_list, NULL ); - unsigned i = unsigned(&w - worker_list); - __TBB_ASSERT( i<n, NULL ); - - // Start my children - if( 2*i+1<n ) { - // Have a left child, so start it. - worker_list[2*i+1].start_one_worker_thread(); - if( 2*i+2<n ) { - // Have a right child, so start it. - worker_list[2*i+2].start_one_worker_thread(); - } - } - - GenericScheduler* s = GenericScheduler::create_worker(*w.arena,i); - - // Attempt to publish worker - ITT_NOTIFY(sync_releasing, &w.scheduler); - // Note: really need only release fence on the compare-and-swap. - if( __TBB_CompareAndSwapW( &w.scheduler, (intptr)s, intptr(0) )==-1 ) { - // Master thread has already commenced terminate_workers() and not waited for us to respond. - // Thus we are responsible for cleaning up ourselves. - s->dummy_task->prefix().ref_count = 0; - // Do not register scheduler in thread local storage, because the storage may be gone. - } else { - __TBB_ASSERT( w.scheduler==s, NULL ); - Governor::sign_on(s); - } - return s; -} - -GenericScheduler* GenericScheduler::create_master( Arena* arena ) { - GenericScheduler* s = GenericScheduler::allocate_scheduler( arena ); - task& t = *s->dummy_task; - s->innermost_running_task = &t; - t.prefix().ref_count = 1; - Governor::sign_on(s); -#if __TBB_EXCEPTIONS - // Context to be used by root tasks by default (if the user has not specified one). - // Allocation is done by NFS allocator because we cannot reuse memory allocated - // for task objects since the free list is empty at the moment. - t.prefix().context = new ( NFS_Allocate(sizeof(task_group_context), 1, NULL) ) task_group_context(task_group_context::isolated); - scheduler_list_node_t &node = s->my_node; - { - mutex::scoped_lock lock(the_scheduler_list_mutex); - node.my_next = the_scheduler_list_head.my_next; - node.my_prev = &the_scheduler_list_head; - the_scheduler_list_head.my_next->my_prev = &node; - the_scheduler_list_head.my_next = &node; - -#if __TBB_TASK_DEQUE - unsigned last = arena->prefix().number_of_slots; - // This slot index assignment is just a hint to ... - if ( arena->prefix().limit < last ) { - // ... to prevent competition between the first few masters. - s->arena_index = arena->prefix().limit++; - } - else { - // ... to minimize the probability of competition between multiple masters. - unsigned first = arena->prefix().number_of_workers; - s->arena_index = first + s->random.get() % (last - first); - } -#endif /* __TBB_TASK_DEQUE */ - } -#if __TBB_TASK_DEQUE - s->init_stack_info(); -#endif /* __TBB_TASK_DEQUE */ - - // Sync up the local cancellation state with the global one. No need for fence here. - s->local_cancel_count = global_cancel_count; -#endif /* __TBB_EXCEPTIONS */ - __TBB_ASSERT( &task::self()==&t, NULL ); -#if __TBB_SCHEDULER_OBSERVER - // Process any existing observers. - s->notify_entry_observers(); -#endif /* __TBB_SCHEDULER_OBSERVER */ - return s; -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Suppress warning about volatile variable sink_for_alloca being defined but not used. - #pragma warning (push) - #pragma warning (disable: 4189) -#endif - -thread_routine_return_type __TBB_THREAD_ROUTINE GenericScheduler::worker_routine( void* arg ) -{ - ITT_THREAD_SET_NAME(_T("TBB Worker Thread")); - - GenericScheduler& scheduler = *create_worker_heap(*(WorkerDescriptor*)arg); - - if( scheduler.dummy_task->prefix().ref_count==0 ) { - // No sense to start anything because shutdown has been requested - cleanup_worker(&scheduler); - return thread_routine_return_type(0); - } - -#if USE_PTHREAD - pthread_cleanup_push( cleanup_worker, &scheduler ); -#else /* USE_WINTHREAD */ - class raii_finalizer : internal::no_copy { - GenericScheduler& scheduler; - public: - explicit raii_finalizer(GenericScheduler& sch) : scheduler(sch) {} - ~raii_finalizer() { cleanup_worker(&scheduler); } - } finalizer(scheduler); -#endif - -#if (_WIN32||_WIN64)&&!__TBB_ipf - // Deal with 64K aliasing. The formula for "offset" is a Fibonacci hash function, - // which has the desirable feature of spreading out the offsets fairly evenly - // without knowing the total number of offsets, and furthermore unlikely to - // accidentally cancel out other 64K aliasing schemes that Microsoft might implement later. - // See Knuth Vol 3. "Theorem S" for details on Fibonacci hashing. -#if __TBB_TASK_DEQUE - size_t offset = (scheduler.arena_index + 1) * 40503U % (1U << 16); -#else /* !__TBB_TASK_DEQUE */ - size_t offset = (scheduler.dummy_slot.task_pool->prefix().arena_index+1) * 40503U % (1U<<16); -#endif /* !__TBB_TASK_DEQUE */ - // The following statement is really does need "volatile", otherwise the compiler might remove the _alloca. - void* volatile sink_for_alloca = _alloca(offset); -#else - // Linux thread allocators avoid 64K aliasing. -#endif /* _WIN32||_WIN64 */ - - scheduler.wait_for_all(*scheduler.dummy_task,NULL); - -#if USE_PTHREAD - pthread_cleanup_pop( true ); -#endif - return thread_routine_return_type(0); -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif // warning 4189 is back - -void GenericScheduler::cleanup_worker( void* arg ) { - TBB_TRACE(("%p.cleanup_worker entered\n",arg)); - GenericScheduler& s = *(GenericScheduler*)arg; - __TBB_ASSERT( s.dummy_slot.task_pool, "cleaning up worker with missing task pool" ); -#if __TBB_SCHEDULER_OBSERVER - s.notify_exit_observers(/*is_worker=*/true); -#endif /* __TBB_SCHEDULER_OBSERVER */ - Arena* a = s.arena; -#if !__TBB_TASK_DEQUE - __TBB_ASSERT( s.arena_slot!=&s.dummy_slot, "worker not in arena?" ); -#endif /* !__TBB_TASK_DEQUE */ - s.free_scheduler(); - a->remove_gc_reference(); -} - -void GenericScheduler::cleanup_master() { - TBB_TRACE(("%p.cleanup_master entered\n",this)); - GenericScheduler& s = *this; // for similarity with cleanup_worker - __TBB_ASSERT( s.dummy_slot.task_pool, "cleaning up master with missing task pool" ); -#if __TBB_SCHEDULER_OBSERVER - s.notify_exit_observers(/*is_worker=*/false); -#endif /* __TBB_SCHEDULER_OBSERVER */ - s.free_scheduler(); - Governor::finish_with_arena(); -} - -//------------------------------------------------------------------------ -// WorkerDescriptor -//------------------------------------------------------------------------ -void WorkerDescriptor::start_one_worker_thread() { -// Worker threads are detached right after creation. They must take care of own cleanup. -#if USE_WINTHREAD - unsigned thread_id; - unsigned stack_size = (unsigned)arena->prefix().stack_size; - __TBB_ASSERT( stack_size == arena->prefix().stack_size, "Requested stack size is too large for Windows" ); - // The return type of _beginthreadex is "uintptr_t" on new MS compilers, - // and 'unsigned long' on old MS compilers. Our uintptr works for both. - uintptr status = _beginthreadex( NULL, stack_size, GenericScheduler::worker_routine, this, 0, &thread_id ); - if( status==0 ) - handle_perror(errno,"__beginthreadex"); - else - CloseHandle((HANDLE)status); // detach -#else /* USE_PTHREAD */ - int status; - pthread_attr_t stack_size; - status = pthread_attr_init( &stack_size ); - if( status ) - handle_perror( status, "pthread_attr_init" ); - __TBB_ASSERT( arena->prefix().stack_size > 0, "No default worker stack size set" ); - status = pthread_attr_setstacksize( &stack_size, arena->prefix().stack_size ); - if( status ) - handle_perror( status, "pthread_attr_setstacksize" ); - pthread_t handle; - // This if is due to an Intel Compiler Bug, tracker # C70996 - // This #if should be removed as soon as the bug is fixed -#if __APPLE__ && __TBB_x86_64 - static void *(*r)(void*) = GenericScheduler::worker_routine; - status = pthread_create( &handle, &stack_size, r, this ); -#else - status = pthread_create( &handle, &stack_size, GenericScheduler::worker_routine, this ); -#endif - if( status ) - handle_perror( status, "pthread_create" ); - status = pthread_detach( handle ); - if( status ) - handle_perror( status, "pthread_detach" ); -#endif /* USE_WINTHREAD */ -} - -//------------------------------------------------------------------------ -// Methods of allocate_root_proxy -//------------------------------------------------------------------------ -task& allocate_root_proxy::allocate( size_t size ) { -#if __TBB_TASK_SCHEDULER_AUTO_INIT - internal::GenericScheduler* v = Governor::local_scheduler_with_auto_init(); -#else - internal::GenericScheduler* v = Governor::local_scheduler(); -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - __TBB_ASSERT( v, "thread did not activate a task_scheduler_init object?" ); - task_prefix& p = v->innermost_running_task->prefix(); - // New root task becomes part of the currently running task's cancellation context - return v->allocate_task( size, __TBB_ALLOC_TASK_ARGS(NULL, p.depth+1, p.context) ); -} - -void allocate_root_proxy::free( task& task ) { - internal::GenericScheduler* v = Governor::local_scheduler(); - __TBB_ASSERT( v, "thread does not have initialized task_scheduler_init object?" ); -#if __TBB_EXCEPTIONS - // No need to do anything here as long as there is no context -> task connection -#endif /* __TBB_EXCEPTIONS */ - v->free_task<GenericScheduler::is_local>( task ); -} - -#if __TBB_EXCEPTIONS -//------------------------------------------------------------------------ -// Methods of allocate_root_with_context_proxy -//------------------------------------------------------------------------ -task& allocate_root_with_context_proxy::allocate( size_t size ) const { - internal::GenericScheduler* v = Governor::local_scheduler(); - __TBB_ASSERT( v, "thread did not activate a task_scheduler_init object?" ); - task_prefix& p = v->innermost_running_task->prefix(); - task& t = v->allocate_task( size, __TBB_ALLOC_TASK_ARGS(NULL, p.depth+1, &my_context) ); - // The supported usage model prohibits concurrent initial binding. Thus we - // do not need interlocked operations or fences here. - if ( my_context.my_kind == task_group_context::binding_required ) { - __TBB_ASSERT ( my_context.my_owner, "Context without owner" ); - __TBB_ASSERT ( !my_context.my_parent, "Parent context set before initial binding" ); - // If we are in the innermost task dispatch loop of a master thread, then - // there is nothing to bind this context to, and we skip the binding part. - if ( v->innermost_running_task != v->dummy_task ) { - // By not using the fence here we get faster code in case of normal execution - // flow in exchange of a bit higher probability that in cases when cancellation - // is in flight we will take deeper traversal branch. Normally cache coherency - // mechanisms are efficient enough to deliver updated value most of the time. - uintptr_t local_count_snapshot = ((GenericScheduler*)my_context.my_owner)->local_cancel_count; - __TBB_store_with_release(my_context.my_parent, p.context); - uintptr_t global_count_snapshot = __TBB_load_with_acquire(global_cancel_count); - if ( !my_context.my_cancellation_requested ) { - if ( local_count_snapshot == global_count_snapshot ) { - // It is possible that there is active cancellation request in our - // parents chain. Fortunately the equality of the local and global - // counters means that if this is the case it's already been propagated - // to our parent. - my_context.my_cancellation_requested = p.context->my_cancellation_requested; - } else { - // Another thread was propagating cancellation request at the moment - // when we set our parent, but since we do not use locks we could've - // been skipped. So we have to make sure that we get the cancellation - // request if one of our ancestors has been canceled. - my_context.propagate_cancellation_from_ancestors(); - } - } - } - my_context.my_kind = task_group_context::binding_completed; - } - // else the context either has already been associated with its parent or is isolated - return t; -} - -void allocate_root_with_context_proxy::free( task& task ) const { - internal::GenericScheduler* v = Governor::local_scheduler(); - __TBB_ASSERT( v, "thread does not have initialized task_scheduler_init object?" ); - // No need to do anything here as long as unbinding is performed by context destructor only. - v->free_task<GenericScheduler::is_local>( task ); -} -#endif /* __TBB_EXCEPTIONS */ - -//------------------------------------------------------------------------ -// Methods of allocate_continuation_proxy -//------------------------------------------------------------------------ -task& allocate_continuation_proxy::allocate( size_t size ) const { - task& t = *((task*)this); - __TBB_ASSERT( AssertOkay(t), NULL ); - GenericScheduler* v = static_cast<GenericScheduler*>(t.prefix().owner); - __TBB_ASSERT( Governor::local_scheduler()==v, "thread does not own this" ); - task* parent = t.parent(); - t.prefix().parent = NULL; - return v->allocate_task( size, __TBB_ALLOC_TASK_ARGS(parent, t.prefix().depth, t.prefix().context) ); -} - -void allocate_continuation_proxy::free( task& mytask ) const { - task& t = *((task*)this); - // Restore the parent as it was before the corresponding allocate was called. - t.prefix().parent = mytask.parent(); - static_cast<GenericScheduler*>(t.prefix().owner)->free_task<GenericScheduler::is_local>(mytask); -} - -//------------------------------------------------------------------------ -// Methods of allocate_child_proxy -//------------------------------------------------------------------------ -task& allocate_child_proxy::allocate( size_t size ) const { - task& t = *((task*)this); - __TBB_ASSERT( AssertOkay(t), NULL ); - GenericScheduler* v = static_cast<GenericScheduler*>(t.prefix().owner); - __TBB_ASSERT( Governor::local_scheduler()==v, "thread does not own parent" ); - return v->allocate_task( size, __TBB_ALLOC_TASK_ARGS(&t, t.prefix().depth+1, t.prefix().context) ); -} - -void allocate_child_proxy::free( task& mytask ) const { - task& t = *((task*)this); - GenericScheduler* v = static_cast<GenericScheduler*>(t.prefix().owner); - v->free_task<GenericScheduler::is_local>(mytask); -} - -//------------------------------------------------------------------------ -// Methods of allocate_additional_child_of_proxy -//------------------------------------------------------------------------ -task& allocate_additional_child_of_proxy::allocate( size_t size ) const { - __TBB_ASSERT( AssertOkay(self), NULL ); - __TBB_FetchAndIncrementWacquire( &parent.prefix().ref_count ); - GenericScheduler* v = static_cast<GenericScheduler*>(self.prefix().owner); - return v->allocate_task( size, __TBB_ALLOC_TASK_ARGS(&parent, parent.prefix().depth+1, parent.prefix().context) ); -} - -void allocate_additional_child_of_proxy::free( task& task ) const { - // Undo the increment. We do not check the result of the fetch-and-decrement. - // We could consider be spawning the task if the fetch-and-decrement returns 1. - // But we do not know that was the programmer's intention. - // Furthermore, if it was the programmer's intention, the program has a fundamental - // race condition (that we warn about in Reference manual), because the - // reference count might have become zero before the corresponding call to - // allocate_additional_child_of_proxy::allocate. - __TBB_FetchAndDecrementWrelease( &parent.prefix().ref_count ); - GenericScheduler* v = static_cast<GenericScheduler*>(self.prefix().owner); - - v->free_task<GenericScheduler::is_local>(task); -} - -//------------------------------------------------------------------------ -// Support for auto_partitioner -//------------------------------------------------------------------------ -size_t get_initial_auto_partitioner_divisor() { - const size_t X_FACTOR = 4; - return X_FACTOR * (Governor::number_of_workers_in_arena()+1); -} - -//------------------------------------------------------------------------ -// Methods of affinity_partitioner_base_v3 -//------------------------------------------------------------------------ -void affinity_partitioner_base_v3::resize( unsigned factor ) { - // Check factor to avoid asking for number of workers while there might be no arena. - size_t new_size = factor ? factor*(Governor::number_of_workers_in_arena()+1) : 0; - if( new_size!=my_size ) { - if( my_array ) { - NFS_Free( my_array ); - // Following two assignments must be done here for sake of exception safety. - my_array = NULL; - my_size = 0; - } - if( new_size ) { - my_array = static_cast<affinity_id*>(NFS_Allocate(new_size,sizeof(affinity_id), NULL )); - memset( my_array, 0, sizeof(affinity_id)*new_size ); - my_size = new_size; - } - } -} - -} // namespace internal - -using namespace tbb::internal; - -#if __TBB_EXCEPTIONS - -//------------------------------------------------------------------------ -// captured_exception -//------------------------------------------------------------------------ - -inline -void copy_string ( char*& dst, const char* src ) { - if ( src ) { - size_t len = strlen(src) + 1; - dst = (char*)allocate_via_handler_v3(len); - strncpy (dst, src, len); - } - else - dst = NULL; -} - -void captured_exception::set ( const char* name, const char* info ) throw() -{ - copy_string(const_cast<char*&>(my_exception_name), name); - copy_string(const_cast<char*&>(my_exception_info), info); -} - -void captured_exception::clear () throw() { - deallocate_via_handler_v3 (const_cast<char*>(my_exception_name)); - deallocate_via_handler_v3 (const_cast<char*>(my_exception_info)); -} - -captured_exception* captured_exception::move () throw() { - captured_exception *e = (captured_exception*)allocate_via_handler_v3(sizeof(captured_exception)); - if ( e ) { - new (e) captured_exception(); - e->my_exception_name = my_exception_name; - e->my_exception_info = my_exception_info; - e->my_dynamic = true; - my_exception_name = my_exception_info = NULL; - } - return e; -} - -void captured_exception::destroy () throw() { - __TBB_ASSERT ( my_dynamic, "Method destroy can be used only on objects created by clone or allocate" ); - if ( my_dynamic ) { - this->captured_exception::~captured_exception(); - deallocate_via_handler_v3 (this); - } -} - -captured_exception* captured_exception::allocate ( const char* name, const char* info ) -{ - captured_exception *e = (captured_exception*)allocate_via_handler_v3(sizeof(captured_exception)); - if ( e ) { - new (e) captured_exception(name, info); - e->my_dynamic = true; - } - return e; -} - -const char* captured_exception::name() const throw() { - return my_exception_name; -} - -const char* captured_exception::what() const throw() { - return my_exception_info; -} - -//------------------------------------------------------------------------ -// task_group_context -//------------------------------------------------------------------------ - -task_group_context::~task_group_context () { - if ( my_kind != isolated ) { - __TBB_ASSERT ( Governor::local_scheduler() == my_owner, "Task group context is destructed by wrong thread" ); - GenericScheduler *s = (GenericScheduler*)my_owner; - my_node.my_next->my_prev = my_node.my_prev; - // By not using the fence here we get faster code in case of normal execution - // flow in exchange for a bit higher probability that in cases when cancellation - // is in flight we will take the branch containing the lock. Normally cache - // coherency mechanisms are efficient enough to deliver updated value most - // of the time. - uintptr_t local_count_snapshot = s->local_cancel_count; - __TBB_store_with_release( my_node.my_prev->my_next, my_node.my_next ); - if ( local_count_snapshot != __TBB_load_with_acquire(global_cancel_count) ) { - // Another thread was propagating cancellation request when we removed - // ourselves from the list. We must ensure that it does not access us - // when this destructor finishes. We'll be able to acquire the lock - // below only after the other thread finishes with us. - spin_mutex::scoped_lock lock(s->context_list_mutex); - } - } - if ( my_exception ) - my_exception->destroy(); -} - -void task_group_context::init () { - __TBB_ASSERT ( sizeof(task_group_context) == 2 * NFS_MaxLineSize, "Context class has wrong size - check padding and members alignment" ); - __TBB_ASSERT ( (uintptr_t(this) & (sizeof(my_cancellation_requested) - 1)) == 0, "Context is improperly aligned" ); - __TBB_ASSERT ( my_kind == isolated || my_kind == bound, "Context can be created only as isolated or bound" ); - my_parent = NULL; - my_cancellation_requested = 0; - my_exception = NULL; - if ( my_kind == bound ) { -#if __TBB_TASK_SCHEDULER_AUTO_INIT - GenericScheduler *s = Governor::local_scheduler_with_auto_init(); -#else - GenericScheduler *s = Governor::local_scheduler(); -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - my_owner = s; - __TBB_ASSERT ( my_owner, "Thread has not activated a task_scheduler_init object?" ); - // Backward links are used by this thread only, thus no fences are necessary - my_node.my_prev = &s->context_list_head; - s->context_list_head.my_next->my_prev = &my_node; - // The only operation on the thread local list of contexts that may be performed - // concurrently is its traversal by another thread while propagating cancellation - // request. Therefore the release fence below is necessary to ensure that the new - // value of my_node.my_next is visible to the traversing thread - // after it reads new value of v->context_list_head.my_next. - my_node.my_next = s->context_list_head.my_next; - __TBB_store_with_release(s->context_list_head.my_next, &my_node); - } -} - -bool task_group_context::cancel_group_execution () { - __TBB_ASSERT ( my_cancellation_requested == 0 || my_cancellation_requested == 1, "Invalid cancellation state"); - if ( my_cancellation_requested || __TBB_CompareAndSwapW(&my_cancellation_requested, 1, 0) ) { - // This task group has already been canceled - return false; - } - Governor::local_scheduler()->propagate_cancellation(this); - return true; -} - -bool task_group_context::is_group_execution_cancelled () const { - return __TBB_load_with_acquire(my_cancellation_requested) != 0; -} - -// IMPORTANT: It is assumed that this method is not used concurrently! -void task_group_context::reset () { - //! \todo Add assertion that this context does not have children - // No fences are necessary since this context can be accessed from another thread - // only after stealing happened (which means necessary fences were used). - if ( my_exception ) { - my_exception->destroy(); - my_exception = NULL; - } - my_cancellation_requested = 0; -} - -void task_group_context::propagate_cancellation_from_ancestors () { - task_group_context *parent = my_parent; - while ( parent && !parent->my_cancellation_requested ) - parent = parent->my_parent; - if ( parent ) { - // One of our ancestor groups was canceled. Cancel all its descendants. - task_group_context *ctx = this; - do { - __TBB_store_with_release(ctx->my_cancellation_requested, 1); - ctx = ctx->my_parent; - } while ( ctx != parent ); - } -} - -#endif /* __TBB_EXCEPTIONS */ - -//------------------------------------------------------------------------ -// task -//------------------------------------------------------------------------ - -void task::internal_set_ref_count( int count ) { - __TBB_ASSERT( count>0, "count must be positive" ); - __TBB_ASSERT( !(prefix().extra_state&GenericScheduler::es_ref_count_active), "ref_count race detected" ); - ITT_NOTIFY(sync_releasing, &prefix().ref_count); - prefix().ref_count = count; -} - -task& task::self() { -#if __TBB_TASK_SCHEDULER_AUTO_INIT - GenericScheduler *v = Governor::local_scheduler_with_auto_init(); -#else - GenericScheduler *v = Governor::local_scheduler(); -#endif /* __TBB_TASK_SCHEDULER_AUTO_INIT */ - __TBB_ASSERT( v->assert_okay(), NULL ); - __TBB_ASSERT( v->innermost_running_task, NULL ); - return *v->innermost_running_task; -} - -bool task::is_owned_by_current_thread() const { - return Governor::local_scheduler()==prefix().owner; -} - -void task::destroy( task& victim ) { - __TBB_ASSERT( is_owned_by_current_thread(), "task-destroyer is not owned by the current thread" ); - __TBB_ASSERT( victim.prefix().ref_count==0, "victim must have reference count of zero" ); - __TBB_ASSERT( victim.state()==task::allocated, "illegal state for victim task" ); - task* parent = victim.parent(); - victim.~task(); - if( parent ) { - __TBB_ASSERT( parent->state()==task::allocated, "attempt to destroy child of running or corrupted parent?" ); - ITT_NOTIFY(sync_releasing, &parent->prefix().ref_count); - __TBB_FetchAndDecrementWrelease(&parent->prefix().ref_count); - ITT_NOTIFY(sync_acquired, &parent->prefix().ref_count); - } - internal::GenericScheduler* v = static_cast<internal::GenericScheduler*>(prefix().owner); - v->free_task<GenericScheduler::no_hint>( victim ); -} - -void task::spawn_and_wait_for_all( task_list& list ) { - __TBB_ASSERT( is_owned_by_current_thread(), "'this' not owned by current thread" ); - task* t = list.first; - if( t ) { - if( &t->prefix().next!=list.next_ptr ) - prefix().owner->spawn( *t->prefix().next, *list.next_ptr ); - list.clear(); - } - prefix().owner->wait_for_all( *this, t ); -} - -/** Defined out of line so that compiler does not replicate task's vtable. - It's pointless to define it inline anyway, because all call sites to it are virtual calls - that the compiler is unlikely to optimize. */ -void task::note_affinity( affinity_id ) { -} - -//------------------------------------------------------------------------ -// task_scheduler_init -//------------------------------------------------------------------------ - -void task_scheduler_init::initialize( int number_of_threads ) { - initialize( number_of_threads, 0 ); -} - -void task_scheduler_init::initialize( int number_of_threads, stack_size_type thread_stack_size ) { - if( number_of_threads!=deferred ) { - __TBB_ASSERT( !my_scheduler, "task_scheduler_init already initialized" ); - __TBB_ASSERT( number_of_threads==-1 || number_of_threads>=1, - "number_of_threads for task_scheduler_init must be -1 or positive" ); - // Double-check - if( !__TBB_InitOnce::initialization_done() ) { - DoOneTimeInitializations(); - } - GenericScheduler* s = Governor::local_scheduler(); - if( s ) { - s->ref_count += 1; - } else { - Arena* a = Governor::obtain_arena(number_of_threads,thread_stack_size); - s = GenericScheduler::create_master( a ); - } - my_scheduler = s; - } else { - __TBB_ASSERT( !thread_stack_size, "deferred initialization ignores stack size setting" ); - } -} - -void task_scheduler_init::terminate() { - TBB_TRACE(("task_scheduler_init::terminate(): this=%p\n", this)); - GenericScheduler* s = static_cast<GenericScheduler*>(my_scheduler); - my_scheduler = NULL; - __TBB_ASSERT( s, "task_scheduler_init::terminate without corresponding task_scheduler_init::initialize()"); - if( !--(s->ref_count) ) - s->cleanup_master(); -} - -int task_scheduler_init::default_num_threads() { - // No memory fence required, because at worst each invoking thread calls NumberOfHardwareThreads. - int n = DefaultNumberOfThreads; - if( !n ) { - DefaultNumberOfThreads = n = DetectNumberOfWorkers(); - } - return n; -} - -#if __TBB_SCHEDULER_OBSERVER -//------------------------------------------------------------------------ -// Methods of observer_proxy -//------------------------------------------------------------------------ -namespace internal { - -#if TBB_USE_ASSERT -static atomic<int> observer_proxy_count; - -struct check_observer_proxy_count { - ~check_observer_proxy_count() { - if( observer_proxy_count!=0 ) { - fprintf(stderr,"warning: leaked %ld observer_proxy objects\n", long(observer_proxy_count)); - } - } -}; - -static check_observer_proxy_count the_check_observer_proxy_count; -#endif /* TBB_USE_ASSERT */ - -observer_proxy::observer_proxy( task_scheduler_observer_v3& tso ) : next(NULL), observer(&tso) { -#if TBB_USE_ASSERT - ++observer_proxy_count; -#endif /* TBB_USE_ASSERT */ - // 1 for observer - gc_ref_count = 1; - { - // Append to the global list - task_scheduler_observer_mutex_scoped_lock lock(the_task_scheduler_observer_mutex.begin()[0],/*is_writer=*/true); - observer_proxy* p = global_last_observer_proxy; - prev = p; - if( p ) - p->next=this; - else - global_first_observer_proxy = this; - global_last_observer_proxy = this; - } -} - -void observer_proxy::remove_from_list() { - // Take myself off the global list. - if( next ) - next->prev = prev; - else - global_last_observer_proxy = prev; - if( prev ) - prev->next = next; - else - global_first_observer_proxy = next; -#if TBB_USE_ASSERT - poison_pointer(prev); - poison_pointer(next); - gc_ref_count = -666; -#endif /* TBB_USE_ASSERT */ -} - -void observer_proxy::remove_ref_slow() { - int r = gc_ref_count; - while(r>1) { - __TBB_ASSERT( r!=0, NULL ); - int r_old = gc_ref_count.compare_and_swap(r-1,r); - if( r_old==r ) { - // Successfully decremented count. - return; - } - r = r_old; - } - __TBB_ASSERT( r==1, NULL ); - // Reference count might go to zero - { - task_scheduler_observer_mutex_scoped_lock lock(the_task_scheduler_observer_mutex.begin()[0],/*is_writer=*/true); - r = --gc_ref_count; - if( !r ) { - remove_from_list(); - } - } - if( !r ) { - __TBB_ASSERT( gc_ref_count == -666, NULL ); -#if TBB_USE_ASSERT - --observer_proxy_count; -#endif /* TBB_USE_ASSERT */ - delete this; - } -} - -observer_proxy* observer_proxy::process_list( observer_proxy* local_last, bool is_worker, bool is_entry ) { - // Pointer p marches though the list. - // If is_entry, start with our previous list position, otherwise start at beginning of list. - observer_proxy* p = is_entry ? local_last : NULL; - for(;;) { - task_scheduler_observer* tso=NULL; - // Hold lock on list only long enough to advance to next proxy in list. - { - task_scheduler_observer_mutex_scoped_lock lock(the_task_scheduler_observer_mutex.begin()[0],/*is_writer=*/false); - do { - if( local_last && local_last->observer ) { - // 2 = 1 for observer and 1 for local_last - __TBB_ASSERT( local_last->gc_ref_count>=2, NULL ); - // Can decrement count quickly, because it cannot become zero here. - --local_last->gc_ref_count; - local_last = NULL; - } else { - // Use slow form of decrementing the reference count, after lock is released. - } - if( p ) { - // We were already processing the list. - if( observer_proxy* q = p->next ) { - // Step to next item in list. - p=q; - } else { - // At end of list. - if( is_entry ) { - // Remember current position in the list, so we can start at on the next call. - ++p->gc_ref_count; - } else { - // Finishin running off the end of the list - p=NULL; - } - goto done; - } - } else { - // Starting pass through the list - p = global_first_observer_proxy; - if( !p ) - goto done; - } - tso = p->observer; - } while( !tso ); - ++p->gc_ref_count; - ++tso->my_busy_count; - } - __TBB_ASSERT( !local_last || p!=local_last, NULL ); - if( local_last ) - local_last->remove_ref_slow(); - // Do not hold any locks on the list while calling user's code. - try { - if( is_entry ) - tso->on_scheduler_entry( is_worker ); - else - tso->on_scheduler_exit( is_worker ); - } catch(...) { - // Suppress exception, because user routines are supposed to be observing, not changing - // behavior of a master or worker thread. -#if TBB_USE_ASSERT - fprintf(stderr,"warning: %s threw exception\n",is_entry?"on_scheduler_entry":"on_scheduler_exit"); -#endif /* __TBB_USE_ASSERT */ - } - intptr bc = --tso->my_busy_count; - __TBB_ASSERT_EX( bc>=0, "my_busy_count underflowed" ); - local_last = p; - } -done: - // Return new value to be used as local_last next time. - if( local_last ) - local_last->remove_ref_slow(); - __TBB_ASSERT( !p || is_entry, NULL ); - return p; -} - -void task_scheduler_observer_v3::observe( bool state ) { - if( state ) { - if( !my_proxy ) { - if( !__TBB_InitOnce::initialization_done() ) - DoOneTimeInitializations(); - my_busy_count = 0; - my_proxy = new observer_proxy(*this); - if( GenericScheduler* s = Governor::local_scheduler() ) { - // Notify newly created observer of its own thread. - // Any other pending observers are notified too. - s->notify_entry_observers(); - } - } - } else { - if( observer_proxy* proxy = my_proxy ) { - my_proxy = NULL; - __TBB_ASSERT( proxy->gc_ref_count>=1, "reference for observer missing" ); - { - task_scheduler_observer_mutex_scoped_lock lock(the_task_scheduler_observer_mutex.begin()[0],/*is_writer=*/true); - proxy->observer = NULL; - } - proxy->remove_ref_slow(); - while( my_busy_count ) { - __TBB_Yield(); - } - } - } -} - -} // namespace internal -#endif /* __TBB_SCHEDULER_OBSERVER */ - -} // namespace tbb - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_assert_impl.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_assert_impl.h deleted file mode 100644 index cfbded6c17..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_assert_impl.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// IMPORTANT: To use assertion handling in TBB, exactly one of the TBB source files -// should #include tbb_assert_impl.h thus instantiating assertion handling routines. -// The intent of putting it to a separate file is to allow some tests to use it -// as well in order to avoid dependency on the library. - -// include headers for required function declarations -#include <cstdlib> -#include <stdio.h> -#include <string.h> -#include <stdarg.h> -#if _WIN32||_WIN64 -#include <crtdbg.h> -#endif - -#if _MSC_VER >= 1400 -#define __TBB_EXPORTED_FUNC __cdecl -#else -#define __TBB_EXPORTED_FUNC -#endif - -using namespace std; - -namespace tbb { - //! Type for an assertion handler - typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment ); - - static assertion_handler_type assertion_handler; - - assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler ) { - assertion_handler_type old_handler = assertion_handler; - assertion_handler = new_handler; - return old_handler; - } - - void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment ) { - if( assertion_handler_type a = assertion_handler ) { - (*a)(filename,line,expression,comment); - } else { - static bool already_failed; - if( !already_failed ) { - already_failed = true; - fprintf( stderr, "Assertion %s failed on line %d of file %s\n", - expression, line, filename ); - if( comment ) - fprintf( stderr, "Detailed description: %s\n", comment ); -#if (_WIN32||_WIN64) && defined(_DEBUG) - if(1 == _CrtDbgReport(_CRT_ASSERT, filename, line, "tbb_debug.dll", "%s\r\n%s", expression, comment?comment:"")) - _CrtDbgBreak(); -#else - abort(); -#endif - } - } - } - -#if defined(_MSC_VER)&&_MSC_VER<1400 -# define vsnprintf _vsnprintf -#endif - - namespace internal { - //! Report a runtime warning. - void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... ) - { - char str[1024]; memset(str, 0, 1024); - va_list args; va_start(args, format); - vsnprintf( str, 1024-1, format, args); - fprintf( stderr, "TBB Warning: %s\n", str); - } - } // namespace internal - -} /* namespace tbb */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.cpp deleted file mode 100644 index 0d5763bb69..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Source file for miscellaneous entities that are infrequently referenced by -// an executing program. - -#include "tbb/tbb_stddef.h" -// Out-of-line TBB assertion handling routines are instantiated here. -#include "tbb_assert_impl.h" - -#include "tbb_misc.h" -#include <cstdio> -#include <cstdlib> -#include <cstring> -#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__SUNPRO_CC) - #include <string> // std::string is used to construct runtime_error - #include <stdexcept> -#endif - -using namespace std; - -#include "tbb/tbb_machine.h" - -namespace tbb { - -namespace internal { - -#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__SUNPRO_CC) -// The above preprocessor symbols are defined by compilers when exception handling is enabled. -// However, in some cases it could be disabled for this file. - -void handle_perror( int error_code, const char* what ) { - char buf[128]; - sprintf(buf,"%s: ",what); - char* end = strchr(buf,0); - size_t n = buf+sizeof(buf)-end; - strncpy( end, strerror( error_code ), n ); - // Ensure that buffer ends in terminator. - buf[sizeof(buf)-1] = 0; - throw runtime_error(buf); -} -#endif //__EXCEPTIONS || _CPPUNWIND - -bool GetBoolEnvironmentVariable( const char * name ) { - if( const char* s = getenv(name) ) - return strcmp(s,"0") != 0; - return false; -} - -#include "tbb_version.h" - -/** The leading "\0" is here so that applying "strings" to the binary delivers a clean result. */ -static const char VersionString[] = "\0" TBB_VERSION_STRINGS; - -static bool PrintVersionFlag = false; - -void PrintVersion() { - PrintVersionFlag = true; - fputs(VersionString+1,stderr); -} - -void PrintExtraVersionInfo( const char* category, const char* description ) { - if( PrintVersionFlag ) - fprintf(stderr, "%s: %s\t%s\n", "TBB", category, description ); -} - -} // namespace internal - -extern "C" int TBB_runtime_interface_version() { - return TBB_INTERFACE_VERSION; -} - -} // namespace tbb - -#if __TBB_x86_32 - -#include "tbb/atomic.h" - -//on Windows, int64_t defined in tbb::internal namespace only -#if _WIN32||_WIN64 -using tbb::internal::int64_t; -#endif - -//! Warn about 8-byte store that crosses a cache line. -extern "C" void __TBB_machine_store8_slow_perf_warning( volatile void *ptr ) { - // Report run-time warning unless we have already recently reported warning for that address. - const unsigned n = 4; - static tbb::atomic<void*> cache[n]; - static tbb::atomic<unsigned> k; - for( unsigned i=0; i<n; ++i ) - if( ptr==cache[i] ) - goto done; - cache[(k++)%n] = const_cast<void*>(ptr); - tbb::internal::runtime_warning( "atomic store on misaligned 8-byte location %p is slow", ptr ); -done:; -} - -//! Handle 8-byte store that crosses a cache line. -extern "C" void __TBB_machine_store8_slow( volatile void *ptr, int64_t value ) { - for( tbb::internal::AtomicBackoff b;; b.pause() ) { - int64_t tmp = *(int64_t*)ptr; - if( __TBB_machine_cmpswp8(ptr,value,tmp)==tmp ) - break; - } -} - -#endif /* __TBB_x86_32 */ - -#if __TBB_ipf -extern "C" intptr_t __TBB_machine_lockbyte( volatile unsigned char& flag ) { - if ( !__TBB_TryLockByte(flag) ) { - tbb::internal::AtomicBackoff b; - do { - b.pause(); - } while ( !__TBB_TryLockByte(flag) ); - } - return 0; -} -#endif diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.h deleted file mode 100644 index a9d91a091b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_misc.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _TBB_tbb_misc_H -#define _TBB_tbb_misc_H - -#include "tbb/tbb_stddef.h" -#include "tbb/tbb_machine.h" - -#if _WIN32||_WIN64 -#include <windows.h> -#elif defined(__linux__) -#include <sys/sysinfo.h> -#elif defined(__sun) -#include <sys/sysinfo.h> -#include <unistd.h> -#elif defined(__APPLE__) -#include <sys/types.h> -#include <sys/sysctl.h> -#elif defined(__FreeBSD__) -#include <unistd.h> -#endif - -#if USE_PTHREAD -#include <pthread.h> -#endif /* USE_PTHREAD */ - -namespace tbb { - -namespace internal { - -#if defined(__TBB_DetectNumberOfWorkers) -static inline int DetectNumberOfWorkers() { - return __TBB_DetectNumberOfWorkers(); -} - -#else - -#if _WIN32||_WIN64 -static inline int DetectNumberOfWorkers() { - SYSTEM_INFO si; - GetSystemInfo(&si); - return static_cast<int>(si.dwNumberOfProcessors); -} - -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) -static inline int DetectNumberOfWorkers() { - long number_of_workers; - -#if (defined(__FreeBSD__) || defined(__sun)) && defined(_SC_NPROCESSORS_ONLN) - number_of_workers = sysconf(_SC_NPROCESSORS_ONLN); - -// In theory, sysconf should work everywhere. -// But in practice, system-specific methods are more reliable -#elif defined(__linux__) - number_of_workers = get_nprocs(); -#elif defined(__APPLE__) - int name[2] = {CTL_HW, HW_AVAILCPU}; - int ncpu; - size_t size = sizeof(ncpu); - sysctl( name, 2, &ncpu, &size, NULL, 0 ); - number_of_workers = ncpu; -#else -#error DetectNumberOfWorkers: Method to detect the number of online CPUs is unknown -#endif - -// Fail-safety strap - if ( number_of_workers < 1 ) { - number_of_workers = 1; - } - - return number_of_workers; -} - -#else -#error DetectNumberOfWorkers: OS detection method is unknown - -#endif /* os kind */ - -#endif - -// assertion_failure is declared in tbb/tbb_stddef.h because it user code -// needs to see its declaration. - -//! Throw std::runtime_error of form "(what): (strerror of error_code)" -/* The "what" should be fairly short, not more than about 64 characters. - Because we control all the call sites to handle_perror, it is pointless - to bullet-proof it for very long strings. - - Design note: ADR put this routine off to the side in tbb_misc.cpp instead of - Task.cpp because the throw generates a pathetic lot of code, and ADR wanted - this large chunk of code to be placed on a cold page. */ -void __TBB_EXPORTED_FUNC handle_perror( int error_code, const char* what ); - -//! True if environment variable with given name is set and not 0; otherwise false. -bool GetBoolEnvironmentVariable( const char * name ); - -//! Print TBB version information on stderr -void PrintVersion(); - -//! Print extra TBB version information on stderr -void PrintExtraVersionInfo( const char* category, const char* description ); - -//! Class that implements exponential backoff. -/** See implementation of SpinwaitWhileEq for an example. */ -class ExponentialBackoff { - //! Time delay, in units of "pause" instructions. - /** Should be equal to approximately the number of "pause" instructions - that take the same time as an context switch. */ - static const int LOOPS_BEFORE_YIELD = 0x10; - int count; -public: - ExponentialBackoff() : count(1) {} - - //! Pause for a while. - void pause() { - if( count<=LOOPS_BEFORE_YIELD ) { - __TBB_Pause(count); - // Pause twice as long the next time. - count*=2; - } else { - // Pause is so long that we might as well yield CPU to scheduler. - __TBB_Yield(); - } - } - void reset() { - count = 1; - } -}; - -//! Spin WHILE the value of the variable is equal to a given value -/** T and U should be comparable types. */ -template<typename T, typename U> -static inline void SpinwaitWhileEq( const volatile T& location, U value ) { - ExponentialBackoff backoff; - while( location==value ) { - backoff.pause(); - } -} - -//! Spin UNTIL the value of the variable is equal to a given value -/** T and U should be comparable types. */ -template<typename T, typename U> -static inline void SpinwaitUntilEq( const volatile T& location, const U value ) { - ExponentialBackoff backoff; - while( location!=value ) { - backoff.pause(); - } -} - -typedef void (*tls_dtor_t)(void*); - -//! Class to use native TLS support directly -template <typename T> -class tls { -#if USE_WINTHREAD - typedef DWORD tls_key_t; -public: - int create() { - tls_key_t tmp = TlsAlloc(); - if( tmp==TLS_OUT_OF_INDEXES ) - return TLS_OUT_OF_INDEXES; - my_key = tmp; - return 0; - } - int destroy() { TlsFree(my_key); my_key=0; return 0; } - void set( T value ) { TlsSetValue(my_key, (LPVOID)value); } - T get() { return (T)TlsGetValue(my_key); } -#else /* USE_PTHREAD */ - typedef pthread_key_t tls_key_t; -public: - int create( tls_dtor_t dtor = NULL ) { - return pthread_key_create(&my_key, dtor); - } - int destroy() { return pthread_key_delete(my_key); } - void set( T value ) { pthread_setspecific(my_key, (void*)value); } - T get() { return (T)pthread_getspecific(my_key); } -#endif -private: - tls_key_t my_key; -}; - -} // namespace internal - -} // namespace tbb - -#endif /* _TBB_tbb_misc_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_resource.rc b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_resource.rc deleted file mode 100644 index f82c8ce0a8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_resource.rc +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include <winresrc.h> -#define ENDL "\r\n" -#include "tbb_version.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -//#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// manifest integration -#ifdef TBB_MANIFEST -#include "winuser.h" -2 RT_MANIFEST tbbmanifest.exe.manifest -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION TBB_VERNUMBERS - PRODUCTVERSION TBB_VERNUMBERS - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "CompanyName", "Intel Corporation\0" - VALUE "FileDescription", "Threading Building Blocks library\0" - VALUE "FileVersion", TBB_VERSION "\0" -//what is it? VALUE "InternalName", "tbb\0" - VALUE "LegalCopyright", "Copyright (C) 2006\0" - VALUE "LegalTrademarks", "\0" -#ifndef TBB_USE_DEBUG - VALUE "OriginalFilename", "tbb.dll\0" -#else - VALUE "OriginalFilename", "tbb_debug.dll\0" -#endif - VALUE "ProductName", "Threading Building Blocks\0" - VALUE "ProductVersion", TBB_VERSION "\0" - VALUE "Comments", TBB_VERSION_STRINGS "\0" - VALUE "PrivateBuild", "\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -//#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_thread.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_thread.cpp deleted file mode 100644 index bb328e242e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_thread.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#if _WIN32||_WIN64 -#include <process.h> /* Need _beginthreadex from there */ -#include <stdexcept> /* Need std::runtime_error from there */ -#include <string> /* Need std::string from there */ -#endif // _WIN32||_WIN64 -#include "tbb_misc.h" // for handle_perror -#include "tbb/tbb_stddef.h" -#include "tbb/tbb_thread.h" -#include "tbb/tbb_allocator.h" -#include "tbb/task_scheduler_init.h" /* Need task_scheduler_init::default_num_threads() */ - -namespace tbb { - -namespace internal { - -//! Allocate a closure -void* allocate_closure_v3( size_t size ) -{ - return allocate_via_handler_v3( size ); -} - -//! Free a closure allocated by allocate_closure_v3 -void free_closure_v3( void *ptr ) -{ - deallocate_via_handler_v3( ptr ); -} - -#if _WIN32||_WIN64 -#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) -// The above preprocessor symbols are defined by compilers when exception handling is enabled. - -void handle_win_error( int error_code ) -{ - LPTSTR msg_buf; - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - error_code, - 0, - (LPTSTR) &msg_buf, - 0, NULL ); - const std::string msg_str(msg_buf); - LocalFree(msg_buf); - throw std::runtime_error(msg_str); -} -#endif //__EXCEPTIONS || _CPPUNWIND -#endif // _WIN32||_WIN64 - -void tbb_thread_v3::join() -{ - __TBB_ASSERT( joinable(), "thread should be joinable when join called" ); -#if _WIN32||_WIN64 - DWORD status = WaitForSingleObject( my_handle, INFINITE ); - if ( status == WAIT_FAILED ) - handle_win_error( GetLastError() ); - BOOL close_stat = CloseHandle( my_handle ); - if ( close_stat == 0 ) - handle_win_error( GetLastError() ); - my_thread_id = 0; -#else - int status = pthread_join( my_handle, NULL ); - if( status ) - handle_perror( status, "pthread_join" ); -#endif // _WIN32||_WIN64 - my_handle = 0; -} - -void tbb_thread_v3::detach() { - __TBB_ASSERT( joinable(), "only joinable thread can be detached" ); -#if _WIN32||_WIN64 - BOOL status = CloseHandle( my_handle ); - if ( status == 0 ) - handle_win_error( GetLastError() ); - my_thread_id = 0; -#else - int status = pthread_detach( my_handle ); - if( status ) - handle_perror( status, "pthread_detach" ); -#endif // _WIN32||_WIN64 - my_handle = 0; -} - -const size_t MB = 1<<20; -#if !defined(__TBB_WORDSIZE) -const size_t ThreadStackSize = 1*MB; -#elif __TBB_WORDSIZE<=4 -const size_t ThreadStackSize = 2*MB; -#else -const size_t ThreadStackSize = 4*MB; -#endif - -void tbb_thread_v3::internal_start( __TBB_NATIVE_THREAD_ROUTINE_PTR(start_routine), - void* closure ) { -#if _WIN32||_WIN64 - unsigned thread_id; - // The return type of _beginthreadex is "uintptr_t" on new MS compilers, - // and 'unsigned long' on old MS compilers. Our uintptr works for both. - uintptr status = _beginthreadex( NULL, ThreadStackSize, start_routine, - closure, 0, &thread_id ); - if( status==0 ) - handle_perror(errno,"__beginthreadex"); - else { - my_handle = (HANDLE)status; - my_thread_id = thread_id; - } -#else - pthread_t thread_handle; - int status; - pthread_attr_t stack_size; - status = pthread_attr_init( &stack_size ); - if( status ) - handle_perror( status, "pthread_attr_init" ); - status = pthread_attr_setstacksize( &stack_size, ThreadStackSize ); - if( status ) - handle_perror( status, "pthread_attr_setstacksize" ); - - status = pthread_create( &thread_handle, &stack_size, start_routine, closure ); - if( status ) - handle_perror( status, "pthread_create" ); - - my_handle = thread_handle; -#endif // _WIN32||_WIN64 -} - -unsigned tbb_thread_v3::hardware_concurrency() { - return task_scheduler_init::default_num_threads(); -} - -tbb_thread_v3::id thread_get_id_v3() { -#if _WIN32||_WIN64 - return tbb_thread_v3::id( GetCurrentThreadId() ); -#else - return tbb_thread_v3::id( pthread_self() ); -#endif // _WIN32||_WIN64 -} - -void move_v3( tbb_thread_v3& t1, tbb_thread_v3& t2 ) -{ - if (t1.joinable()) - t1.detach(); - t1.my_handle = t2.my_handle; - t2.my_handle = 0; -#if _WIN32||_WIN64 - t1.my_thread_id = t2.my_thread_id; - t2.my_thread_id = 0; -#endif // _WIN32||_WIN64 -} - -void thread_yield_v3() -{ - __TBB_Yield(); -} - -void thread_sleep_v3(const tick_count::interval_t &i) -{ -#if _WIN32||_WIN64 - tick_count t0 = tick_count::now(); - tick_count t1 = t0; - for(;;) { - double remainder = (i-(t1-t0)).seconds()*1e3; // milliseconds remaining to sleep - if( remainder<=0 ) break; - DWORD t = remainder>=INFINITE ? INFINITE-1 : DWORD(remainder); - Sleep( t ); - t1 = tick_count::now(); - } -#else - struct timespec req; - double sec = i.seconds(); - - req.tv_sec = static_cast<long>(sec); - req.tv_nsec = static_cast<long>( (sec - req.tv_sec)*1e9 ); - nanosleep(&req, NULL); -#endif // _WIN32||_WIN64 -} - -} // internal - -} // tbb diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_version.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_version.h deleted file mode 100644 index cd86de08e7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/tbb_version.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Please define version number in the file: -#include "tbb/tbb_stddef.h" - -// And don't touch anything below -#ifndef ENDL -#define ENDL "\n" -#endif -#include "version_string.tmp" - -#ifndef __TBB_VERSION_STRINGS -#pragma message("Warning: version_string.tmp isn't generated properly by version_info.sh script!") -// here is an example of macros value: -#define __TBB_VERSION_STRINGS \ -"TBB: BUILD_HOST\tUnknown\n" \ -"TBB: BUILD_ARCH\tUnknown\n" \ -"TBB: BUILD_OS\t\tUnknown\n" \ -"TBB: BUILD_CL\t\tUnknown\n" \ -"TBB: BUILD_COMPILER\tUnknown\n" \ -"TBB: BUILD_COMMAND\tUnknown\n" -#endif -#ifndef __TBB_DATETIME -#ifdef RC_INVOKED -#define __TBB_DATETIME "Unknown" -#else -#define __TBB_DATETIME __DATE__ __TIME__ -#endif -#endif - -#define __TBB_VERSION_NUMBER "TBB: VERSION\t\t" __TBB_STRING(TBB_VERSION_MAJOR.TBB_VERSION_MINOR) ENDL -#define __TBB_INTERFACE_VERSION_NUMBER "TBB: INTERFACE VERSION\t" __TBB_STRING(TBB_INTERFACE_VERSION) ENDL -#define __TBB_VERSION_DATETIME "TBB: BUILD_DATE\t\t" __TBB_DATETIME ENDL -#ifndef TBB_USE_DEBUG - #define __TBB_VERSION_USE_DEBUG "TBB: TBB_USE_DEBUG\tundefined" ENDL -#elif TBB_USE_DEBUG==0 - #define __TBB_VERSION_USE_DEBUG "TBB: TBB_USE_DEBUG\t0" ENDL -#elif TBB_USE_DEBUG==1 - #define __TBB_VERSION_USE_DEBUG "TBB: TBB_USE_DEBUG\t1" ENDL -#elif TBB_USE_DEBUG==2 - #define __TBB_VERSION_USE_DEBUG "TBB: TBB_USE_DEBUG\t2" ENDL -#else - #error Unexpected value for TBB_USE_DEBUG -#endif -#ifndef TBB_USE_ASSERT - #define __TBB_VERSION_USE_ASSERT "TBB: TBB_USE_ASSERT\tundefined" ENDL -#elif TBB_USE_ASSERT==0 - #define __TBB_VERSION_USE_ASSERT "TBB: TBB_USE_ASSERT\t0" ENDL -#elif TBB_USE_ASSERT==1 - #define __TBB_VERSION_USE_ASSERT "TBB: TBB_USE_ASSERT\t1" ENDL -#elif TBB_USE_ASSERT==2 - #define __TBB_VERSION_USE_ASSERT "TBB: TBB_USE_ASSERT\t2" ENDL -#else - #error Unexpected value for TBB_USE_ASSERT -#endif -#ifndef DO_ITT_NOTIFY - #define __TBB_VERSION_DO_NOTIFY "TBB: DO_ITT_NOTIFY\tundefined" ENDL -#elif DO_ITT_NOTIFY==1 - #define __TBB_VERSION_DO_NOTIFY "TBB: DO_ITT_NOTIFY\t1" ENDL -#elif DO_ITT_NOTIFY==0 - #define __TBB_VERSION_DO_NOTIFY -#else - #error Unexpected value for DO_ITT_NOTIFY -#endif - -#define TBB_VERSION_STRINGS __TBB_VERSION_NUMBER __TBB_INTERFACE_VERSION_NUMBER __TBB_VERSION_DATETIME __TBB_VERSION_STRINGS __TBB_VERSION_USE_DEBUG __TBB_VERSION_USE_ASSERT __TBB_VERSION_DO_NOTIFY - -// numbers -#ifndef __TBB_VERSION_YMD -#define __TBB_VERSION_YMD 0, 0 -#endif - -#define TBB_VERNUMBERS TBB_VERSION_MAJOR, TBB_VERSION_MINOR, __TBB_VERSION_YMD - -#define TBB_VERSION __TBB_STRING(TBB_VERNUMBERS) diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win32-tbb-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win32-tbb-export.def deleted file mode 100644 index 46f76ac2da..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win32-tbb-export.def +++ /dev/null @@ -1,251 +0,0 @@ -; Copyright 2005-2009 Intel Corporation. All Rights Reserved. -; -; This file is part of Threading Building Blocks. -; -; Threading Building Blocks is free software; you can redistribute it -; and/or modify it under the terms of the GNU General Public License -; version 2 as published by the Free Software Foundation. -; -; Threading Building Blocks is distributed in the hope that it will be -; useful, but WITHOUT ANY WARRANTY; without even the implied warranty -; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with Threading Building Blocks; if not, write to the Free Software -; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -; -; As a special exception, you may use this file as part of a free software -; library without restriction. Specifically, if other files instantiate -; templates or use macros or inline functions from this file, or you compile -; this file and link it with other files to produce an executable, this -; file does not by itself cause the resulting executable to be covered by -; the GNU General Public License. This exception does not however -; invalidate any other reasons why the executable file might be covered by -; the GNU General Public License. - -#include "tbb/tbb_config.h" - -EXPORTS - -; Assembly-language support that is called directly by clients -;__TBB_machine_cmpswp1 -;__TBB_machine_cmpswp2 -;__TBB_machine_cmpswp4 -__TBB_machine_cmpswp8 -;__TBB_machine_fetchadd1 -;__TBB_machine_fetchadd2 -;__TBB_machine_fetchadd4 -__TBB_machine_fetchadd8 -;__TBB_machine_fetchstore1 -;__TBB_machine_fetchstore2 -;__TBB_machine_fetchstore4 -__TBB_machine_fetchstore8 -__TBB_machine_store8 -__TBB_machine_load8 -__TBB_machine_trylockbyte - -; cache_aligned_allocator.cpp -?NFS_Allocate@internal@tbb@@YAPAXIIPAX@Z -?NFS_GetLineSize@internal@tbb@@YAIXZ -?NFS_Free@internal@tbb@@YAXPAX@Z -?allocate_via_handler_v3@internal@tbb@@YAPAXI@Z -?deallocate_via_handler_v3@internal@tbb@@YAXPAX@Z -?is_malloc_used_v3@internal@tbb@@YA_NXZ - -; task.cpp v3 -?allocate@allocate_additional_child_of_proxy@internal@tbb@@QBEAAVtask@3@I@Z -?allocate@allocate_child_proxy@internal@tbb@@QBEAAVtask@3@I@Z -?allocate@allocate_continuation_proxy@internal@tbb@@QBEAAVtask@3@I@Z -?allocate@allocate_root_proxy@internal@tbb@@SAAAVtask@3@I@Z -?destroy@task@tbb@@QAEXAAV12@@Z -?free@allocate_additional_child_of_proxy@internal@tbb@@QBEXAAVtask@3@@Z -?free@allocate_child_proxy@internal@tbb@@QBEXAAVtask@3@@Z -?free@allocate_continuation_proxy@internal@tbb@@QBEXAAVtask@3@@Z -?free@allocate_root_proxy@internal@tbb@@SAXAAVtask@3@@Z -?internal_set_ref_count@task@tbb@@AAEXH@Z -?is_owned_by_current_thread@task@tbb@@QBE_NXZ -?note_affinity@task@tbb@@UAEXG@Z -?resize@affinity_partitioner_base_v3@internal@tbb@@AAEXI@Z -?self@task@tbb@@SAAAV12@XZ -?spawn_and_wait_for_all@task@tbb@@QAEXAAVtask_list@2@@Z -?default_num_threads@task_scheduler_init@tbb@@SAHXZ -?initialize@task_scheduler_init@tbb@@QAEXHI@Z -?initialize@task_scheduler_init@tbb@@QAEXH@Z -?terminate@task_scheduler_init@tbb@@QAEXXZ -?observe@task_scheduler_observer_v3@internal@tbb@@QAEX_N@Z - -; exception handling support -?allocate@allocate_root_with_context_proxy@internal@tbb@@QBEAAVtask@3@I@Z -?free@allocate_root_with_context_proxy@internal@tbb@@QBEXAAVtask@3@@Z -?is_group_execution_cancelled@task_group_context@tbb@@QBE_NXZ -?cancel_group_execution@task_group_context@tbb@@QAE_NXZ -?reset@task_group_context@tbb@@QAEXXZ -?init@task_group_context@tbb@@IAEXXZ -??1task_group_context@tbb@@QAE@XZ -?name@captured_exception@tbb@@UBEPBDXZ -?what@captured_exception@tbb@@UBEPBDXZ -??1captured_exception@tbb@@UAE@XZ - -; tbb_misc.cpp -?assertion_failure@tbb@@YAXPBDH00@Z -?get_initial_auto_partitioner_divisor@internal@tbb@@YAIXZ -?handle_perror@internal@tbb@@YAXHPBD@Z -?set_assertion_handler@tbb@@YAP6AXPBDH00@ZP6AX0H00@Z@Z -?runtime_warning@internal@tbb@@YAXPBDZZ -TBB_runtime_interface_version - -; itt_notify.cpp -?itt_load_pointer_with_acquire_v3@internal@tbb@@YAPAXPBX@Z -?itt_store_pointer_with_release_v3@internal@tbb@@YAXPAX0@Z -?itt_set_sync_name_v3@internal@tbb@@YAXPAXPB_W@Z -?itt_load_pointer_v3@internal@tbb@@YAPAXPBX@Z - -; pipeline.cpp -??0pipeline@tbb@@QAE@XZ -??1filter@tbb@@UAE@XZ -??1pipeline@tbb@@UAE@XZ -??_7pipeline@tbb@@6B@ -?add_filter@pipeline@tbb@@QAEXAAVfilter@2@@Z -?clear@pipeline@tbb@@QAEXXZ -?inject_token@pipeline@tbb@@AAEXAAVtask@2@@Z -?run@pipeline@tbb@@QAEXI@Z -?run@pipeline@tbb@@QAEXIAAVtask_group_context@2@@Z - -; queuing_rw_mutex.cpp -?internal_construct@queuing_rw_mutex@tbb@@QAEXXZ -?acquire@scoped_lock@queuing_rw_mutex@tbb@@QAEXAAV23@_N@Z -?downgrade_to_reader@scoped_lock@queuing_rw_mutex@tbb@@QAE_NXZ -?release@scoped_lock@queuing_rw_mutex@tbb@@QAEXXZ -?upgrade_to_writer@scoped_lock@queuing_rw_mutex@tbb@@QAE_NXZ -?try_acquire@scoped_lock@queuing_rw_mutex@tbb@@QAE_NAAV23@_N@Z - -#if !TBB_NO_LEGACY -; spin_rw_mutex.cpp v2 -?internal_acquire_reader@spin_rw_mutex@tbb@@CAXPAV12@@Z -?internal_acquire_writer@spin_rw_mutex@tbb@@CA_NPAV12@@Z -?internal_downgrade@spin_rw_mutex@tbb@@CAXPAV12@@Z -?internal_itt_releasing@spin_rw_mutex@tbb@@CAXPAV12@@Z -?internal_release_reader@spin_rw_mutex@tbb@@CAXPAV12@@Z -?internal_release_writer@spin_rw_mutex@tbb@@CAXPAV12@@Z -?internal_upgrade@spin_rw_mutex@tbb@@CA_NPAV12@@Z -?internal_try_acquire_writer@spin_rw_mutex@tbb@@CA_NPAV12@@Z -?internal_try_acquire_reader@spin_rw_mutex@tbb@@CA_NPAV12@@Z -#endif - -; spin_rw_mutex v3 -?internal_construct@spin_rw_mutex_v3@tbb@@AAEXXZ -?internal_upgrade@spin_rw_mutex_v3@tbb@@AAE_NXZ -?internal_downgrade@spin_rw_mutex_v3@tbb@@AAEXXZ -?internal_acquire_reader@spin_rw_mutex_v3@tbb@@AAEXXZ -?internal_acquire_writer@spin_rw_mutex_v3@tbb@@AAE_NXZ -?internal_release_reader@spin_rw_mutex_v3@tbb@@AAEXXZ -?internal_release_writer@spin_rw_mutex_v3@tbb@@AAEXXZ -?internal_try_acquire_reader@spin_rw_mutex_v3@tbb@@AAE_NXZ -?internal_try_acquire_writer@spin_rw_mutex_v3@tbb@@AAE_NXZ - -; spin_mutex.cpp -?internal_construct@spin_mutex@tbb@@QAEXXZ -?internal_acquire@scoped_lock@spin_mutex@tbb@@AAEXAAV23@@Z -?internal_release@scoped_lock@spin_mutex@tbb@@AAEXXZ -?internal_try_acquire@scoped_lock@spin_mutex@tbb@@AAE_NAAV23@@Z - -; mutex.cpp -?internal_acquire@scoped_lock@mutex@tbb@@AAEXAAV23@@Z -?internal_release@scoped_lock@mutex@tbb@@AAEXXZ -?internal_try_acquire@scoped_lock@mutex@tbb@@AAE_NAAV23@@Z -?internal_construct@mutex@tbb@@AAEXXZ -?internal_destroy@mutex@tbb@@AAEXXZ - -; recursive_mutex.cpp -?internal_acquire@scoped_lock@recursive_mutex@tbb@@AAEXAAV23@@Z -?internal_release@scoped_lock@recursive_mutex@tbb@@AAEXXZ -?internal_try_acquire@scoped_lock@recursive_mutex@tbb@@AAE_NAAV23@@Z -?internal_construct@recursive_mutex@tbb@@AAEXXZ -?internal_destroy@recursive_mutex@tbb@@AAEXXZ - -; queuing_mutex.cpp -?internal_construct@queuing_mutex@tbb@@QAEXXZ -?acquire@scoped_lock@queuing_mutex@tbb@@QAEXAAV23@@Z -?release@scoped_lock@queuing_mutex@tbb@@QAEXXZ -?try_acquire@scoped_lock@queuing_mutex@tbb@@QAE_NAAV23@@Z - -; concurrent_hash_map.cpp -?internal_grow_predicate@hash_map_segment_base@internal@tbb@@QBE_NXZ - -#if !TBB_NO_LEGACY -; concurrent_queue.cpp v2 -?advance@concurrent_queue_iterator_base@internal@tbb@@IAEXXZ -?assign@concurrent_queue_iterator_base@internal@tbb@@IAEXABV123@@Z -?internal_size@concurrent_queue_base@internal@tbb@@IBEHXZ -??0concurrent_queue_base@internal@tbb@@IAE@I@Z -??0concurrent_queue_iterator_base@internal@tbb@@IAE@ABVconcurrent_queue_base@12@@Z -??1concurrent_queue_base@internal@tbb@@MAE@XZ -??1concurrent_queue_iterator_base@internal@tbb@@IAE@XZ -?internal_pop@concurrent_queue_base@internal@tbb@@IAEXPAX@Z -?internal_pop_if_present@concurrent_queue_base@internal@tbb@@IAE_NPAX@Z -?internal_push@concurrent_queue_base@internal@tbb@@IAEXPBX@Z -?internal_push_if_not_full@concurrent_queue_base@internal@tbb@@IAE_NPBX@Z -?internal_set_capacity@concurrent_queue_base@internal@tbb@@IAEXHI@Z -#endif - -; concurrent_queue v3 -??1concurrent_queue_iterator_base_v3@internal@tbb@@IAE@XZ -??0concurrent_queue_iterator_base_v3@internal@tbb@@IAE@ABVconcurrent_queue_base_v3@12@@Z -?advance@concurrent_queue_iterator_base_v3@internal@tbb@@IAEXXZ -?assign@concurrent_queue_iterator_base_v3@internal@tbb@@IAEXABV123@@Z -??0concurrent_queue_base_v3@internal@tbb@@IAE@I@Z -??1concurrent_queue_base_v3@internal@tbb@@MAE@XZ -?internal_pop@concurrent_queue_base_v3@internal@tbb@@IAEXPAX@Z -?internal_pop_if_present@concurrent_queue_base_v3@internal@tbb@@IAE_NPAX@Z -?internal_push@concurrent_queue_base_v3@internal@tbb@@IAEXPBX@Z -?internal_push_if_not_full@concurrent_queue_base_v3@internal@tbb@@IAE_NPBX@Z -?internal_size@concurrent_queue_base_v3@internal@tbb@@IBEHXZ -?internal_set_capacity@concurrent_queue_base_v3@internal@tbb@@IAEXHI@Z -?internal_finish_clear@concurrent_queue_base_v3@internal@tbb@@IAEXXZ -?internal_throw_exception@concurrent_queue_base_v3@internal@tbb@@IBEXXZ -?assign@concurrent_queue_base_v3@internal@tbb@@IAEXABV123@@Z - -#if !TBB_NO_LEGACY -; concurrent_vector.cpp v2 -?internal_assign@concurrent_vector_base@internal@tbb@@IAEXABV123@IP6AXPAXI@ZP6AX1PBXI@Z4@Z -?internal_capacity@concurrent_vector_base@internal@tbb@@IBEIXZ -?internal_clear@concurrent_vector_base@internal@tbb@@IAEXP6AXPAXI@Z_N@Z -?internal_copy@concurrent_vector_base@internal@tbb@@IAEXABV123@IP6AXPAXPBXI@Z@Z -?internal_grow_by@concurrent_vector_base@internal@tbb@@IAEIIIP6AXPAXI@Z@Z -?internal_grow_to_at_least@concurrent_vector_base@internal@tbb@@IAEXIIP6AXPAXI@Z@Z -?internal_push_back@concurrent_vector_base@internal@tbb@@IAEPAXIAAI@Z -?internal_reserve@concurrent_vector_base@internal@tbb@@IAEXIII@Z -#endif - -; concurrent_vector v3 -??1concurrent_vector_base_v3@internal@tbb@@IAE@XZ -?internal_assign@concurrent_vector_base_v3@internal@tbb@@IAEXABV123@IP6AXPAXI@ZP6AX1PBXI@Z4@Z -?internal_capacity@concurrent_vector_base_v3@internal@tbb@@IBEIXZ -?internal_clear@concurrent_vector_base_v3@internal@tbb@@IAEIP6AXPAXI@Z@Z -?internal_copy@concurrent_vector_base_v3@internal@tbb@@IAEXABV123@IP6AXPAXPBXI@Z@Z -?internal_grow_by@concurrent_vector_base_v3@internal@tbb@@IAEIIIP6AXPAXPBXI@Z1@Z -?internal_grow_to_at_least@concurrent_vector_base_v3@internal@tbb@@IAEXIIP6AXPAXPBXI@Z1@Z -?internal_push_back@concurrent_vector_base_v3@internal@tbb@@IAEPAXIAAI@Z -?internal_reserve@concurrent_vector_base_v3@internal@tbb@@IAEXIII@Z -?internal_compact@concurrent_vector_base_v3@internal@tbb@@IAEPAXIPAXP6AX0I@ZP6AX0PBXI@Z@Z -?internal_swap@concurrent_vector_base_v3@internal@tbb@@IAEXAAV123@@Z -?internal_throw_exception@concurrent_vector_base_v3@internal@tbb@@IBEXI@Z - -; tbb_thread -?join@tbb_thread_v3@internal@tbb@@QAEXXZ -?detach@tbb_thread_v3@internal@tbb@@QAEXXZ -?internal_start@tbb_thread_v3@internal@tbb@@AAEXP6GIPAX@Z0@Z -?allocate_closure_v3@internal@tbb@@YAPAXI@Z -?free_closure_v3@internal@tbb@@YAXPAX@Z -?hardware_concurrency@tbb_thread_v3@internal@tbb@@SAIXZ -?thread_yield_v3@internal@tbb@@YAXXZ -?thread_sleep_v3@internal@tbb@@YAXABVinterval_t@tick_count@2@@Z -?move_v3@internal@tbb@@YAXAAVtbb_thread_v3@12@0@Z -?thread_get_id_v3@internal@tbb@@YA?AVid@tbb_thread_v3@12@XZ - -; enumerable_thread_specific -?create_key@tls_single_key_manager_v4@internal@tbb@@SAXAAI@Z -?destroy_key@tls_single_key_manager_v4@internal@tbb@@SAXAAI@Z -?get_tls@tls_single_key_manager_v4@internal@tbb@@SAPAXAAI@Z -?set_tls@tls_single_key_manager_v4@internal@tbb@@SAXAAIPAX@Z diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win64-tbb-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win64-tbb-export.def deleted file mode 100644 index 142efca27a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbb/win64-tbb-export.def +++ /dev/null @@ -1,247 +0,0 @@ -; Copyright 2005-2009 Intel Corporation. All Rights Reserved. -; -; This file is part of Threading Building Blocks. -; -; Threading Building Blocks is free software; you can redistribute it -; and/or modify it under the terms of the GNU General Public License -; version 2 as published by the Free Software Foundation. -; -; Threading Building Blocks is distributed in the hope that it will be -; useful, but WITHOUT ANY WARRANTY; without even the implied warranty -; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with Threading Building Blocks; if not, write to the Free Software -; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -; -; As a special exception, you may use this file as part of a free software -; library without restriction. Specifically, if other files instantiate -; templates or use macros or inline functions from this file, or you compile -; this file and link it with other files to produce an executable, this -; file does not by itself cause the resulting executable to be covered by -; the GNU General Public License. This exception does not however -; invalidate any other reasons why the executable file might be covered by -; the GNU General Public License. - -; This file is organized with a section for each .cpp file. -; Each of these sections is in alphabetical order. - -#include "tbb/tbb_config.h" - -EXPORTS - -; Assembly-language support that is called directly by clients -__TBB_machine_cmpswp1 -__TBB_machine_fetchadd1 -__TBB_machine_fetchstore1 -__TBB_machine_cmpswp2 -__TBB_machine_fetchadd2 -__TBB_machine_fetchstore2 -__TBB_machine_pause - -; cache_aligned_allocator.cpp -?NFS_Allocate@internal@tbb@@YAPEAX_K0PEAX@Z -?NFS_GetLineSize@internal@tbb@@YA_KXZ -?NFS_Free@internal@tbb@@YAXPEAX@Z -?allocate_via_handler_v3@internal@tbb@@YAPEAX_K@Z -?deallocate_via_handler_v3@internal@tbb@@YAXPEAX@Z -?is_malloc_used_v3@internal@tbb@@YA_NXZ - - -; task.cpp v3 -?resize@affinity_partitioner_base_v3@internal@tbb@@AEAAXI@Z -?allocate@allocate_additional_child_of_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z -?allocate@allocate_child_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z -?allocate@allocate_continuation_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z -?allocate@allocate_root_proxy@internal@tbb@@SAAEAVtask@3@_K@Z -?destroy@task@tbb@@QEAAXAEAV12@@Z -?free@allocate_additional_child_of_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z -?free@allocate_child_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z -?free@allocate_continuation_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z -?free@allocate_root_proxy@internal@tbb@@SAXAEAVtask@3@@Z -?internal_set_ref_count@task@tbb@@AEAAXH@Z -?is_owned_by_current_thread@task@tbb@@QEBA_NXZ -?note_affinity@task@tbb@@UEAAXG@Z -?self@task@tbb@@SAAEAV12@XZ -?spawn_and_wait_for_all@task@tbb@@QEAAXAEAVtask_list@2@@Z -?default_num_threads@task_scheduler_init@tbb@@SAHXZ -?initialize@task_scheduler_init@tbb@@QEAAXH_K@Z -?initialize@task_scheduler_init@tbb@@QEAAXH@Z -?terminate@task_scheduler_init@tbb@@QEAAXXZ -?observe@task_scheduler_observer_v3@internal@tbb@@QEAAX_N@Z - -; exception handling support -?allocate@allocate_root_with_context_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z -?free@allocate_root_with_context_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z -?is_group_execution_cancelled@task_group_context@tbb@@QEBA_NXZ -?cancel_group_execution@task_group_context@tbb@@QEAA_NXZ -?reset@task_group_context@tbb@@QEAAXXZ -?init@task_group_context@tbb@@IEAAXXZ -??1task_group_context@tbb@@QEAA@XZ -?name@captured_exception@tbb@@UEBAPEBDXZ -?what@captured_exception@tbb@@UEBAPEBDXZ -??1captured_exception@tbb@@UEAA@XZ - -; tbb_misc.cpp -?assertion_failure@tbb@@YAXPEBDH00@Z -?get_initial_auto_partitioner_divisor@internal@tbb@@YA_KXZ -?handle_perror@internal@tbb@@YAXHPEBD@Z -?set_assertion_handler@tbb@@YAP6AXPEBDH00@ZP6AX0H00@Z@Z -?runtime_warning@internal@tbb@@YAXPEBDZZ -TBB_runtime_interface_version - -; itt_notify.cpp -?itt_load_pointer_with_acquire_v3@internal@tbb@@YAPEAXPEBX@Z -?itt_store_pointer_with_release_v3@internal@tbb@@YAXPEAX0@Z -?itt_load_pointer_v3@internal@tbb@@YAPEAXPEBX@Z -?itt_set_sync_name_v3@internal@tbb@@YAXPEAXPEB_W@Z - -; pipeline.cpp -??_7pipeline@tbb@@6B@ -??0pipeline@tbb@@QEAA@XZ -??1filter@tbb@@UEAA@XZ -??1pipeline@tbb@@UEAA@XZ -?add_filter@pipeline@tbb@@QEAAXAEAVfilter@2@@Z -?clear@pipeline@tbb@@QEAAXXZ -?inject_token@pipeline@tbb@@AEAAXAEAVtask@2@@Z -?run@pipeline@tbb@@QEAAX_K@Z -?run@pipeline@tbb@@QEAAX_KAEAVtask_group_context@2@@Z - -; queuing_rw_mutex.cpp -?internal_construct@queuing_rw_mutex@tbb@@QEAAXXZ -?acquire@scoped_lock@queuing_rw_mutex@tbb@@QEAAXAEAV23@_N@Z -?downgrade_to_reader@scoped_lock@queuing_rw_mutex@tbb@@QEAA_NXZ -?release@scoped_lock@queuing_rw_mutex@tbb@@QEAAXXZ -?upgrade_to_writer@scoped_lock@queuing_rw_mutex@tbb@@QEAA_NXZ -?try_acquire@scoped_lock@queuing_rw_mutex@tbb@@QEAA_NAEAV23@_N@Z - -#if !TBB_NO_LEGACY -; spin_rw_mutex.cpp v2 -?internal_itt_releasing@spin_rw_mutex@tbb@@CAXPEAV12@@Z -?internal_acquire_writer@spin_rw_mutex@tbb@@CA_NPEAV12@@Z -?internal_acquire_reader@spin_rw_mutex@tbb@@CAXPEAV12@@Z -?internal_downgrade@spin_rw_mutex@tbb@@CAXPEAV12@@Z -?internal_upgrade@spin_rw_mutex@tbb@@CA_NPEAV12@@Z -?internal_release_reader@spin_rw_mutex@tbb@@CAXPEAV12@@Z -?internal_release_writer@spin_rw_mutex@tbb@@CAXPEAV12@@Z -?internal_try_acquire_writer@spin_rw_mutex@tbb@@CA_NPEAV12@@Z -?internal_try_acquire_reader@spin_rw_mutex@tbb@@CA_NPEAV12@@Z -#endif - -; spin_rw_mutex v3 -?internal_construct@spin_rw_mutex_v3@tbb@@AEAAXXZ -?internal_upgrade@spin_rw_mutex_v3@tbb@@AEAA_NXZ -?internal_downgrade@spin_rw_mutex_v3@tbb@@AEAAXXZ -?internal_acquire_reader@spin_rw_mutex_v3@tbb@@AEAAXXZ -?internal_acquire_writer@spin_rw_mutex_v3@tbb@@AEAA_NXZ -?internal_release_reader@spin_rw_mutex_v3@tbb@@AEAAXXZ -?internal_release_writer@spin_rw_mutex_v3@tbb@@AEAAXXZ -?internal_try_acquire_reader@spin_rw_mutex_v3@tbb@@AEAA_NXZ -?internal_try_acquire_writer@spin_rw_mutex_v3@tbb@@AEAA_NXZ - -; spin_mutex.cpp -?internal_construct@spin_mutex@tbb@@QEAAXXZ -?internal_acquire@scoped_lock@spin_mutex@tbb@@AEAAXAEAV23@@Z -?internal_release@scoped_lock@spin_mutex@tbb@@AEAAXXZ -?internal_try_acquire@scoped_lock@spin_mutex@tbb@@AEAA_NAEAV23@@Z - -; mutex.cpp -?internal_acquire@scoped_lock@mutex@tbb@@AEAAXAEAV23@@Z -?internal_release@scoped_lock@mutex@tbb@@AEAAXXZ -?internal_try_acquire@scoped_lock@mutex@tbb@@AEAA_NAEAV23@@Z -?internal_construct@mutex@tbb@@AEAAXXZ -?internal_destroy@mutex@tbb@@AEAAXXZ - -; recursive_mutex.cpp -?internal_construct@recursive_mutex@tbb@@AEAAXXZ -?internal_destroy@recursive_mutex@tbb@@AEAAXXZ -?internal_acquire@scoped_lock@recursive_mutex@tbb@@AEAAXAEAV23@@Z -?internal_try_acquire@scoped_lock@recursive_mutex@tbb@@AEAA_NAEAV23@@Z -?internal_release@scoped_lock@recursive_mutex@tbb@@AEAAXXZ - -; queuing_mutex.cpp -?internal_construct@queuing_mutex@tbb@@QEAAXXZ -?acquire@scoped_lock@queuing_mutex@tbb@@QEAAXAEAV23@@Z -?release@scoped_lock@queuing_mutex@tbb@@QEAAXXZ -?try_acquire@scoped_lock@queuing_mutex@tbb@@QEAA_NAEAV23@@Z - -; concurrent_hash_map.cpp -?internal_grow_predicate@hash_map_segment_base@internal@tbb@@QEBA_NXZ - -#if !TBB_NO_LEGACY -; concurrent_queue.cpp v2 -??0concurrent_queue_base@internal@tbb@@IEAA@_K@Z -??0concurrent_queue_iterator_base@internal@tbb@@IEAA@AEBVconcurrent_queue_base@12@@Z -??1concurrent_queue_base@internal@tbb@@MEAA@XZ -??1concurrent_queue_iterator_base@internal@tbb@@IEAA@XZ -?advance@concurrent_queue_iterator_base@internal@tbb@@IEAAXXZ -?assign@concurrent_queue_iterator_base@internal@tbb@@IEAAXAEBV123@@Z -?internal_pop@concurrent_queue_base@internal@tbb@@IEAAXPEAX@Z -?internal_pop_if_present@concurrent_queue_base@internal@tbb@@IEAA_NPEAX@Z -?internal_push@concurrent_queue_base@internal@tbb@@IEAAXPEBX@Z -?internal_push_if_not_full@concurrent_queue_base@internal@tbb@@IEAA_NPEBX@Z -?internal_set_capacity@concurrent_queue_base@internal@tbb@@IEAAX_J_K@Z -?internal_size@concurrent_queue_base@internal@tbb@@IEBA_JXZ -#endif - -; concurrent_queue v3 -??0concurrent_queue_iterator_base_v3@internal@tbb@@IEAA@AEBVconcurrent_queue_base_v3@12@@Z -??1concurrent_queue_iterator_base_v3@internal@tbb@@IEAA@XZ -?assign@concurrent_queue_iterator_base_v3@internal@tbb@@IEAAXAEBV123@@Z -?advance@concurrent_queue_iterator_base_v3@internal@tbb@@IEAAXXZ -??0concurrent_queue_base_v3@internal@tbb@@IEAA@_K@Z -??1concurrent_queue_base_v3@internal@tbb@@MEAA@XZ -?internal_push@concurrent_queue_base_v3@internal@tbb@@IEAAXPEBX@Z -?internal_push_if_not_full@concurrent_queue_base_v3@internal@tbb@@IEAA_NPEBX@Z -?internal_pop@concurrent_queue_base_v3@internal@tbb@@IEAAXPEAX@Z -?internal_pop_if_present@concurrent_queue_base_v3@internal@tbb@@IEAA_NPEAX@Z -?internal_size@concurrent_queue_base_v3@internal@tbb@@IEBA_JXZ -?internal_finish_clear@concurrent_queue_base_v3@internal@tbb@@IEAAXXZ -?internal_set_capacity@concurrent_queue_base_v3@internal@tbb@@IEAAX_J_K@Z -?internal_throw_exception@concurrent_queue_base_v3@internal@tbb@@IEBAXXZ -?assign@concurrent_queue_base_v3@internal@tbb@@IEAAXAEBV123@@Z - -#if !TBB_NO_LEGACY -; concurrent_vector.cpp v2 -?internal_assign@concurrent_vector_base@internal@tbb@@IEAAXAEBV123@_KP6AXPEAX1@ZP6AX2PEBX1@Z5@Z -?internal_capacity@concurrent_vector_base@internal@tbb@@IEBA_KXZ -?internal_clear@concurrent_vector_base@internal@tbb@@IEAAXP6AXPEAX_K@Z_N@Z -?internal_copy@concurrent_vector_base@internal@tbb@@IEAAXAEBV123@_KP6AXPEAXPEBX1@Z@Z -?internal_grow_by@concurrent_vector_base@internal@tbb@@IEAA_K_K0P6AXPEAX0@Z@Z -?internal_grow_to_at_least@concurrent_vector_base@internal@tbb@@IEAAX_K0P6AXPEAX0@Z@Z -?internal_push_back@concurrent_vector_base@internal@tbb@@IEAAPEAX_KAEA_K@Z -?internal_reserve@concurrent_vector_base@internal@tbb@@IEAAX_K00@Z -#endif - -; concurrent_vector v3 -??1concurrent_vector_base_v3@internal@tbb@@IEAA@XZ -?internal_assign@concurrent_vector_base_v3@internal@tbb@@IEAAXAEBV123@_KP6AXPEAX1@ZP6AX2PEBX1@Z5@Z -?internal_capacity@concurrent_vector_base_v3@internal@tbb@@IEBA_KXZ -?internal_clear@concurrent_vector_base_v3@internal@tbb@@IEAA_KP6AXPEAX_K@Z@Z -?internal_copy@concurrent_vector_base_v3@internal@tbb@@IEAAXAEBV123@_KP6AXPEAXPEBX1@Z@Z -?internal_grow_by@concurrent_vector_base_v3@internal@tbb@@IEAA_K_K0P6AXPEAXPEBX0@Z2@Z -?internal_grow_to_at_least@concurrent_vector_base_v3@internal@tbb@@IEAAX_K0P6AXPEAXPEBX0@Z2@Z -?internal_push_back@concurrent_vector_base_v3@internal@tbb@@IEAAPEAX_KAEA_K@Z -?internal_reserve@concurrent_vector_base_v3@internal@tbb@@IEAAX_K00@Z -?internal_compact@concurrent_vector_base_v3@internal@tbb@@IEAAPEAX_KPEAXP6AX10@ZP6AX1PEBX0@Z@Z -?internal_swap@concurrent_vector_base_v3@internal@tbb@@IEAAXAEAV123@@Z -?internal_throw_exception@concurrent_vector_base_v3@internal@tbb@@IEBAX_K@Z - -; tbb_thread -?allocate_closure_v3@internal@tbb@@YAPEAX_K@Z -?detach@tbb_thread_v3@internal@tbb@@QEAAXXZ -?free_closure_v3@internal@tbb@@YAXPEAX@Z -?hardware_concurrency@tbb_thread_v3@internal@tbb@@SAIXZ -?internal_start@tbb_thread_v3@internal@tbb@@AEAAXP6AIPEAX@Z0@Z -?join@tbb_thread_v3@internal@tbb@@QEAAXXZ -?move_v3@internal@tbb@@YAXAEAVtbb_thread_v3@12@0@Z -?thread_get_id_v3@internal@tbb@@YA?AVid@tbb_thread_v3@12@XZ -?thread_sleep_v3@internal@tbb@@YAXAEBVinterval_t@tick_count@2@@Z -?thread_yield_v3@internal@tbb@@YAXXZ - -; enumerable_thread_specific -?create_key@tls_single_key_manager_v4@internal@tbb@@SAXAEA_K@Z -?destroy_key@tls_single_key_manager_v4@internal@tbb@@SAXAEA_K@Z -?set_tls@tls_single_key_manager_v4@internal@tbb@@SAXAEA_KPEAX@Z -?get_tls@tls_single_key_manager_v4@internal@tbb@@SAPEAXAEA_K@Z diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Customize.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Customize.h deleted file mode 100644 index e9cb824daf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Customize.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _TBB_malloc_Customize_H_ -#define _TBB_malloc_Customize_H_ - -/* Thread shutdown notification callback */ -/* redefine the name of the callback to meet TBB requirements - for externally visible names of service functions */ -#define mallocThreadShutdownNotification __TBB_mallocThreadShutdownNotification -#define mallocProcessShutdownNotification __TBB_mallocProcessShutdownNotification - -extern "C" void mallocThreadShutdownNotification(void *); -extern "C" void mallocProcessShutdownNotification(void); - -// customizing MALLOC_ASSERT macro -#include "tbb/tbb_stddef.h" -#define MALLOC_ASSERT(assertion, message) __TBB_ASSERT(assertion, message) - -#ifndef MALLOC_DEBUG -#define MALLOC_DEBUG TBB_USE_DEBUG -#endif - -#include "tbb/tbb_machine.h" - -#if DO_ITT_NOTIFY -#include "tbb/itt_notify.h" -#define MALLOC_ITT_SYNC_PREPARE(pointer) ITT_NOTIFY(sync_prepare, (pointer)) -#define MALLOC_ITT_SYNC_ACQUIRED(pointer) ITT_NOTIFY(sync_acquired, (pointer)) -#define MALLOC_ITT_SYNC_RELEASING(pointer) ITT_NOTIFY(sync_releasing, (pointer)) -#define MALLOC_ITT_SYNC_CANCEL(pointer) ITT_NOTIFY(sync_cancel, (pointer)) -#else -#define MALLOC_ITT_SYNC_PREPARE(pointer) ((void)0) -#define MALLOC_ITT_SYNC_ACQUIRED(pointer) ((void)0) -#define MALLOC_ITT_SYNC_RELEASING(pointer) ((void)0) -#define MALLOC_ITT_SYNC_CANCEL(pointer) ((void)0) -#endif - -//! Stripped down version of spin_mutex. -/** Instances of MallocMutex must be declared in memory that is zero-initialized. - There are no constructors. This is a feature that lets it be - used in situations where the mutex might be used while file-scope constructors - are running. - - There are no methods "acquire" or "release". The scoped_lock must be used - in a strict block-scoped locking pattern. Omitting these methods permitted - further simplication. */ -class MallocMutex { - unsigned char value; - - //! Deny assignment - void operator=( MallocMutex& MallocMutex ); -public: - class scoped_lock { - const unsigned char value; - MallocMutex& mutex; - public: - scoped_lock( MallocMutex& m ) : value( __TBB_LockByte(m.value)), mutex(m) {} - ~scoped_lock() { __TBB_store_with_release(mutex.value, value); } - }; - friend class scoped_lock; -}; - -inline intptr_t AtomicIncrement( volatile intptr_t& counter ) { - return __TBB_FetchAndAddW( &counter, 1 )+1; -} - -inline intptr_t AtomicCompareExchange( volatile intptr_t& location, intptr_t new_value, intptr_t comparand) { - return __TBB_CompareAndSwapW( &location, new_value, comparand ); -} - -#define USE_DEFAULT_MEMORY_MAPPING 1 - -namespace tbb { -namespace internal { - void init_tbbmalloc(); -} } // namespaces - -#define MALLOC_EXTRA_INITIALIZATION tbb::internal::init_tbbmalloc() - -// To support malloc replacement with LD_PRELOAD -#include "proxy.h" - -#if MALLOC_LD_PRELOAD -extern "C" void * __TBB_malloc_proxy(size_t) __attribute__ ((weak)); -#endif - -#endif /* _TBB_malloc_Customize_H_ */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/LifoQueue.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/LifoQueue.h deleted file mode 100644 index 95cfd2bcf2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/LifoQueue.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _itt_common_malloc_LifoQueue_H_ -#define _itt_common_malloc_LifoQueue_H_ - -#include "TypeDefinitions.h" -#include <string.h> // for memset() - -//! Checking the synchronization method -/** FINE_GRAIN_LOCKS is the only variant for now; should be defined for LifoQueue */ -#ifndef FINE_GRAIN_LOCKS -#define FINE_GRAIN_LOCKS -#endif - -namespace ThreadingSubstrate { - -namespace Internal { - -class LifoQueue { -public: - inline LifoQueue(); - inline void push(void** ptr); - inline void* pop(void); - -private: - void * top; -#ifdef FINE_GRAIN_LOCKS - MallocMutex lock; -#endif /* FINE_GRAIN_LOCKS */ -}; - -#ifdef FINE_GRAIN_LOCKS -/* LifoQueue assumes zero initialization so a vector of it can be created - * by just allocating some space with no call to constructor. - * On Linux, it seems to be necessary to avoid linking with C++ libraries. - * - * By usage convention there is no race on the initialization. */ -LifoQueue::LifoQueue( ) : top(NULL) -{ - // MallocMutex assumes zero initialization - memset(&lock, 0, sizeof(MallocMutex)); -} - -void LifoQueue::push( void **ptr ) -{ - MallocMutex::scoped_lock scoped_cs(lock); - *ptr = top; - top = ptr; -} - -void * LifoQueue::pop( ) -{ - void **result=NULL; - { - MallocMutex::scoped_lock scoped_cs(lock); - if (!top) goto done; - result = (void **) top; - top = *result; - } - *result = NULL; -done: - return result; -} - -#endif /* FINE_GRAIN_LOCKS */ - -} // namespace Internal -} // namespace ThreadingSubstrate - -#endif /* _itt_common_malloc_LifoQueue_H_ */ - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MapMemory.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MapMemory.h deleted file mode 100644 index 77daff0ec7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MapMemory.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _itt_shared_malloc_MapMemory_H -#define _itt_shared_malloc_MapMemory_H - -#if __linux__ || __APPLE__ -#include <sys/mman.h> - -#define MEMORY_MAPPING_USES_MALLOC 0 -void* MapMemory (size_t bytes) -{ - void* result = 0; -#ifndef MAP_ANONYMOUS -// Mac OS* X defines MAP_ANON, which is deprecated in Linux. -#define MAP_ANONYMOUS MAP_ANON -#endif /* MAP_ANONYMOUS */ - result = mmap(result, bytes, (PROT_READ | PROT_WRITE), MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - return result==MAP_FAILED? 0: result; -} - -int UnmapMemory(void *area, size_t bytes) -{ - return munmap(area, bytes); -} - -#elif _WIN32 || _WIN64 -#include <windows.h> - -#define MEMORY_MAPPING_USES_MALLOC 0 -void* MapMemory (size_t bytes) -{ - /* Is VirtualAlloc thread safe? */ - return VirtualAlloc(NULL, bytes, (MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN), PAGE_READWRITE); -} - -int UnmapMemory(void *area, size_t bytes) -{ - BOOL result = VirtualFree(area, 0, MEM_RELEASE); - return !result; -} - -#else -#include <stdlib.h> - -void* MapMemory (size_t bytes) -{ - return malloc( bytes ); -} - -int UnmapMemory(void *area, size_t bytes) -{ - free( area ); - return 0; -} - -#endif /* OS dependent */ - -#endif /* _itt_shared_malloc_MapMemory_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MemoryAllocator.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MemoryAllocator.cpp deleted file mode 100644 index 2ce7766abd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/MemoryAllocator.cpp +++ /dev/null @@ -1,1816 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -#include "TypeDefinitions.h" - -#if USE_PTHREAD - // Some pthreads documentation says that <pthreads.h> must be first header. - #include <pthread.h> - #define TlsSetValue_func pthread_setspecific - #define TlsGetValue_func pthread_getspecific - typedef pthread_key_t tls_key_t; - #include <sched.h> - inline void do_yield() {sched_yield();} - -#elif USE_WINTHREAD - #define _WIN32_WINNT 0x0400 - #include <windows.h> - #define TlsSetValue_func TlsSetValue - #define TlsGetValue_func TlsGetValue - typedef DWORD tls_key_t; - inline void do_yield() {SwitchToThread();} - -#else - #error Must define USE_PTHREAD or USE_WINTHREAD - -#endif - -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/********* Various compile-time options **************/ - -#define MALLOC_TRACE 0 - -#if MALLOC_TRACE -#define TRACEF(x) printf x -#else -#define TRACEF(x) ((void)0) -#endif /* MALLOC_TRACE */ - -#define ASSERT_TEXT NULL - -//! Define the main synchronization method -/** It should be specified before including LifoQueue.h */ -#define FINE_GRAIN_LOCKS -#include "LifoQueue.h" - -#if MALLOC_DEBUG -#define COLLECT_STATISTICS 1 -#endif - -#include "Statistics.h" - -#define FREELIST_NONBLOCKING 1 - -// If USE_MALLOC_FOR_LARGE_OBJECT is nonzero, then large allocations are done via malloc. -// Otherwise large allocations are done using the scalable allocator's block allocator. -// As of 06.Jun.17, using malloc is about 10x faster on Linux. -#if !_WIN32 -#define USE_MALLOC_FOR_LARGE_OBJECT 1 -#endif - - -extern "C" { - void * scalable_malloc(size_t size); - void scalable_free(void *object); -} - -/********* End compile-time options **************/ - -#if MALLOC_LD_PRELOAD -#include <new> /* for placement new */ -#endif - -namespace ThreadingSubstrate { - -namespace Internal { - -/******* A helper class to support overriding malloc with scalable_malloc *******/ -#if MALLOC_LD_PRELOAD -class recursive_malloc_call_protector { - static MallocMutex rmc_mutex; - - MallocMutex::scoped_lock* lock_acquired; - char scoped_lock_space[sizeof(MallocMutex::scoped_lock)+1]; -public: - recursive_malloc_call_protector(bool condition) : lock_acquired(NULL) { - if (condition) { - lock_acquired = new (scoped_lock_space) MallocMutex::scoped_lock( rmc_mutex ); - lockRecursiveMallocFlag(); - } - } - ~recursive_malloc_call_protector() { - if (lock_acquired) { - unlockRecursiveMallocFlag(); - lock_acquired->~scoped_lock(); - } - } -}; - -MallocMutex recursive_malloc_call_protector::rmc_mutex; - -#define malloc_proxy __TBB_malloc_proxy - -#else /* MALLOC_LD_PRELOAD */ -class recursive_malloc_call_protector { -public: - recursive_malloc_call_protector(bool) {} - ~recursive_malloc_call_protector() {} -}; -const bool malloc_proxy = false; -#endif /* MALLOC_LD_PRELOAD */ - -/*********** Code to provide thread ID and a thread-local void pointer **********/ - -typedef intptr_t ThreadId; - -static ThreadId ThreadIdCount; - -static tls_key_t TLS_pointer_key; -static tls_key_t Tid_key; - -static inline ThreadId getThreadId(void) -{ - ThreadId result; - result = reinterpret_cast<ThreadId>(TlsGetValue_func(Tid_key)); - if( !result ) { - recursive_malloc_call_protector scoped(/*condition=*/malloc_proxy); - // Thread-local value is zero -> first call from this thread, - // need to initialize with next ID value (IDs start from 1) - result = AtomicIncrement(ThreadIdCount); // returned new value! - TlsSetValue_func( Tid_key, reinterpret_cast<void*>(result) ); - } - return result; -} - -static inline void* getThreadMallocTLS() { - void *result; - result = TlsGetValue_func( TLS_pointer_key ); -// The assert below is incorrect: with lazy initialization, it fails on the first call of the function. -// MALLOC_ASSERT( result, "Memory allocator not initialized" ); - return result; -} - -static inline void setThreadMallocTLS( void * newvalue ) { - recursive_malloc_call_protector scoped(/*condition=*/malloc_proxy); - TlsSetValue_func( TLS_pointer_key, newvalue ); -} - -/*********** End code to provide thread ID and a TLS pointer **********/ - -/* - * This number of bins in the TLS that leads to blocks that we can allocate in. - */ -const uint32_t numBlockBinLimit = 32; - -/* - * The identifier to make sure that memory is allocated by scalable_malloc. - */ -const uint64_t theMallocUniqueID=0xE3C7AF89A1E2D8C1ULL; - -/********* The data structures and global objects **************/ - -struct FreeObject { - FreeObject *next; -}; - -/* - * The following constant is used to define the size of struct Block, the block header. - * The intent is to have the size of a Block multiple of the cache line size, this allows us to - * get good alignment at the cost of some overhead equal to the amount of padding included in the Block. - */ - -const int blockHeaderAlignment = 64; // a common size of a cache line - -struct Block; - -/* The 'next' field in the block header has to maintain some invariants: - * it needs to be on a 16K boundary and the first field in the block. - * Any value stored there needs to have the lower 14 bits set to 0 - * so that various assert work. This means that if you want to smash this memory - * for debugging purposes you will need to obey this invariant. - * The total size of the header needs to be a power of 2 to simplify - * the alignment requirements. For now it is a 128 byte structure. - * To avoid false sharing, the fields changed only locally are separated - * from the fields changed by foreign threads. - * Changing the size of the block header would require to change - * some bin allocation sizes, in particular "fitting" sizes (see above). - */ - -struct LocalBlockFields { - Block *next; /* This field needs to be on a 16K boundary and the first field in the block - for LIFO lists to work. */ - uint64_t mallocUniqueID; /* The field to identify memory allocated by scalable_malloc */ - Block *previous; /* Use double linked list to speed up removal */ - unsigned int objectSize; - unsigned int owner; - FreeObject *bumpPtr; /* Bump pointer moves from the end to the beginning of a block */ - FreeObject *freeList; - unsigned int allocatedCount; /* Number of objects allocated (obviously by the owning thread) */ - unsigned int isFull; -}; - -struct Block : public LocalBlockFields { - size_t __pad_local_fields[(blockHeaderAlignment-sizeof(LocalBlockFields))/sizeof(size_t)]; - FreeObject *publicFreeList; - Block *nextPrivatizable; - size_t __pad_public_fields[(blockHeaderAlignment-2*sizeof(void*))/sizeof(size_t)]; -}; - -struct Bin { - Block *activeBlk; - Block *mailbox; - MallocMutex mailLock; -}; - -/* - * The size of the TLS should be enough to hold twice as many as numBlockBinLimit pointers - * the first sequence of pointers is for lists of blocks to allocate from - * the second sequence is for lists of blocks that have non-empty publicFreeList - */ -const uint32_t tlsSize = numBlockBinLimit * sizeof(Bin); - -/* - * This is a LIFO linked list that one can init, push or pop from - */ -static LifoQueue freeBlockList; - -/* - * When a block that is not completely free is returned for reuse by other threads - * this is where the block goes. - * - */ - -static char globalBinSpace[sizeof(LifoQueue)*numBlockBinLimit]; -static LifoQueue* globalSizeBins = (LifoQueue*)globalBinSpace; - -/********* End of the data structures **************/ - -/********** Various numeric parameters controlling allocations ********/ - -/* - * blockSize - the size of a block, it must be larger than maxSegregatedObjectSize. - * - */ -const uintptr_t blockSize = 16*1024; - -/* - * There are bins for all 8 byte aligned objects less than this segregated size; 8 bins in total - */ -const uint32_t minSmallObjectIndex = 0; -const uint32_t numSmallObjectBins = 8; -const uint32_t maxSmallObjectSize = 64; - -/* - * There are 4 bins between each couple of powers of 2 [64-128-256-...] - * from maxSmallObjectSize till this size; 16 bins in total - */ -const uint32_t minSegregatedObjectIndex = minSmallObjectIndex+numSmallObjectBins; -const uint32_t numSegregatedObjectBins = 16; -const uint32_t maxSegregatedObjectSize = 1024; - -/* - * And there are 5 bins with the following allocation sizes: 1792, 2688, 3968, 5376, 8064. - * They selected to fit 9, 6, 4, 3, and 2 sizes per a block, and also are multiples of 128. - * If sizeof(Block) changes from 128, these sizes require close attention! - */ -const uint32_t minFittingIndex = minSegregatedObjectIndex+numSegregatedObjectBins; -const uint32_t numFittingBins = 5; - -const uint32_t fittingAlignment = 128; - -#define SET_FITTING_SIZE(N) ( (blockSize-sizeof(Block))/N ) & ~(fittingAlignment-1) -const uint32_t fittingSize1 = SET_FITTING_SIZE(9); -const uint32_t fittingSize2 = SET_FITTING_SIZE(6); -const uint32_t fittingSize3 = SET_FITTING_SIZE(4); -const uint32_t fittingSize4 = SET_FITTING_SIZE(3); -const uint32_t fittingSize5 = SET_FITTING_SIZE(2); -#undef SET_FITTING_SIZE - -/* - * Objects of this size and larger are considered large objects. - */ -const uint32_t minLargeObjectSize = fittingSize5 + 1; - -const uint32_t numBlockBins = minFittingIndex+numFittingBins; - -/* - * Get virtual memory in pieces of this size: 0x0100000 is 1 megabyte decimal - */ -static size_t mmapRequestSize = 0x0100000; - -/********** End of numeric parameters controlling allocations *********/ - -#if __INTEL_COMPILER || _MSC_VER -#define NOINLINE(decl) __declspec(noinline) decl -#elif __GNUC__ -#define NOINLINE(decl) decl __attribute__ ((noinline)) -#else -#define NOINLINE(decl) decl -#endif - -static NOINLINE( Block* getPublicFreeListBlock(Bin* bin) ); -static NOINLINE( void moveBlockToBinFront(Block *block) ); -static NOINLINE( void processLessUsedBlock(Block *block) ); - -#undef NOINLINE - -/*********** Code to acquire memory from the OS or other executive ****************/ - -#if USE_DEFAULT_MEMORY_MAPPING -#include "MapMemory.h" -#else -/* assume MapMemory and UnmapMemory are customized */ -#endif - -/* - * Returns 0 if failure for any reason - * otherwise returns a pointer to the newly available memory. - */ -static void* getMemory (size_t bytes) -{ - void *result = 0; - // TODO: either make sure the assertion below is always valid, or remove it. - /*MALLOC_ASSERT( bytes>=minLargeObjectSize, "request too small" );*/ -#if MEMORY_MAPPING_USES_MALLOC - recursive_malloc_call_protector scoped(/*condition=*/malloc_proxy); -#endif - result = MapMemory(bytes); -#if MALLOC_TRACE - if (!result) { - TRACEF(( "[ScalableMalloc trace] getMemory unsuccess, can't get %d bytes from OS\n", bytes )); - } else { - TRACEF(( "[ScalableMalloc trace] - getMemory success returning %p\n", result )); - } -#endif - return result; -} - -#if !USE_MALLOC_FOR_LARGE_OBJECT -static void returnMemory(void *area, size_t bytes) -{ - int retcode = UnmapMemory(area, bytes); -#if MALLOC_TRACE - if (retcode) { - TRACEF(( "[ScalableMalloc trace] returnMemory unsuccess for %p; perhaps it has already been freed or was never allocated.\n", area )); - } -#endif - return; -} -#endif /* USE_MALLOC_FOR_LARGE_OBJECT */ - -/********* End memory acquisition code ********************************/ - -/********* Now some rough utility code to deal with indexing the size bins. **************/ - -/* - * Given a number return the highest non-zero bit in it. It is intended to work with 32-bit values only. - * Moreover, on IPF, for sake of simplicity and performance, it is narrowed to only serve for 64 to 1023. - * This is enough for current algorithm of distribution of sizes among bins. - */ -#if _WIN64 && _MSC_VER>=1400 && !__INTEL_COMPILER -extern "C" unsigned char _BitScanReverse( unsigned long* i, unsigned long w ); -#pragma intrinsic(_BitScanReverse) -#endif -static inline unsigned int highestBitPos(unsigned int n) -{ - unsigned int pos; -#if __ARCH_x86_32||__ARCH_x86_64 - -# if __linux__||__APPLE__||__FreeBSD__ || __sun - __asm__ ("bsr %1,%0" : "=r"(pos) : "r"(n)); -# elif (_WIN32 && (!_WIN64 || __INTEL_COMPILER)) - __asm - { - bsr eax, n - mov pos, eax - } -# elif _WIN64 && _MSC_VER>=1400 - _BitScanReverse((unsigned long*)&pos, (unsigned long)n); -# else -# error highestBitPos() not implemented for this platform -# endif - -#elif __ARCH_ipf || __ARCH_other - static unsigned int bsr[16] = {0,6,7,7,8,8,8,8,9,9,9,9,9,9,9,9}; - MALLOC_ASSERT( n>=64 && n<1024, ASSERT_TEXT ); - pos = bsr[ n>>6 ]; -#else -# error highestBitPos() not implemented for this platform -#endif /* __ARCH_* */ - return pos; -} - -/* - * Depending on indexRequest, for a given size return either the index into the bin - * for objects of this size, or the actual size of objects in this bin. - */ -template<bool indexRequest> -static unsigned int getIndexOrObjectSize (unsigned int size) -{ - if (size <= maxSmallObjectSize) { // selection from 4/8/16/24/32/40/48/56/64 - /* Index 0 holds up to 8 bytes, Index 1 16 and so forth */ - return indexRequest ? (size - 1) >> 3 : alignUp(size,8); - } - else if (size <= maxSegregatedObjectSize ) { // 80/96/112/128 / 160/192/224/256 / 320/384/448/512 / 640/768/896/1024 - unsigned int order = highestBitPos(size-1); // which group of bin sizes? - MALLOC_ASSERT( 6<=order && order<=9, ASSERT_TEXT ); - if (indexRequest) - return minSegregatedObjectIndex - (4*6) - 4 + (4*order) + ((size-1)>>(order-2)); - else { - unsigned int alignment = 128 >> (9-order); // alignment in the group - MALLOC_ASSERT( alignment==16 || alignment==32 || alignment==64 || alignment==128, ASSERT_TEXT ); - return alignUp(size,alignment); - } - } - else { - if( size <= fittingSize3 ) { - if( size <= fittingSize2 ) { - if( size <= fittingSize1 ) - return indexRequest ? minFittingIndex : fittingSize1; - else - return indexRequest ? minFittingIndex+1 : fittingSize2; - } else - return indexRequest ? minFittingIndex+2 : fittingSize3; - } else { - if( size <= fittingSize5 ) { - if( size <= fittingSize4 ) - return indexRequest ? minFittingIndex+3 : fittingSize4; - else - return indexRequest ? minFittingIndex+4 : fittingSize5; - } else { - MALLOC_ASSERT( 0,ASSERT_TEXT ); // this should not happen - return ~0U; - } - } - } -} - -static unsigned int getIndex (unsigned int size) -{ - return getIndexOrObjectSize</*indexRequest*/true>(size); -} - -static unsigned int getObjectSize (unsigned int size) -{ - return getIndexOrObjectSize</*indexRequest*/false>(size); -} - -/* - * Initialization code. - * - */ - -/* - * Big Blocks are the blocks we get from the OS or some similar place using getMemory above. - * They are placed on the freeBlockList once they are acquired. - */ - -static inline void *alignBigBlock(void *unalignedBigBlock) -{ - void *alignedBigBlock; - /* align the entireHeap so all blocks are aligned. */ - alignedBigBlock = alignUp(unalignedBigBlock, blockSize); - return alignedBigBlock; -} - -/* Divide the big block into smaller bigBlocks that hold this many blocks. - * This is done since we really need a lot of blocks on the freeBlockList or there will be - * contention problems. - */ -const unsigned int blocksPerBigBlock = 16; - -/* Returns 0 if unsuccessful, otherwise 1. */ -static int mallocBigBlock() -{ - void *unalignedBigBlock; - void *alignedBigBlock; - void *bigBlockCeiling; - Block *splitBlock; - void *splitEdge; - size_t bigBlockSplitSize; - - unalignedBigBlock = getMemory(mmapRequestSize); - - if (!unalignedBigBlock) { - TRACEF(( "[ScalableMalloc trace] in mallocBigBlock, getMemory returns 0\n" )); - /* We can't get any more memory from the OS or executive so return 0 */ - return 0; - } - - alignedBigBlock = alignBigBlock(unalignedBigBlock); - bigBlockCeiling = (void*)((uintptr_t)unalignedBigBlock + mmapRequestSize); - - bigBlockSplitSize = blocksPerBigBlock * blockSize; - - splitBlock = (Block*)alignedBigBlock; - - while ( ((uintptr_t)splitBlock + blockSize) <= (uintptr_t)bigBlockCeiling ) { - splitEdge = (void*)((uintptr_t)splitBlock + bigBlockSplitSize); - if( splitEdge > bigBlockCeiling) { - splitEdge = alignDown(bigBlockCeiling, blockSize); - } - splitBlock->bumpPtr = (FreeObject*)splitEdge; - freeBlockList.push((void**) splitBlock); - splitBlock = (Block*)splitEdge; - } - - TRACEF(( "[ScalableMalloc trace] in mallocBigBlock returning 1\n" )); - return 1; -} - -/* - * The malloc routines themselves need to be able to occasionally malloc some space, - * in order to set up the structures used by the thread local structures. This - * routine preforms that fuctions. - */ - -/* - * Forward Refs - */ -static void initEmptyBlock(Block *block, size_t size); -static Block *getEmptyBlock(size_t size); - -static MallocMutex bootStrapLock; - -static Block *bootStrapBlock = NULL; -static Block *bootStrapBlockUsed = NULL; -static FreeObject *bootStrapObjectList = NULL; - -static void *bootStrapMalloc(size_t size) -{ - FreeObject *result; - - MALLOC_ASSERT( size == tlsSize, ASSERT_TEXT ); - - { // Lock with acquire - MallocMutex::scoped_lock scoped_cs(bootStrapLock); - - if( bootStrapObjectList) { - result = bootStrapObjectList; - bootStrapObjectList = bootStrapObjectList->next; - } else { - if (!bootStrapBlock) { - bootStrapBlock = getEmptyBlock(size); - } - result = bootStrapBlock->bumpPtr; - bootStrapBlock->bumpPtr = (FreeObject *)((uintptr_t)bootStrapBlock->bumpPtr - bootStrapBlock->objectSize); - if ((uintptr_t)bootStrapBlock->bumpPtr < (uintptr_t)bootStrapBlock+sizeof(Block)) { - bootStrapBlock->bumpPtr = NULL; - bootStrapBlock->next = bootStrapBlockUsed; - bootStrapBlockUsed = bootStrapBlock; - bootStrapBlock = NULL; - } - } - } // Unlock with release - - memset (result, 0, size); - return (void*)result; -} - -static void bootStrapFree(void* ptr) -{ - MALLOC_ASSERT( ptr, ASSERT_TEXT ); - { // Lock with acquire - MallocMutex::scoped_lock scoped_cs(bootStrapLock); - ((FreeObject*)ptr)->next = bootStrapObjectList; - bootStrapObjectList = (FreeObject*)ptr; - } // Unlock with release -} - -/********* End rough utility code **************/ - -/********* Thread and block related code *************/ - -#if MALLOC_DEBUG>1 -/* The debug version verifies the TLSBin as needed */ -static void verifyTLSBin (Bin* bin, size_t size) -{ - Block* temp; - Bin* tls; - uint32_t index = getIndex(size); - uint32_t objSize = getObjectSize(size); - - tls = (Bin*)getThreadMallocTLS(); - MALLOC_ASSERT( bin == tls+index, ASSERT_TEXT ); - - if (tls[index].activeBlk) { - MALLOC_ASSERT( tls[index].activeBlk->mallocUniqueID==theMallocUniqueID, ASSERT_TEXT ); - MALLOC_ASSERT( tls[index].activeBlk->owner == getThreadId(), ASSERT_TEXT ); - MALLOC_ASSERT( tls[index].activeBlk->objectSize == objSize, ASSERT_TEXT ); - - for (temp = tls[index].activeBlk->next; temp; temp=temp->next) { - MALLOC_ASSERT( temp!=tls[index].activeBlk, ASSERT_TEXT ); - MALLOC_ASSERT( temp->mallocUniqueID==theMallocUniqueID, ASSERT_TEXT ); - MALLOC_ASSERT( temp->owner == getThreadId(), ASSERT_TEXT ); - MALLOC_ASSERT( temp->objectSize == objSize, ASSERT_TEXT ); - MALLOC_ASSERT( temp->previous->next == temp, ASSERT_TEXT ); - if (temp->next) { - MALLOC_ASSERT( temp->next->previous == temp, ASSERT_TEXT ); - } - } - for (temp = tls[index].activeBlk->previous; temp; temp=temp->previous) { - MALLOC_ASSERT( temp!=tls[index].activeBlk, ASSERT_TEXT ); - MALLOC_ASSERT( temp->mallocUniqueID==theMallocUniqueID, ASSERT_TEXT ); - MALLOC_ASSERT( temp->owner == getThreadId(), ASSERT_TEXT ); - MALLOC_ASSERT( temp->objectSize == objSize, ASSERT_TEXT ); - MALLOC_ASSERT( temp->next->previous == temp, ASSERT_TEXT ); - if (temp->previous) { - MALLOC_ASSERT( temp->previous->next == temp, ASSERT_TEXT ); - } - } - } -} -#else -inline static void verifyTLSBin (Bin*, size_t) {} -#endif /* MALLOC_DEBUG>1 */ - -/* - * Add a block to the start of this tls bin list. - */ -static void pushTLSBin (Bin* bin, Block* block) -{ - /* The objectSize should be defined and not a parameter - because the function is applied to partially filled blocks as well */ - unsigned int size = block->objectSize; - Block* activeBlk; - - MALLOC_ASSERT( block->owner == getThreadId(), ASSERT_TEXT ); - MALLOC_ASSERT( block->objectSize != 0, ASSERT_TEXT ); - MALLOC_ASSERT( block->next == NULL, ASSERT_TEXT ); - MALLOC_ASSERT( block->previous == NULL, ASSERT_TEXT ); - - MALLOC_ASSERT( bin, ASSERT_TEXT ); - verifyTLSBin(bin, size); - activeBlk = bin->activeBlk; - - block->next = activeBlk; - if( activeBlk ) { - block->previous = activeBlk->previous; - activeBlk->previous = block; - if( block->previous ) - block->previous->next = block; - } else { - bin->activeBlk = block; - } - - verifyTLSBin(bin, size); -} - -/* - * Take a block out of its tls bin (e.g. before removal). - */ -static void outofTLSBin (Bin* bin, Block* block) -{ - unsigned int size = block->objectSize; - - MALLOC_ASSERT( block->owner == getThreadId(), ASSERT_TEXT ); - MALLOC_ASSERT( block->objectSize != 0, ASSERT_TEXT ); - - MALLOC_ASSERT( bin, ASSERT_TEXT ); - verifyTLSBin(bin, size); - - if (block == bin->activeBlk) { - bin->activeBlk = block->previous? block->previous : block->next; - } - /* Delink the block */ - if (block->previous) { - MALLOC_ASSERT( block->previous->next == block, ASSERT_TEXT ); - block->previous->next = block->next; - } - if (block->next) { - MALLOC_ASSERT( block->next->previous == block, ASSERT_TEXT ); - block->next->previous = block->previous; - } - block->next = NULL; - block->previous = NULL; - - verifyTLSBin(bin, size); -} - -/* - * Return the bin for the given size. If the TLS bin structure is absent, create it. - */ -static Bin* getAllocationBin(size_t size) -{ - Bin* tls = (Bin*)getThreadMallocTLS(); - if( !tls ) { - MALLOC_ASSERT( tlsSize >= sizeof(Bin) * numBlockBins, ASSERT_TEXT ); - tls = (Bin*) bootStrapMalloc(tlsSize); - /* the block contains zeroes after bootStrapMalloc, so bins are initialized */ -#if MALLOC_DEBUG - for (int i = 0; i < numBlockBinLimit; i++) { - MALLOC_ASSERT( tls[i].activeBlk == 0, ASSERT_TEXT ); - MALLOC_ASSERT( tls[i].mailbox == 0, ASSERT_TEXT ); - } -#endif - setThreadMallocTLS(tls); - } - MALLOC_ASSERT( tls, ASSERT_TEXT ); - return tls+getIndex(size); -} - -const float emptyEnoughRatio = 1.0 / 4.0; /* "Reactivate" a block if this share of its objects is free. */ - -static unsigned int emptyEnoughToUse (Block *mallocBlock) -{ - const float threshold = (blockSize - sizeof(Block)) * (1-emptyEnoughRatio); - - if (mallocBlock->bumpPtr) { - /* If we are still using a bump ptr for this block it is empty enough to use. */ - STAT_increment(mallocBlock->owner, getIndex(mallocBlock->objectSize), examineEmptyEnough); - mallocBlock->isFull = 0; - return 1; - } - - /* allocatedCount shows how many objects in the block are in use; however it still counts - blocks freed by other threads; so prior call to privatizePublicFreeList() is recommended */ - mallocBlock->isFull = (mallocBlock->allocatedCount*mallocBlock->objectSize > threshold)? 1: 0; -#if COLLECT_STATISTICS - if (mallocBlock->isFull) - STAT_increment(mallocBlock->owner, getIndex(mallocBlock->objectSize), examineNotEmpty); - else - STAT_increment(mallocBlock->owner, getIndex(mallocBlock->objectSize), examineEmptyEnough); -#endif - return 1-mallocBlock->isFull; -} - -/* Restore the bump pointer for an empty block that is planned to use */ -static void restoreBumpPtr (Block *block) -{ - MALLOC_ASSERT( block->allocatedCount == 0, ASSERT_TEXT ); - MALLOC_ASSERT( block->publicFreeList == NULL, ASSERT_TEXT ); - STAT_increment(block->owner, getIndex(block->objectSize), freeRestoreBumpPtr); - block->bumpPtr = (FreeObject *)((uintptr_t)block + blockSize - block->objectSize); - block->freeList = NULL; - block->isFull = 0; -} - -#if !(FREELIST_NONBLOCKING) -static MallocMutex publicFreeListLock; // lock for changes of publicFreeList -#endif - -const uintptr_t UNUSABLE = 0x1; -inline bool isSolidPtr( void* ptr ) -{ - return (UNUSABLE|(uintptr_t)ptr)!=UNUSABLE; -} -inline bool isNotForUse( void* ptr ) -{ - return (uintptr_t)ptr==UNUSABLE; -} - -static void freePublicObject (Block *block, FreeObject *objectToFree) -{ - Bin* theBin; - FreeObject *publicFreeList; - -#if FREELIST_NONBLOCKING - FreeObject *temp = block->publicFreeList; - MALLOC_ITT_SYNC_RELEASING(&block->publicFreeList); - do { - publicFreeList = objectToFree->next = temp; - temp = (FreeObject*)AtomicCompareExchange( - (intptr_t&)block->publicFreeList, - (intptr_t)objectToFree, (intptr_t)publicFreeList ); - // no backoff necessary because trying to make change, not waiting for a change - } while( temp != publicFreeList ); -#else - STAT_increment(getThreadId(), ThreadCommonCounters, lockPublicFreeList); - { - MallocMutex::scoped_lock scoped_cs(publicFreeListLock); - publicFreeList = objectToFree->next = block->publicFreeList; - block->publicFreeList = objectToFree; - } -#endif - - if( publicFreeList==NULL ) { - // if the block is abandoned, its nextPrivatizable pointer should be UNUSABLE - // otherwise, it should point to the bin the block belongs to. - // reading nextPrivatizable is thread-safe below, because: - // 1) the executing thread atomically got publicFreeList==NULL and changed it to non-NULL; - // 2) only owning thread can change it back to NULL, - // 3) but it can not be done until the block is put to the mailbox - // So the executing thread is now the only one that can change nextPrivatizable - if( !isNotForUse(block->nextPrivatizable) ) { - MALLOC_ASSERT( block->nextPrivatizable!=NULL, ASSERT_TEXT ); - MALLOC_ASSERT( block->owner!=0, ASSERT_TEXT ); - theBin = (Bin*) block->nextPrivatizable; - MallocMutex::scoped_lock scoped_cs(theBin->mailLock); - block->nextPrivatizable = theBin->mailbox; - theBin->mailbox = block; - } else { - MALLOC_ASSERT( block->owner==0, ASSERT_TEXT ); - } - } - STAT_increment(getThreadId(), ThreadCommonCounters, freeToOtherThread); - STAT_increment(block->owner, getIndex(block->objectSize), freeByOtherThread); -} - -static void privatizePublicFreeList (Block *mallocBlock) -{ - FreeObject *temp, *publicFreeList; - - MALLOC_ASSERT( mallocBlock->owner == getThreadId(), ASSERT_TEXT ); -#if FREELIST_NONBLOCKING - temp = mallocBlock->publicFreeList; - do { - publicFreeList = temp; - temp = (FreeObject*)AtomicCompareExchange( - (intptr_t&)mallocBlock->publicFreeList, - 0, (intptr_t)publicFreeList); - // no backoff necessary because trying to make change, not waiting for a change - } while( temp != publicFreeList ); - MALLOC_ITT_SYNC_ACQUIRED(&mallocBlock->publicFreeList); -#else - STAT_increment(mallocBlock->owner, ThreadCommonCounters, lockPublicFreeList); - { - MallocMutex::scoped_lock scoped_cs(publicFreeListLock); - publicFreeList = mallocBlock->publicFreeList; - mallocBlock->publicFreeList = NULL; - } - temp = publicFreeList; -#endif - - MALLOC_ASSERT( publicFreeList && publicFreeList==temp, ASSERT_TEXT ); // there should be something in publicFreeList! - if( !isNotForUse(temp) ) { // return/getPartialBlock could set it to UNUSABLE - MALLOC_ASSERT( mallocBlock->allocatedCount <= (blockSize-sizeof(Block))/mallocBlock->objectSize, ASSERT_TEXT ); - /* other threads did not change the counter freeing our blocks */ - mallocBlock->allocatedCount--; - while( isSolidPtr(temp->next) ){ // the list will end with either NULL or UNUSABLE - temp = temp->next; - mallocBlock->allocatedCount--; - } - MALLOC_ASSERT( mallocBlock->allocatedCount < (blockSize-sizeof(Block))/mallocBlock->objectSize, ASSERT_TEXT ); - /* merge with local freeList */ - temp->next = mallocBlock->freeList; - mallocBlock->freeList = publicFreeList; - STAT_increment(mallocBlock->owner, getIndex(mallocBlock->objectSize), allocPrivatized); - } -} - -static Block* getPublicFreeListBlock (Bin* bin) -{ - Block* block; - MALLOC_ASSERT( bin, ASSERT_TEXT ); -// the counter should be changed STAT_increment(getThreadId(), ThreadCommonCounters, lockPublicFreeList); - { - MallocMutex::scoped_lock scoped_cs(bin->mailLock); - block = bin->mailbox; - if( block ) { - MALLOC_ASSERT( block->owner == getThreadId(), ASSERT_TEXT ); - MALLOC_ASSERT( !isNotForUse(block->nextPrivatizable), ASSERT_TEXT ); - bin->mailbox = block->nextPrivatizable; - block->nextPrivatizable = (Block*) bin; - } - } - if( block ) { - MALLOC_ASSERT( isSolidPtr(block->publicFreeList), ASSERT_TEXT ); - privatizePublicFreeList(block); - } - return block; -} - -static Block *getPartialBlock(Bin* bin, unsigned int size) -{ - Block *result; - MALLOC_ASSERT( bin, ASSERT_TEXT ); - unsigned int index = getIndex(size); - result = (Block *) globalSizeBins[index].pop(); - if (result) { - MALLOC_ASSERT( result->mallocUniqueID==theMallocUniqueID, ASSERT_TEXT ); - result->next = NULL; - result->previous = NULL; - MALLOC_ASSERT( result->publicFreeList!=NULL, ASSERT_TEXT ); - /* There is not a race here since no other thread owns this block */ - MALLOC_ASSERT( result->owner == 0, ASSERT_TEXT ); - result->owner = getThreadId(); - // It is safe to change nextPrivatizable, as publicFreeList is not null - MALLOC_ASSERT( isNotForUse(result->nextPrivatizable), ASSERT_TEXT ); - result->nextPrivatizable = (Block*)bin; - // the next call is required to change publicFreeList to 0 - privatizePublicFreeList(result); - if( result->allocatedCount ) { - // check its fullness and set result->isFull - emptyEnoughToUse(result); - } else { - restoreBumpPtr(result); - } - MALLOC_ASSERT( !isNotForUse(result->publicFreeList), ASSERT_TEXT ); - STAT_increment(result->owner, index, allocBlockPublic); - } - return result; -} - -static void returnPartialBlock(Bin* bin, Block *block) -{ - unsigned int index = getIndex(block->objectSize); - MALLOC_ASSERT( bin, ASSERT_TEXT ); - MALLOC_ASSERT( block->owner==getThreadId(), ASSERT_TEXT ); - STAT_increment(block->owner, index, freeBlockPublic); - // need to set publicFreeList to non-zero, so other threads - // will not change nextPrivatizable and it can be zeroed. - if ((intptr_t)block->nextPrivatizable==(intptr_t)bin) { - void* oldval; -#if FREELIST_NONBLOCKING - oldval = (void*)AtomicCompareExchange((intptr_t&)block->publicFreeList, (intptr_t)UNUSABLE, 0); -#else - STAT_increment(block->owner, ThreadCommonCounters, lockPublicFreeList); - { - MallocMutex::scoped_lock scoped_cs(publicFreeListLock); - if ( (oldval=block->publicFreeList)==NULL ) - (uintptr_t&)(block->publicFreeList) = UNUSABLE; - } -#endif - if ( oldval!=NULL ) { - // another thread freed an object; we need to wait until it finishes. - // I believe there is no need for exponential backoff, as the wait here is not for a lock; - // but need to yield, so the thread we wait has a chance to run. - int count = 256; - while( (intptr_t)const_cast<Block* volatile &>(block->nextPrivatizable)==(intptr_t)bin ) { - if (--count==0) { - do_yield(); - count = 256; - } - } - } - } else { - MALLOC_ASSERT( isSolidPtr(block->publicFreeList), ASSERT_TEXT ); - } - MALLOC_ASSERT( block->publicFreeList!=NULL, ASSERT_TEXT ); - // now it is safe to change our data - block->previous = NULL; - block->owner = 0; - // it is caller responsibility to ensure that the list of blocks - // formed by nextPrivatizable pointers is kept consistent if required. - // if only called from thread shutdown code, it does not matter. - (uintptr_t&)(block->nextPrivatizable) = UNUSABLE; - globalSizeBins[index].push((void **)block); -} - -static void initEmptyBlock(Block *block, size_t size) -{ - // Having getIndex and getObjectSize called next to each other - // allows better compiler optimization as they basically share the code. - unsigned int index = getIndex(size); - unsigned int objectSize = getObjectSize(size); - Bin* tls = (Bin*)getThreadMallocTLS(); -#if MALLOC_DEBUG - memset (block, 0x0e5, blockSize); -#endif - block->mallocUniqueID = theMallocUniqueID; - block->next = NULL; - block->previous = NULL; - block->objectSize = objectSize; - block->owner = getThreadId(); - // bump pointer should be prepared for first allocation - thus mode it down to objectSize - block->bumpPtr = (FreeObject *)((uintptr_t)block + blockSize - objectSize); - block->freeList = NULL; - block->allocatedCount = 0; - block->isFull = 0; - - block->publicFreeList = NULL; - // each block should have the address where the head of the list of "privatizable" blocks is kept - // the only exception is a block for boot strap which is initialized when TLS is yet NULL - block->nextPrivatizable = tls? (Block*)(tls + index) : NULL; - TRACEF(( "[ScalableMalloc trace] Empty block %p is initialized, owner is %d, objectSize is %d, bumpPtr is %p\n", - block, block->owner, block->objectSize, block->bumpPtr )); - } - -/* Return an empty uninitialized block in a non-blocking fashion. */ -static Block *getEmptyBlock(size_t size) -{ - Block *result; - Block *bigBlock; - - result = NULL; - - bigBlock = (Block *) freeBlockList.pop(); - - while (!bigBlock) { - /* We are out of blocks so go to the OS and get another one */ - if (!mallocBigBlock()) { - return NULL; - } - bigBlock = (Block *) freeBlockList.pop(); - } - - // check alignment - MALLOC_ASSERT( isAligned( bigBlock, blockSize ), ASSERT_TEXT ); - MALLOC_ASSERT( isAligned( bigBlock->bumpPtr, blockSize ), ASSERT_TEXT ); - // block should be at least as big as blockSize; otherwise the previous block can be damaged. - MALLOC_ASSERT( (uintptr_t)bigBlock->bumpPtr >= (uintptr_t)bigBlock + blockSize, ASSERT_TEXT ); - bigBlock->bumpPtr = (FreeObject *)((uintptr_t)bigBlock->bumpPtr - blockSize); - result = (Block *)bigBlock->bumpPtr; - if ( result!=bigBlock ) { - TRACEF(( "[ScalableMalloc trace] Pushing partial rest of block back on.\n" )); - freeBlockList.push((void **)bigBlock); - } - initEmptyBlock(result, size); - STAT_increment(result->owner, getIndex(result->objectSize), allocBlockNew); - - return result; -} - -/* We have a block give it back to the malloc block manager */ -static void returnEmptyBlock (Block *block, bool keepTheBin = true) -{ - // it is caller's responsibility to ensure no data is lost before calling this - MALLOC_ASSERT( block->allocatedCount==0, ASSERT_TEXT ); - MALLOC_ASSERT( block->publicFreeList==NULL, ASSERT_TEXT ); - if (keepTheBin) { - /* We should keep the TLS bin structure */ - MALLOC_ASSERT( block->next == NULL, ASSERT_TEXT ); - MALLOC_ASSERT( block->previous == NULL, ASSERT_TEXT ); - } - STAT_increment(block->owner, getIndex(block->objectSize), freeBlockBack); - - block->publicFreeList = NULL; - block->nextPrivatizable = NULL; - - block->mallocUniqueID=0; - block->next = NULL; - block->previous = NULL; - block->objectSize = 0; - block->owner = (unsigned)-1; - // for an empty block, bump pointer should point right after the end of the block - block->bumpPtr = (FreeObject *)((uintptr_t)block + blockSize); - block->freeList = NULL; - block->allocatedCount = 0; - block->isFull = 0; - freeBlockList.push((void **)block); -} - -inline static Block* getActiveBlock( Bin* bin ) -{ - MALLOC_ASSERT( bin, ASSERT_TEXT ); - return bin->activeBlk; -} - -inline static void setActiveBlock (Bin* bin, Block *block) -{ - MALLOC_ASSERT( bin, ASSERT_TEXT ); - MALLOC_ASSERT( block->owner == getThreadId(), ASSERT_TEXT ); - // it is the caller responsibility to keep bin consistence (i.e. ensure this block is in the bin list) - bin->activeBlk = block; -} - -inline static Block* setPreviousBlockActive( Bin* bin ) -{ - MALLOC_ASSERT( bin && bin->activeBlk, ASSERT_TEXT ); - Block* temp = bin->activeBlk->previous; - if( temp ) { - MALLOC_ASSERT( temp->isFull == 0, ASSERT_TEXT ); - bin->activeBlk = temp; - } - return temp; -} - -/********* End thread related code *************/ - -/********* Library initialization *************/ - -//! Value indicating the state of initialization. -/* 0 = initialization not started. - * 1 = initialization started but not finished. - * 2 = initialization finished. - * In theory, we only need values 0 and 2. But value 1 is nonetheless - * useful for detecting errors in the double-check pattern. - */ -static int mallocInitialized; // implicitly initialized to 0 -static MallocMutex initAndShutMutex; - -extern "C" void mallocThreadShutdownNotification(void*); - -/* - * Allocator initialization routine; - * it is called lazily on the very first scalable_malloc call. - */ -static void initMemoryManager() -{ - TRACEF(( "[ScalableMalloc trace] sizeof(Block) is %d (expected 128); sizeof(uintptr_t) is %d\n", - sizeof(Block), sizeof(uintptr_t) )); - MALLOC_ASSERT( 2*blockHeaderAlignment == sizeof(Block), ASSERT_TEXT ); - -// Create keys for thread-local storage and for thread id -// TODO: add error handling -#if USE_WINTHREAD - TLS_pointer_key = TlsAlloc(); - Tid_key = TlsAlloc(); -#else - int status1 = pthread_key_create( &TLS_pointer_key, mallocThreadShutdownNotification ); - int status2 = pthread_key_create( &Tid_key, NULL ); - if ( status1 || status2 ) { - fprintf (stderr, "The memory manager cannot create tls key during initialisation; exiting \n"); - exit(1); - } -#endif /* USE_WINTHREAD */ -#if COLLECT_STATISTICS - if (NULL != getenv("TBB_MALLOC_STAT")) - reportAllocationStatistics = true; -#endif - TRACEF(( "[ScalableMalloc trace] Asking for a mallocBigBlock\n" )); - if (!mallocBigBlock()) { - fprintf (stderr, "The memory manager cannot access sufficient memory to initialize; exiting \n"); - exit(1); - } -} - -//! Ensures that initMemoryManager() is called once and only once. -/** Does not return until initMemoryManager() has been completed by a thread. - There is no need to call this routine if mallocInitialized==2 . */ -static inline void checkInitialization() -{ - if (mallocInitialized==2) return; - MallocMutex::scoped_lock lock( initAndShutMutex ); - if (mallocInitialized!=2) { - MALLOC_ASSERT( mallocInitialized==0, ASSERT_TEXT ); - mallocInitialized = 1; - initMemoryManager(); -#ifdef MALLOC_EXTRA_INITIALIZATION - recursive_malloc_call_protector scoped(/*condition=*/malloc_proxy); - MALLOC_EXTRA_INITIALIZATION; -#endif - MALLOC_ASSERT( mallocInitialized==1, ASSERT_TEXT ); - mallocInitialized = 2; - } - MALLOC_ASSERT( mallocInitialized==2, ASSERT_TEXT ); /* It can't be 0 or I would have initialized it */ -} - -/********* End library initialization *************/ - -/********* The malloc show *************/ - -/* - * The program wants a large object that we are not prepared to deal with. - * so we pass the problem on to the OS. Large Objects are the only objects in - * the system that begin on a 16K byte boundary since the blocks used for smaller - * objects have the Block structure at each 16K boundary. - * - */ - -struct LargeObjectHeader { - void *unalignedResult; /* The base of the memory returned from getMemory, this is what is used to return this to the OS */ - size_t unalignedSize; /* The size that was requested from getMemory */ - uint64_t mallocUniqueID; /* The field to check whether the memory was allocated by scalable_malloc */ - size_t objectSize; /* The size originally requested by a client */ -}; - -/* A predicate checks whether an object starts on blockSize boundary */ -static inline unsigned int isLargeObject(void *object) -{ - return isAligned(object, blockSize); -} - -static inline void *mallocLargeObject (size_t size, size_t alignment) -{ - void *alignedArea; - void *unalignedArea; - LargeObjectHeader *header; - - // TODO: can the requestedSize be optimized somehow? - size_t requestedSize = size + sizeof(LargeObjectHeader) + alignment; -#if USE_MALLOC_FOR_LARGE_OBJECT -#if MALLOC_LD_PRELOAD - if (malloc_proxy) { - if ( original_malloc_found ){ - unalignedArea = (*original_malloc_ptr)(requestedSize); - }else{ - MALLOC_ASSERT( 0, ASSERT_TEXT ); - return NULL; - } - } else -#endif /* MALLOC_LD_PRELOAD */ - unalignedArea = malloc(requestedSize); -#else - unalignedArea = getMemory(requestedSize); -#endif /* USE_MALLOC_FOR_LARGE_OBJECT */ - if (!unalignedArea) { - /* We can't get any more memory from the OS or executive so return 0 */ - return 0; - } - alignedArea = (void*) alignUp((uintptr_t)unalignedArea+sizeof(LargeObjectHeader), - alignment); - header = (LargeObjectHeader*) ((uintptr_t)alignedArea-sizeof(LargeObjectHeader)); - header->unalignedResult = unalignedArea; - header->mallocUniqueID=theMallocUniqueID; - header->unalignedSize = requestedSize; - header->objectSize = size; - MALLOC_ASSERT( isLargeObject(alignedArea), ASSERT_TEXT ); - STAT_increment(getThreadId(), ThreadCommonCounters, allocLargeSize); - return alignedArea; -} - -static inline void freeLargeObject(void *object) -{ - LargeObjectHeader *header; - STAT_increment(getThreadId(), ThreadCommonCounters, freeLargeSize); - header = (LargeObjectHeader *)((uintptr_t)object - sizeof(LargeObjectHeader)); - header->mallocUniqueID = 0; -#if USE_MALLOC_FOR_LARGE_OBJECT -#if MALLOC_LD_PRELOAD - if (malloc_proxy) { - if ( original_malloc_found ){ - original_free_ptr(header->unalignedResult); - }else{ - MALLOC_ASSERT( 0, ASSERT_TEXT ); - } - } else -#endif /* MALLOC_LD_PRELOAD */ - free(header->unalignedResult); -#else - returnMemory(header->unalignedResult, header->unalignedSize); -#endif /* USE_MALLOC_FOR_LARGE_OBJECT */ -} - -static FreeObject *allocateFromFreeList(Block *mallocBlock) -{ - FreeObject *result; - - if (!mallocBlock->freeList) { - return NULL; - } - - result = mallocBlock->freeList; - MALLOC_ASSERT( result, ASSERT_TEXT ); - - mallocBlock->freeList = result->next; - MALLOC_ASSERT( mallocBlock->allocatedCount < (blockSize-sizeof(Block))/mallocBlock->objectSize, ASSERT_TEXT ); - mallocBlock->allocatedCount++; - STAT_increment(mallocBlock->owner, getIndex(mallocBlock->objectSize), allocFreeListUsed); - - return result; -} - -static FreeObject *allocateFromBumpPtr(Block *mallocBlock) -{ - FreeObject *result = mallocBlock->bumpPtr; - if (result) { - mallocBlock->bumpPtr = - (FreeObject *) ((uintptr_t) mallocBlock->bumpPtr - mallocBlock->objectSize); - if ( (uintptr_t)mallocBlock->bumpPtr < (uintptr_t)mallocBlock+sizeof(Block) ) { - mallocBlock->bumpPtr = NULL; - } - MALLOC_ASSERT( mallocBlock->allocatedCount < (blockSize-sizeof(Block))/mallocBlock->objectSize, ASSERT_TEXT ); - mallocBlock->allocatedCount++; - STAT_increment(mallocBlock->owner, getIndex(mallocBlock->objectSize), allocBumpPtrUsed); - } - return result; -} - -inline static FreeObject* allocateFromBlock( Block *mallocBlock ) -{ - FreeObject *result; - - MALLOC_ASSERT( mallocBlock->owner == getThreadId(), ASSERT_TEXT ); - - /* for better cache locality, first looking in the free list. */ - if ( (result = allocateFromFreeList(mallocBlock)) ) { - return result; - } - MALLOC_ASSERT( !mallocBlock->freeList, ASSERT_TEXT ); - - /* if free list is empty, try thread local bump pointer allocation. */ - if ( (result = allocateFromBumpPtr(mallocBlock)) ) { - return result; - } - MALLOC_ASSERT( !mallocBlock->bumpPtr, ASSERT_TEXT ); - - /* the block is considered full. */ - mallocBlock->isFull = 1; - return NULL; -} - -static void moveBlockToBinFront(Block *block) -{ - Bin* bin = getAllocationBin(block->objectSize); - /* move the block to the front of the bin */ - outofTLSBin(bin, block); - pushTLSBin(bin, block); -} - -static void processLessUsedBlock(Block *block) -{ - Bin* bin = getAllocationBin(block->objectSize); - if (block != getActiveBlock(bin) && block != getActiveBlock(bin)->previous ) { - /* We are not actively using this block; return it to the general block pool */ - outofTLSBin(bin, block); - returnEmptyBlock(block); - } else { - /* all objects are free - let's restore the bump pointer */ - restoreBumpPtr(block); - } -} - -/* - * All aligned allocations fall into one of the following categories: - * 1. if both request size and alignment are <= maxSegregatedObjectSize, - * we just align the size up, and request this amount, because for every size - * aligned to some power of 2, the allocated object is at least that aligned. - * 2. for bigger size, check if already guaranteed fittingAlignment is enough. - * 3. if size+alignment<minLargeObjectSize, we take an object of fittingSizeN and align - * its address up; given such pointer, scalable_free could find the real object. - * 4. otherwise, aligned large object is allocated. - */ -static void *allocateAligned(size_t size, size_t alignment) -{ - MALLOC_ASSERT( isPowerOfTwo(alignment), ASSERT_TEXT ); - - void *result; - if (size<=maxSegregatedObjectSize && alignment<=maxSegregatedObjectSize) - result = scalable_malloc(alignUp(size? size: sizeof(size_t), alignment)); - else if (alignment<=fittingAlignment) - result = scalable_malloc(size); - else if (size+alignment < minLargeObjectSize) { - void *unaligned = scalable_malloc(size+alignment); - if (!unaligned) return NULL; - result = alignUp(unaligned, alignment); - } else { - /* This can be the first allocation call. */ - checkInitialization(); - /* To correctly detect kind of allocation in scalable_free we need - to distinguish memory allocated as large object. - This is done via alignment that is greater than can be found in Block. - */ - result = mallocLargeObject(size, blockSize>alignment? blockSize: alignment); - } - - MALLOC_ASSERT( isAligned(result, alignment), ASSERT_TEXT ); - return result; -} - -static void *reallocAligned(void *ptr, size_t size, size_t alignment = 0) -{ - void *result; - size_t copySize; - - if (isLargeObject(ptr)) { - LargeObjectHeader* loh = (LargeObjectHeader *)((uintptr_t)ptr - sizeof(LargeObjectHeader)); - MALLOC_ASSERT( loh->mallocUniqueID==theMallocUniqueID, ASSERT_TEXT ); - copySize = loh->unalignedSize-((uintptr_t)ptr-(uintptr_t)loh->unalignedResult); - if (size <= copySize && (0==alignment || isAligned(ptr, alignment))) { - loh->objectSize = size; - return ptr; - } else { - copySize = loh->objectSize; - result = alignment ? allocateAligned(size, alignment) : scalable_malloc(size); - } - } else { - Block* block = (Block *)alignDown(ptr, blockSize); - MALLOC_ASSERT( block->mallocUniqueID==theMallocUniqueID, ASSERT_TEXT ); - copySize = block->objectSize; - if (size <= copySize && (0==alignment || isAligned(ptr, alignment))) { - return ptr; - } else { - result = alignment ? allocateAligned(size, alignment) : scalable_malloc(size); - } - } - if (result) { - memcpy(result, ptr, copySize<size? copySize: size); - scalable_free(ptr); - } - return result; -} - -/* A predicate checks if an object is properly placed inside its block */ -static inline bool isProperlyPlaced(const void *object, const Block *block) -{ - return 0 == ((uintptr_t)block + blockSize - (uintptr_t)object) % block->objectSize; -} - -/* Finds the real object inside the block */ -static inline FreeObject *findAllocatedObject(const void *address, const Block *block) -{ - // calculate offset from the end of the block space - uintptr_t offset = (uintptr_t)block + blockSize - (uintptr_t)address; - MALLOC_ASSERT( offset<blockSize-sizeof(Block), ASSERT_TEXT ); - // find offset difference from a multiple of allocation size - offset %= block->objectSize; - // and move the address down to where the real object starts. - return (FreeObject*)((uintptr_t)address - (offset? block->objectSize-offset: 0)); -} - -} // namespace Internal -} // namespace ThreadingSubstrate - -using namespace ThreadingSubstrate; -using namespace ThreadingSubstrate::Internal; - -/* - * When a thread is shutting down this routine should be called to remove all the thread ids - * from the malloc blocks and replace them with a NULL thread id. - * - */ -#if MALLOC_TRACE -static unsigned int threadGoingDownCount = 0; -#endif - -/* - * for pthreads, the function is set as a callback in pthread_key_create for TLS bin. - * it will be automatically called at thread exit with the key value as the argument. - * - * for Windows, it should be called directly e.g. from DllMain; the argument can be NULL - * one should include "TypeDefinitions.h" for the declaration of this function. -*/ -extern "C" void mallocThreadShutdownNotification(void* arg) -{ - Bin *tls; - Block *threadBlock; - Block *threadlessBlock; - unsigned int index; - - { - MallocMutex::scoped_lock lock( initAndShutMutex ); - if ( mallocInitialized == 0 ) return; - } - - TRACEF(( "[ScalableMalloc trace] Thread id %d blocks return start %d\n", - getThreadId(), threadGoingDownCount++ )); -#ifdef USE_WINTHREAD - tls = (Bin*)getThreadMallocTLS(); -#else - tls = (Bin*)arg; -#endif - if (tls) { - for (index = 0; index < numBlockBins; index++) { - if (tls[index].activeBlk==NULL) - continue; - threadlessBlock = tls[index].activeBlk->previous; - while (threadlessBlock) { - threadBlock = threadlessBlock->previous; - if (threadlessBlock->allocatedCount==0 && threadlessBlock->publicFreeList==NULL) { - /* we destroy the thread, no need to keep its TLS bin -> the second param is false */ - returnEmptyBlock(threadlessBlock, false); - } else { - returnPartialBlock(tls+index, threadlessBlock); - } - threadlessBlock = threadBlock; - } - threadlessBlock = tls[index].activeBlk; - while (threadlessBlock) { - threadBlock = threadlessBlock->next; - if (threadlessBlock->allocatedCount==0 && threadlessBlock->publicFreeList==NULL) { - /* we destroy the thread, no need to keep its TLS bin -> the second param is false */ - returnEmptyBlock(threadlessBlock, false); - } else { - returnPartialBlock(tls+index, threadlessBlock); - } - threadlessBlock = threadBlock; - } - tls[index].activeBlk = 0; - } - bootStrapFree((void*)tls); - setThreadMallocTLS(NULL); - } - - TRACEF(( "[ScalableMalloc trace] Thread id %d blocks return end\n", getThreadId() )); -} - -extern "C" void mallocProcessShutdownNotification(void) -{ - // for now, this function is only necessary for dumping statistics -#if COLLECT_STATISTICS - ThreadId nThreads = ThreadIdCount; - for( int i=1; i<=nThreads && i<MAX_THREADS; ++i ) - STAT_print(i); -#endif -} - -/********* The malloc code *************/ - -extern "C" void * scalable_malloc(size_t size) -{ - Bin* bin; - Block * mallocBlock; - FreeObject *result; - - if (!size) size = sizeof(size_t); - - /* This returns only after malloc is initialized */ - checkInitialization(); - - /* - * Use Large Object Allocation - */ - if (size >= minLargeObjectSize) { - result = (FreeObject*)mallocLargeObject(size, blockSize); - if (!result) errno = ENOMEM; - return result; - } - - /* - * Get an element in thread-local array corresponding to the given size; - * It keeps ptr to the active block for allocations of this size - */ - bin = getAllocationBin(size); - - /* Get the block of you want to try to allocate in. */ - mallocBlock = getActiveBlock(bin); - - if (mallocBlock) { - do { - if( (result = allocateFromBlock(mallocBlock)) ) { - return result; - } - // the previous block, if any, should be empty enough - } while( (mallocBlock = setPreviousBlockActive(bin)) ); - } - MALLOC_ASSERT( !(bin->activeBlk) || bin->activeBlk->isFull==1, ASSERT_TEXT ); - - /* - * else privatize publicly freed objects in some block and allocate from it - */ - mallocBlock = getPublicFreeListBlock( bin ); - if (mallocBlock) { - if (emptyEnoughToUse(mallocBlock)) { - /* move the block to the front of the bin */ - outofTLSBin(bin, mallocBlock); - pushTLSBin(bin, mallocBlock); - } - MALLOC_ASSERT( mallocBlock->freeList, ASSERT_TEXT ); - if ( (result = allocateFromFreeList(mallocBlock)) ) { - return result; - } - /* Else something strange happened, need to retry from the beginning; */ - TRACEF(( "[ScalableMalloc trace] Something is wrong: no objects in public free list; reentering.\n" )); - return scalable_malloc(size); - } - - /* - * no suitable own blocks, try to get a partial block that some other thread has discarded. - */ - mallocBlock = getPartialBlock(bin, size); - while (mallocBlock) { - pushTLSBin(bin, mallocBlock); -// guaranteed by pushTLSBin: MALLOC_ASSERT( *bin==mallocBlock || (*bin)->previous==mallocBlock, ASSERT_TEXT ); - setActiveBlock(bin, mallocBlock); - if( (result = allocateFromBlock(mallocBlock)) ) { - return result; - } - mallocBlock = getPartialBlock(bin, size); - } - - /* - * else try to get a new empty block - */ - mallocBlock = getEmptyBlock(size); - if (mallocBlock) { - pushTLSBin(bin, mallocBlock); -// guaranteed by pushTLSBin: MALLOC_ASSERT( *bin==mallocBlock || (*bin)->previous==mallocBlock, ASSERT_TEXT ); - setActiveBlock(bin, mallocBlock); - if( (result = allocateFromBlock(mallocBlock)) ) { - return result; - } - /* Else something strange happened, need to retry from the beginning; */ - TRACEF(( "[ScalableMalloc trace] Something is wrong: no objects in empty block; reentering.\n" )); - return scalable_malloc(size); - } - /* - * else nothing works so return NULL - */ - TRACEF(( "[ScalableMalloc trace] No memory found, returning NULL.\n" )); - errno = ENOMEM; - return NULL; -} - -/********* End the malloc code *************/ - -/********* The free code *************/ - -extern "C" void scalable_free (void *object) { - Block *block; - ThreadId myTid; - FreeObject *objectToFree; - - if (!object) { - return; - } - - if (isLargeObject(object)) { - freeLargeObject(object); - return; - } - - myTid = getThreadId(); - - block = (Block *)alignDown(object, blockSize);/* mask low bits to get the block */ - MALLOC_ASSERT( block->mallocUniqueID == theMallocUniqueID, ASSERT_TEXT ); - MALLOC_ASSERT( block->allocatedCount, ASSERT_TEXT ); - - // Due to aligned allocations, a pointer passed to scalable_free - // might differ from the address of internally allocated object. - // Small objects however should always be fine. - if (block->objectSize <= maxSegregatedObjectSize) - objectToFree = (FreeObject*)object; - // "Fitting size" allocations are suspicious if aligned higher than naturally - else { - if ( ! isAligned(object,2*fittingAlignment) ) - // TODO: the above check is questionable - it gives false negatives in ~50% cases, - // so might even be slower in average than unconditional use of findAllocatedObject. - // here it should be a "real" object - objectToFree = (FreeObject*)object; - else - // here object can be an aligned address, so applying additional checks - objectToFree = findAllocatedObject(object, block); - MALLOC_ASSERT( isAligned(objectToFree,fittingAlignment), ASSERT_TEXT ); - } - MALLOC_ASSERT( isProperlyPlaced(objectToFree, block), ASSERT_TEXT ); - - if (myTid == block->owner) { - objectToFree->next = block->freeList; - block->freeList = objectToFree; - block->allocatedCount--; - MALLOC_ASSERT( block->allocatedCount < (blockSize-sizeof(Block))/block->objectSize, ASSERT_TEXT ); -#if COLLECT_STATISTICS - if (getActiveBlock(getAllocationBin(block->objectSize)) != block) - STAT_increment(myTid, getIndex(block->objectSize), freeToInactiveBlock); - else - STAT_increment(myTid, getIndex(block->objectSize), freeToActiveBlock); -#endif - if (block->isFull) { - if (emptyEnoughToUse(block)) - moveBlockToBinFront(block); - } else { - if (block->allocatedCount==0 && block->publicFreeList==NULL) - processLessUsedBlock(block); - } - } else { /* Slower path to add to the shared list, the allocatedCount is updated by the owner thread in malloc. */ - freePublicObject (block, objectToFree); - } -} - -/* - * A variant that provides additional memory safety, by checking whether the given address - * was obtained with this allocator, and if not redirecting to the provided alternative call. - */ -extern "C" void safer_scalable_free (void *object, void (*original_free)(void*)) -{ - if (!object) - return; - - // Check if the memory was allocated by scalable_malloc - uint64_t id = isLargeObject(object)? - ((LargeObjectHeader*)((uintptr_t)object-sizeof(LargeObjectHeader)))->mallocUniqueID: - ((Block *)alignDown(object, blockSize))->mallocUniqueID; - if (id==theMallocUniqueID) - scalable_free(object); - else if (original_free) - original_free(object); -} - -/********* End the free code *************/ - -/********* Code for scalable_realloc ***********/ - -/* - * From K&R - * "realloc changes the size of the object pointed to by p to size. The contents will - * be unchanged up to the minimum of the old and the new sizes. If the new size is larger, - * the new space is uninitialized. realloc returns a pointer to the new space, or - * NULL if the request cannot be satisfied, in which case *p is unchanged." - * - */ -extern "C" void* scalable_realloc(void* ptr, size_t size) -{ - /* corner cases left out of reallocAligned to not deal with errno there */ - if (!ptr) { - return scalable_malloc(size); - } - if (!size) { - scalable_free(ptr); - return NULL; - } - void* tmp = reallocAligned(ptr, size, 0); - if (!tmp) errno = ENOMEM; - return tmp; -} - -/* - * A variant that provides additional memory safety, by checking whether the given address - * was obtained with this allocator, and if not redirecting to the provided alternative call. - */ -extern "C" void* safer_scalable_realloc (void* ptr, size_t sz, void* (*original_realloc)(void*,size_t)) -{ - if (!ptr) { - return scalable_malloc(sz); - } - // Check if the memory was allocated by scalable_malloc - uint64_t id = isLargeObject(ptr)? - ((LargeObjectHeader*)((uintptr_t)ptr-sizeof(LargeObjectHeader)))->mallocUniqueID: - ((Block *)alignDown(ptr, blockSize))->mallocUniqueID; - if (id==theMallocUniqueID) { - if (!sz) { - scalable_free(ptr); - return NULL; - } - void* tmp = reallocAligned(ptr, sz, 0); - if (!tmp) errno = ENOMEM; - return tmp; - } - else if (original_realloc) - return original_realloc(ptr,sz); - else - return NULL; -} - -/********* End code for scalable_realloc ***********/ - -/********* Code for scalable_calloc ***********/ - -/* - * From K&R - * calloc returns a pointer to space for an array of nobj objects, - * each of size size, or NULL if the request cannot be satisfied. - * The space is initialized to zero bytes. - * - */ - -extern "C" void * scalable_calloc(size_t nobj, size_t size) -{ - size_t arraySize = nobj * size; - void* result = scalable_malloc(arraySize); - if (result) - memset(result, 0, arraySize); - return result; -} - -/********* End code for scalable_calloc ***********/ - -/********* Code for aligned allocation API **********/ - -extern "C" int scalable_posix_memalign(void **memptr, size_t alignment, size_t size) -{ - if ( !isPowerOfTwoMultiple(alignment, sizeof(void*)) ) - return EINVAL; - void *result = allocateAligned(size, alignment); - if (!result) - return ENOMEM; - *memptr = result; - return 0; -} - -extern "C" void * scalable_aligned_malloc(size_t size, size_t alignment) -{ - if (!isPowerOfTwo(alignment) || 0==size) { - errno = EINVAL; - return NULL; - } - void* tmp = allocateAligned(size, alignment); - if (!tmp) errno = ENOMEM; - return tmp; -} - -extern "C" void * scalable_aligned_realloc(void *ptr, size_t size, size_t alignment) -{ - /* corner cases left out of reallocAligned to not deal with errno there */ - if (!isPowerOfTwo(alignment)) { - errno = EINVAL; - return NULL; - } - if (!ptr) { - return allocateAligned(size, alignment); - } - // Check if the memory was allocated by scalable_malloc - uint64_t id = isLargeObject(ptr)? - ((LargeObjectHeader*)((uintptr_t)ptr-sizeof(LargeObjectHeader)))->mallocUniqueID: - ((Block *)alignDown(ptr, blockSize))->mallocUniqueID; - if (!size) { - if (id==theMallocUniqueID) - scalable_free(ptr); - return NULL; - } - if (id!=theMallocUniqueID) - return NULL; - - void* tmp = reallocAligned(ptr, size, alignment); - if (!tmp) errno = ENOMEM; - return tmp; -} - -/********* End code for scalable_aligned_realloc ***********/ - -extern "C" void scalable_aligned_free(void *ptr) -{ - scalable_free(ptr); -} - -/********* end code for aligned allocation API **********/ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Statistics.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Statistics.h deleted file mode 100644 index 11742f7c78..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/Statistics.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#define MAX_THREADS 1024 -#define NUM_OF_BINS 30 -#define ThreadCommonCounters NUM_OF_BINS - -enum counter_type { - allocBlockNew = 0, - allocBlockPublic, - allocBumpPtrUsed, - allocFreeListUsed, - allocPrivatized, - examineEmptyEnough, - examineNotEmpty, - freeRestoreBumpPtr, - freeByOtherThread, - freeToActiveBlock, - freeToInactiveBlock, - freeBlockPublic, - freeBlockBack, - MaxCounters -}; -enum common_counter_type { - allocLargeSize = 0, - freeLargeSize, - lockPublicFreeList, - freeToOtherThread -}; - -#if COLLECT_STATISTICS -/* Statistics reporting callback registred via a static object dtor on - Posix or DLL_PROCESS_DETACH on Windows. - */ - -static bool reportAllocationStatistics; - -struct bin_counters { - int counter[MaxCounters]; -}; - -static bin_counters statistic[MAX_THREADS][NUM_OF_BINS+1]; //zero-initialized; - -static inline int STAT_increment(int thread, int bin, int ctr) -{ - return reportAllocationStatistics && thread < MAX_THREADS ? ++(statistic[thread][bin].counter[ctr]) : 0; -} -#else -#define STAT_increment(a,b,c) ((int)a) -#endif - -static inline void STAT_print(int thread) -{ -#if COLLECT_STATISTICS - if (!reportAllocationStatistics) - return; - - char filename[100]; - sprintf(filename, "stat_ScalableMalloc_thr%04d.log", thread); - FILE* outfile = fopen(filename, "w"); - for(int i=0; i<NUM_OF_BINS; ++i) - { - bin_counters& ctrs = statistic[thread][i]; - fprintf(outfile, "Thr%04d Bin%02d", thread, i); - fprintf(outfile, ": allocNewBlocks %5d", ctrs.counter[allocBlockNew]); - fprintf(outfile, ", allocPublicBlocks %5d", ctrs.counter[allocBlockPublic]); - fprintf(outfile, ", restoreBumpPtr %5d", ctrs.counter[freeRestoreBumpPtr]); - fprintf(outfile, ", privatizeCalled %10d", ctrs.counter[allocPrivatized]); - fprintf(outfile, ", emptyEnough %10d", ctrs.counter[examineEmptyEnough]); - fprintf(outfile, ", notEmptyEnough %10d", ctrs.counter[examineNotEmpty]); - fprintf(outfile, ", freeBlocksPublic %5d", ctrs.counter[freeBlockPublic]); - fprintf(outfile, ", freeBlocksBack %5d", ctrs.counter[freeBlockBack]); - fprintf(outfile, "\n"); - } - for(int i=0; i<NUM_OF_BINS; ++i) - { - bin_counters& ctrs = statistic[thread][i]; - fprintf(outfile, "Thr%04d Bin%02d", thread, i); - fprintf(outfile, ": allocBumpPtr %10d", ctrs.counter[allocBumpPtrUsed]); - fprintf(outfile, ", allocFreeList %10d", ctrs.counter[allocFreeListUsed]); - fprintf(outfile, ", freeToActiveBlk %10d", ctrs.counter[freeToActiveBlock]); - fprintf(outfile, ", freeToInactive %10d", ctrs.counter[freeToInactiveBlock]); - fprintf(outfile, ", freedByOther %10d", ctrs.counter[freeByOtherThread]); - fprintf(outfile, "\n"); - } - bin_counters& ctrs = statistic[thread][ThreadCommonCounters]; - fprintf(outfile, "Thr%04d common counters", thread); - fprintf(outfile, ": allocLargeObjects %5d", ctrs.counter[allocLargeSize]); - fprintf(outfile, ", freeLargeObjects %5d", ctrs.counter[freeLargeSize]); - fprintf(outfile, ", lockPublicFreeList %5d", ctrs.counter[lockPublicFreeList]); - fprintf(outfile, ", freeToOtherThread %10d", ctrs.counter[freeToOtherThread]); - fprintf(outfile, "\n"); - - fclose(outfile); -#endif -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/TypeDefinitions.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/TypeDefinitions.h deleted file mode 100644 index 074f658b79..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/TypeDefinitions.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _itt_shared_malloc_TypeDefinitions_H_ -#define _itt_shared_malloc_TypeDefinitions_H_ - -// Define preprocessor symbols used to determine architecture -#if _WIN32||_WIN64 -# if defined(_M_AMD64) -# define __ARCH_x86_64 1 -# elif defined(_M_IA64) -# define __ARCH_ipf 1 -# elif defined(_M_IX86) -# define __ARCH_x86_32 1 -# else -# error Unknown processor architecture for Windows -# endif -# define USE_WINTHREAD 1 -#else /* Assume generic Unix */ -# if __x86_64__ -# define __ARCH_x86_64 1 -# elif __ia64__ -# define __ARCH_ipf 1 -# elif __i386__ || __i386 -# define __ARCH_x86_32 1 -# else -# define __ARCH_other 1 -# endif -# define USE_PTHREAD 1 -#endif - -// Include files containing declarations of intptr_t and uintptr_t -#if _WIN32 -#include <stddef.h> -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -#else -#include <stdint.h> -#endif - -//! PROVIDE YOUR OWN Customize.h IF YOU FEEL NECESSARY -#include "Customize.h" - -/* - * Functions to align an integer down or up to the given power of two, - * and test for such an alignment, and for power of two. - */ -template<typename T> -static inline T alignDown(T arg, uintptr_t alignment) { - return T( (uintptr_t)arg & ~(alignment-1)); -} -template<typename T> -static inline T alignUp (T arg, uintptr_t alignment) { - return T(((uintptr_t)arg+(alignment-1)) & ~(alignment-1)); - // /*is this better?*/ return (((uintptr_t)arg-1) | (alignment-1)) + 1; -} -template<typename T> -static inline bool isAligned(T arg, uintptr_t alignment) { - return 0==((uintptr_t)arg & (alignment-1)); -} -static inline bool isPowerOfTwo(uintptr_t arg) { - return arg && (0==(arg & (arg-1))); -} -static inline bool isPowerOfTwoMultiple(uintptr_t arg, uintptr_t divisor) { - // Divisor is assumed to be a power of two (which is valid for current uses). - MALLOC_ASSERT( isPowerOfTwo(divisor), "Divisor should be a power of two" ); - return arg && (0==(arg & (arg-divisor))); -} - -void lockRecursiveMallocFlag(); -void unlockRecursiveMallocFlag(); - -extern bool original_malloc_found; -extern void* (*original_malloc_ptr)(size_t); -extern void (*original_free_ptr)(void*); - -#endif /* _itt_shared_malloc_TypeDefinitions_H_ */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin-tbbmalloc-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin-tbbmalloc-export.def deleted file mode 100644 index 66db63d7cf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin-tbbmalloc-export.def +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -{ -global: -scalable_calloc; -scalable_free; -scalable_malloc; -scalable_realloc; -scalable_posix_memalign; -scalable_aligned_malloc; -scalable_aligned_realloc; -scalable_aligned_free; -__TBB_internal_calloc; -__TBB_internal_free; -__TBB_internal_malloc; -__TBB_internal_realloc; -__TBB_internal_posix_memalign; -local:*; -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin32-proxy-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin32-proxy-export.def deleted file mode 100644 index 39799c74ae..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin32-proxy-export.def +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -{ -global: -calloc; -free; -malloc; -realloc; -posix_memalign; -memalign; -valloc; -pvalloc; -mallinfo; -mallopt; -__TBB_malloc_proxy; -__TBB_internal_find_original_malloc; -_ZdaPv; /* next ones are new/delete */ -_ZdaPvRKSt9nothrow_t; -_ZdlPv; -_ZdlPvRKSt9nothrow_t; -_Znaj; -_ZnajRKSt9nothrow_t; -_Znwj; -_ZnwjRKSt9nothrow_t; -local:*; -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64-proxy-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64-proxy-export.def deleted file mode 100644 index dc9ceb4ee6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64-proxy-export.def +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -{ -global: -calloc; -free; -malloc; -realloc; -posix_memalign; -memalign; -valloc; -pvalloc; -mallinfo; -mallopt; -__TBB_malloc_proxy; -__TBB_internal_find_original_malloc; -_ZdaPv; /* next ones are new/delete */ -_ZdaPvRKSt9nothrow_t; -_ZdlPv; -_ZdlPvRKSt9nothrow_t; -_Znam; -_ZnamRKSt9nothrow_t; -_Znwm; -_ZnwmRKSt9nothrow_t; -local:*; -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64ipf-proxy-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64ipf-proxy-export.def deleted file mode 100644 index dc9ceb4ee6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/lin64ipf-proxy-export.def +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -{ -global: -calloc; -free; -malloc; -realloc; -posix_memalign; -memalign; -valloc; -pvalloc; -mallinfo; -mallopt; -__TBB_malloc_proxy; -__TBB_internal_find_original_malloc; -_ZdaPv; /* next ones are new/delete */ -_ZdaPvRKSt9nothrow_t; -_ZdlPv; -_ZdlPvRKSt9nothrow_t; -_Znam; -_ZnamRKSt9nothrow_t; -_Znwm; -_ZnwmRKSt9nothrow_t; -local:*; -}; diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac32-tbbmalloc-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac32-tbbmalloc-export.def deleted file mode 100644 index 6736ba0caf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac32-tbbmalloc-export.def +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# MemoryAllocator.cpp -_scalable_calloc -_scalable_free -_scalable_malloc -_scalable_realloc -_scalable_posix_memalign -_scalable_aligned_malloc -_scalable_aligned_realloc -_scalable_aligned_free diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac64-tbbmalloc-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac64-tbbmalloc-export.def deleted file mode 100644 index 6736ba0caf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/mac64-tbbmalloc-export.def +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2005-2009 Intel Corporation. All Rights Reserved. -# -# This file is part of Threading Building Blocks. -# -# Threading Building Blocks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Threading Building Blocks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Threading Building Blocks; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. - -# MemoryAllocator.cpp -_scalable_calloc -_scalable_free -_scalable_malloc -_scalable_realloc -_scalable_posix_memalign -_scalable_aligned_malloc -_scalable_aligned_realloc -_scalable_aligned_free diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.cpp deleted file mode 100644 index dc17ce93f4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "proxy.h" - -#if MALLOC_LD_PRELOAD - -/*** service functions and variables ***/ - -#include <unistd.h> // for sysconf -#include <dlfcn.h> - -static long memoryPageSize; - -static inline void initPageSize() -{ - memoryPageSize = sysconf(_SC_PAGESIZE); -} - -/* For the expected behaviour (i.e., finding malloc/free/etc from libc.so, - not from ld-linux.so) dlsym(RTLD_NEXT) should be called from - a LD_PRELOADed library, not another dynamic library. - So we have to put find_original_malloc here. - */ -extern "C" bool __TBB_internal_find_original_malloc(int num, const char *names[], - void *ptrs[]) -{ - for (int i=0; i<num; i++) - if (NULL == (ptrs[i] = dlsym (RTLD_NEXT, names[i]))) - return false; - - return true; -} - -/* __TBB_malloc_proxy used as a weak symbol by libtbbmalloc for: - 1) detection that the proxy library is loaded - 2) check that dlsym("malloc") found something different from our replacement malloc -*/ -extern "C" void *__TBB_malloc_proxy() __attribute__ ((alias ("malloc"))); - -#ifndef __THROW -#define __THROW -#endif - -/*** replacements for malloc and the family ***/ - -extern "C" { - -void *malloc(size_t size) __THROW -{ - return __TBB_internal_malloc(size); -} - -void * calloc(size_t num, size_t size) __THROW -{ - return __TBB_internal_calloc(num, size); -} - -void free(void *object) __THROW -{ - __TBB_internal_free(object); -} - -void * realloc(void* ptr, size_t sz) __THROW -{ - return __TBB_internal_realloc(ptr, sz); -} - -int posix_memalign(void **memptr, size_t alignment, size_t size) __THROW -{ - return __TBB_internal_posix_memalign(memptr, alignment, size); -} - -/* The older *NIX interface for aligned allocations; - it's formally substituted by posix_memalign and deprecated, - so we do not expect it to cause cyclic dependency with C RTL. */ -void * memalign(size_t alignment, size_t size) __THROW -{ - return scalable_aligned_malloc(size, alignment); -} - -/* valloc allocates memory aligned on a page boundary */ -void * valloc(size_t size) __THROW -{ - if (! memoryPageSize) initPageSize(); - - return scalable_aligned_malloc(size, memoryPageSize); -} - -/* pvalloc allocates smallest set of complete pages which can hold - the requested number of bytes. Result is aligned on page boundary. */ -void * pvalloc(size_t size) __THROW -{ - if (! memoryPageSize) initPageSize(); - // align size up to the page size - size = ((size-1) | (memoryPageSize-1)) + 1; - - return scalable_aligned_malloc(size, memoryPageSize); -} - -int mallopt(int /*param*/, int /*value*/) __THROW -{ - return 1; -} - -} /* extern "C" */ - -#if __linux__ -#include <malloc.h> -#include <string.h> // for memset - -extern "C" struct mallinfo mallinfo() __THROW -{ - struct mallinfo m; - memset(&m, 0, sizeof(struct mallinfo)); - - return m; -} -#endif /* __linux__ */ - -/*** replacements for global operators new and delete ***/ - -#include <new> - -void * operator new(size_t sz) throw (std::bad_alloc) { - void *res = scalable_malloc(sz); - if (NULL == res) throw std::bad_alloc(); - return res; -} -void* operator new[](size_t sz) throw (std::bad_alloc) { - void *res = scalable_malloc(sz); - if (NULL == res) throw std::bad_alloc(); - return res; -} -void operator delete(void* ptr) throw() { - scalable_free(ptr); -} -void operator delete[](void* ptr) throw() { - scalable_free(ptr); -} -void* operator new(size_t sz, const std::nothrow_t&) throw() { - return scalable_malloc(sz); -} -void* operator new[](std::size_t sz, const std::nothrow_t&) throw() { - return scalable_malloc(sz); -} -void operator delete(void* ptr, const std::nothrow_t&) throw() { - scalable_free(ptr); -} -void operator delete[](void* ptr, const std::nothrow_t&) throw() { - scalable_free(ptr); -} - -#endif /* MALLOC_LD_PRELOAD */ - - -#ifdef _WIN32 -#include <windows.h> - -#include <stdio.h> -#include "tbb_function_replacement.h" - -#define HEAP_INIT_SIZE 0x100000 -#define HEAP_MAX_SIZE 0x1000000 - -// Replace the CRT malloc with heap allocation, using my private heap -HANDLE myHeap = 0; - -typedef struct PAGE_DB_t { - CRITICAL_SECTION cs; - DWORD alloc; - DWORD last; - LPVOID *db; -} PAGE_DB; - -static PAGE_DB pageDB; - -extern "C" void safer_scalable_free( void *ptr, void*); -extern "C" void* safer_scalable_realloc( void *ptr, size_t, void* ); - -void safer_scalable_free2( void *ptr) - { - safer_scalable_free( ptr, NULL ); - } -void* safer_scalable_realloc2( void *ptr, size_t size ) - { - return safer_scalable_realloc( ptr, size, NULL ); - } - -/*** replacements for global operators new and delete ***/ - -#include <new> - -#pragma warning( push ) -#pragma warning( disable : 4290 ) - -void * operator_new(size_t sz) throw (std::bad_alloc) { - void *res = scalable_malloc(sz); - if (NULL == res) throw std::bad_alloc(); - return res; -} -void* operator_new_arr(size_t sz) throw (std::bad_alloc) { - void *res = scalable_malloc(sz); - if (NULL == res) throw std::bad_alloc(); - return res; -} -void operator_delete(void* ptr) throw() { - safer_scalable_free2(ptr); -} -#pragma warning( pop ) - -void operator_delete_arr(void* ptr) throw() { - safer_scalable_free2(ptr); -} -void* operator_new_t(size_t sz, const std::nothrow_t&) throw() { - return scalable_malloc(sz); -} -void* operator_new_arr_t(std::size_t sz, const std::nothrow_t&) throw() { - return scalable_malloc(sz); -} -void operator_delete_t(void* ptr, const std::nothrow_t&) throw() { - safer_scalable_free2(ptr); -} -void operator_delete_arr_t(void* ptr, const std::nothrow_t&) throw() { - safer_scalable_free2(ptr); -} - -char* modules_to_replace[] = { - "msvcr80d.dll", - "msvcr80.dll", - "msvcr90d.dll", - "msvcr90.dll", - "msvcrd.dll", - "msvcr.dll", - "msvcr70d.dll", - "msvcr70.dll", - "msvcr71d.dll", - "msvcr71.dll", - }; - -/* -We need to replace following functions: -malloc -calloc -realloc -free -_aligned_malloc -_aligned_realloc -_aligned_free -??2@YAPAXI@Z operator new (ia32) -??_U@YAPAXI@Z void * operator new[] (size_t size) (ia32) -??3@YAXPAX@Z operator delete (ia32) -??_V@YAXPAX@Z operator delete[] (ia32) -??2@YAPEAX_K@Z void * operator new(unsigned __int64) (intel64) -??_V@YAXPEAX@Z void * operator new[](unsigned __int64) (intel64) -??3@YAXPEAX@Z operator delete (intel64) -??_V@YAXPEAX@Z operator delete[] (intel64) -??2@YAPAXIABUnothrow_t@std@@@Z void * operator new (size_t sz, const std::nothrow_t&) throw() (optional) -??_U@YAPAXIABUnothrow_t@std@@@Z void * operator new[] (size_t sz, const std::nothrow_t&) throw() (optional) -*/ - -typedef struct FRData_t { - //char *_module; - char *_func; - FUNCPTR _fptr; - FRR_ON_ERROR _on_error; -} FRDATA; - -FRDATA routines_to_replace[] = { - { "malloc", (FUNCPTR)scalable_malloc, FRR_FAIL }, - { "calloc", (FUNCPTR)scalable_calloc, FRR_FAIL }, - { "realloc", (FUNCPTR)safer_scalable_realloc2, FRR_FAIL }, - { "free", (FUNCPTR)safer_scalable_free2, FRR_FAIL }, - { "_aligned_malloc", (FUNCPTR)scalable_aligned_malloc, FRR_FAIL }, - { "_aligned_realloc", (FUNCPTR)scalable_aligned_realloc, FRR_FAIL }, - { "_aligned_free", (FUNCPTR)safer_scalable_free2, FRR_FAIL }, -#if _WIN64 - { "??2@YAPEAX_K@Z", (FUNCPTR)operator_new, FRR_FAIL }, - { "??_U@YAPEAX_K@Z", (FUNCPTR)operator_new_arr, FRR_FAIL }, - { "??3@YAXPEAX@Z", (FUNCPTR)operator_delete, FRR_FAIL }, - { "??_V@YAXPEAX@Z", (FUNCPTR)operator_delete_arr, FRR_FAIL }, -#else - { "??2@YAPAXI@Z", (FUNCPTR)operator_new, FRR_FAIL }, - { "??_U@YAPAXI@Z", (FUNCPTR)operator_new_arr, FRR_FAIL }, - { "??3@YAXPAX@Z", (FUNCPTR)operator_delete, FRR_FAIL }, - { "??_V@YAXPAX@Z", (FUNCPTR)operator_delete_arr, FRR_FAIL }, -#endif - { "??2@YAPAXIABUnothrow_t@std@@@Z", (FUNCPTR)operator_new_t, FRR_IGNORE }, - { "??_U@YAPAXIABUnothrow_t@std@@@Z", (FUNCPTR)operator_new_arr_t, FRR_IGNORE } -}; - -// Initialize the malloc replacement data structures -void initializeMallocReplacement() -{ - int i,j; - myHeap = HeapCreate(HEAP_NO_SERIALIZE, HEAP_INIT_SIZE, HEAP_MAX_SIZE); - if (myHeap == 0) - { - fprintf(stderr, "Can't create private heap\n"); - exit(1); - } - pageDB.alloc = 100; - pageDB.last = 0; - pageDB.db = (LPVOID *)HeapAlloc(myHeap, HEAP_ZERO_MEMORY, pageDB.alloc * sizeof(LPVOID)); - if (pageDB.db == 0) - { - fprintf(stderr, "Can't create my pointer database\n"); - exit(1); - } - InitializeCriticalSection(&pageDB.cs); - - // Replace malloc functions - int modules_to_replace_count = sizeof(modules_to_replace) / sizeof(modules_to_replace[0]); - int routines_to_replace_count = sizeof(routines_to_replace) / sizeof(routines_to_replace[0]); - for ( j=0; j<modules_to_replace_count; j++ ) - for (i = 0; i < routines_to_replace_count; i++) - { - FRR_TYPE type = ReplaceFunction( modules_to_replace[j], routines_to_replace[i]._func, routines_to_replace[i]._fptr ); - if (type == FRR_NODLL) break; - if (type != FRR_OK && routines_to_replace[i]._on_error==FRR_FAIL) - { - fprintf(stderr, "Failed to replace function %s in module %s\n", - routines_to_replace[i]._func, modules_to_replace[j]); - exit(1); - } - } - -} - -BOOL WINAPI DllMain( HINSTANCE hInst, DWORD callReason, LPVOID reserved ) -{ - - if ( callReason==DLL_PROCESS_ATTACH && reserved && hInst ) - { -#if TBBMALLOC_USE_TBB_FOR_ALLOCATOR_ENV_CONTROLLED - char pinEnvVariable[50]; - if( GetEnvironmentVariable("TBBMALLOC_USE_TBB_FOR_ALLOCATOR", pinEnvVariable, 50)) - { - initializeMallocReplacement(); - } -#else - initializeMallocReplacement(); -#endif - } - - return TRUE; -} - -// Just to make the linker happy and link the DLL to the application -extern "C" __declspec(dllexport) void __TBB_malloc_proxy() -{ - -} - -#endif //_WIN32 diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.h deleted file mode 100644 index 15c25a97a7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/proxy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef _TBB_malloc_proxy_H_ -#define _TBB_malloc_proxy_H_ - -#if __linux__ -#define MALLOC_LD_PRELOAD 1 -#endif - -#include <stddef.h> - -extern "C" { - void * scalable_malloc(size_t size); - void * scalable_calloc(size_t nobj, size_t size); - void scalable_free(void *object); - void * scalable_realloc(void* ptr, size_t size); - void * scalable_aligned_malloc(size_t size, size_t alignment); - void * scalable_aligned_realloc(void* ptr, size_t size, size_t alignment); - int scalable_posix_memalign(void **memptr, size_t alignment, size_t size); - - void * __TBB_internal_malloc(size_t size); - void * __TBB_internal_calloc(size_t num, size_t size); - void __TBB_internal_free(void *object); - void * __TBB_internal_realloc(void* ptr, size_t sz); - int __TBB_internal_posix_memalign(void **memptr, size_t alignment, size_t size); - - bool __TBB_internal_find_original_malloc(int num, const char *names[], void *table[]); -} // extern "C" - -#endif /* _TBB_malloc_proxy_H_ */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.cpp deleted file mode 100644 index d437b64236..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.cpp +++ /dev/null @@ -1,371 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -//We works on windows only -#ifdef _WIN32 -#define _CRT_SECURE_NO_DEPRECATE 1 - -#include <windows.h> -#include <new> -#include "tbb_function_replacement.h" - -inline UINT_PTR Ptr2Addrint(LPVOID ptr) -{ - Int2Ptr i2p; - i2p.lpv = ptr; - return i2p.uip; -} - -inline LPVOID Addrint2Ptr(UINT_PTR ptr) -{ - Int2Ptr i2p; - i2p.uip = ptr; - return i2p.lpv; -} - -// We need to remember which pointer was allocated from myHeap and which -// was allocated before replacing malloc (therefore allocated from the -// CRT heap). -// Keep page database, since entire pages belong to the same heap, just -// remember the pages. -#define PAGE_SIZE 0x1000 - -// Use this value as the maximum size the trampoline region -const int MAX_PROBE_SIZE = 16; - -// The size of a jump relative instruction "e9 00 00 00 00" -const int SIZE_OF_RELJUMP = 5; - -// The size of jump RIP relative indirect "ff 25 00 00 00 00" -const int SIZE_OF_INDJUMP = 6; - -// The size of address we put in the location (in Intel64) -const int SIZE_OF_ADDRESS = 8; - -// The max distance covered in 32 bits -const __int64 MAX_DISTANCE = (((__int64)1 << 31) - 1); - -// The maximum number of distinct buffers in memory -const int MAX_NUM_BUFFERS = 256; - -// Is the distance between addr1 and addr2 smaller than dist -inline BOOL IsInDistance(UINT_PTR addr1, UINT_PTR addr2, __int64 dist) -{ - __int64 diff = addr1 - addr2; - if (diff < 0) diff = -diff; - return (diff < dist); -} - -/* - * When inserting a probe in 64 bits process the distance between the insertion - * point and the target may be bigger than 2^32. In this case we are using - * indirect jump through memory where the offset to this memory location - * is smaller than 2^32 and it contains the absolute address (8 bytes). - * - * This class is used to hold the pages used for the above trampolines. - * Since this utility will be used to replace malloc functions this implementation - * doesn't allocate memory dynamically. - * - * The struct MemoryBuffer holds the data about a page in the memory used for - * replacing functions in Intel64 where the target is too far to be replaced - * with a short jump. All the calculations of m_base and m_next are in a multiple - * of SIZE_OF_ADDRESS (which is 8 in Win64). - */ -class MemoryProvider { -private: - struct MemoryBuffer { - UINT_PTR m_base; // base address of the buffer - UINT_PTR m_next; // next free location in the buffer - DWORD m_size; // size of buffer - - // Default constructor - MemoryBuffer() : m_base(0), m_next(0), m_size(0) {} - - // Constructor - MemoryBuffer(void *base, DWORD size) - { - m_base = Ptr2Addrint(base); - m_next = m_base; - m_size = size; - } - }; - -MemoryBuffer *CreateBuffer(UINT_PTR addr) - { - // No more room in the pages database - if (m_lastBuffer - m_pages == MAX_NUM_BUFFERS) - return 0; - - void *newAddr = Addrint2Ptr(addr); - // Get information for the region which the given address belongs to - MEMORY_BASIC_INFORMATION memInfo; - if (VirtualQuery(newAddr, &memInfo, sizeof(memInfo)) != sizeof(memInfo)) - return 0; - - for(;;) { - // The new address to check is beyond the current region and aligned to allocation size - newAddr = Addrint2Ptr( (Ptr2Addrint(memInfo.BaseAddress) + memInfo.RegionSize + m_allocSize) & ~(UINT_PTR)(m_allocSize-1) ); - - // Check that the address is in the right distance. - // VirtualAlloc can only round the address down; so it will remain in the right distance - if (!IsInDistance(addr, Ptr2Addrint(newAddr), MAX_DISTANCE)) - break; - - if (VirtualQuery(newAddr, &memInfo, sizeof(memInfo)) != sizeof(memInfo)) - break; - - if (memInfo.State == MEM_FREE && memInfo.RegionSize >= m_allocSize) - { - // Found a free region, try to allocate a page in this region - void *newPage = VirtualAlloc(newAddr, m_allocSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); - if (!newPage) - break; - - // Add the new page to the pages database - MemoryBuffer *pBuff = new (m_lastBuffer) MemoryBuffer(newPage, m_allocSize); - ++m_lastBuffer; - return pBuff; - } - } - - // Failed to find a buffer in the distance - return 0; - } - -public: - MemoryProvider() - { - SYSTEM_INFO sysInfo; - GetSystemInfo(&sysInfo); - m_allocSize = sysInfo.dwAllocationGranularity; - m_lastBuffer = &m_pages[0]; - } - - // We can't free the pages in the destructor because the trampolines - // are using these memory locations and a replaced function might be called - // after the destructor was called. - ~MemoryProvider() - { - } - - // Return a memory location in distance less than 2^31 from input address - UINT_PTR GetLocation(UINT_PTR addr) - { - MemoryBuffer *pBuff = m_pages; - while (pBuff < m_lastBuffer) - { - if (IsInDistance(pBuff->m_base, addr, MAX_DISTANCE) && - pBuff->m_next < pBuff->m_base + pBuff->m_size) - { - UINT_PTR loc = pBuff->m_next; - pBuff->m_next += SIZE_OF_ADDRESS; - return loc; - } - } - - pBuff = CreateBuffer(addr); - if(!pBuff) - return 0; - - UINT_PTR loc = pBuff->m_next; - pBuff->m_next += SIZE_OF_ADDRESS; - return loc; - } - -private: - MemoryBuffer m_pages[MAX_NUM_BUFFERS]; - MemoryBuffer *m_lastBuffer; - DWORD m_allocSize; -}; - -static MemoryProvider memProvider; - -// Insert jump relative instruction to the input address -// RETURN: the size of the trampoline or 0 on failure -static DWORD InsertTrampoline32(void *inpAddr, void *targetAddr) -{ - UINT_PTR srcAddr = Ptr2Addrint(inpAddr); - UINT_PTR tgtAddr = Ptr2Addrint(targetAddr); - UINT_PTR offset = tgtAddr - srcAddr - SIZE_OF_RELJUMP; - UINT offset32 = (UINT)(offset & 0xFFFFFFFF); - UCHAR *codePtr = (UCHAR *)inpAddr; - - // Check that the target fits in 32 bits - if (!IsInDistance(srcAddr, tgtAddr, MAX_DISTANCE)) - return 0; - - // Fill the buffer - *codePtr++ = 0xE9; - memcpy(codePtr, &offset32, sizeof(offset32)); - return SIZE_OF_RELJUMP; -} - - -// This function is called when the offset doesn't fit in 32 bits -// 1 Find and allocate a page in the small distance (<2^31) from input address -// 2 Put jump RIP relative indirect through the address in the close page -// 3 Put the absolute address of the target in the allocated location -// RETURN: the size of the trampoline or 0 on failure -static DWORD InsertTrampoline64(void *inpAddr, void *targetAddr) -{ - UINT_PTR srcAddr = Ptr2Addrint(inpAddr); - UINT_PTR tgtAddr = Ptr2Addrint(targetAddr); - - // Get a location close to the source address - UINT_PTR location = memProvider.GetLocation(srcAddr); - if (!location) - return 0; - - UINT_PTR offset = location - srcAddr - SIZE_OF_INDJUMP; - UINT offset32 = (INT)(offset & 0xFFFFFFFF); - - // Fill the location - UINT_PTR *locPtr = (UINT_PTR *)Addrint2Ptr(location); - *locPtr = tgtAddr; - - // Fill the buffer - UCHAR *codePtr = (UCHAR *)inpAddr; - *codePtr++ = 0xFF; - *codePtr++ = 0x25; - memcpy(codePtr, &offset32, sizeof(offset32)); - return SIZE_OF_INDJUMP; -} - - -// Insert a jump instruction in the inpAddr to the targetAddr -// 1. Get the memory protection of the page containing the input address -// 2. Change the memory protection to writable -// 3. Call InsertTrampoline32 or InsertTrampoline64 -// 4. Restore memory protection -// RETURN: FALSE on failure, TRUE on success -static BOOL InsertTrampoline(void *inpAddr, void *targetAddr) -{ - DWORD probeSize; - - // Change page protection to EXECUTE+WRITE - DWORD origProt = 0; - if (!VirtualProtect(inpAddr, MAX_PROBE_SIZE, PAGE_EXECUTE_WRITECOPY, &origProt)) - return FALSE; - - probeSize = InsertTrampoline32(inpAddr, targetAddr); - if (!probeSize) - probeSize = InsertTrampoline64(inpAddr, targetAddr); - - // Restore original protection - VirtualProtect(inpAddr, MAX_PROBE_SIZE, origProt, &origProt); - - if (!probeSize) - return FALSE; - - FlushInstructionCache(GetCurrentProcess(), inpAddr, probeSize); - return TRUE; -} - -FRR_TYPE ReplaceFunctionA(char *dllName, char *funcName, FUNCPTR newFunc) -{ - // Cache the results of the last search for the module - // Assume that there was no DLL unload between - static char cachedName[MAX_PATH+1]; - static HMODULE cachedHM = 0; - - if (!dllName || !*dllName) - return FRR_NODLL; - - if (!cachedHM || strncmp(dllName, cachedName, MAX_PATH) != 0) - { - // Find the module handle for the input dll - HMODULE hModule = GetModuleHandleA(dllName); - if (hModule == 0) - { - // Couldn't find the module with the input name - cachedHM = 0; - return FRR_NODLL; - } - - cachedHM = hModule; - strncpy(cachedName, dllName, MAX_PATH); - } - - FARPROC inpFunc = GetProcAddress(cachedHM, funcName); - if (inpFunc == 0) - { - // Function was not found - return FRR_NOFUNC; - } - - if (!InsertTrampoline(inpFunc, newFunc)) - { - // Failed to insert the trampoline to the target address - return FRR_FAILED; - } - - return FRR_OK; -} - -FRR_TYPE ReplaceFunctionW(wchar_t *dllName, char *funcName, FUNCPTR newFunc) -{ - // Cache the results of the last search for the module - // Assume that there was no DLL unload between - static wchar_t cachedName[MAX_PATH+1]; - static HMODULE cachedHM = 0; - - if (!dllName || !*dllName) - return FRR_NODLL; - - if (!cachedHM || wcsncmp(dllName, cachedName, MAX_PATH) != 0) - { - // Find the module handle for the input dll - HMODULE hModule = GetModuleHandleW(dllName); - if (hModule == 0) - { - // Couldn't find the module with the input name - cachedHM = 0; - return FRR_NODLL; - } - - cachedHM = hModule; - wcsncpy(cachedName, dllName, MAX_PATH); - } - - FARPROC inpFunc = GetProcAddress(cachedHM, funcName); - if (inpFunc == 0) - { - // Function was not found - return FRR_NOFUNC; - } - - if (!InsertTrampoline(inpFunc, newFunc)) - { - // Failed to insert the trampoline to the target address - return FRR_FAILED; - } - - return FRR_OK; -} - -#endif //_WIN32 diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.h deleted file mode 100644 index ba1cc45def..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbb_function_replacement.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef __TBB_function_replacement_H -#define __TBB_function_replacement_H - -typedef enum { - FRR_OK, /* Succeeded in replacing the function */ - FRR_NODLL, /* The requested DLL was not found */ - FRR_NOFUNC, /* The requested function was not found */ - FRR_FAILED, /* The function replacement request failed */ -} FRR_TYPE; - -typedef enum { - FRR_FAIL, /* Required function */ - FRR_IGNORE, /* optional function */ -} FRR_ON_ERROR; - -typedef void (*FUNCPTR)(); - -#ifndef UNICODE -#define ReplaceFunction ReplaceFunctionA -#else -#define ReplaceFunction ReplaceFunctionW -#endif //UNICODE - -FRR_TYPE ReplaceFunctionA(char *dllName, char *funcName, FUNCPTR newFunc); -FRR_TYPE ReplaceFunctionW(wchar_t *dllName, char *funcName, FUNCPTR newFunc); - -// Utilities to convert between ADDRESS and LPVOID -union Int2Ptr { - UINT_PTR uip; - LPVOID lpv; -}; - -inline UINT_PTR Ptr2Addrint(LPVOID ptr); -inline LPVOID Addrint2Ptr(UINT_PTR ptr); - -#endif //__TBB_function_replacement_H diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.cpp deleted file mode 100644 index 483c9ee004..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "TypeDefinitions.h" // Customize.h and proxy.h get included - -#include "tbb/itt_notify.cpp" - -#if MALLOC_LD_PRELOAD - -#include <pthread.h> -#include <stdio.h> -#include <unistd.h> -#if __sun -#include <string.h> /* for memset */ -#include <errno.h> -#endif - -extern "C" { - -void safer_scalable_free( void*, void (*)(void*) ); -void * safer_scalable_realloc( void*, size_t, void* (*)(void*,size_t) ); - -bool __TBB_internal_find_original_malloc(int num, const char *names[], void *table[]) __attribute__ ((weak)); - -} - -#define malloc_proxy __TBB_malloc_proxy - -void* (*original_malloc_ptr)(size_t) = 0; -void (*original_free_ptr)(void*) = 0; -static void* (*original_calloc_ptr)(size_t,size_t) = 0; -static void* (*original_realloc_ptr)(void*,size_t) = 0; - -#endif /* MALLOC_LD_PRELOAD */ - -namespace tbb { -namespace internal { - -#if __TBB_NEW_ITT_NOTIFY -extern "C" -#endif -void ITT_DoOneTimeInitialization() {} // required for itt_notify.cpp to work - -#if DO_ITT_NOTIFY -/** Caller is responsible for ensuring this routine is called exactly once. */ -void MallocInitializeITT() { -#if __TBB_NEW_ITT_NOTIFY - __TBB_load_ittnotify(); -#else - bool success = false; - // Check if we are running under control of VTune. - if( GetBoolEnvironmentVariable("KMP_FOR_TCHECK") || GetBoolEnvironmentVariable("KMP_FOR_TPROFILE") ) { - // Yes, we are under control of VTune. Check for libittnotify library. - success = dynamic_link( LIBITTNOTIFY_NAME, ITT_HandlerTable, 5 ); - } - if (!success){ - for (int i = 0; i < 5; i++) - *ITT_HandlerTable[i].handler = NULL; - } -#endif /* !__TBB_NEW_ITT_NOTIFY */ -} -#endif /* DO_ITT_NOTIFY */ - -void init_tbbmalloc() { -#if MALLOC_LD_PRELOAD - if (malloc_proxy && __TBB_internal_find_original_malloc) { - const char *alloc_names[] = { "malloc", "free", "realloc", "calloc"}; - void *orig_alloc_ptrs[4]; - - if (__TBB_internal_find_original_malloc(4, alloc_names, orig_alloc_ptrs)) { - (void *&)original_malloc_ptr = orig_alloc_ptrs[0]; - (void *&)original_free_ptr = orig_alloc_ptrs[1]; - (void *&)original_realloc_ptr = orig_alloc_ptrs[2]; - (void *&)original_calloc_ptr = orig_alloc_ptrs[3]; - MALLOC_ASSERT( original_malloc_ptr!=malloc_proxy, - "standard malloc not found" ); -/* It's workaround for a bug in GNU Libc 2.9 (as it shipped with Fedora 10). - 1st call to libc's malloc should be not from threaded code. - */ - original_free_ptr(original_malloc_ptr(1024)); - original_malloc_found = 1; - } - } -#endif /* MALLOC_LD_PRELOAD */ - -#if DO_ITT_NOTIFY - MallocInitializeITT(); -#endif -} - -#if !(_WIN32||_WIN64) -struct RegisterProcessShutdownNotification { - ~RegisterProcessShutdownNotification() { - mallocProcessShutdownNotification(); - } -}; - -static RegisterProcessShutdownNotification reg; -#endif - -} } // namespaces - -#ifdef _WIN32 -#include <windows.h> - -BOOL WINAPI DllMain( HINSTANCE hInst, DWORD callReason, LPVOID ) -{ - - if (callReason==DLL_THREAD_DETACH) - { - mallocThreadShutdownNotification(NULL); - } - else if (callReason==DLL_PROCESS_DETACH) - { - mallocProcessShutdownNotification(); - } - return TRUE; -} - -#endif //_WIN32 - -#if MALLOC_LD_PRELOAD - -bool original_malloc_found; - -pthread_t recursive_malloc_call_thread; -int recursive_malloc_call_flag; - -void lockRecursiveMallocFlag() -{ - recursive_malloc_call_thread = pthread_self(); - recursive_malloc_call_flag = 1; -} -void unlockRecursiveMallocFlag() -{ - recursive_malloc_call_flag = 0; -} -static inline bool underRecursiveMallocFlag() -{ - return recursive_malloc_call_flag - && pthread_equal( recursive_malloc_call_thread, pthread_self()); -} - -extern "C" { - -void * __TBB_internal_malloc(size_t size) -{ - if ( underRecursiveMallocFlag() ) { - if ( original_malloc_found ){ - return original_malloc_ptr(size); - }else{ - return NULL; - } - }else{ - return (void*)scalable_malloc(size); - } -} - -void * __TBB_internal_calloc(size_t num, size_t size) -{ - if ( underRecursiveMallocFlag() ) { - if ( original_malloc_found ){ -#if __sun - /* There seem to be run time problems on Solaris if original_calloc_ptr is used. */ - size_t arraySize = num * size; - void *result = original_malloc_ptr(arraySize); - if (result) - memset(result, 0, arraySize); - return result; -#else - return original_calloc_ptr(num, size); -#endif - }else{ - return NULL; - } - }else{ - return scalable_calloc(num, size); - } -} - -int __TBB_internal_posix_memalign(void **memptr, size_t alignment, size_t size) -{ - MALLOC_ASSERT( !underRecursiveMallocFlag(), - "posix_memalign not expected to create a cyclic dependency" ); - return scalable_posix_memalign(memptr, alignment, size); -} - -void* __TBB_internal_realloc(void* ptr, size_t sz) -{ - return safer_scalable_realloc(ptr, sz, original_realloc_ptr); -} - -void __TBB_internal_free(void *object) -{ - safer_scalable_free(object, original_free_ptr); -} - -} /* extern "C" */ - -#endif /* MALLOC_LD_PRELOAD */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.rc b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.rc deleted file mode 100644 index 0bce7f2351..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/tbbmalloc.rc +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2005-2009 Intel Corporation. All Rights Reserved. -// -// This file is part of Threading Building Blocks. -// -// Threading Building Blocks is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// version 2 as published by the Free Software Foundation. -// -// Threading Building Blocks is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Threading Building Blocks; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include <winresrc.h> -#define ENDL "\r\n" -#include "tbb/tbb_version.h" - -#define TBBMALLOC_VERNUMBERS 1, 0, __TBB_VERSION_YMD -#define TBBMALLOC_VERSION __TBB_STRING(TBBMALLOC_VERNUMBERS) - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// manifest integration -#ifdef TBB_MANIFEST -#include "winuser.h" -2 RT_MANIFEST tbbmanifest.exe.manifest -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION TBBMALLOC_VERNUMBERS - PRODUCTVERSION TBB_VERNUMBERS - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "CompanyName", "Intel Corporation\0" - VALUE "FileDescription", "Scalable Allocator library\0" - VALUE "FileVersion", TBBMALLOC_VERSION "\0" -//what is it? VALUE "InternalName", "tbbmalloc\0" - VALUE "LegalCopyright", "Copyright (C) 2006\0" - VALUE "LegalTrademarks", "\0" -#ifndef TBB_USE_DEBUG - VALUE "OriginalFilename", "tbbmalloc.dll\0" -#else - VALUE "OriginalFilename", "tbbmalloc_debug.dll\0" -#endif - VALUE "ProductName", "Threading Building Blocks\0" - VALUE "ProductVersion", TBB_VERSION "\0" - VALUE "Comments", TBB_VERSION_STRINGS "\0" - VALUE "PrivateBuild", "\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win32-tbbmalloc-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win32-tbbmalloc-export.def deleted file mode 100644 index 43142ac8f7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win32-tbbmalloc-export.def +++ /dev/null @@ -1,40 +0,0 @@ -; Copyright 2005-2009 Intel Corporation. All Rights Reserved. -; -; This file is part of Threading Building Blocks. -; -; Threading Building Blocks is free software; you can redistribute it -; and/or modify it under the terms of the GNU General Public License -; version 2 as published by the Free Software Foundation. -; -; Threading Building Blocks is distributed in the hope that it will be -; useful, but WITHOUT ANY WARRANTY; without even the implied warranty -; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with Threading Building Blocks; if not, write to the Free Software -; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -; -; As a special exception, you may use this file as part of a free software -; library without restriction. Specifically, if other files instantiate -; templates or use macros or inline functions from this file, or you compile -; this file and link it with other files to produce an executable, this -; file does not by itself cause the resulting executable to be covered by -; the GNU General Public License. This exception does not however -; invalidate any other reasons why the executable file might be covered by -; the GNU General Public License. - -EXPORTS - -; MemoryAllocator.cpp -scalable_calloc -scalable_free -scalable_malloc -scalable_realloc -scalable_posix_memalign -scalable_aligned_malloc -scalable_aligned_realloc -scalable_aligned_free -safer_scalable_free -safer_scalable_realloc - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win64-tbbmalloc-export.def b/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win64-tbbmalloc-export.def deleted file mode 100644 index 6ac1b97e6a..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/tbbmalloc/win64-tbbmalloc-export.def +++ /dev/null @@ -1,39 +0,0 @@ -; Copyright 2005-2009 Intel Corporation. All Rights Reserved. -; -; This file is part of Threading Building Blocks. -; -; Threading Building Blocks is free software; you can redistribute it -; and/or modify it under the terms of the GNU General Public License -; version 2 as published by the Free Software Foundation. -; -; Threading Building Blocks is distributed in the hope that it will be -; useful, but WITHOUT ANY WARRANTY; without even the implied warranty -; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with Threading Building Blocks; if not, write to the Free Software -; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -; -; As a special exception, you may use this file as part of a free software -; library without restriction. Specifically, if other files instantiate -; templates or use macros or inline functions from this file, or you compile -; this file and link it with other files to produce an executable, this -; file does not by itself cause the resulting executable to be covered by -; the GNU General Public License. This exception does not however -; invalidate any other reasons why the executable file might be covered by -; the GNU General Public License. - -EXPORTS - -; MemoryAllocator.cpp -scalable_calloc -scalable_free -scalable_malloc -scalable_realloc -scalable_posix_memalign -scalable_aligned_malloc -scalable_aligned_realloc -scalable_aligned_free -safer_scalable_free -safer_scalable_realloc diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness.h deleted file mode 100644 index fc99b5dd4c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness.h +++ /dev/null @@ -1,301 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Declarations for rock-bottom simple test harness. -// Just include this file to use it. -// Every test is presumed to have a command line of the form "foo [-v] [nthread]" -// The default for nthread is 2. - -#if __SUNPRO_CC -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#else -#include <cstdio> -#include <cstdlib> -#include <cstring> -#endif -#include <new> - -#if _WIN32||_WIN64 - #include <windows.h> - #include <process.h> -#else - #include <pthread.h> -#endif - -#if !HARNESS_NO_ASSERT -#include "harness_assert.h" - -typedef void (*test_error_extra_t)(void); -static test_error_extra_t ErrorExtraCall; -//! Set additional handler to process failed assertions -void SetHarnessErrorProcessing( test_error_extra_t extra_call ) { - ErrorExtraCall = extra_call; - // TODO: add tbb::set_assertion_handler(ReportError); -} -//! Reports errors issued by failed assertions -void ReportError( const char* filename, int line, const char* expression, const char * message ) { - printf("%s:%d, assertion %s: %s\n", filename, line, expression, message ? message : "failed" ); - if( ErrorExtraCall ) - (*ErrorExtraCall)(); -#if TBB_EXIT_ON_ASSERT - exit(1); -#else - abort(); -#endif /* TBB_EXIT_ON_ASSERT */ -} -//! Reports warnings issued by failed warning assertions -void ReportWarning( const char* filename, int line, const char* expression, const char * message ) { - printf("Warning: %s:%d, assertion %s: %s\n", filename, line, expression, message ? message : "failed" ); -} -#else -#define ASSERT(p,msg) ((void)0) -#define ASSERT_WARNING(p,msg) ((void)0) -#endif /* HARNESS_NO_ASSERT */ - -#if !HARNESS_NO_PARSE_COMMAND_LINE -//! Controls level of commentary. -/** If true, makes the test print commentary. If false, test should print "done" and nothing more. */ -static bool Verbose; - -//! Minimum number of threads -/** The default is 0, which is typically interpreted by tests as "run without TBB". */ -static int MinThread = 0; - -//! Maximum number of threads -static int MaxThread = 2; - -//! Parse command line of the form "name [-v] [nthread]" -/** Sets Verbose, MinThread, and MaxThread accordingly. - The nthread argument can be a single number or a range of the form m:n. - A single number m is interpreted as if written m:m. - The numbers must be non-negative. - Clients often treat the value 0 as "run sequentially." */ -static void ParseCommandLine( int argc, char* argv[] ) { - int i = 1; - if( i<argc ) { - if( strcmp( argv[i], "-v" )==0 ) { - Verbose = true; - ++i; - } - } - if( i<argc ) { - char* endptr; - MinThread = strtol( argv[i], &endptr, 0 ); - if( *endptr==':' ) - MaxThread = strtol( endptr+1, &endptr, 0 ); - else if( *endptr=='\0' ) - MaxThread = MinThread; - if( *endptr!='\0' ) { - printf("garbled nthread range\n"); - exit(1); - } - if( MinThread<0 ) { - printf("nthread must be nonnegative\n"); - exit(1); - } - if( MaxThread<MinThread ) { - printf("nthread range is backwards\n"); - exit(1); - } - ++i; - } - if( i!=argc ) { - printf("Usage: %s [-v] [nthread|minthread:maxthread]\n", argv[0] ); - exit(1); - } -} -#endif /* HARNESS_NO_PARSE_COMMAND_LINE */ - -//! Base class for prohibiting compiler-generated operator= -class NoAssign { - //! Assignment not allowed - void operator=( const NoAssign& ); -public: -#if __GNUC__ - //! Explicitly define default construction, because otherwise gcc issues gratuitous warning. - NoAssign() {} -#endif /* __GNUC__ */ -}; - -//! Base class for prohibiting compiler-generated copy constructor or operator= -class NoCopy: NoAssign { - //! Copy construction not allowed - NoCopy( const NoCopy& ); -public: - NoCopy() {} -}; - -//! For internal use by template function NativeParallelFor -template<typename Index, typename Body> -class NativeParallelForTask: NoCopy { -public: - NativeParallelForTask( Index index_, const Body& body_ ) : - index(index_), - body(body_) - {} - - //! Start task - void start() { -#if _WIN32||_WIN64 - unsigned thread_id; - thread_handle = (HANDLE)_beginthreadex( NULL, 0, thread_function, this, 0, &thread_id ); - ASSERT( thread_handle!=0, "NativeParallelFor: _beginthreadex failed" ); -#else -#if __ICC==1100 - #pragma warning (push) - #pragma warning (disable: 2193) -#endif /* __ICC==1100 */ - // Some machines may have very large hard stack limit. When the test is - // launched by make, the default stack size is set to the hard limit, and - // calls to pthread_create fail with out-of-memory error. - // Therefore we set the stack size explicitly (as for TBB worker threads). - const size_t MByte = 1<<20; -#if __i386__||__i386 - const size_t stack_size = 1*MByte; -#elif __x86_64__ - const size_t stack_size = 2*MByte; -#else - const size_t stack_size = 4*MByte; -#endif - pthread_attr_t attr_stack; - int status = pthread_attr_init(&attr_stack); - ASSERT(0==status, "NativeParallelFor: pthread_attr_init failed"); - status = pthread_attr_setstacksize( &attr_stack, stack_size ); - ASSERT(0==status, "NativeParallelFor: pthread_attr_setstacksize failed"); - status = pthread_create(&thread_id, &attr_stack, thread_function, this); - ASSERT(0==status, "NativeParallelFor: pthread_create failed"); - pthread_attr_destroy(&attr_stack); -#if __ICC==1100 - #pragma warning (pop) -#endif -#endif /* _WIN32||_WIN64 */ - } - - //! Wait for task to finish - void wait_to_finish() { -#if _WIN32||_WIN64 - DWORD status = WaitForSingleObject( thread_handle, INFINITE ); - ASSERT( status!=WAIT_FAILED, "WaitForSingleObject failed" ); - CloseHandle( thread_handle ); -#else - int status = pthread_join( thread_id, NULL ); - ASSERT( !status, "pthread_join failed" ); -#endif - } - -private: -#if _WIN32||_WIN64 - HANDLE thread_handle; -#else - pthread_t thread_id; -#endif - - //! Range over which task will invoke the body. - const Index index; - - //! Body to invoke over the range. - const Body body; - -#if _WIN32||_WIN64 - static unsigned __stdcall thread_function( void* object ) -#else - static void* thread_function(void* object) -#endif - { - NativeParallelForTask& self = *static_cast<NativeParallelForTask*>(object); -#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__SUNPRO_CC) - try { - (self.body)(self.index); - } catch(...) { - ASSERT( false, "uncaught exception" ); - } -#else - (self.body)(self.index); -#endif// exceptions are enabled - return 0; - } -}; - -//! Execute body(i) in parallel for i in the interval [0,n). -/** Each iteartion is performed by a separate thread. */ -template<typename Index, typename Body> -void NativeParallelFor( Index n, const Body& body ) { - typedef NativeParallelForTask<Index,Body> task; - - if( n>0 ) { - // Allocate array to hold the tasks - task* array = static_cast<task*>(operator new( n*sizeof(task) )); - - // Construct the tasks - for( Index i=0; i!=n; ++i ) - new( &array[i] ) task(i,body); - - // Start the tasks - for( Index i=0; i!=n; ++i ) - array[i].start(); - - // Wait for the tasks to finish and destroy each one. - for( Index i=n; i; --i ) { - array[i-1].wait_to_finish(); - array[i-1].~task(); - } - - // Deallocate the task array - operator delete(array); - } -} - -//! The function to zero-initialize arrays; useful to avoid warnings -template <typename T> -void zero_fill(void* array, size_t N) { - memset(array, 0, sizeof(T)*N); -} - -#ifndef min - //! Utility template function returning lesser of the two values. - /** Provided here to avoid including not strict safe <algorithm>.\n - In case operands cause signed/unsigned or size mismatch warnings it is caller's - responsibility to do the appropriate cast before calling the function. **/ - template<typename T1, typename T2> - T1 min ( const T1& val1, const T2& val2 ) { - return val1 < val2 ? val1 : val2; - } -#endif /* !min */ - -#ifndef max - //! Utility template function returning greater of the two values. Provided here to avoid including not strict safe <algorithm>. - /** Provided here to avoid including not strict safe <algorithm>.\n - In case operands cause signed/unsigned or size mismatch warnings it is caller's - responsibility to do the appropriate cast before calling the function. **/ - template<typename T1, typename T2> - T1 max ( const T1& val1, const T2& val2 ) { - return val1 < val2 ? val2 : val1; - } -#endif /* !max */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_allocator.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_allocator.h deleted file mode 100644 index 92302d9980..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_allocator.h +++ /dev/null @@ -1,228 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Declarations for simple estimate of the memory being used by a program. -// Not yet implemented for Mac. -// This header is an optional part of the test harness. -// It assumes that "harness_assert.h" has already been included. - -#if __linux__ -#include <unistd.h> -#elif __APPLE__ || __sun -#include <unistd.h> -#elif _WIN32 -#include <windows.h> -#endif -#include <new> -#include <stdexcept> -#include <tbb/atomic.h> - -#if __SUNPRO_CC -using std::printf; -#endif - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (push) - #pragma warning (disable: 4267) -#endif - - -template <typename base_alloc_t, typename count_t = tbb::atomic<size_t> > -class static_counting_allocator : public base_alloc_t -{ -public: - typedef typename base_alloc_t::pointer pointer; - typedef typename base_alloc_t::const_pointer const_pointer; - typedef typename base_alloc_t::reference reference; - typedef typename base_alloc_t::const_reference const_reference; - typedef typename base_alloc_t::value_type value_type; - typedef typename base_alloc_t::size_type size_type; - typedef typename base_alloc_t::difference_type difference_type; - template<typename U> struct rebind { - typedef static_counting_allocator<typename base_alloc_t::template rebind<U>::other,count_t> other; - }; - - static size_t max_items; - static count_t items_allocated; - static count_t items_freed; - static count_t allocations; - static count_t frees; - static bool verbose, throwing; - - static_counting_allocator() throw() { } - - static_counting_allocator(const static_counting_allocator&) throw() { } - - template<typename U, typename C> - static_counting_allocator(const static_counting_allocator<U, C>&) throw() { } - - bool operator==(const static_counting_allocator &a) const - { return true; } - - pointer allocate(const size_type n) - { - if(verbose) printf("\t+%d|", int(n)); - if(max_items && items_allocated + n >= max_items) { - if(verbose) printf("items limit hits!"); - if(throwing) throw std::bad_alloc(); - return NULL; - } - allocations++; - items_allocated += n; - return base_alloc_t::allocate(n, pointer(0)); - } - - pointer allocate(const size_type n, const void * const) - { return allocate(n); } - - void deallocate(const pointer ptr, const size_type n) - { - if(verbose) printf("\t-%d|", int(n)); - frees++; - items_freed += n; - base_alloc_t::deallocate(ptr, n); - } - - static void init_counters(bool v = false) { - verbose = v; - if(verbose) printf("\n------------------------------------------- Allocations:\n"); - items_allocated = 0; - items_freed = 0; - allocations = 0; - frees = 0; - max_items = 0; - } - - static void set_limits(size_type max = 0, bool do_throw = true) { - max_items = max; - throwing = do_throw; - } -}; - -template <typename base_alloc_t, typename count_t> -size_t static_counting_allocator<base_alloc_t, count_t>::max_items; -template <typename base_alloc_t, typename count_t> -count_t static_counting_allocator<base_alloc_t, count_t>::items_allocated; -template <typename base_alloc_t, typename count_t> -count_t static_counting_allocator<base_alloc_t, count_t>::items_freed; -template <typename base_alloc_t, typename count_t> -count_t static_counting_allocator<base_alloc_t, count_t>::allocations; -template <typename base_alloc_t, typename count_t> -count_t static_counting_allocator<base_alloc_t, count_t>::frees; -template <typename base_alloc_t, typename count_t> -bool static_counting_allocator<base_alloc_t, count_t>::verbose; -template <typename base_alloc_t, typename count_t> -bool static_counting_allocator<base_alloc_t, count_t>::throwing; - -template <typename base_alloc_t, typename count_t = tbb::atomic<size_t> > -class local_counting_allocator : public base_alloc_t -{ -public: - typedef typename base_alloc_t::pointer pointer; - typedef typename base_alloc_t::const_pointer const_pointer; - typedef typename base_alloc_t::reference reference; - typedef typename base_alloc_t::const_reference const_reference; - typedef typename base_alloc_t::value_type value_type; - typedef typename base_alloc_t::size_type size_type; - typedef typename base_alloc_t::difference_type difference_type; - template<typename U> struct rebind { - typedef local_counting_allocator<typename base_alloc_t::template rebind<U>::other,count_t> other; - }; - - count_t items_allocated; - count_t items_freed; - count_t allocations; - count_t frees; - size_t max_items; - - local_counting_allocator() throw() { - items_allocated = 0; - items_freed = 0; - allocations = 0; - frees = 0; - max_items = 0; - } - - local_counting_allocator(const local_counting_allocator &a) throw() - : items_allocated(a.items_allocated) - , items_freed(a.items_freed) - , allocations(a.allocations) - , frees(a.frees) - , max_items(a.max_items) - { } - - template<typename U, typename C> - local_counting_allocator(const static_counting_allocator<U,C> &) throw() { - items_allocated = static_counting_allocator<U,C>::items_allocated; - items_freed = static_counting_allocator<U,C>::items_freed; - allocations = static_counting_allocator<U,C>::allocations; - frees = static_counting_allocator<U,C>::frees; - max_items = static_counting_allocator<U,C>::max_items; - } - - template<typename U, typename C> - local_counting_allocator(const local_counting_allocator<U,C> &a) throw() - : items_allocated(a.items_allocated) - , items_freed(a.items_freed) - , allocations(a.allocations) - , frees(a.frees) - , max_items(a.max_items) - { } - - bool operator==(const local_counting_allocator &a) const - { return &a == this; } - - pointer allocate(const size_type n) - { - if(max_items && items_allocated + n >= max_items) - throw std::bad_alloc(); - ++allocations; - items_allocated += n; - return base_alloc_t::allocate(n, pointer(0)); - } - - pointer allocate(const size_type n, const void * const) - { return allocate(n); } - - void deallocate(const pointer ptr, const size_type n) - { - ++frees; - items_freed += n; - base_alloc_t::deallocate(ptr, n); - } - - void set_limits(size_type max = 0) { - max_items = max; - } -}; - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (pop) -#endif // warning 4267 is back diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_assert.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_assert.h deleted file mode 100644 index bc21edb3b6..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_assert.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Just the assertion portion of the harness. -// This is useful for writing portions of tests that include -// the minimal number of necessary header files. -// -// The full "harness.h" must be included later. - -#ifndef harness_assert_H -#define harness_assert_H - -void ReportError( const char* filename, int line, const char* expression, const char* message); -void ReportWarning( const char* filename, int line, const char* expression, const char* message); - -#define ASSERT(p,message) ((p)?(void)0:ReportError(__FILE__,__LINE__,#p,message)) -#define ASSERT_WARNING(p,message) ((p)?(void)0:ReportWarning(__FILE__,__LINE__,#p,message)) - -//! Compile-time error if x and y have different types -template<typename T> -void AssertSameType( const T& /*x*/, const T& /*y*/ ) {} - -#endif /* harness_assert_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_bad_expr.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_bad_expr.h deleted file mode 100644 index ba9353e6aa..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_bad_expr.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Declarations for checking __TBB_ASSERT checks inside TBB. -// This header is an optional part of the test harness. -// It assumes that "harness.h" has already been included. - -//! Check that expression x raises assertion failure with message containing given substring. -/** Assumes that tbb::set_assertion_handler( AssertionFailureHandler ) was called earlier. */ -#define TRY_BAD_EXPR(x,substr) \ - { \ - const char* message = NULL; \ - bool okay = false; \ - try { \ - x; \ - } catch( AssertionFailure a ) { \ - okay = true; \ - message = a.message; \ - } \ - CheckAssertionFailure(__LINE__,#x,okay,message,substr); \ - } - -//! Exception object that holds a message. -struct AssertionFailure { - const char* message; - AssertionFailure( const char* filename, int line, const char* expression, const char* comment ); -}; - -AssertionFailure::AssertionFailure( const char* filename, int line, const char* expression, const char* comment ) : - message(comment) -{ - ASSERT(filename,"missing filename"); - ASSERT(0<line,"line number must be positive"); - // All of our current files have fewer than 4000 lines. - ASSERT(line<5000,"dubiously high line number"); - ASSERT(expression,"missing expression"); -} - -void AssertionFailureHandler( const char* filename, int line, const char* expression, const char* comment ) { - throw AssertionFailure(filename,line,expression,comment); -} - -void CheckAssertionFailure( int line, const char* expression, bool okay, const char* message, const char* substr ) { - if( !okay ) { - printf("Line %d, %s failed to fail\n", line, expression ); - abort(); - } else if( !message ) { - printf("Line %d, %s failed without a message\n", line, expression ); - abort(); - } else if( strstr(message,substr)==0 ) { - printf("Line %d, %s failed with message '%s' missing substring '%s'\n", __LINE__, expression, message, substr ); - abort(); - } -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_barrier.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_barrier.h deleted file mode 100644 index cfaaf2b491..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_barrier.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/atomic.h" -#include "../tbb/tbb_misc.h" - -#ifndef harness_barrier_H -#define harness_barrier_H - -namespace Harness { - -class SpinBarrier -{ - unsigned numThreads; - tbb::atomic<unsigned> numThreadsFinished; /* threads reached barrier in this epoch */ - tbb::atomic<unsigned> epoch; /* how many times this barrier used - XXX move to a separate cache line */ - - struct DummyCallback { - void operator() () const {} - }; - - SpinBarrier( const SpinBarrier& ); // no copy ctor - void operator=( const SpinBarrier& ); // no assignment -public: - SpinBarrier( unsigned nthreads ) { initialize(nthreads); }; - - void initialize( unsigned nthreads ) { - numThreads = nthreads; - numThreadsFinished = 0; - epoch = 0; - }; - - // onOpenBarrierCallback is called by last thread arrived on a barrier - template<typename Callback> - bool wait(const Callback &onOpenBarrierCallback) - { // return true if last thread - unsigned myEpoch = epoch; - int threadsLeft = numThreads - numThreadsFinished.fetch_and_increment() - 1; - ASSERT(threadsLeft>=0, "Broken barrier"); - if (threadsLeft > 0) { - /* not the last threading reaching barrier, wait until epoch changes & return 0 */ - tbb::internal::SpinwaitWhileEq(epoch, myEpoch); - return false; - } - /* No more threads left to enter, so I'm the last one reaching this epoch; - reset the barrier, increment epoch, and return non-zero */ - onOpenBarrierCallback(); - numThreadsFinished = 0; - epoch = myEpoch+1; /* wakes up threads waiting to exit this epoch */ - return true; - } - bool wait() - { - return wait(DummyCallback()); - } -}; - -} - -#endif //harness_barrier_H diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_cpu.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_cpu.h deleted file mode 100644 index 3ccc8363e7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_cpu.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Declarations for simple estimate of CPU time being used by a program. -// This header is an optional part of the test harness. -// It assumes that "harness_assert.h" has already been included. - -#if _WIN32 -#include <windows.h> -#else -#include <sys/time.h> -#include <sys/resource.h> -#endif - -//! Return time (in seconds) spent by the current process in user mode. -/* Returns 0 if not implemented on platform. */ -static double GetCPUUserTime() { -#if _WIN32 - FILETIME my_times[4]; - bool status = GetProcessTimes(GetCurrentProcess(), my_times, my_times+1, my_times+2, my_times+3)!=0; - ASSERT( status, NULL ); - LARGE_INTEGER usrtime; - usrtime.LowPart = my_times[3].dwLowDateTime; - usrtime.HighPart = my_times[3].dwHighDateTime; - return double(usrtime.QuadPart)*1E-7; -#else - // Generic UNIX, including __APPLE__ - - // On Linux, there is no good way to get CPU usage info for the current process: - // getrusage(RUSAGE_SELF, ...) that is used now only returns info for the calling thread; - // getrusage(RUSAGE_CHILDREN, ...) only counts for finished children threads; - // tms_utime and tms_cutime got with times(struct tms*) are equivalent to the above items; - // finally, /proc/self/task/<task_id>/stat doesn't exist on older kernels - // and it isn't quite convenient to read it for every task_id. - - struct rusage resources; - bool status = getrusage(RUSAGE_SELF, &resources)==0; - ASSERT( status, NULL ); - return (double(resources.ru_utime.tv_sec)*1E6 + double(resources.ru_utime.tv_usec))*1E-6; -#endif -} - -#include "tbb/tick_count.h" -#include <cstdio> - -// The resolution of GetCPUUserTime is 10-15 ms or so; waittime should be a few times bigger. -const double WAITTIME = 0.1; // in seconds, i.e. 100 ms -const double THRESHOLD = WAITTIME/100; - -static void TestCPUUserTime( int nthreads, int nactive = 1 ) { - // The test will always pass on Linux; read the comments in GetCPUUserTime for details - // Also it will not detect spinning issues on systems with only one processing core. - - static double minimal_waittime = WAITTIME; - int nworkers = nthreads-nactive; - if( !nworkers ) return; - - double usrtime; - double lastusrtime = GetCPUUserTime(); - while( (usrtime=GetCPUUserTime())-lastusrtime < THRESHOLD ) - ; // wait for GetCPUUserTime update - lastusrtime = usrtime; - - // Test that all workers sleep when no work. - double waittime; - tbb::tick_count stamp = tbb::tick_count::now(); - while( ((waittime=(tbb::tick_count::now()-stamp).seconds()) < minimal_waittime) - || ((usrtime=GetCPUUserTime()-lastusrtime) < THRESHOLD) ) - ; // Wait for workers to go sleep - - while( nactive>1 && usrtime-nactive*waittime<0 ) { - // probably the number of active threads was mispredicted - --nactive; ++nworkers; - } - double avg_worker_usrtime = (usrtime-nactive*waittime)/nworkers; - - if( avg_worker_usrtime > waittime/2 ) - printf( "ERROR: %d worker threads are spinning; waittime: %g; usrtime: %g; avg worker usrtime: %g\n", - nworkers, waittime, usrtime, avg_worker_usrtime); - else if( Verbose ) - printf("%d worker threads; waittime: %g; usrtime: %g; avg worker usrtime: %g\n", - nworkers, waittime, usrtime, avg_worker_usrtime); -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_m128.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_m128.h deleted file mode 100644 index e23ce53fa4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_m128.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Header that sets HAVE_m128 if we have type __m128 - -#if (__SSE__||_M_IX86) && !defined(__sun) -#include <xmmintrin.h> -#define HAVE_m128 1 -#endif /* __SSE__||_M_IX86 */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_memory.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_memory.h deleted file mode 100644 index 30b1dd0e5c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_memory.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Declarations for simple estimate of the memory being used by a program. -// Not yet implemented for Mac. -// This header is an optional part of the test harness. -// It assumes that "harness_assert.h" has already been included. - -#if __linux__ || __sun -#include <sys/resource.h> -#include <unistd.h> - -#elif __APPLE__ -#include <unistd.h> -#include <mach/mach.h> -#include <mach/shared_memory_server.h> -#if SHARED_TEXT_REGION_SIZE || SHARED_DATA_REGION_SIZE -const size_t shared_size = SHARED_TEXT_REGION_SIZE+SHARED_DATA_REGION_SIZE; -#else -const size_t shared_size = 0; -#endif - -#elif _WIN32 -#include <windows.h> -#include <psapi.h> -#pragma comment(lib, "psapi") -#endif - -//! Return estimate of number of bytes of memory that this program is currently using. -/* Returns 0 if not implemented on platform. */ -size_t GetMemoryUsage() { -#if __linux__ - FILE* statsfile = fopen("/proc/self/statm","r"); - size_t pagesize = getpagesize(); - ASSERT(statsfile, NULL); - long total_mem; - int n = fscanf(statsfile,"%lu",&total_mem); - if( n!=1 ) { - printf("Warning: memory usage statistics wasn't obtained\n"); - return 0; - } - fclose(statsfile); - return total_mem*pagesize; -#elif __APPLE__ - kern_return_t status; - task_basic_info info; - mach_msg_type_number_t msg_type = TASK_BASIC_INFO_COUNT; - status = task_info(mach_task_self(), TASK_BASIC_INFO, reinterpret_cast<task_info_t>(&info), &msg_type); - ASSERT(status==KERN_SUCCESS, NULL); - return info.virtual_size - shared_size; -#elif _WIN32 - PROCESS_MEMORY_COUNTERS mem; - bool status = GetProcessMemoryInfo(GetCurrentProcess(), &mem, sizeof(mem))!=0; - ASSERT(status, NULL); - return mem.PagefileUsage; -#else - return 0; -#endif -} - -//! Use approximately a specified amount of stack space. -/** Recursion is used here instead of alloca because some implementations of alloca do not use the stack. */ -void UseStackSpace( size_t amount, char* top=0 ) { - char x[1000]; - memset( x, -1, sizeof(x) ); - if( !top ) - top = x; - ASSERT( x<=top, "test assumes that stacks grow downwards" ); - if( size_t(top-x)<amount ) - UseStackSpace( amount, top ); -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_sleep.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_sleep.h deleted file mode 100644 index 188aa0399f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_sleep.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef tbb_tests_harness_sleep_H -#define tbb_tests_harness_sleep_H - -namespace Harness { -#if _WIN32 || _WIN64 - void Sleep ( int ms ) { ::Sleep(ms); } -#else /* !WIN */ - void Sleep ( int ms ) { - timespec requested = { ms / 1000, (ms % 1000)*1000000 }; - timespec remaining = {0}; - nanosleep(&requested, &remaining); - } -#endif /* !WIN */ -} - -#endif /* tbb_tests_harness_sleep_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_trace.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_trace.h deleted file mode 100644 index 53dda21815..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/harness_trace.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Just the tracing portion of the harness. -// -// This header defines TRACE and TRCAENL macros, which use printf like syntax and -// are useful for duplicating trace output to the standard debug output on Windows. -// It is possible to add the ability of automatic extending messages with additional -// info (file, line, function, time, thread ID, ...). -// -// Macros output nothing when test app runs in non-verbose mode (default). -// -// The full "harness.h" must be included before this header. - -#ifndef tbb_tests_harness_trace_H -#define tbb_tests_harness_trace_H - -#if defined(MAX_TRACE_SIZE) && MAX_TRACE_SIZE < 1024 - #undef MAX_TRACE_SIZE -#endif -#ifndef MAX_TRACE_SIZE - #define MAX_TRACE_SIZE 1024 -#endif - -#include <cstdarg> - -#if _WIN32||_WIN64 - #define snprintf _snprintf -#endif -#if defined(_MSC_VER) && (_MSC_VER<=1400) - #define vsnprintf _vsnprintf -#endif - -namespace harness_internal { - - struct tracer_t - { - int my_flags; - const char *my_file; - const char *my_func; - size_t my_line; - - enum { - prefix = 1, - need_lf = 2 - }; - - tracer_t* set_trace_info ( int flags, const char *file, size_t line, const char *func ) - { - my_flags = flags; - my_line = line; - my_file = file; - my_func = func; - return this; - } - - void trace ( const char* fmt, ... ) - { - char msg[MAX_TRACE_SIZE]; - char msg_fmt_buf[MAX_TRACE_SIZE]; - const char *msg_fmt = fmt; - if ( my_flags & prefix ) { - snprintf (msg_fmt_buf, MAX_TRACE_SIZE, "[%s] %s", my_func, fmt); - msg_fmt = msg_fmt_buf; - } - std::va_list argptr; - va_start (argptr, fmt); - int len = vsnprintf (msg, MAX_TRACE_SIZE, msg_fmt, argptr); - va_end (argptr); - if ( my_flags & need_lf && - len < MAX_TRACE_SIZE - 1 && msg_fmt[len-1] != '\n' ) - { - msg[len] = '\n'; - msg[len + 1] = 0; - } - printf ("%s",msg); - fflush(stdout); -#if _WIN32 || _WIN64 - OutputDebugStringA(msg); -#endif - } - }; // class tracer_t - - static tracer_t tracer; - - template<int> - bool not_the_first_call () { - static bool first_call = false; - bool res = first_call; - first_call = true; - return res; - } -} // namespace harness_internal - -#if defined(_MSC_VER) && _MSC_VER >= 1300 || defined(__GNUC__) || defined(__GNUG__) - #define HARNESS_TRACE_ORIG_INFO __FILE__, __LINE__, __FUNCTION__ -#else - #define HARNESS_TRACE_ORIG_INFO __FILE__, __LINE__, "" - #define __FUNCTION__ "" -#endif - - -//! printf style tracing macro -/** This variant of TRACE adds trailing line-feed (new line) character, if it is absent. **/ -#define TRACE harness_internal::tracer.set_trace_info(harness_internal::tracer_t::need_lf, HARNESS_TRACE_ORIG_INFO)->trace - -//! printf style tracing macro without automatic new line character adding -#define TRACENL harness_internal::tracer.set_trace_info(0, HARNESS_TRACE_ORIG_INFO)->trace - -//! printf style tracing macro with additional information prefix (e.g. current function name) -#define TRACEP harness_internal::tracer.set_trace_info(harness_internal::tracer_t::prefix | \ - harness_internal::tracer_t::need_lf, HARNESS_TRACE_ORIG_INFO)->trace - -//! printf style remark macro -/** Produces output only when the test is run with the -v (verbose) option. **/ -#define REMARK !Verbose ? (void)0 : TRACE - -//! printf style remark macro -/** Produces output only when invoked first time. - Only one instance of this macro is allowed per source code line. **/ -#define REMARK_ONCE (!Verbose || harness_internal::not_the_first_call<__LINE__>()) ? (void)0 : TRACE - -#endif /* tbb_tests_harness_trace_H */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator.cpp deleted file mode 100644 index 6c58bbcbe4..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Test whether scalable_allocator complies with the requirements in 20.1.5 of ISO C++ Standard (1998). - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 - -#include "tbb/scalable_allocator.h" - -// the actual body of the test is there: -#include "test_allocator.h" - -#if _MSC_VER -#include <windows.h> -#endif /* _MSC_VER */ - -int main(void) -{ -#if _MSC_VER && !__TBBMALLOC_NO_IMPLICIT_LINKAGE - #ifdef _DEBUG - ASSERT(!GetModuleHandle("tbbmalloc.dll") && GetModuleHandle("tbbmalloc_debug.dll"), - "debug application links with non-debug tbbmalloc library"); - #else - ASSERT(!GetModuleHandle("tbbmalloc_debug.dll") && GetModuleHandle("tbbmalloc.dll"), - "non-debug application links with debug tbbmalloc library"); - #endif -#endif /* _MSC_VER && !__TBBMALLOC_NO_IMPLICIT_LINKAGE */ - int result = TestMain<tbb::scalable_allocator<void> >(); - printf("done\n"); - return result; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator_STL.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator_STL.cpp deleted file mode 100644 index 4b1397fe46..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ScalableAllocator_STL.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Test whether scalable_allocator works with some of the host's STL containers. - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -#include "tbb/scalable_allocator.h" - -// The actual body of the test is there: -#include "test_allocator_STL.h" - -int main() { - TestAllocatorWithSTL<tbb::scalable_allocator>(); - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_aligned_space.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_aligned_space.cpp deleted file mode 100644 index 647a083840..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_aligned_space.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -//! Wrapper around T where all members are private. -/** Used to prove that aligned_space<T,N> never calls member of T. */ -template<typename T> -class Minimal { - Minimal(); - Minimal( Minimal& min ); - ~Minimal(); - void operator=( const Minimal& ); - T pad; -public: - friend void AssignToCheckAlignment( Minimal& dst, const Minimal& src ) { - dst.pad = src.pad; - } -}; - -#include "tbb/aligned_space.h" -#include "harness_assert.h" - -static bool SpaceWasted; - -template<typename U, size_t N> -void TestAlignedSpaceN() { - typedef Minimal<U> T; - struct { - //! Pad byte increases chance that subsequent member will be misaligned if there is a problem. - char pad; - tbb::aligned_space<T ,N> space; - } x; - AssertSameType( static_cast< T *>(0), x.space.begin() ); - AssertSameType( static_cast< T *>(0), x.space.end() ); - ASSERT( reinterpret_cast<void *>(x.space.begin())==reinterpret_cast< void *>(&x.space), NULL ); - ASSERT( x.space.end()-x.space.begin()==N, NULL ); - ASSERT( reinterpret_cast<void *>(x.space.begin())>=reinterpret_cast< void *>(&x.space), NULL ); - ASSERT( x.space.end()<=reinterpret_cast< T *>(&x.space+1), NULL ); - // Though not required, a good implementation of aligned_space<T,N> does not use any more space than a T[N]. - SpaceWasted |= sizeof(x.space)!=sizeof(T)*N; - for( size_t k=1; k<N; ++k ) - AssignToCheckAlignment( x.space.begin()[k-1], x.space.begin()[k] ); -} - -static void PrintSpaceWastingWarning( const char* type_name ); - -#include <typeinfo> - -template<typename T> -void TestAlignedSpace() { - SpaceWasted = false; - TestAlignedSpaceN<T,1>(); - TestAlignedSpaceN<T,2>(); - TestAlignedSpaceN<T,3>(); - TestAlignedSpaceN<T,4>(); - TestAlignedSpaceN<T,5>(); - TestAlignedSpaceN<T,6>(); - TestAlignedSpaceN<T,7>(); - TestAlignedSpaceN<T,8>(); - if( SpaceWasted ) - PrintSpaceWastingWarning( typeid(T).name() ); -} - -#include "harness_m128.h" -#include <cstdio> // Inclusion of <cstdio> deferred, to improve odds of detecting accidental dependences on it. - -int main() { - TestAlignedSpace<char>(); - TestAlignedSpace<short>(); - TestAlignedSpace<int>(); - TestAlignedSpace<float>(); - TestAlignedSpace<double>(); - TestAlignedSpace<long double>(); - TestAlignedSpace<size_t>(); -#if HAVE_m128 - TestAlignedSpace<__m128>(); -#endif /* HAVE_m128 */ - std::printf("done\n"); - return 0; -} - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -#include "harness.h" - -static void PrintSpaceWastingWarning( const char* type_name ) { - std::printf("Consider rewriting aligned_space<%s,N> to waste less space\n", type_name ); -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator.h deleted file mode 100644 index 87d6de3a5e..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Basic testing of an allocator -// Tests against requirements in 20.1.5 of ISO C++ Standard (1998). -// Does not check for thread safety or false sharing issues. -// -// Tests for compatibility with the host's STL are in -// test_Allocator_STL.h. Those tests are in a separate file -// because they bring in lots of STL headers, and the tests here -// are supposed to work in the abscense of STL. - -#include "harness.h" - -int NumberOfFoo; - -template<typename T, size_t N> -struct Foo { - T foo_array[N]; - Foo() { - zero_fill<T>(foo_array, N); - ++NumberOfFoo; - } - Foo( const Foo& x ) { - *this = x; - ++NumberOfFoo; - } - ~Foo() { - --NumberOfFoo; - } -}; - -inline char PseudoRandomValue( size_t j, size_t k ) { - return char(j*3 ^ j>>4 ^ k); -} - -//! T is type and A is allocator for that type -template<typename T, typename A> -void TestBasic( A& a ) { - T x; - const T cx = T(); - - // See Table 32 in ISO ++ Standard - typename A::pointer px = &x; - typename A::const_pointer pcx = &cx; - - typename A::reference rx = x; - ASSERT( &rx==&x, NULL ); - - typename A::const_reference rcx = cx; - ASSERT( &rcx==&cx, NULL ); - - typename A::value_type v = x; - - typename A::size_type size; - size = 0; - --size; - ASSERT( size>0, "not an unsigned integral type?" ); - - typename A::difference_type difference; - difference = 0; - --difference; - ASSERT( difference<0, "not an signed integral type?" ); - - // "rebind" tested by our caller - - ASSERT( a.address(rx)==px, NULL ); - - ASSERT( a.address(rcx)==pcx, NULL ); - - typename A::pointer array[100]; - size_t sizeof_T = sizeof(T); - for( size_t k=0; k<100; ++k ) { - array[k] = k&1 ? a.allocate(k,array[0]) : a.allocate(k); - char* s = reinterpret_cast<char*>(reinterpret_cast<void*>(array[k])); - for( size_t j=0; j<k*sizeof_T; ++j ) - s[j] = PseudoRandomValue(j,k); - } - - // Test hint argument. This can't be compiled when hint is void*, It should be const void* - typename A::pointer a_ptr; - const void * const_hint = NULL; - a_ptr = a.allocate (1, const_hint); - a.deallocate(a_ptr, 1); - - // Test "a.deallocate(p,n) - for( size_t k=0; k<100; ++k ) { - char* s = reinterpret_cast<char*>(reinterpret_cast<void*>(array[k])); - for( size_t j=0; j<k*sizeof_T; ++j ) - ASSERT( s[j] == PseudoRandomValue(j,k), NULL ); - a.deallocate(array[k],k); - } - - // Test "a.max_size()" - AssertSameType( a.max_size(), typename A::size_type(0) ); - // Following assertion catches case where max_size() is so large that computation of - // number of bytes for such an allocation would overflow size_type. - ASSERT( a.max_size()*typename A::size_type(sizeof(T))>=a.max_size(), "max_size larger than reasonable" ); - - // Test "a1==a2" - A a1, a2; - ASSERT( a1==a2, NULL ); - - // Test "a1!=a2" - ASSERT( !(a1!=a2), NULL ); - - // Test "a.construct(p,t)" - int n = NumberOfFoo; - typename A::pointer p = a.allocate(1); - a.construct( p, cx ); - ASSERT( NumberOfFoo==n+1, "constructor for Foo not called?" ); - - // Test "a.destroy(p)" - a.destroy( p ); - ASSERT( NumberOfFoo==n, "destructor for Foo not called?" ); - a.deallocate(p,1); -} - -#include "tbb/blocked_range.h" - -// A is an allocator for some type -template<typename A> -struct Body: NoAssign { - static const size_t max_k = 100000; - A &a; - Body(A &a_) : a(a_) {} - void check_allocate( typename A::pointer array[], size_t i, size_t t ) const - { - ASSERT(array[i] == 0, NULL); - size_t size = i * (i&3); - array[i] = i&1 ? a.allocate(size, array[i>>3]) : a.allocate(size); - char* s = reinterpret_cast<char*>(reinterpret_cast<void*>(array[i])); - for( size_t j=0; j<size*sizeof(A); ++j ) - s[j] = PseudoRandomValue(i, t); - } - - void check_deallocate( typename A::pointer array[], size_t i, size_t t ) const - { - ASSERT(array[i] != 0, NULL); - size_t size = i * (i&3); - char* s = reinterpret_cast<char*>(reinterpret_cast<void*>(array[i])); - for( size_t j=0; j<size*sizeof(A); ++j ) - ASSERT( s[j] == PseudoRandomValue(i, t), "Thread safety test failed" ); - a.deallocate(array[i], size); - array[i] = 0; - } - - void operator()( size_t thread_id ) const { - typename A::pointer array[256]; - - for( size_t k=0; k<256; ++k ) - array[k] = 0; - for( size_t k=0; k<max_k; ++k ) { - size_t i = static_cast<unsigned char>(PseudoRandomValue(k,thread_id)); - if(!array[i]) check_allocate(array, i, thread_id); - else check_deallocate(array, i, thread_id); - } - for( size_t k=0; k<256; ++k ) - if(array[k]) - check_deallocate(array, k, thread_id); - } -}; - -// A is an allocator for some type, and U is another type -template<typename A, typename U> -void Test() { - typename A::template rebind<U>::other b; - TestBasic<U>(b); - - A a(b); - TestBasic<typename A::value_type>(a); - - // thread safety - int n = NumberOfFoo; - NativeParallelFor( 4, Body<A>(a) ); - ASSERT( NumberOfFoo==n, "Allocate/deallocate count mismatched" ); - - ASSERT( a==b, NULL ); - ASSERT( !(a!=b), NULL ); -} - -template<typename Allocator> -int TestMain() { - Test<typename Allocator::template rebind<Foo<char,1> >::other, Foo<int,17> >(); - Test<typename Allocator::template rebind<Foo<double,1> >::other, Foo<float,23> >(); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator_STL.h b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator_STL.h deleted file mode 100644 index caa81f59f3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_allocator_STL.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Tests for compatibility with the host's STL. - -#include "harness.h" - -template<typename Container> -void TestSequence() { - Container c; - for( int i=0; i<1000; ++i ) - c.push_back(i*i); - typename Container::const_iterator p = c.begin(); - for( int i=0; i<1000; ++i ) { - ASSERT( *p==i*i, NULL ); - ++p; - } -} - -template<typename Set> -void TestSet() { - Set s; - typedef typename Set::value_type value_type; - for( int i=0; i<100; ++i ) - s.insert(value_type(3*i)); - for( int i=0; i<300; ++i ) { - ASSERT( s.erase(i)==size_t(i%3==0), NULL ); - } -} - -template<typename Map> -void TestMap() { - Map m; - typedef typename Map::value_type value_type; - for( int i=0; i<100; ++i ) - m.insert(value_type(i,i*i)); - for( int i=0; i<100; ++i ) - ASSERT( m.find(i)->second==i*i, NULL ); -} - -#include <deque> -#include <list> -#include <map> -#include <set> -#include <vector> - -template<template<typename T> class Allocator> -void TestAllocatorWithSTL() { - // Sequenced containers - TestSequence<std::deque <int,Allocator<int> > >(); - TestSequence<std::list <int,Allocator<int> > >(); - TestSequence<std::vector<int,Allocator<int> > >(); - - // Associative containers - TestSet<std::set <int, std::less<int>, Allocator<int> > >(); - TestSet<std::multiset<int, std::less<int>, Allocator<int> > >(); - TestMap<std::map <int, int, std::less<int>, Allocator<std::pair<const int,int> > > >(); - TestMap<std::multimap<int, int, std::less<int>, Allocator<std::pair<const int,int> > > >(); - -#if _WIN32||_WIN64 - // Test compatibility with Microsoft's implementation of std::allocator for some cases that - // are undefined according to the ISO standard but permitted by Microsoft. - TestSequence<std::deque <const int,Allocator<const int> > >(); -#if _CPPLIB_VER>=500 - TestSequence<std::list <const int,Allocator<const int> > >(); -#endif /* _CPPLIB_VER>=500 */ - TestSequence<std::vector<const int,Allocator<const int> > >(); - TestSet<std::set<const int, std::less<int>, Allocator<const int> > >(); - TestMap<std::map<int, int, std::less<int>, Allocator<std::pair<int,int> > > >(); - TestMap<std::map<const int, int, std::less<int>, Allocator<std::pair<const int,int> > > >(); - TestMap<std::multimap<int, int, std::less<int>, Allocator<std::pair<int,int> > > >(); - TestMap<std::multimap<const int, int, std::less<int>, Allocator<std::pair<const int,int> > > >(); -#endif /* _WIN32||_WIN64 */ -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_assembly.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_assembly.cpp deleted file mode 100644 index c952733a64..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_assembly.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Program for basic correctness testing of assembly-language routines. -// This program deliberately #includes ../internal/task.cpp so that -// it can get intimate access to the scheduler. - -#define TEST_ASSEMBLY_ROUTINES 1 -#define __TBB_TASK_CPP_DIRECTLY_INCLUDED 1 -// to avoid usage of #pragma comment -#define __TBB_NO_IMPLICIT_LINKAGE 1 - -#include "../tbb/task.cpp" -#include <new> -#include "harness.h" - -namespace tbb { - -namespace internal { - -class TestTask: public task { -public: - /*override*/ task* execute() { - return NULL; - } - const char* name; - TestTask( const char* name_ ) : name(name_) {} -}; - -void GenericScheduler::test_assembly_routines() { - __TBB_ASSERT( assert_okay(), NULL ); -#if __TBB_TASK_DEQUE - try_enter_arena(); - ASSERT( arena_slot->task_pool == dummy_slot.task_pool, "entering arena must not lock the task pool" ); - arena->mark_pool_full(); - acquire_task_pool(); - release_task_pool(); - acquire_task_pool(); // leave_arena requires the pool to be locked - leave_arena(); -#else /* !__TBB_TASK_DEQUE */ - try_enter_arena(); - arena->mark_pool_full(); - release_task_pool(); - long steal_count = 0; - long get_count = 0; - const depth_type n = 5; - const depth_type array_size_proxy = array_size; // using proxy to reduce compilation warnings - ASSERT( array_size-array_size_proxy==0, NULL ); // check validity of the replacement - ASSERT( array_size_proxy>=n, NULL ); - // Loop over insertion levels - for( depth_type i=0; i<n; ++i ) - // Loop over values for "deepest" - for( depth_type d=-1; d<n; ++d ) - // Loop over values for "shallowest" - for( depth_type s=0; s<n; ++s ) - // Loop over depth limits - for( depth_type limit=0; limit<n; ++limit ) - // Loop over whether to insert or not - for( int insert=0; insert<2; ++insert ) - // Loop over whether to steal or get - for( int steal=0; steal<2; ++steal ) { - __TBB_ASSERT( assert_okay(), NULL ); - task** array = dummy_slot.task_pool->array; - for( depth_type k=0; k<array_size_proxy; ++k ) - array[k] = NULL; - dummy_slot.task_pool->prefix().steal_begin = s; - __TBB_ASSERT( assert_okay(), NULL ); - - TestTask& w = *new( task::allocate_root() ) TestTask("w"); - __TBB_ASSERT( assert_okay(), NULL ); - if( d>=0 ) { - w.prefix().depth = int(d); - w.prefix().next = NULL; - w.prefix().state = task::ready; - dummy_slot.task_pool->array[d] = &w; - } - deepest = d; - arena_slot->steal_end = 2*d; - - __TBB_ASSERT( assert_okay(), NULL ); - TestTask& x = *new( task::allocate_root() ) TestTask("x"); - TestTask& y = *new( task::allocate_root() ) TestTask("y"); - TestTask& z = *new( task::allocate_root() ) TestTask("z"); - __TBB_ASSERT( assert_okay(), NULL ); - x.prefix().next = &y; - y.prefix().next = &z; - z.prefix().next = NULL; - ASSERT( x.prefix().next==&y, NULL ); - for( task* p=&x; p; p=p->prefix().next ) - p->prefix().depth = int(i); - __TBB_ASSERT( assert_okay(), NULL ); - z.prefix().next = (task*)(void*)-1; - if( insert ) { - spawn( x, z.prefix().next ); - __TBB_ASSERT( assert_okay(), NULL ); - depth_type expected_deepest = d>=i ? d : i; - ASSERT( deepest==expected_deepest, NULL ); - depth_type expected_shallowest = i<=s ? i : s; - ASSERT( dummy_slot.task_pool->prefix().steal_begin==expected_shallowest, NULL ); - ASSERT( array[i]==&x, NULL ); - ASSERT( x.prefix().next==&y, NULL ); - } - if( steal ) { - task* expected_task = NULL; - depth_type shallowest = dummy_slot.task_pool->prefix().steal_begin; - depth_type expected_shallowest = shallowest; - for( depth_type k=shallowest; k<array_size_proxy; ++k ) { - if( k>=limit && array[k] ) { - expected_task = array[k]; - if( shallowest>=limit ) - expected_shallowest = k; - break; - } - } - __TBB_ASSERT( assert_okay(), NULL ); - task* t = steal_task( *arena_slot, limit ); - ASSERT( (arena_slot->steal_end&1)==0, "forgot to release lock?" ); - __TBB_ASSERT( assert_okay(), NULL ); - ASSERT( t==expected_task, NULL ); - shallowest = dummy_slot.task_pool->prefix().steal_begin; - ASSERT( shallowest==expected_shallowest, NULL ); - ++steal_count; - } else { - task* expected_task = NULL; - for( depth_type k=array_size_proxy-1; k>=limit; --k ) { - if( array[k] ) { - expected_task = array[k]; - ASSERT( deepest==k, NULL ); - break; - } - } - __TBB_ASSERT( assert_okay(), NULL ); - task* t = get_task( limit ); - ASSERT( (arena_slot->steal_end&1)==0, "forgot to release lock?" ); - __TBB_ASSERT( assert_okay(), NULL ); - ASSERT( t==expected_task, NULL ); - ++get_count; - } - } - ASSERT( array_size-array_size_proxy==0, NULL ); // check for any side effects affecting array_size - if( Verbose ) - printf("%ld successful gets and %ld successful steals\n", get_count, steal_count ); -#endif /* !__TBB_TASK_DEQUE */ -} - -//! Test __TBB_CompareAndSwapW -static void TestCompareExchange() { - ASSERT( intptr(-10)<10, "intptr not a signed integral type?" ); - if( Verbose ) - printf("testing __TBB_CompareAndSwapW\n"); - for( intptr a=-10; a<10; ++a ) - for( intptr b=-10; b<10; ++b ) - for( intptr c=-10; c<10; ++c ) { -// Workaround for a bug in GCC 4.3.0; and one more is below. -#if __GNUC__==4&&__GNUC_MINOR__==3&&__GNUC_PATCHLEVEL__==0 - intptr x; - __TBB_store_with_release( x, a ); -#else - intptr x = a; -#endif - intptr y = __TBB_CompareAndSwapW(&x,b,c); - ASSERT( y==a, NULL ); - if( a==c ) - ASSERT( x==b, NULL ); - else - ASSERT( x==a, NULL ); - } -} - -//! Test __TBB___TBB_FetchAndIncrement and __TBB___TBB_FetchAndDecrement -static void TestAtomicCounter() { - // "canary" is a value used to detect illegal overwrites. - const internal::reference_count canary = ~(internal::uintptr)0/3; - if( Verbose ) - printf("testing __TBB_FetchAndIncrement\n"); - struct { - internal::reference_count prefix, i, suffix; - } x; - x.prefix = canary; - x.i = 0; - x.suffix = canary; - for( int k=0; k<10; ++k ) { - internal::reference_count j = __TBB_FetchAndIncrementWacquire((volatile void *)&x.i); - ASSERT( x.prefix==canary, NULL ); - ASSERT( x.suffix==canary, NULL ); - ASSERT( x.i==k+1, NULL ); - ASSERT( j==k, NULL ); - } - if( Verbose ) - printf("testing __TBB_FetchAndDecrement\n"); - x.i = 10; - for( int k=10; k>0; --k ) { - internal::reference_count j = __TBB_FetchAndDecrementWrelease((volatile void *)&x.i); - ASSERT( j==k, NULL ); - ASSERT( x.i==k-1, NULL ); - ASSERT( x.prefix==canary, NULL ); - ASSERT( x.suffix==canary, NULL ); - } -} - -static void TestTinyLock() { - if( Verbose ) - printf("testing __TBB_LockByte\n"); - unsigned char flags[16]; - for( int i=0; i<16; ++i ) - flags[i] = i; -#if __GNUC__==4&&__GNUC_MINOR__==3&&__GNUC_PATCHLEVEL__==0 - __TBB_store_with_release( flags[8], 0 ); -#else - flags[8] = 0; -#endif - __TBB_LockByte(flags[8]); - for( int i=0; i<16; ++i ) - ASSERT( flags[i]==(i==8?1:i), NULL ); -} - -static void TestLog2() { - if( Verbose ) - printf("testing __TBB_Log2\n"); - for( uintptr_t i=1; i; i<<=1 ) { - for( uintptr_t j=1; j<1<<16; ++j ) { - if( uintptr_t k = i*j ) { - uintptr_t actual = __TBB_Log2(k); - const uintptr_t ONE = 1; // warning suppression again - ASSERT( k >= ONE<<actual, NULL ); - ASSERT( k>>1 < ONE<<actual, NULL ); - } - } - } -} - -static void TestPause() { - if( Verbose ) - printf("testing __TBB_Pause\n"); - __TBB_Pause(1); -} - - -} // namespace internal -} // namespace tbb - -using namespace tbb; - -int main( int argc, char* argv[] ) { - try { - ParseCommandLine( argc, argv ); - TestLog2(); - TestTinyLock(); - TestCompareExchange(); - TestAtomicCounter(); - TestPause(); - - task_scheduler_init init(1); - - if( Verbose ) - printf("testing __TBB_(scheduler assists)\n"); - GenericScheduler* scheduler = internal::Governor::local_scheduler(); - scheduler->test_assembly_routines(); - - } catch(...) { - ASSERT(0,"unexpected exception"); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_atomic.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_atomic.cpp deleted file mode 100644 index f511e4d9bb..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_atomic.cpp +++ /dev/null @@ -1,743 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Put tbb/atomic.h first, so if it is missing a prerequisite header, we find out about it. -// The tests here do *not* test for atomicity, just serial correctness. */ - -#include "tbb/atomic.h" -#include "harness_assert.h" - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // unary minus operator applied to unsigned type, result still unsigned - #pragma warning( push ) - #pragma warning( disable: 4310 ) -#endif - -//! Structure that holds an atomic<T> and some guard bytes around it. -template<typename T> -struct TestStruct { - T prefix; - tbb::atomic<T> counter; - T suffix; - TestStruct( T i ) : prefix(T(0x1234)), suffix(T(0x5678)) { - counter = i; - ASSERT( sizeof(*this)==3*sizeof(T), NULL ); - } - ~TestStruct() { - // Check for writes outside the counter. - ASSERT( prefix==T(0x1234), NULL ); - ASSERT( suffix==T(0x5678), NULL ); - } -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif - -//! Test compare_and_swap template members of class atomic<T> for memory_semantics=M -template<typename T,tbb::memory_semantics M> -void TestCompareAndSwapAcquireRelease( T i, T j, T k ) { - ASSERT( i!=k, "values must be distinct" ); - // Test compare_and_swap that should fail - TestStruct<T> x(i); - T old = x.counter.template compare_and_swap<M>( j, k ); - ASSERT( old==i, NULL ); - ASSERT( x.counter==i, "old value not retained" ); - // Test compare and swap that should suceed - old = x.counter.template compare_and_swap<M>( j, i ); - ASSERT( old==i, NULL ); - ASSERT( x.counter==j, "value not updated?" ); -} - -//! i, j, k must be different values -template<typename T> -void TestCompareAndSwap( T i, T j, T k ) { - ASSERT( i!=k, "values must be distinct" ); - // Test compare_and_swap that should fail - TestStruct<T> x(i); - T old = x.counter.compare_and_swap( j, k ); - ASSERT( old==i, NULL ); - ASSERT( x.counter==i, "old value not retained" ); - // Test compare and swap that should suceed - old = x.counter.compare_and_swap( j, i ); - ASSERT( old==i, NULL ); - if( x.counter==i ) { - ASSERT( x.counter==j, "value not updated?" ); - } else { - ASSERT( x.counter==j, "value trashed" ); - } - TestCompareAndSwapAcquireRelease<T,tbb::acquire>(i,j,k); - TestCompareAndSwapAcquireRelease<T,tbb::release>(i,j,k); -} - -//! memory_semantics variation on TestFetchAndStore -template<typename T, tbb::memory_semantics M> -void TestFetchAndStoreAcquireRelease( T i, T j ) { - ASSERT( i!=j, "values must be distinct" ); - TestStruct<T> x(i); - T old = x.counter.template fetch_and_store<M>( j ); - ASSERT( old==i, NULL ); - ASSERT( x.counter==j, NULL ); -} - -//! i and j must be different values -template<typename T> -void TestFetchAndStore( T i, T j ) { - ASSERT( i!=j, "values must be distinct" ); - TestStruct<T> x(i); - T old = x.counter.fetch_and_store( j ); - ASSERT( old==i, NULL ); - ASSERT( x.counter==j, NULL ); - TestFetchAndStoreAcquireRelease<T,tbb::acquire>(i,j); - TestFetchAndStoreAcquireRelease<T,tbb::release>(i,j); -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // conversion from <bigger integer> to <smaller integer>, possible loss of data - // the warning seems a complete nonsense when issued for e.g. short+=short - #pragma warning( push ) - #pragma warning( disable: 4244 ) -#endif - -//! Test fetch_and_add members of class atomic<T> for memory_semantics=M -template<typename T,tbb::memory_semantics M> -void TestFetchAndAddAcquireRelease( T i ) { - TestStruct<T> x(i); - T actual; - T expected = i; - - // Test fetch_and_add member template - for( int j=0; j<10; ++j ) { - actual = x.counter.fetch_and_add(j); - ASSERT( actual==expected, NULL ); - expected += j; - } - for( int j=0; j<10; ++j ) { - actual = x.counter.fetch_and_add(-j); - ASSERT( actual==expected, NULL ); - expected -= j; - } - - // Test fetch_and_increment member template - ASSERT( x.counter==i, NULL ); - actual = x.counter.template fetch_and_increment<M>(); - ASSERT( actual==i, NULL ); - ASSERT( x.counter==T(i+1), NULL ); - - // Test fetch_and_decrement member template - actual = x.counter.template fetch_and_decrement<M>(); - ASSERT( actual==T(i+1), NULL ); - ASSERT( x.counter==i, NULL ); -} - -//! Test fetch_and_add and related operators -template<typename T> -void TestFetchAndAdd( T i ) { - TestStruct<T> x(i); - T value; - value = ++x.counter; - ASSERT( value==T(i+1), NULL ); - value = x.counter++; - ASSERT( value==T(i+1), NULL ); - value = x.counter--; - ASSERT( value==T(i+2), NULL ); - value = --x.counter; - ASSERT( value==i, NULL ); - T actual; - T expected = i; - for( int j=-100; j<=100; ++j ) { - expected += j; - actual = x.counter += j; - ASSERT( actual==expected, NULL ); - } - for( int j=-100; j<=100; ++j ) { - expected -= j; - actual = x.counter -= j; - ASSERT( actual==expected, NULL ); - } - // Test fetch_and_increment - ASSERT( x.counter==i, NULL ); - actual = x.counter.fetch_and_increment(); - ASSERT( actual==i, NULL ); - ASSERT( x.counter==T(i+1), NULL ); - - // Test fetch_and_decrement - actual = x.counter.fetch_and_decrement(); - ASSERT( actual==T(i+1), NULL ); - ASSERT( x.counter==i, NULL ); - x.counter = i; - ASSERT( x.counter==i, NULL ); - - TestFetchAndAddAcquireRelease<T,tbb::acquire>(i); - TestFetchAndAddAcquireRelease<T,tbb::release>(i); -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif // warning 4244 is back - -//! A type with unknown size. -class IncompleteType; - -void TestFetchAndAdd( IncompleteType* ) { - // There are no fetch-and-add operations on a IncompleteType*. -} -void TestFetchAndAdd( void* ) { - // There are no fetch-and-add operations on a void*. -} - -void TestFetchAndAdd( bool ) { - // There are no fetch-and-add operations on a bool. -} - -template<typename T> -void TestConst( T i ) { - // Try const - const TestStruct<T> x(i); - ASSERT( reinterpret_cast<const T&>(x.counter)==i, "write to atomic<T> broken?" ); - ASSERT( x.counter==i, "read of atomic<T> broken?" ); -} - -template<typename T> -void TestOperations( T i, T j, T k ) { - TestConst(i); - TestCompareAndSwap(i,j,k); - TestFetchAndStore(i,k); // Pass i,k instead of i,j, because callee requires two distinct values. - TestFetchAndAdd(i); -} - -template<typename T> -void TestParallel( const char* name ); - -bool ParallelError; - -template<typename T> -struct AlignmentChecker { - char c; - tbb::atomic<T> i; -}; - -#include "harness.h" - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // unary minus operator applied to unsigned type, result still unsigned - #pragma warning( push ) - #pragma warning( disable: 4146 ) -#endif - -/** T is an integral type. */ -template<typename T> -void TestAtomicInteger( const char* name ) { - if( Verbose ) - printf("testing atomic<%s>\n",name); -#if ( __linux__ && __TBB_x86_32 && __GNUC__==3 && __GNUC_MINOR__==3 ) || defined(__SUNPRO_CC) - // gcc 3.3 has known problem for 32-bit Linux, so only warn if there is a problem. - // SUNPRO_CC does have this problem as well - if( sizeof(T)==8 ) { - if( sizeof(AlignmentChecker<T>)!=2*sizeof(tbb::atomic<T>) ) { - printf("Warning: alignment for atomic<%s> is wrong (known issue with gcc 3.3 and sunCC 5.9 2008/01/28 for IA32)\n",name); - } - } else -#endif /* ( __linux__ && __TBB_x86_32 && __GNUC__==3 && __GNUC_MINOR__==3 ) || defined(__SUNPRO_CC) */ - ASSERT( sizeof(AlignmentChecker<T>)==2*sizeof(tbb::atomic<T>), NULL ); - TestOperations<T>(0L,T(-T(1)),T(1)); - for( int k=0; k<int(sizeof(long))*8-1; ++k ) { - TestOperations<T>(T(1L<<k),T(~(1L<<k)),T(1-(1L<<k))); - TestOperations<T>(T(-1L<<k),T(~(-1L<<k)),T(1-(-1L<<k))); - } - TestParallel<T>( name ); -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif - - -template<typename T> -struct Foo { - T x, y, z; -}; - - -template<typename T> -void TestIndirection() { - Foo<T> item; - tbb::atomic<Foo<T>*> pointer; - pointer = &item; - for( int k=-10; k<=10; ++k ) { - // Test various syntaxes for indirection to fields with non-zero offset. - T value1=T(), value2=T(); - for( size_t j=0; j<sizeof(T); ++j ) { - *(char*)&value1 = char(k^j); - *(char*)&value2 = char(k^j*j); - } - pointer->y = value1; - (*pointer).z = value2; - T result1 = (*pointer).y; - T result2 = pointer->z; - ASSERT( memcmp(&value1,&result1,sizeof(T))==0, NULL ); - ASSERT( memcmp(&value2,&result2,sizeof(T))==0, NULL ); - } -} - -//! Test atomic<T*> -template<typename T> -void TestAtomicPointer() { - if( Verbose ) - printf("testing atomic pointer (%d)\n",int(sizeof(T))); - T array[1000]; - TestOperations<T*>(&array[500],&array[250],&array[750]); - TestIndirection<T>(); - TestParallel<T*>( "pointer" ); -} - -//! Test atomic<Ptr> where Ptr is a pointer to a type of unknown size -template<typename Ptr> -void TestAtomicPointerToTypeOfUnknownSize( const char* name ) { - if( Verbose ) - printf("testing atomic<%s>\n",name); - char array[1000]; - TestOperations<Ptr>((Ptr)(void*)&array[500],(Ptr)(void*)&array[250],(Ptr)(void*)&array[750]); - TestParallel<Ptr>( name ); -} - -void TestAtomicBool() { - if( Verbose ) - printf("testing atomic<bool>\n"); - TestOperations<bool>(true,true,false); - TestOperations<bool>(false,false,true); - TestParallel<bool>( "bool" ); -} - -const int numMaskedOperations = 100000; -const int testSpaceSize = 8; -int prime[testSpaceSize] = {3,5,7,11,13,17,19,23}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // "possible loss of data" warning suppressed again - #pragma warning( push ) - #pragma warning( disable: 4244 ) -#endif - -template<typename T> -class TestMaskedCAS_Body: NoAssign { - T* test_space_uncontended; - T* test_space_contended; -public: - TestMaskedCAS_Body( T* _space1, T* _space2 ) : test_space_uncontended(_space1), test_space_contended(_space2) {} - void operator()( int my_idx ) const { - using tbb::internal::__TBB_MaskedCompareAndSwap; - const T my_prime = T(prime[my_idx]); - T* const my_ptr = test_space_uncontended+my_idx; - T old_value=0; - for( int i=0; i<numMaskedOperations; ++i, old_value+=my_prime ){ - T result; - // Test uncontended case - T new_value = old_value + my_prime; - // The following CAS should always fail - result = __TBB_MaskedCompareAndSwap<sizeof(T),T>(my_ptr,new_value,old_value-1); - ASSERT(result!=old_value-1, "masked CAS succeeded while it should fail"); - ASSERT(result==*my_ptr, "masked CAS result mismatch with real value"); - // The following one should succeed - result = __TBB_MaskedCompareAndSwap<sizeof(T),T>(my_ptr,new_value,old_value); - ASSERT(result==old_value && *my_ptr==new_value, "masked CAS failed while it should succeed"); - // The following one should fail again - result = __TBB_MaskedCompareAndSwap<sizeof(T),T>(my_ptr,new_value,old_value); - ASSERT(result!=old_value, "masked CAS succeeded while it should fail"); - ASSERT(result==*my_ptr, "masked CAS result mismatch with real value"); - // Test contended case - for( int j=0; j<testSpaceSize; ++j ){ - // try adding my_prime until success - T value; - do { - value = test_space_contended[j]; - result = __TBB_MaskedCompareAndSwap<sizeof(T),T>(test_space_contended+j,value+my_prime,value); - } while( result!=value ); - } - } - } -}; - -template<typename T> -struct intptr_as_array_of -{ - static const int how_many_Ts = sizeof(intptr_t)/sizeof(T); - union { - intptr_t result; - T space[ how_many_Ts ]; - }; -}; - -template<typename T> -intptr_t getCorrectUncontendedValue(int slot_idx) { - intptr_as_array_of<T> slot; - slot.result = 0; - for( int i=0; i<slot.how_many_Ts; ++i ) { - const T my_prime = T(prime[slot_idx*slot.how_many_Ts + i]); - for( int j=0; j<numMaskedOperations; ++j ) - slot.space[i] += my_prime; - } - return slot.result; -} - -template<typename T> -intptr_t getCorrectContendedValue() { - intptr_as_array_of<T> slot; - slot.result = 0; - for( int i=0; i<slot.how_many_Ts; ++i ) - for( int primes=0; primes<testSpaceSize; ++primes ) - for( int j=0; j<numMaskedOperations; ++j ) - slot.space[i] += prime[primes]; - return slot.result; -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif // warning 4244 is back again - -template<typename T> -void TestMaskedCAS() { - if( Verbose ) - printf("testing masked CAS<%d>\n",int(sizeof(T))); - - const int num_slots = sizeof(T)*testSpaceSize/sizeof(intptr_t); - intptr_t arr1[num_slots+2]; // two more "canary" slots at boundaries - intptr_t arr2[num_slots+2]; - for(int i=0; i<num_slots+2; ++i) - arr2[i] = arr1[i] = 0; - T* test_space_uncontended = (T*)(arr1+1); - T* test_space_contended = (T*)(arr2+1); - - NativeParallelFor( testSpaceSize, TestMaskedCAS_Body<T>(test_space_uncontended, test_space_contended) ); - - ASSERT( arr1[0]==0 && arr1[num_slots+1]==0 && arr2[0]==0 && arr2[num_slots+1]==0 , "adjacent memory was overwritten" ); - const intptr_t correctContendedValue = getCorrectContendedValue<T>(); - for(int i=0; i<num_slots; ++i) { - ASSERT( arr1[i+1]==getCorrectUncontendedValue<T>(i), "unexpected value in an uncontended slot" ); - ASSERT( arr2[i+1]==correctContendedValue, "unexpected value in a contended slot" ); - } -} - -template<unsigned N> -class ArrayElement { - char item[N]; -}; - -int main( int argc, char* argv[] ) { - ParseCommandLine( argc, argv ); -#if defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 - TestAtomicInteger<unsigned long long>("unsigned long long"); - TestAtomicInteger<long long>("long long"); -#else - printf("Warning: atomic<64-bits> not tested because of known problem in Microsoft compiler\n"); -#endif /*defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 */ - TestAtomicInteger<unsigned long>("unsigned long"); - TestAtomicInteger<long>("long"); - TestAtomicInteger<unsigned int>("unsigned int"); - TestAtomicInteger<int>("int"); - TestAtomicInteger<unsigned short>("unsigned short"); - TestAtomicInteger<short>("short"); - TestAtomicInteger<signed char>("signed char"); - TestAtomicInteger<unsigned char>("unsigned char"); - TestAtomicInteger<char>("char"); - TestAtomicInteger<wchar_t>("wchar_t"); - TestAtomicInteger<size_t>("size_t"); - TestAtomicInteger<ptrdiff_t>("ptrdiff_t"); - TestAtomicPointer<ArrayElement<1> >(); - TestAtomicPointer<ArrayElement<2> >(); - TestAtomicPointer<ArrayElement<3> >(); - TestAtomicPointer<ArrayElement<4> >(); - TestAtomicPointer<ArrayElement<5> >(); - TestAtomicPointer<ArrayElement<6> >(); - TestAtomicPointer<ArrayElement<7> >(); - TestAtomicPointer<ArrayElement<8> >(); - TestAtomicPointerToTypeOfUnknownSize<IncompleteType*>( "IncompleteType*" ); - TestAtomicPointerToTypeOfUnknownSize<void*>( "void*" ); - TestAtomicBool(); - ASSERT( !ParallelError, NULL ); - TestMaskedCAS<unsigned char>(); - TestMaskedCAS<unsigned short>(); - printf("done\n"); - return 0; -} - -template<typename T> -struct FlagAndMessage { - //! 0 if message not set yet, 1 if message is set. - tbb::atomic<T> flag; - /** Force flag and message to be on distinct cache lines for machines with cache line size <= 4096 bytes */ - char pad[4096/sizeof(T)]; - //! Non-zero if message is ready - T message; -}; - -// A special template function used for summation. -// Actually it is only necessary because of its specialization for void* -template<typename T> -T special_sum(intptr_t arg1, intptr_t arg2) { - return (T)((T)arg1 + arg2); -} - -// The specialization for IncompleteType* is required -// because pointer arithmetic (+) is impossible with IncompleteType* -template<> -IncompleteType* special_sum<IncompleteType*>(intptr_t arg1, intptr_t arg2) { - return (IncompleteType*)(arg1 + arg2); -} - -// The specialization for void* is required -// because pointer arithmetic (+) is impossible with void* -template<> -void* special_sum<void*>(intptr_t arg1, intptr_t arg2) { - return (void*)(arg1 + arg2); -} - -// The specialization for bool is required to shut up gratuitous compiler warnings, -// because some compilers warn about casting int to bool. -template<> -bool special_sum<bool>(intptr_t arg1, intptr_t arg2) { - return ((arg1!=0) + arg2)!=0; -} - -volatile int One = 1; - -template<typename T> -class HammerLoadAndStoreFence: NoAssign { - FlagAndMessage<T>* fam; - const int n; - const int p; - const int trial; - const char* name; - mutable T accum; -public: - HammerLoadAndStoreFence( FlagAndMessage<T>* fam_, int n_, int p_, const char* name_, int trial_ ) : fam(fam_), n(n_), p(p_), trial(trial_), name(name_) {} - void operator()( int k ) const { - int one = One; - FlagAndMessage<T>* s = fam+k; - FlagAndMessage<T>* s_next = fam + (k+1)%p; - for( int i=0; i<n; ++i ) { - // The inner for loop is a spin-wait loop, which is normally considered very bad style. - // But we must use it here because we are interested in examining subtle hardware effects. - for(unsigned short cnt=1; ; ++cnt) { - if( !cnt ) // to help 1-core systems complete the test, yield every 2^16 iterations - __TBB_Yield(); - // Compilers typically generate non-trivial sequence for division by a constant. - // The expression here is dependent on the loop index i, so it cannot be hoisted. -#define COMPLICATED_ZERO (i*(one-1)/100) - // Read flag and then the message - T flag, message; - if( trial&1 ) { - // COMPLICATED_ZERO here tempts compiler to hoist load of message above reading of flag. - flag = (s+COMPLICATED_ZERO)->flag; - message = s->message; - } else { - flag = s->flag; - message = s->message; - } - if( flag ) { - if( flag!=(T)-1 ) { - printf("ERROR: flag!=(T)-1 k=%d i=%d trial=%x type=%s (atomicity problem?)\n", k, i, trial, name ); - ParallelError = true; - } - if( message!=(T)-1 ) { - printf("ERROR: message!=(T)-1 k=%d i=%d trial=%x type=%s (memory fence problem?)\n", k, i, trial, name ); - ParallelError = true; - } - s->message = 0; - s->flag = 0; - // Set message and then the flag - if( trial&2 ) { - // COMPLICATED_ZERO here tempts compiler to sink store below setting of flag - s_next->message = special_sum<T>(-1, COMPLICATED_ZERO); - s_next->flag = (T)-1; - } else { - s_next->message = (T)-1; - s_next->flag = (T)-1; - } - break; - } else { - // Force compiler to use message anyway, so it cannot sink read of s->message below the if. - accum = message; - } - } - } - } -}; - -//! Test that atomic<T> has acquire semantics for loads and release semantics for stores. -/** Test performs round-robin passing of message among p processors, - where p goes from MinThread to MaxThread. */ -template<typename T> -void TestLoadAndStoreFences( const char* name ) { - for( int p=MinThread<2 ? 2 : MinThread; p<=MaxThread; ++p ) { - FlagAndMessage<T>* fam = new FlagAndMessage<T>[p]; - // Each of four trials excercise slightly different expresion pattern within the test. - // See occurrences of COMPLICATED_ZERO for details. - for( int trial=0; trial<4; ++trial ) { - memset( fam, 0, p*sizeof(FlagAndMessage<T>) ); - fam->message = (T)-1; - fam->flag = (T)-1; - NativeParallelFor( p, HammerLoadAndStoreFence<T>( fam, 100, p, name, trial ) ); - for( int k=0; k<p; ++k ) { - ASSERT( fam[k].message==(k==0 ? (T)-1 : 0), "incomplete round-robin?" ); - ASSERT( fam[k].flag==(k==0 ? (T)-1 : 0), "incomplete round-robin?" ); - } - } - delete[] fam; - } -} - -//! Sparse set of values of integral type T. -/** Set is designed so that if a value is read or written non-atomically, - the resulting intermediate value is likely to not be a member of the set. */ -template<typename T> -class SparseValueSet { - T factor; -public: - SparseValueSet() { - // Compute factor such that: - // 1. It has at least one 1 in most of its bytes. - // 2. The bytes are typically different. - // 3. When multiplied by any value <=127, the product does not overflow. - factor = 0; - for( unsigned i=0; i<sizeof(T)*8-7; i+=7 ) - factor |= (T)1<<i; - } - //! Get ith member of set - T get( int i ) const { - // Create multiple of factor. The & prevents overflow of the product. - return T((i&0x7F)*factor); - } - //! True if set contains x - bool contains( T x ) const { - // True if - return (x%factor)==0; - } -}; - -//! Specialization for pointer types. The pointers are random and should not be dereferenced. -template<typename T> -class SparseValueSet<T*> { - SparseValueSet<ptrdiff_t> my_set; -public: - T* get( int i ) const {return reinterpret_cast<T*>(my_set.get(i));} - bool contains( T* x ) const {return my_set.contains(reinterpret_cast<ptrdiff_t>(x));} -}; - -//! Specialization for bool. -/** Checking bool for atomic read/write is pointless in practice, because - there is no way to *not* atomically read or write a bool value. */ -template<> -class SparseValueSet<bool> { -public: - bool get( int i ) const {return i&1;} - bool contains( bool ) const {return true;} -}; - -template<typename T> -class HammerAssignment: NoAssign { - tbb::atomic<T>& x; - const char* name; - SparseValueSet<T> set; -public: - HammerAssignment( tbb::atomic<T>& x_, const char* name_ ) : x(x_), name(name_) {} - void operator()( int k ) const { - const int n = 1000000; - if( k ) { - tbb::atomic<T> z; - AssertSameType( z=x, z ); // Check that return type from assignment is correct - for( int i=0; i<n; ++i ) { - // Read x atomically into z. - z = x; - if( !set.contains(z) ) { - printf("ERROR: assignment of atomic<%s> is not atomic\n", name); - ParallelError = true; - return; - } - } - } else { - tbb::atomic<T> y; - for( int i=0; i<n; ++i ) { - // Get pseudo-random value. - y = set.get(i); - // Write y atomically into x. - x = y; - } - } - } -}; - -// Compile-time check that a class method has the required signature. -// Intended to check the assignment operator of tbb::atomic. -template<typename T> void TestAssignmentSignature( T& (T::*)(const T&) ) {} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Suppress "conditional expression is constant" warning. - #pragma warning( push ) - #pragma warning( disable: 4127 ) -#endif - -template<typename T> -void TestAssignment( const char* name ) { - TestAssignmentSignature( &tbb::atomic<T>::operator= ); - tbb::atomic<T> x; - x = 0; - NativeParallelFor( 2, HammerAssignment<T>( x, name ) ); -#if __TBB_x86_32 && (__linux__ || __FreeBSD__ || _WIN32) - if( sizeof(T)==8 ) { - // Some compilers for IA-32 fail to provide 8-byte alignment of objects on the stack, - // even if the object specifies 8-byte alignment. On such platforms, the IA-32 implementation - // of atomic<long long> and atomic<unsigned long long> use different tactics depending upon - // whether the object is properly aligned or not. The following abusive test ensures that we - // cover both the proper and improper alignment cases, one with the x above and the other with - // the y below, perhaps not respectively. - - // Allocate space big enough to always contain 8-byte locations that are aligned and misaligned. - char raw_space[15]; - // Set delta to 0 if x is aligned, 4 otherwise. - uintptr_t delta = ((reinterpret_cast<uintptr_t>(&x)&7) ? 0 : 4); - // y crosses 8-byte boundary if and only if x does not cross. - tbb::atomic<T>& y = *reinterpret_cast<tbb::atomic<T>*>((reinterpret_cast<uintptr_t>(&raw_space[7+delta])&~7u) - delta); - // Assertion checks that y really did end up somewhere inside "raw_space". - ASSERT( raw_space<=reinterpret_cast<char*>(&y), "y starts before raw_space" ); - ASSERT( reinterpret_cast<char*>(&y+1) <= raw_space+sizeof(raw_space), "y starts after raw_space" ); - y = 0; - NativeParallelFor( 2, HammerAssignment<T>( y, name ) ); - } -#endif /* __TBB_x86_32 && (__linux__ || __FreeBSD__ || _WIN32) */ -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif - -template<typename T> -void TestParallel( const char* name ) { - TestLoadAndStoreFences<T>(name); - TestAssignment<T>(name); -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range.cpp deleted file mode 100644 index ececef5d10..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/blocked_range.h" -#include "harness_assert.h" - -// First test as much as we can without including other headers. -// Doing so should catch problems arising from failing to include headers. - -class AbstractValueType { - AbstractValueType() {} - int value; -public: - friend AbstractValueType MakeAbstractValueType( int i ); - friend int GetValueOf( const AbstractValueType& v ) {return v.value;} -}; - -AbstractValueType MakeAbstractValueType( int i ) { - AbstractValueType x; - x.value = i; - return x; -} - -std::size_t operator-( const AbstractValueType& u, const AbstractValueType& v ) { - return GetValueOf(u)-GetValueOf(v); -} - -bool operator<( const AbstractValueType& u, const AbstractValueType& v ) { - return GetValueOf(u)<GetValueOf(v); -} - -AbstractValueType operator+( const AbstractValueType& u, std::size_t offset ) { - return MakeAbstractValueType(GetValueOf(u)+int(offset)); -} - -static void SerialTest() { - for( int x=-10; x<10; ++x ) - for( int y=-10; y<10; ++y ) { - AbstractValueType i = MakeAbstractValueType(x); - AbstractValueType j = MakeAbstractValueType(y); - for( std::size_t k=1; k<10; ++k ) { - typedef tbb::blocked_range<AbstractValueType> range_type; - range_type r( i, j, k ); - AssertSameType( r.empty(), true ); - AssertSameType( range_type::size_type(), std::size_t() ); - AssertSameType( static_cast<range_type::const_iterator*>(0), static_cast<AbstractValueType*>(0) ); - AssertSameType( r.begin(), MakeAbstractValueType(0) ); - AssertSameType( r.end(), MakeAbstractValueType(0) ); - ASSERT( r.empty()==(y<=x), NULL ); - ASSERT( r.grainsize()==k, NULL ); - if( x<=y ) { - AssertSameType( r.is_divisible(), true ); - ASSERT( r.is_divisible()==(std::size_t(y-x)>k), NULL ); - ASSERT( r.size()==std::size_t(y-x), NULL ); - if( r.is_divisible() ) { - tbb::blocked_range<AbstractValueType> r2(r,tbb::split()); - ASSERT( GetValueOf(r.begin())==x, NULL ); - ASSERT( GetValueOf(r.end())==GetValueOf(r2.begin()), NULL ); - ASSERT( GetValueOf(r2.end())==y, NULL ); - ASSERT( r.grainsize()==k, NULL ); - ASSERT( r2.grainsize()==k, NULL ); - } - } - } - } -} - -#include "harness.h" -#include "tbb/parallel_for.h" - -const int N = 1<<22; - -unsigned char Array[N]; - -struct Striker { - // Note: we use <int> here instead of <long> in order to test for Quad 407676 - void operator()( const tbb::blocked_range<int>& r ) const { - for( tbb::blocked_range<int>::const_iterator i=r.begin(); i!=r.end(); ++i ) - ++Array[i]; - } -}; - -void ParallelTest() { - for( int i=0; i<N; i=i<3 ? i+1 : i*3 ) { - const tbb::blocked_range<int> r( 0, i, 10 ); - tbb::parallel_for( r, Striker() ); - for( int k=0; k<N; ++k ) { - ASSERT( Array[k]==(k<i), NULL ); - Array[k] = 0; - } - } -} - -#include "tbb/task_scheduler_init.h" - -int main( int argc, char* argv[] ) { - ParseCommandLine(argc,argv); - SerialTest(); - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init(p); - ParallelTest(); - } - std::printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range2d.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range2d.cpp deleted file mode 100644 index 7fce1014d3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range2d.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/blocked_range2d.h" -#include "harness_assert.h" - -// First test as much as we can without including other headers. -// Doing so should catch problems arising from failing to include headers. - -template<typename Tag> -class AbstractValueType { - AbstractValueType() {} - int value; -public: - template<typename OtherTag> - friend AbstractValueType<OtherTag> MakeAbstractValueType( int i ); - - friend int GetValueOf( const AbstractValueType& v ) {return v.value;} -}; - -template<typename Tag> -AbstractValueType<Tag> MakeAbstractValueType( int i ) { - AbstractValueType<Tag> x; - x.value = i; - return x; -} - -template<typename Tag> -bool operator<( const AbstractValueType<Tag>& u, const AbstractValueType<Tag>& v ) { - return GetValueOf(u)<GetValueOf(v); -} - -template<typename Tag> -std::size_t operator-( const AbstractValueType<Tag>& u, const AbstractValueType<Tag>& v ) { - return GetValueOf(u)-GetValueOf(v); -} - -template<typename Tag> -AbstractValueType<Tag> operator+( const AbstractValueType<Tag>& u, std::size_t offset ) { - return MakeAbstractValueType<Tag>(GetValueOf(u)+int(offset)); -} - -struct RowTag {}; -struct ColTag {}; - -static void SerialTest() { - typedef AbstractValueType<RowTag> row_type; - typedef AbstractValueType<ColTag> col_type; - typedef tbb::blocked_range2d<row_type,col_type> range_type; - for( int rowx=-10; rowx<10; ++rowx ) { - for( int rowy=rowx; rowy<10; ++rowy ) { - row_type rowi = MakeAbstractValueType<RowTag>(rowx); - row_type rowj = MakeAbstractValueType<RowTag>(rowy); - for( int rowg=1; rowg<10; ++rowg ) { - for( int colx=-10; colx<10; ++colx ) { - for( int coly=colx; coly<10; ++coly ) { - col_type coli = MakeAbstractValueType<ColTag>(colx); - col_type colj = MakeAbstractValueType<ColTag>(coly); - for( int colg=1; colg<10; ++colg ) { - range_type r( rowi, rowj, rowg, coli, colj, colg ); - AssertSameType( r.is_divisible(), true ); - AssertSameType( r.empty(), true ); - AssertSameType( static_cast<range_type::row_range_type::const_iterator*>(0), static_cast<row_type*>(0) ); - AssertSameType( static_cast<range_type::col_range_type::const_iterator*>(0), static_cast<col_type*>(0) ); - AssertSameType( r.rows(), tbb::blocked_range<row_type>( rowi, rowj, 1 )); - AssertSameType( r.cols(), tbb::blocked_range<col_type>( coli, colj, 1 )); - ASSERT( r.empty()==(rowx==rowy||colx==coly), NULL ); - ASSERT( r.is_divisible()==(rowy-rowx>rowg||coly-colx>colg), NULL ); - if( r.is_divisible() ) { - range_type r2(r,tbb::split()); - if( GetValueOf(r2.rows().begin())==GetValueOf(r.rows().begin()) ) { - ASSERT( GetValueOf(r2.rows().end())==GetValueOf(r.rows().end()), NULL ); - ASSERT( GetValueOf(r2.cols().begin())==GetValueOf(r.cols().end()), NULL ); - } else { - ASSERT( GetValueOf(r2.cols().end())==GetValueOf(r.cols().end()), NULL ); - ASSERT( GetValueOf(r2.rows().begin())==GetValueOf(r.rows().end()), NULL ); - } - } - } - } - } - } - } - } -} - -#include "harness.h" -#include "tbb/parallel_for.h" - -const int N = 1<<10; - -unsigned char Array[N][N]; - -struct Striker { - // Note: we use <int> here instead of <long> in order to test for problems similar to Quad 407676 - void operator()( const tbb::blocked_range2d<int>& r ) const { - for( tbb::blocked_range<int>::const_iterator i=r.rows().begin(); i!=r.rows().end(); ++i ) - for( tbb::blocked_range<int>::const_iterator j=r.cols().begin(); j!=r.cols().end(); ++j ) - ++Array[i][j]; - } -}; - -void ParallelTest() { - for( int i=0; i<N; i=i<3 ? i+1 : i*3 ) { - for( int j=0; j<N; j=j<3 ? j+1 : j*3 ) { - const tbb::blocked_range2d<int> r( 0, i, 7, 0, j, 5 ); - tbb::parallel_for( r, Striker() ); - for( int k=0; k<N; ++k ) { - for( int l=0; l<N; ++l ) { - ASSERT( Array[k][l]==(k<i && l<j), NULL ); - Array[k][l] = 0; - } - } - } - } -} - -#include "tbb/task_scheduler_init.h" - -int main( int argc, char* argv[] ) { - ParseCommandLine(argc,argv); - SerialTest(); - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init(p); - ParallelTest(); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range3d.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range3d.cpp deleted file mode 100644 index 36ede8d1fd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_blocked_range3d.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/blocked_range3d.h" -#include "harness_assert.h" - -// First test as much as we can without including other headers. -// Doing so should catch problems arising from failing to include headers. - -template<typename Tag> -class AbstractValueType { - AbstractValueType() {} - int value; -public: - template<typename OtherTag> - friend AbstractValueType<OtherTag> MakeAbstractValueType( int i ); - - friend int GetValueOf( const AbstractValueType& v ) {return v.value;} -}; - -template<typename Tag> -AbstractValueType<Tag> MakeAbstractValueType( int i ) { - AbstractValueType<Tag> x; - x.value = i; - return x; -} - -template<typename Tag> -bool operator<( const AbstractValueType<Tag>& u, const AbstractValueType<Tag>& v ) { - return GetValueOf(u)<GetValueOf(v); -} - -template<typename Tag> -std::size_t operator-( const AbstractValueType<Tag>& u, const AbstractValueType<Tag>& v ) { - return GetValueOf(u)-GetValueOf(v); -} - -template<typename Tag> -AbstractValueType<Tag> operator+( const AbstractValueType<Tag>& u, std::size_t offset ) { - return MakeAbstractValueType<Tag>(GetValueOf(u)+int(offset)); -} - -struct PageTag {}; -struct RowTag {}; -struct ColTag {}; - -static void SerialTest() { - typedef AbstractValueType<PageTag> page_type; - typedef AbstractValueType<RowTag> row_type; - typedef AbstractValueType<ColTag> col_type; - typedef tbb::blocked_range3d<page_type,row_type,col_type> range_type; - for( int pagex=-4; pagex<4; ++pagex ) { - for( int pagey=pagex; pagey<4; ++pagey ) { - page_type pagei = MakeAbstractValueType<PageTag>(pagex); - page_type pagej = MakeAbstractValueType<PageTag>(pagey); - for( int pageg=1; pageg<4; ++pageg ) { - for( int rowx=-4; rowx<4; ++rowx ) { - for( int rowy=rowx; rowy<4; ++rowy ) { - row_type rowi = MakeAbstractValueType<RowTag>(rowx); - row_type rowj = MakeAbstractValueType<RowTag>(rowy); - for( int rowg=1; rowg<4; ++rowg ) { - for( int colx=-4; colx<4; ++colx ) { - for( int coly=colx; coly<4; ++coly ) { - col_type coli = MakeAbstractValueType<ColTag>(colx); - col_type colj = MakeAbstractValueType<ColTag>(coly); - for( int colg=1; colg<4; ++colg ) { - range_type r( pagei, pagej, pageg, rowi, rowj, rowg, coli, colj, colg ); - AssertSameType( r.is_divisible(), true ); - - AssertSameType( r.empty(), true ); - - AssertSameType( static_cast<range_type::page_range_type::const_iterator*>(0), static_cast<page_type*>(0) ); - AssertSameType( static_cast<range_type::row_range_type::const_iterator*>(0), static_cast<row_type*>(0) ); - AssertSameType( static_cast<range_type::col_range_type::const_iterator*>(0), static_cast<col_type*>(0) ); - - AssertSameType( r.pages(), tbb::blocked_range<page_type>( pagei, pagej, 1 )); - AssertSameType( r.rows(), tbb::blocked_range<row_type>( rowi, rowj, 1 )); - AssertSameType( r.cols(), tbb::blocked_range<col_type>( coli, colj, 1 )); - - ASSERT( r.empty()==(pagex==pagey||rowx==rowy||colx==coly), NULL ); - - ASSERT( r.is_divisible()==(pagey-pagex>pageg||rowy-rowx>rowg||coly-colx>colg), NULL ); - - if( r.is_divisible() ) { - range_type r2(r,tbb::split()); - if( (GetValueOf(r2.pages().begin())==GetValueOf(r.pages().begin())) && (GetValueOf(r2.rows().begin())==GetValueOf(r.rows().begin())) ) { - ASSERT( GetValueOf(r2.pages().end())==GetValueOf(r.pages().end()), NULL ); - ASSERT( GetValueOf(r2.rows().end())==GetValueOf(r.rows().end()), NULL ); - ASSERT( GetValueOf(r2.cols().begin())==GetValueOf(r.cols().end()), NULL ); - } else { - if ( (GetValueOf(r2.pages().begin())==GetValueOf(r.pages().begin())) && (GetValueOf(r2.cols().begin())==GetValueOf(r.cols().begin())) ) { - ASSERT( GetValueOf(r2.pages().end())==GetValueOf(r.pages().end()), NULL ); - ASSERT( GetValueOf(r2.cols().end())==GetValueOf(r.cols().end()), NULL ); - ASSERT( GetValueOf(r2.rows().begin())==GetValueOf(r.rows().end()), NULL ); - } else { - ASSERT( GetValueOf(r2.rows().end())==GetValueOf(r.rows().end()), NULL ); - ASSERT( GetValueOf(r2.cols().end())==GetValueOf(r.cols().end()), NULL ); - ASSERT( GetValueOf(r2.pages().begin())==GetValueOf(r.pages().end()), NULL ); - } - } - } - } - } - } - } - } - } - } - } - } -} - -#include "harness.h" -#include "tbb/parallel_for.h" - -const int N = 1<<5; - -unsigned char Array[N][N][N]; - -struct Striker { - // Note: we use <int> here instead of <long> in order to test for problems similar to Quad 407676 - void operator()( const tbb::blocked_range3d<int>& r ) const { - for( tbb::blocked_range<int>::const_iterator i=r.pages().begin(); i!=r.pages().end(); ++i ) - for( tbb::blocked_range<int>::const_iterator j=r.rows().begin(); j!=r.rows().end(); ++j ) - for( tbb::blocked_range<int>::const_iterator k=r.cols().begin(); k!=r.cols().end(); ++k ) - ++Array[i][j][k]; - } -}; - -void ParallelTest() { - for( int i=0; i<N; i=i<3 ? i+1 : i*3 ) { - for( int j=0; j<N; j=j<3 ? j+1 : j*3 ) { - for( int k=0; k<N; k=k<3 ? k+1 : k*3 ) { - const tbb::blocked_range3d<int> r( 0, i, 5, 0, j, 3, 0, k, 1 ); - tbb::parallel_for( r, Striker() ); - for( int l=0; l<N; ++l ) { - for( int m=0; m<N; ++m ) { - for( int n=0; n<N; ++n ) { - ASSERT( Array[l][m][n]==(l<i && m<j && n<k), NULL ); - Array[l][m][n] = 0; - } - } - } - } - } - } -} - -#include "tbb/task_scheduler_init.h" - -int main( int argc, char* argv[] ) { - ParseCommandLine(argc,argv); - SerialTest(); - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init(p); - ParallelTest(); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator.cpp deleted file mode 100644 index b5930a265b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Test whether cache_aligned_allocator works with some of the host's STL containers. - -#include "tbb/cache_aligned_allocator.h" -#include "tbb/tbb_allocator.h" - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -// the real body of the test is there: -#include "test_allocator.h" - -int main(void) -{ - int result = TestMain<tbb::cache_aligned_allocator<void> >(); - result += TestMain<tbb::tbb_allocator<void> >(); - - printf("done\n"); - return result; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator_STL.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator_STL.cpp deleted file mode 100644 index abf33dbbe0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_cache_aligned_allocator_STL.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Test whether cache_aligned_allocator works with some of the host's STL containers. - -#include "tbb/cache_aligned_allocator.h" -#include "tbb/tbb_allocator.h" - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -#include "test_allocator_STL.h" - -int main() { - TestAllocatorWithSTL<tbb::cache_aligned_allocator>(); - TestAllocatorWithSTL<tbb::tbb_allocator>(); - printf("done\n"); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_compiler.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_compiler.cpp deleted file mode 100644 index a6b6583796..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_compiler.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include <stdio.h> - -union char2bool { - unsigned char c; - volatile bool b; -} u; - -// The function proves the compiler uses 0 or 1 to store a bool. It -// inspects what a compiler does when it loads a bool. A compiler that -// uses a value other than 0 or 1 to represent a bool will have to normalize -// the value to 0 or 1 when the bool is cast to an unsigned char. -// Compilers that pass this test do not do the normalization, and thus must -// be assuming that a bool is a 0 or 1. -int test_bool_representation() { - for( unsigned i=0; i<256; ++i ) { - u.c = (unsigned char)i; - unsigned char x = (unsigned char)u.b; - if( x != i ) { - printf("Test failed at iteration i=%d\n",i); - return 1; - } - } - return 0; -} - -int main() { - if( test_bool_representation()!=0 ) - printf("ERROR: bool representation test failed\n"); - else - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_hash_map.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_hash_map.cpp deleted file mode 100644 index c6097e666f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_hash_map.cpp +++ /dev/null @@ -1,883 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifndef TBB_USE_PERFORMANCE_WARNINGS -#define TBB_USE_PERFORMANCE_WARNINGS 1 -#endif - -// Our tests usually include the header under test first. But this test needs -// to use the preprocessor to edit the identifier runtime_warning in concurrent_hash_map.h. -// Hence we include a few other headers before doing the abusive edit. -#include "tbb/tbb_stddef.h" /* Defines runtime_warning */ -#include "harness_assert.h" /* Prerequisite for defining hooked_warning */ - -// The symbol internal::runtime_warning is normally an entry point into the TBB library. -// Here for sake of testing, we define it to be hooked_warning, a routine peculiar to this unit test. -#define runtime_warning hooked_warning - -static bool bad_hashing = false; - -namespace tbb { - namespace internal { - static void hooked_warning( const char* /*format*/, ... ) { - ASSERT(bad_hashing, "unexpected bad hashing"); - } - } // namespace internal -} // namespace tbb - -#include "tbb/concurrent_hash_map.h" - -// Restore runtime_warning as an entry point into the TBB library. -#undef runtime_warning - -// Test whether a sufficient set of headers were included to instantiate a concurernt_hash_map. OSS Bug #120 (& #130): -// http://www.threadingbuildingblocks.org/bug_desc.php?id=120 -tbb::concurrent_hash_map<std::pair<std::pair<int,std::string>,const char*>,int> TestInstantiation; - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" -#include "tbb/atomic.h" -#include "tbb/tick_count.h" -#include "harness.h" -#include "harness_allocator.h" - -class MyException : public std::bad_alloc { -public: - virtual const char *what() const throw() { return "out of items limit"; } - virtual ~MyException() throw() {} -}; - -/** Has tighly controlled interface so that we can verify - that concurrent_hash_map uses only the required interface. */ -class MyKey { -private: - void operator=( const MyKey& ); // Deny access - int key; - friend class MyHashCompare; - friend class YourHashCompare; -public: - static MyKey make( int i ) { - MyKey result; - result.key = i; - return result; - } - int value_of() const {return key;} -}; - -tbb::atomic<long> MyDataCount; -long MyDataCountLimit = 0; - -class MyData { -protected: - friend class MyData2; - int data; - enum state_t { - LIVE=0x1234, - DEAD=0x5678 - } my_state; - void operator=( const MyData& ); // Deny acces -public: - MyData(int i = 0) { - my_state = LIVE; - data = i; - if(MyDataCountLimit && MyDataCount + 1 >= MyDataCountLimit) - throw MyException(); - ++MyDataCount; - } - MyData( const MyData& other ) { - ASSERT( other.my_state==LIVE, NULL ); - my_state = LIVE; - data = other.data; - if(MyDataCountLimit && MyDataCount + 1 >= MyDataCountLimit) - throw MyException(); - ++MyDataCount; - } - ~MyData() { - --MyDataCount; - my_state = DEAD; - } - static MyData make( int i ) { - MyData result; - result.data = i; - return result; - } - int value_of() const { - ASSERT( my_state==LIVE, NULL ); - return data; - } - void set_value( int i ) { - ASSERT( my_state==LIVE, NULL ); - data = i; - } - bool operator==( const MyData& other ) const { - ASSERT( other.my_state==LIVE, NULL ); - ASSERT( my_state==LIVE, NULL ); - return data == other.data; - } -}; - -class MyData2 : public MyData { -public: - MyData2( ) {} - MyData2( const MyData& other ) { - ASSERT( other.my_state==LIVE, NULL ); - ASSERT( my_state==LIVE, NULL ); - data = other.data; - } - void operator=( const MyData& other ) { - ASSERT( other.my_state==LIVE, NULL ); - ASSERT( my_state==LIVE, NULL ); - data = other.data; - } - void operator=( const MyData2& other ) { - ASSERT( other.my_state==LIVE, NULL ); - ASSERT( my_state==LIVE, NULL ); - data = other.data; - } - bool operator==( const MyData2& other ) const { - ASSERT( other.my_state==LIVE, NULL ); - ASSERT( my_state==LIVE, NULL ); - return data == other.data; - } -}; - -class MyHashCompare { -public: - bool equal( const MyKey& j, const MyKey& k ) const { - return j.key==k.key; - } - unsigned long hash( const MyKey& k ) const { - return k.key; - } -}; - -class YourHashCompare { -public: - bool equal( const MyKey& j, const MyKey& k ) const { - return j.key==k.key; - } - unsigned long hash( const MyKey& ) const { - return 1; - } -}; - -typedef local_counting_allocator<std::allocator<MyData> > MyAllocator; -typedef tbb::concurrent_hash_map<MyKey,MyData,MyHashCompare,MyAllocator> MyTable; -typedef tbb::concurrent_hash_map<MyKey,MyData2,MyHashCompare> MyTable2; -typedef tbb::concurrent_hash_map<MyKey,MyData,YourHashCompare> YourTable; - -template<typename MyTable> -inline void CheckAllocator(MyTable &table, size_t expected_allocs, size_t expected_frees, bool exact = true) { - size_t items_allocated = table.get_allocator().items_allocated, items_freed = table.get_allocator().items_freed; - size_t allocations = table.get_allocator().allocations, frees = table.get_allocator().frees; - if(Verbose) - printf("checking allocators: items %u/%u, allocs %u/%u\n", - unsigned(items_allocated), unsigned(items_freed), unsigned(allocations), unsigned(frees) ); - ASSERT( items_allocated == allocations, NULL); ASSERT( items_freed == frees, NULL); - if(exact) { - ASSERT( allocations == expected_allocs, NULL); ASSERT( frees == expected_frees, NULL); - } else { - ASSERT( allocations >= expected_allocs, NULL); ASSERT( frees >= expected_frees, NULL); - ASSERT( allocations == frees, NULL ); - } -} - -inline bool UseKey( size_t i ) { - return (i&3)!=3; -} - -struct Insert { - static void apply( MyTable& table, int i ) { - if( UseKey(i) ) { - if( i&4 ) { - MyTable::accessor a; - table.insert( a, MyKey::make(i) ); - if( i&1 ) - (*a).second.set_value(i*i); - else - a->second.set_value(i*i); - } else - if( i&1 ) { - MyTable::accessor a; - table.insert( a, std::make_pair(MyKey::make(i), MyData(i*i)) ); - ASSERT( (*a).second.value_of()==i*i, NULL ); - } else { - MyTable::const_accessor ca; - table.insert( ca, std::make_pair(MyKey::make(i), MyData(i*i)) ); - ASSERT( ca->second.value_of()==i*i, NULL ); - } - } - } -}; - -struct Find { - static void apply( MyTable& table, int i ) { - MyTable::accessor a; - const MyTable::accessor& ca = a; - bool b = table.find( a, MyKey::make(i) ); - ASSERT( b==!a.empty(), NULL ); - if( b ) { - if( !UseKey(i) ) - printf("Line %d: unexpected key %d present\n",__LINE__,i); - AssertSameType( &*a, static_cast<MyTable::value_type*>(0) ); - ASSERT( ca->second.value_of()==i*i, NULL ); - ASSERT( (*ca).second.value_of()==i*i, NULL ); - if( i&1 ) - ca->second.set_value( ~ca->second.value_of() ); - else - (*ca).second.set_value( ~ca->second.value_of() ); - } else { - if( UseKey(i) ) - printf("Line %d: key %d missing\n",__LINE__,i); - } - } -}; - -struct FindConst { - static void apply( const MyTable& table, int i ) { - MyTable::const_accessor a; - const MyTable::const_accessor& ca = a; - bool b = table.find( a, MyKey::make(i) ); - ASSERT( b==(table.count(MyKey::make(i))>0), NULL ); - ASSERT( b==!a.empty(), NULL ); - ASSERT( b==UseKey(i), NULL ); - if( b ) { - AssertSameType( &*ca, static_cast<const MyTable::value_type*>(0) ); - ASSERT( ca->second.value_of()==~(i*i), NULL ); - ASSERT( (*ca).second.value_of()==~(i*i), NULL ); - } - } -}; - -tbb::atomic<int> EraseCount; - -struct Erase { - static void apply( MyTable& table, int i ) { - bool b; - if(i&4) { - if(i&8) { - MyTable::const_accessor a; - b = table.find( a, MyKey::make(i) ) && table.erase( a ); - } else { - MyTable::accessor a; - b = table.find( a, MyKey::make(i) ) && table.erase( a ); - } - } else - b = table.erase( MyKey::make(i) ); - if( b ) ++EraseCount; - ASSERT( table.count(MyKey::make(i)) == 0, NULL ); - } -}; - -static const int IE_SIZE = 2; -tbb::atomic<YourTable::size_type> InsertEraseCount[IE_SIZE]; - -struct InsertErase { - static void apply( YourTable& table, int i ) { - if ( i%3 ) { - int key = i%IE_SIZE; - if ( table.insert( std::make_pair(MyKey::make(key), MyData2()) ) ) - ++InsertEraseCount[key]; - } else { - int key = i%IE_SIZE; - if( i&1 ) { - YourTable::accessor res; - if(table.find( res, MyKey::make(key) ) && table.erase( res ) ) - --InsertEraseCount[key]; - } else { - YourTable::const_accessor res; - if(table.find( res, MyKey::make(key) ) && table.erase( res ) ) - --InsertEraseCount[key]; - } - } - } -}; - -// Test for the deadlock discussed at: -// http://softwarecommunity.intel.com/isn/Community/en-US/forums/permalink/30253302/30253302/ShowThread.aspx#30253302 -struct InnerInsert { - static void apply( YourTable& table, int i ) { - YourTable::accessor a1, a2; - if(i&1) __TBB_Yield(); - table.insert( a1, MyKey::make(1) ); - __TBB_Yield(); - table.insert( a2, MyKey::make(1 + (1<<30)) ); // the same chain - table.erase( a2 ); // if erase by key it would lead to deadlock for single thread - } -}; - -template<typename Op, typename MyTable> -class TableOperation: NoAssign { - MyTable& my_table; -public: - void operator()( const tbb::blocked_range<int>& range ) const { - for( int i=range.begin(); i!=range.end(); ++i ) - Op::apply(my_table,i); - } - TableOperation( MyTable& table ) : my_table(table) {} -}; - -template<typename Op, typename TableType> -void DoConcurrentOperations( TableType& table, int n, const char* what, int nthread ) { - if( Verbose ) - printf("testing %s with %d threads\n",what,nthread); - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for( tbb::blocked_range<int>(0,n,100), TableOperation<Op,TableType>(table) ); - tbb::tick_count t1 = tbb::tick_count::now(); - if( Verbose ) - printf("time for %s = %g with %d threads\n",what,(t1-t0).seconds(),nthread); -} - -//! Test traversing the table with an iterator. -void TraverseTable( MyTable& table, size_t n, size_t expected_size ) { - if( Verbose ) - printf("testing traversal\n"); - size_t actual_size = table.size(); - ASSERT( actual_size==expected_size, NULL ); - size_t count = 0; - bool* array = new bool[n]; - memset( array, 0, n*sizeof(bool) ); - const MyTable& const_table = table; - MyTable::const_iterator ci = const_table.begin(); - for( MyTable::iterator i = table.begin(); i!=table.end(); ++i ) { - // Check iterator - int k = i->first.value_of(); - ASSERT( UseKey(k), NULL ); - ASSERT( (*i).first.value_of()==k, NULL ); - ASSERT( 0<=k && size_t(k)<n, "out of bounds key" ); - ASSERT( !array[k], "duplicate key" ); - array[k] = true; - ++count; - - // Check lower/upper bounds - std::pair<MyTable::iterator, MyTable::iterator> er = table.equal_range(i->first); - std::pair<MyTable::const_iterator, MyTable::const_iterator> cer = const_table.equal_range(i->first); - ASSERT(cer.first == er.first && cer.second == er.second, NULL); - ASSERT(cer.first == i, NULL); - ASSERT(std::distance(cer.first, cer.second) == 1, NULL); - - // Check const_iterator - ASSERT( ci->first.value_of()==k, NULL ); - ASSERT( (*ci).first.value_of()==k, NULL ); - ++ci; - } - ASSERT( ci==const_table.end(), NULL ); - delete[] array; - if( count!=expected_size ) { - printf("Line %d: count=%ld but should be %ld\n",__LINE__,long(count),long(expected_size)); - } -} - -typedef tbb::atomic<unsigned char> AtomicByte; - -template<typename RangeType> -struct ParallelTraverseBody: NoAssign { - const size_t n; - AtomicByte* const array; - ParallelTraverseBody( AtomicByte array_[], size_t n_ ) : - n(n_), - array(array_) - {} - void operator()( const RangeType& range ) const { - for( typename RangeType::iterator i = range.begin(); i!=range.end(); ++i ) { - int k = i->first.value_of(); - ASSERT( 0<=k && size_t(k)<n, NULL ); - ++array[k]; - } - } -}; - -void Check( AtomicByte array[], size_t n, size_t expected_size ) { - if( expected_size ) - for( size_t k=0; k<n; ++k ) { - if( array[k] != int(UseKey(k)) ) { - printf("array[%d]=%d != %d=UseKey(%d)\n", - int(k), int(array[k]), int(UseKey(k)), int(k)); - ASSERT(false,NULL); - } - } -} - -//! Test travering the tabel with a parallel range -void ParallelTraverseTable( MyTable& table, size_t n, size_t expected_size ) { - if( Verbose ) - printf("testing parallel traversal\n"); - ASSERT( table.size()==expected_size, NULL ); - AtomicByte* array = new AtomicByte[n]; - - memset( array, 0, n*sizeof(AtomicByte) ); - MyTable::range_type r = table.range(10); - tbb::parallel_for( r, ParallelTraverseBody<MyTable::range_type>( array, n )); - Check( array, n, expected_size ); - - const MyTable& const_table = table; - memset( array, 0, n*sizeof(AtomicByte) ); - MyTable::const_range_type cr = const_table.range(10); - tbb::parallel_for( cr, ParallelTraverseBody<MyTable::const_range_type>( array, n )); - Check( array, n, expected_size ); - - delete[] array; -} - -void TestInsertFindErase( int nthread ) { - int n=250000; - - // compute m = number of unique keys - int m = 0; - for( int i=0; i<n; ++i ) - m += UseKey(i); - - MyAllocator a; a.items_freed = a.frees = 100; - ASSERT( MyDataCount==0, NULL ); - MyTable table(a); - TraverseTable(table,n,0); - ParallelTraverseTable(table,n,0); - CheckAllocator(table, 0, 100); - - DoConcurrentOperations<Insert,MyTable>(table,n,"insert",nthread); - ASSERT( MyDataCount==m, NULL ); - TraverseTable(table,n,m); - ParallelTraverseTable(table,n,m); - CheckAllocator(table, m, 100); - - DoConcurrentOperations<Find,MyTable>(table,n,"find",nthread); - ASSERT( MyDataCount==m, NULL ); - CheckAllocator(table, m, 100); - - DoConcurrentOperations<FindConst,MyTable>(table,n,"find(const)",nthread); - ASSERT( MyDataCount==m, NULL ); - CheckAllocator(table, m, 100); - - EraseCount=0; - DoConcurrentOperations<Erase,MyTable>(table,n,"erase",nthread); - ASSERT( EraseCount==m, NULL ); - ASSERT( MyDataCount==0, NULL ); - TraverseTable(table,n,0); - CheckAllocator(table, m, m+100); - - bad_hashing = true; - table.clear(); - bad_hashing = false; - - if(nthread > 1) { - YourTable ie_table; - for( int i=0; i<IE_SIZE; ++i ) - InsertEraseCount[i] = 0; - DoConcurrentOperations<InsertErase,YourTable>(ie_table,n/2,"insert_erase",nthread); - for( int i=0; i<IE_SIZE; ++i ) - ASSERT( InsertEraseCount[i]==ie_table.count(MyKey::make(i)), NULL ); - - DoConcurrentOperations<InnerInsert,YourTable>(ie_table,2000,"inner insert",nthread); - } -} - -volatile int Counter; - -class AddToTable: NoAssign { - MyTable& my_table; - const int my_nthread; - const int my_m; -public: - AddToTable( MyTable& table, int nthread, int m ) : my_table(table), my_nthread(nthread), my_m(m) {} - void operator()( int ) const { - for( int i=0; i<my_m; ++i ) { - // Busy wait to synchronize threads - int j = 0; - while( Counter<i ) { - if( ++j==1000000 ) { - // If Counter<i after a million iterations, then we almost surely have - // more logical threads than physical threads, and should yield in - // order to let suspended logical threads make progress. - j = 0; - __TBB_Yield(); - } - } - // Now all threads attempt to simultaneously insert a key. - int k; - { - MyTable::accessor a; - MyKey key = MyKey::make(i); - if( my_table.insert( a, key ) ) - a->second.set_value( 1 ); - else - a->second.set_value( a->second.value_of()+1 ); - k = a->second.value_of(); - } - if( k==my_nthread ) - Counter=i+1; - } - } -}; - -class RemoveFromTable: NoAssign { - MyTable& my_table; - const int my_nthread; - const int my_m; -public: - RemoveFromTable( MyTable& table, int nthread, int m ) : my_table(table), my_nthread(nthread), my_m(m) {} - void operator()(int) const { - for( int i=0; i<my_m; ++i ) { - bool b; - if(i&4) { - if(i&8) { - MyTable::const_accessor a; - b = my_table.find( a, MyKey::make(i) ) && my_table.erase( a ); - } else { - MyTable::accessor a; - b = my_table.find( a, MyKey::make(i) ) && my_table.erase( a ); - } - } else - b = my_table.erase( MyKey::make(i) ); - if( b ) ++EraseCount; - } - } -}; - -//! Test for memory leak in concurrent_hash_map (TR #153). -void TestConcurrency( int nthread ) { - if( Verbose ) - printf("testing multiple insertions/deletions of same key with %d threads\n", nthread); - { - ASSERT( MyDataCount==0, NULL ); - MyTable table; - const int m = 1000; - Counter = 0; - tbb::tick_count t0 = tbb::tick_count::now(); - NativeParallelFor( nthread, AddToTable(table,nthread,m) ); - tbb::tick_count t1 = tbb::tick_count::now(); - if( Verbose ) - printf("time for %u insertions = %g with %d threads\n",unsigned(MyDataCount),(t1-t0).seconds(),nthread); - ASSERT( MyDataCount==m, "memory leak detected" ); - - EraseCount = 0; - t0 = tbb::tick_count::now(); - NativeParallelFor( nthread, RemoveFromTable(table,nthread,m) ); - t1 = tbb::tick_count::now(); - if( Verbose ) - printf("time for %u deletions = %g with %d threads\n",unsigned(EraseCount),(t1-t0).seconds(),nthread); - ASSERT( MyDataCount==0, "memory leak detected" ); - ASSERT( EraseCount==m, "return value of erase() is broken" ); - - CheckAllocator(table, m, m, /*exact*/nthread <= 1); - } - ASSERT( MyDataCount==0, "memory leak detected" ); -} - -void TestTypes() { - AssertSameType( static_cast<MyTable::key_type*>(0), static_cast<MyKey*>(0) ); - AssertSameType( static_cast<MyTable::mapped_type*>(0), static_cast<MyData*>(0) ); - AssertSameType( static_cast<MyTable::value_type*>(0), static_cast<std::pair<const MyKey,MyData>*>(0) ); - AssertSameType( static_cast<MyTable::accessor::value_type*>(0), static_cast<MyTable::value_type*>(0) ); - AssertSameType( static_cast<MyTable::const_accessor::value_type*>(0), static_cast<const MyTable::value_type*>(0) ); - AssertSameType( static_cast<MyTable::size_type*>(0), static_cast<size_t*>(0) ); - AssertSameType( static_cast<MyTable::difference_type*>(0), static_cast<ptrdiff_t*>(0) ); -} - -template<typename Iterator, typename T> -void TestIteratorTraits() { - AssertSameType( static_cast<typename Iterator::difference_type*>(0), static_cast<ptrdiff_t*>(0) ); - AssertSameType( static_cast<typename Iterator::value_type*>(0), static_cast<T*>(0) ); - AssertSameType( static_cast<typename Iterator::pointer*>(0), static_cast<T**>(0) ); - AssertSameType( static_cast<typename Iterator::iterator_category*>(0), static_cast<std::forward_iterator_tag*>(0) ); - T x; - typename Iterator::reference xr = x; - typename Iterator::pointer xp = &x; - ASSERT( &xr==xp, NULL ); -} - -template<typename Iterator1, typename Iterator2> -void TestIteratorAssignment( Iterator2 j ) { - Iterator1 i(j), k; - ASSERT( i==j, NULL ); ASSERT( !(i!=j), NULL ); - k = j; - ASSERT( k==j, NULL ); ASSERT( !(k!=j), NULL ); -} - -template<typename Range1, typename Range2> -void TestRangeAssignment( Range2 r2 ) { - Range1 r1(r2); r1 = r2; -} -//------------------------------------------------------------------------ -// Test for copy constructor and assignment -//------------------------------------------------------------------------ - -template<typename MyTable> -void FillTable( MyTable& x, int n ) { - for( int i=1; i<=n; ++i ) { - MyKey key( MyKey::make(i) ); - typename MyTable::accessor a; - bool b = x.insert(a,key); - ASSERT(b,NULL); - a->second.set_value( i*i ); - } -} - -template<typename MyTable> -void CheckTable( const MyTable& x, int n ) { - ASSERT( x.size()==size_t(n), "table is different size than expected" ); - ASSERT( x.empty()==(n==0), NULL ); - ASSERT( x.size()<=x.max_size(), NULL ); - for( int i=1; i<=n; ++i ) { - MyKey key( MyKey::make(i) ); - typename MyTable::const_accessor a; - bool b = x.find(a,key); - ASSERT( b, NULL ); - ASSERT( a->second.value_of()==i*i, NULL ); - } - int count = 0; - int key_sum = 0; - for( typename MyTable::const_iterator i(x.begin()); i!=x.end(); ++i ) { - ++count; - key_sum += i->first.value_of(); - } - ASSERT( count==n, NULL ); - ASSERT( key_sum==n*(n+1)/2, NULL ); -} - -void TestCopy() { - if( Verbose ) - printf("testing copy\n"); - MyTable t1; - for( int i=0; i<10000; i=(i<100 ? i+1 : i*3) ) { - MyDataCount = 0; - - FillTable( t1, i ); - CheckTable(t1,i); - - MyTable t2(t1); - // Check that copy constructor did not mangle source table. - CheckTable(t1,i); - swap(t1, t2); - CheckTable(t1,i); - ASSERT( !(t1 != t2), NULL ); - - // Clear original table - t2.clear(); - swap(t2, t1); - CheckTable(t1,0); - - // Verify that copy of t1 is correct, even after t1 is cleared. - CheckTable(t2,i); - t2.clear(); - t1.swap( t2 ); - CheckTable(t1,0); - CheckTable(t2,0); - ASSERT( MyDataCount==0, "data leak?" ); - } -} - -void TestAssignment() { - if( Verbose ) - printf("testing assignment\n"); - for( int i=0; i<1000; i=(i<30 ? i+1 : i*5) ) { - for( int j=0; j<1000; j=(j<30 ? j+1 : j*7) ) { - MyTable t1; - MyTable t2; - FillTable(t1,i); - FillTable(t2,j); - ASSERT( (t1 == t2) == (i == j), NULL ); - CheckTable(t1,i); - CheckTable(t2,j); - - MyTable& tref = t2=t1; - ASSERT( &tref==&t2, NULL ); - CheckTable(t1,i); - CheckTable(t2,i); - - t1.clear(); - CheckTable(t1,0); - CheckTable(t2,i); - ASSERT( MyDataCount==i, "data leak?" ); - - t2.clear(); - CheckTable(t1,0); - CheckTable(t2,0); - ASSERT( MyDataCount==0, "data leak?" ); - } - } -} - -void TestIteratorsAndRanges() { - if( Verbose ) - printf("testing iterators compliance\n"); - TestIteratorTraits<MyTable::iterator,MyTable::value_type>(); - TestIteratorTraits<MyTable::const_iterator,const MyTable::value_type>(); - - MyTable v; - MyTable const &u = v; - - TestIteratorAssignment<MyTable::const_iterator>( u.begin() ); - TestIteratorAssignment<MyTable::const_iterator>( v.begin() ); - TestIteratorAssignment<MyTable::iterator>( v.begin() ); - // doesn't compile as expected: TestIteratorAssignment<typename V::iterator>( u.begin() ); - - // check for non-existing - ASSERT(v.equal_range(MyKey::make(-1)) == std::make_pair(v.end(), v.end()), NULL); - ASSERT(u.equal_range(MyKey::make(-1)) == std::make_pair(u.end(), u.end()), NULL); - - if( Verbose ) - printf("testing ranges compliance\n"); - TestRangeAssignment<MyTable::const_range_type>( u.range() ); - TestRangeAssignment<MyTable::const_range_type>( v.range() ); - TestRangeAssignment<MyTable::range_type>( v.range() ); - // doesn't compile as expected: TestRangeAssignment<typename V::range_type>( u.range() ); - - if( Verbose ) - printf("testing construction and insertion from iterators range\n"); - FillTable( v, 1000 ); - MyTable2 t(v.begin(), v.end()); - CheckTable(t, 1000); - t.insert(v.begin(), v.end()); // do nothing - CheckTable(t, 1000); - t.clear(); - t.insert(v.begin(), v.end()); // restore - CheckTable(t, 1000); - - if( Verbose ) - printf("testing comparison\n"); - typedef tbb::concurrent_hash_map<MyKey,MyData2,YourHashCompare,MyAllocator> YourTable1; - typedef tbb::concurrent_hash_map<MyKey,MyData2,YourHashCompare> YourTable2; - YourTable1 t1; - FillTable( t1, 10 ); - CheckTable(t1, 10 ); - YourTable2 t2(t1.begin(), t1.end()); - MyKey key( MyKey::make(5) ); MyData2 data; - ASSERT(t2.erase(key), NULL); - YourTable2::accessor a; - ASSERT(t2.insert(a, key), NULL); - data.set_value(0); a->second = data; - ASSERT( t1 != t2, NULL); - data.set_value(5*5); a->second = data; - ASSERT( t1 == t2, NULL); -} - -void TestExceptions() { - typedef local_counting_allocator<tbb::tbb_allocator<MyData2> > allocator_t; - typedef tbb::concurrent_hash_map<MyKey,MyData2,MyHashCompare,allocator_t> ThrowingTable; - enum methods { - zero_method = 0, - ctor_copy, op_assign, op_insert, - all_methods - }; - if( Verbose ) - printf("testing exception-safety guarantees\n"); - ThrowingTable src; - FillTable( src, 1000 ); - ASSERT( MyDataCount==1000, NULL ); - - try { - for(int t = 0; t < 2; t++) // exception type - for(int m = zero_method+1; m < all_methods; m++) - { - allocator_t a; - if(t) MyDataCountLimit = 101; - else a.set_limits(101); - ThrowingTable victim(a); - MyDataCount = 0; - - try { - switch(m) { - case ctor_copy: { - ThrowingTable acopy(src, a); - } break; - case op_assign: { - victim = src; - } break; - case op_insert: { - FillTable( victim, 1000 ); - } break; - default:; - } - ASSERT(false, "should throw an exception"); - } catch(std::bad_alloc &e) { - MyDataCountLimit = 0; - size_t size = victim.size(); - switch(m) { - case op_assign: - ASSERT( MyDataCount==100, "data leak?" ); - ASSERT( size>=100, NULL ); - CheckAllocator(victim, 100+t, t); - case ctor_copy: - CheckTable(src, 1000); - break; - case op_insert: - ASSERT( size==size_t(100-t), NULL ); - ASSERT( MyDataCount==100-t, "data leak?" ); - CheckTable(victim, 100-t); - CheckAllocator(victim, 100, t); - break; - - default:; // nothing to check here - } - if( Verbose ) printf("Exception %d: %s\t- ok ()\n", m, e.what()); - } - } - } catch(...) { - ASSERT(false, "unexpected exception"); - } - src.clear(); MyDataCount = 0; -} - -//------------------------------------------------------------------------ -// Test driver -//------------------------------------------------------------------------ - -#include "tbb/task_scheduler_init.h" - -//! Test driver -int main( int argc, char* argv[] ) { - // Default minimum number of threads is 1. - MinThread = 1; - - ParseCommandLine(argc,argv); - if( MinThread<0 ) { - printf("ERROR: must use at least one thread\n"); - exit(1); - } - - // Do serial tests - TestTypes(); - TestCopy(); - TestAssignment(); - TestIteratorsAndRanges(); - TestExceptions(); - - // Do concurrency tests. - for( int nthread=MinThread; nthread<=MaxThread; ++nthread ) { - tbb::task_scheduler_init init( nthread ); - TestInsertFindErase( nthread ); - TestConcurrency( nthread ); - } - // check linking - if(bad_hashing) { //should be false - tbb::internal::runtime_warning("none\nERROR: it must not be executed"); - } - - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_queue.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_queue.cpp deleted file mode 100644 index 2cbf0d9c95..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_queue.cpp +++ /dev/null @@ -1,846 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/concurrent_queue.h" -#include "tbb/atomic.h" -#include "tbb/tick_count.h" -#include "harness.h" -#include "harness_allocator.h" - -static tbb::atomic<long> FooConstructed; -static tbb::atomic<long> FooDestroyed; - -class Foo { - enum state_t{ - LIVE=0x1234, - DEAD=0xDEAD - }; - state_t state; -public: - int thread_id; - int serial; - Foo() : state(LIVE) { - ++FooConstructed; - } - Foo( const Foo& item ) : state(LIVE) { - ASSERT( item.state==LIVE, NULL ); - ++FooConstructed; - thread_id = item.thread_id; - serial = item.serial; - } - ~Foo() { - ASSERT( state==LIVE, NULL ); - ++FooDestroyed; - state=DEAD; - thread_id=0xDEAD; - serial=0xDEAD; - } - void operator=( Foo& item ) { - ASSERT( item.state==LIVE, NULL ); - ASSERT( state==LIVE, NULL ); - thread_id = item.thread_id; - serial = item.serial; - } - bool is_const() {return false;} - bool is_const() const {return true;} -}; - -// problem size -static const int N = 50000; // # of bytes - -//! Exception for concurrent_queue -class Foo_exception : public std::bad_alloc { -public: - virtual const char *what() const throw() { return "out of Foo limit"; } - virtual ~Foo_exception() throw() {} -}; - -static tbb::atomic<long> FooExConstructed; -static tbb::atomic<long> FooExDestroyed; -static tbb::atomic<long> serial_source; -static long MaxFooCount = 0; -static const long Threshold = 400; - -class FooEx { - enum state_t{ - LIVE=0x1234, - DEAD=0xDEAD - }; - state_t state; -public: - int serial; - FooEx() : state(LIVE) { - ++FooExConstructed; - serial = serial_source++; - } - - FooEx( const FooEx& item ) : state(LIVE) { - ++FooExConstructed; - if( MaxFooCount && (FooExConstructed-FooExDestroyed) >= MaxFooCount ) // in push() - throw Foo_exception(); - serial = item.serial; - } - ~FooEx() { - ASSERT( state==LIVE, NULL ); - ++FooExDestroyed; - state=DEAD; - serial=0xDEAD; - } - void operator=( FooEx& item ) { - ASSERT( item.state==LIVE, NULL ); - ASSERT( state==LIVE, NULL ); - serial = item.serial; - if( MaxFooCount==2*Threshold && (FooExConstructed-FooExDestroyed) <= MaxFooCount/4 ) // in pop() - throw Foo_exception(); - } -} ; - -const size_t MAXTHREAD = 256; - -static int Sum[MAXTHREAD]; - -//! Count of various pop operations -/** [0] = pop_if_present that failed - [1] = pop_if_present that succeeded - [2] = pop */ -static tbb::atomic<long> PopKind[3]; - -const int M = 10000; - -struct Body: NoAssign { - tbb::concurrent_queue<Foo>* queue; - const int nthread; - Body( int nthread_ ) : nthread(nthread_) {} - void operator()( int thread_id ) const { - long pop_kind[3] = {0,0,0}; - int serial[MAXTHREAD+1]; - memset( serial, 0, nthread*sizeof(int) ); - ASSERT( thread_id<nthread, NULL ); - - long sum = 0; - for( long j=0; j<M; ++j ) { - Foo f; - f.thread_id = 0xDEAD; - f.serial = 0xDEAD; - bool prepopped = false; - if( j&1 ) { - prepopped = queue->pop_if_present(f); - ++pop_kind[prepopped]; - } - Foo g; - g.thread_id = thread_id; - g.serial = j+1; - queue->push( g ); - if( !prepopped ) { - queue->pop(f); - ++pop_kind[2]; - } - ASSERT( f.thread_id<=nthread, NULL ); - ASSERT( f.thread_id==nthread || serial[f.thread_id]<f.serial, "partial order violation" ); - serial[f.thread_id] = f.serial; - sum += f.serial-1; - } - Sum[thread_id] = sum; - for( int k=0; k<3; ++k ) - PopKind[k] += pop_kind[k]; - } -}; - -void TestPushPop( int prefill, ptrdiff_t capacity, int nthread ) { - ASSERT( nthread>0, "nthread must be positive" ); - if( prefill+1>=capacity ) - return; - bool success = false; - for( int k=0; k<3; ++k ) - PopKind[k] = 0; - for( int trial=0; !success; ++trial ) { - FooConstructed = 0; - FooDestroyed = 0; - Body body(nthread); - tbb::concurrent_queue<Foo> queue; - queue.set_capacity( capacity ); - body.queue = &queue; - for( int i=0; i<prefill; ++i ) { - Foo f; - f.thread_id = nthread; - f.serial = 1+i; - queue.push(f); - ASSERT( queue.size()==i+1, NULL ); - ASSERT( !queue.empty(), NULL ); - } - tbb::tick_count t0 = tbb::tick_count::now(); - NativeParallelFor( nthread, body ); - tbb::tick_count t1 = tbb::tick_count::now(); -#if !__TBB_FLOATING_POINT_BROKEN - double timing = (t1-t0).seconds(); - if( Verbose ) - printf("prefill=%d capacity=%d time = %g = %g nsec/operation\n", prefill, int(capacity), timing, timing/(2*M*nthread)*1.E9); -#endif /* !__TBB_FLOATING_POINT_BROKEN */ - int sum = 0; - for( int k=0; k<nthread; ++k ) - sum += Sum[k]; - int expected = nthread*((M-1)*M/2) + ((prefill-1)*prefill)/2; - for( int i=prefill; --i>=0; ) { - ASSERT( !queue.empty(), NULL ); - Foo f; - queue.pop(f); - ASSERT( queue.size()==i, NULL ); - sum += f.serial-1; - } - ASSERT( queue.empty(), NULL ); - ASSERT( queue.size()==0, NULL ); - if( sum!=expected ) - printf("sum=%d expected=%d\n",sum,expected); - ASSERT( FooConstructed==FooDestroyed, NULL ); - // TODO: checks by counting allocators - - success = true; - if( nthread>1 && prefill==0 ) { - // Check that pop_if_present got sufficient exercise - for( int k=0; k<2; ++k ) { -#if (_WIN32||_WIN64) - // The TBB library on Windows seems to have a tough time generating - // the desired interleavings for pop_if_present, so the code tries longer, and settles - // for fewer desired interleavings. - const int max_trial = 100; - const int min_requirement = 20; -#else - const int min_requirement = 100; - const int max_trial = 20; -#endif /* _WIN32||_WIN64 */ - if( PopKind[k]<min_requirement ) { - if( trial>=max_trial ) { - if( Verbose ) - printf("Warning: %d threads had only %ld pop_if_present operations %s after %d trials (expected at least %d). " - "This problem may merely be unlucky scheduling. " - "Investigate only if it happens repeatedly.\n", - nthread, long(PopKind[k]), k==0?"failed":"succeeded", max_trial, min_requirement); - else - printf("Warning: the number of %s pop_if_present operations is less than expected for %d threads. Investigate if it happens repeatedly.\n", - k==0?"failed":"succeeded", nthread ); - - } else { - success = false; - } - } - } - } - } -} - -class Bar { - enum state_t { - LIVE=0x1234, - DEAD=0xDEAD - }; - state_t state; -public: - ptrdiff_t my_id; - Bar() : state(LIVE), my_id(-1) {} - Bar(size_t _i) : state(LIVE), my_id(_i) {} - Bar( const Bar& a_bar ) : state(LIVE) { - ASSERT( a_bar.state==LIVE, NULL ); - my_id = a_bar.my_id; - } - ~Bar() { - ASSERT( state==LIVE, NULL ); - state = DEAD; - my_id = DEAD; - } - void operator=( const Bar& a_bar ) { - ASSERT( a_bar.state==LIVE, NULL ); - ASSERT( state==LIVE, NULL ); - my_id = a_bar.my_id; - } - friend bool operator==(const Bar& bar1, const Bar& bar2 ) ; -} ; - -bool operator==(const Bar& bar1, const Bar& bar2) { - ASSERT( bar1.state==Bar::LIVE, NULL ); - ASSERT( bar2.state==Bar::LIVE, NULL ); - return bar1.my_id == bar2.my_id; -} - -class BarIterator -{ - Bar* bar_ptr; - BarIterator(Bar* bp_) : bar_ptr(bp_) {} -public: - ~BarIterator() {} - BarIterator& operator=( const BarIterator& other ) { - bar_ptr = other.bar_ptr; - return *this; - } - Bar& operator*() const { - return *bar_ptr; - } - BarIterator& operator++() { - ++bar_ptr; - return *this; - } - Bar* operator++(int) { - Bar* result = &operator*(); - operator++(); - return result; - } - friend bool operator==(const BarIterator& bia, const BarIterator& bib) ; - friend bool operator!=(const BarIterator& bia, const BarIterator& bib) ; - friend void TestConstructors (); -} ; - -bool operator==(const BarIterator& bia, const BarIterator& bib) { - return bia.bar_ptr==bib.bar_ptr; -} - -bool operator!=(const BarIterator& bia, const BarIterator& bib) { - return bia.bar_ptr!=bib.bar_ptr; -} - -class Bar_exception : public std::bad_alloc { -public: - virtual const char *what() const throw() { return "making the entry invalid"; } - virtual ~Bar_exception() throw() {} -}; - -class BarEx -{ - enum state_t { - LIVE=0x1234, - DEAD=0xDEAD - }; - static int count; -public: - state_t state; - typedef enum { - PREPARATION, - COPY_CONSTRUCT - } mode_t; - static mode_t mode; - ptrdiff_t my_id; - ptrdiff_t my_tilda_id; - static int button; - BarEx() : state(LIVE), my_id(-1), my_tilda_id(-1) {} - BarEx(size_t _i) : state(LIVE), my_id(_i), my_tilda_id(my_id^(-1)) {} - BarEx( const BarEx& a_bar ) : state(LIVE) { - ASSERT( a_bar.state==LIVE, NULL ); - my_id = a_bar.my_id; - if( mode==PREPARATION ) - if( !( ++count % 100 ) ) - throw Bar_exception(); - my_tilda_id = a_bar.my_tilda_id; - } - ~BarEx() { - ASSERT( state==LIVE, NULL ); - state = DEAD; - my_id = DEAD; - } - static void set_mode( mode_t m ) { mode = m; } - void operator=( const BarEx& a_bar ) { - ASSERT( a_bar.state==LIVE, NULL ); - ASSERT( state==LIVE, NULL ); - my_id = a_bar.my_id; - my_tilda_id = a_bar.my_tilda_id; - } - friend bool operator==(const BarEx& bar1, const BarEx& bar2 ) ; -} ; - -int BarEx::count = 0; -BarEx::mode_t BarEx::mode = BarEx::PREPARATION; - -bool operator==(const BarEx& bar1, const BarEx& bar2) { - ASSERT( bar1.state==BarEx::LIVE, NULL ); - ASSERT( bar2.state==BarEx::LIVE, NULL ); - ASSERT( (bar1.my_id ^ bar1.my_tilda_id) == -1, NULL ); - ASSERT( (bar2.my_id ^ bar2.my_tilda_id) == -1, NULL ); - return bar1.my_id==bar2.my_id && bar1.my_tilda_id==bar2.my_tilda_id; -} - -void TestConstructors () -{ - tbb::concurrent_queue<Bar> src_queue; - tbb::concurrent_queue<Bar>::const_iterator dqb; - tbb::concurrent_queue<Bar>::const_iterator dqe; - tbb::concurrent_queue<Bar>::const_iterator iter; - - for( size_t size=0; size<1001; ++size ) { - for( size_t i=0; i<size; ++i ) - src_queue.push(Bar(i+(i^size))); - tbb::concurrent_queue<Bar>::const_iterator sqb(src_queue.begin()); - tbb::concurrent_queue<Bar>::const_iterator sqe(src_queue.end()); - - tbb::concurrent_queue<Bar> dst_queue(sqb, sqe); - - ASSERT(src_queue.size()==dst_queue.size(), "different size"); - - src_queue.clear(); - } - - Bar bar_array[1001]; - for( size_t size=0; size<1001; ++size ) { - for( size_t i=0; i<size; ++i ) - bar_array[i] = Bar(i+(i^size)); - - const BarIterator sab(bar_array+0); - const BarIterator sae(bar_array+size); - - tbb::concurrent_queue<Bar> dst_queue2(sab, sae); - - ASSERT( int(size)==dst_queue2.size(), NULL ); - ASSERT( sab==BarIterator(bar_array+0), NULL ); - ASSERT( sae==BarIterator(bar_array+size), NULL ); - - dqb = dst_queue2.begin(); - dqe = dst_queue2.end(); - BarIterator v_iter(sab); - for( ; dqb != dqe; ++dqb, ++v_iter ) - ASSERT( *dqb == *v_iter, "unexpected element" ); - ASSERT( v_iter==sae, "different size?" ); - } - - src_queue.clear(); - - tbb::concurrent_queue<Bar> dst_queue3( src_queue ); - ASSERT( src_queue.size()==dst_queue3.size(), NULL ); - ASSERT( 0==dst_queue3.size(), NULL ); - - int k=0; - for( size_t i=0; i<1001; ++i ) { - Bar tmp_bar; - src_queue.push(Bar(++k)); - src_queue.push(Bar(++k)); - src_queue.pop(tmp_bar); - - tbb::concurrent_queue<Bar> dst_queue4( src_queue ); - - ASSERT( src_queue.size()==dst_queue4.size(), NULL ); - - dqb = dst_queue4.begin(); - dqe = dst_queue4.end(); - iter = src_queue.begin(); - - for( ; dqb != dqe; ++dqb, ++iter ) - ASSERT( *dqb == *iter, "unexpected element" ); - - ASSERT( iter==src_queue.end(), "different size?" ); - } - - tbb::concurrent_queue<Bar> dst_queue5( src_queue ); - - ASSERT( src_queue.size()==dst_queue5.size(), NULL ); - dqb = dst_queue5.begin(); - dqe = dst_queue5.end(); - iter = src_queue.begin(); - for( ; dqb != dqe; ++dqb, ++iter ) - ASSERT( *dqb == *iter, "unexpected element" ); - - for( size_t i=0; i<100; ++i) { - Bar tmp_bar; - src_queue.push(Bar(i+1000)); - src_queue.push(Bar(i+1000)); - src_queue.pop(tmp_bar); - - dst_queue5.push(Bar(i+1000)); - dst_queue5.push(Bar(i+1000)); - dst_queue5.pop(tmp_bar); - } - - ASSERT( src_queue.size()==dst_queue5.size(), NULL ); - dqb = dst_queue5.begin(); - dqe = dst_queue5.end(); - iter = src_queue.begin(); - for( ; dqb != dqe; ++dqb, ++iter ) - ASSERT( *dqb == *iter, "unexpected element" ); - ASSERT( iter==src_queue.end(), "different size?" ); - -#if __TBB_EXCEPTION_HANDLING_BROKEN || __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN - printf("Warning: Part of the constructor test is skipped due to a known issue.\n"); -#else - k = 0; - int n_elements=0; - tbb::concurrent_queue<BarEx> src_queue_ex; - for( size_t size=0; size<1001; ++size ) { - BarEx tmp_bar_ex; - int n_successful_pushes=0; - BarEx::set_mode( BarEx::PREPARATION ); - try { - src_queue_ex.push(BarEx(k+(k^size))); - ++n_successful_pushes; - } catch (...) { - } - ++k; - try { - src_queue_ex.push(BarEx(k+(k^size))); - ++n_successful_pushes; - } catch (...) { - } - ++k; - src_queue_ex.pop(tmp_bar_ex); - n_elements += (n_successful_pushes - 1); - ASSERT( src_queue_ex.size()==n_elements, NULL); - - BarEx::set_mode( BarEx::COPY_CONSTRUCT ); - tbb::concurrent_queue<BarEx> dst_queue_ex( src_queue_ex ); - - ASSERT( src_queue_ex.size()==dst_queue_ex.size(), NULL ); - - tbb::concurrent_queue<BarEx>::const_iterator dqb_ex = dst_queue_ex.begin(); - tbb::concurrent_queue<BarEx>::const_iterator dqe_ex = dst_queue_ex.end(); - tbb::concurrent_queue<BarEx>::const_iterator iter_ex = src_queue_ex.begin(); - - for( ; dqb_ex != dqe_ex; ++dqb_ex, ++iter_ex ) - ASSERT( *dqb_ex == *iter_ex, "unexpected element" ); - ASSERT( iter_ex==src_queue_ex.end(), "different size?" ); - } -#endif -} - -template<typename Iterator1, typename Iterator2> -void TestIteratorAux( Iterator1 i, Iterator2 j, int size ) { - // Now test iteration - Iterator1 old_i; - for( int k=0; k<size; ++k ) { - ASSERT( i!=j, NULL ); - ASSERT( !(i==j), NULL ); - Foo f; - if( k&1 ) { - // Test pre-increment - f = *old_i++; - // Test assignment - i = old_i; - } else { - // Test post-increment - f=*i++; - if( k<size-1 ) { - // Test "->" - ASSERT( k+2==i->serial, NULL ); - } - // Test assignment - old_i = i; - } - ASSERT( k+1==f.serial, NULL ); - } - ASSERT( !(i!=j), NULL ); - ASSERT( i==j, NULL ); -} - -template<typename Iterator1, typename Iterator2> -void TestIteratorAssignment( Iterator2 j ) { - Iterator1 i(j); - ASSERT( i==j, NULL ); - ASSERT( !(i!=j), NULL ); - Iterator1 k; - k = j; - ASSERT( k==j, NULL ); - ASSERT( !(k!=j), NULL ); -} - -template<typename Iterator, typename T> -void TestIteratorTraits() { - AssertSameType( static_cast<typename Iterator::difference_type*>(0), static_cast<ptrdiff_t*>(0) ); - AssertSameType( static_cast<typename Iterator::value_type*>(0), static_cast<T*>(0) ); - AssertSameType( static_cast<typename Iterator::pointer*>(0), static_cast<T**>(0) ); - AssertSameType( static_cast<typename Iterator::iterator_category*>(0), static_cast<std::forward_iterator_tag*>(0) ); - T x; - typename Iterator::reference xr = x; - typename Iterator::pointer xp = &x; - ASSERT( &xr==xp, NULL ); -} - -//! Test the iterators for concurrent_queue -void TestIterator() { - tbb::concurrent_queue<Foo> queue; - tbb::concurrent_queue<Foo>& const_queue = queue; - for( int j=0; j<500; ++j ) { - TestIteratorAux( queue.begin(), queue.end(), j ); - TestIteratorAux( const_queue.begin(), const_queue.end(), j ); - TestIteratorAux( const_queue.begin(), queue.end(), j ); - TestIteratorAux( queue.begin(), const_queue.end(), j ); - Foo f; - f.serial = j+1; - queue.push(f); - } - TestIteratorAssignment<tbb::concurrent_queue<Foo>::const_iterator>( const_queue.begin() ); - TestIteratorAssignment<tbb::concurrent_queue<Foo>::const_iterator>( queue.begin() ); - TestIteratorAssignment<tbb::concurrent_queue<Foo>::iterator>( queue.begin() ); - TestIteratorTraits<tbb::concurrent_queue<Foo>::const_iterator, const Foo>(); - TestIteratorTraits<tbb::concurrent_queue<Foo>::iterator, Foo>(); -} - -void TestConcurrentQueueType() { - AssertSameType( tbb::concurrent_queue<Foo>::value_type(), Foo() ); - Foo f; - const Foo g; - tbb::concurrent_queue<Foo>::reference r = f; - ASSERT( &r==&f, NULL ); - ASSERT( !r.is_const(), NULL ); - tbb::concurrent_queue<Foo>::const_reference cr = g; - ASSERT( &cr==&g, NULL ); - ASSERT( cr.is_const(), NULL ); -} - -template<typename T> -void TestEmptyQueue() { - const tbb::concurrent_queue<T> queue; - ASSERT( queue.size()==0, NULL ); - ASSERT( queue.capacity()>0, NULL ); - ASSERT( size_t(queue.capacity())>=size_t(-1)/(sizeof(void*)+sizeof(T)), NULL ); -} - -void TestFullQueue() { - for( int n=0; n<10; ++n ) { - FooConstructed = 0; - FooDestroyed = 0; - tbb::concurrent_queue<Foo> queue; - queue.set_capacity(n); - for( int i=0; i<=n; ++i ) { - Foo f; - f.serial = i; - bool result = queue.push_if_not_full( f ); - ASSERT( result==(i<n), NULL ); - } - for( int i=0; i<=n; ++i ) { - Foo f; - bool result = queue.pop_if_present( f ); - ASSERT( result==(i<n), NULL ); - ASSERT( !result || f.serial==i, NULL ); - } - ASSERT( FooConstructed==FooDestroyed, NULL ); - } -} - -void TestClear() { - FooConstructed = 0; - FooDestroyed = 0; - const int n=5; - const int q_capacity=10; - - tbb::concurrent_queue<Foo> queue; - queue.set_capacity(q_capacity); - for( int i=0; i<n; ++i ) { - Foo f; - f.serial = i; - bool result = queue.push_if_not_full( f ); - ASSERT( result, NULL ); - } - ASSERT( queue.size()==n, NULL ); - queue.clear(); - ASSERT( queue.size()==0, NULL ); - for( int i=0; i<n; ++i ) { - Foo f; - f.serial = i; - bool result = queue.push_if_not_full( f ); - ASSERT( result, NULL ); - } - ASSERT( queue.size()==n, NULL ); - queue.clear(); - ASSERT( queue.size()==0, NULL ); - for( int i=0; i<n; ++i ) { - Foo f; - f.serial = i; - bool result = queue.push_if_not_full( f ); - ASSERT( result, NULL ); - } - ASSERT( queue.size()==n, NULL ); -} - -template<typename T> -struct TestNegativeQueueBody: NoAssign { - tbb::concurrent_queue<T>& queue; - const int nthread; - TestNegativeQueueBody( tbb::concurrent_queue<T>& q, int n ) : queue(q), nthread(n) {} - void operator()( int k ) const { - if( k==0 ) { - int number_of_pops = nthread-1; - // Wait for all pops to pend. - while( queue.size()>-number_of_pops ) { - __TBB_Yield(); - } - for( int i=0; ; ++i ) { - ASSERT( queue.size()==i-number_of_pops, NULL ); - ASSERT( queue.empty()==(queue.size()<=0), NULL ); - if( i==number_of_pops ) break; - // Satisfy another pop - queue.push( T() ); - } - } else { - // Pop item from queue - T item; - queue.pop(item); - } - } -}; - -//! Test a queue with a negative size. -template<typename T> -void TestNegativeQueue( int nthread ) { - tbb::concurrent_queue<T> queue; - NativeParallelFor( nthread, TestNegativeQueueBody<T>(queue,nthread) ); -} - -void TestExceptions() { - typedef static_counting_allocator<std::allocator<FooEx>, size_t> allocator_t; - typedef static_counting_allocator<std::allocator<char>, size_t> allocator_char_t; - typedef tbb::concurrent_queue<FooEx, allocator_t> concur_queue_t; - - enum methods { - m_push = 0, - m_pop - }; - - if( Verbose ) - printf("Testing exception safety\n"); - // verify 'clear()' on exception; queue's destructor calls its clear() - { - concur_queue_t queue_clear; - try { - allocator_char_t::init_counters(); - allocator_char_t::set_limits(N/2); - for( int k=0; k<N; k++ ) - queue_clear.push( FooEx() ); - } catch (...) { - // TODO: some assert here? - } - } - if( Verbose ) - printf("... queue destruction test passed\n"); - - try { - int n_pushed=0, n_popped=0; - for(int t = 0; t <= 1; t++)// exception type -- 0 : from allocator(), 1 : from Foo's constructor - { - concur_queue_t queue_test; - for( int m=m_push; m<=m_pop; m++ ) { - // concurrent_queue internally rebinds the allocator to one with 'char' - allocator_char_t::init_counters(); - - if(t) MaxFooCount = MaxFooCount + 400; - else allocator_char_t::set_limits(N/2); - - try { - switch(m) { - case m_push: - for( int k=0; k<N; k++ ) { - queue_test.push( FooEx() ); - n_pushed++; - } - break; - case m_pop: - n_popped=0; - for( int k=0; k<n_pushed; k++ ) { - FooEx elt; - queue_test.pop( elt ); - n_popped++; - } - n_pushed = 0; - allocator_char_t::set_limits(); - break; - } - if( !t && m==m_push ) ASSERT(false, "should throw an exception"); - } catch ( Foo_exception & ) { - switch(m) { - case m_push: { - ASSERT( queue_test.size()==n_pushed, "incorrect queue size" ); - long tc = MaxFooCount; - MaxFooCount = 0; - for( int k=0; k<(int)tc; k++ ) { - queue_test.push( FooEx() ); - n_pushed++; - } - MaxFooCount = tc; - } - break; - case m_pop: - MaxFooCount = 0; // disable exception - n_pushed -= (n_popped+1); // including one that threw an exception - for( int k=0; k<1000; k++ ) { - queue_test.push( FooEx() ); - n_pushed++; - } - ASSERT( !queue_test.empty(), "queue must not be empty" ); - ASSERT( queue_test.size()==n_pushed, "queue size must be equal to n pushed" ); - for( int k=0; k<n_pushed; k++ ) { - FooEx elt; - queue_test.pop( elt ); - } - ASSERT( queue_test.empty(), "queue must be empty" ); - ASSERT( queue_test.size()==0, "queue must be empty" ); - break; - } - } catch ( std::bad_alloc & ) { - allocator_char_t::set_limits(); // disable exception from allocator - size_t size = queue_test.size(); - switch(m) { - case m_push: - ASSERT( size>0, "incorrect queue size"); - break; - case m_pop: - if( !t ) ASSERT( false, "should not throw an exceptin" ); - break; - } - } - if( Verbose ) - printf("... for t=%d and m=%d, exception test passed\n", t, m); - } - } - } catch(...) { - ASSERT(false, "unexpected exception"); - } -} - -int main( int argc, char* argv[] ) { - // Set default for minimum number of threads. - MinThread = 1; - ParseCommandLine(argc,argv); - - TestEmptyQueue<char>(); - TestEmptyQueue<Foo>(); - TestFullQueue(); - TestClear(); - TestConcurrentQueueType(); - TestIterator(); - TestConstructors(); - - // Test concurrent operations - for( int nthread=MinThread; nthread<=MaxThread; ++nthread ) { - TestNegativeQueue<Foo>(nthread); - for( int prefill=0; prefill<64; prefill+=(1+prefill/3) ) { - TestPushPop(prefill,ptrdiff_t(-1),nthread); - TestPushPop(prefill,ptrdiff_t(1),nthread); - TestPushPop(prefill,ptrdiff_t(2),nthread); - TestPushPop(prefill,ptrdiff_t(10),nthread); - TestPushPop(prefill,ptrdiff_t(100),nthread); - } - } -#if __TBB_EXCEPTION_HANDLING_BROKEN - printf("Warning: Exception safety test is skipped due to a known issue.\n"); -#else - TestExceptions(); -#endif - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_vector.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_vector.cpp deleted file mode 100644 index e195d343f3..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_concurrent_vector.cpp +++ /dev/null @@ -1,923 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/concurrent_vector.h" -#include "tbb/cache_aligned_allocator.h" -#include "tbb/tbb_exception.h" -#include <cstdio> -#include <cstdlib> -#include <stdexcept> -#include "harness_assert.h" -#include "harness_allocator.h" - -static bool known_issue_verbose = false; -#define KNOWN_ISSUE(msg) if(!known_issue_verbose) known_issue_verbose = true, printf(msg) - -tbb::atomic<long> FooCount; -long MaxFooCount = 0; - -//! Problem size -const size_t N = 500000; - -//! Exception for concurrent_vector -class Foo_exception : public std::bad_alloc { -public: - virtual const char *what() const throw() { return "out of Foo limit"; } - virtual ~Foo_exception() throw() {} -}; - -struct Foo { - int my_bar; -public: - enum State { - ZeroInitialized=0, - DefaultInitialized=0x1234, - CopyInitialized=0x8765, - Destroyed=0x5678 - } state; - int& zero_bar() { - ASSERT( state==DefaultInitialized||state==CopyInitialized||state==ZeroInitialized, NULL ); - return my_bar; - } - int& bar() { - ASSERT( state==DefaultInitialized||state==CopyInitialized, NULL ); - return my_bar; - } - int bar() const { - ASSERT( state==DefaultInitialized||state==CopyInitialized, NULL ); - return my_bar; - } - static const int initial_value_of_bar = 42; - Foo() { - state = DefaultInitialized; - if(MaxFooCount && FooCount >= MaxFooCount) - throw Foo_exception(); - ++FooCount; - my_bar = initial_value_of_bar; - } - Foo( const Foo& foo ) { - state = CopyInitialized; - if(MaxFooCount && FooCount >= MaxFooCount) - throw Foo_exception(); - ++FooCount; - my_bar = foo.my_bar; - } - ~Foo() { - ASSERT( state==DefaultInitialized||state==CopyInitialized||(state==ZeroInitialized && !my_bar), NULL ); - state = Destroyed; - my_bar = ~initial_value_of_bar; - --FooCount; - } - bool operator==(const Foo &f) const { return my_bar == f.my_bar; } - bool operator<(const Foo &f) const { return my_bar < f.my_bar; } - bool is_const() const {return true;} - bool is_const() {return false;} -private: - char reserve[1]; -}; - -class FooWithAssign: public Foo { -public: - void operator=( const FooWithAssign& x ) { - ASSERT( x.state==DefaultInitialized||x.state==CopyInitialized, NULL ); - ASSERT( state==DefaultInitialized||state==CopyInitialized, NULL ); - my_bar = x.my_bar; - } -}; - -class FooIterator: public std::iterator<std::input_iterator_tag,FooWithAssign> { - int x_bar; -public: - FooIterator(int x) { - x_bar = x; - } - FooIterator &operator++() { - x_bar++; return *this; - } - FooWithAssign operator*() { - FooWithAssign foo; foo.bar() = x_bar; - return foo; - } - bool operator!=(const FooIterator &i) { return x_bar != i.x_bar; } -}; - -inline void NextSize( int& s ) { - if( s<=32 ) ++s; - else s += s/10; -} - -//! Check vector have expected size and filling -template<typename vector_t> -static void CheckVector( const vector_t& cv, size_t expected_size, size_t old_size ) { - ASSERT( cv.size()==expected_size, NULL ); - ASSERT( cv.empty()==(expected_size==0), NULL ); - for( int j=0; j<int(expected_size); ++j ) { - if( cv[j].bar()!=~j ) - std::printf("ERROR on line %d for old_size=%ld expected_size=%ld j=%d\n",__LINE__,long(old_size),long(expected_size),j); - } -} - -//! Test of assign, grow, copying with various sizes -void TestResizeAndCopy() { - typedef static_counting_allocator<std::allocator<Foo>, std::size_t> allocator_t; - typedef tbb::concurrent_vector<Foo, allocator_t> vector_t; - allocator_t::init_counters(); - for( int old_size=0; old_size<=128; NextSize( old_size ) ) { - for( int new_size=old_size; new_size<=1280; NextSize( new_size ) ) { - long count = FooCount; - vector_t v; - ASSERT( count==FooCount, NULL ); - v.assign(old_size/2, Foo() ); - ASSERT( count+old_size/2==FooCount, NULL ); - for( int j=0; j<old_size/2; ++j ) - ASSERT( v[j].state == Foo::CopyInitialized, NULL); - v.assign(FooIterator(0), FooIterator(old_size)); - v.grow_to_at_least(new_size); - ASSERT( count+new_size==FooCount, NULL ); - for( int j=0; j<new_size; ++j ) { - int expected = j<old_size ? j : Foo::initial_value_of_bar; - if( v[j].bar()!=expected ) - std::printf("ERROR on line %d for old_size=%ld new_size=%ld v[%ld].bar()=%d != %d\n",__LINE__,long(old_size),long(new_size),long(j),v[j].bar(), expected); - } - ASSERT( v.size()==size_t(new_size), NULL ); - for( int j=0; j<new_size; ++j ) { - v[j].bar() = ~j; - } - const vector_t& cv = v; - // Try copy constructor - vector_t copy_of_v(cv); - CheckVector(cv,new_size,old_size); - ASSERT( !(v != copy_of_v), NULL ); - v.clear(); - ASSERT( v.empty(), NULL ); - swap(v, copy_of_v); - ASSERT( copy_of_v.empty(), NULL ); - CheckVector(v,new_size,old_size); - } - } - ASSERT( allocator_t::items_allocated == allocator_t::items_freed, NULL); - ASSERT( allocator_t::allocations == allocator_t::frees, NULL); -} - -//! Test reserve, compact, capacity -void TestCapacity() { - typedef static_counting_allocator<tbb::cache_aligned_allocator<Foo>, std::size_t> allocator_t; - typedef tbb::concurrent_vector<Foo, allocator_t> vector_t; - allocator_t::init_counters(); - for( size_t old_size=0; old_size<=11000; old_size=(old_size<5 ? old_size+1 : 3*old_size) ) { - for( size_t new_size=0; new_size<=11000; new_size=(new_size<5 ? new_size+1 : 3*new_size) ) { - long count = FooCount; - { - vector_t v; v.reserve(old_size); - ASSERT( v.capacity()>=old_size, NULL ); - v.reserve( new_size ); - ASSERT( v.capacity()>=old_size, NULL ); - ASSERT( v.capacity()>=new_size, NULL ); - ASSERT( v.empty(), NULL ); - for( size_t i=0; i<2*new_size; ++i ) { - ASSERT( size_t(FooCount)==count+i, NULL ); - size_t j = v.grow_by(1); - ASSERT( j==i, NULL ); - v[j].bar() = int(~j); - } - vector_t copy_of_v(v); // should allocate first segment with same size as for compact() - v.compact(); // TODO: how to check if optimization was performed correctly - CheckVector(v, new_size*2, old_size); // check vector correctness - ASSERT( v==copy_of_v, NULL ); // TODO: check also segments layout equality - } - ASSERT( FooCount==count, NULL ); - } - } - ASSERT( allocator_t::items_allocated == allocator_t::items_freed, NULL); - ASSERT( allocator_t::allocations == allocator_t::frees, NULL); -} - -struct AssignElement { - typedef tbb::concurrent_vector<int>::range_type::iterator iterator; - iterator base; - void operator()( const tbb::concurrent_vector<int>::range_type& range ) const { - for( iterator i=range.begin(); i!=range.end(); ++i ) { - if( *i!=0 ) - std::printf("ERROR for v[%ld]\n", long(i-base)); - *i = int(i-base); - } - } - AssignElement( iterator base_ ) : base(base_) {} -}; - -struct CheckElement { - typedef tbb::concurrent_vector<int>::const_range_type::iterator iterator; - iterator base; - void operator()( const tbb::concurrent_vector<int>::const_range_type& range ) const { - for( iterator i=range.begin(); i!=range.end(); ++i ) - if( *i != int(i-base) ) - std::printf("ERROR for v[%ld]\n", long(i-base)); - } - CheckElement( iterator base_ ) : base(base_) {} -}; - -#include "tbb/tick_count.h" -#include "tbb/parallel_for.h" -#include "harness.h" - -//! Test parallel access by iterators -void TestParallelFor( int nthread ) { - typedef tbb::concurrent_vector<int> vector_t; - vector_t v; - v.grow_to_at_least(N); - tbb::tick_count t0 = tbb::tick_count::now(); - if( Verbose ) - std::printf("Calling parallel_for with %ld threads\n",long(nthread)); - tbb::parallel_for( v.range(10000), AssignElement(v.begin()) ); - tbb::tick_count t1 = tbb::tick_count::now(); - const vector_t& u = v; - tbb::parallel_for( u.range(10000), CheckElement(u.begin()) ); - tbb::tick_count t2 = tbb::tick_count::now(); - if( Verbose ) - std::printf("Time for parallel_for: assign time = %8.5f, check time = %8.5f\n", - (t1-t0).seconds(),(t2-t1).seconds()); - for( long i=0; size_t(i)<v.size(); ++i ) - if( v[i]!=i ) - std::printf("ERROR for v[%ld]\n", i); -} - -template<typename Iterator1, typename Iterator2> -void TestIteratorAssignment( Iterator2 j ) { - Iterator1 i(j); - ASSERT( i==j, NULL ); - ASSERT( !(i!=j), NULL ); - Iterator1 k; - k = j; - ASSERT( k==j, NULL ); - ASSERT( !(k!=j), NULL ); -} - -template<typename Range1, typename Range2> -void TestRangeAssignment( Range2 r2 ) { - Range1 r1(r2); r1 = r2; -} - -template<typename Iterator, typename T> -void TestIteratorTraits() { - AssertSameType( static_cast<typename Iterator::difference_type*>(0), static_cast<ptrdiff_t*>(0) ); - AssertSameType( static_cast<typename Iterator::value_type*>(0), static_cast<T*>(0) ); - AssertSameType( static_cast<typename Iterator::pointer*>(0), static_cast<T**>(0) ); - AssertSameType( static_cast<typename Iterator::iterator_category*>(0), static_cast<std::random_access_iterator_tag*>(0) ); - T x; - typename Iterator::reference xr = x; - typename Iterator::pointer xp = &x; - ASSERT( &xr==xp, NULL ); -} - -template<typename Vector, typename Iterator> -void CheckConstIterator( const Vector& u, int i, const Iterator& cp ) { - typename Vector::const_reference pref = *cp; - if( pref.bar()!=i ) - std::printf("ERROR for u[%ld] using const_iterator\n", long(i)); - typename Vector::difference_type delta = cp-u.begin(); - ASSERT( delta==i, NULL ); - if( u[i].bar()!=i ) - std::printf("ERROR for u[%ld] using subscripting\n", long(i)); - ASSERT( u.begin()[i].bar()==i, NULL ); -} - -template<typename Iterator1, typename Iterator2, typename V> -void CheckIteratorComparison( V& u ) { - V u2 = u; - Iterator1 i = u.begin(); - - for( int i_count=0; i_count<100; ++i_count ) { - Iterator2 j = u.begin(); - Iterator2 i2 = u2.begin(); - for( int j_count=0; j_count<100; ++j_count ) { - ASSERT( (i==j)==(i_count==j_count), NULL ); - ASSERT( (i!=j)==(i_count!=j_count), NULL ); - ASSERT( (i-j)==(i_count-j_count), NULL ); - ASSERT( (i<j)==(i_count<j_count), NULL ); - ASSERT( (i>j)==(i_count>j_count), NULL ); - ASSERT( (i<=j)==(i_count<=j_count), NULL ); - ASSERT( (i>=j)==(i_count>=j_count), NULL ); - ASSERT( !(i==i2), NULL ); - ASSERT( i!=i2, NULL ); - ++j; - ++i2; - } - ++i; - } -} - -//! Test sequential iterators for vector type V. -/** Also does timing. */ -template<typename T> -void TestSequentialFor() { - typedef tbb::concurrent_vector<Foo> V; - V v; - v.grow_by(N); - ASSERT(v.grow_by(0) == v.grow_by(0, Foo()), NULL); - - // Check iterator - tbb::tick_count t0 = tbb::tick_count::now(); - typename V::iterator p = v.begin(); - ASSERT( !(*p).is_const(), NULL ); - ASSERT( !p->is_const(), NULL ); - for( int i=0; size_t(i)<v.size(); ++i, ++p ) { - if( (*p).state!=Foo::DefaultInitialized ) - std::printf("ERROR for v[%ld]\n", long(i)); - typename V::reference pref = *p; - pref.bar() = i; - typename V::difference_type delta = p-v.begin(); - ASSERT( delta==i, NULL ); - ASSERT( -delta<=0, "difference type not signed?" ); - } - tbb::tick_count t1 = tbb::tick_count::now(); - - // Check const_iterator going forwards - const V& u = v; - typename V::const_iterator cp = u.begin(); - ASSERT( (*cp).is_const(), NULL ); - ASSERT( cp->is_const(), NULL ); - ASSERT( *cp == v.front(), NULL); - for( int i=0; size_t(i)<u.size(); ++i ) { - CheckConstIterator(u,i,cp); - V::const_iterator &cpr = ++cp; - ASSERT( &cpr == &cp, "preincrement not returning a reference?"); - } - tbb::tick_count t2 = tbb::tick_count::now(); - if( Verbose ) - std::printf("Time for serial for: assign time = %8.5f, check time = %8.5f\n", - (t1-t0).seconds(),(t2-t1).seconds()); - - // Now go backwards - cp = u.end(); - for( int i=int(u.size()); i>0; ) { - --i; - V::const_iterator &cpr = --cp; - ASSERT( &cpr == &cp, "predecrement not returning a reference?"); - if( i>0 ) { - typename V::const_iterator cp_old = cp--; - int here = (*cp_old).bar(); - ASSERT( here==u[i].bar(), NULL ); - typename V::const_iterator cp_new = cp++; - int prev = (*cp_new).bar(); - ASSERT( prev==u[i-1].bar(), NULL ); - } - CheckConstIterator(u,i,cp); - } - - // Now go forwards and backwards - ptrdiff_t j = 0; - cp = u.begin(); - for( size_t i=0; i<u.size(); ++i ) { - CheckConstIterator(u,int(j),cp); - typename V::difference_type delta = i*3 % u.size(); - if( 0<=j+delta && size_t(j+delta)<u.size() ) { - V::const_iterator &cpr = (cp += delta); - ASSERT( &cpr == &cp, "+= not returning a reference?"); - j += delta; - } - delta = i*7 % u.size(); - if( 0<=j-delta && size_t(j-delta)<u.size() ) { - if( i&1 ) { - V::const_iterator &cpr = (cp -= delta); - ASSERT( &cpr == &cp, "-= not returning a reference?"); - } else - cp = cp - delta; // Test operator- - j -= delta; - } - } - - for( int i=0; size_t(i)<u.size(); i=(i<50?i+1:i*3) ) - for( int j=-i; size_t(i+j)<u.size(); j=(j<50?j+1:j*5) ) { - ASSERT( (u.begin()+i)[j].bar()==i+j, NULL ); - ASSERT( (v.begin()+i)[j].bar()==i+j, NULL ); - ASSERT( (i+u.begin())[j].bar()==i+j, NULL ); - ASSERT( (i+v.begin())[j].bar()==i+j, NULL ); - } - - CheckIteratorComparison<typename V::iterator, typename V::iterator>(v); - CheckIteratorComparison<typename V::iterator, typename V::const_iterator>(v); - CheckIteratorComparison<typename V::const_iterator, typename V::iterator>(v); - CheckIteratorComparison<typename V::const_iterator, typename V::const_iterator>(v); - - TestIteratorAssignment<typename V::const_iterator>( u.begin() ); - TestIteratorAssignment<typename V::const_iterator>( v.begin() ); - TestIteratorAssignment<typename V::iterator>( v.begin() ); - // doesn't compile as expected: TestIteratorAssignment<typename V::iterator>( u.begin() ); - - TestRangeAssignment<typename V::const_range_type>( u.range() ); - TestRangeAssignment<typename V::const_range_type>( v.range() ); - TestRangeAssignment<typename V::range_type>( v.range() ); - // doesn't compile as expected: TestRangeAssignment<typename V::range_type>( u.range() ); - - // Check reverse_iterator - typename V::reverse_iterator rp = v.rbegin(); - for( size_t i=v.size(); i>0; --i, ++rp ) { - typename V::reference pref = *rp; - ASSERT( size_t(pref.bar())==i-1, NULL ); - ASSERT( rp!=v.rend(), NULL ); - } - ASSERT( rp==v.rend(), NULL ); - - // Check const_reverse_iterator - typename V::const_reverse_iterator crp = u.rbegin(); - ASSERT( *crp == v.back(), NULL); - for( size_t i=v.size(); i>0; --i, ++crp ) { - typename V::const_reference cpref = *crp; - ASSERT( size_t(cpref.bar())==i-1, NULL ); - ASSERT( crp!=u.rend(), NULL ); - } - ASSERT( crp==u.rend(), NULL ); - - TestIteratorAssignment<typename V::const_reverse_iterator>( u.rbegin() ); - TestIteratorAssignment<typename V::reverse_iterator>( v.rbegin() ); - - // test compliance with C++ Standard 2003, clause 23.1.1p9 - { - tbb::concurrent_vector<int> v1, v2(1, 100); - v1.assign(1, 100); ASSERT(v1 == v2, NULL); - ASSERT(v1.size() == 1 && v1[0] == 100, "used integral iterators"); - } - - // cross-allocator tests -#if !defined(_WIN64) || defined(_CPPLIB_VER) - typedef local_counting_allocator<std::allocator<int>, size_t> allocator1_t; - typedef tbb::cache_aligned_allocator<void> allocator2_t; - typedef tbb::concurrent_vector<Foo, allocator1_t> V1; - typedef tbb::concurrent_vector<Foo, allocator2_t> V2; - V1 v1( v ); // checking cross-allocator copying - V2 v2( 10 ); v2 = v1; // checking cross-allocator assignment - ASSERT( (v1 == v) && !(v2 != v), NULL); - ASSERT( !(v1 < v) && !(v2 > v), NULL); - ASSERT( (v1 <= v) && (v2 >= v), NULL); -#endif -} - -static const size_t Modulus = 7; - -typedef static_counting_allocator<tbb::cache_aligned_allocator<Foo> > MyAllocator; -typedef tbb::concurrent_vector<Foo, MyAllocator> MyVector; - -class GrowToAtLeast: NoAssign { - MyVector& my_vector; -public: - void operator()( const tbb::blocked_range<size_t>& range ) const { - for( size_t i=range.begin(); i!=range.end(); ++i ) { - size_t n = my_vector.size(); - size_t k = i % (2*n+1); - my_vector.grow_to_at_least(k+1); - ASSERT( my_vector.size()>=k+1, NULL ); - } - } - GrowToAtLeast( MyVector& vector ) : my_vector(vector) {} -}; - -void TestConcurrentGrowToAtLeast() { - MyAllocator::init_counters(); - MyVector v(2, Foo(), MyAllocator()); - for( size_t s=1; s<1000; s*=10 ) { - tbb::parallel_for( tbb::blocked_range<size_t>(0,10000*s,s), GrowToAtLeast(v) ); - } - v.clear(); - ASSERT( 0 == v.get_allocator().frees, NULL); - v.compact(); - size_t items_allocated = v.get_allocator().items_allocated, - items_freed = v.get_allocator().items_freed; - size_t allocations = v.get_allocator().allocations, - frees = v.get_allocator().frees; - ASSERT( items_allocated == items_freed, NULL); - ASSERT( allocations == frees, NULL); -} - -//! Test concurrent invocations of method concurrent_vector::grow_by -class GrowBy: NoAssign { - MyVector& my_vector; -public: - void operator()( const tbb::blocked_range<int>& range ) const { - for( int i=range.begin(); i!=range.end(); ++i ) { - if( i&1 ) { - Foo& element = my_vector[my_vector.grow_by(1)]; - element.bar() = i; - } else { - Foo f; - f.bar() = i; - size_t k; - if( i&2 ) - k = my_vector.push_back( f ); - else - k = my_vector.grow_by(1, f); - ASSERT( my_vector[k].bar()==i, NULL ); - } - } - } - GrowBy( MyVector& vector ) : my_vector(vector) {} -}; - -//! Test concurrent invocations of method concurrent_vector::grow_by -void TestConcurrentGrowBy( int nthread ) { - MyAllocator::init_counters(); - { - int m = 100000; MyAllocator a; - MyVector v( a ); - tbb::parallel_for( tbb::blocked_range<int>(0,m,1000), GrowBy(v) ); - ASSERT( v.size()==size_t(m), NULL ); - - // Verify that v is a permutation of 0..m - int inversions = 0; - bool* found = new bool[m]; - memset( found, 0, m ); - for( int i=0; i<m; ++i ) { - int index = v[i].bar(); - ASSERT( v[i].state == (index&1 ? Foo::DefaultInitialized : Foo::CopyInitialized), NULL); - ASSERT( !found[index], NULL ); - found[index] = true; - if( i>0 ) - inversions += v[i].bar()<v[i-1].bar(); - } - for( int i=0; i<m; ++i ) { - ASSERT( found[i], NULL ); - ASSERT( nthread>1 || v[i].bar()==i, "sequential execution is wrong" ); - } - delete[] found; - if( nthread>1 && inversions<m/10 ) - std::printf("Warning: not much concurrency in TestConcurrentGrowBy\n"); - } - size_t items_allocated = MyAllocator::items_allocated, - items_freed = MyAllocator::items_freed; - size_t allocations = MyAllocator::allocations, - frees = MyAllocator::frees; - ASSERT( items_allocated == items_freed, NULL); - ASSERT( allocations == frees, NULL); -} - -//! Test the assignment operator and swap -void TestAssign() { - typedef tbb::concurrent_vector<FooWithAssign, local_counting_allocator<std::allocator<FooWithAssign>, size_t > > vector_t; - local_counting_allocator<std::allocator<FooWithAssign>, size_t > init_alloc; - init_alloc.allocations = 100; - for( int dst_size=1; dst_size<=128; NextSize( dst_size ) ) { - for( int src_size=2; src_size<=128; NextSize( src_size ) ) { - vector_t u(FooIterator(0), FooIterator(src_size), init_alloc); - for( int i=0; i<src_size; ++i ) - ASSERT( u[i].bar()==i, NULL ); - vector_t v(dst_size, FooWithAssign(), init_alloc); - for( int i=0; i<dst_size; ++i ) { - ASSERT( v[i].state==Foo::CopyInitialized, NULL ); - v[i].bar() = ~i; - } - ASSERT( v != u, NULL); - v.swap(u); - CheckVector(u, dst_size, src_size); - u.swap(v); - // using assignment - v = u; - ASSERT( v == u, NULL); - u.clear(); - ASSERT( u.size()==0, NULL ); - ASSERT( v.size()==size_t(src_size), NULL ); - for( int i=0; i<src_size; ++i ) - ASSERT( v[i].bar()==i, NULL ); - ASSERT( 0 == u.get_allocator().frees, NULL); - u.compact(); // deallocate unused memory - size_t items_allocated = u.get_allocator().items_allocated, - items_freed = u.get_allocator().items_freed; - size_t allocations = u.get_allocator().allocations, - frees = u.get_allocator().frees + 100; - ASSERT( items_allocated == items_freed, NULL); - ASSERT( allocations == frees, NULL); - } - } -} - -// Test the comparison operators -#include <string> -void TestComparison() { - std::string str[3]; str[0] = "abc"; - str[1].assign("cba"); - str[2].assign("abc"); // same as 0th - tbb::concurrent_vector<char> var[3]; - var[0].assign(str[0].begin(), str[0].end()); - var[1].assign(str[0].rbegin(), str[0].rend()); - var[2].assign(var[1].rbegin(), var[1].rend()); // same as 0th - for (int i = 0; i < 3; ++i) { - for (int j = 0; j < 3; ++j) { - ASSERT( (var[i] == var[j]) == (str[i] == str[j]), NULL ); - ASSERT( (var[i] != var[j]) == (str[i] != str[j]), NULL ); - ASSERT( (var[i] < var[j]) == (str[i] < str[j]), NULL ); - ASSERT( (var[i] > var[j]) == (str[i] > str[j]), NULL ); - ASSERT( (var[i] <= var[j]) == (str[i] <= str[j]), NULL ); - ASSERT( (var[i] >= var[j]) == (str[i] >= str[j]), NULL ); - } - } -} - -//------------------------------------------------------------------------ -// Regression test for problem where on oversubscription caused -// concurrent_vector::grow_by to run very slowly (TR#196). -//------------------------------------------------------------------------ - -#include "tbb/task_scheduler_init.h" -#include <math.h> - -typedef unsigned long Number; - -static tbb::concurrent_vector<Number> Primes; - -class FindPrimes { - bool is_prime( Number val ) const { - int limit, factor = 3; - if( val<5u ) - return val==2; - else { - limit = long(sqrtf(float(val))+0.5f); - while( factor<=limit && val % factor ) - ++factor; - return factor>limit; - } - } -public: - void operator()( const tbb::blocked_range<Number>& r ) const { - for( Number i=r.begin(); i!=r.end(); ++i ) { - if( i%2 && is_prime(i) ) { - Primes[Primes.grow_by(1)] = i; - } - } - } -}; - -static double TimeFindPrimes( int nthread ) { - Primes.clear(); // clear behavior has been changed since 2.0 - tbb::task_scheduler_init init(nthread); - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for( tbb::blocked_range<Number>(0,1000000,500), FindPrimes() ); - tbb::tick_count t1 = tbb::tick_count::now(); - return (t1-t0).seconds(); -} - -static void TestFindPrimes() { - // Time fully subscribed run. - double t2 = TimeFindPrimes( tbb::task_scheduler_init::automatic ); - - // Time parallel run that is very likely oversubscribed. - double t128 = TimeFindPrimes(128); - - if( Verbose ) - std::printf("TestFindPrimes: t2==%g t128=%g k=%g\n", t2, t128, t128/t2); - - // We allow the 128-thread run a little extra time to allow for thread overhead. - // Theoretically, following test will fail on machine with >128 processors. - // But that situation is not going to come up in the near future, - // and the generalization to fix the issue is not worth the trouble. - // - // [05.09.2007] Anton M has modified coefficient below from value 1.1 to 1.3 due to - // changes have been made in clear() behavior since 2.0 [U1] version. - // Originally, clear() kept segments allocated before which led to inaccurate measurment of t128. - if( t128 > 1.3*t2 ) { - std::printf("Warning: grow_by is pathetically slow: t2==%g t128=%g k=%g\n", t2, t128, t128/t2); - } -} - -//------------------------------------------------------------------------ -// Test compatibility with STL sort. -//------------------------------------------------------------------------ - -#include <algorithm> - -void TestSort() { - for( int n=0; n<100; n=n*3+1 ) { - tbb::concurrent_vector<int> array(n); - for( int i=0; i<n; ++i ) - array.at(i) = (i*7)%n; - std::sort( array.begin(), array.end() ); - for( int i=0; i<n; ++i ) - ASSERT( array[i]==i, NULL ); - } -} - -//------------------------------------------------------------------------ -// Test exceptions safety (from allocator and items constructors) -//------------------------------------------------------------------------ -template<typename MyVector> -class GrowthException: NoAssign { - MyVector& my_vector; -public: - static volatile bool my_cancel; - void operator()( const tbb::blocked_range<int>& range ) const { - if(!my_cancel) for( int i=range.begin(); i!=range.end(); ++i ) { - try { - if( i&1 ) { - Foo& element = my_vector[my_vector.grow_by(1)]; - element.bar() = i; - } else { - Foo f; - f.bar() = i; - size_t k; - if( i&2 ) - k = my_vector.push_back( f ); - else - k = my_vector.grow_by(1, f); - ASSERT( my_vector[k].bar()==i, NULL ); - } - } catch(...) { - my_cancel = true; - } - } - } - GrowthException( MyVector& vector ) : my_vector(vector) { my_cancel = false; } -}; - -template<typename MyVector> -volatile bool GrowthException<MyVector>::my_cancel = false; - -void TestExceptions() { - typedef static_counting_allocator<std::allocator<Foo>, std::size_t> allocator_t; - typedef tbb::concurrent_vector<Foo, allocator_t> vector_t; - - enum methods { - zero_method = 0, - ctor_copy, ctor_size, assign_nt, assign_ir, op_equ, reserve, compact, grow, - all_methods - }; - try { - vector_t src(FooIterator(0), FooIterator(N)); // original data - - for(int t = 0; t < 2; ++t) // exception type - for(int m = zero_method+1; m < all_methods; ++m) - { - allocator_t::init_counters(); - if(t) MaxFooCount = FooCount + N/2; - else allocator_t::set_limits(N/2); - vector_t victim; - try { - switch(m) { - case ctor_copy: { - vector_t acopy(src); - } break; // auto destruction after exception is checked by ~Foo - case ctor_size: { - vector_t sized(N); - } break; // auto destruction after exception is checked by ~Foo - // Do not test assignment constructor due to reusing of same methods as below - case assign_nt: { - victim.assign(N, Foo()); - } break; - case assign_ir: { - victim.assign(FooIterator(0), FooIterator(N)); - } break; - case op_equ: { - victim.reserve(2); victim = src; // fragmented assignment - } break; - case reserve: { - try { - victim.reserve(victim.max_size()+1); - } catch(std::length_error &) { - } catch(...) { - KNOWN_ISSUE("ERROR: unrecognized exception - known compiler issue\n"); - } - victim.reserve(N); - } break; - case compact: { - if(t) MaxFooCount = 0; else allocator_t::set_limits(); // reset limits - victim.reserve(2); victim = src; // fragmented assignment - if(t) MaxFooCount = 1; else allocator_t::set_limits(1, false); // block any allocation, check NULL return from allocator - victim.compact(); // should start defragmenting first segment - } break; - case grow: { - tbb::task_scheduler_init init; - tbb::parallel_for( tbb::blocked_range<int>(0, N, 5), GrowthException<vector_t>(victim) ); - if(GrowthException<vector_t>::my_cancel) throw tbb::bad_last_alloc(); // parallel algorithms don't support exception passing yet - } break; - default:; - } - if(!t || m != reserve) ASSERT(false, "should throw an exception"); - } catch(std::bad_alloc &e) { - allocator_t::set_limits(); MaxFooCount = 0; - size_t capacity = victim.capacity(); - size_t size = victim.size(); - switch(m) { - case reserve: - if(t) ASSERT(false, NULL); - case assign_nt: - case assign_ir: - if(!t) { - ASSERT(capacity < N/2, "unexpected capacity"); - ASSERT(size == 0, "unexpected size"); - break; - } else { - ASSERT(size == N, "unexpected size"); - ASSERT(capacity >= N, "unexpected capacity"); - int i; - for(i = 1; ; ++i) - if(!victim[i].zero_bar()) break; - else ASSERT(victim[i].bar() == (m == assign_ir)? i : Foo::initial_value_of_bar, NULL); - for(; size_t(i) < size; ++i) ASSERT(!victim[i].zero_bar(), NULL); - ASSERT(size_t(i) == size, NULL); - break; - } - case grow: - case op_equ: - if(!t) ASSERT(capacity > 0 && capacity < N, "unexpected capacity"); - {// not related to if(!t) - vector_t copy_of_victim(victim); - ASSERT(copy_of_victim.size() > 0, NULL); - for(int i = 0; ; ++i) { - try { - Foo &foo = victim.at(i); - int bar = t? foo.zero_bar() : foo.bar(); - if(m != grow) ASSERT( bar == i || (t && bar == 0), NULL); - if(size_t(i) < copy_of_victim.size()) ASSERT( copy_of_victim[i].bar() == bar, NULL); - } catch(std::range_error &) { // skip broken segment - ASSERT( size_t(i) < size, NULL ); if(m == op_equ) break; - } catch(std::out_of_range &){ - ASSERT( i > 0, NULL ); break; - } catch(...) { - KNOWN_ISSUE("ERROR: unrecognized exception - known compiler issue\n"); break; - } - } - vector_t copy_of_victim2(10); copy_of_victim2 = victim; - ASSERT(copy_of_victim == copy_of_victim2, "assignment doesn't match copying"); - try { - victim = copy_of_victim; - } catch(tbb::bad_last_alloc &) { break; - } catch(...) { - KNOWN_ISSUE("ERROR: unrecognized exception - known compiler issue\n"); break; - } - ASSERT(t, NULL); - } break; - case compact: - ASSERT(capacity > 0, "unexpected capacity"); - ASSERT(victim == src, "compact() is broken"); - break; - - default:; // nothing to check here - } - if( Verbose ) std::printf("Exception %d: %s\t- ok ()\n", m, e.what()); - } - } - } catch(...) { - ASSERT(false, "unexpected exception"); - } -} - -//------------------------------------------------------------------------ - -//! Test driver -int main( int argc, char* argv[] ) { - // Test requires at least one thread. - MinThread = 1; - ParseCommandLine( argc, argv ); - if( MinThread<1 ) { - std::printf("ERROR: MinThread=%d, but must be at least 1\n",MinThread); MinThread = 1; - } - - TestIteratorTraits<tbb::concurrent_vector<Foo>::iterator,Foo>(); - TestIteratorTraits<tbb::concurrent_vector<Foo>::const_iterator,const Foo>(); - TestSequentialFor<Foo> (); - TestResizeAndCopy(); - TestAssign(); - TestCapacity(); - for( int nthread=MinThread; nthread<=MaxThread; ++nthread ) { - tbb::task_scheduler_init init( nthread ); - TestParallelFor( nthread ); - TestConcurrentGrowToAtLeast(); - TestConcurrentGrowBy( nthread ); - } - TestComparison(); -#if !__TBB_FLOATING_POINT_BROKEN - TestFindPrimes(); -#endif - TestSort(); -#if __TBB_EXCEPTION_HANDLING_BROKEN - printf("Warning: Exception safety test is skipped due to a known issue.\n"); -#else - TestExceptions(); -#endif - - if( Verbose ) - std::printf("sizeof(concurrent_vector<int>) == %d\n", (int)sizeof(tbb::concurrent_vector<int>)); - std::printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_algorithms.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_algorithms.cpp deleted file mode 100644 index b6a2c88590..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_algorithms.cpp +++ /dev/null @@ -1,1777 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/task_scheduler_init.h" -#include "tbb/tbb_exception.h" -#include "tbb/task.h" -#include "tbb/atomic.h" -#include "tbb/parallel_for.h" -#include "tbb/parallel_reduce.h" -#include "tbb/parallel_do.h" -#include "tbb/pipeline.h" -#include "tbb/blocked_range.h" - -#include <typeinfo> - -#include "harness.h" -#include "harness_trace.h" -#include "harness_sleep.h" - - -#if __TBB_EXCEPTIONS - -//------------------------------------------------------------------------ -// Utility definitions -//------------------------------------------------------------------------ - -#define ITER_RANGE 100000 -#define ITER_GRAIN 1000 -#define NESTING_RANGE 100 -#define NESTING_GRAIN 10 -#define NESTED_RANGE (ITER_RANGE / NESTING_RANGE) -#define NESTED_GRAIN (ITER_GRAIN / NESTING_GRAIN) -#define EXCEPTION_DESCR "Test exception" - -namespace internal = tbb::internal; -using internal::intptr; - -namespace util { - -#if _WIN32 || _WIN64 - - typedef DWORD tid_t; - - tid_t get_my_tid () { return GetCurrentThreadId(); } - -#else /* !WIN */ - - typedef pthread_t tid_t; - - tid_t get_my_tid () { return pthread_self(); } - -#endif /* !WIN */ - -inline intptr num_subranges ( intptr length, intptr grain ) { - intptr n = 1; - for( ; length>grain; length-=length>>1 ) - n*=2; - return n; -} - -} // namespace util - -int g_max_concurrency = 0; -int g_num_threads = 0; - -class test_exception : public std::exception -{ - const char* my_description; -public: - test_exception ( const char* description ) : my_description(description) {} - - const char* what() const throw() { return my_description; } -}; - -class solitary_test_exception : public test_exception -{ -public: - solitary_test_exception ( const char* description ) : test_exception(description) {} -}; - - -tbb::atomic<intptr> g_cur_executed, // number of times a body was requested to process data - g_exc_executed, // snapshot of execution statistics at the moment of the 1st exception throwing - g_catch_executed, // snapshot of execution statistics at the moment when the 1st exception is caught - g_exceptions, // number of exceptions exposed to TBB users (i.e. intercepted by the test code) - g_added_tasks_count; // number of tasks added by parallel_do feeder - -util::tid_t g_master = 0; - -volatile intptr g_exception_thrown = 0; -volatile bool g_throw_exception = true; -volatile bool g_no_exception = true; -volatile bool g_unknown_exception = false; -volatile bool g_task_was_cancelled = false; - -bool g_exception_in_master = false; -bool g_solitary_exception = true; -volatile bool g_wait_completed = false; - -void reset_globals () { - g_cur_executed = g_exc_executed = g_catch_executed = 0; - g_exceptions = 0; - g_exception_thrown = 0; - g_throw_exception = true; - g_no_exception = true; - g_unknown_exception = false; - g_task_was_cancelled = false; - g_wait_completed = false; - g_added_tasks_count = 0; -} - -void throw_test_exception ( intptr throw_threshold ) { - if ( !g_throw_exception || g_exception_in_master ^ (util::get_my_tid() == g_master) ) - return; - if ( !g_solitary_exception ) { - __TBB_CompareAndSwapW(&g_exc_executed, g_cur_executed, 0); - REMARK ("About to throw one of multiple test_exceptions (thread %08x):", util::get_my_tid()); - g_exception_thrown = 1; - throw (test_exception(EXCEPTION_DESCR)); - } - while ( g_cur_executed < throw_threshold ) - __TBB_Yield(); - if ( __TBB_CompareAndSwapW(&g_exception_thrown, 1, 0) == 0 ) { - g_exc_executed = g_cur_executed; - REMARK ("About to throw solitary test_exception... :"); - throw (solitary_test_exception(EXCEPTION_DESCR)); - } -} - -#define TRY() \ - bool no_exception = true, unknown_exception = false; \ - try { - -#define CATCH() \ - } catch ( tbb::captured_exception& e ) { \ - g_catch_executed = g_cur_executed; \ - ASSERT (strcmp(e.name(), (g_solitary_exception ? typeid(solitary_test_exception) : typeid(test_exception)).name() ) == 0, "Unexpected original exception name"); \ - ASSERT (strcmp(e.what(), EXCEPTION_DESCR) == 0, "Unexpected original exception info"); \ - REMARK ("Executed at throw moment %d; upon catch %d", (intptr)g_exc_executed, (intptr)g_catch_executed); \ - g_no_exception = no_exception = false; \ - ++g_exceptions; \ - } \ - catch ( ... ) { \ - g_no_exception = false; \ - g_unknown_exception = unknown_exception = true; \ - } - -#define ASSERT_EXCEPTION() \ - ASSERT (g_exception_thrown ? !g_no_exception : g_no_exception, "throw without catch or catch without throw"); \ - ASSERT (!g_no_exception, "no exception occurred"); \ - ASSERT (!g_unknown_exception, "unknown exception was caught"); - -#define CATCH_AND_ASSERT() \ - CATCH() \ - ASSERT_EXCEPTION() - -#define ASSERT_TEST_POSTCOND() - - -//------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------ - -typedef size_t count_type; -typedef tbb::blocked_range<count_type> range_type; - - -template<class Body> -intptr test_num_subranges_calculation ( intptr length, intptr grain, intptr nested_length, intptr nested_grain ) { - reset_globals(); - g_throw_exception = false; - intptr nesting_body_calls = util::num_subranges(length, grain), - nested_body_calls = util::num_subranges(nested_length, nested_grain), - calls_in_normal_case = nesting_body_calls * (nested_body_calls + 1); - tbb::parallel_for( range_type(0, length, grain), Body() ); - ASSERT (g_cur_executed == calls_in_normal_case, "Wrong estimation of bodies invocation count"); - return calls_in_normal_case; -} - -class no_throw_pfor_body { -public: - void operator()( const range_type& r ) const { - volatile long x; - count_type end = r.end(); - for( count_type i=r.begin(); i<end; ++i ) - x = 0; - } -}; - -void Test0 () { - REMARK (__FUNCTION__); - reset_globals(); - tbb::simple_partitioner p; - for( size_t i=0; i<10; ++i ) { - tbb::parallel_for( range_type(0, 0, 1), no_throw_pfor_body() ); - tbb::parallel_for( range_type(0, 0, 1), no_throw_pfor_body(), p ); - tbb::parallel_for( range_type(0, 128, 8), no_throw_pfor_body() ); - tbb::parallel_for( range_type(0, 128, 8), no_throw_pfor_body(), p ); - } -} // void Test0 () - -//! Template that creates a functor suitable for parallel_reduce from a functor for parallel_for. -template<typename ForBody> -class ReduceBody: NoAssign { - ForBody my_body; -public: - void operator()( const range_type& r ) const {my_body(r);} - ReduceBody( count_type c ) : my_body(c) {} - ReduceBody( ReduceBody& left, tbb::split ) : my_body(left.my_body) {} - void join( ReduceBody& /*right*/ ) {} -}; - -//! Test parallel_for and parallel_reduce for a given partitioner. -/** The Body need only be suitable for a parallel_for. */ -template<typename Body, typename Partitioner> -void TestParallelLoopAux( Partitioner& partitioner ) { - for( int i=0; i<2; ++i ) { - REMARK (__FUNCTION__); - reset_globals(); - TRY(); - if( i==0 ) - tbb::parallel_for( range_type(0, ITER_RANGE, ITER_GRAIN), Body(ITER_RANGE/3), partitioner ); - else { - ReduceBody<Body> rb(ITER_RANGE/3); - tbb::parallel_reduce( range_type(0, ITER_RANGE, ITER_GRAIN), rb, partitioner ); - } - CATCH_AND_ASSERT(); - ASSERT (!no_exception, "No exception thrown from the nesting parallel_for"); - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - REMARK ("Executed at the end of test %d; number of exceptions", (intptr)g_cur_executed); - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - } -} - -//! Test with parallel_for and parallel_reduce, over all three kinds of partitioners. -/** The Body need only be suitable for a parallel_for. */ -template<typename Body> -void TestParallelLoop() { - // The simple and auto partitioners should be const, but not the affinity partitioner. - const tbb::simple_partitioner p0; - TestParallelLoopAux<Body>( p0 ); - const tbb::auto_partitioner p1; - TestParallelLoopAux<Body>( p1 ); - tbb::affinity_partitioner p2; - TestParallelLoopAux<Body>( p2 ); -} - -class simple_pfor_body: NoAssign { - const count_type my_throw_limit; -public: - simple_pfor_body( count_type throw_limit=0 ) : my_throw_limit(throw_limit) {} - void operator()( const range_type& r ) const { - volatile long x; - count_type end = r.end(); - for( count_type i=r.begin(); i!=end; ++i ) - x = 0; - ++g_cur_executed; - if ( g_exception_in_master ^ (util::get_my_tid() == g_master) ) - { - // Make absolutely sure that worker threads on multicore machines had a chance to steal something - Harness::Sleep(10); - } - if( my_throw_limit<r.end() ) - throw_test_exception(1); - } -}; - -void Test1() { - TestParallelLoop<simple_pfor_body>(); -} // void Test1 () - -class nesting_pfor_body: NoAssign { - const count_type my_throw_limit; -public: - nesting_pfor_body( count_type throw_limit=0 ) : my_throw_limit(throw_limit) {} - void operator()( const range_type& ) const { - ++g_cur_executed; - if ( util::get_my_tid() == g_master ) - __TBB_Yield(); - tbb::parallel_for( tbb::blocked_range<size_t>(0, NESTED_RANGE, NESTED_GRAIN), simple_pfor_body() ); - } -}; - -//! Uses parallel_for body containing a nested parallel_for with the default context not wrapped by a try-block. -/** Nested algorithms are spawned inside the new bound context by default. Since - exceptions thrown from the nested parallel_for are not handled by the caller - (nesting parallel_for body) in this test, they will cancel all the sibling nested - algorithms. **/ -void Test2 () { - TestParallelLoop<nesting_pfor_body>(); -} // void Test2 () - -class nesting_pfor_with_isolated_context_body { -public: - void operator()( const range_type& ) const { - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - // Give other threads a chance to steal their first tasks - __TBB_Yield(); - tbb::parallel_for( tbb::blocked_range<size_t>(0, NESTED_RANGE, NESTED_GRAIN), simple_pfor_body(), tbb::simple_partitioner(), ctx ); - } -}; - -//! Uses parallel_for body invoking a nested parallel_for with an isolated context without a try-block. -/** Even though exceptions thrown from the nested parallel_for are not handled - by the caller in this test, they will not affect sibling nested algorithms - already running because of the isolated contexts. However because the first - exception cancels the root parallel_for only the first g_num_threads subranges - will be processed (which launch nested parallel_fors) **/ -void Test3 () { - REMARK (__FUNCTION__); - reset_globals(); - typedef nesting_pfor_with_isolated_context_body body_type; - intptr nested_body_calls = util::num_subranges(NESTED_RANGE, NESTED_GRAIN), - min_num_calls = (g_num_threads - 1) * nested_body_calls; - TRY(); - tbb::parallel_for( range_type(0, NESTING_RANGE, NESTING_GRAIN), body_type() ); - CATCH_AND_ASSERT(); - ASSERT (!no_exception, "No exception thrown from the nesting parallel_for"); - REMARK ("Executed at the end of test %d", (intptr)g_cur_executed); - if ( g_solitary_exception ) { - ASSERT (g_cur_executed > min_num_calls, "Too few tasks survived exception"); - ASSERT (g_cur_executed <= min_num_calls + (g_catch_executed + g_num_threads), "Too many tasks survived exception"); - } - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); -} // void Test3 () - - -class nesting_pfor_with_eh_body { -public: - void operator()( const range_type& ) const { - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - TRY(); - tbb::parallel_for( tbb::blocked_range<size_t>(0, NESTED_RANGE, NESTED_GRAIN), simple_pfor_body(), tbb::simple_partitioner(), ctx ); - CATCH(); - } -}; - -//! Uses parallel_for body invoking a nested parallel_for (with default bound context) inside a try-block. -/** Since exception(s) thrown from the nested parallel_for are handled by the caller - in this test, they do not affect neither other tasks of the the root parallel_for - nor sibling nested algorithms. **/ -void Test4 () { - REMARK (__FUNCTION__); - reset_globals(); - intptr nested_body_calls = util::num_subranges(NESTED_RANGE, NESTED_GRAIN), - nesting_body_calls = util::num_subranges(NESTING_RANGE, NESTING_GRAIN), - calls_in_normal_case = nesting_body_calls * (nested_body_calls + 1); - TRY(); - tbb::parallel_for( range_type(0, NESTING_RANGE, NESTING_GRAIN), nesting_pfor_with_eh_body() ); - CATCH(); - ASSERT (no_exception, "All exceptions must have been handled in the parallel_for body"); - REMARK ("Executed %d (normal case %d), exceptions %d, in master only? %d", (intptr)g_cur_executed, calls_in_normal_case, (intptr)g_exceptions, g_exception_in_master); - intptr min_num_calls = 0; - if ( g_solitary_exception ) { - min_num_calls = calls_in_normal_case - nested_body_calls; - ASSERT (g_exceptions == 1, "No exception registered"); - ASSERT (g_cur_executed <= min_num_calls + g_num_threads, "Too many tasks survived exception"); - } - else if ( !g_exception_in_master ) { - // Each nesting body + at least 1 of its nested body invocations - min_num_calls = 2 * nesting_body_calls; - ASSERT (g_exceptions > 1 && g_exceptions <= nesting_body_calls, "Unexpected actual number of exceptions"); - ASSERT (g_cur_executed >= min_num_calls + (nesting_body_calls - g_exceptions) * nested_body_calls, "Too few tasks survived exception"); - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived multiple exceptions"); - // Additional nested_body_calls accounts for the minimal amount of tasks spawned - // by not throwing threads. In the minimal case it is either the master thread or the only worker. - ASSERT (g_cur_executed <= min_num_calls + (nesting_body_calls - g_exceptions + 1) * nested_body_calls + g_exceptions + g_num_threads, "Too many tasks survived exception"); - } -} // void Test4 () - - -class my_cancellator_task : public tbb::task -{ - tbb::task_group_context &my_ctx_to_cancel; - intptr my_cancel_threshold; - - tbb::task* execute () { - s_cancellator_ready = true; - while ( g_cur_executed < my_cancel_threshold ) - __TBB_Yield(); - my_ctx_to_cancel.cancel_group_execution(); - g_catch_executed = g_cur_executed; - return NULL; - } -public: - my_cancellator_task ( tbb::task_group_context& ctx, intptr threshold ) - : my_ctx_to_cancel(ctx), my_cancel_threshold(threshold) - {} - - static volatile bool s_cancellator_ready; -}; - -volatile bool my_cancellator_task::s_cancellator_ready = false; - -class pfor_body_to_cancel { -public: - void operator()( const range_type& ) const { - ++g_cur_executed; - do { - __TBB_Yield(); - } while( !my_cancellator_task::s_cancellator_ready ); - } -}; - -template<class B> -class my_worker_task : public tbb::task -{ - tbb::task_group_context &my_ctx; - - tbb::task* execute () { - tbb::parallel_for( range_type(0, ITER_RANGE, ITER_GRAIN), B(), tbb::simple_partitioner(), my_ctx ); - return NULL; - } -public: - my_worker_task ( tbb::task_group_context& ctx ) : my_ctx(ctx) {} -}; - - -//! Test for cancelling an algorithm from outside (from a task running in parallel with the algorithm). -void Test5 () { - REMARK (__FUNCTION__); - reset_globals(); - g_throw_exception = false; - intptr threshold = util::num_subranges(ITER_RANGE, ITER_GRAIN) / 4; - tbb::task_group_context ctx; - ctx.reset(); - my_cancellator_task::s_cancellator_ready = false; - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - r.set_ref_count(3); - r.spawn( *new( r.allocate_child() ) my_cancellator_task(ctx, threshold) ); - __TBB_Yield(); - r.spawn( *new( r.allocate_child() ) my_worker_task<pfor_body_to_cancel>(ctx) ); - TRY(); - r.wait_for_all(); - CATCH(); - r.destroy(r); - ASSERT (no_exception, "Cancelling tasks should not cause any exceptions"); - //ASSERT_WARNING (g_catch_executed < threshold + 2 * g_num_threads, "Too many tasks were executed between reaching threshold and signaling cancellation"); - ASSERT (g_cur_executed < g_catch_executed + g_num_threads, "Too many tasks were executed after cancellation"); -} // void Test5 () - -class my_cancellator_2_task : public tbb::task -{ - tbb::task_group_context &my_ctx_to_cancel; - - tbb::task* execute () { - Harness::Sleep(20); // allow the first workers to start - my_ctx_to_cancel.cancel_group_execution(); - g_catch_executed = g_cur_executed; - return NULL; - } -public: - my_cancellator_2_task ( tbb::task_group_context& ctx ) : my_ctx_to_cancel(ctx) {} -}; - -class pfor_body_to_cancel_2 { -public: - void operator()( const range_type& ) const { - ++g_cur_executed; - // The test will hang (and be timed out by the test system) if is_cancelled() is broken - while( !tbb::task::self().is_cancelled() ) __TBB_Yield(); - } -}; - -//! Test for cancelling an algorithm from outside (from a task running in parallel with the algorithm). -/** This version also tests task::is_cancelled() method. **/ -void Test6 () { - REMARK (__FUNCTION__); - reset_globals(); - tbb::task_group_context ctx; - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - r.set_ref_count(3); - r.spawn( *new( r.allocate_child() ) my_cancellator_2_task(ctx) ); - __TBB_Yield(); - r.spawn( *new( r.allocate_child() ) my_worker_task<pfor_body_to_cancel_2>(ctx) ); - TRY(); - r.wait_for_all(); - CATCH(); - r.destroy(r); - ASSERT (no_exception, "Cancelling tasks should not cause any exceptions"); - ASSERT_WARNING (g_catch_executed < g_num_threads, "Somehow worker tasks started their execution before the cancellator task"); - ASSERT (g_cur_executed <= g_catch_executed, "Some tasks were executed after cancellation"); -} // void Test6 () - -//////////////////////////////////////////////////////////////////////////////// -// Regression test based on the contribution by the author of the following forum post: -// http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30254959.aspx - -#define LOOP_COUNT 16 -#define MAX_NESTING 3 -#define REDUCE_RANGE 1024 -#define REDUCE_GRAIN 256 - -class my_worker_t { -public: - void doit (int & result, int nest); -}; - -class reduce_test_body_t { - my_worker_t * my_shared_worker; - int my_nesting_level; - int my_result; -public: - reduce_test_body_t ( reduce_test_body_t& src, tbb::split ) - : my_shared_worker(src.my_shared_worker) - , my_nesting_level(src.my_nesting_level) - , my_result(0) - {} - reduce_test_body_t ( my_worker_t *w, int nesting ) - : my_shared_worker(w) - , my_nesting_level(nesting) - , my_result(0) - {} - - void operator() ( const tbb::blocked_range<size_t>& r ) { - for (size_t i = r.begin (); i != r.end (); ++i) { - int result = 0; - my_shared_worker->doit (result, my_nesting_level); - my_result += result; - } - } - void join (const reduce_test_body_t & x) { - my_result += x.my_result; - } - int result () { return my_result; } -}; - -void my_worker_t::doit ( int& result, int nest ) { - ++nest; - if ( nest < MAX_NESTING ) { - reduce_test_body_t rt (this, nest); - tbb::parallel_reduce (tbb::blocked_range<size_t>(0, REDUCE_RANGE, REDUCE_GRAIN), rt); - result = rt.result (); - } - else - ++result; -} - -//! Regression test for hanging that occurred with the first version of cancellation propagation -void Test7 () { - REMARK (__FUNCTION__); - my_worker_t w; - int result = 0; - w.doit (result, 0); - ASSERT ( result == 1048576, "Wrong calculation result"); -} - -void RunTests () { - tbb::task_scheduler_init init (g_num_threads); - g_master = util::get_my_tid(); - - Test0(); -#if !__TBB_EXCEPTION_HANDLING_BROKEN - Test1(); - Test3(); - Test4(); -#endif - Test5(); - Test6(); - Test7(); -} - -// Parallel_do testing - -#define ITER_TEST_NUMBER_OF_ELEMENTS 1000 - -// Forward iterator type -template <class T> -class ForwardIterator { - size_t * my_ptr; -public: - typedef std::forward_iterator_tag iterator_category; - typedef T value_type; - typedef typename std::allocator<T>::difference_type difference_type; - typedef typename std::allocator<T>::pointer pointer; - typedef typename std::allocator<T>::reference reference; - - ForwardIterator ( size_t * ptr ) : my_ptr(ptr){} - - ForwardIterator ( const ForwardIterator& r ) : my_ptr(r.my_ptr){} - - size_t& operator* () { return *my_ptr; } - - ForwardIterator& operator++ () { ++my_ptr; return *this; } - - bool operator== ( const ForwardIterator& r ) { return my_ptr == r.my_ptr; } -}; - - -template <class T> -class RandomIterator { - size_t * my_ptr; -public: - typedef std::random_access_iterator_tag iterator_category; - typedef T value_type; - typedef typename std::allocator<T>::difference_type difference_type; - typedef typename std::allocator<T>::pointer pointer; - typedef typename std::allocator<T>::reference reference; - - RandomIterator ( size_t * ptr ) : my_ptr(ptr){} - - RandomIterator ( const RandomIterator& r ) : my_ptr(r.my_ptr){} - - size_t& operator* () { return *my_ptr; } - - RandomIterator& operator++ () { ++my_ptr; return *this; } - - bool operator== ( const RandomIterator& r ) { return my_ptr == r.my_ptr; } - size_t operator- (const RandomIterator &r) {return my_ptr - r.my_ptr;} - RandomIterator operator+ (size_t n) {return RandomIterator(my_ptr + n);} -}; - -// Simple functor object, no exception throwing -class nothrow_pdo_body -{ -public: - //! This form of the function call operator can be used when the body needs to add more work during the processing - void operator() ( size_t &value ) const { - value = value + 1000; - } -}; // class nothrow_pdo_body - -// Simple functor object with feeder, no exception throwing -class nothrow_pdo_body_with_feeder -{ -public: - //! This form of the function call operator can be used when the body needs to add more work during the processing - void operator() ( size_t &value, tbb::parallel_do_feeder<size_t>& feeder ) const { - value = value + 1000; - - if (g_added_tasks_count < 500 ) - { - g_added_tasks_count ++; - feeder.add(0); - } - } -}; // class nothrow_pdo_body_with_feeder - -// Test parallel_do without exceptions throwing -template <class Iterator> void Test0_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - size_t values[ITER_TEST_NUMBER_OF_ELEMENTS]; - - for (int i =0; i < ITER_TEST_NUMBER_OF_ELEMENTS; i++) values[i] = i; - - Iterator begin(&values[0]); - Iterator end(&values[ITER_TEST_NUMBER_OF_ELEMENTS - 1]); - tbb::parallel_do<Iterator, nothrow_pdo_body>(begin, end, nothrow_pdo_body()); - g_added_tasks_count = 0; - tbb::parallel_do<Iterator, nothrow_pdo_body_with_feeder>(begin, end, nothrow_pdo_body_with_feeder()); -} // void Test0_parallel_do_forward () - -// Simple functor object with exception -class simple_pdo_body -{ -public: - //! This form of the function call operator can be used when the body needs to add more work during the processing - void operator() ( size_t &value ) const { - value = value + 1000; - - ++g_cur_executed; - if ( g_exception_in_master ^ (util::get_my_tid() == g_master) ) - { - // Make absolutely sure that worker threads on multicore machines had a chance to steal something - Harness::Sleep(10); - } - throw_test_exception(1); - } -}; // class simple_pdo_body - -// Simple functor object with exception and feeder -class simple_pdo_body_feeder -{ -public: - //! This form of the function call operator can be used when the body needs to add more work during the processing - void operator() ( size_t &value, tbb::parallel_do_feeder<size_t> &feeder ) const { - value = value + 1000; - if (g_added_tasks_count < 500) { - g_added_tasks_count++; - feeder.add(0); - } - - ++g_cur_executed; - if ( g_exception_in_master ^ (util::get_my_tid() == g_master) ) - { - // Make absolutely sure that worker threads on multicore machines had a chance to steal something - Harness::Sleep(10); - } - throw_test_exception(1); - } -}; // class simple_pdo_body_feeder - -// Tests exceptions without nesting -template <class Iterator, class simple_body> void Test1_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - - size_t test_vector[ITER_TEST_NUMBER_OF_ELEMENTS + 1]; - - for (int i =0; i < ITER_TEST_NUMBER_OF_ELEMENTS; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[ITER_TEST_NUMBER_OF_ELEMENTS]); - - g_added_tasks_count = 0; - - TRY(); - tbb::parallel_do<Iterator, simple_body>(begin, end, simple_body() ); - CATCH_AND_ASSERT(); - - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - REMARK ("Executed at the end of test %d; number of exceptions", (intptr)g_cur_executed); - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - -} // void Test1_parallel_do () - - -template <class Iterator> class nesting_pdo_body { -public: - void operator()( size_t& /*value*/ ) const { - ++g_cur_executed; - if ( util::get_my_tid() == g_master ) - __TBB_Yield(); - - size_t test_vector[101]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - tbb::parallel_do<Iterator, simple_pdo_body>(begin, end, simple_pdo_body()); - } -}; - -template <class Iterator> class nesting_pdo_body_feeder { -public: - void operator()( size_t& /*value*/, tbb::parallel_do_feeder<size_t>& feeder ) const { - ++g_cur_executed; - - if (g_added_tasks_count < 500) { - g_added_tasks_count++; - feeder.add(0); - } - - if ( util::get_my_tid() == g_master ) - __TBB_Yield(); - - size_t test_vector[101]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - tbb::parallel_do<Iterator, simple_pdo_body>(begin, end, simple_pdo_body()); - } -}; - -//! Uses parallel_do body containing a nested parallel_do with the default context not wrapped by a try-block. -/** Nested algorithms are spawned inside the new bound context by default. Since - exceptions thrown from the nested parallel_do are not handled by the caller - (nesting parallel_do body) in this test, they will cancel all the sibling nested - algorithms. **/ -template <class Iterator, class nesting_body> void Test2_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - - size_t test_vector[ITER_TEST_NUMBER_OF_ELEMENTS + 1]; - - for (int i =0; i < ITER_TEST_NUMBER_OF_ELEMENTS; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[ITER_TEST_NUMBER_OF_ELEMENTS]); - - g_added_tasks_count = 0; - - TRY(); - tbb::parallel_do<Iterator, nesting_body >(begin, end, nesting_body() ); - CATCH_AND_ASSERT(); - - ASSERT (!no_exception, "No exception thrown from the nesting parallel_for"); - //if ( g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - REMARK ("Executed at the end of test %d", (intptr)g_cur_executed); - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); -} // void Test2_parallel_do () - -template <class Iterator> class nesting_pdo_with_isolated_context_body { -public: - void operator()( size_t& /*value*/ ) const { - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - - __TBB_Yield(); - size_t test_vector[101]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - tbb::parallel_do<Iterator, simple_pdo_body>(begin, end, simple_pdo_body(), ctx); - } -}; - -template <class Iterator> class nesting_pdo_with_isolated_context_body_and_feeder { -public: - void operator()( size_t& /*value*/, tbb::parallel_do_feeder<size_t> &feeder ) const { - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - - if (g_added_tasks_count < 50) { - g_added_tasks_count++; - feeder.add(0); - } - - __TBB_Yield(); - size_t test_vector[101]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - tbb::parallel_do<Iterator, simple_pdo_body>(begin, end, simple_pdo_body(), ctx); - } -}; - -//! Uses parallel_do body invoking a nested parallel_do with an isolated context without a try-block. -/** Even though exceptions thrown from the nested parallel_do are not handled - by the caller in this test, they will not affect sibling nested algorithms - already running because of the isolated contexts. However because the first - exception cancels the root parallel_do only the first g_num_threads subranges - will be processed (which launch nested parallel_dos) **/ -template <class Iterator, class nesting_body> void Test3_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - intptr nested_body_calls = 100, - min_num_calls = (g_num_threads - 1) * nested_body_calls; - - size_t test_vector[101]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - TRY(); - tbb::parallel_do<Iterator, nesting_body >(begin, end,nesting_body()); - CATCH_AND_ASSERT(); - - ASSERT (!no_exception, "No exception thrown from the nesting parallel_for"); - REMARK ("Executed at the end of test %d", (intptr)g_cur_executed); - if ( g_solitary_exception ) { - ASSERT (g_cur_executed > min_num_calls, "Too few tasks survived exception"); - ASSERT (g_cur_executed <= min_num_calls + (g_catch_executed + g_num_threads), "Too many tasks survived exception"); - } - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); -} // void Test3_parallel_do () - - -template <class Iterator> class nesting_pdo_with_eh_body { -public: - void operator()( size_t& /*value*/ ) const { - size_t test_vector[100]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - TRY(); - tbb::parallel_do<Iterator, simple_pdo_body>(begin, end, simple_pdo_body(), ctx); - CATCH(); - } -}; - -template <class Iterator> class nesting_pdo_with_eh_body_and_feeder: NoAssign { -public: - void operator()( size_t &/*value*/, tbb::parallel_do_feeder<size_t> &feeder ) const { - size_t test_vector[100]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - if (g_added_tasks_count < 5) { - g_added_tasks_count++; - feeder.add(0); - } - - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - TRY(); - tbb::parallel_do<Iterator, simple_pdo_body>(begin, end, simple_pdo_body(), ctx); - CATCH(); - } -}; - - -//! Uses parallel_for body invoking a nested parallel_for (with default bound context) inside a try-block. -/** Since exception(s) thrown from the nested parallel_for are handled by the caller - in this test, they do not affect neither other tasks of the the root parallel_for - nor sibling nested algorithms. **/ - -template <class Iterator, class nesting_body_with_eh> void Test4_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - - intptr nested_body_calls = 100, - nesting_body_calls = 10, - calls_in_normal_case = nesting_body_calls * nested_body_calls; - - size_t test_vector[10]; - - for (int i =0; i < 10; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[10]); - - TRY(); - tbb::parallel_do<Iterator, nesting_body_with_eh>(begin, end, nesting_body_with_eh()); - CATCH(); - ASSERT (no_exception, "All exceptions must have been handled in the parallel_do body"); - REMARK ("Executed %d (normal case %d), exceptions %d, in master only? %d", (intptr)g_cur_executed, calls_in_normal_case, (intptr)g_exceptions, g_exception_in_master); - intptr min_num_calls = 0; - if ( g_solitary_exception ) { - min_num_calls = calls_in_normal_case - nested_body_calls; - ASSERT (g_exceptions == 1, "No exception registered"); - ASSERT (g_cur_executed <= min_num_calls + g_num_threads, "Too many tasks survived exception"); - } - else if ( !g_exception_in_master ) { - // Each nesting body + at least 1 of its nested body invocations - nesting_body_calls += g_added_tasks_count; - min_num_calls = 2 * nesting_body_calls; - ASSERT (g_exceptions > 1 && g_exceptions <= nesting_body_calls, "Unexpected actual number of exceptions"); - ASSERT (g_cur_executed >= min_num_calls + (nesting_body_calls - g_exceptions) * nested_body_calls, "Too few tasks survived exception"); - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived multiple exceptions"); - // Additional nested_body_calls accounts for the minimal amount of tasks spawned - // by not throwing threads. In the minimal case it is either the master thread or the only worker. - ASSERT (g_cur_executed <= min_num_calls + (nesting_body_calls - g_exceptions + 1) * nested_body_calls + g_exceptions + g_num_threads, "Too many tasks survived exception"); - } -} // void Test4_parallel_do () - -class pdo_body_to_cancel { -public: - void operator()( size_t& /*value*/ ) const { - ++g_cur_executed; - do { - Harness::Sleep(10); - __TBB_Yield(); - } while( !my_cancellator_task::s_cancellator_ready ); - } -}; - -class pdo_body_to_cancel_with_feeder { -public: - void operator()( size_t& /*value*/, tbb::parallel_do_feeder<size_t> &feeder ) const { - ++g_cur_executed; - - if (g_added_tasks_count < 50) { - g_added_tasks_count++; - feeder.add(0); - } - - do { - Harness::Sleep(10); - __TBB_Yield(); - } while( !my_cancellator_task::s_cancellator_ready ); - } -}; - -template<class B, class Iterator> -class my_worker_pdo_task : public tbb::task -{ - tbb::task_group_context &my_ctx; - - tbb::task* execute () { - size_t test_vector[100]; - - for (int i =0; i < 100; i++) test_vector[i] = i; - - Iterator begin(&test_vector[0]); - Iterator end(&test_vector[100]); - - tbb::parallel_do<Iterator, B>( begin, end, B(), my_ctx ); - return NULL; - } -public: - my_worker_pdo_task ( tbb::task_group_context& ctx ) : my_ctx(ctx) {} -}; - -//! Test for cancelling an algorithm from outside (from a task running in parallel with the algorithm). -template <class Iterator, class body_to_cancel> void Test5_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - g_throw_exception = false; - intptr threshold = 10; - tbb::task_group_context ctx; - ctx.reset(); - my_cancellator_task::s_cancellator_ready = false; - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - r.set_ref_count(3); - r.spawn( *new( r.allocate_child() ) my_cancellator_task(ctx, threshold) ); - __TBB_Yield(); - r.spawn( *new( r.allocate_child() ) my_worker_pdo_task<body_to_cancel, Iterator>(ctx) ); - TRY(); - r.wait_for_all(); - CATCH(); - r.destroy(r); - ASSERT (no_exception, "Cancelling tasks should not cause any exceptions"); - ASSERT (g_cur_executed < g_catch_executed + g_num_threads, "Too many tasks were executed after cancellation"); -} // void Test5_parallel_do () - - -class pdo_body_to_cancel_2 { -public: - void operator()( size_t& /*value*/ ) const { - ++g_cur_executed; - // The test will hang (and be timed out by the tesst system) if is_cancelled() is broken - while( !tbb::task::self().is_cancelled() ) __TBB_Yield(); - } -}; - -class pdo_body_to_cancel_2_with_feeder { -public: - void operator()( size_t& /*value*/, tbb::parallel_do_feeder<size_t> &feeder ) const { - ++g_cur_executed; - - if (g_added_tasks_count < 50) { - g_added_tasks_count++; - feeder.add(0); - } - - // The test will hang (and be timed out by the tesst system) if is_cancelled() is broken - while( !tbb::task::self().is_cancelled() ) __TBB_Yield(); - } -}; - -//! Test for cancelling an algorithm from outside (from a task running in parallel with the algorithm). -/** This version also tests task::is_cancelled() method. **/ -template <class Iterator, class body_to_cancel> void Test6_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - tbb::task_group_context ctx; - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - r.set_ref_count(3); - r.spawn( *new( r.allocate_child() ) my_cancellator_2_task(ctx) ); - __TBB_Yield(); - r.spawn( *new( r.allocate_child() ) my_worker_pdo_task<body_to_cancel, Iterator>(ctx) ); - TRY(); - r.wait_for_all(); - CATCH(); - r.destroy(r); - ASSERT (no_exception, "Cancelling tasks should not cause any exceptions"); - ASSERT (g_cur_executed <= g_catch_executed, "Some tasks were executed after cancellation"); -} // void Test6_parallel_do () - -// This body throws an exception only if the task was added by feeder -class pdo_body_exception_only_in_task_added_by_feeder -{ -public: - //! This form of the function call operator can be used when the body needs to add more work during the processing - void operator() ( size_t &value, tbb::parallel_do_feeder<size_t> &feeder ) const { - ++g_cur_executed; - - if (g_added_tasks_count < 50) { - g_added_tasks_count++; - feeder.add(1); - } - - if (value == 1) throw_test_exception(1); - } -}; // class pdo_body_exception_only_in_task_added_by_feeder - -// Test exception in task, which was added by feeder. -template <class Iterator> void Test8_parallel_do () { - REMARK (__FUNCTION__); - reset_globals(); - size_t values[ITER_TEST_NUMBER_OF_ELEMENTS]; - - for (int i =0; i < ITER_TEST_NUMBER_OF_ELEMENTS; i++) values[i] = 0; - - Iterator begin(&values[0]); - Iterator end(&values[ITER_TEST_NUMBER_OF_ELEMENTS - 1]); - TRY(); - tbb::parallel_do<Iterator, pdo_body_exception_only_in_task_added_by_feeder>(begin, end, pdo_body_exception_only_in_task_added_by_feeder()); - CATCH(); - - REMARK ("Executed at the end of test %d; number of exceptions", (intptr)g_cur_executed); - if (g_solitary_exception) - ASSERT (!no_exception, "At least one exception should occur"); -} // void Test8_parallel_do () - - -void RunParallelDoTests() { - tbb::task_scheduler_init init (g_num_threads); - g_master = util::get_my_tid(); - - Test0_parallel_do<RandomIterator<size_t> >(); - Test0_parallel_do<ForwardIterator<size_t> >(); -#if !__TBB_EXCEPTION_HANDLING_BROKEN - Test1_parallel_do<RandomIterator<size_t>, simple_pdo_body >(); - Test1_parallel_do<RandomIterator<size_t>, simple_pdo_body_feeder >(); - Test1_parallel_do<ForwardIterator<size_t>, simple_pdo_body >(); - Test1_parallel_do<ForwardIterator<size_t>, simple_pdo_body_feeder >(); - Test2_parallel_do<RandomIterator<size_t>, nesting_pdo_body<RandomIterator<size_t> > >(); - Test2_parallel_do<RandomIterator<size_t>, nesting_pdo_body_feeder<RandomIterator<size_t> > >(); - Test2_parallel_do<ForwardIterator<size_t>, nesting_pdo_body<ForwardIterator<size_t> > >(); - Test2_parallel_do<ForwardIterator<size_t>, nesting_pdo_body_feeder<ForwardIterator<size_t> > >(); - Test3_parallel_do<ForwardIterator<size_t>, nesting_pdo_with_isolated_context_body<ForwardIterator<size_t> > >(); - Test3_parallel_do<RandomIterator<size_t>, nesting_pdo_with_isolated_context_body<RandomIterator<size_t> > >(); - Test3_parallel_do<ForwardIterator<size_t>, nesting_pdo_with_isolated_context_body_and_feeder<ForwardIterator<size_t> > >(); - Test3_parallel_do<RandomIterator<size_t>, nesting_pdo_with_isolated_context_body_and_feeder<RandomIterator<size_t> > >(); - Test4_parallel_do<ForwardIterator<size_t>, nesting_pdo_with_eh_body<ForwardIterator<size_t> > >(); - Test4_parallel_do<RandomIterator<size_t>, nesting_pdo_with_eh_body<RandomIterator<size_t> > >(); - Test4_parallel_do<ForwardIterator<size_t>, nesting_pdo_with_eh_body_and_feeder<ForwardIterator<size_t> > >(); - Test4_parallel_do<RandomIterator<size_t>, nesting_pdo_with_eh_body_and_feeder<RandomIterator<size_t> > >(); -#endif - Test5_parallel_do<ForwardIterator<size_t>, pdo_body_to_cancel >(); - Test5_parallel_do<RandomIterator<size_t>, pdo_body_to_cancel >(); - Test5_parallel_do<ForwardIterator<size_t>, pdo_body_to_cancel_with_feeder >(); - Test5_parallel_do<RandomIterator<size_t>, pdo_body_to_cancel_with_feeder >(); - Test6_parallel_do<ForwardIterator<size_t>, pdo_body_to_cancel_2 >(); - Test6_parallel_do<RandomIterator<size_t>, pdo_body_to_cancel_2 >(); - Test6_parallel_do<ForwardIterator<size_t>, pdo_body_to_cancel_2_with_feeder >(); - Test6_parallel_do<RandomIterator<size_t>, pdo_body_to_cancel_2_with_feeder >(); -#if !__TBB_EXCEPTION_HANDLING_BROKEN - Test8_parallel_do<ForwardIterator<size_t> >(); - Test8_parallel_do<RandomIterator<size_t> >(); -#endif -} - -// Pipeline testing -#define TEST_PROLOGUE() \ - REMARK (__FUNCTION__); \ - { \ - tbb::task_scheduler_init init (g_num_threads); \ - g_master = util::get_my_tid(); \ - reset_globals(); \ - -#define TEST_EPILOGUE() \ - } \ - -const size_t buffer_size = 100, - data_end_tag = size_t(~0); - -size_t g_num_tokens = 0; - -// Simple input filter class, it assigns 1 to all array members -// It stops when it receives item equal to -1 -class input_filter: public tbb::filter { - tbb::atomic<size_t> my_item; - size_t my_buffer[buffer_size + 1]; - -public: - input_filter() : tbb::filter(parallel) { - my_item = 0; - for (size_t i = 0; i < buffer_size; ++i ) { - my_buffer[i] = 1; - } - my_buffer[buffer_size] = data_end_tag; - } - - void* operator()( void* ) { - size_t item = my_item.fetch_and_increment(); - if ( item >= buffer_size ) { // end of input - return NULL; - } - size_t &value = my_buffer[item]; - value = 1; - return &value; - } - - size_t* buffer() { return my_buffer; } -}; // class input_filter - -// Pipeline filter, without exceptions throwing -class no_throw_filter: public tbb::filter { - size_t my_value; -public: - enum operation { - addition, - subtraction, - multiplication - } my_operation; - - no_throw_filter(operation _operation, size_t value, bool is_parallel) - : filter(is_parallel? tbb::filter::parallel : tbb::filter::serial_in_order), - my_value(value), my_operation(_operation) - {} - void* operator()(void* item) { - size_t &value = *(size_t*)item; - ASSERT(value != data_end_tag, "terminator element is being processed"); - switch (my_operation){ - case addition: - value += my_value; - break; - case subtraction: - value -= my_value; - break; - case multiplication: - value *= my_value; - break; - default: - ASSERT(0, "Wrong operation parameter passed to no_throw_filter"); - } // switch (my_operation) - return item; - } -}; - -// Test pipeline without exceptions throwing -void Test0_pipeline () { - TEST_PROLOGUE() - - // Run test when serial filter is the first non-input filter - input_filter my_input_filter; - no_throw_filter my_filter_1(no_throw_filter::addition, 99, false); - no_throw_filter my_filter_2(no_throw_filter::subtraction, 90, true); - no_throw_filter my_filter_3(no_throw_filter::multiplication, 5, false); - // Result should be 50 for all items except the last - - tbb::pipeline my_pipeline; - my_pipeline.add_filter(my_input_filter); - my_pipeline.add_filter(my_filter_1); - my_pipeline.add_filter(my_filter_2); - my_pipeline.add_filter(my_filter_3); - my_pipeline.run(8); - - for (size_t i = 0; i < buffer_size; ++i) { - ASSERT(my_input_filter.buffer()[i] == 50, "pipeline didn't process items properly"); - } - TEST_EPILOGUE() -} // void Test0_pipeline () - -// Simple filter with exception throwing -class simple_filter : public tbb::filter -{ -public: - simple_filter (tbb::filter::mode _mode ) : filter (_mode) {} - - void* operator()(void* item) { - ++g_cur_executed; - if ( g_exception_in_master ^ (util::get_my_tid() == g_master) ) - { - // Make absolutely sure that worker threads on multicore machines had a chance to steal something - Harness::Sleep(10); - } - throw_test_exception(1); - - return item; - } -}; // class simple_filter - -// This enumeration represents filters order in pipeline -enum filter_set { - parallel__parallel=0, - parallel__serial=1, - parallel__serial_out_of_order=2, - serial__parallel=4, - serial__serial=5, - serial__serial_out_of_order=6, - serial_out_of_order__parallel=8, - serial_out_of_order__serial=9, - serial_out_of_order__serial_out_of_order=10 -}; - -// The function returns filter type using filter number in set -tbb::filter::mode filter_mode (filter_set set, int number) -{ - size_t tmp = set << (2 * (2 - number)); - switch (tmp&12){ - case 0: - return tbb::filter::parallel; - case 4: - return tbb::filter::serial_in_order; - case 8: - return tbb::filter::serial_out_of_order; - } - ASSERT(0, "Wrong filter set passed to get_filter_type"); - return tbb::filter::parallel; // We should never get here, just to prevent compiler warnings -} - - -template<typename InputFilter, typename Filter> -class custom_pipeline : protected tbb::pipeline { - typedef tbb::pipeline base; - InputFilter my_input_filter; - Filter my_filter_1; - Filter my_filter_2; - -public: - custom_pipeline( filter_set filter_set ) - : my_filter_1(filter_mode(filter_set, 1)) - , my_filter_2(filter_mode(filter_set, 2)) - { - add_filter(my_input_filter); - add_filter(my_filter_1); - add_filter(my_filter_2); - } - void run () { base::run(g_num_tokens); } - void run ( tbb::task_group_context& ctx ) { base::run(g_num_tokens, ctx); } - using base::add_filter; -}; - -typedef custom_pipeline<input_filter, simple_filter> simple_pipeline; - -// Tests exceptions without nesting -void Test1_pipeline ( filter_set mode ) { - TEST_PROLOGUE() - - simple_pipeline test_pipeline(mode); - TRY(); - test_pipeline.run(); - if ( g_cur_executed == 2 * buffer_size ) { - // In case of all serial filters they might be all executed in the thread(s) - // where exceptions are not allowed by the common test logic. So we just quit. - return; - } - CATCH_AND_ASSERT(); - - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - REMARK ("Executed at the end of test %d; number of exceptions", (intptr)g_cur_executed); - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - - TEST_EPILOGUE() -} // void Test1_pipeline () - -// Filter with nesting -class nesting_filter : public tbb::filter -{ -public: - nesting_filter(tbb::filter::mode _mode ) - : filter ( _mode) - {} - - void* operator()(void* item) { - ++g_cur_executed; - if ( util::get_my_tid() == g_master ) - __TBB_Yield(); - - simple_pipeline test_pipeline(serial__parallel); - test_pipeline.run(); - - return item; - } -}; // class nesting_filter - -//! Uses pipeline containing a nested pipeline with the default context not wrapped by a try-block. -/** Nested algorithms are spawned inside the new bound context by default. Since - exceptions thrown from the nested pipeline are not handled by the caller - (nesting pipeline body) in this test, they will cancel all the sibling nested - algorithms. **/ -void Test2_pipeline ( filter_set mode ) { - TEST_PROLOGUE() - - custom_pipeline<input_filter, nesting_filter> test_pipeline(mode); - TRY(); - test_pipeline.run(); - CATCH_AND_ASSERT(); - - ASSERT (!no_exception, "No exception thrown from the nesting pipeline"); - //if ( g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - REMARK ("Executed at the end of test %d", (intptr)g_cur_executed); - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - TEST_EPILOGUE() -} // void Test2_pipeline () - -class nesting_filter_with_isolated_context : public tbb::filter -{ -public: - nesting_filter_with_isolated_context(tbb::filter::mode _mode ) - : filter ( _mode) - {} - - void* operator()(void* item) { - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - __TBB_Yield(); - simple_pipeline test_pipeline(serial__parallel); - test_pipeline.run(ctx); - return item; - } -}; // class nesting_filter_with_isolated_context - -//! Uses pipeline invoking a nested pipeline with an isolated context without a try-block. -/** Even though exceptions thrown from the nested pipeline are not handled - by the caller in this test, they will not affect sibling nested algorithms - already running because of the isolated contexts. However because the first - exception cancels the root parallel_do only the first g_num_threads subranges - will be processed (which launch nested pipelines) **/ -void Test3_pipeline ( filter_set mode ) { - TEST_PROLOGUE() - intptr nested_body_calls = 100, - min_num_calls = (g_num_threads - 1) * nested_body_calls; - - custom_pipeline<input_filter, nesting_filter_with_isolated_context> test_pipeline(mode); - TRY(); - test_pipeline.run(); - CATCH_AND_ASSERT(); - - ASSERT (!no_exception, "No exception thrown from the nesting parallel_for"); - REMARK ("Executed at the end of test %d", (intptr)g_cur_executed); - if ( g_solitary_exception ) { - ASSERT (g_cur_executed > min_num_calls, "Too few tasks survived exception"); - ASSERT (g_cur_executed <= min_num_calls + (g_catch_executed + g_num_threads), "Too many tasks survived exception"); - } - ASSERT (g_exceptions == 1, "No try_blocks in any body expected in this test"); - if ( !g_solitary_exception ) - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived exception"); - TEST_EPILOGUE(); -} // void Test3_pipeline () - -class nesting_filter_with_eh_body : public tbb::filter -{ -public: - nesting_filter_with_eh_body(tbb::filter::mode _mode ) - : filter ( _mode) - {} - - void* operator()(void* item) { - tbb::task_group_context ctx(tbb::task_group_context::isolated); - ++g_cur_executed; - simple_pipeline test_pipeline(serial__parallel); - TRY(); - test_pipeline.run(ctx); - CATCH(); - return item; - } -}; // class nesting_filter_with_eh_body - -//! Uses pipeline body invoking a nested pipeline (with default bound context) inside a try-block. -/** Since exception(s) thrown from the nested pipeline are handled by the caller - in this test, they do not affect neither other tasks of the the root pipeline - nor sibling nested algorithms. **/ - -void Test4_pipeline ( filter_set mode ) { - TEST_PROLOGUE() - - intptr nested_body_calls = buffer_size + 1, - nesting_body_calls = 2 * (buffer_size + 1), - calls_in_normal_case = nesting_body_calls * nested_body_calls; - - custom_pipeline<input_filter, nesting_filter_with_eh_body> test_pipeline(mode); - TRY(); - test_pipeline.run(); - CATCH_AND_ASSERT(); - - - ASSERT (no_exception, "All exceptions must have been handled in the parallel_do body"); - REMARK ("Executed %d (normal case %d), exceptions %d, in master only? %d", (intptr)g_cur_executed, calls_in_normal_case, (intptr)g_exceptions, g_exception_in_master); - intptr min_num_calls = 0; - if ( g_solitary_exception ) { - min_num_calls = calls_in_normal_case - nested_body_calls; - ASSERT (g_exceptions == 1, "No exception registered"); - ASSERT (g_cur_executed <= min_num_calls + g_num_threads, "Too many tasks survived exception"); - } - else if ( !g_exception_in_master ) { - // Each nesting body + at least 1 of its nested body invocations - nesting_body_calls += g_added_tasks_count; - min_num_calls = 2 * nesting_body_calls; - ASSERT (g_exceptions > 1 && g_exceptions <= nesting_body_calls, "Unexpected actual number of exceptions"); - ASSERT (g_cur_executed <= g_catch_executed + g_num_threads, "Too many tasks survived multiple exceptions"); - // Additional nested_body_calls accounts for the minimal amount of tasks spawned - // by not throwing threads. In the minimal case it is either the master thread or the only worker. - ASSERT (g_cur_executed <= min_num_calls + (nesting_body_calls - g_exceptions + 1) * nested_body_calls + g_exceptions + g_num_threads, "Too many tasks survived exception"); - } - TEST_EPILOGUE() -} // void Test4_pipeline () - - -class filter_to_cancel : public tbb::filter -{ -public: - filter_to_cancel(bool is_parallel) - : filter ( is_parallel ? tbb::filter::parallel : tbb::filter::serial_in_order) - {} - - void* operator()(void* item) { - ++g_cur_executed; - do { - Harness::Sleep(10); - __TBB_Yield(); - } while( !my_cancellator_task::s_cancellator_ready ); - return item; - } -}; // class filter_to_cancel - - -template <class Filter_to_cancel> class my_worker_pipeline_task : public tbb::task -{ - tbb::task_group_context &my_ctx; - -public: - my_worker_pipeline_task ( tbb::task_group_context& ctx ) : my_ctx(ctx) {} - - tbb::task* execute () { - // Run test when serial filter is the first non-input filter - input_filter my_input_filter; - Filter_to_cancel my_filter_to_cancel(true); - - tbb::pipeline my_pipeline; - my_pipeline.add_filter(my_input_filter); - my_pipeline.add_filter(my_filter_to_cancel); - - my_pipeline.run(g_num_tokens, my_ctx); - - return NULL; - } - -}; - -//! Test for cancelling an algorithm from outside (from a task running in parallel with the algorithm). -void Test5_pipeline () { - TEST_PROLOGUE() - - g_throw_exception = false; - intptr threshold = 10; - tbb::task_group_context ctx; - ctx.reset(); - my_cancellator_task::s_cancellator_ready = false; - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - r.set_ref_count(3); - r.spawn( *new( r.allocate_child() ) my_cancellator_task(ctx, threshold) ); - __TBB_Yield(); - r.spawn( *new( r.allocate_child() ) my_worker_pipeline_task<filter_to_cancel>(ctx) ); - TRY(); - r.wait_for_all(); - CATCH(); - r.destroy(r); - ASSERT (no_exception, "Cancelling tasks should not cause any exceptions"); - ASSERT (g_cur_executed < g_catch_executed + g_num_threads, "Too many tasks were executed after cancellation"); - TEST_EPILOGUE() -} // void Test5_pipeline () - -class filter_to_cancel_2 : public tbb::filter { -public: - filter_to_cancel_2(bool is_parallel) - : filter ( is_parallel ? tbb::filter::parallel : tbb::filter::serial_in_order) - {} - - void* operator()(void* item) { - ++g_cur_executed; - // The test will hang (and be timed out by the tesst system) if is_cancelled() is broken - while( !tbb::task::self().is_cancelled() ) __TBB_Yield(); - return item; - } -}; - -//! Test for cancelling an algorithm from outside (from a task running in parallel with the algorithm). -/** This version also tests task::is_cancelled() method. **/ -void Test6_pipeline () { - TEST_PROLOGUE() - - tbb::task_group_context ctx; - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - r.set_ref_count(3); - r.spawn( *new( r.allocate_child() ) my_cancellator_2_task(ctx) ); - __TBB_Yield(); - r.spawn( *new( r.allocate_child() ) my_worker_pipeline_task<filter_to_cancel_2>(ctx) ); - TRY(); - r.wait_for_all(); - CATCH(); - r.destroy(r); - ASSERT (no_exception, "Cancelling tasks should not cause any exceptions"); - ASSERT (g_cur_executed <= g_catch_executed, "Some tasks were executed after cancellation"); - TEST_EPILOGUE() -} // void Test6_pipeline () - -//! Testing filter::finalize method -const int FINALIZE_SIZE_OF_EACH_BUFFER = buffer_size + 1; -const int FINALIZE_NUMBER_OF_BUFFERS = 10000; -tbb::atomic<size_t> allocated_count; // Number of currently allocated buffers -tbb::atomic<size_t> total_count; // Total number of allocated buffers - -//! Base class for all filters involved in finalize method testing -class finalize_base_filter: public tbb::filter{ -public: - finalize_base_filter (tbb::filter::mode _mode) - : filter ( _mode) - {} - - // Deletes buffers if exception occured - virtual void finalize( void* item ) { - size_t* my_item = (size_t*)item; - delete[] my_item; - allocated_count--; - } -}; - -//! Input filter to test finalize method -class finalize_input_filter: public finalize_base_filter { -public: - finalize_input_filter() : finalize_base_filter(tbb::filter::serial) - { - total_count = 0; - } - void* operator()( void* ){ - if (total_count == FINALIZE_NUMBER_OF_BUFFERS) { - return NULL; - } - - size_t* item = new size_t[FINALIZE_SIZE_OF_EACH_BUFFER]; - for (int i = 0; i < FINALIZE_SIZE_OF_EACH_BUFFER; i++) - item[i] = 1; - total_count++; - allocated_count ++; - return item; - } -}; - -// The filter multiplies each buffer item by 10. -class finalize_process_filter: public finalize_base_filter { -public: - finalize_process_filter (tbb::filter::mode _mode) : finalize_base_filter (_mode) {} - - void* operator()( void* item){ - if (total_count > FINALIZE_NUMBER_OF_BUFFERS / 2) - throw_test_exception(1); - - size_t* my_item = (size_t*)item; - for (int i = 0; i < FINALIZE_SIZE_OF_EACH_BUFFER; i++) - my_item[i] *= 10; - - return item; - } -}; - -// Output filter deletes previously allocated buffer -class finalize_output_filter: public finalize_base_filter { -public: - finalize_output_filter (tbb::filter::mode _mode) : finalize_base_filter (_mode) {} - - void* operator()( void* item){ - size_t* my_item = (size_t*)item; - delete[] my_item; - allocated_count--; - - return NULL; // not used - } -}; - -//! Tests filter::finalize method -void Test8_pipeline (filter_set mode) { - TEST_PROLOGUE() - - allocated_count = 0; - - custom_pipeline<finalize_input_filter, finalize_process_filter> test_pipeline(mode); - finalize_output_filter my_output_filter(tbb::filter::parallel); - - test_pipeline.add_filter(my_output_filter); - TRY(); - test_pipeline.run(); - CATCH(); - - TEST_EPILOGUE() - - ASSERT (allocated_count == 0, "Memory leak: Some my_object weren't destroyed"); -} // void Test8_pipeline () - -// Tests pipeline function passed with different combination of filters -template<void pipeline_test(filter_set)> -void TestWithDifferentFilters() { - pipeline_test(parallel__parallel); - pipeline_test(parallel__serial); - pipeline_test(parallel__serial_out_of_order); - pipeline_test(serial__parallel); - pipeline_test(serial__serial); - pipeline_test(serial__serial_out_of_order); - pipeline_test(serial_out_of_order__parallel); - pipeline_test(serial_out_of_order__serial); - pipeline_test(serial_out_of_order__serial_out_of_order); -} - -void RunPipelineTests() { - g_num_tokens = 2 * g_num_threads; - - Test0_pipeline(); -#if !__TBB_EXCEPTION_HANDLING_BROKEN - TestWithDifferentFilters<Test1_pipeline>(); - TestWithDifferentFilters<Test2_pipeline>(); -#endif /* !__TBB_EXCEPTION_HANDLING_BROKEN */ - Test5_pipeline(); - Test6_pipeline(); -#if !__TBB_EXCEPTION_HANDLING_BROKEN - TestWithDifferentFilters<Test8_pipeline>(); -#endif -} - -#endif /* __TBB_EXCEPTIONS */ - - -//------------------------------------------------------------------------ -// Entry point -//------------------------------------------------------------------------ - -/** If min and max thread numbers specified on the command line are different, - the test is run only for 2 sizes of the thread pool (MinThread and MaxThread) - to be able to test the high and low contention modes while keeping the test reasonably fast **/ -int main(int argc, char* argv[]) { - // Set default minimum number of threads - MinThread = 2; - ParseCommandLine( argc, argv ); - MinThread = min(MinThread, MaxThread); - ASSERT (MinThread>=2, "Minimal number of threads must be 2 or more"); - ASSERT (ITER_RANGE >= ITER_GRAIN * MaxThread, "Fix defines"); -#if __TBB_EXCEPTIONS - int step = max(MaxThread - MinThread, 1); - for ( g_num_threads = MinThread; g_num_threads <= MaxThread; g_num_threads += step ) { - REMARK ("Number of threads %d", g_num_threads); - g_max_concurrency = min(g_num_threads, tbb::task_scheduler_init::default_num_threads()); - // Execute in all the possible modes - for ( size_t j = 0; j < 4; ++j ) { - g_exception_in_master = (j & 1) == 1; - g_solitary_exception = (j & 2) == 1; - RunTests(); - RunParallelDoTests(); - RunPipelineTests(); - } - } -#if __TBB_EXCEPTION_HANDLING_BROKEN - printf("Warning: Exception handling tests are skipped due to a known issue.\n"); -#endif - printf("done\n"); -#else /* !__TBB_EXCEPTIONS */ - printf("skipped\n"); -#endif /* !__TBB_EXCEPTIONS */ - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_tasks.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_tasks.cpp deleted file mode 100644 index ed17fa0ddf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_eh_tasks.cpp +++ /dev/null @@ -1,808 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// to avoid usage of #pragma comment -#define __TBB_NO_IMPLICIT_LINKAGE 1 - -#define COUNT_TASK_NODES 1 -#define __TBB_TASK_CPP_DIRECTLY_INCLUDED 1 -#include "../tbb/task.cpp" - -#if __TBB_EXCEPTIONS - -#include "tbb/task_scheduler_init.h" -#include "tbb/spin_mutex.h" -#include "tbb/tick_count.h" -#include <string> - -#include "harness.h" -#include "harness_trace.h" -#include "harness_sleep.h" - -#define NUM_CHILD_TASKS 256 -#define NUM_ROOT_TASKS 32 -#define NUM_ROOTS_IN_GROUP 8 -#define EXCEPTION_DESCR "Test exception" - -namespace internal = tbb::internal; -using internal::intptr; - -int g_max_concurrency = 0; -int g_num_threads = 0; - -class test_exception : public std::exception -{ - const char* my_description; -public: - test_exception ( const char* description ) : my_description(description) {} - - const char* what() const throw() { return my_description; } -}; - -class solitary_test_exception : public test_exception -{ -public: - solitary_test_exception ( const char* description ) : test_exception(description) {} -}; - - -//! Statistics about number of tasks in different states -class task_statistics_t -{ - typedef tbb::spin_mutex::scoped_lock lock_t; - //! Number of tasks allocated that was ever allocated - volatile intptr my_existed; - //! Number of tasks executed to the moment - volatile intptr my_executed; - //! Number of tasks allocated but not yet destroyed to the moment - volatile intptr my_existing; - - mutable tbb::spin_mutex my_mutex; - -public: - //! Assumes that assignment is noncontended for the left-hand operand - const task_statistics_t& operator= ( const task_statistics_t& rhs ) { - if ( this != &rhs ) { - lock_t lock(rhs.my_mutex); - my_existed = rhs.my_existed; - my_executed = rhs.my_executed; - my_existing = rhs.my_existing; - } - return *this; - } - - intptr existed () const { return my_existed; } - intptr executed () const { return my_executed; } - intptr existing () const { return my_existing; } - - void inc_existed () { lock_t lock(my_mutex); ++my_existed; ++my_existing; } - void inc_executed () { lock_t lock(my_mutex); ++my_executed; } - void dec_existing () { lock_t lock(my_mutex); --my_existing; } - - //! Assumed to be used in noncontended manner only - void reset () { my_executed = my_existing = my_existed = 0; } - - void trace (const char* prefix ) { - const char* separator = prefix && prefix[0] ? " " : ""; - lock_t lock(my_mutex); - REMARK ("%s%stasks total %u, existing %u, executed %u", prefix, separator, (intptr)my_existed, (intptr)my_existing, (intptr)my_executed); - } -}; - -task_statistics_t g_cur_stat, - g_exc_stat; // snapshot of statistics at the moment of exception throwing - -internal::GenericScheduler *g_master = NULL; - -volatile intptr g_exception_thrown = 0; -volatile bool g_throw_exception = true; -volatile bool g_no_exception = true; -volatile bool g_unknown_exception = false; -volatile bool g_task_was_cancelled = false; -tbb::atomic<int> g_tasks_started; -int g_tasks_wait_limit = 0; -const int c_timeout = 50000; - -bool g_exception_in_master = false; -bool g_solitary_exception = true; - -//volatile intptr g_num_tasks_when_last_exception = 0; - - -void reset_globals () { - g_cur_stat.reset(); - g_exc_stat.reset(); - g_exception_thrown = 0; - g_throw_exception = true; - g_no_exception = true; - g_unknown_exception = false; - g_task_was_cancelled = false; - g_tasks_started = 0; - g_tasks_wait_limit = g_num_threads; -} - -intptr num_tasks () { return g_master->get_task_node_count(true); } - -void throw_test_exception ( intptr throw_threshold ) { - if ( !g_throw_exception || g_exception_in_master ^ (internal::Governor::local_scheduler() == g_master) ) - return; - while ( g_cur_stat.existed() < throw_threshold ) - __TBB_Yield(); - if ( !g_solitary_exception ) { - REMARK ("About to throw one of multiple test_exceptions... :"); - throw test_exception(EXCEPTION_DESCR); - } - if ( __TBB_CompareAndSwapW(&g_exception_thrown, 1, 0) == 0 ) { - g_exc_stat = g_cur_stat; - REMARK ("About to throw solitary test_exception... :"); - throw solitary_test_exception(EXCEPTION_DESCR); - } -} - -// Default timeout value (50000) translates to 20-50 ms on most of the modern architectures -inline void wait_for_exception_with_timeout ( int timeout = 50000 ) { - int wait_count = 0; - while ( g_no_exception && (++wait_count < timeout) ) __TBB_Yield(); - if ( wait_count == timeout ) - REMARK("wait_for_exception_with_timeout: wait failed\n"); -} - -#define TRY() \ - bool no_exception = true, unknown_exception = false; \ - try { - -// When changing this macro check test10 as well - it uses similar code -#define CATCH() \ - } catch ( tbb::captured_exception& e ) { \ - ASSERT (strcmp(e.name(), (g_solitary_exception ? typeid(solitary_test_exception) : typeid(test_exception)).name() ) == 0, "Unexpected original exception name"); \ - ASSERT (strcmp(e.what(), EXCEPTION_DESCR) == 0, "Unexpected original exception info"); \ - if ( g_solitary_exception ) { \ - g_exc_stat.trace("stat at throw moment:"); \ - g_cur_stat.trace("stat upon catch :"); \ - } \ - g_no_exception = no_exception = false; \ - } \ - catch ( ... ) { \ - g_no_exception = false; \ - g_unknown_exception = unknown_exception = true; \ - } - -#define ASSERT_EXCEPTION() \ - ASSERT (!g_no_exception, "no exception occurred"); \ - ASSERT (!g_unknown_exception, "unknown exception was caught"); - -#define CATCH_AND_ASSERT() \ - CATCH() \ - ASSERT_EXCEPTION() - -#define ASSERT_TEST_POSTCOND() \ - ASSERT (g_cur_stat.existed() >= g_cur_stat.executed(), "Total number of tasks is less than executed"); \ - ASSERT (!g_cur_stat.existing(), "Not all task objects have been destroyed"); - -#define TEST_PROLOGUE() \ - REMARK (__FUNCTION__); \ - { \ - tbb::task_scheduler_init init (g_num_threads); \ - g_master = internal::Governor::local_scheduler(); \ - reset_globals(); - -#define TEST_EPILOGUE() \ - } \ - ASSERT_TEST_POSTCOND() - -class my_throwing_task : public tbb::task { -public: - tbb::task* execute () { throw 0; } - ~my_throwing_task() { - ASSERT( tbb::task::self().is_owned_by_current_thread(), NULL ); - } -}; - -//! Checks if innermost running task information is updated correctly during cancellation processing -void Test0 () { - tbb::task_scheduler_init init (1); - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - tbb::task_list tl; - tl.push_back( *new( r.allocate_child() ) my_throwing_task ); - tl.push_back( *new( r.allocate_child() ) my_throwing_task ); - r.set_ref_count( 3 ); - try { - r.spawn_and_wait_for_all( tl ); - } - catch (...) { - } - r.destroy( r ); -} - -class my_base_task : public tbb::task -{ - tbb::task* execute () { - tbb::task* t = NULL; - try { t = do_execute(); } - catch ( ... ) { g_cur_stat.inc_executed(); throw; } - g_cur_stat.inc_executed(); - return t; - } -protected: - my_base_task ( bool throw_exception = true ) : my_throw(throw_exception) { g_cur_stat.inc_existed(); } - ~my_base_task () { g_cur_stat.dec_existing(); } - - virtual tbb::task* do_execute () = 0; - - bool my_throw; -}; // class my_base_task - -class my_leaf_task : public my_base_task -{ - tbb::task* do_execute () { - ++g_tasks_started; - if ( my_throw ) - throw_test_exception(NUM_CHILD_TASKS/2); - if ( !g_throw_exception ) - __TBB_Yield(); - return NULL; - } -public: - my_leaf_task ( bool throw_exception = true ) : my_base_task(throw_exception) {} -}; - -class my_simple_root_task : public my_base_task -{ - tbb::task* do_execute () { - set_ref_count(NUM_CHILD_TASKS + 1); - for ( size_t i = 0; i < NUM_CHILD_TASKS; ++i ) { - my_leaf_task &t = *new( allocate_child() ) my_leaf_task(my_throw); - spawn(t); - __TBB_Yield(); - } -// ++g_tasks_started; - if ( g_exception_in_master ^ (internal::Governor::local_scheduler() == g_master) ) - { - // Make absolutely sure that worker threads on multicore machines had a chance to steal something -// Harness::Sleep(10); - int n = 0; -// while ( (++n < c_timeout) && (g_tasks_started < g_tasks_wait_limit) ) __TBB_Yield(); - while ( (++n < c_timeout) && !g_tasks_started ) __TBB_Yield(); - if ( n == c_timeout ) - REMARK("my_simple_root_task: wait failed\n"); - } - wait_for_all(); - return NULL; - } -public: - my_simple_root_task ( bool throw_exception = true ) : my_base_task(throw_exception) {} -}; - -//! Default exception behavior test. -/** Allocates a root task that spawns a bunch of children, one or several of which throw - a test exception in a worker or master thread (depending on the global setting). **/ -void Test1 () { - TEST_PROLOGUE(); - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - ASSERT (!g_cur_stat.existing() && !g_cur_stat.existed() && !g_cur_stat.executed(), - "something wrong with the task accounting"); - r.set_ref_count(NUM_CHILD_TASKS + 1); - for ( int i = 0; i < NUM_CHILD_TASKS; ++i ) { - my_leaf_task &t = *new( r.allocate_child() ) my_leaf_task; - r.spawn(t); - // Make sure that worker threads on multicore machines had a chance to steal something -// Harness::Sleep(1); - int n = 0; -// while ( ++n < c_timeout && g_no_exception && g_tasks_started < min (i + 1, g_num_threads - 1) ) __TBB_Yield(); - while ( ++n < c_timeout && !g_tasks_started ) __TBB_Yield(); - if ( n == c_timeout ) - REMARK("Test1: wait failed\n"); - } - TRY(); - r.wait_for_all(); - CATCH_AND_ASSERT(); - r.destroy(r); - TEST_EPILOGUE(); -} // void Test1 () - -//! Default exception behavior test. -/** Allocates and spawns root task that runs a bunch of children, one of which throws - a test exception in a worker thread. (Similar to Test1, except that the root task - is spawned by the test function, and children are created by the root task instead - of the test function body.) **/ -void Test2 () -{ - TEST_PROLOGUE(); - my_simple_root_task &r = *new( tbb::task::allocate_root() ) my_simple_root_task; - ASSERT (g_cur_stat.existing() == 1 && g_cur_stat.existed() == 1 && !g_cur_stat.executed(), - "something wrong with the task accounting"); - TRY(); - tbb::task::spawn_root_and_wait(r); - CATCH_AND_ASSERT(); - ASSERT (!g_no_exception, "no exception occurred"); - TEST_EPILOGUE(); -} // void Test2 () - -//! The same as Test2() except the root task has explicit context. -/** The context is initialized as bound in order to check correctness of its associating - with a root task. **/ -void Test3 () -{ - TEST_PROLOGUE(); - tbb::task_group_context ctx(tbb::task_group_context::bound); - my_simple_root_task &r = *new( tbb::task::allocate_root(ctx) ) my_simple_root_task; - ASSERT (g_cur_stat.existing() == 1 && g_cur_stat.existed() == 1 && !g_cur_stat.executed(), - "something wrong with the task accounting"); - TRY(); - tbb::task::spawn_root_and_wait(r); - CATCH_AND_ASSERT(); - ASSERT (!g_no_exception, "no exception occurred"); - TEST_EPILOGUE(); -} // void Test2 () - -class my_root_with_context_launcher_task : public my_base_task -{ - tbb::task_group_context::kind_type my_context_kind; - - tbb::task* do_execute () { - tbb::task_group_context ctx (tbb::task_group_context::isolated); - my_simple_root_task &r = *new( allocate_root(ctx) ) my_simple_root_task; - TRY(); - spawn_root_and_wait(r); - // Give a child of our siblings a chance to throw the test exception - wait_for_exception_with_timeout(); - CATCH(); - ASSERT_WARNING (!g_no_exception, "no exception occurred - machine overloaded?"); - ASSERT (!g_unknown_exception, "unknown exception was caught"); - return NULL; - } -public: - my_root_with_context_launcher_task ( tbb::task_group_context::kind_type ctx_kind = tbb::task_group_context::isolated ) : my_context_kind(ctx_kind) {} -}; - -/** Allocates and spawns a bunch of roots, which allocate and spawn new root with - isolated context, which at last spawns a bunch of children each, one of which - throws a test exception in a worker thread. **/ -void Test4 () { - TEST_PROLOGUE(); - tbb::task_list tl; - for ( size_t i = 0; i < NUM_ROOT_TASKS; ++i ) { - my_root_with_context_launcher_task &r = *new( tbb::task::allocate_root() ) my_root_with_context_launcher_task; - tl.push_back(r); - } - TRY(); - tbb::task::spawn_root_and_wait(tl); - CATCH_AND_ASSERT(); - ASSERT (no_exception, "unexpected exception intercepted"); - g_cur_stat.trace("stat at end of test :"); - intptr num_tasks_expected = NUM_ROOT_TASKS * (NUM_CHILD_TASKS + 2); - ASSERT (g_cur_stat.existed() == num_tasks_expected, "Wrong total number of tasks"); - if ( g_solitary_exception ) - ASSERT (g_cur_stat.executed() >= num_tasks_expected - NUM_CHILD_TASKS, "Unexpected number of executed tasks"); - TEST_EPILOGUE(); -} // void Test4 () - -class my_root_with_context_group_launcher_task : public my_base_task -{ - tbb::task* do_execute () { - tbb::task_group_context ctx (tbb::task_group_context::isolated); - tbb::task_list tl; - for ( size_t i = 0; i < NUM_ROOT_TASKS; ++i ) { - my_simple_root_task &r = *new( allocate_root(ctx) ) my_simple_root_task; - tl.push_back(r); - } - TRY(); - spawn_root_and_wait(tl); - // Give worker a chance to throw exception - wait_for_exception_with_timeout(); - CATCH_AND_ASSERT(); - return NULL; - } -}; - -/** Allocates and spawns a bunch of roots, which allocate and spawn groups of roots - with an isolated context shared by all group members, which at last spawn a bunch - of children each, one of which throws a test exception in a worker thread. **/ -void Test5 () { - TEST_PROLOGUE(); - tbb::task_list tl; - for ( size_t i = 0; i < NUM_ROOTS_IN_GROUP; ++i ) { - my_root_with_context_group_launcher_task &r = *new( tbb::task::allocate_root() ) my_root_with_context_group_launcher_task; - tl.push_back(r); - } - TRY(); - tbb::task::spawn_root_and_wait(tl); - CATCH_AND_ASSERT(); - ASSERT (no_exception, "unexpected exception intercepted"); - g_cur_stat.trace("stat at end of test :"); - if ( g_solitary_exception ) { - intptr num_tasks_expected = NUM_ROOTS_IN_GROUP * (1 + NUM_ROOT_TASKS * (1 + NUM_CHILD_TASKS)); - intptr min_num_tasks_executed = num_tasks_expected - NUM_ROOT_TASKS * (NUM_CHILD_TASKS + 1); - ASSERT (g_cur_stat.executed() >= min_num_tasks_executed, "Too few tasks executed"); - } - TEST_EPILOGUE(); -} // void Test5 () - -class my_throwing_root_with_context_launcher_task : public my_base_task -{ - tbb::task* do_execute () { - tbb::task_group_context ctx (tbb::task_group_context::bound); - my_simple_root_task &r = *new( allocate_root(ctx) ) my_simple_root_task(false); - TRY(); - spawn_root_and_wait(r); - CATCH(); - ASSERT (no_exception, "unexpected exception intercepted"); - throw_test_exception(NUM_CHILD_TASKS); - __TBB_Yield(); - g_task_was_cancelled |= is_cancelled(); - return NULL; - } -}; - -class my_bound_hierarchy_launcher_task : public my_base_task -{ - bool my_recover; - - void alloc_roots ( tbb::task_group_context& ctx, tbb::task_list& tl ) { - for ( size_t i = 0; i < NUM_ROOT_TASKS; ++i ) { - my_throwing_root_with_context_launcher_task &r = *new( allocate_root(ctx) ) my_throwing_root_with_context_launcher_task; - tl.push_back(r); - } - } - - tbb::task* do_execute () { - tbb::task_group_context ctx (tbb::task_group_context::isolated); - tbb::task_list tl; - alloc_roots(ctx, tl); - TRY(); - spawn_root_and_wait(tl); - CATCH_AND_ASSERT(); - ASSERT (!no_exception, "no exception occurred"); - ASSERT (!tl.empty(), "task list was cleared somehow"); - if ( g_solitary_exception ) - ASSERT (g_task_was_cancelled, "No tasks were cancelled despite of exception"); - if ( my_recover ) { - // Test task_group_context::unbind and task_group_context::reset methods - g_throw_exception = false; - no_exception = true; - tl.clear(); - alloc_roots(ctx, tl); - ctx.reset(); - try { - spawn_root_and_wait(tl); - } - catch (...) { - no_exception = false; - } - ASSERT (no_exception, "unexpected exception occurred"); - } - return NULL; - } -public: - my_bound_hierarchy_launcher_task ( bool recover = false ) : my_recover(recover) {} - -}; // class my_bound_hierarchy_launcher_task - -//! Test for bound contexts forming 2 level tree. Exception is thrown on the 1st (root) level. -/** Allocates and spawns a root that spawns a bunch of 2nd level roots sharing - the same isolated context, each of which in their turn spawns a single 3rd level - root with the bound context, and these 3rd level roots spawn bunches of leaves - in the end. Leaves do not generate exceptions. The test exception is generated - by one of the 2nd level roots. **/ -void Test6 () { - TEST_PROLOGUE(); - my_bound_hierarchy_launcher_task &r = *new( tbb::task::allocate_root() ) my_bound_hierarchy_launcher_task; - TRY(); - tbb::task::spawn_root_and_wait(r); - CATCH_AND_ASSERT(); - ASSERT (no_exception, "unexpected exception intercepted"); - g_cur_stat.trace("stat at end of test :"); - // After the first of the branches (my_throwing_root_with_context_launcher_task) completes, - // the rest of the task tree may be collapsed before having a chance to execute leaves. - // A number of branches running concurrently with the first one will be able to spawn leaves though. - /// \todo: If additional checkpoints are added to scheduler the following assertion must weaken - intptr num_tasks_expected = 1 + NUM_ROOT_TASKS * (2 + NUM_CHILD_TASKS); - intptr min_num_tasks_created = 1 + g_num_threads * 2 + NUM_CHILD_TASKS; - // 2 stands for my_bound_hierarchy_launcher_task and my_simple_root_task - // 1 corresponds to my_bound_hierarchy_launcher_task - intptr min_num_tasks_executed = 2 + 1 + NUM_CHILD_TASKS; - ASSERT (g_cur_stat.existed() <= num_tasks_expected, "Number of expected tasks is calculated incorrectly"); - ASSERT (g_cur_stat.existed() >= min_num_tasks_created, "Too few tasks created"); - ASSERT (g_cur_stat.executed() >= min_num_tasks_executed, "Too few tasks executed"); - TEST_EPILOGUE(); -} // void Test6 () - -//! Tests task_group_context::unbind and task_group_context::reset methods. -/** Allocates and spawns a root that spawns a bunch of 2nd level roots sharing - the same isolated context, each of which in their turn spawns a single 3rd level - root with the bound context, and these 3rd level roots spawn bunches of leaves - in the end. Leaves do not generate exceptions. The test exception is generated - by one of the 2nd level roots. **/ -void Test7 () { - TEST_PROLOGUE(); - my_bound_hierarchy_launcher_task &r = *new( tbb::task::allocate_root() ) my_bound_hierarchy_launcher_task; - TRY(); - tbb::task::spawn_root_and_wait(r); - CATCH_AND_ASSERT(); - ASSERT (no_exception, "unexpected exception intercepted"); - TEST_EPILOGUE(); -} // void Test6 () - -class my_bound_hierarchy_launcher_task_2 : public my_base_task -{ - tbb::task* do_execute () { - tbb::task_group_context ctx; - tbb::task_list tl; - for ( size_t i = 0; i < NUM_ROOT_TASKS; ++i ) { - my_root_with_context_launcher_task &r = *new( allocate_root(ctx) ) my_root_with_context_launcher_task(tbb::task_group_context::bound); - tl.push_back(r); - } - TRY(); - spawn_root_and_wait(tl); - CATCH_AND_ASSERT(); - // Exception must be intercepted by my_root_with_context_launcher_task - ASSERT (no_exception, "no exception occurred"); - return NULL; - } -}; // class my_bound_hierarchy_launcher_task_2 - - -//! Test for bound contexts forming 2 level tree. Exception is thrown in the 2nd (outer) level. -/** Allocates and spawns a root that spawns a bunch of 2nd level roots sharing - the same isolated context, each of which in their turn spawns a single 3rd level - root with the bound context, and these 3rd level roots spawn bunches of leaves - in the end. The test exception is generated by one of the leaves. **/ -void Test8 () { - TEST_PROLOGUE(); - my_bound_hierarchy_launcher_task_2 &r = *new( tbb::task::allocate_root() ) my_bound_hierarchy_launcher_task_2; - TRY(); - tbb::task::spawn_root_and_wait(r); - CATCH_AND_ASSERT(); - ASSERT (no_exception, "unexpected exception intercepted"); - g_cur_stat.trace("stat at end of test :"); - if ( g_solitary_exception ) { - intptr num_tasks_expected = 1 + NUM_ROOT_TASKS * (2 + NUM_CHILD_TASKS); - intptr min_num_tasks_created = 1 + g_num_threads * (2 + NUM_CHILD_TASKS); - intptr min_num_tasks_executed = num_tasks_expected - (NUM_CHILD_TASKS + 1); - ASSERT (g_cur_stat.existed() <= num_tasks_expected, "Number of expected tasks is calculated incorrectly"); - ASSERT (g_cur_stat.existed() >= min_num_tasks_created, "Too few tasks created"); - ASSERT (g_cur_stat.executed() >= min_num_tasks_executed, "Too few tasks executed"); - } - TEST_EPILOGUE(); -} // void Test8 () - - -class my_cancellation_root_task : public my_base_task -{ - tbb::task_group_context &my_ctx_to_cancel; - intptr my_cancel_threshold; - - tbb::task* do_execute () { - while ( g_cur_stat.executed() < my_cancel_threshold ) - __TBB_Yield(); - my_ctx_to_cancel.cancel_group_execution(); - g_exc_stat = g_cur_stat; - return NULL; - } -public: - my_cancellation_root_task ( tbb::task_group_context& ctx, intptr threshold ) - : my_ctx_to_cancel(ctx), my_cancel_threshold(threshold) - {} -}; - -class my_calculation_root_task : public my_base_task -{ - tbb::task_group_context &my_ctx; - - tbb::task* do_execute () { - tbb::task::spawn_root_and_wait( *new( tbb::task::allocate_root(my_ctx) ) my_simple_root_task ); - return NULL; - } -public: - my_calculation_root_task ( tbb::task_group_context& ctx ) : my_ctx(ctx) {} -}; - - -//! Test for cancelling a task hierarchy from outside (from a task running in parallel with it). -void Test9 () { - TEST_PROLOGUE(); - g_throw_exception = false; - g_tasks_wait_limit = g_num_threads - 1; - intptr threshold = NUM_CHILD_TASKS / 4; - tbb::task_group_context ctx; - tbb::task_list tl; - tl.push_back( *new( tbb::task::allocate_root() ) my_calculation_root_task(ctx) ); - tl.push_back( *new( tbb::task::allocate_root() ) my_cancellation_root_task(ctx, threshold) ); - TRY(); - tbb::task::spawn_root_and_wait(tl); - CATCH(); - ASSERT (no_exception, "Cancelling tasks should not cause any exceptions"); - // g_exc_stat contains statistics snapshot at the moment right after cancellation signal sending - REMARK ("Threshold %d; executed: after cancellation signal %d, total %d", threshold, g_exc_stat.executed(), g_cur_stat.executed()); - // 2 - root tasks in the calculation branch - //ASSERT_WARNING (g_exc_stat.executed() - threshold <= g_num_threads + 2, "too many tasks executed between reaching threshold and statistics cutoff"); - // 3 - all root tasks - ASSERT (g_cur_stat.executed() <= g_exc_stat.executed() + g_num_threads + 3, "Too many tasks were executed after cancellation"); - TEST_EPILOGUE(); -} // void Test9 () - - -//static tbb::atomic<int> g_int_exception_data_counter; - -template<typename T> -void throw_movable_exception ( intptr throw_threshold, const T& data ) { - if ( g_exception_in_master ^ (internal::Governor::local_scheduler() == g_master) ) - return; - if ( !g_solitary_exception ) { - REMARK ("About to throw one of multiple movable_exceptions... :"); - throw tbb::movable_exception<T>(data); - } - while ( g_cur_stat.existed() < throw_threshold ) - __TBB_Yield(); - if ( __TBB_CompareAndSwapW(&g_exception_thrown, 1, 0) == 0 ) { - g_exc_stat = g_cur_stat; - REMARK ("About to throw solitary movable_exception... :"); - throw tbb::movable_exception<T>(data); - } -} - -const int g_int_exception_data = -375; -const std::string g_string_exception_data = "My test string"; - -// Exception data class implementing minimal requirements of tbb::movable_exception -class my_exception_data_t { - const my_exception_data_t& operator = ( const my_exception_data_t& src ); - explicit my_exception_data_t ( int n ) : my_int(n), my_string(g_string_exception_data) {} -public: - my_exception_data_t ( const my_exception_data_t& src ) : my_int(src.my_int), my_string(src.my_string) {} - ~my_exception_data_t () {} - - int my_int; - std::string my_string; - - // Simple way to provide an instance when all initializing constructors are private - // and to avoid memory reclamation problems. - static my_exception_data_t s_data; -}; - -my_exception_data_t my_exception_data_t::s_data(g_int_exception_data); - -typedef tbb::movable_exception<int> solitary_movable_exception; -typedef tbb::movable_exception<my_exception_data_t> multiple_movable_exception; - -class my_leaf_task_with_movable_exceptions : public my_base_task -{ - bool my_int_as_data; - - tbb::task* do_execute () { - ++g_tasks_started; - if ( g_solitary_exception ) - throw_movable_exception<int>(NUM_CHILD_TASKS/2, g_int_exception_data); - else { - throw_movable_exception<my_exception_data_t>(NUM_CHILD_TASKS/2, my_exception_data_t::s_data); - } - return NULL; - } -}; - -//! Test for movable_exception behavior and semantics. -/** Allocates a root task that spawns a bunch of children, one or several of which throw - a movable exception in a worker or master thread (depending on the global settings). **/ -void Test10 () { - TEST_PROLOGUE(); - tbb::empty_task &r = *new( tbb::task::allocate_root() ) tbb::empty_task; - ASSERT (!g_cur_stat.existing() && !g_cur_stat.existed() && !g_cur_stat.executed(), - "something wrong with the task accounting"); - r.set_ref_count(NUM_CHILD_TASKS + 1); - for ( int i = 0; i < NUM_CHILD_TASKS; ++i ) { - my_leaf_task_with_movable_exceptions &t = *new( r.allocate_child() ) my_leaf_task_with_movable_exceptions; - r.spawn(t); - // Make sure that worker threads on multicore machines had a chance to steal something -// Harness::Sleep(20); -// __TBB_Yield(); - int n = 0; - while ( ++n < c_timeout && !g_tasks_started ) __TBB_Yield(); - if ( n == c_timeout ) - REMARK("Test10: wait failed\n"); - } - TRY() - r.wait_for_all(); - } catch ( tbb::tbb_exception& e ) { - ASSERT (strcmp(e.name(), (g_solitary_exception ? typeid(solitary_movable_exception) - : typeid(multiple_movable_exception)).name() ) == 0, - "Unexpected original exception name"); - ASSERT (strcmp(e.what(), "tbb::movable_exception") == 0, "Unexpected original exception info "); - if ( g_solitary_exception ) { - solitary_movable_exception& me = dynamic_cast<solitary_movable_exception&>(e); - ASSERT (me.data() == g_int_exception_data, "Unexpected solitary movable_exception data"); - } - else { - multiple_movable_exception& me = dynamic_cast<multiple_movable_exception&>(e); - ASSERT (me.data().my_int == g_int_exception_data, "Unexpected multiple movable_exception int data"); - ASSERT (me.data().my_string == g_string_exception_data, "Unexpected multiple movable_exception string data"); - } - if ( g_solitary_exception ) { - g_exc_stat.trace("stat at throw moment:"); - g_cur_stat.trace("stat upon catch :"); - } - g_no_exception = no_exception = false; - } - catch ( ... ) { - g_no_exception = false; - g_unknown_exception = unknown_exception = true; - } - r.destroy(r); - ASSERT_EXCEPTION(); - TEST_EPILOGUE(); -} // void Test10 () - - - -void TestExceptionHandling () -{ - REMARK ("Number of threads %d", g_num_threads); - - Test1(); - Test2(); - Test3(); - Test4(); - Test5(); - Test6(); - Test7(); - Test8(); - Test9(); - Test10(); -} - -#endif /* __TBB_EXCEPTIONS */ - -//------------------------------------------------------------------------ - -/** If min and max thread numbers specified on the command line are different, - the test is run only for 2 sizes of the thread pool (MinThread and MaxThread) - to be able to test the high and low contention modes while keeping the test reasonably fast **/ -int main(int argc, char* argv[]) { - ParseCommandLine( argc, argv ); - ASSERT (NUM_ROOTS_IN_GROUP < NUM_ROOT_TASKS, "Fix defines"); - MaxThread = std::min<int>(NUM_ROOTS_IN_GROUP, MaxThread); - MinThread = std::min<int>(MinThread, MaxThread); - ASSERT (MinThread>=2, "Minimal number of threads must be 2 or more"); -#if __TBB_EXCEPTIONS - // Test0 always runs with one thread - Test0(); - int step = max(MaxThread - MinThread, 1); - for ( g_num_threads = MinThread; g_num_threads <= MaxThread; g_num_threads += step ) { - g_max_concurrency = min(g_num_threads, tbb::task_scheduler_init::default_num_threads()); - for ( size_t j = 0; j < 2; ++j ) { - g_solitary_exception = (j & 2) == 1; - TestExceptionHandling(); - } - } - printf("done\n"); -#else - printf("skipped\n"); -#endif /* __TBB_EXCEPTIONS */ - return 0; -} - - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_enumerable_thread_specific.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_enumerable_thread_specific.cpp deleted file mode 100644 index 46e0edc433..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_enumerable_thread_specific.cpp +++ /dev/null @@ -1,635 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/enumerable_thread_specific.h" -#include "tbb/task_scheduler_init.h" -#include "tbb/parallel_for.h" -#include "tbb/parallel_reduce.h" -#include "tbb/blocked_range.h" -#include "tbb/tick_count.h" -#include "tbb/tbb_allocator.h" -#include "tbb/tbb_thread.h" - -#include <cstring> -#include <vector> -#include <deque> -#include <list> -#include <map> -#include <utility> - -#include "harness_assert.h" -#include "harness.h" - -static tbb::atomic<int> construction_counter; -static tbb::atomic<int> destruction_counter; - -const int REPETITIONS = 10; -const int N = 100000; -const int VALID_NUMBER_OF_KEYS = 100; -const double EXPECTED_SUM = (REPETITIONS + 1) * N; - -// -// A minimal class -// Define: default and copy constructor, and allow implicit operator& -// Hide: operator= -// - -class minimal: NoAssign { -private: - int my_value; -public: - minimal() : my_value(0) { ++construction_counter; } - minimal( const minimal &m ) : my_value(m.my_value) { ++construction_counter; } - ~minimal() { ++destruction_counter; } - void set_value( const int i ) { my_value = i; } - int value( ) const { return my_value; } -}; - -// -// A helper class that simplifies writing the tests since minimal does not -// define = or + operators. -// - -template< typename T > -struct test_helper { - static inline void init(T &e) { e = static_cast<T>(0); } - static inline void sum(T &e, const int addend ) { e += static_cast<T>(addend); } - static inline void sum(T &e, const double addend ) { e += static_cast<T>(addend); } - static inline void set(T &e, const int value ) { e = static_cast<T>(value); } - static inline double get(T &e ) { return static_cast<double>(e); } -}; - -template< > -struct test_helper<minimal> { - static inline void init(minimal &sum) { sum.set_value( 0 ); } - static inline void sum(minimal &sum, const int addend ) { sum.set_value( sum.value() + addend); } - static inline void sum(minimal &sum, const double addend ) { sum.set_value( sum.value() + static_cast<int>(addend)); } - static inline void sum(minimal &sum, const minimal &addend ) { sum.set_value( sum.value() + addend.value()); } - static inline void set(minimal &v, const int value ) { v.set_value( static_cast<int>(value) ); } - static inline double get(minimal &sum ) { return static_cast<double>(sum.value()); } -}; - - -template< typename T > -void run_serial_scalar_tests(const char *test_name) { - tbb::tick_count t0; - T sum; - test_helper<T>::init(sum); - - if (Verbose) printf("Testing serial %s... ", test_name); - for (int t = -1; t < REPETITIONS; ++t) { - if (Verbose && t == 0) t0 = tbb::tick_count::now(); - for (int i = 0; i < N; ++i) { - test_helper<T>::sum(sum,1); - } - } - - double result_value = test_helper<T>::get(sum); - ASSERT( EXPECTED_SUM == result_value, NULL); - if (Verbose) - printf("done\nserial %s, 0, %g, %g\n", test_name, result_value, ( tbb::tick_count::now() - t0).seconds()); -} - - -template <typename T> -class parallel_scalar_body: NoAssign { - - tbb::enumerable_thread_specific<T> &sums; - -public: - - parallel_scalar_body ( tbb::enumerable_thread_specific<T> &_sums ) : sums(_sums) { } - - void operator()( const tbb::blocked_range<int> &r ) const { - for (int i = r.begin(); i != r.end(); ++i) - test_helper<T>::sum( sums.local(), 1 ); - } - -}; - -template< typename T > -void run_parallel_scalar_tests(const char *test_name) { - - tbb::task_scheduler_init init(tbb::task_scheduler_init::deferred); - T exemplar; - test_helper<T>::init(exemplar); - - for (int p = MinThread; p <= MaxThread; ++p) { - - - if (p == 0) continue; - - if (Verbose) printf("Testing parallel %s on %d thread(s)... ", test_name, p); - init.initialize(p); - - tbb::tick_count t0; - - T iterator_sum; - test_helper<T>::init(iterator_sum); - - T const_iterator_sum; - test_helper<T>::init(const_iterator_sum); - - T range_sum; - test_helper<T>::init(range_sum); - - T const_range_sum; - test_helper<T>::init(const_range_sum); - - for (int t = -1; t < REPETITIONS; ++t) { - if (Verbose && t == 0) t0 = tbb::tick_count::now(); - - tbb::enumerable_thread_specific<T> sums(exemplar); - - ASSERT( sums.empty(), NULL); - tbb::parallel_for( tbb::blocked_range<int>( 0, N, 10000 ), parallel_scalar_body<T>( sums ) ); - ASSERT( !sums.empty(), NULL); - - // use iterator - typename tbb::enumerable_thread_specific<T>::size_type size = 0; - for ( typename tbb::enumerable_thread_specific<T>::iterator i = sums.begin(); i != sums.end(); ++i ) { - ++size; - test_helper<T>::sum(iterator_sum, *i); - } - ASSERT( sums.size() == size, NULL); - - // use const_iterator - for ( typename tbb::enumerable_thread_specific<T>::const_iterator i = sums.begin(); i != sums.end(); ++i ) { - test_helper<T>::sum(const_iterator_sum, *i); - } - - // use range_type - typename tbb::enumerable_thread_specific<T>::range_type r = sums.range(); - for ( typename tbb::enumerable_thread_specific<T>::range_type::const_iterator i = r.begin(); i != r.end(); ++i ) { - test_helper<T>::sum(range_sum, *i); - } - - // use const_range_type - typename tbb::enumerable_thread_specific<T>::const_range_type cr = sums.range(); - for ( typename tbb::enumerable_thread_specific<T>::const_range_type::iterator i = cr.begin(); i != cr.end(); ++i ) { - test_helper<T>::sum(const_range_sum, *i); - } - - } - - ASSERT( EXPECTED_SUM == test_helper<T>::get(iterator_sum), NULL); - ASSERT( EXPECTED_SUM == test_helper<T>::get(const_iterator_sum), NULL); - ASSERT( EXPECTED_SUM == test_helper<T>::get(range_sum), NULL); - ASSERT( EXPECTED_SUM == test_helper<T>::get(const_range_sum), NULL); - - if (Verbose) - printf("done\nparallel %s, %d, %g, %g\n", test_name, p, test_helper<T>::get(iterator_sum), - ( tbb::tick_count::now() - t0).seconds()); - init.terminate(); - } -} - - -template <typename T> -class parallel_vector_for_body: NoAssign { - - tbb::enumerable_thread_specific< std::vector<T, tbb::tbb_allocator<T> > > &locals; - -public: - - parallel_vector_for_body ( tbb::enumerable_thread_specific< std::vector<T, tbb::tbb_allocator<T> > > &_locals ) : locals(_locals) { } - - void operator()( const tbb::blocked_range<int> &r ) const { - T one; - test_helper<T>::set(one, 1); - - for (int i = r.begin(); i < r.end(); ++i) { - locals.local().push_back( one ); - } - } - -}; - -template <typename R, typename T> -struct parallel_vector_reduce_body { - - T sum; - size_t count; - - parallel_vector_reduce_body ( ) : count(0) { test_helper<T>::init(sum); } - parallel_vector_reduce_body ( parallel_vector_reduce_body<R, T> &, tbb::split ) : count(0) { test_helper<T>::init(sum); } - - void operator()( const R &r ) { - for (typename R::iterator ri = r.begin(); ri != r.end(); ++ri) { - const std::vector< T, tbb::tbb_allocator<T> > &v = *ri; - ++count; - for (typename std::vector<T, tbb::tbb_allocator<T> >::const_iterator vi = v.begin(); vi != v.end(); ++vi) { - test_helper<T>::sum(sum, *vi); - } - } - } - - void join( const parallel_vector_reduce_body &b ) { - test_helper<T>::sum(sum,b.sum); - count += b.count; - } - -}; - -template< typename T > -void run_parallel_vector_tests(const char *test_name) { - tbb::tick_count t0; - tbb::task_scheduler_init init(tbb::task_scheduler_init::deferred); - typedef std::vector<T, tbb::tbb_allocator<T> > container_type; - - for (int p = MinThread; p <= MaxThread; ++p) { - - if (p == 0) continue; - if (Verbose) printf("Testing parallel %s on %d thread(s)... ", test_name, p); - init.initialize(p); - - T sum; - test_helper<T>::init(sum); - - for (int t = -1; t < REPETITIONS; ++t) { - if (Verbose && t == 0) t0 = tbb::tick_count::now(); - typedef typename tbb::enumerable_thread_specific< container_type > ets_type; - ets_type vs; - - ASSERT( vs.empty(), NULL); - tbb::parallel_for ( tbb::blocked_range<int> (0, N, 10000), parallel_vector_for_body<T>( vs ) ); - ASSERT( !vs.empty(), NULL); - - parallel_vector_reduce_body< typename tbb::enumerable_thread_specific< std::vector< T, tbb::tbb_allocator<T> > >::const_range_type, T > pvrb; - tbb::parallel_reduce ( vs.range(1), pvrb ); - - test_helper<T>::sum(sum, pvrb.sum); - - ASSERT( vs.size() == pvrb.count, NULL); - - tbb::flattened2d<ets_type> fvs = flatten2d(vs); - size_t ccount = fvs.size(); - size_t elem_cnt = 0; - for(typename tbb::flattened2d<ets_type>::const_iterator i = fvs.begin(); i != fvs.end(); ++i) { - ++elem_cnt; - }; - ASSERT(ccount == elem_cnt, NULL); - - elem_cnt = 0; - for(typename tbb::flattened2d<ets_type>::iterator i = fvs.begin(); i != fvs.end(); ++i) { - ++elem_cnt; - }; - ASSERT(ccount == elem_cnt, NULL); - } - - double result_value = test_helper<T>::get(sum); - ASSERT( EXPECTED_SUM == result_value, NULL); - if (Verbose) - printf("done\nparallel %s, %d, %g, %g\n", test_name, p, result_value, ( tbb::tick_count::now() - t0).seconds()); - init.terminate(); - } -} - -template< typename T > -void run_serial_vector_tests(const char *test_name) { - tbb::tick_count t0; - T sum; - test_helper<T>::init(sum); - T one; - test_helper<T>::set(one, 1); - - if (Verbose) printf("Testing serial %s... ", test_name); - for (int t = -1; t < REPETITIONS; ++t) { - if (Verbose && t == 0) t0 = tbb::tick_count::now(); - std::vector<T, tbb::tbb_allocator<T> > v; - for (int i = 0; i < N; ++i) { - v.push_back( one ); - } - for (typename std::vector<T, tbb::tbb_allocator<T> >::const_iterator i = v.begin(); i != v.end(); ++i) - test_helper<T>::sum(sum, *i); - } - - double result_value = test_helper<T>::get(sum); - ASSERT( EXPECTED_SUM == result_value, NULL); - if (Verbose) - printf("done\nserial %s, 0, %g, %g\n", test_name, result_value, ( tbb::tick_count::now() - t0).seconds()); -} - -void -run_serial_tests() { - run_serial_scalar_tests<int>("int"); - run_serial_scalar_tests<double>("double"); - run_serial_scalar_tests<minimal>("minimal"); - run_serial_vector_tests<int>("std::vector<int, tbb::tbb_allocator<int> >"); - run_serial_vector_tests<double>("std::vector<double, tbb::tbb_allocator<double> >"); -} - -void -run_parallel_tests() { - run_parallel_scalar_tests<int>("int"); - run_parallel_scalar_tests<double>("double"); - run_parallel_scalar_tests<minimal>("minimal"); - run_parallel_vector_tests<int>("std::vector<int, tbb::tbb_allocator<int> >"); - run_parallel_vector_tests<double>("std::vector<double, tbb::tbb_allocator<double> >"); -} - -typedef tbb::enumerable_thread_specific<minimal> * minimal_ptr; - -class set_body { - minimal_ptr *a; - -public: - set_body( minimal_ptr *_a ) : a(_a) { } - - void operator() ( ) const { - for (int i = 0; i < VALID_NUMBER_OF_KEYS; ++i) { - a[i]->local().set_value(i + 1); - } - } - -}; - -void do_tbb_threads( int max_threads, minimal_ptr *a ) { - std::vector< tbb::tbb_thread * > threads; - - for (int p = 0; p < max_threads; ++p) { - threads.push_back( new tbb::tbb_thread ( set_body( a ) ) ); - } - - for (int p = 0; p < max_threads; ++p) { - threads[p]->join(); - } -} - -void -flog_key_creation_and_deletion() { - - const int FLOG_REPETITIONS = 100; - minimal_ptr a[VALID_NUMBER_OF_KEYS]; - tbb::task_scheduler_init init(tbb::task_scheduler_init::deferred); - - for (int p = MinThread; p <= MaxThread; ++p) { - - if (p == 0) continue; - - if (Verbose) printf("Testing repeated deletes on %d threads... ", p); - - for (int j = 0; j < FLOG_REPETITIONS; ++j) { - construction_counter = 0; - destruction_counter = 0; - - // causes VALID_NUMER_OF_KEYS exemplar instances to be constructed - for (int i = 0; i < VALID_NUMBER_OF_KEYS; ++i) { - a[i] = new tbb::enumerable_thread_specific<minimal>; - } - - // causes p * VALID_NUMBER_OF_KEYS minimals to be created - do_tbb_threads(p, a); - - for (int i = 0; i < VALID_NUMBER_OF_KEYS; ++i) { - for ( tbb::enumerable_thread_specific< minimal >::iterator tli = a[i]->begin(); - tli != a[i]->end(); ++tli ) { - ASSERT( (*tli).value() == i+1, NULL ); - } - delete a[i]; - a[i] = NULL; - } - } - - ASSERT( int(construction_counter) == (p+1)*VALID_NUMBER_OF_KEYS, NULL ); - ASSERT( int(destruction_counter) == (p+1)*VALID_NUMBER_OF_KEYS, NULL ); - - if (Verbose) printf("done\nTesting repeated clears on %d threads... ", p); - - construction_counter = 0; - destruction_counter = 0; - - // causes VALID_NUMER_OF_KEYS exemplar instances to be constructed - for (int i = 0; i < VALID_NUMBER_OF_KEYS; ++i) { - a[i] = new tbb::enumerable_thread_specific<minimal>; - } - - for (int j = 0; j < FLOG_REPETITIONS; ++j) { - - // causes p * VALID_NUMBER_OF_KEYS minimals to be created - do_tbb_threads(p, a); - - for (int i = 0; i < VALID_NUMBER_OF_KEYS; ++i) { - for ( tbb::enumerable_thread_specific< minimal >::iterator tli = a[i]->begin(); - tli != a[i]->end(); ++tli ) { - ASSERT( (*tli).value() == i+1, NULL ); - } - a[i]->clear(); - ASSERT( static_cast<int>(a[i]->end() - a[i]->begin()) == 0, NULL ); - } - - } - - for (int i = 0; i < VALID_NUMBER_OF_KEYS; ++i) { - delete a[i]; - a[i] = NULL; - } - - ASSERT( int(construction_counter) == (FLOG_REPETITIONS*p+1)*VALID_NUMBER_OF_KEYS, NULL ); - ASSERT( int(destruction_counter) == (FLOG_REPETITIONS*p+1)*VALID_NUMBER_OF_KEYS, NULL ); - - if (Verbose) printf("done\n"); - } - -} - -template <typename inner_container> -void -flog_segmented_interator() { - - bool found_error = false; - typedef typename inner_container::value_type T; - typedef std::vector< inner_container > nested_vec; - inner_container my_inner_container; - my_inner_container.clear(); - nested_vec my_vec; - - // simple nested vector (neither level empty) - const int maxval = 10; - for(int i=0; i < maxval; i++) { - my_vec.push_back(my_inner_container); - for(int j = 0; j < maxval; j++) { - my_vec.at(i).push_back((T)(maxval * i + j)); - } - } - - tbb::internal::segmented_iterator<nested_vec, T> my_si(my_vec); - - T ii; - for(my_si=my_vec.begin(), ii=0; my_si != my_vec.end(); ++my_si, ++ii) { - if((*my_si) != ii) { - found_error = true; - if(Verbose) printf( "*my_si=%d\n", int(*my_si)); - } - } - - // outer level empty - my_vec.clear(); - for(my_si=my_vec.begin(); my_si != my_vec.end(); ++my_si) { - found_error = true; - } - - // inner levels empty - my_vec.clear(); - for(int i =0; i < maxval; ++i) { - my_vec.push_back(my_inner_container); - } - for(my_si = my_vec.begin(); my_si != my_vec.end(); ++my_si) { - found_error = true; - } - - // every other inner container is empty - my_vec.clear(); - for(int i=0; i < maxval; ++i) { - my_vec.push_back(my_inner_container); - if(i%2) { - for(int j = 0; j < maxval; ++j) { - my_vec.at(i).push_back((T)(maxval * (i/2) + j)); - } - } - } - for(my_si = my_vec.begin(), ii=0; my_si != my_vec.end(); ++my_si, ++ii) { - if((*my_si) != ii) { - found_error = true; - if(Verbose) printf("*my_si=%d, ii=%d\n", (int)(*my_si), (int)ii); - } - } - - tbb::internal::segmented_iterator<nested_vec, const T> my_csi(my_vec); - for(my_csi=my_vec.begin(), ii=0; my_csi != my_vec.end(); ++my_csi, ++ii) { - if((*my_csi) != ii) { - found_error = true; - if(Verbose) printf( "*my_csi=%d\n", int(*my_csi)); - } - } - - // outer level empty - my_vec.clear(); - for(my_csi=my_vec.begin(); my_csi != my_vec.end(); ++my_csi) { - found_error = true; - } - - // inner levels empty - my_vec.clear(); - for(int i =0; i < maxval; ++i) { - my_vec.push_back(my_inner_container); - } - for(my_csi = my_vec.begin(); my_csi != my_vec.end(); ++my_csi) { - found_error = true; - } - - // every other inner container is empty - my_vec.clear(); - for(int i=0; i < maxval; ++i) { - my_vec.push_back(my_inner_container); - if(i%2) { - for(int j = 0; j < maxval; ++j) { - my_vec.at(i).push_back((T)(maxval * (i/2) + j)); - } - } - } - for(my_csi = my_vec.begin(), ii=0; my_csi != my_vec.end(); ++my_csi, ++ii) { - if((*my_csi) != ii) { - found_error = true; - if(Verbose) printf("*my_csi=%d, ii=%d\n", (int)(*my_csi), (int)ii); - } - } - - - if(found_error) printf("segmented_iterator failed\n"); -} - -template <typename Key, typename Val> -void -flog_segmented_iterator_map() { - typedef typename std::map<Key, Val> my_map; - typedef std::vector< my_map > nested_vec; - my_map my_inner_container; - my_inner_container.clear(); - nested_vec my_vec; - my_vec.clear(); - bool found_error = false; - - // simple nested vector (neither level empty) - const int maxval = 4; - for(int i=0; i < maxval; i++) { - my_vec.push_back(my_inner_container); - for(int j = 0; j < maxval; j++) { - my_vec.at(i).insert(std::make_pair<Key,Val>(maxval * i + j, 2*(maxval*i + j))); - } - } - - tbb::internal::segmented_iterator<nested_vec, std::pair<const Key, Val> > my_si(my_vec); - Key ii; - for(my_si=my_vec.begin(), ii=0; my_si != my_vec.end(); ++my_si, ++ii) { - if(((*my_si).first != ii) || ((*my_si).second != 2*ii)) { - found_error = true; - if(Verbose) printf( "ii=%d, (*my_si).first=%d, second=%d\n",ii, int((*my_si).first), int((*my_si).second)); - } - } - - tbb::internal::segmented_iterator<nested_vec, const std::pair<const Key, Val> > my_csi(my_vec); - for(my_csi=my_vec.begin(), ii=0; my_csi != my_vec.end(); ++my_csi, ++ii) { - if(((*my_csi).first != ii) || ((*my_csi).second != 2*ii)) { - found_error = true; - if(Verbose) printf( "ii=%d, (*my_csi).first=%d, second=%d\n",ii, int((*my_csi).first), int((*my_csi).second)); - } - } -} - -void -run_segmented_iterator_tests() { - // only the following containers can be used with the segmented iterator. - if(Verbose) printf("Running Segmented Iterator Tests\n"); - flog_segmented_interator<std::vector< int > >(); - flog_segmented_interator<std::vector< double > >(); - flog_segmented_interator<std::deque< int > >(); - flog_segmented_interator<std::deque< double > >(); - flog_segmented_interator<std::list< int > >(); - flog_segmented_interator<std::list< double > >(); - - flog_segmented_iterator_map<int, int>(); - flog_segmented_iterator_map<int, double>(); -} - -int main(int argc, char *argv[]) { - ParseCommandLine(argc, argv); - run_segmented_iterator_tests(); - - flog_key_creation_and_deletion(); - - if (MinThread == 0) - run_serial_tests(); - - if (MaxThread > 0) - run_parallel_tests(); - - printf("done\n"); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_halt.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_halt.cpp deleted file mode 100644 index b8f9c794c7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_halt.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include <cstdio> -#include <cstdlib> -#include <cassert> -#include <utility> -#include "tbb/task.h" -#include "tbb/task_scheduler_init.h" -#include "tbb/tick_count.h" -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" -#include "tbb/mutex.h" -#include "tbb/spin_mutex.h" -#include "tbb/queuing_mutex.h" -#include "harness.h" - -using namespace std; -using namespace tbb; - -///////////////////// Parallel methods //////////////////////// - -// *** Serial shared by mutexes *** // -int SharedI = 1, SharedN; -template<typename M> -class SharedSerialFibBody: NoAssign { - M &mutex; -public: - SharedSerialFibBody( M &m ) : mutex( m ) {} - //! main loop - void operator()( const blocked_range<int>& /*range*/ ) const { - for(;;) { - typename M::scoped_lock lock( mutex ); - if(SharedI >= SharedN) break; - volatile double sum = 7.3; - sum *= 11.17; - ++SharedI; - } - } -}; - -//! Root function -template<class M> -void SharedSerialFib(int n) -{ - SharedI = 1; - SharedN = n; - M mutex; - parallel_for( blocked_range<int>(0,4,1), SharedSerialFibBody<M>( mutex ) ); -} - -/////////////////////////// Main //////////////////////////////////////////////////// - -double Tsum = 0; int Tnum = 0; - -typedef void (*MeasureFunc)(int); -//! Measure ticks count in loop [2..n] -void Measure(const char *name, MeasureFunc func, int n) -{ - tick_count t0; - tick_count::interval_t T; - if( Verbose ) - printf("%s",name); - t0 = tick_count::now(); - for(int number = 2; number <= n; number++) - func(number); - T = tick_count::now() - t0; - double avg = Tnum? Tsum/Tnum : 1; - if (avg == 0.0) avg = 1; - if(avg * 100 < T.seconds()) { - printf("Warning: halting detected (%g sec, av: %g)\n", T.seconds(), avg); - ASSERT(avg * 1000 > T.seconds(), "Too long halting period"); - } else { - Tsum += T.seconds(); Tnum++; - } - if( Verbose ) - printf("\t- in %f msec\n", T.seconds()*1000); -} - -//! program entry -int main( int argc, char* argv[] ) { - MaxThread = 8; MinThread = 2; - ParseCommandLine( argc, argv ); - int NumbersCount = 100; - short recycle = 100; - - do { - for(int threads = 2; threads <= MaxThread; threads++) - { - task_scheduler_init scheduler_init(threads); - if( Verbose ) - printf("Threads number is %d\t", threads); - Measure("Shared serial (wrapper mutex)\t", SharedSerialFib<mutex>, NumbersCount); - //sum = Measure("Shared serial (spin_mutex)", SharedSerialFib<tbb::spin_mutex>, NumbersCount); - //sum = Measure("Shared serial (queuing_mutex)", SharedSerialFib<tbb::queuing_mutex>, NumbersCount); - } - } while(--recycle); - if(!Verbose) - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_handle_perror.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_handle_perror.cpp deleted file mode 100644 index ef49048b8b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_handle_perror.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Program for basic correctness of handle_perror, which is internal -// to the TBB shared library. - -#include <cerrno> -#include <stdexcept> -#include "tbb/tbb_misc.h" -#include "harness.h" - -static void TestHandlePerror() { - bool caught = false; - try { - tbb::internal::handle_perror( EAGAIN, "apple" ); - } catch( std::runtime_error& e ) { - if( Verbose ) - printf("caught runtime_exception('%s')\n",e.what()); - ASSERT( memcmp(e.what(),"apple: ",7)==0, NULL ); - ASSERT( strstr(e.what(),"unavailable")!=NULL, "bad error message?" ); - caught = true; - } - ASSERT(caught,NULL); -} - -int main( int argc, char* argv[] ) { - ParseCommandLine( argc, argv ); - TestHandlePerror(); - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_inits_loop.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_inits_loop.cpp deleted file mode 100644 index 88c52352c8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_inits_loop.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include <stdio.h> - -#if __APPLE__ - -#include "harness.h" -#include <cstdlib> -#include "tbb/task_scheduler_init.h" - -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> -#include <signal.h> -#include <errno.h> - -bool exec_test(const char *self) { - int status = 1; - pid_t p = fork(); - if(p < 0) { - printf("fork error: errno=%d: %s\n", errno, strerror(errno)); - return true; - } - else if(p) { // parent - if(waitpid(p, &status, 0) != p) { - printf("wait error: errno=%d: %s\n", errno, strerror(errno)); - return true; - } - if(WIFEXITED(status)) { - if(!WEXITSTATUS(status)) return false; // ok - else printf("child has exited with return code 0x%x\n", WEXITSTATUS(status)); - } else { - printf("child error 0x%x:%s%s ", status, WIFSIGNALED(status)?" signalled":"", - WIFSTOPPED(status)?" stopped":""); - if(WIFSIGNALED(status)) - printf("%s%s", sys_siglist[WTERMSIG(status)], WCOREDUMP(status)?" core dumped":""); - if(WIFSTOPPED(status)) - printf("with %d stop-code", WSTOPSIG(status)); - printf("\n"); - } - } - else { // child - // reproduces error much often - execl(self, self, "0", NULL); - printf("exec fails %s: %d: %s\n", self, errno, strerror(errno)); - exit(2); - } - return true; -} - -int main( int argc, char * argv[] ) { - MinThread = 3000; - ParseCommandLine( argc, argv ); - if( MinThread <= 0 ) { - tbb::task_scheduler_init init( 2 ); // even number required for an error - } else { - for(int i = 0; i<MinThread; i++) - if(exec_test(argv[0])) { - printf("ERROR: execution fails at %d-th iteration!\n", i); - exit(1); - } - - printf("done\n"); - } - return 0; -} - -#else - -int main() { - printf("skip\n"); - return 0; -} - -#endif /* __APPLE__ */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ittnotify.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ittnotify.cpp deleted file mode 100644 index 42dde9931f..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_ittnotify.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#if !TBB_USE_THREADING_TOOLS - #define TBB_USE_THREADING_TOOLS 1 -#endif - -#include "harness.h" - -#if DO_ITT_NOTIFY - -#include "tbb/spin_mutex.h" -#include "tbb/spin_rw_mutex.h" -#include "tbb/queuing_rw_mutex.h" -#include "tbb/queuing_mutex.h" -#include "tbb/mutex.h" -#include "tbb/recursive_mutex.h" -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" -#include "tbb/task_scheduler_init.h" -#include "harness_trace.h" - - -#include "../tbb/itt_notify.h" - - -template<typename M> -class WorkEmulator: NoAssign { - M& m_mutex; - static volatile size_t s_anchor; -public: - void operator()( tbb::blocked_range<size_t>& range ) const { - for( size_t i=range.begin(); i!=range.end(); ++i ) { - typename M::scoped_lock lock(m_mutex); - for ( size_t j = 0; j!=range.end(); ++j ) - s_anchor = (s_anchor - i) / 2 + (s_anchor + j) / 2; - } - } - WorkEmulator( M& mutex ) : m_mutex(mutex) {} -}; - -template<typename M> -volatile size_t WorkEmulator<M>::s_anchor = 0; - - -template<class M> -void Test( const char * name ) { - REMARK("%s time = ",name); - M mtx; - tbb::profiling::set_name(mtx, name); - - const int n = 10000; - tbb::parallel_for( tbb::blocked_range<size_t>(0,n,n/100), WorkEmulator<M>(mtx) ); -} - - #define TEST_MUTEX(type, name) Test<tbb::type>( name ) - -#endif /* !DO_ITT_NOTIFY */ - -int main( int argc, char * argv[] ) { - // Default is to run on two threads - MinThread = MaxThread = 2; - ParseCommandLine( argc, argv ); -#if DO_ITT_NOTIFY - for( int p=MinThread; p<=MaxThread; ++p ) { - REMARK( "testing with %d workers\n", p ); - tbb::task_scheduler_init init( p ); - TEST_MUTEX( spin_mutex, "Spin Mutex" ); - TEST_MUTEX( queuing_mutex, "Queuing Mutex" ); - TEST_MUTEX( queuing_rw_mutex, "Queuing RW Mutex" ); - TEST_MUTEX( spin_rw_mutex, "Spin RW Mutex" ); - } - std::printf("done\n"); -#else /* !DO_ITT_NOTIFY */ - std::printf("skip\n"); -#endif /* !DO_ITT_NOTIFY */ - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_compliance.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_compliance.cpp deleted file mode 100644 index 091112ddcd..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_compliance.cpp +++ /dev/null @@ -1,965 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -const int MByte = 1048576; //1MB - -/* _WIN32_WINNT should be defined at the very beginning, - because other headers might include <windows.h> -*/ -#if _WIN32 || _WIN64 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 -#include <windows.h> -#include <stdio.h> - -HANDLE hJob; - -void limitMem( int limit ) -{ - JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo; - jobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_PROCESS_MEMORY; - jobInfo.ProcessMemoryLimit = limit? limit*MByte : 2*1024LL*MByte; - if (NULL == hJob) { - if (NULL == (hJob = CreateJobObject(NULL, NULL))) { - printf("Can't assign create job object: %d\n", GetLastError()); - exit(1); - } - if (0 == AssignProcessToJobObject(hJob, GetCurrentProcess())) { - printf("Can't assign process to job object: %d\n", GetLastError()); - exit(1); - } - } - if (0 == SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, - &jobInfo, sizeof(jobInfo))) { - printf("Can't set limits: %d\n", GetLastError()); - exit(1); - } -} -#else -#include <sys/resource.h> -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> - -void limitMem( int limit ) -{ - rlimit rlim; - rlim.rlim_cur = limit? limit*MByte : (rlim_t)RLIM_INFINITY; - rlim.rlim_max = (rlim_t)RLIM_INFINITY; - int ret = setrlimit(RLIMIT_AS,&rlim); - if (0 != ret) { - printf("Can't set limits: errno %d\n", errno); - exit(1); - } -} -#endif - -#include <time.h> -#include <errno.h> -#include <vector> -#define __TBB_NO_IMPLICIT_LINKAGE 1 -#include "tbb/scalable_allocator.h" -#include "tbb/tbb_machine.h" - -#include "harness.h" -#include "harness_barrier.h" -#if __linux__ -#include <stdint.h> // uintptr_t -#endif -#if _WIN32 || _WIN64 -#include <malloc.h> // _aligned_(malloc|free|realloc) -#endif - -const size_t COUNT_ELEM_CALLOC = 2; -const int COUNT_TESTS = 1000; -const int COUNT_ELEM = 50000; -const size_t MAX_SIZE = 1000; -const int COUNTEXPERIMENT = 10000; - -const char strError[]="failed"; -const char strOk[]="done"; - -typedef unsigned int UINT; -typedef unsigned char UCHAR; -typedef unsigned long DWORD; -typedef unsigned char BYTE; - - -typedef void* TestMalloc(size_t size); -typedef void* TestCalloc(size_t num, size_t size); -typedef void* TestRealloc(void* memblock, size_t size); -typedef void TestFree(void* memblock); -typedef int TestPosixMemalign(void **memptr, size_t alignment, size_t size); -typedef void* TestAlignedMalloc(size_t size, size_t alignment); -typedef void* TestAlignedRealloc(void* memblock, size_t size, size_t alignment); -typedef void TestAlignedFree(void* memblock); - -TestMalloc* Tmalloc; -TestCalloc* Tcalloc; -TestRealloc* Trealloc; -TestFree* Tfree; -TestAlignedFree* Taligned_free; -// call alignment-related function via pointer and check result's alignment -int Tposix_memalign(void **memptr, size_t alignment, size_t size); -void* Taligned_malloc(size_t size, size_t alignment); -void* Taligned_realloc(void* memblock, size_t size, size_t alignment); - -// pointers to alignment-related functions used while testing -TestPosixMemalign* Rposix_memalign; -TestAlignedMalloc* Raligned_malloc; -TestAlignedRealloc* Raligned_realloc; - -bool error_occurred = false; - -const size_t POWERS_OF_2 = 20; - -#if __linux__ && __ia64__ -/* Can't use Intel compiler intrinsic due to internal error reported by - 10.1 compiler */ -pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER; - -int32_t __TBB_machine_fetchadd4__TBB_full_fence (volatile void *ptr, int32_t value) -{ - pthread_mutex_lock(&counter_mutex); - int32_t result = *(int32_t*)ptr; - *(int32_t*)ptr = result + value; - pthread_mutex_unlock(&counter_mutex); - return result; -} - -void __TBB_machine_pause(int32_t /*delay*/) {} - -#elif (_WIN32||_WIN64) && defined(_M_AMD64) - -void __TBB_machine_pause(__int32 /*delay*/ ) {} - -#endif - -struct MemStruct -{ - void* Pointer; - UINT Size; - - MemStruct() : Pointer(NULL), Size(0) {} - MemStruct(void* Pointer, UINT Size) : Pointer(Pointer), Size(Size) {} -}; - -class CMemTest: NoAssign -{ - UINT CountErrors; - int total_threads; - bool FullLog; - Harness::SpinBarrier *limitBarrier; - static bool firstTime; - -public: - CMemTest(int total_threads, Harness::SpinBarrier *limitBarrier, - bool isVerbose=false) : - CountErrors(0), total_threads(total_threads), limitBarrier(limitBarrier) - { - srand((UINT)time(NULL)); - FullLog=isVerbose; - rand(); - } - void InvariantDataRealloc(bool aligned); //realloc does not change data - void NULLReturn(UINT MinSize, UINT MaxSize); // NULL pointer + check errno - void UniquePointer(); // unique pointer - check with padding - void AddrArifm(); // unique pointer - check with pointer arithmetic - bool ShouldReportError(); - void Free_NULL(); // - void Zerofilling(); // check if arrays are zero-filled - void TestAlignedParameters(); - void RunAllTests(int total_threads); - ~CMemTest() {} -}; - -class Limit { - int limit; -public: - Limit(int limit) : limit(limit) {} - void operator() () const { - limitMem(limit); - } -}; - -int argC; -char** argV; - -struct RoundRobin: NoAssign { - const long number_of_threads; - mutable CMemTest test; - - RoundRobin( long p, Harness::SpinBarrier *limitBarrier, bool verbose ) : - number_of_threads(p), test(p, limitBarrier, verbose) {} - void operator()( int /*id*/ ) const - { - test.RunAllTests(number_of_threads); - } -}; - -bool CMemTest::firstTime = true; - -static void setSystemAllocs() -{ - Tmalloc=malloc; - Trealloc=realloc; - Tcalloc=calloc; - Tfree=free; -#if _WIN32 || _WIN64 - Raligned_malloc=_aligned_malloc; - Raligned_realloc=_aligned_realloc; - Taligned_free=_aligned_free; - Rposix_memalign=0; -#elif __APPLE__ || __sun // Max OS X and Solaris don't have posix_memalign - Raligned_malloc=0; - Raligned_realloc=0; - Taligned_free=0; - Rposix_memalign=0; -#else - Raligned_malloc=0; - Raligned_realloc=0; - Taligned_free=0; - Rposix_memalign=posix_memalign; -#endif -} - -// check that realloc works as free and as malloc -void ReallocParam() -{ - const int ITERS = 1000; - int i; - void *bufs[ITERS]; - - bufs[0] = Trealloc(NULL, 30*MByte); - ASSERT(bufs[0], "Can't get memory to start the test."); - - for (i=1; i<ITERS; i++) - { - bufs[i] = Trealloc(NULL, 30*MByte); - if (NULL == bufs[i]) - break; - } - ASSERT(i<ITERS, "Limits should be decreased for the test to work."); - - Trealloc(bufs[0], 0); - /* There is a race for the free space between different threads at - this point. So, have to run the test sequentially. - */ - bufs[0] = Trealloc(NULL, 30*MByte); - ASSERT(bufs[0], NULL); - - for (int j=0; j<i; j++) - Trealloc(bufs[j], 0); -} - -int main(int argc, char* argv[]) -{ - argC=argc; - argV=argv; - MaxThread = MinThread = 1; - Tmalloc=scalable_malloc; - Trealloc=scalable_realloc; - Tcalloc=scalable_calloc; - Tfree=scalable_free; - Rposix_memalign=scalable_posix_memalign; - Raligned_malloc=scalable_aligned_malloc; - Raligned_realloc=scalable_aligned_realloc; - Taligned_free=scalable_aligned_free; - - // check if we were called to test standard behavior - for (int i=1; i< argc; i++) { - if (strcmp((char*)*(argv+i),"-s")==0) - { - setSystemAllocs(); - argC--; - break; - } - } - - ParseCommandLine( argC, argV ); - //------------------------------------- -#if __APPLE__ - /* Skip due to lack of memory limit enforcing under Mac OS X. */ -#else - limitMem(200); - ReallocParam(); - limitMem(0); -#endif - for( int p=MaxThread; p>=MinThread; --p ) { - if( Verbose ) - printf("testing with %d threads\n", p ); - Harness::SpinBarrier *barrier = new Harness::SpinBarrier(p); - NativeParallelFor( p, RoundRobin(p, barrier, Verbose) ); - delete barrier; - } - if( !error_occurred ) printf("done\n"); - return 0; -} - -struct TestStruct -{ - DWORD field1:2; - DWORD field2:6; - double field3; - UCHAR field4[100]; - TestStruct* field5; -// std::string field6; - std::vector<int> field7; - double field8; - bool IzZero() - { - UCHAR *tmp; - tmp=(UCHAR*)this; - bool b=true; - for (int i=0; i<(int)sizeof(TestStruct); i++) - if (tmp[i]) b=false; - return b; - } -}; - -int Tposix_memalign(void **memptr, size_t alignment, size_t size) -{ - int ret = Rposix_memalign(memptr, alignment, size); - if (0 == ret) - ASSERT(0==((uintptr_t)*memptr & (alignment-1)), - "allocation result should be aligned"); - return ret; -} -void* Taligned_malloc(size_t size, size_t alignment) -{ - void *ret = Raligned_malloc(size, alignment); - if (0 != ret) - ASSERT(0==((uintptr_t)ret & (alignment-1)), - "allocation result should be aligned"); - return ret; -} -void* Taligned_realloc(void* memblock, size_t size, size_t alignment) -{ - void *ret = Raligned_realloc(memblock, size, alignment); - if (0 != ret) - ASSERT(0==((uintptr_t)ret & (alignment-1)), - "allocation result should be aligned"); - return ret; -} - -inline size_t choose_random_alignment() { - return sizeof(void*)<<(rand() % POWERS_OF_2); -} - -void CMemTest::InvariantDataRealloc(bool aligned) -{ - size_t size, sizeMin; - CountErrors=0; - if (FullLog) printf("\nInvariant data by realloc...."); - UCHAR* pchar; - sizeMin=size=rand()%MAX_SIZE+10; - pchar = aligned? - (UCHAR*)Taligned_realloc(NULL,size,choose_random_alignment()) - : (UCHAR*)Trealloc(NULL,size); - if (NULL == pchar) - return; - for (size_t k=0; k<size; k++) - pchar[k]=(UCHAR)k%255+1; - for (int i=0; i<COUNTEXPERIMENT; i++) - { - size=rand()%MAX_SIZE+10; - UCHAR *pcharNew = aligned? - (UCHAR*)Taligned_realloc(pchar,size, choose_random_alignment()) - : (UCHAR*)Trealloc(pchar,size); - if (NULL == pcharNew) - continue; - pchar = pcharNew; - sizeMin=size<sizeMin ? size : sizeMin; - for (size_t k=0; k<sizeMin; k++) - if (pchar[k] != (UCHAR)k%255+1) - { - CountErrors++; - if (ShouldReportError()) - { - printf("stand '%c', must stand '%c'\n",pchar[k],(UCHAR)k%255+1); - printf("error: data changed (at %llu, SizeMin=%llu)\n", - (long long unsigned)k,(long long unsigned)sizeMin); - } - } - } - if (aligned) - Taligned_realloc(pchar,0,choose_random_alignment()); - else - Trealloc(pchar,0); - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - //printf("end check\n"); -} - -void CMemTest::AddrArifm() -{ - int* MasPointer[COUNT_ELEM]; - size_t MasCountElem[COUNT_ELEM]; - size_t count; - int* tmpAddr; - int j; - UINT CountZero=0; - CountErrors=0; - if (FullLog) printf("\nUnique pointer using Address arithmetics\n"); - if (FullLog) printf("malloc...."); - for (int i=0; i<COUNT_ELEM; i++) - { - count=rand()%MAX_SIZE; - if (count == 0) - CountZero++; - tmpAddr=(int*)Tmalloc(count*sizeof(int)); - for (j=0; j<i; j++) // find a place for the new address - { - if (*(MasPointer+j)>tmpAddr) break; - } - for (int k=i; k>j; k--) - { - MasPointer[k]=MasPointer[k-1]; - MasCountElem[k]=MasCountElem[k-1]; - } - MasPointer[j]=tmpAddr; - MasCountElem[j]=count*sizeof(int);/**/ - } - if (FullLog) printf("Count zero: %d\n",CountZero); - for (int i=0; i<COUNT_ELEM-1; i++) - { - if (NULL!=MasPointer[i] && NULL!=MasPointer[i+1] - && (uintptr_t)MasPointer[i]+MasCountElem[i] > (uintptr_t)MasPointer[i+1]) - { - CountErrors++; - if (ShouldReportError()) printf("malloc: intersection detect at 0x%p between %llu element(int) and 0x%p\n", - (MasPointer+i),(long long unsigned)MasCountElem[i],(MasPointer+i+1)); - } - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - //---------------------------------------------------------------- - CountErrors=0; - if (FullLog) printf("realloc...."); - for (int i=0; i<COUNT_ELEM; i++) - { - count=MasCountElem[i]*2; - if (count == 0) - CountZero++; - tmpAddr=(int*)Trealloc(MasPointer[i],count); - if (NULL==tmpAddr && 0!=count) - Tfree(MasPointer[i]); - for (j=0; j<i; j++) // find a place for the new address - { - if (*(MasPointer+j)>tmpAddr) break; - } - for (int k=i; k>j; k--) - { - MasPointer[k]=MasPointer[k-1]; - MasCountElem[k]=MasCountElem[k-1]; - } - MasPointer[j]=tmpAddr; - MasCountElem[j]=count;//*sizeof(int);/**/ - } - if (FullLog) printf("Count zero: %d\n",CountZero); - - // now we have a sorted array of pointers - for (int i=0; i<COUNT_ELEM-1; i++) - { - if (NULL!=MasPointer[i] && NULL!=MasPointer[i+1] - && (uintptr_t)MasPointer[i]+MasCountElem[i] > (uintptr_t)MasPointer[i+1]) - { - CountErrors++; - if (ShouldReportError()) printf("realloc: intersection detect at 0x%p between %llu element(int) and 0x%p\n", - (MasPointer+i),(long long unsigned)MasCountElem[i],(MasPointer+i+1)); - } - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - for (int i=0; i<COUNT_ELEM; i++) - { - Tfree(MasPointer[i]); - } - //------------------------------------------- - CountErrors=0; - if (FullLog) printf("calloc...."); - for (int i=0; i<COUNT_ELEM; i++) - { - count=rand()%MAX_SIZE; - if (count == 0) - CountZero++; - tmpAddr=(int*)Tcalloc(count*sizeof(int),2); - for (j=0; j<i; j++) // find a place for the new address - { - if (*(MasPointer+j)>tmpAddr) break; - } - for (int k=i; k>j; k--) - { - MasPointer[k]=MasPointer[k-1]; - MasCountElem[k]=MasCountElem[k-1]; - } - MasPointer[j]=tmpAddr; - MasCountElem[j]=count*sizeof(int)*2;/**/ - } - if (FullLog) printf("Count zero: %d\n",CountZero); - - // now we have a sorted array of pointers - for (int i=0; i<COUNT_ELEM-1; i++) - { - if (NULL!=MasPointer[i] && NULL!=MasPointer[i+1] - && (uintptr_t)MasPointer[i]+MasCountElem[i] > (uintptr_t)MasPointer[i+1]) - { - CountErrors++; - if (ShouldReportError()) printf("calloc: intersection detect at 0x%p between %llu element(int) and 0x%p\n", - (MasPointer+i),(long long unsigned)MasCountElem[i],(MasPointer+i+1)); - } - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - for (int i=0; i<COUNT_ELEM; i++) - { - Tfree(MasPointer[i]); - } -} - -void CMemTest::Zerofilling() -{ - TestStruct* TSMas; - size_t CountElement; - CountErrors=0; - if (FullLog) printf("\nzeroings elements of array...."); - //test struct - for (int i=0; i<COUNTEXPERIMENT; i++) - { - CountElement=rand()%MAX_SIZE; - TSMas=(TestStruct*)Tcalloc(CountElement,sizeof(TestStruct)); - if (NULL == TSMas) - continue; - for (size_t j=0; j<CountElement; j++) - { - if (!TSMas->IzZero()) - { - CountErrors++; - if (ShouldReportError()) printf("detect nonzero element at TestStruct\n"); - } - } - Tfree(TSMas); - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; -} - -// As several threads concurrently trying to push to memory limits, adding to -// vectors may have intermittent failures. -void reliablePushBack(std::vector<MemStruct> *vec, const MemStruct &mStruct) -{ - for (int i=0; i<10000; i++) { - try { - vec->push_back(mStruct); - } catch(std::bad_alloc) { - continue; - } - return; - } - ASSERT(0, "Unable to get free memory."); -} - -void CMemTest::NULLReturn(UINT MinSize, UINT MaxSize) -{ - std::vector<MemStruct> PointerList; - void *tmp; - CountErrors=0; - int CountNULL; - if (FullLog) printf("\nNULL return & check errno:\n"); - UINT Size; - do { - Size=rand()%(MaxSize-MinSize)+MinSize; - tmp=Tmalloc(Size); - if (tmp != NULL) - { - memset(tmp, 0, Size); - reliablePushBack(&PointerList, MemStruct(tmp, Size)); - } - } while(tmp != NULL); - if (FullLog) printf("\n"); - - // preparation complete, now running tests - // malloc - if (FullLog) printf("malloc...."); - CountNULL = 0; - while (CountNULL==0) - for (int j=0; j<COUNT_TESTS; j++) - { - Size=rand()%(MaxSize-MinSize)+MinSize; - errno = ENOMEM+j+1; - tmp=Tmalloc(Size); - if (tmp == NULL) - { - CountNULL++; - if (errno != ENOMEM) { - CountErrors++; - if (ShouldReportError()) printf("NULL returned, error: errno (%d) != ENOMEM\n", errno); - } - } - else - { - // Technically, if malloc returns a non-NULL pointer, it is allowed to set errno anyway. - // However, on most systems it does not set errno. - bool known_issue = false; -#if __linux__ - if( errno==ENOMEM ) known_issue = true; -#endif /* __linux__ */ - if (errno != ENOMEM+j+1 && !known_issue) { - CountErrors++; - if (ShouldReportError()) printf("error: errno changed to %d though valid pointer was returned\n", errno); - } - memset(tmp, 0, Size); - reliablePushBack(&PointerList, MemStruct(tmp, Size)); - } - } - if (FullLog) printf("end malloc\n"); - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - - CountErrors=0; - //calloc - if (FullLog) printf("calloc...."); - CountNULL = 0; - while (CountNULL==0) - for (int j=0; j<COUNT_TESTS; j++) - { - Size=rand()%(MaxSize-MinSize)+MinSize; - errno = ENOMEM+j+1; - tmp=Tcalloc(COUNT_ELEM_CALLOC,Size); - if (tmp == NULL) - { - CountNULL++; - if (errno != ENOMEM) { - CountErrors++; - if (ShouldReportError()) printf("NULL returned, error: errno(%d) != ENOMEM\n", errno); - } - } - else - { - // Technically, if calloc returns a non-NULL pointer, it is allowed to set errno anyway. - // However, on most systems it does not set errno. - bool known_issue = false; -#if __linux__ - if( errno==ENOMEM ) known_issue = true; -#endif /* __linux__ */ - if (errno != ENOMEM+j+1 && !known_issue) { - CountErrors++; - if (ShouldReportError()) printf("error: errno changed to %d though valid pointer was returned\n", errno); - } - reliablePushBack(&PointerList, MemStruct(tmp, Size)); - } - } - if (FullLog) printf("end calloc\n"); - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - CountErrors=0; - if (FullLog) printf("realloc...."); - CountNULL = 0; - if (PointerList.size() > 0) - while (CountNULL==0) - for (size_t i=0; i<(size_t)COUNT_TESTS && i<PointerList.size(); i++) - { - errno = 0; - tmp=Trealloc(PointerList[i].Pointer,PointerList[i].Size*2); - if (PointerList[i].Pointer == tmp) // the same place - { - bool known_issue = false; -#if __linux__ - if( errno==ENOMEM ) known_issue = true; -#endif /* __linux__ */ - if (errno != 0 && !known_issue) { - CountErrors++; - if (ShouldReportError()) printf("valid pointer returned, error: errno not kept\n"); - } - PointerList[i].Size *= 2; - } - else if (tmp != PointerList[i].Pointer && tmp != NULL) // another place - { - bool known_issue = false; -#if __linux__ - if( errno==ENOMEM ) known_issue = true; -#endif /* __linux__ */ - if (errno != 0 && !known_issue) { - CountErrors++; - if (ShouldReportError()) printf("valid pointer returned, error: errno not kept\n"); - } - PointerList[i].Pointer = tmp; - PointerList[i].Size *= 2; - } - else if (tmp == NULL) - { - CountNULL++; - if (errno != ENOMEM) - { - CountErrors++; - if (ShouldReportError()) printf("NULL returned, error: errno(%d) != ENOMEM\n", errno); - } - // check data integrity - BYTE *zer=(BYTE*)PointerList[i].Pointer; - for (UINT k=0; k<PointerList[i].Size; k++) - if (zer[k] != 0) - { - CountErrors++; - if (ShouldReportError()) printf("NULL returned, error: data changed\n"); - } - } - } - if (FullLog) printf("realloc end\n"); - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - for (UINT i=0; i<PointerList.size(); i++) - { - Tfree(PointerList[i].Pointer); - } -} - - -void CMemTest::UniquePointer() -{ - CountErrors=0; - int* MasPointer[COUNT_ELEM]; - size_t MasCountElem[COUNT_ELEM]; - if (FullLog) printf("\nUnique pointer using 0\n"); - // - //------------------------------------------------------- - //malloc - for (int i=0; i<COUNT_ELEM; i++) - { - MasCountElem[i]=rand()%MAX_SIZE; - MasPointer[i]=(int*)Tmalloc(MasCountElem[i]*sizeof(int)); - if (NULL == MasPointer[i]) - MasCountElem[i]=0; - for (UINT j=0; j<MasCountElem[i]; j++) - *(MasPointer[i]+j)=0; - } - if (FullLog) printf("malloc...."); - for (UINT i=0; i<COUNT_ELEM-1; i++) - { - for (UINT j=0; j<MasCountElem[i]; j++) - { - if (*(*(MasPointer+i)+j)!=0) - { - CountErrors++; - if (ShouldReportError()) printf("error, detect 1 with 0x%p\n",(*(MasPointer+i)+j)); - } - *(*(MasPointer+i)+j)+=1; - } - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - //---------------------------------------------------------- - //calloc - for (int i=0; i<COUNT_ELEM; i++) - Tfree(MasPointer[i]); - CountErrors=0; - for (long i=0; i<COUNT_ELEM; i++) - { - MasPointer[i]=(int*)Tcalloc(MasCountElem[i]*sizeof(int),2); - if (NULL == MasPointer[i]) - MasCountElem[i]=0; - } - if (FullLog) printf("calloc...."); - for (int i=0; i<COUNT_ELEM-1; i++) - { - for (UINT j=0; j<*(MasCountElem+i); j++) - { - if (*(*(MasPointer+i)+j)!=0) - { - CountErrors++; - if (ShouldReportError()) printf("error, detect 1 with 0x%p\n",(*(MasPointer+i)+j)); - } - *(*(MasPointer+i)+j)+=1; - } - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - //--------------------------------------------------------- - //realloc - CountErrors=0; - for (int i=0; i<COUNT_ELEM; i++) - { - MasCountElem[i]*=2; - *(MasPointer+i)= - (int*)Trealloc(*(MasPointer+i),MasCountElem[i]*sizeof(int)); - if (NULL == MasPointer[i]) - MasCountElem[i]=0; - for (UINT j=0; j<MasCountElem[i]; j++) - *(*(MasPointer+i)+j)=0; - } - if (FullLog) printf("realloc...."); - for (int i=0; i<COUNT_ELEM-1; i++) - { - for (UINT j=0; j<*(MasCountElem+i); j++) - { - if (*(*(MasPointer+i)+j)!=0) - { - CountErrors++; - } - *(*(MasPointer+i)+j)+=1; - } - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; - for (int i=0; i<COUNT_ELEM; i++) - Tfree(MasPointer[i]); -} - -bool CMemTest::ShouldReportError() -{ - if (FullLog) - return true; - else - if (firstTime) { - firstTime = false; - return true; - } else - return false; -} - -void CMemTest::Free_NULL() -{ - CountErrors=0; - if (FullLog) printf("\ncall free with parameter NULL...."); - errno = 0; - for (int i=0; i<COUNTEXPERIMENT; i++) - { - Tfree(NULL); - if (errno != 0) - { - CountErrors++; - if (ShouldReportError()) printf("error is found by a call free with parameter NULL\n"); - } - } - if (CountErrors) printf("%s\n",strError); - else if (FullLog) printf("%s\n",strOk); - error_occurred |= ( CountErrors>0 ) ; -} - -void CMemTest::TestAlignedParameters() -{ - void *memptr; - int ret; - - if (Rposix_memalign) { - // alignment isn't power of 2 - for (int bad_align=3; bad_align<16; bad_align++) - if (bad_align&(bad_align-1)) { - ret = Tposix_memalign(NULL, bad_align, 100); - ASSERT(EINVAL==ret, NULL); - } - - memptr = &ret; - ret = Tposix_memalign(&memptr, 5*sizeof(void*), 100); - ASSERT(memptr == &ret, - "memptr should not be changed after unsuccesful call"); - ASSERT(EINVAL==ret, NULL); - - // alignment is power of 2, but not a multiple of sizeof(void *), - // we expect that sizeof(void*) > 2 - ret = Tposix_memalign(NULL, 2, 100); - ASSERT(EINVAL==ret, NULL); - } - if (Raligned_malloc) { - // alignment isn't power of 2 - for (int bad_align=3; bad_align<16; bad_align++) - if (bad_align&(bad_align-1)) { - memptr = Taligned_malloc(100, bad_align); - ASSERT(NULL==memptr, NULL); - ASSERT(EINVAL==errno, NULL); - } - - // size is zero - memptr = Taligned_malloc(0, 16); - ASSERT(NULL==memptr, "size is zero, so must return NULL"); - ASSERT(EINVAL==errno, NULL); - } - if (Taligned_free) { - // NULL pointer is OK to free - errno = 0; - Taligned_free(NULL); - /* As there is no return value for free, strictly speaking we can't - check errno here. But checked implementations obey the assertion. - */ - ASSERT(0==errno, NULL); - } - if (Raligned_realloc) { - for (int i=1; i<20; i++) { - // checks that calls work correctly in presence of non-zero errno - errno = i; - void *ptr = Taligned_malloc(i*10, 128); - ASSERT(NULL!=ptr, NULL); - ASSERT(0!=errno, NULL); - // if size is zero and pointer is not NULL, works like free - memptr = Taligned_realloc(ptr, 0, 64); - ASSERT(NULL==memptr, NULL); - ASSERT(0!=errno, NULL); - } - // alignment isn't power of 2 - for (int bad_align=3; bad_align<16; bad_align++) - if (bad_align&(bad_align-1)) { - void *ptr = &bad_align; - memptr = Taligned_realloc(&ptr, 100, bad_align); - ASSERT(NULL==memptr, NULL); - ASSERT(&bad_align==ptr, NULL); - ASSERT(EINVAL==errno, NULL); - } - } -} - -void CMemTest::RunAllTests(int total_threads) -{ - Limit limit_200M(200*total_threads), no_limit(0); - - Zerofilling(); - Free_NULL(); - InvariantDataRealloc(/*aligned=*/false); - if (Raligned_realloc) - InvariantDataRealloc(/*aligned=*/true); - TestAlignedParameters(); -#if __APPLE__ - printf("Warning: skipping some tests (known issue on Mac OS* X)\n"); -#else - UniquePointer(); - AddrArifm(); - limitBarrier->wait(limit_200M); - NULLReturn(1*MByte,100*MByte); - limitBarrier->wait(no_limit); -#endif - if (FullLog) printf("All tests ended\nclearing memory...."); -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_overload.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_overload.cpp deleted file mode 100644 index 24f9c084de..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_overload.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - - -#if __linux__ -#define MALLOC_REPLACEMENT_AVAILABLE 1 -#elif _WIN32 -#define MALLOC_REPLACEMENT_AVAILABLE 2 -#endif - -#if MALLOC_REPLACEMENT_AVAILABLE - -#include "harness_assert.h" -#include <stdlib.h> -#include <malloc.h> -#include <stdio.h> -#include <new> - -#if __linux__ -#include <dlfcn.h> -#include <unistd.h> // for sysconf -#include <stdint.h> // for uintptr_t -#elif _WIN32 -#include <stddef.h> -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -#include "tbb/tbbmalloc_proxy.h" -#endif - - -template<typename T> -static inline T alignDown(T arg, uintptr_t alignment) { - return T( (uintptr_t)arg & ~(alignment-1)); -} -template<typename T> -static inline bool isAligned(T arg, uintptr_t alignment) { - return 0==((uintptr_t)arg & (alignment-1)); -} - -/* Below is part of MemoryAllocator.cpp. */ - -/* - * The identifier to make sure that memory is allocated by scalable_malloc. - */ -const uint64_t theMallocUniqueID=0xE3C7AF89A1E2D8C1ULL; - -struct LargeObjectHeader { - void *unalignedResult; /* The base of the memory returned from getMemory, this is what is used to return this to the OS */ - size_t unalignedSize; /* The size that was requested from getMemory */ - uint64_t mallocUniqueID; /* The field to check whether the memory was allocated by scalable_malloc */ - size_t objectSize; /* The size originally requested by a client */ -}; - -/* - * Objects of this size and larger are considered large objects. - */ -const uint32_t minLargeObjectSize = 8065; - -/* end of inclusion from MemoryAllocator.cpp */ - -/* Correct only for arge blocks, i.e. not smaller then minLargeObjectSize */ -static bool scalableMallocLargeBlock(void *object, size_t size) -{ - ASSERT(size >= minLargeObjectSize, NULL); - - LargeObjectHeader *h = (LargeObjectHeader*)((uintptr_t)object-sizeof(LargeObjectHeader)); - return h->mallocUniqueID==theMallocUniqueID && h->objectSize==size; -} - -struct BigStruct { - char f[minLargeObjectSize]; -}; - -int main(int , char *[]) -{ - void *ptr, *ptr1; - -#if MALLOC_REPLACEMENT_AVAILABLE == 1 - if (NULL == dlsym(RTLD_DEFAULT, "scalable_malloc")) { - printf("libtbbmalloc not found\nfail\n"); - return 1; - } -#endif - - ptr = malloc(minLargeObjectSize); - ASSERT(ptr!=NULL && scalableMallocLargeBlock(ptr, minLargeObjectSize), NULL); - free(ptr); - - ptr = calloc(minLargeObjectSize, 2); - ASSERT(ptr!=NULL && scalableMallocLargeBlock(ptr, minLargeObjectSize*2), NULL); - ptr1 = realloc(ptr, minLargeObjectSize*10); - ASSERT(ptr1!=NULL && scalableMallocLargeBlock(ptr1, minLargeObjectSize*10), NULL); - free(ptr1); - -#if MALLOC_REPLACEMENT_AVAILABLE == 1 - - int ret = posix_memalign(&ptr, 1024, 3*minLargeObjectSize); - ASSERT(0==ret && ptr!=NULL && scalableMallocLargeBlock(ptr, 3*minLargeObjectSize), NULL); - free(ptr); - - ptr = memalign(128, 4*minLargeObjectSize); - ASSERT(ptr!=NULL && scalableMallocLargeBlock(ptr, 4*minLargeObjectSize), NULL); - free(ptr); - - ptr = valloc(minLargeObjectSize); - ASSERT(ptr!=NULL && scalableMallocLargeBlock(ptr, minLargeObjectSize), NULL); - free(ptr); - - long memoryPageSize = sysconf(_SC_PAGESIZE); - int sz = 1024*minLargeObjectSize; - ptr = pvalloc(sz); - ASSERT(ptr!=NULL && // align size up to the page size - scalableMallocLargeBlock(ptr, ((sz-1) | (memoryPageSize-1)) + 1), NULL); - free(ptr); - - struct mallinfo info = mallinfo(); - // right now mallinfo initialized by zero - ASSERT(!info.arena && !info.ordblks && !info.smblks && !info.hblks - && !info.hblkhd && !info.usmblks && !info.fsmblks - && !info.uordblks && !info.fordblks && !info.keepcost, NULL); - -#elif MALLOC_REPLACEMENT_AVAILABLE == 2 - - ptr = _aligned_malloc(minLargeObjectSize,16); - ASSERT(ptr!=NULL && scalableMallocLargeBlock(ptr, minLargeObjectSize), NULL); - - ptr1 = _aligned_realloc(ptr, minLargeObjectSize*10,16); - ASSERT(ptr1!=NULL && scalableMallocLargeBlock(ptr1, minLargeObjectSize*10), NULL); - _aligned_free(ptr1); - -#endif - - BigStruct *f = new BigStruct; - ASSERT(f!=NULL && scalableMallocLargeBlock(f, sizeof(BigStruct)), NULL); - delete f; - - f = new BigStruct[10]; - ASSERT(f!=NULL && scalableMallocLargeBlock(f, 10*sizeof(BigStruct)), NULL); - delete []f; - - f = new(std::nothrow) BigStruct; - ASSERT(f!=NULL && scalableMallocLargeBlock(f, sizeof(BigStruct)), NULL); - delete f; - - f = new(std::nothrow) BigStruct[2]; - ASSERT(f!=NULL && scalableMallocLargeBlock(f, 2*sizeof(BigStruct)), NULL); - delete []f; - - printf("done\n"); - return 0; -} - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -#include "harness.h" - -#else /* MALLOC_REPLACEMENT_AVAILABLE */ -#include <stdio.h> - -int main(int , char *[]) -{ - printf("skip\n"); -} -#endif /* MALLOC_REPLACEMENT_AVAILABLE */ diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_pure_c.c b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_pure_c.c deleted file mode 100644 index 5cbc56a785..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_pure_c.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#ifdef __cplusplus -#error For testing purpose, this file should be compiled with a C compiler, not C++ -#endif /*__cplusplus */ - -#include "tbb/scalable_allocator.h" -#include <stdio.h> -#include <assert.h> - -/* - * The test is to check if the scalable_allocator.h and its functions - * can be used from pure C programs; also some regression checks are done - */ - -int main(void) -{ - size_t i, j; - void *p1, *p2; - for( i=0; i<=1<<16; ++i) { - p1 = scalable_malloc(i); - if( !p1 ) - printf("Warning: there should be memory but scalable_malloc returned NULL\n"); - scalable_free(p1); - } - p1 = p2 = NULL; - for( i=1024*1024; ; i/=2 ) - { - scalable_free(p1); - p1 = scalable_realloc(p2, i); - p2 = scalable_calloc(i, 32); - if (p2) { - if (i<sizeof(size_t)) { - for (j=0; j<i; j++) - assert(0==*((char*)p2+j)); - } else { - for (j=0; j<i; j+=sizeof(size_t)) - assert(0==*((size_t*)p2+j)); - } - } - scalable_free(p2); - p2 = scalable_malloc(i); - if (i==0) break; - } - for( i=1; i<1024*1024; i*=2 ) - { - scalable_free(p1); - p1 = scalable_realloc(p2, i); - p2 = scalable_malloc(i); - } - scalable_free(p1); - scalable_free(p2); - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_regression.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_regression.cpp deleted file mode 100644 index c8277627c2..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_malloc_regression.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 - -#include <stdio.h> -#include "tbb/scalable_allocator.h" - -class minimalAllocFree { -public: - void operator()(int size) const { - tbb::scalable_allocator<char> a; - char* str = a.allocate( size ); - a.deallocate( str, size ); - } -}; - -#include "harness.h" - -template<typename Body, typename Arg> -void RunThread(const Body& body, const Arg& arg) { - NativeParallelForTask<Arg,Body> job(arg, body); - job.start(); - job.wait_to_finish(); -} - -#include "harness_memory.h" - -// The regression test for bug #1518 where thread boot strap allocations "leaked" -bool test_bootstrap_leak(void) { - // Check whether memory usage data can be obtained; if not, skip the test. - if( !GetMemoryUsage() ) - return true; - - /* In the bug 1518, each thread leaked ~384 bytes. - Initially, scalable allocator maps 1MB. Thus it is necessary to take out most of this space. - 1MB is chunked into 16K blocks; of those, one block is for thread boot strap, and one more - should be reserved for the test body. 62 blocks left, each can serve 15 objects of 1024 bytes. - */ - const int alloc_size = 1024; - const int take_out_count = 15*62; - - tbb::scalable_allocator<char> a; - char* array[take_out_count]; - for( int i=0; i<take_out_count; ++i ) - array[i] = a.allocate( alloc_size ); - - RunThread( minimalAllocFree(), alloc_size ); // for threading library to take some memory - size_t memory_in_use = GetMemoryUsage(); - // Wait for memory usage data to "stabilize". The test number (1000) has nothing underneath. - for( int i=0; i<1000; i++) { - if( GetMemoryUsage()!=memory_in_use ) { - memory_in_use = GetMemoryUsage(); - i = -1; - } - } - - // Notice that 16K boot strap memory block is enough to serve 42 threads. - const int num_thread_runs = 200; - for( int i=0; i<num_thread_runs; ++i ) - RunThread( minimalAllocFree(), alloc_size ); - - ptrdiff_t memory_leak = GetMemoryUsage() - memory_in_use; - if( memory_leak>0 ) { // possibly too strong? - printf( "Error: memory leak of up to %ld bytes\n", static_cast<long>(memory_leak)); - } - - for( int i=0; i<take_out_count; ++i ) - a.deallocate( array[i], alloc_size ); - - return memory_leak<=0; -} - -int main( int /*argc*/, char* argv[] ) { - bool passed = true; - - passed &= test_bootstrap_leak(); - - if(passed) printf("done\n"); - else printf("%s failed\n", argv[0]); - - return passed?0:1; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_model_plugin.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_model_plugin.cpp deleted file mode 100644 index e28ded0657..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_model_plugin.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#if _WIN32 || _WIN64 -#include <windows.h> -#else -#include <dlfcn.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include <stdexcept> - -#ifdef _USRDLL -#include "tbb/task_scheduler_init.h" - -class CModel { -public: - CModel(void) {}; - static tbb::task_scheduler_init tbb_init; - - void init_and_terminate( int ); -}; - -tbb::task_scheduler_init CModel::tbb_init(1); - -//! Test that task::initialize and task::terminate work when doing nothing else. -/** maxthread is treated as the "maximum" number of worker threads. */ -void CModel::init_and_terminate( int maxthread ) { - for( int i=0; i<200; ++i ) { - switch( i&3 ) { - default: { - tbb::task_scheduler_init init( rand() % maxthread + 1 ); - break; - } - case 0: { - tbb::task_scheduler_init init; - break; - } - case 1: { - tbb::task_scheduler_init init( tbb::task_scheduler_init::automatic ); - break; - } - case 2: { - tbb::task_scheduler_init init( tbb::task_scheduler_init::deferred ); - init.initialize( rand() % maxthread + 1 ); - init.terminate(); - break; - } - } - } -} - -extern "C" -#if _WIN32 || _WIN64 -__declspec(dllexport) -#endif -void plugin_call(int maxthread) -{ - srand(2); - try { - CModel model; - model.init_and_terminate(maxthread); - } catch( std::runtime_error& error ) { - printf("ERROR: %s\n", error.what()); - } -} - -#else /* _USRDLL undefined */ - -#define HARNESS_NO_ASSERT 1 -#include "harness.h" - -extern "C" void plugin_call(int); - -void report_error_in(const char* function_name) -{ -#if _WIN32 || _WIN64 - char* message; - int code = GetLastError(); - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, code,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (char*)&message, 0, NULL ); -#else - char* message = (char*)dlerror(); - int code = 0; -#endif - printf( "%s failed with error %d: %s\n", function_name, code, message); - -#if _WIN32 || _WIN64 - LocalFree(message); -#endif -} - -int use_lot_of_tls() { - int count = 0; -#if _WIN32 || _WIN64 - DWORD last_handles[10]; - DWORD result; - result = TlsAlloc(); - while( result!=TLS_OUT_OF_INDEXES ) { - last_handles[++count%10] = result; - result = TlsAlloc(); - } - for( int i=0; i<10; ++i ) - TlsFree(last_handles[i]); -#else - pthread_key_t last_handles[10]; - pthread_key_t result; - int setspecific_dummy=10; - while( pthread_key_create(&result, NULL)==0 - && count < 4096 ) // Sun Solaris doesn't have any built-in limit, so we set something big enough - { - last_handles[++count%10] = result; - if(Verbose) printf("%d\n", count); - pthread_setspecific(result,&setspecific_dummy); - } - for( int i=0; i<10; ++i ) - pthread_key_delete(last_handles[i]); -#endif - return count-10; -} - -typedef void (*PLUGIN_CALL)(int); - -int main(int argc, char* argv[]) -{ - ParseCommandLine( argc, argv ); - - PLUGIN_CALL my_plugin_call; - - int tls_key_count = use_lot_of_tls(); - if( Verbose ) - printf("%d thread local objects allocated in advance\n", tls_key_count); - - for( int i=1; i<100; ++i ) { -#if _WIN32 || _WIN64 - HMODULE hLib = LoadLibrary("test_model_plugin.dll"); - if (hLib==NULL){ -#if !__TBB_NO_IMPLICIT_LINKAGE - report_error_in("LoadLibrary"); - return -1; -#else - printf("skip\n"); - return 0; -#endif - } - my_plugin_call = (PLUGIN_CALL) GetProcAddress(hLib, "plugin_call"); - if (my_plugin_call==NULL) { - report_error_in("GetProcAddress"); - return -1; - } -#else -#if __APPLE__ - const char *dllname = "test_model_plugin.dylib"; -#else - const char *dllname = "test_model_plugin.so"; -#endif - void* hLib = dlopen( dllname, RTLD_LAZY ); - if (hLib==NULL){ -#if !__TBB_NO_IMPLICIT_LINKAGE - report_error_in("dlopen"); - return -1; -#else - printf("skip\n"); - return 0; -#endif - } - my_plugin_call = PLUGIN_CALL (dlsym(hLib, "plugin_call")); - if (my_plugin_call==NULL) { - report_error_in("dlsym"); - return -1; - } -#endif - - if( Verbose ) - printf("Iteration %d, calling plugin... ", i); - my_plugin_call(MaxThread); - if( Verbose ) - printf("succeeded\n"); - -#if _WIN32 || _WIN64 - FreeLibrary(hLib); -#else - dlclose(hLib); -#endif - } // end for(1,100) - - printf("done\n"); - return 0; -} - -#endif diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex.cpp deleted file mode 100644 index 2ac5d23c43..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex.cpp +++ /dev/null @@ -1,506 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -//------------------------------------------------------------------------ -// Test TBB mutexes when used with parallel_for.h -// -// Usage: test_Mutex.exe [-v] nthread -// -// The -v option causes timing information to be printed. -// -// Compile with _OPENMP and -openmp -//------------------------------------------------------------------------ -#include "tbb/spin_mutex.h" -#include "tbb/spin_rw_mutex.h" -#include "tbb/queuing_rw_mutex.h" -#include "tbb/queuing_mutex.h" -#include "tbb/mutex.h" -#include "tbb/recursive_mutex.h" -#include "tbb/null_mutex.h" -#include "tbb/null_rw_mutex.h" -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" -#include "tbb/tick_count.h" -#include "tbb/atomic.h" -#include "harness.h" -#include "harness_trace.h" -#include <cstdlib> -#include <cstdio> -#if _OPENMP -#include "test/OpenMP_Mutex.h" -#endif /* _OPENMP */ -#include "tbb/tbb_profiling.h" - -#ifndef TBBTEST_LOW_WORKLOAD - #define TBBTEST_LOW_WORKLOAD TBB_USE_THREADING_TOOLS -#endif - -// This test deliberately avoids a "using tbb" statement, -// so that the error of putting types in the wrong namespace will be caught. - -template<typename M> -struct Counter { - typedef M mutex_type; - M mutex; - volatile long value; -}; - -//! Function object for use with parallel_for.h. -template<typename C> -struct AddOne: NoAssign { - C& counter; - /** Increments counter once for each iteration in the iteration space. */ - void operator()( tbb::blocked_range<size_t>& range ) const { - for( size_t i=range.begin(); i!=range.end(); ++i ) { - if( i&1 ) { - // Try implicit acquire and explicit release - typename C::mutex_type::scoped_lock lock(counter.mutex); - counter.value = counter.value+1; - lock.release(); - } else { - // Try explicit acquire and implicit release - typename C::mutex_type::scoped_lock lock; - lock.acquire(counter.mutex); - counter.value = counter.value+1; - } - } - } - AddOne( C& counter_ ) : counter(counter_) {} -}; - -//! Generic test of a TBB mutex type M. -/** Does not test features specific to reader-writer locks. */ -template<typename M> -void Test( const char * name ) { - REMARK("%s time = ",name); - Counter<M> counter; - counter.value = 0; - tbb::profiling::set_name(counter.mutex, name); -#if TBBTEST_LOW_WORKLOAD - const int n = 10000; -#else - const int n = 100000; -#endif /* TBBTEST_LOW_WORKLOAD */ - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for(tbb::blocked_range<size_t>(0,n,n/10),AddOne<Counter<M> >(counter)); - tbb::tick_count t1 = tbb::tick_count::now(); - REMARK("%g usec\n",(t1-t0).seconds()); - if( counter.value!=n ) - std::printf("ERROR for %s: counter.value=%ld\n",name,counter.value); -} - -template<typename M, size_t N> -struct Invariant { - typedef M mutex_type; - M mutex; - const char* mutex_name; - volatile long value[N]; - volatile long single_value; - Invariant( const char* mutex_name_ ) : - mutex_name(mutex_name_) - { - single_value = 0; - for( size_t k=0; k<N; ++k ) - value[k] = 0; - tbb::profiling::set_name(mutex, mutex_name_); - } - void update() { - for( size_t k=0; k<N; ++k ) - ++value[k]; - } - bool value_is( long expected_value ) const { - long tmp; - for( size_t k=0; k<N; ++k ) - if( (tmp=value[k])!=expected_value ) { - printf("ERROR: %ld!=%ld\n", tmp, expected_value); - return false; - } - return true; - } - bool is_okay() { - return value_is( value[0] ); - } -}; - -//! Function object for use with parallel_for.h. -template<typename I> -struct TwiddleInvariant: NoAssign { - I& invariant; - /** Increments counter once for each iteration in the iteration space. */ - void operator()( tbb::blocked_range<size_t>& range ) const { - for( size_t i=range.begin(); i!=range.end(); ++i ) { - //! Every 8th access is a write access - bool write = (i%8)==7; - bool okay = true; - bool lock_kept = true; - if( (i/8)&1 ) { - // Try implicit acquire and explicit release - typename I::mutex_type::scoped_lock lock(invariant.mutex,write); - if( write ) { - long my_value = invariant.value[0]; - invariant.update(); - if( i%16==7 ) { - lock_kept = lock.downgrade_to_reader(); - if( !lock_kept ) - my_value = invariant.value[0] - 1; - okay = invariant.value_is(my_value+1); - } - } else { - okay = invariant.is_okay(); - if( i%8==3 ) { - long my_value = invariant.value[0]; - lock_kept = lock.upgrade_to_writer(); - if( !lock_kept ) - my_value = invariant.value[0]; - invariant.update(); - okay = invariant.value_is(my_value+1); - } - } - lock.release(); - } else { - // Try explicit acquire and implicit release - typename I::mutex_type::scoped_lock lock; - lock.acquire(invariant.mutex,write); - if( write ) { - long my_value = invariant.value[0]; - invariant.update(); - if( i%16==7 ) { - lock_kept = lock.downgrade_to_reader(); - if( !lock_kept ) - my_value = invariant.value[0] - 1; - okay = invariant.value_is(my_value+1); - } - } else { - okay = invariant.is_okay(); - if( i%8==3 ) { - long my_value = invariant.value[0]; - lock_kept = lock.upgrade_to_writer(); - if( !lock_kept ) - my_value = invariant.value[0]; - invariant.update(); - okay = invariant.value_is(my_value+1); - } - } - } - if( !okay ) { - std::printf( "ERROR for %s at %ld: %s %s %s %s\n",invariant.mutex_name, long(i), - write?"write,":"read,", write?(i%16==7?"downgrade,":""):(i%8==3?"upgrade,":""), - lock_kept?"lock kept,":"lock not kept,", (i/8)&1?"imp/exp":"exp/imp" ); - } - } - } - TwiddleInvariant( I& invariant_ ) : invariant(invariant_) {} -}; - -/** This test is generic so that we can test any other kinds of ReaderWriter locks we write later. */ -template<typename M> -void TestReaderWriterLock( const char * mutex_name ) { - REMARK( "%s readers & writers time = ", mutex_name ); - Invariant<M,8> invariant(mutex_name); -#if TBBTEST_LOW_WORKLOAD - const size_t n = 10000; -#else - const size_t n = 500000; -#endif /* TBBTEST_LOW_WORKLOAD */ - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for(tbb::blocked_range<size_t>(0,n,n/100),TwiddleInvariant<Invariant<M,8> >(invariant)); - tbb::tick_count t1 = tbb::tick_count::now(); - // There is either a writer or a reader upgraded to a writer for each 4th iteration - long expected_value = n/4; - if( !invariant.value_is(expected_value) ) - std::printf("ERROR for %s: final invariant value is wrong\n",mutex_name); - REMARK( "%g usec\n", (t1-t0).seconds() ); -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Suppress "conditional expression is constant" warning. - #pragma warning( push ) - #pragma warning( disable: 4127 ) -#endif - -/** Test try_acquire_reader functionality of a non-reenterable reader-writer mutex */ -template<typename M> -void TestTryAcquireReader_OneThread( const char * mutex_name ) { - M tested_mutex; - typename M::scoped_lock lock1; - if( M::is_rw_mutex ) { - if( lock1.try_acquire(tested_mutex, false) ) - lock1.release(); - else - std::printf("ERROR for %s: try_acquire failed though it should not\n", mutex_name); - { - typename M::scoped_lock lock2(tested_mutex, false); - if( lock1.try_acquire(tested_mutex) ) - std::printf("ERROR for %s: try_acquire succeeded though it should not\n", mutex_name); - lock2.release(); - lock2.acquire(tested_mutex, true); - if( lock1.try_acquire(tested_mutex, false) ) - std::printf("ERROR for %s: try_acquire succeeded though it should not\n", mutex_name); - } - if( lock1.try_acquire(tested_mutex, false) ) - lock1.release(); - else - std::printf("ERROR for %s: try_acquire failed though it should not\n", mutex_name); - } -} - -/** Test try_acquire functionality of a non-reenterable mutex */ -template<typename M> -void TestTryAcquire_OneThread( const char * mutex_name ) { - M tested_mutex; - typename M::scoped_lock lock1; - if( lock1.try_acquire(tested_mutex) ) - lock1.release(); - else - std::printf("ERROR for %s: try_acquire failed though it should not\n", mutex_name); - { - if( M::is_recursive_mutex ) { - typename M::scoped_lock lock2(tested_mutex); - if( lock1.try_acquire(tested_mutex) ) - lock1.release(); - else - std::printf("ERROR for %s: try_acquire on recursive lock failed though it should not\n", mutex_name); - //windows.. -- both are recursive - } else { - typename M::scoped_lock lock2(tested_mutex); - if( lock1.try_acquire(tested_mutex) ) - std::printf("ERROR for %s: try_acquire succeeded though it should not\n", mutex_name); - } - } - if( lock1.try_acquire(tested_mutex) ) - lock1.release(); - else - std::printf("ERROR for %s: try_acquire failed though it should not\n", mutex_name); -} - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif - -const int RecurN = 4; -int RecurArray[ RecurN ]; -tbb::recursive_mutex RecurMutex[ RecurN ]; - -struct RecursiveAcquisition { - /** x = number being decoded in base N - max_lock = index of highest lock acquired so far - mask = bit mask; ith bit set if lock i has been acquired. */ - void Body( size_t x, int max_lock=-1, unsigned int mask=0 ) const - { - int i = (int) (x % RecurN); - bool first = (mask&1U<<i)==0; - if( first ) { - // first time to acquire lock - if( i<max_lock ) - // out of order acquisition might lead to deadlock, so stop - return; - max_lock = i; - } - - if( (i&1)!=0 ) { - // acquire lock on location RecurArray[i] using explict acquire - tbb::recursive_mutex::scoped_lock r_lock; - r_lock.acquire( RecurMutex[i] ); - int a = RecurArray[i]; - ASSERT( (a==0)==first, "should be either a==0 if it is the first time to acquire the lock or a!=0 otherwise" ); - ++RecurArray[i]; - if( x ) - Body( x/RecurN, max_lock, mask|1U<<i ); - --RecurArray[i]; - ASSERT( a==RecurArray[i], "a is not equal to RecurArray[i]" ); - - // release lock on location RecurArray[i] using explicit release; otherwise, use implicit one - if( (i&2)!=0 ) r_lock.release(); - } else { - // acquire lock on location RecurArray[i] using implicit acquire - tbb::recursive_mutex::scoped_lock r_lock( RecurMutex[i] ); - int a = RecurArray[i]; - - ASSERT( (a==0)==first, "should be either a==0 if it is the first time to acquire the lock or a!=0 otherwise" ); - - ++RecurArray[i]; - if( x ) - Body( x/RecurN, max_lock, mask|1U<<i ); - --RecurArray[i]; - - ASSERT( a==RecurArray[i], "a is not equal to RecurArray[i]" ); - - // release lock on location RecurArray[i] using explicit release; otherwise, use implicit one - if( (i&2)!=0 ) r_lock.release(); - } - } - - void operator()( const tbb::blocked_range<size_t> &r ) const - { - for( size_t x=r.begin(); x<r.end(); x++ ) { - Body( x ); - } - } -}; - -/** This test is generic so that we may test other kinds of recursive mutexes.*/ -template<typename M> -void TestRecursiveMutex( const char * mutex_name ) -{ - for ( int i = 0; i < RecurN; ++i ) { - tbb::profiling::set_name(RecurMutex[i], mutex_name); - } - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::parallel_for(tbb::blocked_range<size_t>(0,10000,500), RecursiveAcquisition()); - tbb::tick_count t1 = tbb::tick_count::now(); - REMARK( "%s recursive mutex time = %g usec\n", mutex_name, (t1-t0).seconds() ); -} - -template<typename C> -struct NullRecursive: NoAssign { - void recurse_till( size_t i, size_t till ) const { - if( i==till ) { - counter.value = counter.value+1; - return; - } - if( i&1 ) { - typename C::mutex_type::scoped_lock lock2(counter.mutex); - recurse_till( i+1, till ); - lock2.release(); - } else { - typename C::mutex_type::scoped_lock lock2; - lock2.acquire(counter.mutex); - recurse_till( i+1, till ); - } - } - - void operator()( tbb::blocked_range<size_t>& range ) const { - typename C::mutex_type::scoped_lock lock(counter.mutex); - recurse_till( range.begin(), range.end() ); - } - NullRecursive( C& counter_ ) : counter(counter_) { - ASSERT( C::mutex_type::is_recursive_mutex, "Null mutex should be a recursive mutex." ); - } - C& counter; -}; - -template<typename M> -struct NullUpgradeDowngrade: NoAssign { - void operator()( tbb::blocked_range<size_t>& range ) const { - typename M::scoped_lock lock2; - for( size_t i=range.begin(); i!=range.end(); ++i ) { - if( i&1 ) { - typename M::scoped_lock lock1(my_mutex, true) ; - if( lock1.downgrade_to_reader()==false ) - std::printf("ERROR for %s: downgrade should always succeed\n", name); - } else { - lock2.acquire( my_mutex, false ); - if( lock2.upgrade_to_writer()==false ) - std::printf("ERROR for %s: upgrade should always succeed\n", name); - lock2.release(); - } - } - } - - NullUpgradeDowngrade( M& m_, const char* n_ ) : my_mutex(m_), name(n_) {} - M& my_mutex; - const char* name; -} ; - -template<typename M> -void TestNullMutex( const char * name ) { - Counter<M> counter; - counter.value = 0; - const int n = 100; - if( Verbose ) printf("%s ",name); - { - tbb::parallel_for(tbb::blocked_range<size_t>(0,n,10),AddOne<Counter<M> >(counter)); - } - counter.value = 0; - { - tbb::parallel_for(tbb::blocked_range<size_t>(0,n,10),NullRecursive<Counter<M> >(counter)); - } - -} - -template<typename M> -void TestNullRWMutex( const char * name ) { - if( Verbose ) printf("%s ",name); - const int n = 100; - M m; - tbb::parallel_for(tbb::blocked_range<size_t>(0,n,10),NullUpgradeDowngrade<M>(m, name)); -} - -#include "tbb/task_scheduler_init.h" - -int main( int argc, char * argv[] ) { - // Default is to run on two threads - MinThread = MaxThread = 2; - ParseCommandLine( argc, argv ); - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init( p ); - REMARK( "testing with %d workers\n", static_cast<int>(p) ); -#if TBBTEST_LOW_WORKLOAD - // The amount of work is decreased in this mode to bring the length - // of the runs under tools into the tolerable limits. - const int n = 1; -#else - const int n = 3; -#endif - // Run each test several times. - for( int i=0; i<n; ++i ) { - TestNullMutex<tbb::null_mutex>( "Null Mutex" ); - TestNullMutex<tbb::null_rw_mutex>( "Null RW Mutex" ); - TestNullRWMutex<tbb::null_rw_mutex>( "Null RW Mutex" ); - Test<tbb::spin_mutex>( "Spin Mutex" ); -#if _OPENMP - Test<OpenMP_Mutex>( "OpenMP_Mutex" ); -#endif /* _OPENMP */ - Test<tbb::queuing_mutex>( "Queuing Mutex" ); - Test<tbb::mutex>( "Wrapper Mutex" ); - Test<tbb::recursive_mutex>( "Recursive Mutex" ); - Test<tbb::queuing_rw_mutex>( "Queuing RW Mutex" ); - Test<tbb::spin_rw_mutex>( "Spin RW Mutex" ); - - TestTryAcquire_OneThread<tbb::spin_mutex>("Spin Mutex"); - TestTryAcquire_OneThread<tbb::queuing_mutex>("Queuing Mutex"); -#if USE_PTHREAD - // under ifdef because on Windows tbb::mutex is reenterable and the test will fail - TestTryAcquire_OneThread<tbb::mutex>("Wrapper Mutex"); -#endif /* USE_PTHREAD */ - TestTryAcquire_OneThread<tbb::recursive_mutex>( "Recursive Mutex" ); - TestTryAcquire_OneThread<tbb::spin_rw_mutex>("Spin RW Mutex"); // only tests try_acquire for writers - TestTryAcquire_OneThread<tbb::queuing_rw_mutex>("Queuing RW Mutex"); // only tests try_acquire for writers - TestTryAcquireReader_OneThread<tbb::spin_rw_mutex>("Spin RW Mutex"); - TestTryAcquireReader_OneThread<tbb::queuing_rw_mutex>("Queuing RW Mutex"); - - TestReaderWriterLock<tbb::queuing_rw_mutex>( "Queuing RW Mutex" ); - TestReaderWriterLock<tbb::spin_rw_mutex>( "Spin RW Mutex" ); - - TestRecursiveMutex<tbb::recursive_mutex>( "Recursive Mutex" ); - } - REMARK( "calling destructor for task_scheduler_init\n" ); - } - std::printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex_native_threads.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex_native_threads.cpp deleted file mode 100644 index dc75bc5b46..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_mutex_native_threads.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/spin_mutex.h" -#include "tbb/queuing_mutex.h" -#include "tbb/queuing_rw_mutex.h" -#include "tbb/spin_rw_mutex.h" -#include "tbb/tick_count.h" -#include "tbb/atomic.h" - -#include "harness.h" - -// This test deliberately avoids a "using tbb" statement, -// so that the error of putting types in the wrong namespace will be caught. - -template<typename M> -struct Counter { - typedef M mutex_type; - M mutex; - volatile long value; - void flog_once( size_t mode ); -}; - -template<typename M> -void Counter<M>::flog_once(size_t mode) -/** Increments counter once for each iteration in the iteration space. */ -{ - if( mode&1 ) { - // Try implicit acquire and explicit release - typename mutex_type::scoped_lock lock(mutex); - value = value+1; - lock.release(); - } else { - // Try explicit acquire and implicit release - typename mutex_type::scoped_lock lock; - lock.acquire(mutex); - value = value+1; - } -} - -template<typename M, long N> -struct Invariant { - typedef M mutex_type; - M mutex; - const char* mutex_name; - volatile long value[N]; - volatile long single_value; - Invariant( const char* mutex_name_ ) : - mutex_name(mutex_name_) - { - single_value = 0; - for( long k=0; k<N; ++k ) - value[k] = 0; - } - void update() { - for( long k=0; k<N; ++k ) - ++value[k]; - } - bool value_is( long expected_value ) const { - long tmp; - for( long k=0; k<N; ++k ) - if( (tmp=value[k])!=expected_value ) { - printf("ERROR: %ld!=%ld\n", tmp, expected_value); - return false; - } - return true; - } - bool is_okay() { - return value_is( value[0] ); - } - void flog_once( size_t mode ); -}; - -template<typename M, long N> -void Invariant<M,N>::flog_once( size_t mode ) -{ - //! Every 8th access is a write access - bool write = (mode%8)==7; - bool okay = true; - bool lock_kept = true; - if( (mode/8)&1 ) { - // Try implicit acquire and explicit release - typename mutex_type::scoped_lock lock(mutex,write); - if( write ) { - long my_value = value[0]; - update(); - if( mode%16==7 ) { - lock_kept = lock.downgrade_to_reader(); - if( !lock_kept ) - my_value = value[0] - 1; - okay = value_is(my_value+1); - } - } else { - okay = is_okay(); - if( mode%8==3 ) { - long my_value = value[0]; - lock_kept = lock.upgrade_to_writer(); - if( !lock_kept ) - my_value = value[0]; - update(); - okay = value_is(my_value+1); - } - } - lock.release(); - } else { - // Try explicit acquire and implicit release - typename mutex_type::scoped_lock lock; - lock.acquire(mutex,write); - if( write ) { - long my_value = value[0]; - update(); - if( mode%16==7 ) { - lock_kept = lock.downgrade_to_reader(); - if( !lock_kept ) - my_value = value[0] - 1; - okay = value_is(my_value+1); - } - } else { - okay = is_okay(); - if( mode%8==3 ) { - long my_value = value[0]; - lock_kept = lock.upgrade_to_writer(); - if( !lock_kept ) - my_value = value[0]; - update(); - okay = value_is(my_value+1); - } - } - } - if( !okay ) { - printf( "ERROR for %s at %ld: %s %s %s %s\n",mutex_name, long(mode), - write?"write,":"read,", write?(mode%16==7?"downgrade,":""):(mode%8==3?"upgrade,":""), - lock_kept?"lock kept,":"lock not kept,", (mode/8)&1?"imp/exp":"exp/imp" ); - } -} - -static tbb::atomic<size_t> Order; - -template<typename State, long TestSize> -struct Work: NoAssign { - static const size_t chunk = 100; - State& state; - Work( State& state_ ) : state(state_) {} - void operator()( int ) const { - size_t step; - while( (step=Order.fetch_and_add<tbb::acquire>(chunk))<TestSize ) - for( size_t i=0; i<chunk && step<TestSize; ++i, ++step ) - state.flog_once(step); - } -}; - -//! Generic test of a TBB Mutex type M. -/** Does not test features specific to reader-writer locks. */ -template<typename M> -void Test( const char * name, int nthread ) { - if( Verbose ) - printf("testing %s\n",name); - Counter<M> counter; - counter.value = 0; - Order = 0; - const long test_size = 100000; - tbb::tick_count t0 = tbb::tick_count::now(); - NativeParallelFor( nthread, Work<Counter<M>, test_size>(counter) ); - tbb::tick_count t1 = tbb::tick_count::now(); - - if( Verbose ) - printf("%s time = %g usec\n",name, (t1-t0).seconds() ); - if( counter.value!=test_size ) - printf("ERROR for %s: counter.value=%ld != %ld=test_size\n",name,counter.value,test_size); -} - - -//! Generic test of TBB ReaderWriterMutex type M -template<typename M> -void TestReaderWriter( const char * mutex_name, int nthread ) { - if( Verbose ) - printf("testing %s\n",mutex_name); - Invariant<M,8> invariant(mutex_name); - Order = 0; - static const long test_size = 1000000; - tbb::tick_count t0 = tbb::tick_count::now(); - NativeParallelFor( nthread, Work<Invariant<M,8>, test_size>(invariant) ); - tbb::tick_count t1 = tbb::tick_count::now(); - // There is either a writer or a reader upgraded to a writer for each 4th iteration - long expected_value = test_size/4; - if( !invariant.value_is(expected_value) ) - printf("ERROR for %s: final invariant value is wrong\n",mutex_name); - if( Verbose ) - printf("%s readers & writers time = %g usec\n",mutex_name,(t1-t0).seconds()); -} - -int main( int argc, char * argv[] ) { - ParseCommandLine( argc, argv ); - for( int p=MinThread; p<=MaxThread; ++p ) { - if( Verbose ) - printf( "testing with %d threads\n", p ); - Test<tbb::spin_mutex>( "spin_mutex", p ); - Test<tbb::queuing_mutex>( "queuing_mutex", p ); - Test<tbb::queuing_rw_mutex>( "queuing_rw_mutex", p ); - Test<tbb::spin_rw_mutex>( "spin_rw_mutex", p ); - TestReaderWriter<tbb::queuing_rw_mutex>( "queuing_rw_mutex", p ); - TestReaderWriter<tbb::spin_rw_mutex>( "spin_rw_mutex", p ); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_openmp.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_openmp.cpp deleted file mode 100644 index 5c85573169..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_openmp.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Test mixing OpenMP and TBB - -/* SCR #471 - Bellow is workaround to compile test within enviroment of Intel Compiler - but by Microsoft Compiler. So, there is wrong "omp.h" file included and - manifest section is missed from .exe file - restoring here. - */ -#if !defined(__INTEL_COMPILER) && _MSC_VER >= 1400 - #include <crtassem.h> - #if !defined(_OPENMP) - #define _OPENMP - #if defined(_DEBUG) - #pragma comment(lib, "vcompd") - #else // _DEBUG - #pragma comment(lib, "vcomp") - #endif // _DEBUG - #endif // _OPENMP - - #if defined(_DEBUG) - #if defined(_M_IX86) - #pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugOpenMP' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='x86' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") - #elif defined(_M_AMD64) - #pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugOpenMP' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='amd64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") - #elif defined(_M_IA64) - #pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugOpenMP' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='ia64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") - #endif - #else // _DEBUG - #if defined(_M_IX86) - #pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".OpenMP' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='x86' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") - #elif defined(_M_AMD64) - #pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".OpenMP' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='amd64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") - #elif defined(_M_IA64) - #pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".OpenMP' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='ia64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") - #endif - #endif // _DEBUG - #define _OPENMP_NOFORCE_MANIFEST -#endif - -#include <omp.h> - - -typedef short T; - -void SerialConvolve( T c[], const T a[], int m, const T b[], int n ) { - for( int i=0; i<m+n-1; ++i ) { - int start = i<n ? 0 : i-n+1; - int finish = i<m ? i+1 : m; - T sum = 0; - for( int j=start; j<finish; ++j ) - sum += a[j]*b[i-j]; - c[i] = sum; - } -} - -#include "tbb/blocked_range.h" -#include "tbb/parallel_for.h" -#include "tbb/parallel_reduce.h" -#include "tbb/task_scheduler_init.h" -#include "harness.h" - -using namespace tbb; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Suppress overzealous warning about short+=short - #pragma warning( push ) - #pragma warning( disable: 4244 ) -#endif - -class InnerBody: NoAssign { - const T* my_a; - const T* my_b; - const int i; -public: - T sum; - InnerBody( T /*c*/[], const T a[], const T b[], int i ) : - my_a(a), my_b(b), sum(0), i(i) - {} - InnerBody( InnerBody& x, split ) : - my_a(x.my_a), my_b(x.my_b), sum(0), i(x.i) - { - } - void join( InnerBody& x ) {sum += x.sum;} - void operator()( const blocked_range<int>& range ) { - for( int j=range.begin(); j!=range.end(); ++j ) - sum += my_a[j]*my_b[i-j]; - } -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif - -//! Test OpenMMP loop around TBB loop -void OpenMP_TBB_Convolve( T c[], const T a[], int m, const T b[], int n ) { - if( Verbose ) - printf("testing OpenMP loop around TBB loop\n"); -#pragma omp parallel - { - task_scheduler_init init; -#pragma omp for - for( int i=0; i<m+n-1; ++i ) { - int start = i<n ? 0 : i-n+1; - int finish = i<m ? i+1 : m; - InnerBody body(c,a,b,i); - parallel_reduce( blocked_range<int>(start,finish,10), body ); - c[i] = body.sum; - } - } -} - -class OuterBody: NoAssign { - const T* my_a; - const T* my_b; - T* my_c; - const int m; - const int n; -public: - T sum; - OuterBody( T c[], const T a[], int m_, const T b[], int n_ ) : - my_c(c), my_a(a), my_b(b), m(m_), n(n_) - {} - void operator()( const blocked_range<int>& range ) const { - for( int i=range.begin(); i!=range.end(); ++i ) { - int start = i<n ? 0 : i-n+1; - int finish = i<m ? i+1 : m; - T sum = 0; -#pragma omp parallel for reduction(+:sum) - for( int j=start; j<finish; ++j ) - sum += my_a[j]*my_b[i-j]; - my_c[i] = sum; - } - } -}; - -//! Test TBB loop around OpenMP loop -void TBB_OpenMP_Convolve( T c[], const T a[], int m, const T b[], int n ) { - if( Verbose ) - printf("testing TBB loop around OpenMP loop\n"); - parallel_for( blocked_range<int>(0,m+n-1,10), OuterBody( c, a, m, b, n ) ); -} - -#include <stdio.h> - -const int M = 17*17; -const int N = 13*13; - -int main( int argc, char* argv[] ) { -#ifdef _PGO_INSTRUMENT - printf("Warning: test_openmp.exe has problems if compiled with -prof-genx; skipping\n"); - return 0; -#endif - ParseCommandLine(argc,argv); - MinThread = 1; - for( int p=MinThread; p<=MaxThread; ++p ) { - T a[M]; - T b[N]; - for( int m=1; m<=M; m*=17 ) { - for( int n=1; n<=M; n*=13 ) { - for( int i=0; i<m; ++i ) a[i] = T(1+i/5); - for( int i=0; i<n; ++i ) b[i] = T(1+i/7); - T expected[M+N]; - SerialConvolve( expected, a, m, b, n ); - task_scheduler_init init(p); - T actual[M+N]; - for( int k = 0; k<2; ++k ) { - memset( actual, -1, sizeof(actual) ); - switch(k) { - case 0: - TBB_OpenMP_Convolve( actual, a, m, b, n ); - break; - case 1: - OpenMP_TBB_Convolve( actual, a, m, b, n ); - break; - } - for( int i=0; i<m+n-1; ++i ) { - ASSERT( actual[i]==expected[i], NULL ); - } - } - } - } - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_do.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_do.cpp deleted file mode 100644 index 8142fb2cab..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_do.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/parallel_do.h" -#include "tbb/task_scheduler_init.h" -#include "tbb/atomic.h" -#include "harness.h" -#include "harness_cpu.h" -#include <memory> - -#if defined(_MSC_VER) && defined(_Wp64) - // Workaround for overzealous compiler warnings in /Wp64 mode - #pragma warning (disable: 4267) -#endif /* _MSC_VER && _Wp64 */ - -#define N_DEPTHS 20 - -static tbb::atomic<int> g_values_counter; - -class value_t { - size_t x; - value_t& operator= ( const value_t& ); -public: - value_t ( size_t xx ) : x(xx) { ++g_values_counter; } - value_t ( const value_t& v ) : x(v.value()) { ++g_values_counter; } - ~value_t () { --g_values_counter; } - size_t value() const volatile { return x; } -}; - -template <class T> -class InputIterator { - value_t * my_ptr; -public: - typedef std::input_iterator_tag iterator_category; - typedef T value_type; - typedef typename std::allocator<T>::difference_type difference_type; - typedef typename std::allocator<T>::pointer pointer; - typedef typename std::allocator<T>::reference reference; - - InputIterator( value_t * ptr): my_ptr(ptr){} - - value_t& operator* () { return *my_ptr; } - - InputIterator& operator++ () { ++my_ptr; return *this; } - - bool operator== ( const InputIterator& r ) { return my_ptr == r.my_ptr; } -}; - -template <class T> -class ForwardIterator { - value_t * my_ptr; -public: - typedef std::forward_iterator_tag iterator_category; - typedef T value_type; - typedef typename std::allocator<T>::difference_type difference_type; - typedef typename std::allocator<T>::pointer pointer; - typedef typename std::allocator<T>::reference reference; - - ForwardIterator ( value_t * ptr ) : my_ptr(ptr){} - - ForwardIterator ( const ForwardIterator& r ) : my_ptr(r.my_ptr){} - - value_t& operator* () { return *my_ptr; } - - ForwardIterator& operator++ () { ++my_ptr; return *this; } - - bool operator== ( const ForwardIterator& r ) { return my_ptr == r.my_ptr; } -}; - -static size_t g_tasks_expected = 0; -static tbb::atomic<size_t> g_tasks_observed; - -size_t FindNumOfTasks ( size_t max_depth ) { - if( max_depth == 0 ) - return 1; - return max_depth * FindNumOfTasks( max_depth - 1 ) + 1; -} - -//! Simplest form of the parallel_do functor object. -class FakeTaskGeneratorBody { -public: - //! The simplest form of the function call operator - /** It does not allow adding new tasks during its execution. **/ - void operator() ( value_t depth ) const { - g_tasks_observed += FindNumOfTasks(depth.value()); - } -}; - -/** Work item is passed by reference here. **/ -class FakeTaskGeneratorBody_RefVersion { -public: - void operator() ( value_t& depth ) const { - g_tasks_observed += FindNumOfTasks(depth.value()); - } -}; - -/** Work item is passed by reference to const here. **/ -class FakeTaskGeneratorBody_ConstRefVersion { -public: - void operator() ( const value_t& depth ) const { - g_tasks_observed += FindNumOfTasks(depth.value()); - } -}; - -/** Work item is passed by reference to volatile here. **/ -class FakeTaskGeneratorBody_VolatileRefVersion { -public: - void operator() ( volatile value_t& depth, tbb::parallel_do_feeder<value_t>& ) const { - g_tasks_observed += FindNumOfTasks(depth.value()); - } -}; - -void do_work ( const value_t& depth, tbb::parallel_do_feeder<value_t>& feeder ) { - ++g_tasks_observed; - size_t d=depth.value(); - --d; - for( size_t i = 0; i < depth.value(); ++i) - feeder.add(value_t(d)); -} - -//! Standard form of the parallel_do functor object. -/** Allows adding new work items on the fly. **/ -class TaskGeneratorBody -{ -public: - //! This form of the function call operator can be used when the body needs to add more work during the processing - void operator() ( value_t depth, tbb::parallel_do_feeder<value_t>& feeder ) const { - do_work(depth, feeder); - } -private: - // Assert that parallel_do does not ever access body constructors - TaskGeneratorBody () {} - TaskGeneratorBody ( const TaskGeneratorBody& ); - // TestBody() needs access to the default constructor - template<class Body, class Iterator> friend void TestBody( size_t ); -}; // class TaskGeneratorBody - -/** Work item is passed by reference here. **/ -class TaskGeneratorBody_RefVersion -{ -public: - void operator() ( value_t& depth, tbb::parallel_do_feeder<value_t>& feeder ) const { - do_work(depth, feeder); - } -}; // class TaskGeneratorBody - -/** Work item is passed as const here. Compilers must ignore the const qualifier. **/ -class TaskGeneratorBody_ConstVersion -{ -public: - void operator() ( const value_t depth, tbb::parallel_do_feeder<value_t>& feeder ) const { - do_work(depth, feeder); - } -}; // class TaskGeneratorBody - -/** Work item is passed by reference to const here. **/ -class TaskGeneratorBody_ConstRefVersion -{ -public: - void operator() ( const value_t& depth, tbb::parallel_do_feeder<value_t>& feeder ) const { - do_work(depth, feeder); - } -}; // class TaskGeneratorBody - -/** Work item is passed by reference to volatile here. **/ -class TaskGeneratorBody_VolatileRefVersion -{ -public: - void operator() ( volatile value_t& depth, tbb::parallel_do_feeder<value_t>& feeder ) const { - do_work(const_cast<value_t&>(depth), feeder); - } -}; // class TaskGeneratorBody - -/** Work item is passed by reference to volatile here. **/ -class TaskGeneratorBody_ConstVolatileRefVersion -{ -public: - void operator() ( const volatile value_t& depth, tbb::parallel_do_feeder<value_t>& feeder ) const { - do_work(const_cast<value_t&>(depth), feeder); - } -}; // class TaskGeneratorBody - - -static value_t g_depths[N_DEPTHS] = {0, 1, 2, 3, 4, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 0, 1, 2}; - -template<class Body, class Iterator> -void TestBody ( size_t depth ) { - typedef typename std::iterator_traits<Iterator>::value_type value_type; - value_type a_depths[N_DEPTHS] = {0, 1, 2, 3, 4, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 0, 1, 2}; - Body body; - Iterator begin(a_depths); - Iterator end(a_depths + depth); - g_tasks_observed = 0; - tbb::parallel_do(begin, end, body); - ASSERT (g_tasks_observed == g_tasks_expected, NULL); -} - -template<class Iterator> -void TestIterator_RvalueOnly ( int /*nthread*/, size_t depth ) { - g_values_counter = 0; - TestBody<FakeTaskGeneratorBody, Iterator> (depth); - TestBody<FakeTaskGeneratorBody_ConstRefVersion, Iterator> (depth); - TestBody<TaskGeneratorBody, Iterator> (depth); - TestBody<TaskGeneratorBody_ConstVersion, Iterator> (depth); - TestBody<TaskGeneratorBody_ConstRefVersion, Iterator> (depth); -} - -template<class Iterator> -void TestIterator ( int nthread, size_t depth ) { - TestIterator_RvalueOnly<Iterator>(nthread, depth); - TestBody<FakeTaskGeneratorBody_RefVersion, Iterator> (depth); - TestBody<FakeTaskGeneratorBody_VolatileRefVersion, Iterator> (depth); - TestBody<TaskGeneratorBody_RefVersion, Iterator> (depth); - TestBody<TaskGeneratorBody_VolatileRefVersion, Iterator> (depth); - TestBody<TaskGeneratorBody_ConstVolatileRefVersion, Iterator> (depth); -} - -void Run( int nthread ) { - for( size_t depth = 0; depth <= N_DEPTHS; ++depth ) { - g_tasks_expected = 0; - for ( size_t i=0; i < depth; ++i ) - g_tasks_expected += FindNumOfTasks( g_depths[i].value() ); - // Test for iterators over values convertible to work item type - TestIterator_RvalueOnly<size_t*>(nthread, depth); - // Test for random access iterators - TestIterator<value_t*>(nthread, depth); - // Test for input iterators - TestIterator<InputIterator<value_t> >(nthread, depth); - // Test for forward iterators - TestIterator<ForwardIterator<value_t> >(nthread, depth); - } -} - -int main( int argc, char* argv[] ) { - MinThread=1; - MaxThread=2; - ParseCommandLine( argc, argv ); - if( MinThread<1 ) { - printf("number of threads must be positive\n"); - exit(1); - } - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init( p ); - Run(p); - // Test that all workers sleep when no work - TestCPUUserTime(p); - } - // This check must be performed after the scheduler terminated because only in this - // case there is a guarantee that the workers already destroyed their last tasks. - ASSERT( g_values_counter == 0, "Value objects were leaked" ); - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_for.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_for.cpp deleted file mode 100644 index 01b1e5f4b0..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_for.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Test for function template parallel_for.h - -#include "tbb/parallel_for.h" -#include "tbb/atomic.h" -#include "harness_assert.h" -#include "harness.h" - -static tbb::atomic<int> FooBodyCount; - -//! An range object whose only public members are those required by the Range concept. -template<size_t Pad> -class FooRange { - //! Start of range - int start; - - //! Size of range - int size; - FooRange( int start_, int size_ ) : start(start_), size(size_) { - zero_fill<char>(pad, Pad); - pad[Pad-1] = 'x'; - } - template<size_t Pad_> friend void Flog( int nthread ); - template<size_t Pad_> friend class FooBody; - void operator&(); - - char pad[Pad]; -public: - bool empty() const {return size==0;} - bool is_divisible() const {return size>1;} - FooRange( FooRange& original, tbb::split ) : size(original.size/2) { - original.size -= size; - start = original.start+original.size; - ASSERT( original.pad[Pad-1]=='x', NULL ); - pad[Pad-1] = 'x'; - } -}; - -//! An range object whose only public members are those required by the parallel_for.h body concept. -template<size_t Pad> -class FooBody { - static const int LIVE = 0x1234; - tbb::atomic<int>* array; - int state; - friend class FooRange<Pad>; - template<size_t Pad_> friend void Flog( int nthread ); - FooBody( tbb::atomic<int>* array_ ) : array(array_), state(LIVE) {} -public: - ~FooBody() { - --FooBodyCount; - for( size_t i=0; i<sizeof(*this); ++i ) - reinterpret_cast<char*>(this)[i] = -1; - } - //! Copy constructor - FooBody( const FooBody& other ) : array(other.array), state(other.state) { - ++FooBodyCount; - ASSERT( state==LIVE, NULL ); - } - void operator()( FooRange<Pad>& r ) const { - for( int k=0; k<r.size; ++k ) - array[r.start+k]++; - } -}; - -#include "tbb/tick_count.h" - -static const int N = 1000; -static tbb::atomic<int> Array[N]; - -template<size_t Pad> -void Flog( int nthread ) { - tbb::tick_count T0 = tbb::tick_count::now(); - for( int i=0; i<N; ++i ) { - for ( int mode = 0; mode < 4; ++mode) - { - FooRange<Pad> r( 0, i ); - const FooRange<Pad> rc = r; - FooBody<Pad> f( Array ); - const FooBody<Pad> fc = f; - memset( Array, 0, sizeof(Array) ); - FooBodyCount = 1; - switch (mode) { - case 0: - tbb::parallel_for( rc, fc ); - break; - case 1: - tbb::parallel_for( rc, fc, tbb::simple_partitioner() ); - break; - case 2: - tbb::parallel_for( rc, fc, tbb::auto_partitioner() ); - break; - case 3: { - static tbb::affinity_partitioner affinity; - tbb::parallel_for( rc, fc, affinity ); - } - break; - } - for( int j=0; j<i; ++j ) - ASSERT( Array[j]==1, NULL ); - for( int j=i; j<N; ++j ) - ASSERT( Array[j]==0, NULL ); - // Destruction of bodies might take a while, but there should be at most one body per thread - // at this point. - while( FooBodyCount>1 && FooBodyCount<=nthread ) - __TBB_Yield(); - ASSERT( FooBodyCount==1, NULL ); - } - } - tbb::tick_count T1 = tbb::tick_count::now(); - if( Verbose ) - printf("time=%g\tnthread=%d\tpad=%d\n",(T1-T0).seconds(),nthread,int(Pad)); -} - -#include <cstdio> -#include "tbb/task_scheduler_init.h" -#include "harness_cpu.h" - -int main( int argc, char* argv[] ) { - MinThread = 1; - ParseCommandLine(argc,argv); - if( MinThread<1 ) { - printf("number of threads must be positive\n"); - exit(1); - } - for( int p=MinThread; p<=MaxThread; ++p ) { - if( p>0 ) { - tbb::task_scheduler_init init( p ); - Flog<1>(p); - Flog<10>(p); - Flog<100>(p); - Flog<1000>(p); - Flog<10000>(p); - - // Test that all workers sleep when no work - TestCPUUserTime(p); - } - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_invoke.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_invoke.cpp deleted file mode 100644 index 842fb6b17c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_invoke.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/parallel_invoke.h" -#include "tbb/task_scheduler_init.h" -#include "tbb/atomic.h" -#include "tbb/tbb_exception.h" -#include "harness.h" -#include "harness_trace.h" -#include "harness_sleep.h" - -static const size_t MAX_NUMBER_OF_PINVOKE_ARGS = 10; -tbb::atomic<size_t> function_counter; - -// Some macros to make the test easier to read - -// 10 functions test0 ... test9 are defined -// pointer to each function is also defined - -#define TEST_FUNCTION(value) void test##value () \ -{ \ - ASSERT(!(function_counter & (1 << value)), "Test function has already been called"); \ - function_counter += 1 << value; \ -} \ -void (*test_pointer##value)(void) = &test##value; - -TEST_FUNCTION(0) -TEST_FUNCTION(1) -TEST_FUNCTION(2) -TEST_FUNCTION(3) -TEST_FUNCTION(4) -TEST_FUNCTION(5) -TEST_FUNCTION(6) -TEST_FUNCTION(7) -TEST_FUNCTION(8) -TEST_FUNCTION(9) - -// The same with functors -#define TEST_FUNCTOR(value) class test_functor##value \ -{ \ -public: \ - void operator() () const { \ - function_counter += 1 << value; \ - } \ -} functor##value; - -TEST_FUNCTOR(0) -TEST_FUNCTOR(1) -TEST_FUNCTOR(2) -TEST_FUNCTOR(3) -TEST_FUNCTOR(4) -TEST_FUNCTOR(5) -TEST_FUNCTOR(6) -TEST_FUNCTOR(7) -TEST_FUNCTOR(8) -TEST_FUNCTOR(9) - -#define INIT_TEST function_counter = 0; - -#define VALIDATE_INVOKE_RUN(number_of_args, test_type) \ - ASSERT( (size_t)function_counter == (size_t)(1 << number_of_args) - 1, "parallel_invoke called with " #number_of_args " arguments didn't process all " #test_type); - -// Calls parallel_invoke for different number of arguments -// It can be called with and without user context -template <typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, - typename F6, typename F7, typename F8, typename F9> -void call_parallel_invoke( size_t n, F0& f0, F1& f1, F2& f2, F3& f3, F4 &f4, F5 &f5, - F6& f6, F7 &f7, F8 &f8, F9 &f9, tbb::task_group_context* context) { - switch(n) { - default: - ASSERT(false, "number of arguments must be between 2 and 10"); - case 2: - if (context) - tbb::parallel_invoke (f0, f1, *context); - else - tbb::parallel_invoke (f0, f1); - break; - case 3: - if (context) - tbb::parallel_invoke (f0, f1, f2, *context); - else - tbb::parallel_invoke (f0, f1, f2); - break; - case 4: - if(context) - tbb::parallel_invoke (f0, f1, f2, f3, *context); - else - tbb::parallel_invoke (f0, f1, f2, f3); - break; - case 5: - if(context) - tbb::parallel_invoke (f0, f1, f2, f3, f4, *context); - else - tbb::parallel_invoke (f0, f1, f2, f3, f4); - break; - case 6: - if(context) - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, *context); - else - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5); - break; - case 7: - if(context) - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, *context); - else - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6); - break; - case 8: - if(context) - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, *context); - else - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7); - break; - case 9: - if(context) - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8, *context); - else - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8); - break; - case 10: - if(context) - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, *context); - else - tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9); - break; - } -} - -void test_parallel_invoke() -{ - REMARK (__FUNCTION__); - // Testing parallel_invoke with functions - for (int n = 2; n <=10; n++) - { - INIT_TEST; - call_parallel_invoke(n, test0, test1, test2, test3, test4, test5, test6, test7, test8, test9, NULL); - VALIDATE_INVOKE_RUN(n, "functions"); - } - - // Testing with pointers to functions - for (int n = 2; n <=10; n++) - { - INIT_TEST; - call_parallel_invoke(n, test_pointer0, test_pointer1, test_pointer2, test_pointer3, test_pointer4, - test_pointer5, test_pointer6, test_pointer7, test_pointer8, test_pointer9, NULL); - VALIDATE_INVOKE_RUN(n, "pointers to function"); - } - - // Testing parallel_invoke with functors - for (int n = 2; n <=10; n++) - { - INIT_TEST; - call_parallel_invoke(n, functor0, functor1, functor2, functor3, functor4, - functor5, functor6, functor7, functor8, functor9, NULL); - VALIDATE_INVOKE_RUN(n, "functors"); - } -} - -// Exception handling support test -// Some variables and macros to test exceptions -tbb::atomic<size_t> g_cur_executed; -volatile bool g_exception_occured = false; -volatile bool g_unknown_exception = false; -int g_max_concurrency = 0; -#define EXCEPTION_DESCR "Test exception" - -class test_exception : public std::exception -{ -public: - test_exception ( ) {} - - const char* what() const throw() { - REMARK ("About to throw test_exception... :"); - return EXCEPTION_DESCR; - } -}; - -volatile size_t exception_mask; // each bit represents whether the function should throw exception or not - -#define TRY() \ - try { -#define CATCH() \ - } catch ( tbb::captured_exception& e ) { \ - REMARK("tbb::captured_exception is caught"); \ - ASSERT (strcmp(e.what(), EXCEPTION_DESCR) == 0, "Unexpected original exception info"); \ - g_exception_occured = true; \ - } \ - catch ( ... ) { \ - g_exception_occured = true; \ - g_unknown_exception = true; \ - } - -#define ASSERT_EXCEPTION() \ - ASSERT (g_exception_occured, "no exception occurred"); \ - ASSERT (!g_unknown_exception, "unknown exception was caught"); - -#define CATCH_AND_ASSERT() \ - CATCH() \ - ASSERT_EXCEPTION() - -void reset_globals () { - INIT_TEST; - g_cur_executed = 0; - g_exception_occured = false; - g_unknown_exception = false; -} - -void throw_test_exception () { - throw test_exception(); -} - -// throws exception if corresponding exception_mask bit is set -#define TEST_FUNCTION_WITH_THROW(value) void test_with_throw##value () \ -{ \ - if (exception_mask & (1 << value)){ \ - throw_test_exception(); \ - }else{ \ - } \ -} - -TEST_FUNCTION_WITH_THROW(0) -TEST_FUNCTION_WITH_THROW(1) -TEST_FUNCTION_WITH_THROW(2) -TEST_FUNCTION_WITH_THROW(3) -TEST_FUNCTION_WITH_THROW(4) -TEST_FUNCTION_WITH_THROW(5) -TEST_FUNCTION_WITH_THROW(6) -TEST_FUNCTION_WITH_THROW(7) -TEST_FUNCTION_WITH_THROW(8) -TEST_FUNCTION_WITH_THROW(9) - -void test_exception_handling() -{ - REMARK (__FUNCTION__); - for( size_t n = 2; n <= 10; ++n ) { - for( exception_mask = 1; exception_mask < (size_t) (1 << n); ++exception_mask ) { - reset_globals(); - TRY(); - REMARK("Calling parallel_invoke, number of functions = %d, exeption_mask = %d\n", n, exception_mask); - call_parallel_invoke(n, test_with_throw0, test_with_throw1, test_with_throw2, test_with_throw3, - test_with_throw4, test_with_throw5, test_with_throw6, test_with_throw7, test_with_throw8, test_with_throw9, NULL); - CATCH_AND_ASSERT(); - } - } -} - -// Cancellaton support test - -class my_cancellator_task : public tbb::task -{ - tbb::task_group_context &my_ctx_to_cancel; - size_t my_cancel_threshold; - - tbb::task* execute () { - s_cancellator_ready = true; - while ( g_cur_executed < my_cancel_threshold ) - __TBB_Yield(); - my_ctx_to_cancel.cancel_group_execution(); - return NULL; - } -public: - my_cancellator_task ( tbb::task_group_context& ctx, size_t threshold ) - : my_ctx_to_cancel(ctx), my_cancel_threshold(threshold) - {} - static volatile bool s_cancellator_ready; -}; - -volatile bool my_cancellator_task::s_cancellator_ready = false; - -void function_to_cancel() { - ++g_cur_executed; - do { - Harness::Sleep(10); - __TBB_Yield(); - } while( !my_cancellator_task::s_cancellator_ready ); -} - -// The function is used to test cancellation -void simple_test_nothrow (){ - g_cur_executed++; -} - -class my_worker_pinvoke_task : public tbb::task -{ - tbb::task_group_context &my_ctx; - size_t my_number_of_functions; - size_t my_number_of_function_to_cancel; - void(*func_array[10])(void); - - tbb::task* execute () { - func_array[my_number_of_function_to_cancel] = &function_to_cancel; - call_parallel_invoke(my_number_of_functions, func_array[0], func_array[1], func_array[2], func_array[3], - func_array[4], func_array[5], func_array[6], func_array[7], func_array[8], func_array[9], &my_ctx); - return NULL; - } -public: - my_worker_pinvoke_task ( tbb::task_group_context& ctx, size_t number_of_functions, size_t number_of_function_to_cancel ) - : my_ctx(ctx), my_number_of_functions (number_of_functions), my_number_of_function_to_cancel(number_of_function_to_cancel) - { - for (int i = 0; i <=9; ++i) - func_array[i] = &simple_test_nothrow; - } -}; - -void test_cancellation(size_t number_of_functions, size_t number_of_function_to_cancel) -{ - REMARK (__FUNCTION__); - reset_globals(); - tbb::task_group_context ctx; - my_cancellator_task::s_cancellator_ready = false; - tbb::empty_task &r = *new( tbb::task::allocate_root(ctx) ) tbb::empty_task; - r.set_ref_count(3); - r.spawn( *new( r.allocate_child() ) my_cancellator_task(ctx, 1) ); - __TBB_Yield(); - r.spawn( *new( r.allocate_child() ) my_worker_pinvoke_task(ctx, number_of_functions, number_of_function_to_cancel) ); - TRY(); - r.wait_for_all(); - CATCH(); - r.destroy(r); - ASSERT (!g_exception_occured, "Cancelling tasks should not cause any exceptions"); -} - -//------------------------------------------------------------------------ -// Entry point -//------------------------------------------------------------------------ - -int main(int argc, char* argv[]) { - // Set default minimum number of threads - MinThread = 2; - ParseCommandLine( argc, argv ); - MinThread = min(MinThread, MaxThread); - ASSERT (MinThread>=1, "Minimal number of threads must be 1 or more"); - int step = max(MaxThread - MinThread, 1); - for ( int g_num_threads = MinThread; g_num_threads <= MaxThread; g_num_threads += step ) { - tbb::task_scheduler_init init( g_num_threads ); - g_max_concurrency = min(g_num_threads, tbb::task_scheduler_init::default_num_threads()); - test_parallel_invoke(); - if (g_num_threads > 1) { -#if __GLIBC__==2&&__GLIBC_MINOR__==3 - printf("Warning: Exception handling tests are skipped due to a known issue.\n"); -#else - test_exception_handling(); -#endif - for(int n = 2; n <=10; ++n) - for (int m = 0; m <= n - 1; ++m) - test_cancellation(n, m); - } - } - printf("done\n"); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_reduce.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_reduce.cpp deleted file mode 100644 index fb707277e7..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_reduce.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/parallel_reduce.h" -#include "tbb/atomic.h" -#include "harness_assert.h" - -using namespace std; - -static tbb::atomic<long> ForkCount; -static tbb::atomic<long> FooBodyCount; - -//! Class with public interface that is exactly minimal requirements for Range concept -class MinimalRange { - size_t begin, end; - friend class FooBody; - explicit MinimalRange( size_t i ) : begin(0), end(i) {} - friend void Flog( int nthread ); -public: - MinimalRange( MinimalRange& r, tbb::split ) : end(r.end) { - begin = r.end = (r.begin+r.end)/2; - } - bool is_divisible() const {return end-begin>=2;} - bool empty() const {return begin==end;} -}; - -//! Class with public interface that is exactly minimal requirements for Body of a parallel_reduce -class FooBody { -private: - FooBody( const FooBody& ); // Deny access - void operator=( const FooBody& ); // Deny access - friend void Flog( int nthread ); - //! Parent that created this body via split operation. NULL if original body. - FooBody* parent; - //! Total number of index values processed by body and its children. - size_t sum; - //! Number of join operations done so far on this body and its children. - long join_count; - //! Range that has been processed so far by this body and its children. - size_t begin, end; - //! True if body has not yet been processed at least once by operator(). - bool is_new; - //! 1 if body was created by split; 0 if original body. - int forked; - FooBody() {++FooBodyCount;} -public: - ~FooBody() { - forked = 0xDEADBEEF; - sum=0xDEADBEEF; - join_count=0xDEADBEEF; - --FooBodyCount; - } - FooBody( FooBody& other, tbb::split ) { - ++FooBodyCount; - ++ForkCount; - sum = 0; - parent = &other; - join_count = 0; - is_new = true; - forked = 1; - } - void join( FooBody& s ) { - ASSERT( s.forked==1, NULL ); - ASSERT( this!=&s, NULL ); - ASSERT( this==s.parent, NULL ); - ASSERT( end==s.begin, NULL ); - end = s.end; - sum += s.sum; - join_count += s.join_count + 1; - s.forked = 2; - } - void operator()( const MinimalRange& r ) { - for( size_t k=r.begin; k<r.end; ++k ) - ++sum; - if( is_new ) { - is_new = false; - begin = r.begin; - } else - ASSERT( end==r.begin, NULL ); - end = r.end; - } -}; - -#include <cstdio> -#include "harness.h" -#include "tbb/tick_count.h" - -void Flog( int nthread ) { - for (int mode = 0; mode < 4; mode++) { - tbb::tick_count T0 = tbb::tick_count::now(); - long join_count = 0; - tbb::affinity_partitioner ap; - for( size_t i=0; i<=1000; ++i ) { - FooBody f; - f.sum = 0; - f.parent = NULL; - f.join_count = 0; - f.is_new = true; - f.forked = 0; - f.begin = ~size_t(0); - f.end = ~size_t(0); - ASSERT( FooBodyCount==1, NULL ); - switch (mode) { - case 0: - tbb::parallel_reduce( MinimalRange(i), f ); - break; - case 1: - tbb::parallel_reduce( MinimalRange(i), f, tbb::simple_partitioner() ); - break; - case 2: - tbb::parallel_reduce( MinimalRange(i), f, tbb::auto_partitioner() ); - break; - case 3: - tbb::parallel_reduce( MinimalRange(i), f, ap ); - break; - } - join_count += f.join_count; - ASSERT( FooBodyCount==1, NULL ); - ASSERT( f.sum==i, NULL ); - ASSERT( f.begin==(i==0 ? ~size_t(0) : 0), NULL ); - ASSERT( f.end==(i==0 ? ~size_t(0) : i), NULL ); - } - tbb::tick_count T1 = tbb::tick_count::now(); - if( Verbose ) - printf("time=%g join_count=%ld ForkCount=%ld nthread=%d\n",(T1-T0).seconds(),join_count,long(ForkCount), nthread); - } -} - -#include "tbb/task_scheduler_init.h" -#include "harness_cpu.h" - -int main( int argc, char* argv[] ) { - // Set default number of threads - MinThread = MaxThread = 2; - ParseCommandLine( argc, argv ); - if( MinThread<0 ) { - printf("Usage: nthread must be positive\n"); - exit(1); - } - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init( p ); - Flog(p); - - // Test that all workers sleep when no work - TestCPUUserTime(p); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_scan.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_scan.cpp deleted file mode 100644 index c70cedb38c..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_scan.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/parallel_scan.h" -#include "tbb/blocked_range.h" -#include "harness_assert.h" - -typedef tbb::blocked_range<long> Range; - -static volatile bool ScanIsRunning = false; - -//! Sum of 0..i with wrap around on overflow. -inline int TriangularSum( int i ) { - return i&1 ? ((i>>1)+1)*i : (i>>1)*(i+1); -} - -//! Verify that sum is sum of integers in closed interval [start_index..finish_index]. -/** line should be the source line of the caller */ -static void VerifySum( long start_index, long finish_index, int sum, int line ); - -const int MAXN = 2000; - -enum AddendFlag { - UNUSED=0, - USED_NONFINAL=1, - USED_FINAL=2 -}; - -//! Array recording how each addend was used. -/** 'unsigned char' instead of AddendFlag for sake of compactness. */ -static unsigned char AddendHistory[MAXN]; - -//! Set to 1 for debugging output -#define PRINT_DEBUG 0 - -#include "tbb/atomic.h" -#if PRINT_DEBUG -#include <stdio.h> -tbb::atomic<long> NextBodyId; -#endif /* PRINT_DEBUG */ - -struct BodyId { -#if PRINT_DEBUG - const int id; - BodyId() : id(NextBodyId++) {} -#endif /* PRINT_DEBUG */ -}; - -tbb::atomic<long> NumberOfLiveAccumulator; - -static void Snooze( bool scan_should_be_running ) { - ASSERT( ScanIsRunning==scan_should_be_running, NULL ); -} - -template<typename T> -class Accumulator: BodyId { - T my_total; - const T* my_array; - T* my_sum; - Range my_range; - //! Equals this while object is fully constructed, NULL otherwise. - /** Used to detect premature destruction and accidental bitwise copy. */ - Accumulator* self; - Accumulator( const T array[], T sum[] ) : - my_total(), my_array(array), my_sum(sum), my_range(-1,-1,1) - { - ++NumberOfLiveAccumulator; - // Set self as last action of constructor, to indicate that object is fully constructed. - self = this; - } - friend void TestAccumulator( int mode, int nthread ); -public: -#if PRINT_DEBUG - void print() const { - printf("%d [%ld..%ld)\n", id,my_range.begin(),my_range.end() ); - } -#endif /* PRINT_DEBUG */ - ~Accumulator() { -#if PRINT_DEBUG - printf("%d [%ld..%ld) destroyed\n",id,my_range.begin(),my_range.end() ); -#endif /* PRINT_DEBUG */ - // Clear self as first action of destructor, to indicate that object is not fully constructed. - self = 0; - --NumberOfLiveAccumulator; - } - Accumulator( Accumulator& a, tbb::split ) : - my_total(0), my_array(a.my_array), my_sum(a.my_sum), my_range(-1,-1,1) - { - ++NumberOfLiveAccumulator; -#if PRINT_DEBUG - printf("%d forked from %d\n",id,a.id); -#endif /* PRINT_DEBUG */ - Snooze(true); - // Set self as last action of constructor, to indicate that object is fully constructed. - self = this; - } - template<typename Tag> - void operator()( const Range& r, Tag /*tag*/ ) { - Snooze(true); -#if PRINT_DEBUG - if( my_range.empty() ) - printf("%d computing %s [%ld..%ld)\n",id,Tag::is_final_scan()?"final":"lookahead",r.begin(),r.end() ); - else - printf("%d computing %s [%ld..%ld) [%ld..%ld)\n",id,Tag::is_final_scan()?"final":"lookahead",my_range.begin(),my_range.end(),r.begin(),r.end()); -#endif /* PRINT_DEBUG */ - ASSERT( !Tag::is_final_scan() || (my_range.begin()==0 && my_range.end()==r.begin()) || (my_range.empty() && r.begin()==0), NULL ); - for( long i=r.begin(); i<r.end(); ++i ) { - my_total += my_array[i]; - if( Tag::is_final_scan() ) { - ASSERT( AddendHistory[i]<USED_FINAL, "addend used 'finally' twice?" ); - AddendHistory[i] |= USED_FINAL; - my_sum[i] = my_total; - VerifySum( 0L, i, int(my_sum[i]), __LINE__ ); - } else { - ASSERT( AddendHistory[i]==UNUSED, "addend used too many times" ); - AddendHistory[i] |= USED_NONFINAL; - } - } - if( my_range.empty() ) - my_range = r; - else - my_range = Range(my_range.begin(), r.end(), 1 ); - Snooze(true); - ASSERT( self==this, "this Accumulator corrupted or prematurely destroyed" ); - } - void reverse_join( const Accumulator& left ) { -#if PRINT_DEBUG - printf("reverse join %d [%ld..%ld) %d [%ld..%ld)\n", - left.id,left.my_range.begin(),left.my_range.end(), - id,my_range.begin(),my_range.end()); -#endif /* PRINT_DEBUG */ - Snooze(true); - ASSERT( ScanIsRunning, NULL ); - ASSERT( left.my_range.end()==my_range.begin(), NULL ); - my_total += left.my_total; - my_range = Range( left.my_range.begin(), my_range.end(), 1 ); - ASSERT( ScanIsRunning, NULL ); - Snooze(true); - ASSERT( ScanIsRunning, NULL ); - ASSERT( self==this, NULL ); - ASSERT( left.self==&left, NULL ); - } - void assign( const Accumulator& other ) { - my_total = other.my_total; - my_range = other.my_range; - ASSERT( self==this, NULL ); - ASSERT( other.self==&other, "other Accumulator corrupted or prematurely destroyed" ); - } -}; - -#include "tbb/tick_count.h" -#include "harness.h" - -static void VerifySum( long start_index, long finish_index, int sum, int line ) { - int expected = TriangularSum( finish_index ) - TriangularSum( start_index ); - if( expected!=sum ) { - printf( "line %d: sum[%ld..%ld] should be = %d, but was computed as %d\n", - line, start_index, finish_index, expected, sum ); - abort(); - } -} - -void TestAccumulator( int mode, int nthread ) { - typedef int T; - T* addend = new T[MAXN]; - T* sum = new T[MAXN]; - for( long n=0; n<=MAXN; ++n ) { - for( long i=0; i<MAXN; ++i ) { - addend[i] = -1; - sum[i] = -2; - AddendHistory[i] = UNUSED; - } - for( long i=0; i<n; ++i ) - addend[i] = i; - Accumulator<T> acc( addend, sum ); - tbb::tick_count t0 = tbb::tick_count::now(); -#if PRINT_DEBUG - printf("--------- mode=%d range=[0..%ld)\n",mode,n); -#endif /* PRINT_DEBUG */ - ScanIsRunning = true; - - switch (mode) { - case 0: - tbb::parallel_scan( Range( 0, n, 1 ), acc ); - break; - case 1: - tbb::parallel_scan( Range( 0, n, 1 ), acc, tbb::simple_partitioner() ); - break; - case 2: - tbb::parallel_scan( Range( 0, n, 1 ), acc, tbb::auto_partitioner() ); - break; - } - - ScanIsRunning = false; -#if PRINT_DEBUG - printf("=========\n"); -#endif /* PRINT_DEBUG */ - Snooze(false); - tbb::tick_count t1 = tbb::tick_count::now(); - long used_once_count = 0; - for( long i=0; i<n; ++i ) - if( !(AddendHistory[i]&USED_FINAL) ) { - printf("failed to use addend[%ld] %s\n",i,AddendHistory[i]&USED_NONFINAL?"(but used nonfinal)":""); - } - for( long i=0; i<n; ++i ) { - VerifySum( 0, i, sum[i], __LINE__ ); - used_once_count += AddendHistory[i]==USED_FINAL; - } - if( n ) - ASSERT( acc.my_total==sum[n-1], NULL ); - else - ASSERT( acc.my_total==0, NULL ); - if( Verbose ) - printf("time [n=%ld] = %g\tused_once%% = %g\tnthread=%d\n",n,(t1-t0).seconds(), n==0 ? 0 : 100.0*used_once_count/n,nthread); - } - delete[] addend; - delete[] sum; -} - -static void TestScanTags() { - ASSERT( tbb::pre_scan_tag::is_final_scan()==false, NULL ); - ASSERT( tbb::final_scan_tag::is_final_scan()==true, NULL ); -} - -#include "tbb/task_scheduler_init.h" -#include "harness_cpu.h" - -int main(int argc, char* argv[]) { - // Default is to run on two threads. - MinThread = MaxThread = 2; - ParseCommandLine(argc,argv); - TestScanTags(); - for( int p=MinThread; p<=MaxThread; ++p ) { - for (int mode = 0; mode < 3; mode++) { - tbb::task_scheduler_init init(p); - NumberOfLiveAccumulator = 0; - TestAccumulator(mode, p); - - // Test that all workers sleep when no work - TestCPUUserTime(p); - - // Checking has to be done late, because when parallel_scan makes copies of - // the user's "Body", the copies might be destroyed slightly after parallel_scan - // returns. - ASSERT( NumberOfLiveAccumulator==0, NULL ); - } - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_sort.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_sort.cpp deleted file mode 100644 index 20f2c83a21..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_sort.cpp +++ /dev/null @@ -1,532 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/parallel_sort.h" - -#include "harness.h" -#include <math.h> -#include <algorithm> -#include <iterator> -#include <functional> -#include <string> -#include <cstring> -#include <exception> - -#include "tbb/task_scheduler_init.h" -#include "tbb/concurrent_vector.h" - -/** Has tightly controlled interface so that we can verify - that parallel_sort uses only the required interface. */ -class Minimal { - int val; -public: - Minimal() {} - void set_val(int i) { val = i; } - static bool CompareWith (const Minimal &a, const Minimal &b) { - return (a.val < b.val); - } - static bool AreEqual( Minimal &a, Minimal &b) { - return a.val == b.val; - } -}; - -//! Defines a comparison function object for Minimal -class MinimalCompare { -public: - bool operator() (const Minimal &a, const Minimal &b) const { - return Minimal::CompareWith(a,b); - } -}; - -//! The default validate; but it uses operator== which is not required -template<typename RandomAccessIterator> -bool Validate(RandomAccessIterator a, RandomAccessIterator b, size_t n) { - for (size_t i = 0; i < n; i++) { - ASSERT( a[i] == b[i], NULL ); - } - return true; -} - -//! A Validate specialized to string for debugging-only -template<> -bool Validate<std::string *>(std::string * a, std::string * b, size_t n) { - for (size_t i = 0; i < n; i++) { - if ( Verbose && a[i] != b[i]) { - for (size_t j = 0; j < n; j++) { - printf("a[%llu] == %s and b[%llu] == %s\n", static_cast<unsigned long long>(j), a[j].c_str(), static_cast<unsigned long long>(j), b[j].c_str()); - } - } - ASSERT( a[i] == b[i], NULL ); - } - return true; -} - -//! A Validate specialized to Minimal since it does not define an operator== -template<> -bool Validate<Minimal *>(Minimal *a, Minimal *b, size_t n) { - for (size_t i = 0; i < n; i++) { - ASSERT( Minimal::AreEqual(a[i],b[i]), NULL ); - } - return true; -} - -//! A Validate specialized to concurrent_vector<Minimal> since it does not define an operator== -template<> -bool Validate<tbb::concurrent_vector<Minimal>::iterator>(tbb::concurrent_vector<Minimal>::iterator a, - tbb::concurrent_vector<Minimal>::iterator b, size_t n) { - for (size_t i = 0; i < n; i++) { - ASSERT( Minimal::AreEqual(a[i],b[i]), NULL ); - } - return true; -} - -//! used in Verbose mode for identifying which data set is being used -static std::string test_type; - -//! The default initialization routine. -/*! This routine assumes that you can assign to the elements from a float. - It assumes that iter and sorted_list have already been allocated. It fills - them according to the current data set (tracked by a local static variable). - Returns true if a valid test has been setup, or false if there is no test to - perform. -*/ - -template < typename RandomAccessIterator, typename Compare > -bool init_iter(RandomAccessIterator iter, RandomAccessIterator sorted_list, size_t n, const Compare &compare, bool reset) { - static char test_case = 0; - const char num_cases = 3; - - if (reset) test_case = 0; - - if (test_case < num_cases) { - // switch on the current test case, filling the iter and sorted_list appropriately - switch(test_case) { - case 0: - /* use sin to generate the values */ - test_type = "sin"; - for (size_t i = 0; i < n; i++) - iter[i] = sorted_list[i] = static_cast<typename std::iterator_traits< RandomAccessIterator >::value_type>(sin(float(i))); - break; - case 1: - /* presorted list */ - test_type = "pre-sorted"; - for (size_t i = 0; i < n; i++) - iter[i] = sorted_list[i] = static_cast<typename std::iterator_traits< RandomAccessIterator >::value_type>(i); - break; - case 2: - /* reverse-sorted list */ - test_type = "reverse-sorted"; - for (size_t i = 0; i < n; i++) - iter[i] = sorted_list[i] = static_cast<typename std::iterator_traits< RandomAccessIterator >::value_type>(n - i); - break; - } - - // pre-sort sorted_list for later validity testing - std::sort(sorted_list, sorted_list + n, compare); - test_case++; - return true; - } - return false; -} - -template < typename T, typename Compare > -bool init_iter(T * iter, T * sorted_list, size_t n, const Compare &compare, bool reset) { - static char test_case = 0; - const char num_cases = 3; - - if (reset) test_case = 0; - - if (test_case < num_cases) { - // switch on the current test case, filling the iter and sorted_list appropriately - switch(test_case) { - case 0: - /* use sin to generate the values */ - test_type = "sin"; - for (size_t i = 0; i < n; i++) - iter[i] = sorted_list[i] = T(sin(float(i))); - break; - case 1: - /* presorted list */ - test_type = "pre-sorted"; - for (size_t i = 0; i < n; i++) - iter[i] = sorted_list[i] = T(i); - break; - case 2: - /* reverse-sorted list */ - test_type = "reverse-sorted"; - for (size_t i = 0; i < n; i++) - iter[i] = sorted_list[i] = T(n - i); - break; - } - - // pre-sort sorted_list for later validity testing - std::sort(sorted_list, sorted_list + n, compare); - test_case++; - return true; - } - return false; -} - - -//! The initialization routine specialized to the class Minimal -/*! Minimal cannot have floats assigned to it. This function uses the set_val method -*/ - -template < > -bool init_iter(Minimal* iter, Minimal * sorted_list, size_t n, const MinimalCompare &compare, bool reset) { - static char test_case = 0; - const char num_cases = 3; - - if (reset) test_case = 0; - - if (test_case < num_cases) { - switch(test_case) { - case 0: - /* use sin to generate the values */ - test_type = "sin"; - for (size_t i = 0; i < n; i++) { - iter[i].set_val( int( sin( float(i) ) * 1000.f) ); - sorted_list[i].set_val( int ( sin( float(i) ) * 1000.f) ); - } - break; - case 1: - /* presorted list */ - test_type = "pre-sorted"; - for (size_t i = 0; i < n; i++) { - iter[i].set_val( int(i) ); - sorted_list[i].set_val( int(i) ); - } - break; - case 2: - /* reverse-sorted list */ - test_type = "reverse-sorted"; - for (size_t i = 0; i < n; i++) { - iter[i].set_val( int(n-i) ); - sorted_list[i].set_val( int(n-i) ); - } - break; - } - std::sort(sorted_list, sorted_list + n, compare); - test_case++; - return true; - } - return false; -} - -//! The initialization routine specialized to the class concurrent_vector<Minimal> -/*! Minimal cannot have floats assigned to it. This function uses the set_val method -*/ - -template < > -bool init_iter(tbb::concurrent_vector<Minimal>::iterator iter, tbb::concurrent_vector<Minimal>::iterator sorted_list, - size_t n, const MinimalCompare &compare, bool reset) { - static char test_case = 0; - const char num_cases = 3; - - if (reset) test_case = 0; - - if (test_case < num_cases) { - switch(test_case) { - case 0: - /* use sin to generate the values */ - test_type = "sin"; - for (size_t i = 0; i < n; i++) { - iter[i].set_val( int( sin( float(i) ) * 1000.f) ); - sorted_list[i].set_val( int ( sin( float(i) ) * 1000.f) ); - } - break; - case 1: - /* presorted list */ - test_type = "pre-sorted"; - for (size_t i = 0; i < n; i++) { - iter[i].set_val( int(i) ); - sorted_list[i].set_val( int(i) ); - } - break; - case 2: - /* reverse-sorted list */ - test_type = "reverse-sorted"; - for (size_t i = 0; i < n; i++) { - iter[i].set_val( int(n-i) ); - sorted_list[i].set_val( int(n-i) ); - } - break; - } - std::sort(sorted_list, sorted_list + n, compare); - test_case++; - return true; - } - return false; -} - -//! The initialization routine specialized to the class string -/*! strings are created from floats. -*/ - -template<> -bool init_iter(std::string *iter, std::string *sorted_list, size_t n, const std::less<std::string> &compare, bool reset) { - static char test_case = 0; - const char num_cases = 1; - - if (reset) test_case = 0; - - if (test_case < num_cases) { - switch(test_case) { - case 0: - /* use sin to generate the values */ - test_type = "sin"; - for (size_t i = 0; i < n; i++) { - char buffer[20]; -#if __STDC_SECURE_LIB__>=200411 - sprintf_s(buffer, sizeof(buffer), "%f", float(sin(float(i)))); -#else - sprintf(buffer, "%f", float(sin(float(i)))); -#endif /* _MSC_VER>=1400 */ - sorted_list[i] = iter[i] = std::string(buffer); - } - break; - } - std::sort(sorted_list, sorted_list + n, compare); - test_case++; - return true; - } - return false; -} - -//! The current number of threads in use (for Verbose only) -static size_t current_p; - -//! The current data type being sorted (for Verbose only) -static std::string current_type; - -//! The default test routine. -/*! Tests all data set sizes from 0 to N, all grainsizes from 0 to G=10, and selects from - all possible interfaces to parallel_sort depending on whether a scratch space and - compare have been provided. -*/ -template<typename RandomAccessIterator, typename Compare> -bool parallel_sortTest(size_t n, RandomAccessIterator iter, RandomAccessIterator sorted_list, const Compare *comp) { - bool passed = true; - - Compare local_comp; - - init_iter(iter, sorted_list, n, local_comp, true); - do { - if ( Verbose) - printf("%s %s p=%llu n=%llu :",current_type.c_str(), test_type.c_str(), - static_cast<unsigned long long>(current_p), static_cast<unsigned long long>(n)); - if (comp != NULL) { - tbb::parallel_sort(iter, iter + n, local_comp ); - } else { - tbb::parallel_sort(iter, iter + n ); - } - if (!Validate(iter, sorted_list, n)) - passed = false; - if ( Verbose ) printf("passed\n"); - } while (init_iter(iter, sorted_list, n, local_comp, false)); - return passed; -} - -//! The test routine specialize to Minimal, since it does not have a less defined for it -template<> -bool parallel_sortTest(size_t n, Minimal * iter, Minimal * sorted_list, const MinimalCompare *compare) { - bool passed = true; - - if (compare == NULL) return passed; - - init_iter(iter, sorted_list, n, *compare, true); - do { - if ( Verbose) - printf("%s %s p=%llu n=%llu :",current_type.c_str(), test_type.c_str(), - static_cast<unsigned long long>(current_p), static_cast<unsigned long long>(n)); - - tbb::parallel_sort(iter, iter + n, *compare ); - - if (!Validate(iter, sorted_list, n)) - passed = false; - if ( Verbose ) printf("passed\n"); - } while (init_iter(iter, sorted_list, n, *compare, false)); - return passed; -} - -//! The test routine specialize to concurrent_vector of Minimal, since it does not have a less defined for it -template<> -bool parallel_sortTest(size_t n, tbb::concurrent_vector<Minimal>::iterator iter, - tbb::concurrent_vector<Minimal>::iterator sorted_list, const MinimalCompare *compare) { - bool passed = true; - - if (compare == NULL) return passed; - - init_iter(iter, sorted_list, n, *compare, true); - do { - if ( Verbose) - printf("%s %s p=%llu n=%llu :",current_type.c_str(), test_type.c_str(), - static_cast<unsigned long long>(current_p), static_cast<unsigned long long>(n)); - - tbb::parallel_sort(iter, iter + n, *compare ); - - if (!Validate(iter, sorted_list, n)) - passed = false; - if ( Verbose ) printf("passed\n"); - } while (init_iter(iter, sorted_list, n, *compare, false)); - return passed; -} - -//! The main driver for the tests. -/*! Minimal, float and string types are used. All interfaces to parallel_sort that are usable - by each type are tested. -*/ -void Flog() { - // For each type create: - // the list to be sorted by parallel_sort (array) - // the list to be sort by STL sort (array_2) - // and a less function object - - const size_t N = 50000; - - Minimal *minimal_array = new Minimal[N]; - Minimal *minimal_array_2 = new Minimal[N]; - MinimalCompare minimal_less; - -#if !__TBB_FLOATING_POINT_BROKEN - float *float_array = new float[N]; - float *float_array_2 = new float[N]; - std::less<float> float_less; - - tbb::concurrent_vector<float> float_cv1; - tbb::concurrent_vector<float> float_cv2; - float_cv1.grow_to_at_least(N); - float_cv2.grow_to_at_least(N); -#endif /* !__TBB_FLOATING_POINT_BROKEN */ - - std::string *string_array = new std::string[N]; - std::string *string_array_2 = new std::string[N]; - std::less<std::string> string_less; - - tbb::concurrent_vector<Minimal> minimal_cv1; - tbb::concurrent_vector<Minimal> minimal_cv2; - minimal_cv1.grow_to_at_least(N); - minimal_cv2.grow_to_at_least(N); - - - // run the appropriate tests for each type - - current_type = "Minimal(less)"; - parallel_sortTest(0, minimal_array, minimal_array_2, &minimal_less); - parallel_sortTest(1, minimal_array, minimal_array_2, &minimal_less); - parallel_sortTest(10, minimal_array, minimal_array_2, &minimal_less); - parallel_sortTest(9999, minimal_array, minimal_array_2, &minimal_less); - parallel_sortTest(50000, minimal_array, minimal_array_2, &minimal_less); - -#if !__TBB_FLOATING_POINT_BROKEN - current_type = "float (no less)"; - parallel_sortTest(0, float_array, float_array_2, static_cast<std::less<float> *>(NULL)); - parallel_sortTest(1, float_array, float_array_2, static_cast<std::less<float> *>(NULL)); - parallel_sortTest(10, float_array, float_array_2, static_cast<std::less<float> *>(NULL)); - parallel_sortTest(9999, float_array, float_array_2, static_cast<std::less<float> *>(NULL)); - parallel_sortTest(50000, float_array, float_array_2, static_cast<std::less<float> *>(NULL)); - - current_type = "float (less)"; - parallel_sortTest(0, float_array, float_array_2, &float_less); - parallel_sortTest(1, float_array, float_array_2, &float_less); - parallel_sortTest(10, float_array, float_array_2, &float_less); - parallel_sortTest(9999, float_array, float_array_2, &float_less); - parallel_sortTest(50000, float_array, float_array_2, &float_less); - - current_type = "concurrent_vector<float> (no less)"; - parallel_sortTest(0, float_cv1.begin(), float_cv2.begin(), static_cast<std::less<float> *>(NULL)); - parallel_sortTest(1, float_cv1.begin(), float_cv2.begin(), static_cast<std::less<float> *>(NULL)); - parallel_sortTest(10, float_cv1.begin(), float_cv2.begin(), static_cast<std::less<float> *>(NULL)); - parallel_sortTest(9999, float_cv1.begin(), float_cv2.begin(), static_cast<std::less<float> *>(NULL)); - parallel_sortTest(50000, float_cv1.begin(), float_cv2.begin(), static_cast<std::less<float> *>(NULL)); - - current_type = "concurrent_vector<float> (less)"; - parallel_sortTest(0, float_cv1.begin(), float_cv2.begin(), &float_less); - parallel_sortTest(1, float_cv1.begin(), float_cv2.begin(), &float_less); - parallel_sortTest(10, float_cv1.begin(), float_cv2.begin(), &float_less); - parallel_sortTest(9999, float_cv1.begin(), float_cv2.begin(), &float_less); - parallel_sortTest(50000, float_cv1.begin(), float_cv2.begin(), &float_less); -#endif /* !__TBB_FLOATING_POINT_BROKEN */ - - current_type = "string (no less)"; - parallel_sortTest(0, string_array, string_array_2, static_cast<std::less<std::string> *>(NULL)); - parallel_sortTest(1, string_array, string_array_2, static_cast<std::less<std::string> *>(NULL)); - parallel_sortTest(10, string_array, string_array_2, static_cast<std::less<std::string> *>(NULL)); - parallel_sortTest(9999, string_array, string_array_2, static_cast<std::less<std::string> *>(NULL)); - parallel_sortTest(50000, string_array, string_array_2, static_cast<std::less<std::string> *>(NULL)); - - current_type = "string (less)"; - parallel_sortTest(0, string_array, string_array_2, &string_less); - parallel_sortTest(1, string_array, string_array_2, &string_less); - parallel_sortTest(10, string_array, string_array_2, &string_less); - parallel_sortTest(9999, string_array, string_array_2, &string_less); - parallel_sortTest(50000, string_array, string_array_2, &string_less); - - current_type = "concurrent_vector<Minimal> (less)"; - parallel_sortTest(0, minimal_cv1.begin(), minimal_cv2.begin(), &minimal_less); - parallel_sortTest(1, minimal_cv1.begin(), minimal_cv2.begin(), &minimal_less); - parallel_sortTest(10, minimal_cv1.begin(), minimal_cv2.begin(), &minimal_less); - parallel_sortTest(9999, minimal_cv1.begin(), minimal_cv2.begin(), &minimal_less); - parallel_sortTest(50000, minimal_cv1.begin(), minimal_cv2.begin(), &minimal_less); - - delete [] minimal_array; - delete [] minimal_array_2; - -#if !__TBB_FLOATING_POINT_BROKEN - delete [] float_array; - delete [] float_array_2; -#endif /* !__TBB_FLOATING_POINT_BROKEN */ - - delete [] string_array; - delete [] string_array_2; -} - -#include <cstdio> -#include "harness_cpu.h" - -//! Parses the command line and iterates over the number of threads, calling Flog -int main( int argc, char* argv[] ) { - ParseCommandLine(argc,argv); - if( MinThread<1 ) { - printf("Usage: number of threads must be positive\n"); - exit(1); - } - for( int p=MinThread; p<=MaxThread; ++p ) { - if( p>0 ) { - tbb::task_scheduler_init init( p ); - current_p = p; - Flog(); - - // Test that all workers sleep when no work - TestCPUUserTime(p); - } - } - printf("done\n"); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_while.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_while.cpp deleted file mode 100644 index 7d91e37dd5..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_parallel_while.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/parallel_while.h" -#include "harness.h" - -const int N = 200; - -typedef int Element; - -//! Representation of an array index with only those signatures required by parallel_while. -class MinimalArgumentType { - void operator=( const MinimalArgumentType& ); - long my_value; - enum { - DEAD=0xDEAD, - LIVE=0x2718, - INITIALIZED=0x3141 - } my_state; -public: - ~MinimalArgumentType() { - ASSERT( my_state==LIVE||my_state==INITIALIZED, NULL ); - my_state = DEAD; - } - MinimalArgumentType() { - my_state = LIVE; - } - void set_value( long i ) { - ASSERT( my_state==LIVE||my_state==INITIALIZED, NULL ); - my_value = i; - my_state = INITIALIZED; - } - long get_value() const { - ASSERT( my_state==INITIALIZED, NULL ); - return my_value; - } -}; - -class IntegerStream { - long my_limit; - long my_index; -public: - IntegerStream( long n ) : my_limit(n), my_index(0) {} - bool pop_if_present( MinimalArgumentType& v ) { - if( my_index>=my_limit ) - return false; - v.set_value( my_index ); - my_index+=2; - return true; - } -}; - -class MatrixMultiplyBody: NoAssign { - Element (*a)[N]; - Element (*b)[N]; - Element (*c)[N]; - const int n; - tbb::parallel_while<MatrixMultiplyBody>& my_while; -public: - typedef MinimalArgumentType argument_type; - void operator()( argument_type i_arg ) const { - long i = i_arg.get_value(); - if( (i&1)==0 && i+1<N ) { - MinimalArgumentType value; - value.set_value(i+1); - my_while.add( value ); - } - for( int j=0; j<n; ++j ) - c[i][j] = 0; - for( int k=0; k<n; ++k ) { - Element aik = a[i][k]; - for( int j=0; j<n; ++j ) - c[i][j] += aik*b[k][j]; - } - } - MatrixMultiplyBody( tbb::parallel_while<MatrixMultiplyBody>& w, Element c_[N][N], Element a_[N][N], Element b_[N][N], int n_ ) : - a(a_), b(b_), c(c_), n(n_), my_while(w) - {} -}; - -void WhileMatrixMultiply( Element c[N][N], Element a[N][N], Element b[N][N], int n ) { - IntegerStream stream( N ); - tbb::parallel_while<MatrixMultiplyBody> w; - MatrixMultiplyBody body(w,c,a,b,n); - w.run( stream, body ); -} - -#include "tbb/tick_count.h" -#include <cstdlib> -#include <cstdio> -using namespace std; - -static long Iterations = 5; - -static void SerialMatrixMultiply( Element c[N][N], Element a[N][N], Element b[N][N], int n ) { - for( int i=0; i<n; ++i ) { - for( int j=0; j<n; ++j ) - c[i][j] = 0; - for( int k=0; k<n; ++k ) { - Element aik = a[i][k]; - for( int j=0; j<n; ++j ) - c[i][j] += aik*b[k][j]; - } - } -} - -static void InitializeMatrix( Element x[N][N], int n, int salt ) { - for( int i=0; i<n; ++i ) - for( int j=0; j<n; ++j ) - x[i][j] = (i*n+j)^salt; -} - -static Element A[N][N], B[N][N], C[N][N], D[N][N]; - -static void Run( int nthread, int n ) { - /* Initialize matrices */ - InitializeMatrix(A,n,5); - InitializeMatrix(B,n,10); - InitializeMatrix(C,n,0); - InitializeMatrix(D,n,15); - - tbb::tick_count t0 = tbb::tick_count::now(); - for( long i=0; i<Iterations; ++i ) { - WhileMatrixMultiply( C, A, B, n ); - } - tbb::tick_count t1 = tbb::tick_count::now(); - SerialMatrixMultiply( D, A, B, n ); - - // Check result - for( int i=0; i<n; ++i ) - for( int j=0; j<n; ++j ) - ASSERT( C[i][j]==D[i][j], NULL ); - if( Verbose ) - printf("time=%g\tnthread=%d\tn=%d\n",(t1-t0).seconds(),nthread,n); -} - -#include "tbb/task_scheduler_init.h" -#include "harness_cpu.h" - -int main( int argc, char* argv[] ) { - ParseCommandLine( argc, argv ); - if( MinThread<1 ) { - printf("number of threads must be positive\n"); - exit(1); - } - for( int p=MinThread; p<=MaxThread; ++p ) { - tbb::task_scheduler_init init( p ); - for( int n=N/4; n<=N; n+=N/4 ) - Run(p,n); - - // Test that all workers sleep when no work - TestCPUUserTime(p); - } - printf("done\n"); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_pipeline.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_pipeline.cpp deleted file mode 100644 index fdeed758f8..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_pipeline.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/pipeline.h" -#include "tbb/spin_mutex.h" -#include <cstdlib> -#include <cstdio> -#include "harness.h" - -struct Buffer { - int id; - //! True if Buffer is in use. - bool is_busy; - int sequence_number; - Buffer() : id(-1), is_busy(false), sequence_number(-1) {} -}; - -class waiting_probe { - size_t check_counter; -public: - waiting_probe() : check_counter(0) {} - bool required( ) { - ++check_counter; - return !((check_counter+1)&size_t(0x7FFF)); - } - void probe( ); // defined below -}; - -static const int MaxStreamSize = 1<<12; -//! Maximum number of filters allowed -static const int MaxFilters = 5; -static int StreamSize; -static const size_t MaxBuffer = 8; -static bool Done[MaxFilters][MaxStreamSize]; -static waiting_probe WaitTest; -static size_t out_of_order_count; - -class BaseFilter: public tbb::filter { - bool* const my_done; - const bool my_is_last; - bool my_is_running; -public: - tbb::atomic<int> current_token; - BaseFilter( tbb::filter::mode type, bool done[], bool is_last ) : - filter(type), - my_done(done), - my_is_last(is_last), - my_is_running(false), - current_token() - {} - virtual Buffer* get_buffer( void* item ) { - current_token++; - return static_cast<Buffer*>(item); - } - /*override*/void* operator()( void* item ) { - if( is_serial() ) - ASSERT( !my_is_running, "premature entry to serial stage" ); - my_is_running = true; - Buffer* b = get_buffer(item); - if( b ) { - if( is_ordered() ) { - if( b->sequence_number == -1 ) - b->sequence_number = current_token-1; - else - ASSERT( b->sequence_number==current_token-1, "item arrived out of order" ); - } else if( is_serial() ) { - if( b->sequence_number != current_token-1 && b->sequence_number != -1 ) - out_of_order_count++; - } - ASSERT( 0<=b->id && b->id<StreamSize, NULL ); - ASSERT( !my_done[b->id], "duplicate processing of token?" ); - ASSERT( b->is_busy, NULL ); - my_done[b->id] = true; - if( my_is_last ) { - b->id = -1; - b->sequence_number = -1; - __TBB_store_with_release(b->is_busy, false); - } - } - my_is_running = false; - return b; - } -}; -class InputFilter: public BaseFilter { - tbb::spin_mutex input_lock; - Buffer buffer[MaxBuffer]; - const size_t my_number_of_tokens; -public: - InputFilter( tbb::filter::mode type, size_t ntokens, bool done[], bool is_last ) : - BaseFilter(type, done, is_last), - my_number_of_tokens(ntokens) - {} - /*override*/Buffer* get_buffer( void* ) { - int next_input; - size_t free_buffer = 0; - { // lock protected scope - tbb::spin_mutex::scoped_lock lock(input_lock); - if( current_token>=StreamSize ) - return NULL; - next_input = current_token++; - // once in a while, emulate waiting for input; this only makes sense for serial input - if( is_serial() && WaitTest.required() ) - WaitTest.probe( ); - while( free_buffer<MaxBuffer ) - if( __TBB_load_with_acquire(buffer[free_buffer].is_busy) ) - ++free_buffer; - else { - buffer[free_buffer].is_busy = true; - break; - } - } - ASSERT( free_buffer<my_number_of_tokens, "premature reuse of buffer" ); - Buffer* b = &buffer[free_buffer]; - ASSERT( &buffer[0] <= b, NULL ); - ASSERT( b <= &buffer[MaxBuffer-1], NULL ); - ASSERT( b->id == -1, NULL); - b->id = next_input; - ASSERT( b->sequence_number == -1, NULL); - return b; - } -}; - -//! The struct below repeats layout of tbb::pipeline. -struct hacked_pipeline { - tbb::filter* filter_list; - tbb::filter* filter_end; - tbb::empty_task* end_counter; - tbb::internal::Token input_tokens; - tbb::internal::Token token_counter; - bool end_of_input; - - virtual ~hacked_pipeline(); -}; - -//! The struct below repeats layout of tbb::internal::ordered_buffer. -struct hacked_ordered_buffer { - void* array; // This should be changed to task_info* if ever used - tbb::internal::Token array_size; - tbb::internal::Token low_token; - tbb::spin_mutex array_mutex; - tbb::internal::Token high_token; - bool is_ordered; -}; - -//! The struct below repeats layout of tbb::filter. -struct hacked_filter { - tbb::filter* next_filter_in_pipeline; - hacked_ordered_buffer* input_buffer; - unsigned char my_filter_mode; - tbb::filter* prev_filter_in_pipeline; - tbb::pipeline* my_pipeline; - - virtual ~hacked_filter(); -}; - -const tbb::internal::Token tokens_before_wraparound = 0xF; - -void TestTrivialPipeline( size_t nthread, int number_of_filters ) { - // There are 3 filter types: parallel, serial_in_order and serial_out_of_order - static const tbb::filter::mode filter_table[] = { tbb::filter::parallel, tbb::filter::serial_in_order, tbb::filter::serial_out_of_order}; - const int number_of_filter_types = int(sizeof(filter_table)/sizeof(filter_table[0])); - if( Verbose ) - printf("testing with %d threads and %d filters\n", int(nthread), number_of_filters ); - ASSERT( number_of_filters<=MaxFilters, "too many filters" ); - ASSERT( sizeof(hacked_pipeline) == sizeof(tbb::pipeline), "layout changed for tbb::pipeline?" ); - ASSERT( sizeof(hacked_filter) == sizeof(tbb::filter), "layout changed for tbb::filter?" ); - size_t ntokens = nthread<MaxBuffer ? nthread : MaxBuffer; - // Count maximum iterations number - int limit = 1; - for( int i=0; i<number_of_filters; ++i) - limit *= number_of_filter_types; - // Iterate over possible filter sequences - for( int numeral=0; numeral<limit; ++numeral ) { - // Build pipeline - tbb::pipeline pipeline; - // A private member of pipeline is hacked there for sake of testing wrap-around immunity. - ((hacked_pipeline*)(void*)&pipeline)->token_counter = ~tokens_before_wraparound; - tbb::filter* filter[MaxFilters]; - int temp = numeral; - for( int i=0; i<number_of_filters; ++i, temp/=number_of_filter_types ) { - tbb::filter::mode filter_type = filter_table[temp%number_of_filter_types]; - const bool is_last = i==number_of_filters-1; - if( i==0 ) - filter[i] = new InputFilter(filter_type,ntokens,Done[i],is_last); - else - filter[i] = new BaseFilter(filter_type,Done[i],is_last); - pipeline.add_filter(*filter[i]); - // The ordered buffer of serial filters is hacked as well. - if ( filter[i]->is_serial() ) { - ((hacked_filter*)(void*)filter[i])->input_buffer->low_token = ~tokens_before_wraparound; - if ( !filter[i]->is_ordered() ) - ((hacked_filter*)(void*)filter[i])->input_buffer->high_token = ~tokens_before_wraparound; - } - } - for( StreamSize=0; StreamSize<=MaxStreamSize; StreamSize += StreamSize/3+1 ) { - memset( Done, 0, sizeof(Done) ); - for( int i=0; i<number_of_filters; ++i ) { - static_cast<BaseFilter*>(filter[i])->current_token=0; - } - pipeline.run( ntokens ); - for( int i=0; i<number_of_filters; ++i ) - ASSERT( static_cast<BaseFilter*>(filter[i])->current_token==StreamSize, NULL ); - for( int i=0; i<MaxFilters; ++i ) - for( int j=0; j<StreamSize; ++j ) { - ASSERT( Done[i][j]==(i<number_of_filters), NULL ); - } - } - for( int i=number_of_filters; --i>=0; ) { - delete filter[i]; - filter[i] = NULL; - } - pipeline.clear(); - } -} - -#include "harness_cpu.h" - -static int nthread; // knowing number of threads is necessary to call TestCPUUserTime - -void waiting_probe::probe( ) { - if( nthread==1 ) return; - if( Verbose ) printf("emulating wait for input\n"); - // Test that threads sleep while no work. - // The master doesn't sleep so there could be 2 active threads if a worker is waiting for input - TestCPUUserTime(nthread, 2); -} - -#include "tbb/task_scheduler_init.h" - -int main( int argc, char* argv[] ) { - // Default is at least one thread. - MinThread = 1; - out_of_order_count = 0; - ParseCommandLine(argc,argv); - if( MinThread<1 ) { - printf("must have at least one thread"); - exit(1); - } - - // Test with varying number of threads. - for( nthread=MinThread; nthread<=MaxThread; ++nthread ) { - // Initialize TBB task scheduler - tbb::task_scheduler_init init(nthread); - - // Test pipelines with n filters - for( int n=0; n<=5; ++n ) - TestTrivialPipeline(size_t(nthread),n); - - // Test that all workers sleep when no work - TestCPUUserTime(nthread); - } - if( !out_of_order_count ) - printf("Warning: out of order serial filter received tokens in order\n"); - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_rwm_upgrade_downgrade.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_rwm_upgrade_downgrade.cpp deleted file mode 100644 index 182329eeca..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_rwm_upgrade_downgrade.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/queuing_rw_mutex.h" -#include "tbb/spin_rw_mutex.h" -#include "harness.h" - -using namespace tbb; - -volatile int Count; - -template<typename RWMutex> -struct Hammer: NoAssign { - RWMutex &MutexProtectingCount; - mutable volatile int dummy; - - Hammer(RWMutex &m): MutexProtectingCount(m) {} - void operator()( int /*thread_id*/ ) const { - for( int j=0; j<100000; ++j ) { - typename RWMutex::scoped_lock lock(MutexProtectingCount,false); - int c = Count; - for( int j=0; j<10; ++j ) { - ++dummy; - } - if( lock.upgrade_to_writer() ) { - // The upgrade succeeded without any intervening writers - ASSERT( c==Count, "another thread modified Count while I held a read lock" ); - } else { - c = Count; - } - for( int j=0; j<10; ++j ) { - ++Count; - } - lock.downgrade_to_reader(); - for( int j=0; j<10; ++j ) { - ++dummy; - } - } - } -}; - -queuing_rw_mutex QRW_mutex; -spin_rw_mutex SRW_mutex; - -int main( int argc, char* argv[]) { - ParseCommandLine( argc, argv ); - for( int p=MinThread; p<=MaxThread; ++p ) { - Count = 0; - NativeParallelFor( p, Hammer<queuing_rw_mutex>(QRW_mutex) ); - Count = 0; - NativeParallelFor( p, Hammer<spin_rw_mutex>(SRW_mutex) ); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task.cpp deleted file mode 100644 index 9685d0bd24..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task.cpp +++ /dev/null @@ -1,492 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/task.h" -#include "tbb/atomic.h" -#include "harness_assert.h" -#include <cstdlib> - -//------------------------------------------------------------------------ -// Test for task::spawn_children and task_list -//------------------------------------------------------------------------ - -#if __TBB_TASK_DEQUE - -class UnboundedlyRecursiveOnUnboundedStealingTask : public tbb::task { - typedef UnboundedlyRecursiveOnUnboundedStealingTask this_type; - - this_type *my_parent; - const int my_depth; - volatile bool my_go_ahead; - - volatile uintptr_t my_anchor; - - // Well, virtually unboundedly, for any practical purpose - static const int max_depth = 1000000; - -public: - UnboundedlyRecursiveOnUnboundedStealingTask( this_type *parent = NULL, int depth = max_depth ) - : my_parent(parent) - , my_depth(depth) - , my_go_ahead(true) - , my_anchor(0) - {} - - /*override*/ - tbb::task* execute() { - if( !my_parent || (my_depth > 0 && my_parent->my_go_ahead) ) { - if ( my_parent ) { - // We are stolen, let our parent to start waiting for us - my_parent->my_go_ahead = false; - } - tbb::task &t = *new( tbb::task::allocate_child() ) this_type(this, my_depth - 1); - set_ref_count( 2 ); - spawn( t ); - // Give a willing thief a chance to steal - for( int i = 0; i < 1000000 && my_go_ahead; ++i ) { - my_anchor += 1; - __TBB_Yield(); - } - // If our child has not been stolen yet, then prohibit it siring ones - // of its own (when this thread executes it inside the next wait_for_all) - my_go_ahead = false; - wait_for_all(); - } - return NULL; - } -}; // UnboundedlyRecursiveOnUnboundedStealingTask - -#endif /* __TBB_TASK_DEQUE */ - - -tbb::atomic<int> Count; - -class RecursiveTask: public tbb::task { - const int my_child_count; - const int my_depth; - //! Spawn tasks in list. Exact method depends upon my_depth&bit_mask. - void spawn_list( tbb::task_list& list, int bit_mask ) { - if( my_depth&bit_mask ) { - spawn(list); - ASSERT( list.empty(), NULL ); - wait_for_all(); - } else { - spawn_and_wait_for_all(list); - ASSERT( list.empty(), NULL ); - } - } -public: - RecursiveTask( int child_count, int depth ) : my_child_count(child_count), my_depth(depth) {} - /*override*/ tbb::task* execute() { - ++Count; - if( my_depth>0 ) { - tbb::task_list list; - ASSERT( list.empty(), NULL ); - for( int k=0; k<my_child_count; ++k ) { - list.push_back( *new( tbb::task::allocate_child() ) RecursiveTask(my_child_count/2,my_depth-1 ) ); - ASSERT( !list.empty(), NULL ); - } - set_ref_count( my_child_count+1 ); - spawn_list( list, 1 ); - // Now try reusing this as the parent. - set_ref_count(2); - list.push_back( *new (tbb::task::allocate_child() ) tbb::empty_task() ); - spawn_list( list, 2 ); - } - return NULL; - } -}; - -//! Compute what Count should be after RecursiveTask(child_count,depth) runs. -static int Expected( int child_count, int depth ) { - return depth<=0 ? 1 : 1+child_count*Expected(child_count/2,depth-1); -} - -#include "tbb/task_scheduler_init.h" -#include "harness.h" - -#if __TBB_TASK_DEQUE -void TestStealLimit( int nthread ) { - if( Verbose ) - printf( "testing steal limiting heuristics for %d threads\n", nthread ); - tbb::task_scheduler_init init(nthread); - tbb::task &t = *new( tbb::task::allocate_root() ) UnboundedlyRecursiveOnUnboundedStealingTask(); - tbb::task::spawn_root_and_wait(t); -} -#endif /* __TBB_TASK_DEQUE */ - -//! Test task::spawn( task_list& ) -void TestSpawnChildren( int nthread ) { - if( Verbose ) - printf("testing task::spawn_children for %d threads\n",nthread); - tbb::task_scheduler_init init(nthread); - for( int j=0; j<50; ++j ) { - Count = 0; - RecursiveTask& p = *new( tbb::task::allocate_root() ) RecursiveTask(j,4); - tbb::task::spawn_root_and_wait(p); - int expected = Expected(j,4); - ASSERT( Count==expected, NULL ); - } -} - -//! Test task::spawn_root_and_wait( task_list& ) -void TestSpawnRootList( int nthread ) { - if( Verbose ) - printf("testing task::spawn_root_and_wait(task_list&) for %d threads\n",nthread); - tbb::task_scheduler_init init(nthread); - for( int j=0; j<5; ++j ) - for( int k=0; k<10; ++k ) { - Count = 0; - tbb::task_list list; - for( int i=0; i<k; ++i ) - list.push_back( *new( tbb::task::allocate_root() ) RecursiveTask(j,4) ); - tbb::task::spawn_root_and_wait(list); - int expected = k*Expected(j,4); - ASSERT( Count==expected, NULL ); - } -} - -//------------------------------------------------------------------------ -// Test for task::recycle_as_safe_continuation -//------------------------------------------------------------------------ - -class TaskGenerator: public tbb::task { - int my_child_count; - int my_depth; - -public: - TaskGenerator( int child_count, int depth ) : my_child_count(child_count), my_depth(depth) {} - ~TaskGenerator( ) { my_child_count = my_depth = -125; } - - /*override*/ tbb::task* execute() { - ASSERT( my_child_count>=0 && my_depth>=0, NULL ); - if( my_depth>0 ) { - recycle_as_safe_continuation(); - set_ref_count( my_child_count+1 ); - for( int j=0; j<my_child_count; ++j ) { - tbb::task& t = *new( allocate_child() ) TaskGenerator(my_child_count/2,my_depth-1); - spawn(t); - } - --my_depth; - __TBB_Yield(); - ASSERT( state()==recycle && ref_count()>0, NULL); - } - return NULL; - } -}; - -void TestSafeContinuation( int nthread ) { - if( Verbose ) - printf("testing task::recycle_as_safe_continuation for %d threads\n",nthread); - tbb::task_scheduler_init init(nthread); - for( int j=8; j<33; ++j ) { - TaskGenerator& p = *new( tbb::task::allocate_root() ) TaskGenerator(j,5); - tbb::task::spawn_root_and_wait(p); - } -} - -//------------------------------------------------------------------------ -// Test affinity interface -//------------------------------------------------------------------------ -tbb::atomic<int> TotalCount; - -struct AffinityTask: public tbb::task { - const tbb::task::affinity_id expected_affinity_id; - bool noted; - /** Computing affinities is NOT supported by TBB, and may disappear in the future. - It is done here for sake of unit testing. */ - AffinityTask( int expected_affinity_id_ ) : - expected_affinity_id(tbb::task::affinity_id(expected_affinity_id_)), - noted(false) - { - set_affinity(expected_affinity_id); - ASSERT( 0u-expected_affinity_id>0u, "affinity_id not an unsigned integral type?" ); - ASSERT( affinity()==expected_affinity_id, NULL ); - } - /*override*/ tbb::task* execute() { - ++TotalCount; - return NULL; - } - /*override*/ void note_affinity( affinity_id id ) { - // There is no guarantee in TBB that a task runs on its affinity thread. - // However, the current implementation does accidentally guarantee it - // under certain conditions, such as the conditions here. - // We exploit those conditions for sake of unit testing. - ASSERT( id!=expected_affinity_id, NULL ); - ASSERT( !noted, "note_affinity_id called twice!" ); - ASSERT ( &tbb::task::self() == (tbb::task*)this, "Wrong innermost running task" ); - noted = true; - } -}; - -/** Note: This test assumes a lot about the internal implementation of affinity. - Do NOT use this as an example of good programming practice with TBB */ -void TestAffinity( int nthread ) { - TotalCount = 0; - int n = tbb::task_scheduler_init::default_num_threads(); - if( n>nthread ) - n = nthread; - tbb::task_scheduler_init init(n); - tbb::empty_task* t = new( tbb::task::allocate_root() ) tbb::empty_task; - tbb::task::affinity_id affinity_id = t->affinity(); - ASSERT( affinity_id==0, NULL ); - // Set ref_count for n-1 children, plus 1 for the wait. - t->set_ref_count(n); - // Spawn n-1 affinitized children. - for( int i=1; i<n; ++i ) - t->spawn( *new(t->allocate_child()) AffinityTask(i) ); - if( n>1 ) { - // Keep master from stealing - while( TotalCount!=n-1 ) - __TBB_Yield(); - } - // Wait for the children - t->wait_for_all(); - t->destroy(*t); -} - -struct NoteAffinityTask: public tbb::task { - bool noted; - NoteAffinityTask( int id ) : noted(false) - { - set_affinity(tbb::task::affinity_id(id)); - } - ~NoteAffinityTask () { - ASSERT (noted, "note_affinity has not been called"); - } - /*override*/ tbb::task* execute() { - return NULL; - } - /*override*/ void note_affinity( affinity_id /*id*/ ) { - noted = true; - ASSERT ( &tbb::task::self() == (tbb::task*)this, "Wrong innermost running task" ); - } -}; - -// This test checks one of the paths inside the scheduler by affinitizing the child task -// to non-existent thread so that it is proxied in the local task pool but not retrieved -// by another thread. -void TestNoteAffinityContext() { - tbb::task_scheduler_init init(1); - tbb::empty_task* t = new( tbb::task::allocate_root() ) tbb::empty_task; - t->set_ref_count(2); - // This master in the absence of workers will have an affinity id of 1. - // So use another number to make the task get proxied. - t->spawn( *new(t->allocate_child()) NoteAffinityTask(2) ); - t->wait_for_all(); - t->destroy(*t); -} - -//------------------------------------------------------------------------ -// Test that recovery actions work correctly for task::allocate_* methods -// when a task's constructor throws an exception. -//------------------------------------------------------------------------ - -static int TestUnconstructibleTaskCount; - -struct ConstructionFailure { -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Suppress pointless "unreachable code" warning. - #pragma warning (push) - #pragma warning (disable: 4702) -#endif - -//! Task that cannot be constructed. -template<size_t N> -struct UnconstructibleTask: public tbb::empty_task { - char space[N]; - UnconstructibleTask() { - throw ConstructionFailure(); - } -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif - -#define TRY_BAD_CONSTRUCTION(x) \ - { \ - try { \ - new(x) UnconstructibleTask<N>; \ - } catch( const ConstructionFailure& ) { \ - ASSERT( parent()==original_parent, NULL ); \ - ASSERT( ref_count()==original_ref_count, "incorrectly changed ref_count" );\ - ++TestUnconstructibleTaskCount; \ - } \ - } - -template<size_t N> -struct RootTaskForTestUnconstructibleTask: public tbb::task { - tbb::task* execute() { - tbb::task* original_parent = parent(); - ASSERT( original_parent!=NULL, NULL ); - int original_ref_count = ref_count(); - TRY_BAD_CONSTRUCTION( allocate_root() ); - TRY_BAD_CONSTRUCTION( allocate_child() ); - TRY_BAD_CONSTRUCTION( allocate_continuation() ); - TRY_BAD_CONSTRUCTION( allocate_additional_child_of(*this) ); - return NULL; - } -}; - -template<size_t N> -void TestUnconstructibleTask() { - TestUnconstructibleTaskCount = 0; - tbb::task_scheduler_init init; - tbb::task* t = new( tbb::task::allocate_root() ) RootTaskForTestUnconstructibleTask<N>; - tbb::task::spawn_root_and_wait(*t); - ASSERT( TestUnconstructibleTaskCount==4, NULL ); -} - -//------------------------------------------------------------------------ -// Test for alignment problems with task objects. -//------------------------------------------------------------------------ - -#if _MSC_VER && !defined(__INTEL_COMPILER) - // Workaround for pointless warning "structure was padded due to __declspec(align()) - #pragma warning (push) - #pragma warning (disable: 4324) -#endif - -//! Task with members of type T. -/** The task recursively creates tasks. */ -template<typename T> -class TaskWithMember: public tbb::task { - T x; - T y; - unsigned char count; - /*override*/ tbb::task* execute() { - x = y; - if( count>0 ) { - set_ref_count(2); - tbb::task* t = new( tbb::task::allocate_child() ) TaskWithMember<T>(count-1); - spawn_and_wait_for_all(*t); - } - return NULL; - } -public: - TaskWithMember( unsigned char n ) : count(n) {} -}; - -#if _MSC_VER && !defined(__INTEL_COMPILER) - #pragma warning (pop) -#endif - -template<typename T> -void TestAlignmentOfOneClass() { - typedef TaskWithMember<T> task_type; - tbb::task* t = new( tbb::task::allocate_root() ) task_type(10); - tbb::task::spawn_root_and_wait(*t); -} - -#include "harness_m128.h" - -void TestAlignment() { - if( Verbose ) - printf("testing alignment\n"); - tbb::task_scheduler_init init; - // Try types that have variety of alignments - TestAlignmentOfOneClass<char>(); - TestAlignmentOfOneClass<short>(); - TestAlignmentOfOneClass<int>(); - TestAlignmentOfOneClass<long>(); - TestAlignmentOfOneClass<void*>(); - TestAlignmentOfOneClass<float>(); - TestAlignmentOfOneClass<double>(); -#if HAVE_m128 - TestAlignmentOfOneClass<__m128>(); -#endif /* HAVE_m128 */ -} - -//------------------------------------------------------------------------ -// Test for recursing on left while spawning on right -//------------------------------------------------------------------------ - -int Fib( int n ); - -struct RightFibTask: public tbb::task { - int* y; - const int n; - RightFibTask( int* y_, int n_ ) : y(y_), n(n_) {} - task* execute() { - *y = Fib(n-1); - return 0; - } -}; - -int Fib( int n ) { - if( n<2 ) { - return n; - } else { - // y actually does not need to be initialized. It is initialized solely to suppress - // a gratuitous warning "potentially uninitialized local variable". - int y=-1; - tbb::task* root_task = new( tbb::task::allocate_root() ) tbb::empty_task; - root_task->set_ref_count(2); - root_task->spawn( *new( root_task->allocate_child() ) RightFibTask(&y,n) ); - int x = Fib(n-2); - root_task->wait_for_all(); - tbb::task::self().destroy(*root_task); - return y+x; - } -} - -void TestLeftRecursion( int p ) { - if( Verbose ) - printf("testing non-spawned roots for %d threads\n",p); - tbb::task_scheduler_init init(p); - int sum = 0; - for( int i=0; i<100; ++i ) - sum +=Fib(10); - ASSERT( sum==5500, NULL ); -} - -//------------------------------------------------------------------------ -int main(int argc, char* argv[]) { - MinThread = 1; - ParseCommandLine( argc, argv ); - TestUnconstructibleTask<1>(); - TestUnconstructibleTask<10000>(); - TestAlignment(); - TestNoteAffinityContext(); - for( int p=MinThread; p<=MaxThread; ++p ) { - TestSpawnChildren( p ); - TestSpawnRootList( p ); - TestSafeContinuation( p ); - TestLeftRecursion( p ); - TestAffinity( p ); -#if __TBB_TASK_DEQUE - TestStealLimit( p ); -#endif /* __TBB_TASK_DEQUE */ - } - printf("done\n"); - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_assertions.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_assertions.cpp deleted file mode 100644 index 685addbd8b..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_assertions.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// to avoid usage of #pragma comment -#define __TBB_NO_IMPLICIT_LINKAGE 1 -#define __TBB_TASK_CPP_DIRECTLY_INCLUDED 1 -#include "../tbb/task.cpp" - -//------------------------------------------------------------------------ -// Test that important assertions in class task fail as expected. -//------------------------------------------------------------------------ - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -#include "harness.h" -#include "harness_bad_expr.h" - -//! Task that will be abused. -tbb::task* volatile AbusedTask; - -//! Number of times that AbuseOneTask -int AbuseOneTaskRan; - -//! Body used to create task in thread 0 and abuse it in thread 1. -struct AbuseOneTask { - void operator()( int ) const { - tbb::task_scheduler_init init; - // Thread 1 attempts to incorrectly use the task created by thread 0. - TRY_BAD_EXPR(AbusedTask->spawn(*AbusedTask),"owne"); - TRY_BAD_EXPR(AbusedTask->spawn_and_wait_for_all(*AbusedTask),"owne"); - TRY_BAD_EXPR(tbb::task::spawn_root_and_wait(*AbusedTask),"owne"); - - // Try variant that operate on a tbb::task_list - tbb::task_list list; - TRY_BAD_EXPR(AbusedTask->spawn(list),"owne"); - TRY_BAD_EXPR(AbusedTask->spawn_and_wait_for_all(list),"owne"); - // spawn_root_and_wait over empty list should vacuously succeed. - tbb::task::spawn_root_and_wait(list); - - // Check that spawn_root_and_wait fails on non-empty list. - list.push_back(*AbusedTask); - TRY_BAD_EXPR(tbb::task::spawn_root_and_wait(list),"owne"); - - TRY_BAD_EXPR(AbusedTask->destroy(*AbusedTask),"owne"); - TRY_BAD_EXPR(AbusedTask->wait_for_all(),"owne"); - - // Try abusing recycle_as_continuation - TRY_BAD_EXPR(AbusedTask->recycle_as_continuation(), "execute" ); - TRY_BAD_EXPR(AbusedTask->recycle_as_safe_continuation(), "execute" ); - TRY_BAD_EXPR(AbusedTask->recycle_to_reexecute(), "execute" ); - -#if !__TBB_TASK_DEQUE - // Check correct use of depth parameter - tbb::task::depth_type depth = AbusedTask->depth(); - ASSERT( depth==0, NULL ); - for( int k=1; k<=81; k*=3 ) { - AbusedTask->set_depth(depth+k); - ASSERT( AbusedTask->depth()==depth+k, NULL ); - AbusedTask->add_to_depth(k+1); - ASSERT( AbusedTask->depth()==depth+2*k+1, NULL ); - } - AbusedTask->set_depth(0); - - // Try abusing the depth parameter - TRY_BAD_EXPR(AbusedTask->set_depth(-1),"negative"); - TRY_BAD_EXPR(AbusedTask->add_to_depth(-1),"negative"); -#endif /* !__TBB_TASK_DEQUE */ - - ++AbuseOneTaskRan; - } -}; - -//! Test various __TBB_ASSERT assertions related to class tbb::task. -void TestTaskAssertions() { -#if TBB_USE_ASSERT - // Catch assertion failures - tbb::set_assertion_handler( AssertionFailureHandler ); - tbb::task_scheduler_init init; - // Create task to be abused - AbusedTask = new( tbb::task::allocate_root() ) tbb::empty_task; - NativeParallelFor( 1, AbuseOneTask() ); - ASSERT( AbuseOneTaskRan==1, NULL ); - AbusedTask->destroy(*AbusedTask); - // Restore normal assertion handling - tbb::set_assertion_handler( NULL ); -#endif /* TBB_USE_ASSERT */ -} - -//------------------------------------------------------------------------ -int main(int argc, char* argv[]) { -#if __GLIBC__==2&&__GLIBC_MINOR__==3 - printf("skip\n"); -#else - TestTaskAssertions(); - printf("done\n"); -#endif - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_leaks.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_leaks.cpp deleted file mode 100644 index 429eca50be..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_leaks.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// to avoid usage of #pragma comment -#define __TBB_NO_IMPLICIT_LINKAGE 1 - -#define COUNT_TASK_NODES 1 -#define __TBB_TASK_CPP_DIRECTLY_INCLUDED 1 -#include "../tbb/task.cpp" - -#include "tbb/atomic.h" -#include "harness_assert.h" -#include <cstdlib> - -//------------------------------------------------------------------------ -// Test for task::spawn_children -//------------------------------------------------------------------------ - -tbb::atomic<int> Count; -tbb::atomic<tbb::task*> Exchanger; -tbb::internal::scheduler* Producer; - -#include "tbb/task_scheduler_init.h" -#include "harness.h" -using namespace tbb; -using namespace tbb::internal; - -class ChangeProducer: public tbb::task { -public: - /*override*/ tbb::task* execute() { - if( is_stolen_task() ) { - Producer = internal::Governor::local_scheduler(); - } - return NULL; - } -}; - -class TaskGenerator: public tbb::task { - const int my_child_count; - int my_depth; -public: - TaskGenerator(int child_count, int depth) : my_child_count(child_count), my_depth(depth) { - ASSERT(my_child_count>1, "The TaskGenerator should produce at least two children"); - } - /*override*/ tbb::task* execute() { - if( my_depth>0 ) { - int child_count = my_child_count; - scheduler* my_sched = internal::Governor::local_scheduler(); - tbb::task& c = *new( tbb::task::allocate_continuation() ) tbb::empty_task; - c.set_ref_count( child_count ); - recycle_as_child_of(c); - --child_count; - if( Producer==my_sched ) { - // produce a task and put it into Exchanger - tbb::task* t = new( c.allocate_child() ) tbb::empty_task; - --child_count; - t = Exchanger.fetch_and_store(t); - if( t ) this->spawn(*t); - } else { - tbb::task* t = Exchanger.fetch_and_store(NULL); - if( t ) this->spawn(*t); - } - while( child_count ) { - c.spawn( *new( c.allocate_child() ) TaskGenerator(my_child_count, my_depth-1) ); - --child_count; - } - --my_depth; - return this; - } else { - tbb::task* t = Exchanger.fetch_and_store(NULL); - if( t ) this->spawn(*t); - return NULL; - } - } -}; - -#include "harness_memory.h" -#if _MSC_VER==1500 && !defined(__INTEL_COMPILER) - // VS2008/VC9 seems to have an issue - #pragma warning( push ) - #pragma warning( disable: 4985 ) -#endif -#include <math.h> -#if _MSC_VER==1500 && !defined(__INTEL_COMPILER) - #pragma warning( pop ) -#endif - -void RunTaskGenerators( int i ) { - tbb::task* dummy_root; - if( i==250 ) { - Producer = NULL; - } - dummy_root = new( tbb::task::allocate_root() ) tbb::empty_task; - dummy_root->set_ref_count( 2 ); - // If no producer, start elections; some worker will take the role - if( Producer ) - dummy_root->spawn( *new( dummy_root->allocate_child() ) tbb::empty_task ); - else - dummy_root->spawn( *new( dummy_root->allocate_child() ) ChangeProducer ); - if( i==260 && !Producer ) { - printf("Warning: producer has not changed after 10 attempts; running on a single core?\n"); - } - for( int j=0; j<100; ++j ) { - tbb::task& t = *new( tbb::task::allocate_root() ) TaskGenerator(/*child_count=*/4, /*depth=*/6); - tbb::task::spawn_root_and_wait(t); - } - dummy_root->wait_for_all(); - dummy_root->destroy( *dummy_root ); -} - -//! Tests whether task scheduler allows thieves to hoard task objects. -/** The test takes a while to run, so we run it only with the default - number of threads. */ -void TestTaskReclamation() { - if( Verbose ) - printf("testing task reclamation\n"); - - size_t initial_amount_of_memory = 0; - double task_count_sum = 0; - double task_count_sum_square = 0; - double average, sigma; - - tbb::task_scheduler_init init (MinThread); - if( Verbose ) - printf("Starting with %d threads\n", MinThread); - // For now, the master will produce "additional" tasks; later a worker will replace it; - Producer = internal::Governor::local_scheduler(); - int N = 20; - // First N iterations fill internal buffers and collect initial statistics - for( int i=0; i<N; ++i ) { - // First N iterations fill internal buffers and collect initial statistics - RunTaskGenerators( i ); - - size_t m = GetMemoryUsage(); - if( m-initial_amount_of_memory > 0) - initial_amount_of_memory = m; - - intptr_t n = internal::Governor::local_scheduler()->get_task_node_count( /*count_arena_workers=*/true ); - task_count_sum += n; - task_count_sum_square += n*n; - - if( Verbose ) - printf( "Consumed %ld bytes and %ld objects (iteration=%d)\n", long(m), long(n), i ); - } - // Calculate statistical values - average = task_count_sum / N; - sigma = sqrt( (task_count_sum_square - task_count_sum*task_count_sum/N)/N ); - if( Verbose ) - printf("Average task count: %g, sigma: %g, sum: %g, square sum:%g \n", average, sigma, task_count_sum, task_count_sum_square); - - int error_count = 0; - for( int i=0; i<500; ++i ) { - // These iterations check for excessive memory use and unreasonable task count - RunTaskGenerators( i ); - - intptr_t n = internal::Governor::local_scheduler()->get_task_node_count( /*count_arena_workers=*/true ); - size_t m = GetMemoryUsage(); - - if( (m-initial_amount_of_memory > 0) && (n > average+4*sigma) ) { - ++error_count; - // Use 4*sigma interval (for normal distribution, 3*sigma contains ~99% of values). - // Issue a warning for the first couple of times, then errors - printf( "%s: possible leak of up to %ld bytes; currently %ld cached task objects (iteration=%d)\n", - error_count>3?"Error":"Warning", static_cast<unsigned long>(m-initial_amount_of_memory), long(n), i ); - initial_amount_of_memory = m; - if( error_count>5 ) break; - } else { - if( Verbose ) - printf( "Consumed %ld bytes and %ld objects (iteration=%d)\n", long(m), long(n), i ); - } - } -} - -//------------------------------------------------------------------------ - -int main(int argc, char* argv[]) { - MinThread = -1; - ParseCommandLine( argc, argv ); - if( !GetMemoryUsage() ) { - if( Verbose ) - printf("GetMemoryUsage is not implemented for this platform\n"); - printf("skip\n"); - } else { - TestTaskReclamation(); - printf("done\n"); - } - return 0; -} - diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_init.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_init.cpp deleted file mode 100644 index ee1d0615ed..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_init.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/task_scheduler_init.h" -#include <cstdlib> -#include "harness_assert.h" - -//! Test that task::initialize and task::terminate work when doing nothing else. -/** maxthread is treated as the "maximum" number of worker threads. */ -void InitializeAndTerminate( int maxthread ) { - for( int i=0; i<200; ++i ) { - switch( i&3 ) { - default: { - tbb::task_scheduler_init init( std::rand() % maxthread + 1 ); - ASSERT(init.is_active(), NULL); - break; - } - case 0: { - tbb::task_scheduler_init init; - ASSERT(init.is_active(), NULL); - break; - } - case 1: { - tbb::task_scheduler_init init( tbb::task_scheduler_init::automatic ); - ASSERT(init.is_active(), NULL); - break; - } - case 2: { - tbb::task_scheduler_init init( tbb::task_scheduler_init::deferred ); - ASSERT(!init.is_active(), "init should not be active; initialization was deferred"); - init.initialize( std::rand() % maxthread + 1 ); - ASSERT(init.is_active(), NULL); - init.terminate(); - ASSERT(!init.is_active(), "init should not be active; it was terminated"); - break; - } - } - } -} - -#include <cstdio> -#include <stdexcept> -#include "harness.h" - -#if _WIN64 -namespace std { // 64-bit Windows compilers have not caught up with 1998 ISO C++ standard - using ::srand; - using ::printf; -} -#endif /* _WIN64 */ - -struct ThreadedInit { - void operator()( int ) const { - try { - InitializeAndTerminate(MaxThread); - } catch( std::runtime_error& error ) { - std::printf("ERROR: %s\n", error.what() ); - } - } -}; - -#if _MSC_VER -#include <windows.h> -#include <tchar.h> -#endif /* _MSC_VER */ - -//! Test driver -int main(int argc, char* argv[]) { -#if _MSC_VER && !__TBB_NO_IMPLICIT_LINKAGE - #ifdef _DEBUG - ASSERT(!GetModuleHandle(_T("tbb.dll")) && GetModuleHandle(_T("tbb_debug.dll")), - "debug application links with non-debug tbb library"); - #else - ASSERT(!GetModuleHandle(_T("tbb_debug.dll")) && GetModuleHandle(_T("tbb.dll")), - "non-debug application links with debug tbb library"); - #endif -#endif /* _MSC_VER && !__TBB_NO_IMPLICIT_LINKAGE */ - std::srand(2); - // Set defaults - MaxThread = MinThread = 2; - ParseCommandLine( argc, argv ); - try { - InitializeAndTerminate(MaxThread); - } catch( std::runtime_error& error ) { - std::printf("ERROR: %s\n", error.what() ); - } - for( int p=MinThread; p<=MaxThread; ++p ) { - if( Verbose ) printf("testing with %d threads\n", p ); - NativeParallelFor( p, ThreadedInit() ); - } - std::printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_observer.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_observer.cpp deleted file mode 100644 index 4b3758242d..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_task_scheduler_observer.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/task_scheduler_observer.h" - -typedef uintptr_t FlagType; -const int MaxFlagIndex = sizeof(FlagType)*8-1; - -class MyObserver: public tbb::task_scheduler_observer { - FlagType flags; - /*override*/ void on_scheduler_entry( bool is_worker ); - /*override*/ void on_scheduler_exit( bool is_worker ); -public: - MyObserver( FlagType flags_ ) : flags(flags_) { - observe(true); - } -}; - -#include "harness_assert.h" -#include "tbb/atomic.h" - -struct TLS { - FlagType MyFlags; - bool IsMaster; -}; - -#if _WIN32 || _WIN64 - -__declspec(thread) TLS MyTLS; -TLS& GetTLS() {return MyTLS;} - -#else - -#include <pthread.h> -static pthread_key_t TLS_Key; - -TLS& GetTLS() { - TLS* result = (TLS*)pthread_getspecific(TLS_Key); - if( !result ) { - result = new TLS; - result->MyFlags = 0; - result->IsMaster = 0; - pthread_setspecific(TLS_Key, result); - } - return *result; -} - -void DeleteTLS( void* p ) { - delete (TLS*)p; -} - -#endif /* _WIN32 || _WIN64 */ - -tbb::atomic<int> EntryCount; -tbb::atomic<int> ExitCount; - -void MyObserver::on_scheduler_entry( bool is_worker ) { - TLS& tls = GetTLS(); - ASSERT( is_worker==!tls.IsMaster, NULL ); - ASSERT( (tls.MyFlags & flags)==0, NULL ); - ++EntryCount; - tls.MyFlags |= flags; -} - -void MyObserver::on_scheduler_exit( bool is_worker ) { - TLS& tls = GetTLS(); - ASSERT( is_worker==!tls.IsMaster, NULL ); - ++ExitCount; - tls.MyFlags &= ~flags; -} - -#include "tbb/task.h" - -class FibTask: public tbb::task { - const int n; - FlagType flags; -public: - FibTask( int n_, FlagType flags_ ) : n(n_), flags(flags_) {} - /*override*/ tbb::task* execute() { - TLS& tls = GetTLS(); - ASSERT( !(~tls.MyFlags& flags), NULL ); - if( n>=2 ) { - set_ref_count(3); - spawn(*new( tbb::task::allocate_child() ) FibTask(n-1,flags)); - spawn_and_wait_for_all(*new( tbb::task::allocate_child() ) FibTask(n-2,flags)); - } - return NULL; - } -}; - -void DoFib( FlagType flags ) { - tbb::task* t = new( tbb::task::allocate_root() ) FibTask(10,flags); - tbb::task::spawn_root_and_wait(*t); -} - -#include "tbb/task_scheduler_init.h" -#include "harness.h" - -class DoTest { - int nthread; -public: - DoTest( int n ) : nthread(n) {} - void operator()( int i ) const { - TLS& tls = GetTLS(); - tls.IsMaster = true; - if( i==0 ) { - tbb::task_scheduler_init(nthread); - DoFib(0); - } else { - FlagType f = i<=MaxFlagIndex? 1<<i : 0; - MyObserver w(f); - tbb::task_scheduler_init(nthread); - DoFib(f); - } - } -}; - -void TestObserver( int p, int q ) { - NativeParallelFor( p, DoTest(q) ); -} - -int main(int argc, char* argv[]) { - ParseCommandLine( argc, argv ); - -#if _WIN32 || _WIN64 -#else - int status = pthread_key_create(&TLS_Key,DeleteTLS); - ASSERT(!status,NULL); -#endif /* _WIN32 || _WIN64 */ - - for( int p=MinThread; p<=MaxThread; ++p ) - for( int q=MinThread; q<=MaxThread; ++q ) - TestObserver(p,q); - ASSERT( EntryCount>0, "on_scheduler_entry not exercised" ); - ASSERT( ExitCount>0, "on_scheduler_exit not exercised" ); - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_thread.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_thread.cpp deleted file mode 100644 index 7348489307..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_thread.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tbb_thread.h" -#include "tbb/atomic.h" -#include "harness_assert.h" - -static const int THRDS = 3; -static const int THRDS_DETACH = 2; -static tbb::atomic<int> sum; -static tbb::atomic<int> BaseCount; -static tbb::tbb_thread::id real_ids[THRDS+THRDS_DETACH]; - -class Base { - mutable int copy_throws; - friend void RunTests(); - friend void CheckExceptionSafety(); - void operator=( const Base& ); // Deny access -protected: - Base() : copy_throws(100) {++BaseCount;} - Base( const Base& c ) : copy_throws(c.copy_throws) { - if( --copy_throws<=0 ) - throw 0; - ++BaseCount; - } - ~Base() {--BaseCount;} -}; - -template<int N> -class Data: Base { - Data(); // Deny access - explicit Data(int v) : value(v) {} - - friend void RunTests(); - friend void CheckExceptionSafety(); -public: - int value; -}; - - -#include "harness_barrier.h" - -class ThreadFunc: Base { - ThreadFunc() {} - - static Harness::SpinBarrier init_barrier; - - friend void RunTests(); -public: - void operator()(){ - real_ids[0] = tbb::this_tbb_thread::get_id(); - init_barrier.wait(); - - sum.fetch_and_add(1); - } - void operator()(int num){ - real_ids[num] = tbb::this_tbb_thread::get_id(); - init_barrier.wait(); - - sum.fetch_and_add(num); - } - void operator()(int num, Data<0> dx) { - real_ids[num] = tbb::this_tbb_thread::get_id(); - - const double WAIT = .1; - tbb::tick_count t0 = tbb::tick_count::now(); - tbb::this_tbb_thread::sleep( tbb::tick_count::interval_t(WAIT) ); - tbb::tick_count t1 = tbb::tick_count::now(); - ASSERT( ( WAIT - (t1-t0).seconds() ) < 1e-10 - || (t1-t0).seconds() > WAIT, "Should sleep enough."); - - init_barrier.wait(); - - sum.fetch_and_add(num); - sum.fetch_and_add(dx.value); - } - void operator()(Data<0> d) { - tbb::this_tbb_thread::sleep( tbb::tick_count::interval_t(d.value*1.) ); - } -}; - -Harness::SpinBarrier ThreadFunc::init_barrier(THRDS); - -void CheckRelations( const tbb::tbb_thread::id ids[], int n, bool duplicates_allowed ) { - for( int i=0; i<n; ++i ) { - const tbb::tbb_thread::id x = ids[i]; - for( int j=0; j<n; ++j ) { - const tbb::tbb_thread::id y = ids[j]; - ASSERT( (x==y)==!(x!=y), NULL ); - ASSERT( (x<y)==!(x>=y), NULL ); - ASSERT( (x>y)==!(x<=y), NULL ); - ASSERT( (x<y)+(x==y)+(x>y)==1, NULL ); - ASSERT( x!=y || i==j || duplicates_allowed, NULL ); - for( int k=0; k<n; ++k ) { - const tbb::tbb_thread::id z = ids[j]; - ASSERT( !(x<y && y<z) || x<z, "< is not transitive" ); - } - } - } -} - -class AnotherThreadFunc: Base { -public: - void operator()() {} - void operator()(const Data<1>&) {} - void operator()(const Data<1>&, const Data<2>&) {} - friend void CheckExceptionSafety(); -}; - -void CheckExceptionSafety() { - int original_count = BaseCount; - // d loops over number of copies before throw occurs - for( int d=1; d<=3; ++d ) { - // Try all combinations of throw/nothrow for f, x, and y's copy constructor. - for( int i=0; i<8; ++i ) { - { - const AnotherThreadFunc f = AnotherThreadFunc(); - if( i&1 ) f.copy_throws = d; - const Data<1> x(0); - if( i&2 ) x.copy_throws = d; - const Data<2> y(0); - if( i&4 ) y.copy_throws = d; - bool exception_caught = false; - for( int j=0; j<3; ++j ) { - try { - switch(j) { - case 0: {tbb::tbb_thread t(f); t.join();} break; - case 1: {tbb::tbb_thread t(f,x); t.join();} break; - case 2: {tbb::tbb_thread t(f,x,y); t.join();} break; - } - } catch(...) { - exception_caught = true; - } - ASSERT( !exception_caught||(i&((1<<(j+1))-1))!=0, NULL ); - } - } -// Intel Compiler sometimes fails to destroy all implicitly generated copies -// of an object when a copy constructor throws an exception. -// Problem was reported as Quad issue 482935. -// This #if should be removed or tightened when the bug is fixed. -#if !((_WIN32 || _WIN64) && defined(__INTEL_COMPILER)) - ASSERT( BaseCount==original_count, "object leak detected" ); -#endif - } - } -} - -#include <cstdio> - -void RunTests() { - - ThreadFunc t; - Data<0> d100(100), d1(1), d0(0); - tbb::tbb_thread::id id; - tbb::tbb_thread::id id0, uniq_ids[THRDS]; - - tbb::tbb_thread thrs[THRDS]; - tbb::tbb_thread thr; - tbb::tbb_thread thr0(t); - tbb::tbb_thread thr1(t, 2); - tbb::tbb_thread thr2(t, 1, d100); - - ASSERT( thr0.get_id() != id, NULL ); - id0 = thr0.get_id(); - tbb::move(thrs[0], thr0); - ASSERT( thr0.get_id() == id, NULL ); - ASSERT( thrs[0].get_id() == id0, NULL ); - - tbb::tbb_thread::native_handle_type h1 = thr1.native_handle(); - tbb::tbb_thread::native_handle_type h2 = thr2.native_handle(); - tbb::tbb_thread::id id1 = thr1.get_id(); - tbb::tbb_thread::id id2 = thr2.get_id(); - tbb::swap(thr1, thr2); - ASSERT( thr1.native_handle() == h2, NULL ); - ASSERT( thr2.native_handle() == h1, NULL ); - ASSERT( thr1.get_id() == id2, NULL ); - ASSERT( thr2.get_id() == id1, NULL ); - - tbb::move(thrs[1], thr1); - ASSERT( thr1.get_id() == id, NULL ); - - tbb::move(thrs[2], thr2); - ASSERT( thr2.get_id() == id, NULL ); - - for (int i=0; i<THRDS; i++) - uniq_ids[i] = thrs[i].get_id(); - - ASSERT( thrs[2].joinable(), NULL ); - - for (int i=0; i<THRDS; i++) - thrs[i].join(); - for (int i=0; i<THRDS; i++) - ASSERT( real_ids[i] == uniq_ids[i], NULL ); - - int current_sum = sum; - ASSERT( current_sum == 104, NULL ); - ASSERT( ! thrs[2].joinable(), NULL ); - ASSERT( BaseCount==4, "object leak detected" ); - - CheckExceptionSafety(); - - // Note: all tests involving BaseCount should be put before the tests - // involing detached threads, because there is no way of knowing when - // a detached thread destroys its arguments. - - tbb::tbb_thread thr_detach_0(t, d0); - real_ids[THRDS] = thr_detach_0.get_id(); - thr_detach_0.detach(); - ASSERT( thr_detach_0.get_id() == id, NULL ); - - tbb::tbb_thread thr_detach_1(t, d1); - real_ids[THRDS+1] = thr_detach_1.get_id(); - thr_detach_1.detach(); - ASSERT( thr_detach_1.get_id() == id, NULL ); - - CheckRelations(real_ids, THRDS+THRDS_DETACH, true); - - CheckRelations(uniq_ids, THRDS, false); - - for (int i=0; i<2; i++) { - AnotherThreadFunc empty_func; - tbb::tbb_thread thr_to(empty_func), thr_from(empty_func); - tbb::tbb_thread::id from_id = thr_from.get_id(); - if (i) thr_to.join(); - thr_to = thr_from; - ASSERT( thr_from.get_id() == tbb::tbb_thread::id(), NULL ); - ASSERT( thr_to.get_id() == from_id, NULL ); - } - - ASSERT( tbb::tbb_thread::hardware_concurrency() > 0, NULL); -} - -typedef bool (*id_relation)( tbb::tbb_thread::id, tbb::tbb_thread::id ); - -id_relation CheckSignatures() { - id_relation r[6] = {&tbb::operator==, - &tbb::operator!=, - &tbb::operator<, - &tbb::operator>, - &tbb::operator<=, - &tbb::operator>=}; - return r[1]; -} - -int main( int , char *[] ) { - CheckSignatures(); - RunTests(); - std::printf("done\n"); - return 0; -} - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -#include "harness.h" diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_version.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_version.cpp deleted file mode 100644 index 9a932ff058..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tbb_version.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <vector> -#include <string> -#include <utility> - -#define HARNESS_NO_PARSE_COMMAND_LINE 1 -#include "tbb/task_scheduler_init.h" -#include "harness.h" - -#if defined (_WIN32) || defined (_WIN64) -#define TEST_SYSTEM_COMMAND "test_tbb_version.exe 1" -#define putenv _putenv -#else -#define TEST_SYSTEM_COMMAND "./test_tbb_version.exe 1" -#endif - -enum string_required { - required, - not_required - }; - -typedef std::pair <std::string, string_required> string_pair; - -void initialize_strings_vector(std::vector <string_pair>* vector); - -const char stderr_stream[] = "version_test.err"; -const char stdout_stream[] = "version_test.out"; - -int main(int argc, char*[] ) -{ -/* where we first introduced runtime version identification */ -#if TBB_INTERFACE_VERSION>=3014 - // For now, just test that run-time TBB version matches the compile-time version, - // since otherwise the subsequent test of "TBB: INTERFACE VERSION" string will fail anyway. - // We need something more clever in future. - ASSERT(tbb::TBB_runtime_interface_version()==TBB_INTERFACE_VERSION, - "Running with the library of different version than the test was compiled against"); -#endif - try{ - FILE *stream_out; - FILE *stream_err; - char psBuffer[512]; - - if(argc>1) { - stream_err = freopen( stderr_stream, "w", stderr ); - if( stream_err == NULL ){ - printf( "Internal test error (freopen)\n" ); - exit( 1 ); - } - stream_out = freopen( stdout_stream, "w", stdout ); - if( stream_out == NULL ){ - printf( "Internal test error (freopen)\n" ); - exit( 1 ); - } - { - tbb::task_scheduler_init init(1); - } - fclose( stream_out ); - fclose( stream_err ); - exit(0); - } - //1st step check that output is empty if TBB_VERSION is not defined. - if ( getenv("TBB_VERSION") ){ - printf( "TBB_VERSION defined, skipping step 1 (empty output check)\n" ); - }else{ - if( ( system(TEST_SYSTEM_COMMAND) ) != 0 ){ - printf( "Error (step 1): Internal test error\n" ); - exit( 1 ); - } - //Checking output streams - they should be empty - stream_err = fopen( stderr_stream, "r" ); - if( stream_err == NULL ){ - printf( "Error (step 1):Internal test error (stderr open)\n" ); - exit( 1 ); - } - while( !feof( stream_err ) ) { - if( fgets( psBuffer, 512, stream_err ) != NULL ){ - printf( "Error (step 1): stderr should be empty\n" ); - exit( 1 ); - } - } - fclose( stream_err ); - stream_out = fopen( stdout_stream, "r" ); - if( stream_out == NULL ){ - printf( "Error (step 1):Internal test error (stdout open)\n" ); - exit( 1 ); - } - while( !feof( stream_out ) ) { - if( fgets( psBuffer, 512, stream_out ) != NULL ){ - printf( "Error (step 1): stdout should be empty\n" ); - exit( 1 ); - } - } - fclose( stream_out ); - } - - //Setting TBB_VERSION in case it is not set - if ( !getenv("TBB_VERSION") ){ - putenv(const_cast<char*>("TBB_VERSION=1")); - } - - if( ( system(TEST_SYSTEM_COMMAND) ) != 0 ){ - printf( "Error (step 2):Internal test error\n" ); - exit( 1 ); - } - //Checking pipe - it should contain version data - std::vector <string_pair> strings_vector; - std::vector <string_pair>::iterator strings_iterator; - - initialize_strings_vector( &strings_vector ); - strings_iterator = strings_vector.begin(); - - stream_out = fopen( stdout_stream, "r" ); - if( stream_out == NULL ){ - printf( "Error (step 2):Internal test error (stdout open)\n" ); - exit( 1 ); - } - while( !feof( stream_out ) ) { - if( fgets( psBuffer, 512, stream_out ) != NULL ){ - printf( "Error (step 2): stdout should be empty\n" ); - exit( 1 ); - } - } - fclose( stream_out ); - - stream_err = fopen( stderr_stream, "r" ); - if( stream_err == NULL ){ - printf( "Error (step 1):Internal test error (stderr open)\n" ); - exit( 1 ); - } - - int skip_line = 0; - - while( !feof( stream_err ) ) { - if( fgets( psBuffer, 512, stream_err ) != NULL ){ - do{ - if ( strings_iterator == strings_vector.end() ){ - printf( "Error: version string dictionary ended prematurely.\n" ); - printf( "No match for: \t%s", psBuffer ); - exit( 1 ); - } - if ( strstr( psBuffer, strings_iterator->first.c_str() ) == NULL ){ - if( strings_iterator->second == required ){ - printf( "Error: version strings do not match.\n" ); - printf( "Expected \"%s\" not found in:\n\t%s", strings_iterator->first.c_str(), psBuffer ); - exit( 1 ); - }else{ - //Do we need to print in case there is no non-required string? - skip_line = 1; - } - }else{ - skip_line = 0; - } - if ( strings_iterator != strings_vector.end() ) strings_iterator ++; - }while( skip_line ); - } - } - fclose( stream_err ); - } catch(...) { - ASSERT( 0,"unexpected exception" ); - } - printf("done\n"); - return 0; -} - - -// Fill dictionary with version strings for platforms -void initialize_strings_vector(std::vector <string_pair>* vector) -{ - vector->push_back(string_pair("TBB: VERSION\t\t2.1", required)); // check TBB_VERSION - vector->push_back(string_pair("TBB: INTERFACE VERSION\t3016", required)); // check TBB_INTERFACE_VERSION - vector->push_back(string_pair("TBB: BUILD_DATE", required)); - vector->push_back(string_pair("TBB: BUILD_HOST", required)); - vector->push_back(string_pair("TBB: BUILD_OS", required)); -#if _WIN32||_WIN64 - vector->push_back(string_pair("TBB: BUILD_CL", required)); - vector->push_back(string_pair("TBB: BUILD_COMPILER", required)); -#elif __APPLE__ - vector->push_back(string_pair("TBB: BUILD_KERNEL", required)); - vector->push_back(string_pair("TBB: BUILD_GCC", required)); - vector->push_back(string_pair("TBB: BUILD_COMPILER", not_required)); //if( getenv("COMPILER_VERSION") ) -#elif __sun - vector->push_back(string_pair("TBB: BUILD_KERNEL", required)); - vector->push_back(string_pair("TBB: BUILD_SUNCC", required)); - vector->push_back(string_pair("TBB: BUILD_COMPILER", not_required)); //if( getenv("COMPILER_VERSION") ) -#else //We use version_info_linux.sh for unsupported OSes - vector->push_back(string_pair("TBB: BUILD_KERNEL", required)); - vector->push_back(string_pair("TBB: BUILD_GCC", required)); - vector->push_back(string_pair("TBB: BUILD_COMPILER", not_required)); //if( getenv("COMPILER_VERSION") ) - vector->push_back(string_pair("TBB: BUILD_GLIBC", required)); - vector->push_back(string_pair("TBB: BUILD_LD", required)); -#endif - vector->push_back(string_pair("TBB: BUILD_TARGET", required)); - vector->push_back(string_pair("TBB: BUILD_COMMAND", required)); - vector->push_back(string_pair("TBB: TBB_USE_DEBUG", required)); - vector->push_back(string_pair("TBB: TBB_USE_ASSERT", required)); - vector->push_back(string_pair("TBB: DO_ITT_NOTIFY", required)); - vector->push_back(string_pair("TBB: ITT", not_required)); //#ifdef DO_ITT_NOTIFY - vector->push_back(string_pair("TBB: ALLOCATOR", required)); - vector->push_back(string_pair("TBB: SCHEDULER", required)); - - return; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tick_count.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tick_count.cpp deleted file mode 100644 index 2401a03fbe..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_tick_count.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -#include "tbb/tick_count.h" -#include "harness.h" -#include <cstdio> - -//! Assert that two times in seconds are very close. -void AssertNear( double x, double y ) { - ASSERT( -1.0E-10 <= x-y && x-y <=1.0E-10, NULL ); -} - -//! Test arithmetic operators on tick_count::interval_t -void TestArithmetic( const tbb::tick_count& t0, const tbb::tick_count& t1, const tbb::tick_count& t2 ) { - tbb::tick_count::interval_t i= t1-t0; - tbb::tick_count::interval_t j = t2-t1; - tbb::tick_count::interval_t k = t2-t0; - AssertSameType( tbb::tick_count::interval_t(), i-j ); - AssertSameType( tbb::tick_count::interval_t(), i+j ); - ASSERT( i.seconds()>1E-9, NULL ); - ASSERT( j.seconds()>1E-9, NULL ); - ASSERT( k.seconds()>2E-9, NULL ); - AssertNear( (i+j).seconds(), k.seconds() ); - AssertNear( (k-j).seconds(), i.seconds() ); - AssertNear( ((k-j)+(j-i)).seconds(), k.seconds()-i.seconds() ); - tbb::tick_count::interval_t sum; - sum += i; - sum += j; - AssertNear( sum.seconds(), k.seconds() ); - sum -= i; - AssertNear( sum.seconds(), j.seconds() ); - sum -= j; - AssertNear( sum.seconds(), 0.0 ); -} - -//------------------------------------------------------------------------ -// Test for overhead in calls to tick_count -//------------------------------------------------------------------------ - -//! Wait for given duration. -/** The duration parameter is in units of seconds. */ -static void WaitForDuration( double duration ) { - tbb::tick_count start = tbb::tick_count::now(); - while( (tbb::tick_count::now()-start).seconds() < duration ) - continue; -} - -//! Test that average timer overhead is within acceptable limit. -/** The 'tolerance' value inside the test specifies the limit. */ -void TestSimpleDelay( int ntrial, double duration, double tolerance ) { - double total_worktime = 0; - // Iteration -1 warms up the code cache. - for( int trial=-1; trial<ntrial; ++trial ) { - tbb::tick_count t0 = tbb::tick_count::now(); - if( duration ) WaitForDuration(duration); - tbb::tick_count t1 = tbb::tick_count::now(); - if( trial>=0 ) { - total_worktime += (t1-t0).seconds(); - } - } - // Compute average worktime and average delta - double worktime = total_worktime/ntrial; - double delta = worktime-duration; - if (Verbose) - printf("worktime=%g delta=%g tolerance=%g\n", worktime, delta, tolerance); - - // Check that delta is acceptable - if( delta<0 ) - printf("ERROR: delta=%g < 0\n",delta); - if( delta>tolerance ) - printf("%s: delta=%g > %g=tolerance where duration=%g\n",delta>3*tolerance?"ERROR":"Warning",delta,tolerance,duration); -} - -//------------------------------------------------------------------------ -// Test for subtracting calls to tick_count from different threads. -//------------------------------------------------------------------------ - -#include "tbb/atomic.h" -const int MAX_NTHREAD = 1000; -static tbb::atomic<int> Counter; -static volatile bool Flag; -static tbb::tick_count tick_countArray[MAX_NTHREAD]; - -struct tick_countDifferenceBody { - void operator()( int id ) const { - if( --Counter==0 ) Flag = true; - while( !Flag ) continue; - tick_countArray[id] = tbb::tick_count::now(); - } -}; - -//! Test that two tick_count values recorded on different threads can be meaningfully subtracted. -void Testtick_countDifference( int n ) { - double tolerance = 3E-4; - for( int trial=0; trial<10; ++trial ) { - Counter = n; - Flag = false; - NativeParallelFor( n, tick_countDifferenceBody() ); - ASSERT( Counter==0, NULL ); - for( int i=0; i<n; ++i ) - for( int j=0; j<i; ++j ) { - double diff = (tick_countArray[i]-tick_countArray[j]).seconds(); - if( diff<0 ) diff = -diff; - if( diff>tolerance ) { - printf("%s: cross-thread tick_count difference = %g > %g = tolerance\n", - diff>3*tolerance?"ERROR":"Warning",diff,tolerance); - } - } - } -} - -//------------------------------------------------------------------------ -// Test driver -//------------------------------------------------------------------------ - -//! Top level test driver. -int main( int argc, char* argv[]) { - ParseCommandLine(argc, argv); - - tbb::tick_count t0 = tbb::tick_count::now(); - TestSimpleDelay(/*ntrial=*/1000000,/*duration=*/0, /*tolerance=*/2E-6); - tbb::tick_count t1 = tbb::tick_count::now(); - TestSimpleDelay(/*ntrial=*/10, /*duration=*/0.125,/*tolerance=*/5E-6); - tbb::tick_count t2 = tbb::tick_count::now(); - TestArithmetic(t0,t1,t2); - - for( int n=MinThread; n<=MaxThread; ++n ) { - Testtick_countDifference(n); - } - printf("done\n"); - return 0; -} diff --git a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_yield.cpp b/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_yield.cpp deleted file mode 100644 index 35c33e14bf..0000000000 --- a/deal.II/contrib/tbb/tbb21_20090313oss/src/test/test_yield.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright 2005-2009 Intel Corporation. All Rights Reserved. - - This file is part of Threading Building Blocks. - - Threading Building Blocks is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Threading Building Blocks is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Threading Building Blocks; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. -*/ - -// Test that __TBB_Yield works. -// On Red Hat EL4 U1, it does not work, because sched_yield is broken. - -#include "tbb/tbb_machine.h" -#include "tbb/tick_count.h" -#include "harness.h" - -static volatile long CyclicCounter; -static volatile bool Quit; -double SingleThreadTime; - -struct RoundRobin: NoAssign { - const int number_of_threads; - RoundRobin( long p ) : number_of_threads(p) {} - void operator()( long k ) const { - tbb::tick_count t0 = tbb::tick_count::now(); - for( long i=0; i<10000; ++i ) { - // Wait for previous thread to notify us - for( int j=0; CyclicCounter!=k && !Quit; ++j ) { - __TBB_Yield(); - if( j%100==0 ) { - tbb::tick_count t1 = tbb::tick_count::now(); - if( (t1-t0).seconds()>=1.0*number_of_threads ) { - printf("Warning: __TBB_Yield failing to yield with %d threads (or system is heavily loaded)\n",number_of_threads); - Quit = true; - return; - } - } - } - // Notify next thread that it can run - CyclicCounter = (k+1)%number_of_threads; - } - } -}; - -int main( int argc, char* argv[] ) { - // Set defaults - MaxThread = MinThread = 3; - ParseCommandLine( argc, argv ); - for( int p=MinThread; p<=MaxThread; ++p ) { - if( Verbose ) printf("testing with %d threads\n", p ); - CyclicCounter = 0; - Quit = false; - NativeParallelFor( long(p), RoundRobin(p) ); - } - printf("done\n"); - return 0; -} - -- 2.39.5