libgomp.info revision 1.1.1.1
1This is libgomp.info, produced by makeinfo version 4.12 from 2/space/rguenther/gcc-4.5.3/gcc-4.5.3/libgomp/libgomp.texi. 3 4Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. 5 6 Permission is granted to copy, distribute and/or modify this document 7under the terms of the GNU Free Documentation License, Version 1.2 or 8any later version published by the Free Software Foundation; with the 9Invariant Sections being "Funding Free Software", the Front-Cover texts 10being (a) (see below), and with the Back-Cover Texts being (b) (see 11below). A copy of the license is included in the section entitled "GNU 12Free Documentation License". 13 14 (a) The FSF's Front-Cover Text is: 15 16 A GNU Manual 17 18 (b) The FSF's Back-Cover Text is: 19 20 You have freedom to copy and modify this GNU Manual, like GNU 21software. Copies published by the Free Software Foundation raise 22funds for GNU development. 23 24INFO-DIR-SECTION GNU Libraries 25START-INFO-DIR-ENTRY 26* libgomp: (libgomp). GNU OpenMP runtime library 27END-INFO-DIR-ENTRY 28 29 This manual documents the GNU implementation of the OpenMP API for 30multi-platform shared-memory parallel programming in C/C++ and Fortran. 31 32 Published by the Free Software Foundation 51 Franklin Street, Fifth 33Floor Boston, MA 02110-1301 USA 34 35 Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. 36 37 Permission is granted to copy, distribute and/or modify this document 38under the terms of the GNU Free Documentation License, Version 1.2 or 39any later version published by the Free Software Foundation; with the 40Invariant Sections being "Funding Free Software", the Front-Cover texts 41being (a) (see below), and with the Back-Cover Texts being (b) (see 42below). A copy of the license is included in the section entitled "GNU 43Free Documentation License". 44 45 (a) The FSF's Front-Cover Text is: 46 47 A GNU Manual 48 49 (b) The FSF's Back-Cover Text is: 50 51 You have freedom to copy and modify this GNU Manual, like GNU 52software. Copies published by the Free Software Foundation raise 53funds for GNU development. 54 55 56File: libgomp.info, Node: Top, Next: Enabling OpenMP, Up: (dir) 57 58Introduction 59************ 60 61This manual documents the usage of libgomp, the GNU implementation of 62the OpenMP (http://www.openmp.org) Application Programming Interface 63(API) for multi-platform shared-memory parallel programming in C/C++ 64and Fortran. 65 66* Menu: 67 68* Enabling OpenMP:: How to enable OpenMP for your applications. 69* Runtime Library Routines:: The OpenMP runtime application programming 70 interface. 71* Environment Variables:: Influencing runtime behavior with environment 72 variables. 73* The libgomp ABI:: Notes on the external ABI presented by libgomp. 74* Reporting Bugs:: How to report bugs in GNU OpenMP. 75* Copying:: GNU general public license says 76 how you can copy and share libgomp. 77* GNU Free Documentation License:: 78 How you can copy and share this manual. 79* Funding:: How to help assure continued work for free 80 software. 81* Index:: Index of this documentation. 82 83 84File: libgomp.info, Node: Enabling OpenMP, Next: Runtime Library Routines, Prev: Top, Up: Top 85 861 Enabling OpenMP 87***************** 88 89To activate the OpenMP extensions for C/C++ and Fortran, the 90compile-time flag `-fopenmp' must be specified. This enables the OpenMP 91directive `#pragma omp' in C/C++ and `!$omp' directives in free form, 92`c$omp', `*$omp' and `!$omp' directives in fixed form, `!$' conditional 93compilation sentinels in free form and `c$', `*$' and `!$' sentinels in 94fixed form, for Fortran. The flag also arranges for automatic linking 95of the OpenMP runtime library (*note Runtime Library Routines::). 96 97 A complete description of all OpenMP directives accepted may be 98found in the OpenMP Application Program Interface 99(http://www.openmp.org) manual, version 3.0. 100 101 102File: libgomp.info, Node: Runtime Library Routines, Next: Environment Variables, Prev: Enabling OpenMP, Up: Top 103 1042 Runtime Library Routines 105************************** 106 107The runtime routines described here are defined by section 3 of the 108OpenMP specifications in version 3.0. The routines are structured in 109following three parts: 110 111 Control threads, processors and the parallel environment. 112 113* Menu: 114 115* omp_get_active_level:: Number of active parallel regions 116* omp_get_ancestor_thread_num:: Ancestor thread ID 117* omp_get_dynamic:: Dynamic teams setting 118* omp_get_level:: Number of parallel regions 119* omp_get_max_active_levels:: Maximal number of active regions 120* omp_get_max_threads:: Maximal number of threads of parallel region 121* omp_get_nested:: Nested parallel regions 122* omp_get_num_procs:: Number of processors online 123* omp_get_num_threads:: Size of the active team 124* omp_get_schedule:: Obtain the runtime scheduling method 125* omp_get_team_size:: Number of threads in a team 126* omp_get_thread_limit:: Maximal number of threads 127* omp_get_thread_num:: Current thread ID 128* omp_in_parallel:: Whether a parallel region is active 129* omp_set_dynamic:: Enable/disable dynamic teams 130* omp_set_max_active_levels:: Limits the number of active parallel regions 131* omp_set_nested:: Enable/disable nested parallel regions 132* omp_set_num_threads:: Set upper team size limit 133* omp_set_schedule:: Set the runtime scheduling method 134 135 Initialize, set, test, unset and destroy simple and nested locks. 136 137* Menu: 138 139* omp_init_lock:: Initialize simple lock 140* omp_set_lock:: Wait for and set simple lock 141* omp_test_lock:: Test and set simple lock if available 142* omp_unset_lock:: Unset simple lock 143* omp_destroy_lock:: Destroy simple lock 144* omp_init_nest_lock:: Initialize nested lock 145* omp_set_nest_lock:: Wait for and set simple lock 146* omp_test_nest_lock:: Test and set nested lock if available 147* omp_unset_nest_lock:: Unset nested lock 148* omp_destroy_nest_lock:: Destroy nested lock 149 150 Portable, thread-based, wall clock timer. 151 152* Menu: 153 154* omp_get_wtick:: Get timer precision. 155* omp_get_wtime:: Elapsed wall clock time. 156 157 158File: libgomp.info, Node: omp_get_active_level, Next: omp_get_ancestor_thread_num, Up: Runtime Library Routines 159 1602.1 `omp_get_active_level' - Number of parallel regions 161======================================================= 162 163_Description_: 164 This function returns the nesting level for the active parallel 165 blocks, which enclose the calling call. 166 167_C/C++_ 168 _Prototype_: `int omp_get_active_level();' 169 170_Fortran_: 171 _Interface_: `integer omp_get_active_level()' 172 173_See also_: 174 *note omp_get_level::, *note omp_get_max_active_levels::, *note 175 omp_set_max_active_levels:: 176 177_Reference_: 178 OpenMP specifications v3.0 (http://www.openmp.org/), section 179 3.2.19. 180 181 182File: libgomp.info, Node: omp_get_ancestor_thread_num, Next: omp_get_dynamic, Prev: omp_get_active_level, Up: Runtime Library Routines 183 1842.2 `omp_get_ancestor_thread_num' - Ancestor thread ID 185====================================================== 186 187_Description_: 188 This function returns the thread identification number for the 189 given nesting level of the current thread. For values of LEVEL 190 outside zero to `omp_get_level' -1 is returned; if LEVEL is 191 `omp_get_level' the result is identical to `omp_get_thread_num'. 192 193_C/C++_ 194 _Prototype_: `int omp_get_ancestor_thread_num(int level);' 195 196_Fortran_: 197 _Interface_: `integer omp_ancestor_thread_num(level)' 198 `integer level' 199 200_See also_: 201 *note omp_get_level::, *note omp_get_thread_num::, *note 202 omp_get_team_size:: 203 204_Reference_: 205 OpenMP specifications v3.0 (http://www.openmp.org/), section 206 3.2.17. 207 208 209File: libgomp.info, Node: omp_get_dynamic, Next: omp_get_level, Prev: omp_get_ancestor_thread_num, Up: Runtime Library Routines 210 2112.3 `omp_get_dynamic' - Dynamic teams setting 212============================================= 213 214_Description_: 215 This function returns `true' if enabled, `false' otherwise. Here, 216 `true' and `false' represent their language-specific counterparts. 217 218 The dynamic team setting may be initialized at startup by the 219 `OMP_DYNAMIC' environment variable or at runtime using 220 `omp_set_dynamic'. If undefined, dynamic adjustment is disabled by 221 default. 222 223_C/C++_: 224 _Prototype_: `int omp_get_dynamic();' 225 226_Fortran_: 227 _Interface_: `logical function omp_get_dynamic()' 228 229_See also_: 230 *note omp_set_dynamic::, *note OMP_DYNAMIC:: 231 232_Reference_: 233 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.8. 234 235 236File: libgomp.info, Node: omp_get_level, Next: omp_get_max_active_levels, Prev: omp_get_dynamic, Up: Runtime Library Routines 237 2382.4 `omp_get_level' - Obtain the current nesting level 239====================================================== 240 241_Description_: 242 This function returns the nesting level for the parallel blocks, 243 which enclose the calling call. 244 245_C/C++_ 246 _Prototype_: `int omp_get level();' 247 248_Fortran_: 249 _Interface_: `integer omp_level()' 250 251_See also_: 252 *note omp_get_active_level:: 253 254_Reference_: 255 OpenMP specifications v3.0 (http://www.openmp.org/), section 256 3.2.16. 257 258 259File: libgomp.info, Node: omp_get_max_active_levels, Next: omp_get_max_threads, Prev: omp_get_level, Up: Runtime Library Routines 260 2612.5 `omp_set_max_active_levels' - Maximal number of active regions 262================================================================== 263 264_Description_: 265 This function obtains the maximally allowed number of nested, 266 active parallel regions. 267 268_C/C++_ 269 _Prototype_: `int omp_get_max_active_levels();' 270 271_Fortran_: 272 _Interface_: `int omp_get_max_active_levels()' 273 274_See also_: 275 *note omp_set_max_active_levels::, *note omp_get_active_level:: 276 277_Reference_: 278 OpenMP specifications v3.0 (http://www.openmp.org/), section 279 3.2.14. 280 281 282File: libgomp.info, Node: omp_get_max_threads, Next: omp_get_nested, Prev: omp_get_max_active_levels, Up: Runtime Library Routines 283 2842.6 `omp_get_max_threads' - Maximal number of threads of parallel region 285======================================================================== 286 287_Description_: 288 Return the maximal number of threads used for the current parallel 289 region that does not use the clause `num_threads'. 290 291_C/C++_: 292 _Prototype_: `int omp_get_max_threads();' 293 294_Fortran_: 295 _Interface_: `integer function omp_get_max_threads()' 296 297_See also_: 298 *note omp_set_num_threads::, *note omp_set_dynamic::, *note 299 omp_get_thread_limit:: 300 301_Reference_: 302 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.3. 303 304 305File: libgomp.info, Node: omp_get_nested, Next: omp_get_num_procs, Prev: omp_get_max_threads, Up: Runtime Library Routines 306 3072.7 `omp_get_nested' - Nested parallel regions 308============================================== 309 310_Description_: 311 This function returns `true' if nested parallel regions are 312 enabled, `false' otherwise. Here, `true' and `false' represent 313 their language-specific counterparts. 314 315 Nested parallel regions may be initialized at startup by the 316 `OMP_NESTED' environment variable or at runtime using 317 `omp_set_nested'. If undefined, nested parallel regions are 318 disabled by default. 319 320_C/C++_: 321 _Prototype_: `int omp_get_nested();' 322 323_Fortran_: 324 _Interface_: `integer function omp_get_nested()' 325 326_See also_: 327 *note omp_set_nested::, *note OMP_NESTED:: 328 329_Reference_: 330 OpenMP specifications v3.0 (http://www.openmp.org/), section 331 3.2.10. 332 333 334File: libgomp.info, Node: omp_get_num_procs, Next: omp_get_num_threads, Prev: omp_get_nested, Up: Runtime Library Routines 335 3362.8 `omp_get_num_procs' - Number of processors online 337===================================================== 338 339_Description_: 340 Returns the number of processors online. 341 342_C/C++_: 343 _Prototype_: `int omp_get_num_procs();' 344 345_Fortran_: 346 _Interface_: `integer function omp_get_num_procs()' 347 348_Reference_: 349 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.5. 350 351 352File: libgomp.info, Node: omp_get_num_threads, Next: omp_get_schedule, Prev: omp_get_num_procs, Up: Runtime Library Routines 353 3542.9 `omp_get_num_threads' - Size of the active team 355=================================================== 356 357_Description_: 358 The number of threads in the current team. In a sequential section 359 of the program `omp_get_num_threads' returns 1. 360 361 The default team size may be initialized at startup by the 362 `OMP_NUM_THREADS' environment variable. At runtime, the size of 363 the current team may be set either by the `NUM_THREADS' clause or 364 by `omp_set_num_threads'. If none of the above were used to define 365 a specific value and `OMP_DYNAMIC' is disabled, one thread per CPU 366 online is used. 367 368_C/C++_: 369 _Prototype_: `int omp_get_num_threads();' 370 371_Fortran_: 372 _Interface_: `integer function omp_get_num_threads()' 373 374_See also_: 375 *note omp_get_max_threads::, *note omp_set_num_threads::, *note 376 OMP_NUM_THREADS:: 377 378_Reference_: 379 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.2. 380 381 382File: libgomp.info, Node: omp_get_schedule, Next: omp_get_team_size, Prev: omp_get_num_threads, Up: Runtime Library Routines 383 3842.10 `omp_get_schedule' - Obtain the runtime scheduling method 385============================================================== 386 387_Description_: 388 Obtain runtime the scheduling method. The KIND argument will be 389 set to the value `omp_sched_static', `omp_sched_dynamic', 390 `opm_sched_guided' or `auto'. The second argument, MODIFIER, is 391 set to the chunk size. 392 393_C/C++_ 394 _Prototype_: `omp_schedule(omp_sched_t * kind, int *modifier);' 395 396_Fortran_: 397 _Interface_: `subroutine omp_schedule(kind, modifier)' 398 `integer(kind=omp_sched_kind) kind' 399 `integer modifier' 400 401_See also_: 402 *note omp_set_schedule::, *note OMP_SCHEDULE:: 403 404_Reference_: 405 OpenMP specifications v3.0 (http://www.openmp.org/), section 406 3.2.12. 407 408 409File: libgomp.info, Node: omp_get_team_size, Next: omp_get_thread_limit, Prev: omp_get_schedule, Up: Runtime Library Routines 410 4112.11 `omp_get_team_size' - Number of threads in a team 412====================================================== 413 414_Description_: 415 This function returns the number of threads in a thread team to 416 which either the current thread or its ancestor belongs. For 417 values of LEVEL outside zero to `omp_get_level' -1 is returned; if 418 LEVEL is zero 1 is returned and for `omp_get_level' the result is 419 identical to `omp_get_num_threads'. 420 421_C/C++_: 422 _Prototype_: `int omp_get_time_size(int level);' 423 424_Fortran_: 425 _Interface_: `integer function omp_get_team_size(level)' 426 `integer level' 427 428_See also_: 429 *note omp_get_num_threads::, *note omp_get_level::, *note 430 omp_get_ancestor_thread_num:: 431 432_Reference_: 433 OpenMP specifications v3.0 (http://www.openmp.org/), section 434 3.2.18. 435 436 437File: libgomp.info, Node: omp_get_thread_limit, Next: omp_get_thread_num, Prev: omp_get_team_size, Up: Runtime Library Routines 438 4392.12 `omp_get_thread_limit' - Maximal number of threads 440======================================================= 441 442_Description_: 443 Return the maximal number of threads of the program. 444 445_C/C++_: 446 _Prototype_: `int omp_get_thread_limit();' 447 448_Fortran_: 449 _Interface_: `integer function omp_get_thread_limit()' 450 451_See also_: 452 *note omp_get_max_threads::, *note OMP_THREAD_LIMIT:: 453 454_Reference_: 455 OpenMP specifications v3.0 (http://www.openmp.org/), section 456 3.2.13. 457 458 459File: libgomp.info, Node: omp_get_thread_num, Next: omp_in_parallel, Prev: omp_get_thread_limit, Up: Runtime Library Routines 460 4612.13 `omp_get_thread_num' - Current thread ID 462============================================= 463 464_Description_: 465 Unique thread identification number within the current team. In a 466 sequential parts of the program, `omp_get_thread_num' always 467 returns 0. In parallel regions the return value varies from 0 to 468 `omp_get_num_threads'-1 inclusive. The return value of the master 469 thread of a team is always 0. 470 471_C/C++_: 472 _Prototype_: `int omp_get_thread_num();' 473 474_Fortran_: 475 _Interface_: `integer function omp_get_thread_num()' 476 477_See also_: 478 *note omp_get_num_threads::, *note omp_get_ancestor_thread_num:: 479 480_Reference_: 481 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.4. 482 483 484File: libgomp.info, Node: omp_in_parallel, Next: omp_set_dynamic, Prev: omp_get_thread_num, Up: Runtime Library Routines 485 4862.14 `omp_in_parallel' - Whether a parallel region is active 487============================================================ 488 489_Description_: 490 This function returns `true' if currently running in parallel, 491 `false' otherwise. Here, `true' and `false' represent their 492 language-specific counterparts. 493 494_C/C++_: 495 _Prototype_: `int omp_in_parallel();' 496 497_Fortran_: 498 _Interface_: `logical function omp_in_parallel()' 499 500_Reference_: 501 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.6. 502 503 504File: libgomp.info, Node: omp_set_dynamic, Next: omp_set_max_active_levels, Prev: omp_in_parallel, Up: Runtime Library Routines 505 5062.15 `omp_set_dynamic' - Enable/disable dynamic teams 507===================================================== 508 509_Description_: 510 Enable or disable the dynamic adjustment of the number of threads 511 within a team. The function takes the language-specific equivalent 512 of `true' and `false', where `true' enables dynamic adjustment of 513 team sizes and `false' disables it. 514 515_C/C++_: 516 _Prototype_: `void omp_set_dynamic(int);' 517 518_Fortran_: 519 _Interface_: `subroutine omp_set_dynamic(set)' 520 `integer, intent(in) :: set' 521 522_See also_: 523 *note OMP_DYNAMIC::, *note omp_get_dynamic:: 524 525_Reference_: 526 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.7. 527 528 529File: libgomp.info, Node: omp_set_max_active_levels, Next: omp_set_nested, Prev: omp_set_dynamic, Up: Runtime Library Routines 530 5312.16 `omp_set_max_active_levels' - Limits the number of active parallel regions 532=============================================================================== 533 534_Description_: 535 This function limits the maximally allowed number of nested, 536 active parallel regions. 537 538_C/C++_ 539 _Prototype_: `omp_set_max_active_levels(int max_levels);' 540 541_Fortran_: 542 _Interface_: `omp_max_active_levels(max_levels)' 543 `integer max_levels' 544 545_See also_: 546 *note omp_get_max_active_levels::, *note omp_get_active_level:: 547 548_Reference_: 549 OpenMP specifications v3.0 (http://www.openmp.org/), section 550 3.2.14. 551 552 553File: libgomp.info, Node: omp_set_nested, Next: omp_set_num_threads, Prev: omp_set_max_active_levels, Up: Runtime Library Routines 554 5552.17 `omp_set_nested' - Enable/disable nested parallel regions 556============================================================== 557 558_Description_: 559 Enable or disable nested parallel regions, i.e., whether team 560 members are allowed to create new teams. The function takes the 561 language-specific equivalent of `true' and `false', where `true' 562 enables dynamic adjustment of team sizes and `false' disables it. 563 564_C/C++_: 565 _Prototype_: `void omp_set_dynamic(int);' 566 567_Fortran_: 568 _Interface_: `subroutine omp_set_dynamic(set)' 569 `integer, intent(in) :: set' 570 571_See also_: 572 *note OMP_NESTED::, *note omp_get_nested:: 573 574_Reference_: 575 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.9. 576 577 578File: libgomp.info, Node: omp_set_num_threads, Next: omp_set_schedule, Prev: omp_set_nested, Up: Runtime Library Routines 579 5802.18 `omp_set_num_threads' - Set upper team size limit 581====================================================== 582 583_Description_: 584 Specifies the number of threads used by default in subsequent 585 parallel sections, if those do not specify a `num_threads' clause. 586 The argument of `omp_set_num_threads' shall be a positive integer. 587 588_C/C++_: 589 _Prototype_: `void omp_set_num_threads(int);' 590 591_Fortran_: 592 _Interface_: `subroutine omp_set_num_threads(set)' 593 `integer, intent(in) :: set' 594 595_See also_: 596 *note OMP_NUM_THREADS::, *note omp_get_num_threads::, *note 597 omp_get_max_threads:: 598 599_Reference_: 600 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.2.1. 601 602 603File: libgomp.info, Node: omp_set_schedule, Next: omp_init_lock, Prev: omp_set_num_threads, Up: Runtime Library Routines 604 6052.19 `omp_set_schedule' - Set the runtime scheduling method 606=========================================================== 607 608_Description_: 609 Sets the runtime scheduling method. The KIND argument can have the 610 value `omp_sched_static', `omp_sched_dynamic', `opm_sched_guided' 611 or `omp_sched_auto'. Except for `omp_sched_auto', the chunk size 612 is set to the value of MODIFIER if positive or to the default 613 value if zero or negative. For `omp_sched_auto' the MODIFIER 614 argument is ignored. 615 616_C/C++_ 617 _Prototype_: `int omp_schedule(omp_sched_t * kind, int *modifier);' 618 619_Fortran_: 620 _Interface_: `subroutine omp_schedule(kind, modifier)' 621 `integer(kind=omp_sched_kind) kind' 622 `integer modifier' 623 624_See also_: 625 *note omp_get_schedule:: *note OMP_SCHEDULE:: 626 627_Reference_: 628 OpenMP specifications v3.0 (http://www.openmp.org/), section 629 3.2.11. 630 631 632File: libgomp.info, Node: omp_init_lock, Next: omp_set_lock, Prev: omp_set_schedule, Up: Runtime Library Routines 633 6342.20 `omp_init_lock' - Initialize simple lock 635============================================= 636 637_Description_: 638 Initialize a simple lock. After initialization, the lock is in an 639 unlocked state. 640 641_C/C++_: 642 _Prototype_: `void omp_init_lock(omp_lock_t *lock);' 643 644_Fortran_: 645 _Interface_: `subroutine omp_init_lock(lock)' 646 `integer(omp_lock_kind), intent(out) :: lock' 647 648_See also_: 649 *note omp_destroy_lock:: 650 651_Reference_: 652 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.1. 653 654 655File: libgomp.info, Node: omp_set_lock, Next: omp_test_lock, Prev: omp_init_lock, Up: Runtime Library Routines 656 6572.21 `omp_set_lock' - Wait for and set simple lock 658================================================== 659 660_Description_: 661 Before setting a simple lock, the lock variable must be 662 initialized by `omp_init_lock'. The calling thread is blocked 663 until the lock is available. If the lock is already held by the 664 current thread, a deadlock occurs. 665 666_C/C++_: 667 _Prototype_: `void omp_set_lock(omp_lock_t *lock);' 668 669_Fortran_: 670 _Interface_: `subroutine omp_set_lock(lock)' 671 `integer(omp_lock_kind), intent(out) :: lock' 672 673_See also_: 674 *note omp_init_lock::, *note omp_test_lock::, *note 675 omp_unset_lock:: 676 677_Reference_: 678 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.3. 679 680 681File: libgomp.info, Node: omp_test_lock, Next: omp_unset_lock, Prev: omp_set_lock, Up: Runtime Library Routines 682 6832.22 `omp_test_lock' - Test and set simple lock if available 684============================================================ 685 686_Description_: 687 Before setting a simple lock, the lock variable must be 688 initialized by `omp_init_lock'. Contrary to `omp_set_lock', 689 `omp_test_lock' does not block if the lock is not available. This 690 function returns `true' upon success, `false' otherwise. Here, 691 `true' and `false' represent their language-specific counterparts. 692 693_C/C++_: 694 _Prototype_: `int omp_test_lock(omp_lock_t *lock);' 695 696_Fortran_: 697 _Interface_: `subroutine omp_test_lock(lock)' 698 `logical(omp_logical_kind) :: omp_test_lock' 699 `integer(omp_lock_kind), intent(out) :: lock' 700 701_See also_: 702 *note omp_init_lock::, *note omp_set_lock::, *note omp_set_lock:: 703 704_Reference_: 705 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.5. 706 707 708File: libgomp.info, Node: omp_unset_lock, Next: omp_destroy_lock, Prev: omp_test_lock, Up: Runtime Library Routines 709 7102.23 `omp_unset_lock' - Unset simple lock 711========================================= 712 713_Description_: 714 A simple lock about to be unset must have been locked by 715 `omp_set_lock' or `omp_test_lock' before. In addition, the lock 716 must be held by the thread calling `omp_unset_lock'. Then, the 717 lock becomes unlocked. If one ore more threads attempted to set 718 the lock before, one of them is chosen to, again, set the lock for 719 itself. 720 721_C/C++_: 722 _Prototype_: `void omp_unset_lock(omp_lock_t *lock);' 723 724_Fortran_: 725 _Interface_: `subroutine omp_unset_lock(lock)' 726 `integer(omp_lock_kind), intent(out) :: lock' 727 728_See also_: 729 *note omp_set_lock::, *note omp_test_lock:: 730 731_Reference_: 732 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.4. 733 734 735File: libgomp.info, Node: omp_destroy_lock, Next: omp_init_nest_lock, Prev: omp_unset_lock, Up: Runtime Library Routines 736 7372.24 `omp_destroy_lock' - Destroy simple lock 738============================================= 739 740_Description_: 741 Destroy a simple lock. In order to be destroyed, a simple lock 742 must be in the unlocked state. 743 744_C/C++_: 745 _Prototype_: `void omp_destroy_lock(omp_lock_t *);' 746 747_Fortran_: 748 _Interface_: `subroutine omp_destroy_lock(lock)' 749 `integer(omp_lock_kind), intent(inout) :: lock' 750 751_See also_: 752 *note omp_init_lock:: 753 754_Reference_: 755 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.2. 756 757 758File: libgomp.info, Node: omp_init_nest_lock, Next: omp_set_nest_lock, Prev: omp_destroy_lock, Up: Runtime Library Routines 759 7602.25 `omp_init_nest_lock' - Initialize nested lock 761================================================== 762 763_Description_: 764 Initialize a nested lock. After initialization, the lock is in an 765 unlocked state and the nesting count is set to zero. 766 767_C/C++_: 768 _Prototype_: `void omp_init_nest_lock(omp_nest_lock_t *lock);' 769 770_Fortran_: 771 _Interface_: `subroutine omp_init_nest_lock(lock)' 772 `integer(omp_nest_lock_kind), intent(out) :: lock' 773 774_See also_: 775 *note omp_destroy_nest_lock:: 776 777_Reference_: 778 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.1. 779 780 781File: libgomp.info, Node: omp_set_nest_lock, Next: omp_test_nest_lock, Prev: omp_init_nest_lock, Up: Runtime Library Routines 782 7832.26 `omp_set_nest_lock' - Wait for and set simple lock 784======================================================= 785 786_Description_: 787 Before setting a nested lock, the lock variable must be 788 initialized by `omp_init_nest_lock'. The calling thread is blocked 789 until the lock is available. If the lock is already held by the 790 current thread, the nesting count for the lock in incremented. 791 792_C/C++_: 793 _Prototype_: `void omp_set_nest_lock(omp_nest_lock_t *lock);' 794 795_Fortran_: 796 _Interface_: `subroutine omp_set_nest_lock(lock)' 797 `integer(omp_nest_lock_kind), intent(out) :: lock' 798 799_See also_: 800 *note omp_init_nest_lock::, *note omp_unset_nest_lock:: 801 802_Reference_: 803 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.3. 804 805 806File: libgomp.info, Node: omp_test_nest_lock, Next: omp_unset_nest_lock, Prev: omp_set_nest_lock, Up: Runtime Library Routines 807 8082.27 `omp_test_nest_lock' - Test and set nested lock if available 809================================================================= 810 811_Description_: 812 Before setting a nested lock, the lock variable must be 813 initialized by `omp_init_nest_lock'. Contrary to 814 `omp_set_nest_lock', `omp_test_nest_lock' does not block if the 815 lock is not available. If the lock is already held by the current 816 thread, the new nesting count is returned. Otherwise, the return 817 value equals zero. 818 819_C/C++_: 820 _Prototype_: `int omp_test_nest_lock(omp_nest_lock_t *lock);' 821 822_Fortran_: 823 _Interface_: `integer function omp_test_nest_lock(lock)' 824 `integer(omp_integer_kind) :: omp_test_nest_lock' 825 `integer(omp_nest_lock_kind), intent(inout) :: lock' 826 827_See also_: 828 *note omp_init_lock::, *note omp_set_lock::, *note omp_set_lock:: 829 830_Reference_: 831 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.5. 832 833 834File: libgomp.info, Node: omp_unset_nest_lock, Next: omp_destroy_nest_lock, Prev: omp_test_nest_lock, Up: Runtime Library Routines 835 8362.28 `omp_unset_nest_lock' - Unset nested lock 837============================================== 838 839_Description_: 840 A nested lock about to be unset must have been locked by 841 `omp_set_nested_lock' or `omp_test_nested_lock' before. In 842 addition, the lock must be held by the thread calling 843 `omp_unset_nested_lock'. If the nesting count drops to zero, the 844 lock becomes unlocked. If one ore more threads attempted to set 845 the lock before, one of them is chosen to, again, set the lock for 846 itself. 847 848_C/C++_: 849 _Prototype_: `void omp_unset_nest_lock(omp_nest_lock_t *lock);' 850 851_Fortran_: 852 _Interface_: `subroutine omp_unset_nest_lock(lock)' 853 `integer(omp_nest_lock_kind), intent(out) :: lock' 854 855_See also_: 856 *note omp_set_nest_lock:: 857 858_Reference_: 859 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.4. 860 861 862File: libgomp.info, Node: omp_destroy_nest_lock, Next: omp_get_wtick, Prev: omp_unset_nest_lock, Up: Runtime Library Routines 863 8642.29 `omp_destroy_nest_lock' - Destroy nested lock 865================================================== 866 867_Description_: 868 Destroy a nested lock. In order to be destroyed, a nested lock 869 must be in the unlocked state and its nesting count must equal 870 zero. 871 872_C/C++_: 873 _Prototype_: `void omp_destroy_nest_lock(omp_nest_lock_t *);' 874 875_Fortran_: 876 _Interface_: `subroutine omp_destroy_nest_lock(lock)' 877 `integer(omp_nest_lock_kind), intent(inout) :: lock' 878 879_See also_: 880 *note omp_init_lock:: 881 882_Reference_: 883 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.3.2. 884 885 886File: libgomp.info, Node: omp_get_wtick, Next: omp_get_wtime, Prev: omp_destroy_nest_lock, Up: Runtime Library Routines 887 8882.30 `omp_get_wtick' - Get timer precision 889========================================== 890 891_Description_: 892 Gets the timer precision, i.e., the number of seconds between two 893 successive clock ticks. 894 895_C/C++_: 896 _Prototype_: `double omp_get_wtick();' 897 898_Fortran_: 899 _Interface_: `double precision function omp_get_wtick()' 900 901_See also_: 902 *note omp_get_wtime:: 903 904_Reference_: 905 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.4.2. 906 907 908File: libgomp.info, Node: omp_get_wtime, Prev: omp_get_wtick, Up: Runtime Library Routines 909 9102.31 `omp_get_wtime' - Elapsed wall clock time 911============================================== 912 913_Description_: 914 Elapsed wall clock time in seconds. The time is measured per 915 thread, no guarantee can bee made that two distinct threads 916 measure the same time. Time is measured from some "time in the 917 past". On POSIX compliant systems the seconds since the Epoch 918 (00:00:00 UTC, January 1, 1970) are returned. 919 920_C/C++_: 921 _Prototype_: `double omp_get_wtime();' 922 923_Fortran_: 924 _Interface_: `double precision function omp_get_wtime()' 925 926_See also_: 927 *note omp_get_wtick:: 928 929_Reference_: 930 OpenMP specifications v3.0 (http://www.openmp.org/), section 3.4.1. 931 932 933File: libgomp.info, Node: Environment Variables, Next: The libgomp ABI, Prev: Runtime Library Routines, Up: Top 934 9353 Environment Variables 936*********************** 937 938The variables `OMP_DYNAMIC', `OMP_MAX_ACTIVE_LEVELS', `OMP_NESTED', 939`OMP_NUM_THREADS', `OMP_SCHEDULE', `OMP_STACKSIZE',`OMP_THREAD_LIMIT' 940and `OMP_WAIT_POLICY' are defined by section 4 of the OpenMP 941specifications in version 3.0, while `GOMP_CPU_AFFINITY' and 942`GOMP_STACKSIZE' are GNU extensions. 943 944* Menu: 945 946* OMP_DYNAMIC:: Dynamic adjustment of threads 947* OMP_MAX_ACTIVE_LEVELS:: Set the maximal number of nested parallel regions 948* OMP_NESTED:: Nested parallel regions 949* OMP_NUM_THREADS:: Specifies the number of threads to use 950* OMP_STACKSIZE:: Set default thread stack size 951* OMP_SCHEDULE:: How threads are scheduled 952* OMP_THREAD_LIMIT:: Set the maximal number of threads 953* OMP_WAIT_POLICY:: How waiting threads are handled 954* GOMP_CPU_AFFINITY:: Bind threads to specific CPUs 955* GOMP_STACKSIZE:: Set default thread stack size 956 957 958File: libgomp.info, Node: OMP_DYNAMIC, Next: OMP_MAX_ACTIVE_LEVELS, Up: Environment Variables 959 9603.1 `OMP_DYNAMIC' - Dynamic adjustment of threads 961================================================= 962 963_Description_: 964 Enable or disable the dynamic adjustment of the number of threads 965 within a team. The value of this environment variable shall be 966 `TRUE' or `FALSE'. If undefined, dynamic adjustment is disabled by 967 default. 968 969_See also_: 970 *note omp_set_dynamic:: 971 972_Reference_: 973 OpenMP specifications v3.0 (http://www.openmp.org/), section 4.3 974 975 976File: libgomp.info, Node: OMP_MAX_ACTIVE_LEVELS, Next: OMP_NESTED, Prev: OMP_DYNAMIC, Up: Environment Variables 977 9783.2 `OMP_MAX_ACTIVE_LEVELS' - Set the maximal number of nested parallel regions 979=============================================================================== 980 981_Description_: 982 Specifies the initial value for the maximal number of nested 983 parallel regions. The value of this variable shall be positive 984 integer. If undefined, the number of active levels is unlimited. 985 986_See also_: 987 *note omp_set_max_active_levels:: 988 989_Reference_: 990 OpenMP specifications v3.0 (http://www.openmp.org/), section 4.7 991 992 993File: libgomp.info, Node: OMP_NESTED, Next: OMP_NUM_THREADS, Prev: OMP_MAX_ACTIVE_LEVELS, Up: Environment Variables 994 9953.3 `OMP_NESTED' - Nested parallel regions 996========================================== 997 998_Description_: 999 Enable or disable nested parallel regions, i.e., whether team 1000 members are allowed to create new teams. The value of this 1001 environment variable shall be `TRUE' or `FALSE'. If undefined, 1002 nested parallel regions are disabled by default. 1003 1004_See also_: 1005 *note omp_set_nested:: 1006 1007_Reference_: 1008 OpenMP specifications v3.0 (http://www.openmp.org/), section 4.4 1009 1010 1011File: libgomp.info, Node: OMP_NUM_THREADS, Next: OMP_STACKSIZE, Prev: OMP_NESTED, Up: Environment Variables 1012 10133.4 `OMP_NUM_THREADS' - Specifies the number of threads to use 1014============================================================== 1015 1016_Description_: 1017 Specifies the default number of threads to use in parallel 1018 regions. The value of this variable shall be positive integer. If 1019 undefined one thread per CPU online is used. 1020 1021_See also_: 1022 *note omp_set_num_threads:: 1023 1024_Reference_: 1025 OpenMP specifications v3.0 (http://www.openmp.org/), section 4.2 1026 1027 1028File: libgomp.info, Node: OMP_SCHEDULE, Next: OMP_THREAD_LIMIT, Prev: OMP_STACKSIZE, Up: Environment Variables 1029 10303.5 `OMP_SCHEDULE' - How threads are scheduled 1031============================================== 1032 1033_Description_: 1034 Allows to specify `schedule type' and `chunk size'. The value of 1035 the variable shall have the form: `type[,chunk]' where `type' is 1036 one of `static', `dynamic', `guided' or `auto' The optional 1037 `chunk' size shall be a positive integer. If undefined, dynamic 1038 scheduling and a chunk size of 1 is used. 1039 1040_See also_: 1041 *note omp_set_schedule:: 1042 1043_Reference_: 1044 OpenMP specifications v3.0 (http://www.openmp.org/), sections 1045 2.5.1 and 4.1 1046 1047 1048File: libgomp.info, Node: OMP_STACKSIZE, Next: OMP_SCHEDULE, Prev: OMP_NUM_THREADS, Up: Environment Variables 1049 10503.6 `OMP_STACKSIZE' - Set default thread stack size 1051=================================================== 1052 1053_Description_: 1054 Set the default thread stack size in kilobytes, unless the number 1055 is suffixed by `B', `K', `M' or `G', in which case the size is, 1056 respectively, in bytes, kilobytes, megabytes or gigabytes. This is 1057 different from `pthread_attr_setstacksize' which gets the number 1058 of bytes as an argument. If the stacksize can not be set due to 1059 system constraints, an error is reported and the initial stacksize 1060 is left unchanged. If undefined, the stack size is system 1061 dependent. 1062 1063_Reference_: 1064 OpenMP specifications v3.0 (http://www.openmp.org/), sections 4.5 1065 1066 1067File: libgomp.info, Node: OMP_THREAD_LIMIT, Next: OMP_WAIT_POLICY, Prev: OMP_SCHEDULE, Up: Environment Variables 1068 10693.7 `OMP_THREAD_LIMIT' - Set the maximal number of threads 1070========================================================== 1071 1072_Description_: 1073 Specifies the number of threads to use for the whole program. The 1074 value of this variable shall be positive integer. If undefined, 1075 the number of threads is not limited. 1076 1077_See also_: 1078 *note OMP_NUM_THREADS:: *note omp_get_thread_limit:: 1079 1080_Reference_: 1081 OpenMP specifications v3.0 (http://www.openmp.org/), section 4.8 1082 1083 1084File: libgomp.info, Node: OMP_WAIT_POLICY, Next: GOMP_CPU_AFFINITY, Prev: OMP_THREAD_LIMIT, Up: Environment Variables 1085 10863.8 `OMP_WAIT_POLICY' - How waiting threads are handled 1087======================================================= 1088 1089_Description_: 1090 Specifies whether waiting threads should be active or passive. If 1091 the value is `PASSIVE', waiting threads should not consume CPU 1092 power while waiting; while the value is `ACTIVE' specifies that 1093 they should. 1094 1095_Reference_: 1096 OpenMP specifications v3.0 (http://www.openmp.org/), sections 4.6 1097 1098 1099File: libgomp.info, Node: GOMP_CPU_AFFINITY, Next: GOMP_STACKSIZE, Prev: OMP_WAIT_POLICY, Up: Environment Variables 1100 11013.9 `GOMP_CPU_AFFINITY' - Bind threads to specific CPUs 1102======================================================= 1103 1104_Description_: 1105 Binds threads to specific CPUs. The variable should contain a 1106 space- or comma-separated list of CPUs. This list may contain 1107 different kind of entries: either single CPU numbers in any order, 1108 a range of CPUs (M-N) or a range with some stride (M-N:S). CPU 1109 numbers are zero based. For example, `GOMP_CPU_AFFINITY="0 3 1-2 1110 4-15:2"' will bind the initial thread to CPU 0, the second to CPU 1111 3, the third to CPU 1, the fourth to CPU 2, the fifth to CPU 4, 1112 the sixth through tenth to CPUs 6, 8, 10, 12, and 14 respectively 1113 and then start assigning back from the beginning of the list. 1114 `GOMP_CPU_AFFINITY=0' binds all threads to CPU 0. 1115 1116 There is no GNU OpenMP library routine to determine whether a CPU 1117 affinity specification is in effect. As a workaround, 1118 language-specific library functions, e.g., `getenv' in C or 1119 `GET_ENVIRONMENT_VARIABLE' in Fortran, may be used to query the 1120 setting of the `GOMP_CPU_AFFINITY' environment variable. A defined 1121 CPU affinity on startup cannot be changed or disabled during the 1122 runtime of the application. 1123 1124 If this environment variable is omitted, the host system will 1125 handle the assignment of threads to CPUs. 1126 1127 1128File: libgomp.info, Node: GOMP_STACKSIZE, Prev: GOMP_CPU_AFFINITY, Up: Environment Variables 1129 11303.10 `GOMP_STACKSIZE' - Set default thread stack size 1131===================================================== 1132 1133_Description_: 1134 Set the default thread stack size in kilobytes. This is different 1135 from `pthread_attr_setstacksize' which gets the number of bytes as 1136 an argument. If the stacksize can not be set due to system 1137 constraints, an error is reported and the initial stacksize is 1138 left unchanged. If undefined, the stack size is system dependent. 1139 1140_See also_: 1141 *note GOMP_STACKSIZE:: 1142 1143_Reference_: 1144 GCC Patches Mailinglist 1145 (http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html), GCC 1146 Patches Mailinglist 1147 (http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html) 1148 1149 1150File: libgomp.info, Node: The libgomp ABI, Next: Reporting Bugs, Prev: Environment Variables, Up: Top 1151 11524 The libgomp ABI 1153***************** 1154 1155The following sections present notes on the external ABI as presented 1156by libgomp. Only maintainers should need them. 1157 1158* Menu: 1159 1160* Implementing MASTER construct:: 1161* Implementing CRITICAL construct:: 1162* Implementing ATOMIC construct:: 1163* Implementing FLUSH construct:: 1164* Implementing BARRIER construct:: 1165* Implementing THREADPRIVATE construct:: 1166* Implementing PRIVATE clause:: 1167* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses:: 1168* Implementing REDUCTION clause:: 1169* Implementing PARALLEL construct:: 1170* Implementing FOR construct:: 1171* Implementing ORDERED construct:: 1172* Implementing SECTIONS construct:: 1173* Implementing SINGLE construct:: 1174 1175 1176File: libgomp.info, Node: Implementing MASTER construct, Next: Implementing CRITICAL construct, Up: The libgomp ABI 1177 11784.1 Implementing MASTER construct 1179================================= 1180 1181 if (omp_get_thread_num () == 0) 1182 block 1183 1184 Alternately, we generate two copies of the parallel subfunction and 1185only include this in the version run by the master thread. Surely 1186that's not worthwhile though... 1187 1188 1189File: libgomp.info, Node: Implementing CRITICAL construct, Next: Implementing ATOMIC construct, Prev: Implementing MASTER construct, Up: The libgomp ABI 1190 11914.2 Implementing CRITICAL construct 1192=================================== 1193 1194Without a specified name, 1195 1196 void GOMP_critical_start (void); 1197 void GOMP_critical_end (void); 1198 1199 so that we don't get COPY relocations from libgomp to the main 1200application. 1201 1202 With a specified name, use omp_set_lock and omp_unset_lock with name 1203being transformed into a variable declared like 1204 1205 omp_lock_t gomp_critical_user_<name> __attribute__((common)) 1206 1207 Ideally the ABI would specify that all zero is a valid unlocked 1208state, and so we wouldn't actually need to initialize this at startup. 1209 1210 1211File: libgomp.info, Node: Implementing ATOMIC construct, Next: Implementing FLUSH construct, Prev: Implementing CRITICAL construct, Up: The libgomp ABI 1212 12134.3 Implementing ATOMIC construct 1214================================= 1215 1216The target should implement the `__sync' builtins. 1217 1218 Failing that we could add 1219 1220 void GOMP_atomic_enter (void) 1221 void GOMP_atomic_exit (void) 1222 1223 which reuses the regular lock code, but with yet another lock object 1224private to the library. 1225 1226 1227File: libgomp.info, Node: Implementing FLUSH construct, Next: Implementing BARRIER construct, Prev: Implementing ATOMIC construct, Up: The libgomp ABI 1228 12294.4 Implementing FLUSH construct 1230================================ 1231 1232Expands to the `__sync_synchronize' builtin. 1233 1234 1235File: libgomp.info, Node: Implementing BARRIER construct, Next: Implementing THREADPRIVATE construct, Prev: Implementing FLUSH construct, Up: The libgomp ABI 1236 12374.5 Implementing BARRIER construct 1238================================== 1239 1240 void GOMP_barrier (void) 1241 1242 1243File: libgomp.info, Node: Implementing THREADPRIVATE construct, Next: Implementing PRIVATE clause, Prev: Implementing BARRIER construct, Up: The libgomp ABI 1244 12454.6 Implementing THREADPRIVATE construct 1246======================================== 1247 1248In _most_ cases we can map this directly to `__thread'. Except that 1249OMP allows constructors for C++ objects. We can either refuse to 1250support this (how often is it used?) or we can implement something akin 1251to .ctors. 1252 1253 Even more ideally, this ctor feature is handled by extensions to the 1254main pthreads library. Failing that, we can have a set of entry points 1255to register ctor functions to be called. 1256 1257 1258File: libgomp.info, Node: Implementing PRIVATE clause, Next: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses, Prev: Implementing THREADPRIVATE construct, Up: The libgomp ABI 1259 12604.7 Implementing PRIVATE clause 1261=============================== 1262 1263In association with a PARALLEL, or within the lexical extent of a 1264PARALLEL block, the variable becomes a local variable in the parallel 1265subfunction. 1266 1267 In association with FOR or SECTIONS blocks, create a new automatic 1268variable within the current function. This preserves the semantic of 1269new variable creation. 1270 1271 1272File: libgomp.info, Node: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses, Next: Implementing REDUCTION clause, Prev: Implementing PRIVATE clause, Up: The libgomp ABI 1273 12744.8 Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses 1275======================================================================== 1276 1277Seems simple enough for PARALLEL blocks. Create a private struct for 1278communicating between parent and subfunction. In the parent, copy in 1279values for scalar and "small" structs; copy in addresses for others 1280TREE_ADDRESSABLE types. In the subfunction, copy the value into the 1281local variable. 1282 1283 Not clear at all what to do with bare FOR or SECTION blocks. The 1284only thing I can figure is that we do something like 1285 1286 #pragma omp for firstprivate(x) lastprivate(y) 1287 for (int i = 0; i < n; ++i) 1288 body; 1289 1290 which becomes 1291 1292 { 1293 int x = x, y; 1294 1295 // for stuff 1296 1297 if (i == n) 1298 y = y; 1299 } 1300 1301 where the "x=x" and "y=y" assignments actually have different uids 1302for the two variables, i.e. not something you could write directly in 1303C. Presumably this only makes sense if the "outer" x and y are global 1304variables. 1305 1306 COPYPRIVATE would work the same way, except the structure broadcast 1307would have to happen via SINGLE machinery instead. 1308 1309 1310File: libgomp.info, Node: Implementing REDUCTION clause, Next: Implementing PARALLEL construct, Prev: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses, Up: The libgomp ABI 1311 13124.9 Implementing REDUCTION clause 1313================================= 1314 1315The private struct mentioned in the previous section should have a 1316pointer to an array of the type of the variable, indexed by the 1317thread's TEAM_ID. The thread stores its final value into the array, 1318and after the barrier the master thread iterates over the array to 1319collect the values. 1320 1321 1322File: libgomp.info, Node: Implementing PARALLEL construct, Next: Implementing FOR construct, Prev: Implementing REDUCTION clause, Up: The libgomp ABI 1323 13244.10 Implementing PARALLEL construct 1325==================================== 1326 1327 #pragma omp parallel 1328 { 1329 body; 1330 } 1331 1332 becomes 1333 1334 void subfunction (void *data) 1335 { 1336 use data; 1337 body; 1338 } 1339 1340 setup data; 1341 GOMP_parallel_start (subfunction, &data, num_threads); 1342 subfunction (&data); 1343 GOMP_parallel_end (); 1344 1345 void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads) 1346 1347 The FN argument is the subfunction to be run in parallel. 1348 1349 The DATA argument is a pointer to a structure used to communicate 1350data in and out of the subfunction, as discussed above with respect to 1351FIRSTPRIVATE et al. 1352 1353 The NUM_THREADS argument is 1 if an IF clause is present and false, 1354or the value of the NUM_THREADS clause, if present, or 0. 1355 1356 The function needs to create the appropriate number of threads 1357and/or launch them from the dock. It needs to create the team 1358structure and assign team ids. 1359 1360 void GOMP_parallel_end (void) 1361 1362 Tears down the team and returns us to the previous 1363`omp_in_parallel()' state. 1364 1365 1366File: libgomp.info, Node: Implementing FOR construct, Next: Implementing ORDERED construct, Prev: Implementing PARALLEL construct, Up: The libgomp ABI 1367 13684.11 Implementing FOR construct 1369=============================== 1370 1371 #pragma omp parallel for 1372 for (i = lb; i <= ub; i++) 1373 body; 1374 1375 becomes 1376 1377 void subfunction (void *data) 1378 { 1379 long _s0, _e0; 1380 while (GOMP_loop_static_next (&_s0, &_e0)) 1381 { 1382 long _e1 = _e0, i; 1383 for (i = _s0; i < _e1; i++) 1384 body; 1385 } 1386 GOMP_loop_end_nowait (); 1387 } 1388 1389 GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0); 1390 subfunction (NULL); 1391 GOMP_parallel_end (); 1392 1393 #pragma omp for schedule(runtime) 1394 for (i = 0; i < n; i++) 1395 body; 1396 1397 becomes 1398 1399 { 1400 long i, _s0, _e0; 1401 if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0)) 1402 do { 1403 long _e1 = _e0; 1404 for (i = _s0, i < _e0; i++) 1405 body; 1406 } while (GOMP_loop_runtime_next (&_s0, _&e0)); 1407 GOMP_loop_end (); 1408 } 1409 1410 Note that while it looks like there is trickyness to propagating a 1411non-constant STEP, there isn't really. We're explicitly allowed to 1412evaluate it as many times as we want, and any variables involved should 1413automatically be handled as PRIVATE or SHARED like any other variables. 1414So the expression should remain evaluable in the subfunction. We can 1415also pull it into a local variable if we like, but since its supposed 1416to remain unchanged, we can also not if we like. 1417 1418 If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be 1419able to get away with no work-sharing context at all, since we can 1420simply perform the arithmetic directly in each thread to divide up the 1421iterations. Which would mean that we wouldn't need to call any of 1422these routines. 1423 1424 There are separate routines for handling loops with an ORDERED 1425clause. Bookkeeping for that is non-trivial... 1426 1427 1428File: libgomp.info, Node: Implementing ORDERED construct, Next: Implementing SECTIONS construct, Prev: Implementing FOR construct, Up: The libgomp ABI 1429 14304.12 Implementing ORDERED construct 1431=================================== 1432 1433 void GOMP_ordered_start (void) 1434 void GOMP_ordered_end (void) 1435 1436 1437File: libgomp.info, Node: Implementing SECTIONS construct, Next: Implementing SINGLE construct, Prev: Implementing ORDERED construct, Up: The libgomp ABI 1438 14394.13 Implementing SECTIONS construct 1440==================================== 1441 1442A block as 1443 1444 #pragma omp sections 1445 { 1446 #pragma omp section 1447 stmt1; 1448 #pragma omp section 1449 stmt2; 1450 #pragma omp section 1451 stmt3; 1452 } 1453 1454 becomes 1455 1456 for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ()) 1457 switch (i) 1458 { 1459 case 1: 1460 stmt1; 1461 break; 1462 case 2: 1463 stmt2; 1464 break; 1465 case 3: 1466 stmt3; 1467 break; 1468 } 1469 GOMP_barrier (); 1470 1471 1472File: libgomp.info, Node: Implementing SINGLE construct, Prev: Implementing SECTIONS construct, Up: The libgomp ABI 1473 14744.14 Implementing SINGLE construct 1475================================== 1476 1477A block like 1478 1479 #pragma omp single 1480 { 1481 body; 1482 } 1483 1484 becomes 1485 1486 if (GOMP_single_start ()) 1487 body; 1488 GOMP_barrier (); 1489 1490 while 1491 1492 #pragma omp single copyprivate(x) 1493 body; 1494 1495 becomes 1496 1497 datap = GOMP_single_copy_start (); 1498 if (datap == NULL) 1499 { 1500 body; 1501 data.x = x; 1502 GOMP_single_copy_end (&data); 1503 } 1504 else 1505 x = datap->x; 1506 GOMP_barrier (); 1507 1508 1509File: libgomp.info, Node: Reporting Bugs, Next: Copying, Prev: The libgomp ABI, Up: Top 1510 15115 Reporting Bugs 1512**************** 1513 1514Bugs in the GNU OpenMP implementation should be reported via bugzilla 1515(http://gcc.gnu.org/bugzilla/). In all cases, please add "openmp" to 1516the keywords field in the bug report. 1517 1518 1519File: libgomp.info, Node: Copying, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top 1520 1521GNU GENERAL PUBLIC LICENSE 1522************************** 1523 1524 Version 2, June 1991 1525 1526 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 1527 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 1528 1529 Everyone is permitted to copy and distribute verbatim copies 1530 of this license document, but changing it is not allowed. 1531 1532Preamble 1533======== 1534 1535The licenses for most software are designed to take away your freedom 1536to share and change it. By contrast, the GNU General Public License is 1537intended to guarantee your freedom to share and change free 1538software--to make sure the software is free for all its users. This 1539General Public License applies to most of the Free Software 1540Foundation's software and to any other program whose authors commit to 1541using it. (Some other Free Software Foundation software is covered by 1542the GNU Library General Public License instead.) You can apply it to 1543your programs, too. 1544 1545 When we speak of free software, we are referring to freedom, not 1546price. Our General Public Licenses are designed to make sure that you 1547have the freedom to distribute copies of free software (and charge for 1548this service if you wish), that you receive source code or can get it 1549if you want it, that you can change the software or use pieces of it in 1550new free programs; and that you know you can do these things. 1551 1552 To protect your rights, we need to make restrictions that forbid 1553anyone to deny you these rights or to ask you to surrender the rights. 1554These restrictions translate to certain responsibilities for you if you 1555distribute copies of the software, or if you modify it. 1556 1557 For example, if you distribute copies of such a program, whether 1558gratis or for a fee, you must give the recipients all the rights that 1559you have. You must make sure that they, too, receive or can get the 1560source code. And you must show them these terms so they know their 1561rights. 1562 1563 We protect your rights with two steps: (1) copyright the software, 1564and (2) offer you this license which gives you legal permission to copy, 1565distribute and/or modify the software. 1566 1567 Also, for each author's protection and ours, we want to make certain 1568that everyone understands that there is no warranty for this free 1569software. If the software is modified by someone else and passed on, we 1570want its recipients to know that what they have is not the original, so 1571that any problems introduced by others will not reflect on the original 1572authors' reputations. 1573 1574 Finally, any free program is threatened constantly by software 1575patents. We wish to avoid the danger that redistributors of a free 1576program will individually obtain patent licenses, in effect making the 1577program proprietary. To prevent this, we have made it clear that any 1578patent must be licensed for everyone's free use or not licensed at all. 1579 1580 The precise terms and conditions for copying, distribution and 1581modification follow. 1582 1583 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 1584 0. This License applies to any program or other work which contains a 1585 notice placed by the copyright holder saying it may be distributed 1586 under the terms of this General Public License. The "Program", 1587 below, refers to any such program or work, and a "work based on 1588 the Program" means either the Program or any derivative work under 1589 copyright law: that is to say, a work containing the Program or a 1590 portion of it, either verbatim or with modifications and/or 1591 translated into another language. (Hereinafter, translation is 1592 included without limitation in the term "modification".) Each 1593 licensee is addressed as "you". 1594 1595 Activities other than copying, distribution and modification are 1596 not covered by this License; they are outside its scope. The act 1597 of running the Program is not restricted, and the output from the 1598 Program is covered only if its contents constitute a work based on 1599 the Program (independent of having been made by running the 1600 Program). Whether that is true depends on what the Program does. 1601 1602 1. You may copy and distribute verbatim copies of the Program's 1603 source code as you receive it, in any medium, provided that you 1604 conspicuously and appropriately publish on each copy an appropriate 1605 copyright notice and disclaimer of warranty; keep intact all the 1606 notices that refer to this License and to the absence of any 1607 warranty; and give any other recipients of the Program a copy of 1608 this License along with the Program. 1609 1610 You may charge a fee for the physical act of transferring a copy, 1611 and you may at your option offer warranty protection in exchange 1612 for a fee. 1613 1614 2. You may modify your copy or copies of the Program or any portion 1615 of it, thus forming a work based on the Program, and copy and 1616 distribute such modifications or work under the terms of Section 1 1617 above, provided that you also meet all of these conditions: 1618 1619 a. You must cause the modified files to carry prominent notices 1620 stating that you changed the files and the date of any change. 1621 1622 b. You must cause any work that you distribute or publish, that 1623 in whole or in part contains or is derived from the Program 1624 or any part thereof, to be licensed as a whole at no charge 1625 to all third parties under the terms of this License. 1626 1627 c. If the modified program normally reads commands interactively 1628 when run, you must cause it, when started running for such 1629 interactive use in the most ordinary way, to print or display 1630 an announcement including an appropriate copyright notice and 1631 a notice that there is no warranty (or else, saying that you 1632 provide a warranty) and that users may redistribute the 1633 program under these conditions, and telling the user how to 1634 view a copy of this License. (Exception: if the Program 1635 itself is interactive but does not normally print such an 1636 announcement, your work based on the Program is not required 1637 to print an announcement.) 1638 1639 These requirements apply to the modified work as a whole. If 1640 identifiable sections of that work are not derived from the 1641 Program, and can be reasonably considered independent and separate 1642 works in themselves, then this License, and its terms, do not 1643 apply to those sections when you distribute them as separate 1644 works. But when you distribute the same sections as part of a 1645 whole which is a work based on the Program, the distribution of 1646 the whole must be on the terms of this License, whose permissions 1647 for other licensees extend to the entire whole, and thus to each 1648 and every part regardless of who wrote it. 1649 1650 Thus, it is not the intent of this section to claim rights or 1651 contest your rights to work written entirely by you; rather, the 1652 intent is to exercise the right to control the distribution of 1653 derivative or collective works based on the Program. 1654 1655 In addition, mere aggregation of another work not based on the 1656 Program with the Program (or with a work based on the Program) on 1657 a volume of a storage or distribution medium does not bring the 1658 other work under the scope of this License. 1659 1660 3. You may copy and distribute the Program (or a work based on it, 1661 under Section 2) in object code or executable form under the terms 1662 of Sections 1 and 2 above provided that you also do one of the 1663 following: 1664 1665 a. Accompany it with the complete corresponding machine-readable 1666 source code, which must be distributed under the terms of 1667 Sections 1 and 2 above on a medium customarily used for 1668 software interchange; or, 1669 1670 b. Accompany it with a written offer, valid for at least three 1671 years, to give any third party, for a charge no more than your 1672 cost of physically performing source distribution, a complete 1673 machine-readable copy of the corresponding source code, to be 1674 distributed under the terms of Sections 1 and 2 above on a 1675 medium customarily used for software interchange; or, 1676 1677 c. Accompany it with the information you received as to the offer 1678 to distribute corresponding source code. (This alternative is 1679 allowed only for noncommercial distribution and only if you 1680 received the program in object code or executable form with 1681 such an offer, in accord with Subsection b above.) 1682 1683 The source code for a work means the preferred form of the work for 1684 making modifications to it. For an executable work, complete 1685 source code means all the source code for all modules it contains, 1686 plus any associated interface definition files, plus the scripts 1687 used to control compilation and installation of the executable. 1688 However, as a special exception, the source code distributed need 1689 not include anything that is normally distributed (in either 1690 source or binary form) with the major components (compiler, 1691 kernel, and so on) of the operating system on which the executable 1692 runs, unless that component itself accompanies the executable. 1693 1694 If distribution of executable or object code is made by offering 1695 access to copy from a designated place, then offering equivalent 1696 access to copy the source code from the same place counts as 1697 distribution of the source code, even though third parties are not 1698 compelled to copy the source along with the object code. 1699 1700 4. You may not copy, modify, sublicense, or distribute the Program 1701 except as expressly provided under this License. Any attempt 1702 otherwise to copy, modify, sublicense or distribute the Program is 1703 void, and will automatically terminate your rights under this 1704 License. However, parties who have received copies, or rights, 1705 from you under this License will not have their licenses 1706 terminated so long as such parties remain in full compliance. 1707 1708 5. You are not required to accept this License, since you have not 1709 signed it. However, nothing else grants you permission to modify 1710 or distribute the Program or its derivative works. These actions 1711 are prohibited by law if you do not accept this License. 1712 Therefore, by modifying or distributing the Program (or any work 1713 based on the Program), you indicate your acceptance of this 1714 License to do so, and all its terms and conditions for copying, 1715 distributing or modifying the Program or works based on it. 1716 1717 6. Each time you redistribute the Program (or any work based on the 1718 Program), the recipient automatically receives a license from the 1719 original licensor to copy, distribute or modify the Program 1720 subject to these terms and conditions. You may not impose any 1721 further restrictions on the recipients' exercise of the rights 1722 granted herein. You are not responsible for enforcing compliance 1723 by third parties to this License. 1724 1725 7. If, as a consequence of a court judgment or allegation of patent 1726 infringement or for any other reason (not limited to patent 1727 issues), conditions are imposed on you (whether by court order, 1728 agreement or otherwise) that contradict the conditions of this 1729 License, they do not excuse you from the conditions of this 1730 License. If you cannot distribute so as to satisfy simultaneously 1731 your obligations under this License and any other pertinent 1732 obligations, then as a consequence you may not distribute the 1733 Program at all. For example, if a patent license would not permit 1734 royalty-free redistribution of the Program by all those who 1735 receive copies directly or indirectly through you, then the only 1736 way you could satisfy both it and this License would be to refrain 1737 entirely from distribution of the Program. 1738 1739 If any portion of this section is held invalid or unenforceable 1740 under any particular circumstance, the balance of the section is 1741 intended to apply and the section as a whole is intended to apply 1742 in other circumstances. 1743 1744 It is not the purpose of this section to induce you to infringe any 1745 patents or other property right claims or to contest validity of 1746 any such claims; this section has the sole purpose of protecting 1747 the integrity of the free software distribution system, which is 1748 implemented by public license practices. Many people have made 1749 generous contributions to the wide range of software distributed 1750 through that system in reliance on consistent application of that 1751 system; it is up to the author/donor to decide if he or she is 1752 willing to distribute software through any other system and a 1753 licensee cannot impose that choice. 1754 1755 This section is intended to make thoroughly clear what is believed 1756 to be a consequence of the rest of this License. 1757 1758 8. If the distribution and/or use of the Program is restricted in 1759 certain countries either by patents or by copyrighted interfaces, 1760 the original copyright holder who places the Program under this 1761 License may add an explicit geographical distribution limitation 1762 excluding those countries, so that distribution is permitted only 1763 in or among countries not thus excluded. In such case, this 1764 License incorporates the limitation as if written in the body of 1765 this License. 1766 1767 9. The Free Software Foundation may publish revised and/or new 1768 versions of the General Public License from time to time. Such 1769 new versions will be similar in spirit to the present version, but 1770 may differ in detail to address new problems or concerns. 1771 1772 Each version is given a distinguishing version number. If the 1773 Program specifies a version number of this License which applies 1774 to it and "any later version", you have the option of following 1775 the terms and conditions either of that version or of any later 1776 version published by the Free Software Foundation. If the Program 1777 does not specify a version number of this License, you may choose 1778 any version ever published by the Free Software Foundation. 1779 1780 10. If you wish to incorporate parts of the Program into other free 1781 programs whose distribution conditions are different, write to the 1782 author to ask for permission. For software which is copyrighted 1783 by the Free Software Foundation, write to the Free Software 1784 Foundation; we sometimes make exceptions for this. Our decision 1785 will be guided by the two goals of preserving the free status of 1786 all derivatives of our free software and of promoting the sharing 1787 and reuse of software generally. 1788 1789 NO WARRANTY 1790 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO 1791 WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE 1792 LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 1793 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT 1794 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT 1795 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 1796 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 1797 QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 1798 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY 1799 SERVICING, REPAIR OR CORRECTION. 1800 1801 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 1802 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY 1803 MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE 1804 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 1805 INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR 1806 INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 1807 DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU 1808 OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY 1809 OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN 1810 ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 1811 1812 END OF TERMS AND CONDITIONS 1813Appendix: How to Apply These Terms to Your New Programs 1814======================================================= 1815 1816If you develop a new program, and you want it to be of the greatest 1817possible use to the public, the best way to achieve this is to make it 1818free software which everyone can redistribute and change under these 1819terms. 1820 1821 To do so, attach the following notices to the program. It is safest 1822to attach them to the start of each source file to most effectively 1823convey the exclusion of warranty; and each file should have at least 1824the "copyright" line and a pointer to where the full notice is found. 1825 1826 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. 1827 Copyright (C) YEAR NAME OF AUTHOR 1828 1829 This program is free software; you can redistribute it and/or modify 1830 it under the terms of the GNU General Public License as published by 1831 the Free Software Foundation; either version 2 of the License, or 1832 (at your option) any later version. 1833 1834 This program is distributed in the hope that it will be useful, 1835 but WITHOUT ANY WARRANTY; without even the implied warranty of 1836 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1837 GNU General Public License for more details. 1838 1839 You should have received a copy of the GNU General Public License 1840 along with this program; if not, write to the Free Software 1841 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 1842 1843 Also add information on how to contact you by electronic and paper 1844mail. 1845 1846 If the program is interactive, make it output a short notice like 1847this when it starts in an interactive mode: 1848 1849 Gnomovision version 69, Copyright (C) YEAR NAME OF AUTHOR 1850 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details 1851 type `show w'. 1852 This is free software, and you are welcome to redistribute it 1853 under certain conditions; type `show c' for details. 1854 1855 The hypothetical commands `show w' and `show c' should show the 1856appropriate parts of the General Public License. Of course, the 1857commands you use may be called something other than `show w' and `show 1858c'; they could even be mouse-clicks or menu items--whatever suits your 1859program. 1860 1861 You should also get your employer (if you work as a programmer) or 1862your school, if any, to sign a "copyright disclaimer" for the program, 1863if necessary. Here is a sample; alter the names: 1864 1865 Yoyodyne, Inc., hereby disclaims all copyright interest in the program 1866 `Gnomovision' (which makes passes at compilers) written by James Hacker. 1867 1868 SIGNATURE OF TY COON, 1 April 1989 1869 Ty Coon, President of Vice 1870 1871 This General Public License does not permit incorporating your 1872program into proprietary programs. If your program is a subroutine 1873library, you may consider it more useful to permit linking proprietary 1874applications with the library. If this is what you want to do, use the 1875GNU Library General Public License instead of this License. 1876 1877 1878File: libgomp.info, Node: GNU Free Documentation License, Next: Funding, Prev: Copying, Up: Top 1879 1880GNU Free Documentation License 1881****************************** 1882 1883 Version 1.2, November 2002 1884 1885 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. 1886 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 1887 1888 Everyone is permitted to copy and distribute verbatim copies 1889 of this license document, but changing it is not allowed. 1890 1891 0. PREAMBLE 1892 1893 The purpose of this License is to make a manual, textbook, or other 1894 functional and useful document "free" in the sense of freedom: to 1895 assure everyone the effective freedom to copy and redistribute it, 1896 with or without modifying it, either commercially or 1897 noncommercially. Secondarily, this License preserves for the 1898 author and publisher a way to get credit for their work, while not 1899 being considered responsible for modifications made by others. 1900 1901 This License is a kind of "copyleft", which means that derivative 1902 works of the document must themselves be free in the same sense. 1903 It complements the GNU General Public License, which is a copyleft 1904 license designed for free software. 1905 1906 We have designed this License in order to use it for manuals for 1907 free software, because free software needs free documentation: a 1908 free program should come with manuals providing the same freedoms 1909 that the software does. But this License is not limited to 1910 software manuals; it can be used for any textual work, regardless 1911 of subject matter or whether it is published as a printed book. 1912 We recommend this License principally for works whose purpose is 1913 instruction or reference. 1914 1915 1. APPLICABILITY AND DEFINITIONS 1916 1917 This License applies to any manual or other work, in any medium, 1918 that contains a notice placed by the copyright holder saying it 1919 can be distributed under the terms of this License. Such a notice 1920 grants a world-wide, royalty-free license, unlimited in duration, 1921 to use that work under the conditions stated herein. The 1922 "Document", below, refers to any such manual or work. Any member 1923 of the public is a licensee, and is addressed as "you". You 1924 accept the license if you copy, modify or distribute the work in a 1925 way requiring permission under copyright law. 1926 1927 A "Modified Version" of the Document means any work containing the 1928 Document or a portion of it, either copied verbatim, or with 1929 modifications and/or translated into another language. 1930 1931 A "Secondary Section" is a named appendix or a front-matter section 1932 of the Document that deals exclusively with the relationship of the 1933 publishers or authors of the Document to the Document's overall 1934 subject (or to related matters) and contains nothing that could 1935 fall directly within that overall subject. (Thus, if the Document 1936 is in part a textbook of mathematics, a Secondary Section may not 1937 explain any mathematics.) The relationship could be a matter of 1938 historical connection with the subject or with related matters, or 1939 of legal, commercial, philosophical, ethical or political position 1940 regarding them. 1941 1942 The "Invariant Sections" are certain Secondary Sections whose 1943 titles are designated, as being those of Invariant Sections, in 1944 the notice that says that the Document is released under this 1945 License. If a section does not fit the above definition of 1946 Secondary then it is not allowed to be designated as Invariant. 1947 The Document may contain zero Invariant Sections. If the Document 1948 does not identify any Invariant Sections then there are none. 1949 1950 The "Cover Texts" are certain short passages of text that are 1951 listed, as Front-Cover Texts or Back-Cover Texts, in the notice 1952 that says that the Document is released under this License. A 1953 Front-Cover Text may be at most 5 words, and a Back-Cover Text may 1954 be at most 25 words. 1955 1956 A "Transparent" copy of the Document means a machine-readable copy, 1957 represented in a format whose specification is available to the 1958 general public, that is suitable for revising the document 1959 straightforwardly with generic text editors or (for images 1960 composed of pixels) generic paint programs or (for drawings) some 1961 widely available drawing editor, and that is suitable for input to 1962 text formatters or for automatic translation to a variety of 1963 formats suitable for input to text formatters. A copy made in an 1964 otherwise Transparent file format whose markup, or absence of 1965 markup, has been arranged to thwart or discourage subsequent 1966 modification by readers is not Transparent. An image format is 1967 not Transparent if used for any substantial amount of text. A 1968 copy that is not "Transparent" is called "Opaque". 1969 1970 Examples of suitable formats for Transparent copies include plain 1971 ASCII without markup, Texinfo input format, LaTeX input format, 1972 SGML or XML using a publicly available DTD, and 1973 standard-conforming simple HTML, PostScript or PDF designed for 1974 human modification. Examples of transparent image formats include 1975 PNG, XCF and JPG. Opaque formats include proprietary formats that 1976 can be read and edited only by proprietary word processors, SGML or 1977 XML for which the DTD and/or processing tools are not generally 1978 available, and the machine-generated HTML, PostScript or PDF 1979 produced by some word processors for output purposes only. 1980 1981 The "Title Page" means, for a printed book, the title page itself, 1982 plus such following pages as are needed to hold, legibly, the 1983 material this License requires to appear in the title page. For 1984 works in formats which do not have any title page as such, "Title 1985 Page" means the text near the most prominent appearance of the 1986 work's title, preceding the beginning of the body of the text. 1987 1988 A section "Entitled XYZ" means a named subunit of the Document 1989 whose title either is precisely XYZ or contains XYZ in parentheses 1990 following text that translates XYZ in another language. (Here XYZ 1991 stands for a specific section name mentioned below, such as 1992 "Acknowledgements", "Dedications", "Endorsements", or "History".) 1993 To "Preserve the Title" of such a section when you modify the 1994 Document means that it remains a section "Entitled XYZ" according 1995 to this definition. 1996 1997 The Document may include Warranty Disclaimers next to the notice 1998 which states that this License applies to the Document. These 1999 Warranty Disclaimers are considered to be included by reference in 2000 this License, but only as regards disclaiming warranties: any other 2001 implication that these Warranty Disclaimers may have is void and 2002 has no effect on the meaning of this License. 2003 2004 2. VERBATIM COPYING 2005 2006 You may copy and distribute the Document in any medium, either 2007 commercially or noncommercially, provided that this License, the 2008 copyright notices, and the license notice saying this License 2009 applies to the Document are reproduced in all copies, and that you 2010 add no other conditions whatsoever to those of this License. You 2011 may not use technical measures to obstruct or control the reading 2012 or further copying of the copies you make or distribute. However, 2013 you may accept compensation in exchange for copies. If you 2014 distribute a large enough number of copies you must also follow 2015 the conditions in section 3. 2016 2017 You may also lend copies, under the same conditions stated above, 2018 and you may publicly display copies. 2019 2020 3. COPYING IN QUANTITY 2021 2022 If you publish printed copies (or copies in media that commonly 2023 have printed covers) of the Document, numbering more than 100, and 2024 the Document's license notice requires Cover Texts, you must 2025 enclose the copies in covers that carry, clearly and legibly, all 2026 these Cover Texts: Front-Cover Texts on the front cover, and 2027 Back-Cover Texts on the back cover. Both covers must also clearly 2028 and legibly identify you as the publisher of these copies. The 2029 front cover must present the full title with all words of the 2030 title equally prominent and visible. You may add other material 2031 on the covers in addition. Copying with changes limited to the 2032 covers, as long as they preserve the title of the Document and 2033 satisfy these conditions, can be treated as verbatim copying in 2034 other respects. 2035 2036 If the required texts for either cover are too voluminous to fit 2037 legibly, you should put the first ones listed (as many as fit 2038 reasonably) on the actual cover, and continue the rest onto 2039 adjacent pages. 2040 2041 If you publish or distribute Opaque copies of the Document 2042 numbering more than 100, you must either include a 2043 machine-readable Transparent copy along with each Opaque copy, or 2044 state in or with each Opaque copy a computer-network location from 2045 which the general network-using public has access to download 2046 using public-standard network protocols a complete Transparent 2047 copy of the Document, free of added material. If you use the 2048 latter option, you must take reasonably prudent steps, when you 2049 begin distribution of Opaque copies in quantity, to ensure that 2050 this Transparent copy will remain thus accessible at the stated 2051 location until at least one year after the last time you 2052 distribute an Opaque copy (directly or through your agents or 2053 retailers) of that edition to the public. 2054 2055 It is requested, but not required, that you contact the authors of 2056 the Document well before redistributing any large number of 2057 copies, to give them a chance to provide you with an updated 2058 version of the Document. 2059 2060 4. MODIFICATIONS 2061 2062 You may copy and distribute a Modified Version of the Document 2063 under the conditions of sections 2 and 3 above, provided that you 2064 release the Modified Version under precisely this License, with 2065 the Modified Version filling the role of the Document, thus 2066 licensing distribution and modification of the Modified Version to 2067 whoever possesses a copy of it. In addition, you must do these 2068 things in the Modified Version: 2069 2070 A. Use in the Title Page (and on the covers, if any) a title 2071 distinct from that of the Document, and from those of 2072 previous versions (which should, if there were any, be listed 2073 in the History section of the Document). You may use the 2074 same title as a previous version if the original publisher of 2075 that version gives permission. 2076 2077 B. List on the Title Page, as authors, one or more persons or 2078 entities responsible for authorship of the modifications in 2079 the Modified Version, together with at least five of the 2080 principal authors of the Document (all of its principal 2081 authors, if it has fewer than five), unless they release you 2082 from this requirement. 2083 2084 C. State on the Title page the name of the publisher of the 2085 Modified Version, as the publisher. 2086 2087 D. Preserve all the copyright notices of the Document. 2088 2089 E. Add an appropriate copyright notice for your modifications 2090 adjacent to the other copyright notices. 2091 2092 F. Include, immediately after the copyright notices, a license 2093 notice giving the public permission to use the Modified 2094 Version under the terms of this License, in the form shown in 2095 the Addendum below. 2096 2097 G. Preserve in that license notice the full lists of Invariant 2098 Sections and required Cover Texts given in the Document's 2099 license notice. 2100 2101 H. Include an unaltered copy of this License. 2102 2103 I. Preserve the section Entitled "History", Preserve its Title, 2104 and add to it an item stating at least the title, year, new 2105 authors, and publisher of the Modified Version as given on 2106 the Title Page. If there is no section Entitled "History" in 2107 the Document, create one stating the title, year, authors, 2108 and publisher of the Document as given on its Title Page, 2109 then add an item describing the Modified Version as stated in 2110 the previous sentence. 2111 2112 J. Preserve the network location, if any, given in the Document 2113 for public access to a Transparent copy of the Document, and 2114 likewise the network locations given in the Document for 2115 previous versions it was based on. These may be placed in 2116 the "History" section. You may omit a network location for a 2117 work that was published at least four years before the 2118 Document itself, or if the original publisher of the version 2119 it refers to gives permission. 2120 2121 K. For any section Entitled "Acknowledgements" or "Dedications", 2122 Preserve the Title of the section, and preserve in the 2123 section all the substance and tone of each of the contributor 2124 acknowledgements and/or dedications given therein. 2125 2126 L. Preserve all the Invariant Sections of the Document, 2127 unaltered in their text and in their titles. Section numbers 2128 or the equivalent are not considered part of the section 2129 titles. 2130 2131 M. Delete any section Entitled "Endorsements". Such a section 2132 may not be included in the Modified Version. 2133 2134 N. Do not retitle any existing section to be Entitled 2135 "Endorsements" or to conflict in title with any Invariant 2136 Section. 2137 2138 O. Preserve any Warranty Disclaimers. 2139 2140 If the Modified Version includes new front-matter sections or 2141 appendices that qualify as Secondary Sections and contain no 2142 material copied from the Document, you may at your option 2143 designate some or all of these sections as invariant. To do this, 2144 add their titles to the list of Invariant Sections in the Modified 2145 Version's license notice. These titles must be distinct from any 2146 other section titles. 2147 2148 You may add a section Entitled "Endorsements", provided it contains 2149 nothing but endorsements of your Modified Version by various 2150 parties--for example, statements of peer review or that the text 2151 has been approved by an organization as the authoritative 2152 definition of a standard. 2153 2154 You may add a passage of up to five words as a Front-Cover Text, 2155 and a passage of up to 25 words as a Back-Cover Text, to the end 2156 of the list of Cover Texts in the Modified Version. Only one 2157 passage of Front-Cover Text and one of Back-Cover Text may be 2158 added by (or through arrangements made by) any one entity. If the 2159 Document already includes a cover text for the same cover, 2160 previously added by you or by arrangement made by the same entity 2161 you are acting on behalf of, you may not add another; but you may 2162 replace the old one, on explicit permission from the previous 2163 publisher that added the old one. 2164 2165 The author(s) and publisher(s) of the Document do not by this 2166 License give permission to use their names for publicity for or to 2167 assert or imply endorsement of any Modified Version. 2168 2169 5. COMBINING DOCUMENTS 2170 2171 You may combine the Document with other documents released under 2172 this License, under the terms defined in section 4 above for 2173 modified versions, provided that you include in the combination 2174 all of the Invariant Sections of all of the original documents, 2175 unmodified, and list them all as Invariant Sections of your 2176 combined work in its license notice, and that you preserve all 2177 their Warranty Disclaimers. 2178 2179 The combined work need only contain one copy of this License, and 2180 multiple identical Invariant Sections may be replaced with a single 2181 copy. If there are multiple Invariant Sections with the same name 2182 but different contents, make the title of each such section unique 2183 by adding at the end of it, in parentheses, the name of the 2184 original author or publisher of that section if known, or else a 2185 unique number. Make the same adjustment to the section titles in 2186 the list of Invariant Sections in the license notice of the 2187 combined work. 2188 2189 In the combination, you must combine any sections Entitled 2190 "History" in the various original documents, forming one section 2191 Entitled "History"; likewise combine any sections Entitled 2192 "Acknowledgements", and any sections Entitled "Dedications". You 2193 must delete all sections Entitled "Endorsements." 2194 2195 6. COLLECTIONS OF DOCUMENTS 2196 2197 You may make a collection consisting of the Document and other 2198 documents released under this License, and replace the individual 2199 copies of this License in the various documents with a single copy 2200 that is included in the collection, provided that you follow the 2201 rules of this License for verbatim copying of each of the 2202 documents in all other respects. 2203 2204 You may extract a single document from such a collection, and 2205 distribute it individually under this License, provided you insert 2206 a copy of this License into the extracted document, and follow 2207 this License in all other respects regarding verbatim copying of 2208 that document. 2209 2210 7. AGGREGATION WITH INDEPENDENT WORKS 2211 2212 A compilation of the Document or its derivatives with other 2213 separate and independent documents or works, in or on a volume of 2214 a storage or distribution medium, is called an "aggregate" if the 2215 copyright resulting from the compilation is not used to limit the 2216 legal rights of the compilation's users beyond what the individual 2217 works permit. When the Document is included in an aggregate, this 2218 License does not apply to the other works in the aggregate which 2219 are not themselves derivative works of the Document. 2220 2221 If the Cover Text requirement of section 3 is applicable to these 2222 copies of the Document, then if the Document is less than one half 2223 of the entire aggregate, the Document's Cover Texts may be placed 2224 on covers that bracket the Document within the aggregate, or the 2225 electronic equivalent of covers if the Document is in electronic 2226 form. Otherwise they must appear on printed covers that bracket 2227 the whole aggregate. 2228 2229 8. TRANSLATION 2230 2231 Translation is considered a kind of modification, so you may 2232 distribute translations of the Document under the terms of section 2233 4. Replacing Invariant Sections with translations requires special 2234 permission from their copyright holders, but you may include 2235 translations of some or all Invariant Sections in addition to the 2236 original versions of these Invariant Sections. You may include a 2237 translation of this License, and all the license notices in the 2238 Document, and any Warranty Disclaimers, provided that you also 2239 include the original English version of this License and the 2240 original versions of those notices and disclaimers. In case of a 2241 disagreement between the translation and the original version of 2242 this License or a notice or disclaimer, the original version will 2243 prevail. 2244 2245 If a section in the Document is Entitled "Acknowledgements", 2246 "Dedications", or "History", the requirement (section 4) to 2247 Preserve its Title (section 1) will typically require changing the 2248 actual title. 2249 2250 9. TERMINATION 2251 2252 You may not copy, modify, sublicense, or distribute the Document 2253 except as expressly provided for under this License. Any other 2254 attempt to copy, modify, sublicense or distribute the Document is 2255 void, and will automatically terminate your rights under this 2256 License. However, parties who have received copies, or rights, 2257 from you under this License will not have their licenses 2258 terminated so long as such parties remain in full compliance. 2259 2260 10. FUTURE REVISIONS OF THIS LICENSE 2261 2262 The Free Software Foundation may publish new, revised versions of 2263 the GNU Free Documentation License from time to time. Such new 2264 versions will be similar in spirit to the present version, but may 2265 differ in detail to address new problems or concerns. See 2266 `http://www.gnu.org/copyleft/'. 2267 2268 Each version of the License is given a distinguishing version 2269 number. If the Document specifies that a particular numbered 2270 version of this License "or any later version" applies to it, you 2271 have the option of following the terms and conditions either of 2272 that specified version or of any later version that has been 2273 published (not as a draft) by the Free Software Foundation. If 2274 the Document does not specify a version number of this License, 2275 you may choose any version ever published (not as a draft) by the 2276 Free Software Foundation. 2277 2278ADDENDUM: How to use this License for your documents 2279==================================================== 2280 2281To use this License in a document you have written, include a copy of 2282the License in the document and put the following copyright and license 2283notices just after the title page: 2284 2285 Copyright (C) YEAR YOUR NAME. 2286 Permission is granted to copy, distribute and/or modify this document 2287 under the terms of the GNU Free Documentation License, Version 1.2 2288 or any later version published by the Free Software Foundation; 2289 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 2290 Texts. A copy of the license is included in the section entitled ``GNU 2291 Free Documentation License''. 2292 2293 If you have Invariant Sections, Front-Cover Texts and Back-Cover 2294Texts, replace the "with...Texts." line with this: 2295 2296 with the Invariant Sections being LIST THEIR TITLES, with 2297 the Front-Cover Texts being LIST, and with the Back-Cover Texts 2298 being LIST. 2299 2300 If you have Invariant Sections without Cover Texts, or some other 2301combination of the three, merge those two alternatives to suit the 2302situation. 2303 2304 If your document contains nontrivial examples of program code, we 2305recommend releasing these examples in parallel under your choice of 2306free software license, such as the GNU General Public License, to 2307permit their use in free software. 2308 2309 2310File: libgomp.info, Node: Funding, Next: Index, Prev: GNU Free Documentation License, Up: Top 2311 2312Funding Free Software 2313********************* 2314 2315If you want to have more free software a few years from now, it makes 2316sense for you to help encourage people to contribute funds for its 2317development. The most effective approach known is to encourage 2318commercial redistributors to donate. 2319 2320 Users of free software systems can boost the pace of development by 2321encouraging for-a-fee distributors to donate part of their selling price 2322to free software developers--the Free Software Foundation, and others. 2323 2324 The way to convince distributors to do this is to demand it and 2325expect it from them. So when you compare distributors, judge them 2326partly by how much they give to free software development. Show 2327distributors they must compete to be the one who gives the most. 2328 2329 To make this approach work, you must insist on numbers that you can 2330compare, such as, "We will donate ten dollars to the Frobnitz project 2331for each disk sold." Don't be satisfied with a vague promise, such as 2332"A portion of the profits are donated," since it doesn't give a basis 2333for comparison. 2334 2335 Even a precise fraction "of the profits from this disk" is not very 2336meaningful, since creative accounting and unrelated business decisions 2337can greatly alter what fraction of the sales price counts as profit. 2338If the price you pay is $50, ten percent of the profit is probably less 2339than a dollar; it might be a few cents, or nothing at all. 2340 2341 Some redistributors do development work themselves. This is useful 2342too; but to keep everyone honest, you need to inquire how much they do, 2343and what kind. Some kinds of development make much more long-term 2344difference than others. For example, maintaining a separate version of 2345a program contributes very little; maintaining the standard version of a 2346program for the whole community contributes much. Easy new ports 2347contribute little, since someone else would surely do them; difficult 2348ports such as adding a new CPU to the GNU Compiler Collection 2349contribute more; major new features or packages contribute the most. 2350 2351 By establishing the idea that supporting further development is "the 2352proper thing to do" when distributing free software for a fee, we can 2353assure a steady flow of resources into making more free software. 2354 2355 Copyright (C) 1994 Free Software Foundation, Inc. 2356 Verbatim copying and redistribution of this section is permitted 2357 without royalty; alteration is not permitted. 2358 2359 2360File: libgomp.info, Node: Index, Prev: Funding, Up: Top 2361 2362Index 2363***** 2364 2365[index] 2366* Menu: 2367 2368* Environment Variable <1>: GOMP_STACKSIZE. (line 6) 2369* Environment Variable <2>: GOMP_CPU_AFFINITY. (line 6) 2370* Environment Variable <3>: OMP_WAIT_POLICY. (line 6) 2371* Environment Variable <4>: OMP_THREAD_LIMIT. (line 6) 2372* Environment Variable <5>: OMP_STACKSIZE. (line 6) 2373* Environment Variable <6>: OMP_SCHEDULE. (line 6) 2374* Environment Variable <7>: OMP_NUM_THREADS. (line 6) 2375* Environment Variable <8>: OMP_NESTED. (line 6) 2376* Environment Variable <9>: OMP_MAX_ACTIVE_LEVELS. (line 6) 2377* Environment Variable: OMP_DYNAMIC. (line 6) 2378* FDL, GNU Free Documentation License: GNU Free Documentation License. 2379 (line 6) 2380* Implementation specific setting <1>: GOMP_STACKSIZE. (line 6) 2381* Implementation specific setting <2>: OMP_SCHEDULE. (line 6) 2382* Implementation specific setting <3>: OMP_NUM_THREADS. (line 6) 2383* Implementation specific setting: OMP_NESTED. (line 6) 2384* Introduction: Top. (line 6) 2385 2386 2387 2388Tag Table: 2389Node: Top2053 2390Node: Enabling OpenMP3247 2391Node: Runtime Library Routines4032 2392Node: omp_get_active_level6407 2393Node: omp_get_ancestor_thread_num7098 2394Node: omp_get_dynamic8012 2395Node: omp_get_level8886 2396Node: omp_get_max_active_levels9497 2397Node: omp_get_max_threads10185 2398Node: omp_get_nested10937 2399Node: omp_get_num_procs11845 2400Node: omp_get_num_threads12359 2401Node: omp_get_schedule13429 2402Node: omp_get_team_size14336 2403Node: omp_get_thread_limit15294 2404Node: omp_get_thread_num15913 2405Node: omp_in_parallel16767 2406Node: omp_set_dynamic17413 2407Node: omp_set_max_active_levels18249 2408Node: omp_set_nested19011 2409Node: omp_set_num_threads19888 2410Node: omp_set_schedule20726 2411Node: omp_init_lock21770 2412Node: omp_set_lock22420 2413Node: omp_test_lock23269 2414Node: omp_unset_lock24296 2415Node: omp_destroy_lock25222 2416Node: omp_init_nest_lock25892 2417Node: omp_set_nest_lock26624 2418Node: omp_test_nest_lock27533 2419Node: omp_unset_nest_lock28631 2420Node: omp_destroy_nest_lock29640 2421Node: omp_get_wtick30388 2422Node: omp_get_wtime30975 2423Node: Environment Variables31758 2424Node: OMP_DYNAMIC32819 2425Node: OMP_MAX_ACTIVE_LEVELS33387 2426Node: OMP_NESTED34024 2427Node: OMP_NUM_THREADS34628 2428Node: OMP_SCHEDULE35201 2429Node: OMP_STACKSIZE35895 2430Node: OMP_THREAD_LIMIT36720 2431Node: OMP_WAIT_POLICY37313 2432Node: GOMP_CPU_AFFINITY37878 2433Node: GOMP_STACKSIZE39362 2434Node: The libgomp ABI40172 2435Node: Implementing MASTER construct40970 2436Node: Implementing CRITICAL construct41383 2437Node: Implementing ATOMIC construct42131 2438Node: Implementing FLUSH construct42612 2439Node: Implementing BARRIER construct42883 2440Node: Implementing THREADPRIVATE construct43152 2441Node: Implementing PRIVATE clause43804 2442Node: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses44385 2443Node: Implementing REDUCTION clause45700 2444Node: Implementing PARALLEL construct46256 2445Node: Implementing FOR construct47513 2446Node: Implementing ORDERED construct49511 2447Node: Implementing SECTIONS construct49817 2448Node: Implementing SINGLE construct50583 2449Node: Reporting Bugs51245 2450Node: Copying51553 2451Node: GNU Free Documentation License70763 2452Node: Funding93174 2453Node: Index95691 2454 2455End Tag Table 2456