1This is libgomp.info, produced by makeinfo version 6.5 from 2libgomp.texi. 3 4Copyright (C) 2006-2021 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.3 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 funds 22for GNU development. 23INFO-DIR-SECTION GNU Libraries 24START-INFO-DIR-ENTRY 25* libgomp: (libgomp). GNU Offloading and Multi Processing Runtime Library. 26END-INFO-DIR-ENTRY 27 28 This manual documents libgomp, the GNU Offloading and Multi 29Processing Runtime library. This is the GNU implementation of the 30OpenMP and OpenACC APIs for parallel and accelerator programming in 31C/C++ and Fortran. 32 33 Published by the Free Software Foundation 51 Franklin Street, Fifth 34Floor Boston, MA 02110-1301 USA 35 36 Copyright (C) 2006-2021 Free Software Foundation, Inc. 37 38 Permission is granted to copy, distribute and/or modify this document 39under the terms of the GNU Free Documentation License, Version 1.3 or 40any later version published by the Free Software Foundation; with the 41Invariant Sections being "Funding Free Software", the Front-Cover texts 42being (a) (see below), and with the Back-Cover Texts being (b) (see 43below). A copy of the license is included in the section entitled "GNU 44Free Documentation License". 45 46 (a) The FSF's Front-Cover Text is: 47 48 A GNU Manual 49 50 (b) The FSF's Back-Cover Text is: 51 52 You have freedom to copy and modify this GNU Manual, like GNU 53software. Copies published by the Free Software Foundation raise funds 54for GNU development. 55 56 57File: libgomp.info, Node: Top, Next: Enabling OpenMP 58 59Introduction 60************ 61 62This manual documents the usage of libgomp, the GNU Offloading and Multi 63Processing Runtime Library. This includes the GNU implementation of the 64OpenMP (https://www.openmp.org) Application Programming Interface (API) 65for multi-platform shared-memory parallel programming in C/C++ and 66Fortran, and the GNU implementation of the OpenACC 67(https://www.openacc.org) Application Programming Interface (API) for 68offloading of code to accelerator devices in C/C++ and Fortran. 69 70 Originally, libgomp implemented the GNU OpenMP Runtime Library. 71Based on this, support for OpenACC and offloading (both OpenACC and 72OpenMP 4's target construct) has been added later on, and the library's 73name changed to GNU Offloading and Multi Processing Runtime Library. 74 75* Menu: 76 77* Enabling OpenMP:: How to enable OpenMP for your applications. 78* OpenMP Runtime Library Routines: Runtime Library Routines. 79 The OpenMP runtime application programming 80 interface. 81* OpenMP Environment Variables: Environment Variables. 82 Influencing OpenMP runtime behavior with 83 environment variables. 84* Enabling OpenACC:: How to enable OpenACC for your 85 applications. 86* OpenACC Runtime Library Routines:: The OpenACC runtime application 87 programming interface. 88* OpenACC Environment Variables:: Influencing OpenACC runtime behavior with 89 environment variables. 90* CUDA Streams Usage:: Notes on the implementation of 91 asynchronous operations. 92* OpenACC Library Interoperability:: OpenACC library interoperability with the 93 NVIDIA CUBLAS library. 94* OpenACC Profiling Interface:: 95* The libgomp ABI:: Notes on the external ABI presented by libgomp. 96* Reporting Bugs:: How to report bugs in the GNU Offloading and 97 Multi Processing Runtime Library. 98* Copying:: GNU general public license says 99 how you can copy and share libgomp. 100* GNU Free Documentation License:: 101 How you can copy and share this manual. 102* Funding:: How to help assure continued work for free 103 software. 104* Library Index:: Index of this documentation. 105 106 107File: libgomp.info, Node: Enabling OpenMP, Next: Runtime Library Routines, Up: Top 108 1091 Enabling OpenMP 110***************** 111 112To activate the OpenMP extensions for C/C++ and Fortran, the 113compile-time flag '-fopenmp' must be specified. This enables the OpenMP 114directive '#pragma omp' in C/C++ and '!$omp' directives in free form, 115'c$omp', '*$omp' and '!$omp' directives in fixed form, '!$' conditional 116compilation sentinels in free form and 'c$', '*$' and '!$' sentinels in 117fixed form, for Fortran. The flag also arranges for automatic linking 118of the OpenMP runtime library (*note Runtime Library Routines::). 119 120 A complete description of all OpenMP directives accepted may be found 121in the OpenMP Application Program Interface (https://www.openmp.org) 122manual, version 4.5. 123 124 125File: libgomp.info, Node: Runtime Library Routines, Next: Environment Variables, Prev: Enabling OpenMP, Up: Top 126 1272 OpenMP Runtime Library Routines 128********************************* 129 130The runtime routines described here are defined by Section 3 of the 131OpenMP specification in version 4.5. The routines are structured in 132following three parts: 133 134* Menu: 135 136Control threads, processors and the parallel environment. They have C 137linkage, and do not throw exceptions. 138 139* omp_get_active_level:: Number of active parallel regions 140* omp_get_ancestor_thread_num:: Ancestor thread ID 141* omp_get_cancellation:: Whether cancellation support is enabled 142* omp_get_default_device:: Get the default device for target regions 143* omp_get_dynamic:: Dynamic teams setting 144* omp_get_initial_device:: Device number of host device 145* omp_get_level:: Number of parallel regions 146* omp_get_max_active_levels:: Current maximum number of active regions 147* omp_get_max_task_priority:: Maximum task priority value that can be set 148* omp_get_max_threads:: Maximum number of threads of parallel region 149* omp_get_nested:: Nested parallel regions 150* omp_get_num_devices:: Number of target devices 151* omp_get_num_procs:: Number of processors online 152* omp_get_num_teams:: Number of teams 153* omp_get_num_threads:: Size of the active team 154* omp_get_proc_bind:: Whether theads may be moved between CPUs 155* omp_get_schedule:: Obtain the runtime scheduling method 156* omp_get_supported_active_levels:: Maximum number of active regions supported 157* omp_get_team_num:: Get team number 158* omp_get_team_size:: Number of threads in a team 159* omp_get_thread_limit:: Maximum number of threads 160* omp_get_thread_num:: Current thread ID 161* omp_in_parallel:: Whether a parallel region is active 162* omp_in_final:: Whether in final or included task region 163* omp_is_initial_device:: Whether executing on the host device 164* omp_set_default_device:: Set the default device for target regions 165* omp_set_dynamic:: Enable/disable dynamic teams 166* omp_set_max_active_levels:: Limits the number of active parallel regions 167* omp_set_nested:: Enable/disable nested parallel regions 168* omp_set_num_threads:: Set upper team size limit 169* omp_set_schedule:: Set the runtime scheduling method 170 171Initialize, set, test, unset and destroy simple and nested locks. 172 173* omp_init_lock:: Initialize simple lock 174* omp_set_lock:: Wait for and set simple lock 175* omp_test_lock:: Test and set simple lock if available 176* omp_unset_lock:: Unset simple lock 177* omp_destroy_lock:: Destroy simple lock 178* omp_init_nest_lock:: Initialize nested lock 179* omp_set_nest_lock:: Wait for and set simple lock 180* omp_test_nest_lock:: Test and set nested lock if available 181* omp_unset_nest_lock:: Unset nested lock 182* omp_destroy_nest_lock:: Destroy nested lock 183 184Portable, thread-based, wall clock timer. 185 186* omp_get_wtick:: Get timer precision. 187* omp_get_wtime:: Elapsed wall clock time. 188 189Support for event objects. 190 191* omp_fulfill_event:: Fulfill and destroy an OpenMP event. 192 193 194File: libgomp.info, Node: omp_get_active_level, Next: omp_get_ancestor_thread_num, Up: Runtime Library Routines 195 1962.1 'omp_get_active_level' - Number of parallel regions 197======================================================= 198 199_Description_: 200 This function returns the nesting level for the active parallel 201 blocks, which enclose the calling call. 202 203_C/C++_ 204 _Prototype_: 'int omp_get_active_level(void);' 205 206_Fortran_: 207 _Interface_: 'integer function omp_get_active_level()' 208 209_See also_: 210 *note omp_get_level::, *note omp_get_max_active_levels::, *note 211 omp_set_max_active_levels:: 212 213_Reference_: 214 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.20. 215 216 217File: libgomp.info, Node: omp_get_ancestor_thread_num, Next: omp_get_cancellation, Prev: omp_get_active_level, Up: Runtime Library Routines 218 2192.2 'omp_get_ancestor_thread_num' - Ancestor thread ID 220====================================================== 221 222_Description_: 223 This function returns the thread identification number for the 224 given nesting level of the current thread. For values of LEVEL 225 outside zero to 'omp_get_level' -1 is returned; if LEVEL is 226 'omp_get_level' the result is identical to 'omp_get_thread_num'. 227 228_C/C++_ 229 _Prototype_: 'int omp_get_ancestor_thread_num(int level);' 230 231_Fortran_: 232 _Interface_: 'integer function omp_get_ancestor_thread_num(level)' 233 'integer level' 234 235_See also_: 236 *note omp_get_level::, *note omp_get_thread_num::, *note 237 omp_get_team_size:: 238 239_Reference_: 240 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.18. 241 242 243File: libgomp.info, Node: omp_get_cancellation, Next: omp_get_default_device, Prev: omp_get_ancestor_thread_num, Up: Runtime Library Routines 244 2452.3 'omp_get_cancellation' - Whether cancellation support is enabled 246==================================================================== 247 248_Description_: 249 This function returns 'true' if cancellation is activated, 'false' 250 otherwise. Here, 'true' and 'false' represent their 251 language-specific counterparts. Unless 'OMP_CANCELLATION' is set 252 true, cancellations are deactivated. 253 254_C/C++_: 255 _Prototype_: 'int omp_get_cancellation(void);' 256 257_Fortran_: 258 _Interface_: 'logical function omp_get_cancellation()' 259 260_See also_: 261 *note OMP_CANCELLATION:: 262 263_Reference_: 264 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.9. 265 266 267File: libgomp.info, Node: omp_get_default_device, Next: omp_get_dynamic, Prev: omp_get_cancellation, Up: Runtime Library Routines 268 2692.4 'omp_get_default_device' - Get the default device for target regions 270======================================================================== 271 272_Description_: 273 Get the default device for target regions without device clause. 274 275_C/C++_: 276 _Prototype_: 'int omp_get_default_device(void);' 277 278_Fortran_: 279 _Interface_: 'integer function omp_get_default_device()' 280 281_See also_: 282 *note OMP_DEFAULT_DEVICE::, *note omp_set_default_device:: 283 284_Reference_: 285 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.30. 286 287 288File: libgomp.info, Node: omp_get_dynamic, Next: omp_get_initial_device, Prev: omp_get_default_device, Up: Runtime Library Routines 289 2902.5 'omp_get_dynamic' - Dynamic teams setting 291============================================= 292 293_Description_: 294 This function returns 'true' if enabled, 'false' otherwise. Here, 295 'true' and 'false' represent their language-specific counterparts. 296 297 The dynamic team setting may be initialized at startup by the 298 'OMP_DYNAMIC' environment variable or at runtime using 299 'omp_set_dynamic'. If undefined, dynamic adjustment is disabled by 300 default. 301 302_C/C++_: 303 _Prototype_: 'int omp_get_dynamic(void);' 304 305_Fortran_: 306 _Interface_: 'logical function omp_get_dynamic()' 307 308_See also_: 309 *note omp_set_dynamic::, *note OMP_DYNAMIC:: 310 311_Reference_: 312 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.8. 313 314 315File: libgomp.info, Node: omp_get_initial_device, Next: omp_get_level, Prev: omp_get_dynamic, Up: Runtime Library Routines 316 3172.6 'omp_get_initial_device' - Return device number of initial device 318===================================================================== 319 320_Description_: 321 This function returns a device number that represents the host 322 device. For OpenMP 5.1, this must be equal to the value returned 323 by the 'omp_get_num_devices' function. 324 325_C/C++_ 326 _Prototype_: 'int omp_get_initial_device(void);' 327 328_Fortran_: 329 _Interface_: 'integer function omp_get_initial_device()' 330 331_See also_: 332 *note omp_get_num_devices:: 333 334_Reference_: 335 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.35. 336 337 338File: libgomp.info, Node: omp_get_level, Next: omp_get_max_active_levels, Prev: omp_get_initial_device, Up: Runtime Library Routines 339 3402.7 'omp_get_level' - Obtain the current nesting level 341====================================================== 342 343_Description_: 344 This function returns the nesting level for the parallel blocks, 345 which enclose the calling call. 346 347_C/C++_ 348 _Prototype_: 'int omp_get_level(void);' 349 350_Fortran_: 351 _Interface_: 'integer function omp_level()' 352 353_See also_: 354 *note omp_get_active_level:: 355 356_Reference_: 357 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.17. 358 359 360File: libgomp.info, Node: omp_get_max_active_levels, Next: omp_get_max_task_priority, Prev: omp_get_level, Up: Runtime Library Routines 361 3622.8 'omp_get_max_active_levels' - Current maximum number of active regions 363========================================================================== 364 365_Description_: 366 This function obtains the maximum allowed number of nested, active 367 parallel regions. 368 369_C/C++_ 370 _Prototype_: 'int omp_get_max_active_levels(void);' 371 372_Fortran_: 373 _Interface_: 'integer function omp_get_max_active_levels()' 374 375_See also_: 376 *note omp_set_max_active_levels::, *note omp_get_active_level:: 377 378_Reference_: 379 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.16. 380 381 382File: libgomp.info, Node: omp_get_max_task_priority, Next: omp_get_max_threads, Prev: omp_get_max_active_levels, Up: Runtime Library Routines 383 3842.9 'omp_get_max_task_priority' - Maximum priority value 385======================================================== 386 387that can be set for tasks. 388_Description_: 389 This function obtains the maximum allowed priority number for 390 tasks. 391 392_C/C++_ 393 _Prototype_: 'int omp_get_max_task_priority(void);' 394 395_Fortran_: 396 _Interface_: 'integer function omp_get_max_task_priority()' 397 398_Reference_: 399 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.29. 400 401 402File: libgomp.info, Node: omp_get_max_threads, Next: omp_get_nested, Prev: omp_get_max_task_priority, Up: Runtime Library Routines 403 4042.10 'omp_get_max_threads' - Maximum number of threads of parallel region 405========================================================================= 406 407_Description_: 408 Return the maximum number of threads used for the current parallel 409 region that does not use the clause 'num_threads'. 410 411_C/C++_: 412 _Prototype_: 'int omp_get_max_threads(void);' 413 414_Fortran_: 415 _Interface_: 'integer function omp_get_max_threads()' 416 417_See also_: 418 *note omp_set_num_threads::, *note omp_set_dynamic::, *note 419 omp_get_thread_limit:: 420 421_Reference_: 422 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.3. 423 424 425File: libgomp.info, Node: omp_get_nested, Next: omp_get_num_devices, Prev: omp_get_max_threads, Up: Runtime Library Routines 426 4272.11 'omp_get_nested' - Nested parallel regions 428=============================================== 429 430_Description_: 431 This function returns 'true' if nested parallel regions are 432 enabled, 'false' otherwise. Here, 'true' and 'false' represent 433 their language-specific counterparts. 434 435 The state of nested parallel regions at startup depends on several 436 environment variables. If 'OMP_MAX_ACTIVE_LEVELS' is defined and 437 is set to greater than one, then nested parallel regions will be 438 enabled. If not defined, then the value of the 'OMP_NESTED' 439 environment variable will be followed if defined. If neither are 440 defined, then if either 'OMP_NUM_THREADS' or 'OMP_PROC_BIND' are 441 defined with a list of more than one value, then nested parallel 442 regions are enabled. If none of these are defined, then nested 443 parallel regions are disabled by default. 444 445 Nested parallel regions can be enabled or disabled at runtime using 446 'omp_set_nested', or by setting the maximum number of nested 447 regions with 'omp_set_max_active_levels' to one to disable, or 448 above one to enable. 449 450_C/C++_: 451 _Prototype_: 'int omp_get_nested(void);' 452 453_Fortran_: 454 _Interface_: 'logical function omp_get_nested()' 455 456_See also_: 457 *note omp_set_max_active_levels::, *note omp_set_nested::, *note 458 OMP_MAX_ACTIVE_LEVELS::, *note OMP_NESTED:: 459 460_Reference_: 461 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.11. 462 463 464File: libgomp.info, Node: omp_get_num_devices, Next: omp_get_num_procs, Prev: omp_get_nested, Up: Runtime Library Routines 465 4662.12 'omp_get_num_devices' - Number of target devices 467===================================================== 468 469_Description_: 470 Returns the number of target devices. 471 472_C/C++_: 473 _Prototype_: 'int omp_get_num_devices(void);' 474 475_Fortran_: 476 _Interface_: 'integer function omp_get_num_devices()' 477 478_Reference_: 479 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.31. 480 481 482File: libgomp.info, Node: omp_get_num_procs, Next: omp_get_num_teams, Prev: omp_get_num_devices, Up: Runtime Library Routines 483 4842.13 'omp_get_num_procs' - Number of processors online 485====================================================== 486 487_Description_: 488 Returns the number of processors online on that device. 489 490_C/C++_: 491 _Prototype_: 'int omp_get_num_procs(void);' 492 493_Fortran_: 494 _Interface_: 'integer function omp_get_num_procs()' 495 496_Reference_: 497 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.5. 498 499 500File: libgomp.info, Node: omp_get_num_teams, Next: omp_get_num_threads, Prev: omp_get_num_procs, Up: Runtime Library Routines 501 5022.14 'omp_get_num_teams' - Number of teams 503========================================== 504 505_Description_: 506 Returns the number of teams in the current team region. 507 508_C/C++_: 509 _Prototype_: 'int omp_get_num_teams(void);' 510 511_Fortran_: 512 _Interface_: 'integer function omp_get_num_teams()' 513 514_Reference_: 515 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.32. 516 517 518File: libgomp.info, Node: omp_get_num_threads, Next: omp_get_proc_bind, Prev: omp_get_num_teams, Up: Runtime Library Routines 519 5202.15 'omp_get_num_threads' - Size of the active team 521==================================================== 522 523_Description_: 524 Returns the number of threads in the current team. In a sequential 525 section of the program 'omp_get_num_threads' returns 1. 526 527 The default team size may be initialized at startup by the 528 'OMP_NUM_THREADS' environment variable. At runtime, the size of 529 the current team may be set either by the 'NUM_THREADS' clause or 530 by 'omp_set_num_threads'. If none of the above were used to define 531 a specific value and 'OMP_DYNAMIC' is disabled, one thread per CPU 532 online is used. 533 534_C/C++_: 535 _Prototype_: 'int omp_get_num_threads(void);' 536 537_Fortran_: 538 _Interface_: 'integer function omp_get_num_threads()' 539 540_See also_: 541 *note omp_get_max_threads::, *note omp_set_num_threads::, *note 542 OMP_NUM_THREADS:: 543 544_Reference_: 545 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.2. 546 547 548File: libgomp.info, Node: omp_get_proc_bind, Next: omp_get_schedule, Prev: omp_get_num_threads, Up: Runtime Library Routines 549 5502.16 'omp_get_proc_bind' - Whether theads may be moved between CPUs 551=================================================================== 552 553_Description_: 554 This functions returns the currently active thread affinity policy, 555 which is set via 'OMP_PROC_BIND'. Possible values are 556 'omp_proc_bind_false', 'omp_proc_bind_true', 557 'omp_proc_bind_master', 'omp_proc_bind_close' and 558 'omp_proc_bind_spread'. 559 560_C/C++_: 561 _Prototype_: 'omp_proc_bind_t omp_get_proc_bind(void);' 562 563_Fortran_: 564 _Interface_: 'integer(kind=omp_proc_bind_kind) function 565 omp_get_proc_bind()' 566 567_See also_: 568 *note OMP_PROC_BIND::, *note OMP_PLACES::, *note 569 GOMP_CPU_AFFINITY::, 570 571_Reference_: 572 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.22. 573 574 575File: libgomp.info, Node: omp_get_schedule, Next: omp_get_supported_active_levels, Prev: omp_get_proc_bind, Up: Runtime Library Routines 576 5772.17 'omp_get_schedule' - Obtain the runtime scheduling method 578============================================================== 579 580_Description_: 581 Obtain the runtime scheduling method. The KIND argument will be 582 set to the value 'omp_sched_static', 'omp_sched_dynamic', 583 'omp_sched_guided' or 'omp_sched_auto'. The second argument, 584 CHUNK_SIZE, is set to the chunk size. 585 586_C/C++_ 587 _Prototype_: 'void omp_get_schedule(omp_sched_t *kind, int 588 *chunk_size);' 589 590_Fortran_: 591 _Interface_: 'subroutine omp_get_schedule(kind, chunk_size)' 592 'integer(kind=omp_sched_kind) kind' 593 'integer chunk_size' 594 595_See also_: 596 *note omp_set_schedule::, *note OMP_SCHEDULE:: 597 598_Reference_: 599 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.13. 600 601 602File: libgomp.info, Node: omp_get_supported_active_levels, Next: omp_get_team_num, Prev: omp_get_schedule, Up: Runtime Library Routines 603 6042.18 'omp_get_supported_active_levels' - Maximum number of active regions supported 605=================================================================================== 606 607_Description_: 608 This function returns the maximum number of nested, active parallel 609 regions supported by this implementation. 610 611_C/C++_ 612 _Prototype_: 'int omp_get_supported_active_levels(void);' 613 614_Fortran_: 615 _Interface_: 'integer function omp_get_supported_active_levels()' 616 617_See also_: 618 *note omp_get_max_active_levels::, *note 619 omp_set_max_active_levels:: 620 621_Reference_: 622 OpenMP specification v5.0 (https://www.openmp.org), Section 3.2.15. 623 624 625File: libgomp.info, Node: omp_get_team_num, Next: omp_get_team_size, Prev: omp_get_supported_active_levels, Up: Runtime Library Routines 626 6272.19 'omp_get_team_num' - Get team number 628========================================= 629 630_Description_: 631 Returns the team number of the calling thread. 632 633_C/C++_: 634 _Prototype_: 'int omp_get_team_num(void);' 635 636_Fortran_: 637 _Interface_: 'integer function omp_get_team_num()' 638 639_Reference_: 640 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.33. 641 642 643File: libgomp.info, Node: omp_get_team_size, Next: omp_get_thread_limit, Prev: omp_get_team_num, Up: Runtime Library Routines 644 6452.20 'omp_get_team_size' - Number of threads in a team 646====================================================== 647 648_Description_: 649 This function returns the number of threads in a thread team to 650 which either the current thread or its ancestor belongs. For 651 values of LEVEL outside zero to 'omp_get_level', -1 is returned; if 652 LEVEL is zero, 1 is returned, and for 'omp_get_level', the result 653 is identical to 'omp_get_num_threads'. 654 655_C/C++_: 656 _Prototype_: 'int omp_get_team_size(int level);' 657 658_Fortran_: 659 _Interface_: 'integer function omp_get_team_size(level)' 660 'integer level' 661 662_See also_: 663 *note omp_get_num_threads::, *note omp_get_level::, *note 664 omp_get_ancestor_thread_num:: 665 666_Reference_: 667 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.19. 668 669 670File: libgomp.info, Node: omp_get_thread_limit, Next: omp_get_thread_num, Prev: omp_get_team_size, Up: Runtime Library Routines 671 6722.21 'omp_get_thread_limit' - Maximum number of threads 673======================================================= 674 675_Description_: 676 Return the maximum number of threads of the program. 677 678_C/C++_: 679 _Prototype_: 'int omp_get_thread_limit(void);' 680 681_Fortran_: 682 _Interface_: 'integer function omp_get_thread_limit()' 683 684_See also_: 685 *note omp_get_max_threads::, *note OMP_THREAD_LIMIT:: 686 687_Reference_: 688 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.14. 689 690 691File: libgomp.info, Node: omp_get_thread_num, Next: omp_in_parallel, Prev: omp_get_thread_limit, Up: Runtime Library Routines 692 6932.22 'omp_get_thread_num' - Current thread ID 694============================================= 695 696_Description_: 697 Returns a unique thread identification number within the current 698 team. In a sequential parts of the program, 'omp_get_thread_num' 699 always returns 0. In parallel regions the return value varies from 700 0 to 'omp_get_num_threads'-1 inclusive. The return value of the 701 master thread of a team is always 0. 702 703_C/C++_: 704 _Prototype_: 'int omp_get_thread_num(void);' 705 706_Fortran_: 707 _Interface_: 'integer function omp_get_thread_num()' 708 709_See also_: 710 *note omp_get_num_threads::, *note omp_get_ancestor_thread_num:: 711 712_Reference_: 713 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.4. 714 715 716File: libgomp.info, Node: omp_in_parallel, Next: omp_in_final, Prev: omp_get_thread_num, Up: Runtime Library Routines 717 7182.23 'omp_in_parallel' - Whether a parallel region is active 719============================================================ 720 721_Description_: 722 This function returns 'true' if currently running in parallel, 723 'false' otherwise. Here, 'true' and 'false' represent their 724 language-specific counterparts. 725 726_C/C++_: 727 _Prototype_: 'int omp_in_parallel(void);' 728 729_Fortran_: 730 _Interface_: 'logical function omp_in_parallel()' 731 732_Reference_: 733 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.6. 734 735 736File: libgomp.info, Node: omp_in_final, Next: omp_is_initial_device, Prev: omp_in_parallel, Up: Runtime Library Routines 737 7382.24 'omp_in_final' - Whether in final or included task region 739============================================================== 740 741_Description_: 742 This function returns 'true' if currently running in a final or 743 included task region, 'false' otherwise. Here, 'true' and 'false' 744 represent their language-specific counterparts. 745 746_C/C++_: 747 _Prototype_: 'int omp_in_final(void);' 748 749_Fortran_: 750 _Interface_: 'logical function omp_in_final()' 751 752_Reference_: 753 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.21. 754 755 756File: libgomp.info, Node: omp_is_initial_device, Next: omp_set_default_device, Prev: omp_in_final, Up: Runtime Library Routines 757 7582.25 'omp_is_initial_device' - Whether executing on the host device 759=================================================================== 760 761_Description_: 762 This function returns 'true' if currently running on the host 763 device, 'false' otherwise. Here, 'true' and 'false' represent 764 their language-specific counterparts. 765 766_C/C++_: 767 _Prototype_: 'int omp_is_initial_device(void);' 768 769_Fortran_: 770 _Interface_: 'logical function omp_is_initial_device()' 771 772_Reference_: 773 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.34. 774 775 776File: libgomp.info, Node: omp_set_default_device, Next: omp_set_dynamic, Prev: omp_is_initial_device, Up: Runtime Library Routines 777 7782.26 'omp_set_default_device' - Set the default device for target regions 779========================================================================= 780 781_Description_: 782 Set the default device for target regions without device clause. 783 The argument shall be a nonnegative device number. 784 785_C/C++_: 786 _Prototype_: 'void omp_set_default_device(int device_num);' 787 788_Fortran_: 789 _Interface_: 'subroutine omp_set_default_device(device_num)' 790 'integer device_num' 791 792_See also_: 793 *note OMP_DEFAULT_DEVICE::, *note omp_get_default_device:: 794 795_Reference_: 796 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.29. 797 798 799File: libgomp.info, Node: omp_set_dynamic, Next: omp_set_max_active_levels, Prev: omp_set_default_device, Up: Runtime Library Routines 800 8012.27 'omp_set_dynamic' - Enable/disable dynamic teams 802===================================================== 803 804_Description_: 805 Enable or disable the dynamic adjustment of the number of threads 806 within a team. The function takes the language-specific equivalent 807 of 'true' and 'false', where 'true' enables dynamic adjustment of 808 team sizes and 'false' disables it. 809 810_C/C++_: 811 _Prototype_: 'void omp_set_dynamic(int dynamic_threads);' 812 813_Fortran_: 814 _Interface_: 'subroutine omp_set_dynamic(dynamic_threads)' 815 'logical, intent(in) :: dynamic_threads' 816 817_See also_: 818 *note OMP_DYNAMIC::, *note omp_get_dynamic:: 819 820_Reference_: 821 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.7. 822 823 824File: libgomp.info, Node: omp_set_max_active_levels, Next: omp_set_nested, Prev: omp_set_dynamic, Up: Runtime Library Routines 825 8262.28 'omp_set_max_active_levels' - Limits the number of active parallel regions 827=============================================================================== 828 829_Description_: 830 This function limits the maximum allowed number of nested, active 831 parallel regions. MAX_LEVELS must be less or equal to the value 832 returned by 'omp_get_supported_active_levels'. 833 834_C/C++_ 835 _Prototype_: 'void omp_set_max_active_levels(int max_levels);' 836 837_Fortran_: 838 _Interface_: 'subroutine omp_set_max_active_levels(max_levels)' 839 'integer max_levels' 840 841_See also_: 842 *note omp_get_max_active_levels::, *note omp_get_active_level::, 843 *note omp_get_supported_active_levels:: 844 845_Reference_: 846 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.15. 847 848 849File: libgomp.info, Node: omp_set_nested, Next: omp_set_num_threads, Prev: omp_set_max_active_levels, Up: Runtime Library Routines 850 8512.29 'omp_set_nested' - Enable/disable nested parallel regions 852============================================================== 853 854_Description_: 855 Enable or disable nested parallel regions, i.e., whether team 856 members are allowed to create new teams. The function takes the 857 language-specific equivalent of 'true' and 'false', where 'true' 858 enables dynamic adjustment of team sizes and 'false' disables it. 859 860 Enabling nested parallel regions will also set the maximum number 861 of active nested regions to the maximum supported. Disabling 862 nested parallel regions will set the maximum number of active 863 nested regions to one. 864 865_C/C++_: 866 _Prototype_: 'void omp_set_nested(int nested);' 867 868_Fortran_: 869 _Interface_: 'subroutine omp_set_nested(nested)' 870 'logical, intent(in) :: nested' 871 872_See also_: 873 *note omp_get_nested::, *note omp_set_max_active_levels::, *note 874 OMP_MAX_ACTIVE_LEVELS::, *note OMP_NESTED:: 875 876_Reference_: 877 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.10. 878 879 880File: libgomp.info, Node: omp_set_num_threads, Next: omp_set_schedule, Prev: omp_set_nested, Up: Runtime Library Routines 881 8822.30 'omp_set_num_threads' - Set upper team size limit 883====================================================== 884 885_Description_: 886 Specifies the number of threads used by default in subsequent 887 parallel sections, if those do not specify a 'num_threads' clause. 888 The argument of 'omp_set_num_threads' shall be a positive integer. 889 890_C/C++_: 891 _Prototype_: 'void omp_set_num_threads(int num_threads);' 892 893_Fortran_: 894 _Interface_: 'subroutine omp_set_num_threads(num_threads)' 895 'integer, intent(in) :: num_threads' 896 897_See also_: 898 *note OMP_NUM_THREADS::, *note omp_get_num_threads::, *note 899 omp_get_max_threads:: 900 901_Reference_: 902 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.1. 903 904 905File: libgomp.info, Node: omp_set_schedule, Next: omp_init_lock, Prev: omp_set_num_threads, Up: Runtime Library Routines 906 9072.31 'omp_set_schedule' - Set the runtime scheduling method 908=========================================================== 909 910_Description_: 911 Sets the runtime scheduling method. The KIND argument can have the 912 value 'omp_sched_static', 'omp_sched_dynamic', 'omp_sched_guided' 913 or 'omp_sched_auto'. Except for 'omp_sched_auto', the chunk size 914 is set to the value of CHUNK_SIZE if positive, or to the default 915 value if zero or negative. For 'omp_sched_auto' the CHUNK_SIZE 916 argument is ignored. 917 918_C/C++_ 919 _Prototype_: 'void omp_set_schedule(omp_sched_t kind, int 920 chunk_size);' 921 922_Fortran_: 923 _Interface_: 'subroutine omp_set_schedule(kind, chunk_size)' 924 'integer(kind=omp_sched_kind) kind' 925 'integer chunk_size' 926 927_See also_: 928 *note omp_get_schedule:: *note OMP_SCHEDULE:: 929 930_Reference_: 931 OpenMP specification v4.5 (https://www.openmp.org), Section 3.2.12. 932 933 934File: libgomp.info, Node: omp_init_lock, Next: omp_set_lock, Prev: omp_set_schedule, Up: Runtime Library Routines 935 9362.32 'omp_init_lock' - Initialize simple lock 937============================================= 938 939_Description_: 940 Initialize a simple lock. After initialization, the lock is in an 941 unlocked state. 942 943_C/C++_: 944 _Prototype_: 'void omp_init_lock(omp_lock_t *lock);' 945 946_Fortran_: 947 _Interface_: 'subroutine omp_init_lock(svar)' 948 'integer(omp_lock_kind), intent(out) :: svar' 949 950_See also_: 951 *note omp_destroy_lock:: 952 953_Reference_: 954 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.1. 955 956 957File: libgomp.info, Node: omp_set_lock, Next: omp_test_lock, Prev: omp_init_lock, Up: Runtime Library Routines 958 9592.33 'omp_set_lock' - Wait for and set simple lock 960================================================== 961 962_Description_: 963 Before setting a simple lock, the lock variable must be initialized 964 by 'omp_init_lock'. The calling thread is blocked until the lock 965 is available. If the lock is already held by the current thread, a 966 deadlock occurs. 967 968_C/C++_: 969 _Prototype_: 'void omp_set_lock(omp_lock_t *lock);' 970 971_Fortran_: 972 _Interface_: 'subroutine omp_set_lock(svar)' 973 'integer(omp_lock_kind), intent(inout) :: svar' 974 975_See also_: 976 *note omp_init_lock::, *note omp_test_lock::, *note 977 omp_unset_lock:: 978 979_Reference_: 980 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.4. 981 982 983File: libgomp.info, Node: omp_test_lock, Next: omp_unset_lock, Prev: omp_set_lock, Up: Runtime Library Routines 984 9852.34 'omp_test_lock' - Test and set simple lock if available 986============================================================ 987 988_Description_: 989 Before setting a simple lock, the lock variable must be initialized 990 by 'omp_init_lock'. Contrary to 'omp_set_lock', 'omp_test_lock' 991 does not block if the lock is not available. This function returns 992 'true' upon success, 'false' otherwise. Here, 'true' and 'false' 993 represent their language-specific counterparts. 994 995_C/C++_: 996 _Prototype_: 'int omp_test_lock(omp_lock_t *lock);' 997 998_Fortran_: 999 _Interface_: 'logical function omp_test_lock(svar)' 1000 'integer(omp_lock_kind), intent(inout) :: svar' 1001 1002_See also_: 1003 *note omp_init_lock::, *note omp_set_lock::, *note omp_set_lock:: 1004 1005_Reference_: 1006 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.6. 1007 1008 1009File: libgomp.info, Node: omp_unset_lock, Next: omp_destroy_lock, Prev: omp_test_lock, Up: Runtime Library Routines 1010 10112.35 'omp_unset_lock' - Unset simple lock 1012========================================= 1013 1014_Description_: 1015 A simple lock about to be unset must have been locked by 1016 'omp_set_lock' or 'omp_test_lock' before. In addition, the lock 1017 must be held by the thread calling 'omp_unset_lock'. Then, the 1018 lock becomes unlocked. If one or more threads attempted to set the 1019 lock before, one of them is chosen to, again, set the lock to 1020 itself. 1021 1022_C/C++_: 1023 _Prototype_: 'void omp_unset_lock(omp_lock_t *lock);' 1024 1025_Fortran_: 1026 _Interface_: 'subroutine omp_unset_lock(svar)' 1027 'integer(omp_lock_kind), intent(inout) :: svar' 1028 1029_See also_: 1030 *note omp_set_lock::, *note omp_test_lock:: 1031 1032_Reference_: 1033 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.5. 1034 1035 1036File: libgomp.info, Node: omp_destroy_lock, Next: omp_init_nest_lock, Prev: omp_unset_lock, Up: Runtime Library Routines 1037 10382.36 'omp_destroy_lock' - Destroy simple lock 1039============================================= 1040 1041_Description_: 1042 Destroy a simple lock. In order to be destroyed, a simple lock 1043 must be in the unlocked state. 1044 1045_C/C++_: 1046 _Prototype_: 'void omp_destroy_lock(omp_lock_t *lock);' 1047 1048_Fortran_: 1049 _Interface_: 'subroutine omp_destroy_lock(svar)' 1050 'integer(omp_lock_kind), intent(inout) :: svar' 1051 1052_See also_: 1053 *note omp_init_lock:: 1054 1055_Reference_: 1056 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.3. 1057 1058 1059File: libgomp.info, Node: omp_init_nest_lock, Next: omp_set_nest_lock, Prev: omp_destroy_lock, Up: Runtime Library Routines 1060 10612.37 'omp_init_nest_lock' - Initialize nested lock 1062================================================== 1063 1064_Description_: 1065 Initialize a nested lock. After initialization, the lock is in an 1066 unlocked state and the nesting count is set to zero. 1067 1068_C/C++_: 1069 _Prototype_: 'void omp_init_nest_lock(omp_nest_lock_t *lock);' 1070 1071_Fortran_: 1072 _Interface_: 'subroutine omp_init_nest_lock(nvar)' 1073 'integer(omp_nest_lock_kind), intent(out) :: nvar' 1074 1075_See also_: 1076 *note omp_destroy_nest_lock:: 1077 1078_Reference_: 1079 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.1. 1080 1081 1082File: libgomp.info, Node: omp_set_nest_lock, Next: omp_test_nest_lock, Prev: omp_init_nest_lock, Up: Runtime Library Routines 1083 10842.38 'omp_set_nest_lock' - Wait for and set nested lock 1085======================================================= 1086 1087_Description_: 1088 Before setting a nested lock, the lock variable must be initialized 1089 by 'omp_init_nest_lock'. The calling thread is blocked until the 1090 lock is available. If the lock is already held by the current 1091 thread, the nesting count for the lock is incremented. 1092 1093_C/C++_: 1094 _Prototype_: 'void omp_set_nest_lock(omp_nest_lock_t *lock);' 1095 1096_Fortran_: 1097 _Interface_: 'subroutine omp_set_nest_lock(nvar)' 1098 'integer(omp_nest_lock_kind), intent(inout) :: nvar' 1099 1100_See also_: 1101 *note omp_init_nest_lock::, *note omp_unset_nest_lock:: 1102 1103_Reference_: 1104 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.4. 1105 1106 1107File: libgomp.info, Node: omp_test_nest_lock, Next: omp_unset_nest_lock, Prev: omp_set_nest_lock, Up: Runtime Library Routines 1108 11092.39 'omp_test_nest_lock' - Test and set nested lock if available 1110================================================================= 1111 1112_Description_: 1113 Before setting a nested lock, the lock variable must be initialized 1114 by 'omp_init_nest_lock'. Contrary to 'omp_set_nest_lock', 1115 'omp_test_nest_lock' does not block if the lock is not available. 1116 If the lock is already held by the current thread, the new nesting 1117 count is returned. Otherwise, the return value equals zero. 1118 1119_C/C++_: 1120 _Prototype_: 'int omp_test_nest_lock(omp_nest_lock_t *lock);' 1121 1122_Fortran_: 1123 _Interface_: 'logical function omp_test_nest_lock(nvar)' 1124 'integer(omp_nest_lock_kind), intent(inout) :: nvar' 1125 1126_See also_: 1127 *note omp_init_lock::, *note omp_set_lock::, *note omp_set_lock:: 1128 1129_Reference_: 1130 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.6. 1131 1132 1133File: libgomp.info, Node: omp_unset_nest_lock, Next: omp_destroy_nest_lock, Prev: omp_test_nest_lock, Up: Runtime Library Routines 1134 11352.40 'omp_unset_nest_lock' - Unset nested lock 1136============================================== 1137 1138_Description_: 1139 A nested lock about to be unset must have been locked by 1140 'omp_set_nested_lock' or 'omp_test_nested_lock' before. In 1141 addition, the lock must be held by the thread calling 1142 'omp_unset_nested_lock'. If the nesting count drops to zero, the 1143 lock becomes unlocked. If one ore more threads attempted to set 1144 the lock before, one of them is chosen to, again, set the lock to 1145 itself. 1146 1147_C/C++_: 1148 _Prototype_: 'void omp_unset_nest_lock(omp_nest_lock_t *lock);' 1149 1150_Fortran_: 1151 _Interface_: 'subroutine omp_unset_nest_lock(nvar)' 1152 'integer(omp_nest_lock_kind), intent(inout) :: nvar' 1153 1154_See also_: 1155 *note omp_set_nest_lock:: 1156 1157_Reference_: 1158 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.5. 1159 1160 1161File: libgomp.info, Node: omp_destroy_nest_lock, Next: omp_get_wtick, Prev: omp_unset_nest_lock, Up: Runtime Library Routines 1162 11632.41 'omp_destroy_nest_lock' - Destroy nested lock 1164================================================== 1165 1166_Description_: 1167 Destroy a nested lock. In order to be destroyed, a nested lock 1168 must be in the unlocked state and its nesting count must equal 1169 zero. 1170 1171_C/C++_: 1172 _Prototype_: 'void omp_destroy_nest_lock(omp_nest_lock_t *);' 1173 1174_Fortran_: 1175 _Interface_: 'subroutine omp_destroy_nest_lock(nvar)' 1176 'integer(omp_nest_lock_kind), intent(inout) :: nvar' 1177 1178_See also_: 1179 *note omp_init_lock:: 1180 1181_Reference_: 1182 OpenMP specification v4.5 (https://www.openmp.org), Section 3.3.3. 1183 1184 1185File: libgomp.info, Node: omp_get_wtick, Next: omp_get_wtime, Prev: omp_destroy_nest_lock, Up: Runtime Library Routines 1186 11872.42 'omp_get_wtick' - Get timer precision 1188========================================== 1189 1190_Description_: 1191 Gets the timer precision, i.e., the number of seconds between two 1192 successive clock ticks. 1193 1194_C/C++_: 1195 _Prototype_: 'double omp_get_wtick(void);' 1196 1197_Fortran_: 1198 _Interface_: 'double precision function omp_get_wtick()' 1199 1200_See also_: 1201 *note omp_get_wtime:: 1202 1203_Reference_: 1204 OpenMP specification v4.5 (https://www.openmp.org), Section 3.4.2. 1205 1206 1207File: libgomp.info, Node: omp_get_wtime, Next: omp_fulfill_event, Prev: omp_get_wtick, Up: Runtime Library Routines 1208 12092.43 'omp_get_wtime' - Elapsed wall clock time 1210============================================== 1211 1212_Description_: 1213 Elapsed wall clock time in seconds. The time is measured per 1214 thread, no guarantee can be made that two distinct threads measure 1215 the same time. Time is measured from some "time in the past", 1216 which is an arbitrary time guaranteed not to change during the 1217 execution of the program. 1218 1219_C/C++_: 1220 _Prototype_: 'double omp_get_wtime(void);' 1221 1222_Fortran_: 1223 _Interface_: 'double precision function omp_get_wtime()' 1224 1225_See also_: 1226 *note omp_get_wtick:: 1227 1228_Reference_: 1229 OpenMP specification v4.5 (https://www.openmp.org), Section 3.4.1. 1230 1231 1232File: libgomp.info, Node: omp_fulfill_event, Prev: omp_get_wtime, Up: Runtime Library Routines 1233 12342.44 'omp_fulfill_event' - Fulfill and destroy an OpenMP event 1235============================================================== 1236 1237_Description_: 1238 Fulfill the event associated with the event handle argument. 1239 Currently, it is only used to fulfill events generated by detach 1240 clauses on task constructs - the effect of fulfilling the event is 1241 to allow the task to complete. 1242 1243 The result of calling 'omp_fulfill_event' with an event handle 1244 other than that generated by a detach clause is undefined. Calling 1245 it with an event handle that has already been fulfilled is also 1246 undefined. 1247 1248_C/C++_: 1249 _Prototype_: 'void omp_fulfill_event(omp_event_handle_t event);' 1250 1251_Fortran_: 1252 _Interface_: 'subroutine omp_fulfill_event(event)' 1253 'integer (kind=omp_event_handle_kind) :: event' 1254 1255_Reference_: 1256 OpenMP specification v5.0 (https://www.openmp.org), Section 3.5.1. 1257 1258 1259File: libgomp.info, Node: Environment Variables, Next: Enabling OpenACC, Prev: Runtime Library Routines, Up: Top 1260 12613 OpenMP Environment Variables 1262****************************** 1263 1264The environment variables which beginning with 'OMP_' are defined by 1265section 4 of the OpenMP specification in version 4.5, while those 1266beginning with 'GOMP_' are GNU extensions. 1267 1268* Menu: 1269 1270* OMP_CANCELLATION:: Set whether cancellation is activated 1271* OMP_DISPLAY_ENV:: Show OpenMP version and environment variables 1272* OMP_DEFAULT_DEVICE:: Set the device used in target regions 1273* OMP_DYNAMIC:: Dynamic adjustment of threads 1274* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions 1275* OMP_MAX_TASK_PRIORITY:: Set the maximum task priority value 1276* OMP_NESTED:: Nested parallel regions 1277* OMP_NUM_THREADS:: Specifies the number of threads to use 1278* OMP_PROC_BIND:: Whether theads may be moved between CPUs 1279* OMP_PLACES:: Specifies on which CPUs the theads should be placed 1280* OMP_STACKSIZE:: Set default thread stack size 1281* OMP_SCHEDULE:: How threads are scheduled 1282* OMP_TARGET_OFFLOAD:: Controls offloading behaviour 1283* OMP_THREAD_LIMIT:: Set the maximum number of threads 1284* OMP_WAIT_POLICY:: How waiting threads are handled 1285* GOMP_CPU_AFFINITY:: Bind threads to specific CPUs 1286* GOMP_DEBUG:: Enable debugging output 1287* GOMP_STACKSIZE:: Set default thread stack size 1288* GOMP_SPINCOUNT:: Set the busy-wait spin count 1289* GOMP_RTEMS_THREAD_POOLS:: Set the RTEMS specific thread pools 1290 1291 1292File: libgomp.info, Node: OMP_CANCELLATION, Next: OMP_DISPLAY_ENV, Up: Environment Variables 1293 12943.1 'OMP_CANCELLATION' - Set whether cancellation is activated 1295============================================================== 1296 1297_Description_: 1298 If set to 'TRUE', the cancellation is activated. If set to 'FALSE' 1299 or if unset, cancellation is disabled and the 'cancel' construct is 1300 ignored. 1301 1302_See also_: 1303 *note omp_get_cancellation:: 1304 1305_Reference_: 1306 OpenMP specification v4.5 (https://www.openmp.org), Section 4.11 1307 1308 1309File: libgomp.info, Node: OMP_DISPLAY_ENV, Next: OMP_DEFAULT_DEVICE, Prev: OMP_CANCELLATION, Up: Environment Variables 1310 13113.2 'OMP_DISPLAY_ENV' - Show OpenMP version and environment variables 1312===================================================================== 1313 1314_Description_: 1315 If set to 'TRUE', the OpenMP version number and the values 1316 associated with the OpenMP environment variables are printed to 1317 'stderr'. If set to 'VERBOSE', it additionally shows the value of 1318 the environment variables which are GNU extensions. If undefined 1319 or set to 'FALSE', this information will not be shown. 1320 1321_Reference_: 1322 OpenMP specification v4.5 (https://www.openmp.org), Section 4.12 1323 1324 1325File: libgomp.info, Node: OMP_DEFAULT_DEVICE, Next: OMP_DYNAMIC, Prev: OMP_DISPLAY_ENV, Up: Environment Variables 1326 13273.3 'OMP_DEFAULT_DEVICE' - Set the device used in target regions 1328================================================================ 1329 1330_Description_: 1331 Set to choose the device which is used in a 'target' region, unless 1332 the value is overridden by 'omp_set_default_device' or by a 1333 'device' clause. The value shall be the nonnegative device number. 1334 If no device with the given device number exists, the code is 1335 executed on the host. If unset, device number 0 will be used. 1336 1337_See also_: 1338 *note omp_get_default_device::, *note omp_set_default_device::, 1339 1340_Reference_: 1341 OpenMP specification v4.5 (https://www.openmp.org), Section 4.13 1342 1343 1344File: libgomp.info, Node: OMP_DYNAMIC, Next: OMP_MAX_ACTIVE_LEVELS, Prev: OMP_DEFAULT_DEVICE, Up: Environment Variables 1345 13463.4 'OMP_DYNAMIC' - Dynamic adjustment of threads 1347================================================= 1348 1349_Description_: 1350 Enable or disable the dynamic adjustment of the number of threads 1351 within a team. The value of this environment variable shall be 1352 'TRUE' or 'FALSE'. If undefined, dynamic adjustment is disabled by 1353 default. 1354 1355_See also_: 1356 *note omp_set_dynamic:: 1357 1358_Reference_: 1359 OpenMP specification v4.5 (https://www.openmp.org), Section 4.3 1360 1361 1362File: libgomp.info, Node: OMP_MAX_ACTIVE_LEVELS, Next: OMP_MAX_TASK_PRIORITY, Prev: OMP_DYNAMIC, Up: Environment Variables 1363 13643.5 'OMP_MAX_ACTIVE_LEVELS' - Set the maximum number of nested parallel regions 1365=============================================================================== 1366 1367_Description_: 1368 Specifies the initial value for the maximum number of nested 1369 parallel regions. The value of this variable shall be a positive 1370 integer. If undefined, then if 'OMP_NESTED' is defined and set to 1371 true, or if 'OMP_NUM_THREADS' or 'OMP_PROC_BIND' are defined and 1372 set to a list with more than one item, the maximum number of nested 1373 parallel regions will be initialized to the largest number 1374 supported, otherwise it will be set to one. 1375 1376_See also_: 1377 *note omp_set_max_active_levels::, *note OMP_NESTED:: 1378 1379_Reference_: 1380 OpenMP specification v4.5 (https://www.openmp.org), Section 4.9 1381 1382 1383File: libgomp.info, Node: OMP_MAX_TASK_PRIORITY, Next: OMP_NESTED, Prev: OMP_MAX_ACTIVE_LEVELS, Up: Environment Variables 1384 13853.6 'OMP_MAX_TASK_PRIORITY' - Set the maximum priority 1386====================================================== 1387 1388number that can be set for a task. 1389_Description_: 1390 Specifies the initial value for the maximum priority value that can 1391 be set for a task. The value of this variable shall be a 1392 non-negative integer, and zero is allowed. If undefined, the 1393 default priority is 0. 1394 1395_See also_: 1396 *note omp_get_max_task_priority:: 1397 1398_Reference_: 1399 OpenMP specification v4.5 (https://www.openmp.org), Section 4.14 1400 1401 1402File: libgomp.info, Node: OMP_NESTED, Next: OMP_NUM_THREADS, Prev: OMP_MAX_TASK_PRIORITY, Up: Environment Variables 1403 14043.7 'OMP_NESTED' - Nested parallel regions 1405========================================== 1406 1407_Description_: 1408 Enable or disable nested parallel regions, i.e., whether team 1409 members are allowed to create new teams. The value of this 1410 environment variable shall be 'TRUE' or 'FALSE'. If set to 'TRUE', 1411 the number of maximum active nested regions supported will by 1412 default be set to the maximum supported, otherwise it will be set 1413 to one. If 'OMP_MAX_ACTIVE_LEVELS' is defined, its setting will 1414 override this setting. If both are undefined, nested parallel 1415 regions are enabled if 'OMP_NUM_THREADS' or 'OMP_PROC_BINDS' are 1416 defined to a list with more than one item, otherwise they are 1417 disabled by default. 1418 1419_See also_: 1420 *note omp_set_max_active_levels::, *note omp_set_nested:: 1421 1422_Reference_: 1423 OpenMP specification v4.5 (https://www.openmp.org), Section 4.6 1424 1425 1426File: libgomp.info, Node: OMP_NUM_THREADS, Next: OMP_PROC_BIND, Prev: OMP_NESTED, Up: Environment Variables 1427 14283.8 'OMP_NUM_THREADS' - Specifies the number of threads to use 1429============================================================== 1430 1431_Description_: 1432 Specifies the default number of threads to use in parallel regions. 1433 The value of this variable shall be a comma-separated list of 1434 positive integers; the value specifies the number of threads to use 1435 for the corresponding nested level. Specifying more than one item 1436 in the list will automatically enable nesting by default. If 1437 undefined one thread per CPU is used. 1438 1439_See also_: 1440 *note omp_set_num_threads::, *note OMP_NESTED:: 1441 1442_Reference_: 1443 OpenMP specification v4.5 (https://www.openmp.org), Section 4.2 1444 1445 1446File: libgomp.info, Node: OMP_PROC_BIND, Next: OMP_PLACES, Prev: OMP_NUM_THREADS, Up: Environment Variables 1447 14483.9 'OMP_PROC_BIND' - Whether theads may be moved between CPUs 1449============================================================== 1450 1451_Description_: 1452 Specifies whether threads may be moved between processors. If set 1453 to 'TRUE', OpenMP theads should not be moved; if set to 'FALSE' 1454 they may be moved. Alternatively, a comma separated list with the 1455 values 'MASTER', 'CLOSE' and 'SPREAD' can be used to specify the 1456 thread affinity policy for the corresponding nesting level. With 1457 'MASTER' the worker threads are in the same place partition as the 1458 master thread. With 'CLOSE' those are kept close to the master 1459 thread in contiguous place partitions. And with 'SPREAD' a sparse 1460 distribution across the place partitions is used. Specifying more 1461 than one item in the list will automatically enable nesting by 1462 default. 1463 1464 When undefined, 'OMP_PROC_BIND' defaults to 'TRUE' when 1465 'OMP_PLACES' or 'GOMP_CPU_AFFINITY' is set and 'FALSE' otherwise. 1466 1467_See also_: 1468 *note omp_get_proc_bind::, *note GOMP_CPU_AFFINITY::, *note 1469 OMP_NESTED::, *note OMP_PLACES:: 1470 1471_Reference_: 1472 OpenMP specification v4.5 (https://www.openmp.org), Section 4.4 1473 1474 1475File: libgomp.info, Node: OMP_PLACES, Next: OMP_STACKSIZE, Prev: OMP_PROC_BIND, Up: Environment Variables 1476 14773.10 'OMP_PLACES' - Specifies on which CPUs the theads should be placed 1478======================================================================= 1479 1480_Description_: 1481 The thread placement can be either specified using an abstract name 1482 or by an explicit list of the places. The abstract names 1483 'threads', 'cores' and 'sockets' can be optionally followed by a 1484 positive number in parentheses, which denotes the how many places 1485 shall be created. With 'threads' each place corresponds to a 1486 single hardware thread; 'cores' to a single core with the 1487 corresponding number of hardware threads; and with 'sockets' the 1488 place corresponds to a single socket. The resulting placement can 1489 be shown by setting the 'OMP_DISPLAY_ENV' environment variable. 1490 1491 Alternatively, the placement can be specified explicitly as 1492 comma-separated list of places. A place is specified by set of 1493 nonnegative numbers in curly braces, denoting the denoting the 1494 hardware threads. The hardware threads belonging to a place can 1495 either be specified as comma-separated list of nonnegative thread 1496 numbers or using an interval. Multiple places can also be either 1497 specified by a comma-separated list of places or by an interval. 1498 To specify an interval, a colon followed by the count is placed 1499 after after the hardware thread number or the place. Optionally, 1500 the length can be followed by a colon and the stride number - 1501 otherwise a unit stride is assumed. For instance, the following 1502 specifies the same places list: '"{0,1,2}, {3,4,6}, {7,8,9}, 1503 {10,11,12}"'; '"{0:3}, {3:3}, {7:3}, {10:3}"'; and '"{0:2}:4:3"'. 1504 1505 If 'OMP_PLACES' and 'GOMP_CPU_AFFINITY' are unset and 1506 'OMP_PROC_BIND' is either unset or 'false', threads may be moved 1507 between CPUs following no placement policy. 1508 1509_See also_: 1510 *note OMP_PROC_BIND::, *note GOMP_CPU_AFFINITY::, *note 1511 omp_get_proc_bind::, *note OMP_DISPLAY_ENV:: 1512 1513_Reference_: 1514 OpenMP specification v4.5 (https://www.openmp.org), Section 4.5 1515 1516 1517File: libgomp.info, Node: OMP_STACKSIZE, Next: OMP_SCHEDULE, Prev: OMP_PLACES, Up: Environment Variables 1518 15193.11 'OMP_STACKSIZE' - Set default thread stack size 1520==================================================== 1521 1522_Description_: 1523 Set the default thread stack size in kilobytes, unless the number 1524 is suffixed by 'B', 'K', 'M' or 'G', in which case the size is, 1525 respectively, in bytes, kilobytes, megabytes or gigabytes. This is 1526 different from 'pthread_attr_setstacksize' which gets the number of 1527 bytes as an argument. If the stack size cannot be set due to 1528 system constraints, an error is reported and the initial stack size 1529 is left unchanged. If undefined, the stack size is system 1530 dependent. 1531 1532_Reference_: 1533 OpenMP specification v4.5 (https://www.openmp.org), Section 4.7 1534 1535 1536File: libgomp.info, Node: OMP_SCHEDULE, Next: OMP_TARGET_OFFLOAD, Prev: OMP_STACKSIZE, Up: Environment Variables 1537 15383.12 'OMP_SCHEDULE' - How threads are scheduled 1539=============================================== 1540 1541_Description_: 1542 Allows to specify 'schedule type' and 'chunk size'. The value of 1543 the variable shall have the form: 'type[,chunk]' where 'type' is 1544 one of 'static', 'dynamic', 'guided' or 'auto' The optional 'chunk' 1545 size shall be a positive integer. If undefined, dynamic scheduling 1546 and a chunk size of 1 is used. 1547 1548_See also_: 1549 *note omp_set_schedule:: 1550 1551_Reference_: 1552 OpenMP specification v4.5 (https://www.openmp.org), Sections 1553 2.7.1.1 and 4.1 1554 1555 1556File: libgomp.info, Node: OMP_TARGET_OFFLOAD, Next: OMP_THREAD_LIMIT, Prev: OMP_SCHEDULE, Up: Environment Variables 1557 15583.13 'OMP_TARGET_OFFLOAD' - Controls offloading behaviour 1559========================================================= 1560 1561_Description_: 1562 Specifies the behaviour with regard to offloading code to a device. 1563 This variable can be set to one of three values - 'MANDATORY', 1564 'DISABLED' or 'DEFAULT'. 1565 1566 If set to 'MANDATORY', the program will terminate with an error if 1567 the offload device is not present or is not supported. If set to 1568 'DISABLED', then offloading is disabled and all code will run on 1569 the host. If set to 'DEFAULT', the program will try offloading to 1570 the device first, then fall back to running code on the host if it 1571 cannot. 1572 1573 If undefined, then the program will behave as if 'DEFAULT' was set. 1574 1575_Reference_: 1576 OpenMP specification v5.0 (https://www.openmp.org), Section 6.17 1577 1578 1579File: libgomp.info, Node: OMP_THREAD_LIMIT, Next: OMP_WAIT_POLICY, Prev: OMP_TARGET_OFFLOAD, Up: Environment Variables 1580 15813.14 'OMP_THREAD_LIMIT' - Set the maximum number of threads 1582=========================================================== 1583 1584_Description_: 1585 Specifies the number of threads to use for the whole program. The 1586 value of this variable shall be a positive integer. If undefined, 1587 the number of threads is not limited. 1588 1589_See also_: 1590 *note OMP_NUM_THREADS::, *note omp_get_thread_limit:: 1591 1592_Reference_: 1593 OpenMP specification v4.5 (https://www.openmp.org), Section 4.10 1594 1595 1596File: libgomp.info, Node: OMP_WAIT_POLICY, Next: GOMP_CPU_AFFINITY, Prev: OMP_THREAD_LIMIT, Up: Environment Variables 1597 15983.15 'OMP_WAIT_POLICY' - How waiting threads are handled 1599======================================================== 1600 1601_Description_: 1602 Specifies whether waiting threads should be active or passive. If 1603 the value is 'PASSIVE', waiting threads should not consume CPU 1604 power while waiting; while the value is 'ACTIVE' specifies that 1605 they should. If undefined, threads wait actively for a short time 1606 before waiting passively. 1607 1608_See also_: 1609 *note GOMP_SPINCOUNT:: 1610 1611_Reference_: 1612 OpenMP specification v4.5 (https://www.openmp.org), Section 4.8 1613 1614 1615File: libgomp.info, Node: GOMP_CPU_AFFINITY, Next: GOMP_DEBUG, Prev: OMP_WAIT_POLICY, Up: Environment Variables 1616 16173.16 'GOMP_CPU_AFFINITY' - Bind threads to specific CPUs 1618======================================================== 1619 1620_Description_: 1621 Binds threads to specific CPUs. The variable should contain a 1622 space-separated or comma-separated list of CPUs. This list may 1623 contain different kinds of entries: either single CPU numbers in 1624 any order, a range of CPUs (M-N) or a range with some stride 1625 (M-N:S). CPU numbers are zero based. For example, 1626 'GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"' will bind the initial thread 1627 to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to 1628 CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 1629 10, 12, and 14 respectively and then start assigning back from the 1630 beginning of the list. 'GOMP_CPU_AFFINITY=0' binds all threads to 1631 CPU 0. 1632 1633 There is no libgomp library routine to determine whether a CPU 1634 affinity specification is in effect. As a workaround, 1635 language-specific library functions, e.g., 'getenv' in C or 1636 'GET_ENVIRONMENT_VARIABLE' in Fortran, may be used to query the 1637 setting of the 'GOMP_CPU_AFFINITY' environment variable. A defined 1638 CPU affinity on startup cannot be changed or disabled during the 1639 runtime of the application. 1640 1641 If both 'GOMP_CPU_AFFINITY' and 'OMP_PROC_BIND' are set, 1642 'OMP_PROC_BIND' has a higher precedence. If neither has been set 1643 and 'OMP_PROC_BIND' is unset, or when 'OMP_PROC_BIND' is set to 1644 'FALSE', the host system will handle the assignment of threads to 1645 CPUs. 1646 1647_See also_: 1648 *note OMP_PLACES::, *note OMP_PROC_BIND:: 1649 1650 1651File: libgomp.info, Node: GOMP_DEBUG, Next: GOMP_STACKSIZE, Prev: GOMP_CPU_AFFINITY, Up: Environment Variables 1652 16533.17 'GOMP_DEBUG' - Enable debugging output 1654=========================================== 1655 1656_Description_: 1657 Enable debugging output. The variable should be set to '0' 1658 (disabled, also the default if not set), or '1' (enabled). 1659 1660 If enabled, some debugging output will be printed during execution. 1661 This is currently not specified in more detail, and subject to 1662 change. 1663 1664 1665File: libgomp.info, Node: GOMP_STACKSIZE, Next: GOMP_SPINCOUNT, Prev: GOMP_DEBUG, Up: Environment Variables 1666 16673.18 'GOMP_STACKSIZE' - Set default thread stack size 1668===================================================== 1669 1670_Description_: 1671 Set the default thread stack size in kilobytes. This is different 1672 from 'pthread_attr_setstacksize' which gets the number of bytes as 1673 an argument. If the stack size cannot be set due to system 1674 constraints, an error is reported and the initial stack size is 1675 left unchanged. If undefined, the stack size is system dependent. 1676 1677_See also_: 1678 *note OMP_STACKSIZE:: 1679 1680_Reference_: 1681 GCC Patches Mailinglist 1682 (https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html), GCC 1683 Patches Mailinglist 1684 (https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html) 1685 1686 1687File: libgomp.info, Node: GOMP_SPINCOUNT, Next: GOMP_RTEMS_THREAD_POOLS, Prev: GOMP_STACKSIZE, Up: Environment Variables 1688 16893.19 'GOMP_SPINCOUNT' - Set the busy-wait spin count 1690==================================================== 1691 1692_Description_: 1693 Determines how long a threads waits actively with consuming CPU 1694 power before waiting passively without consuming CPU power. The 1695 value may be either 'INFINITE', 'INFINITY' to always wait actively 1696 or an integer which gives the number of spins of the busy-wait 1697 loop. The integer may optionally be followed by the following 1698 suffixes acting as multiplication factors: 'k' (kilo, thousand), 1699 'M' (mega, million), 'G' (giga, billion), or 'T' (tera, trillion). 1700 If undefined, 0 is used when 'OMP_WAIT_POLICY' is 'PASSIVE', 1701 300,000 is used when 'OMP_WAIT_POLICY' is undefined and 30 billion 1702 is used when 'OMP_WAIT_POLICY' is 'ACTIVE'. If there are more 1703 OpenMP threads than available CPUs, 1000 and 100 spins are used for 1704 'OMP_WAIT_POLICY' being 'ACTIVE' or undefined, respectively; unless 1705 the 'GOMP_SPINCOUNT' is lower or 'OMP_WAIT_POLICY' is 'PASSIVE'. 1706 1707_See also_: 1708 *note OMP_WAIT_POLICY:: 1709 1710 1711File: libgomp.info, Node: GOMP_RTEMS_THREAD_POOLS, Prev: GOMP_SPINCOUNT, Up: Environment Variables 1712 17133.20 'GOMP_RTEMS_THREAD_POOLS' - Set the RTEMS specific thread pools 1714==================================================================== 1715 1716_Description_: 1717 This environment variable is only used on the RTEMS real-time 1718 operating system. It determines the scheduler instance specific 1719 thread pools. The format for 'GOMP_RTEMS_THREAD_POOLS' is a list 1720 of optional '<thread-pool-count>[$<priority>]@<scheduler-name>' 1721 configurations separated by ':' where: 1722 * '<thread-pool-count>' is the thread pool count for this 1723 scheduler instance. 1724 * '$<priority>' is an optional priority for the worker threads 1725 of a thread pool according to 'pthread_setschedparam'. In 1726 case a priority value is omitted, then a worker thread will 1727 inherit the priority of the OpenMP master thread that created 1728 it. The priority of the worker thread is not changed after 1729 creation, even if a new OpenMP master thread using the worker 1730 has a different priority. 1731 * '@<scheduler-name>' is the scheduler instance name according 1732 to the RTEMS application configuration. 1733 In case no thread pool configuration is specified for a scheduler 1734 instance, then each OpenMP master thread of this scheduler instance 1735 will use its own dynamically allocated thread pool. To limit the 1736 worker thread count of the thread pools, each OpenMP master thread 1737 must call 'omp_set_num_threads'. 1738_Example_: 1739 Lets suppose we have three scheduler instances 'IO', 'WRK0', and 1740 'WRK1' with 'GOMP_RTEMS_THREAD_POOLS' set to '"1@WRK0:3$4@WRK1"'. 1741 Then there are no thread pool restrictions for scheduler instance 1742 'IO'. In the scheduler instance 'WRK0' there is one thread pool 1743 available. Since no priority is specified for this scheduler 1744 instance, the worker thread inherits the priority of the OpenMP 1745 master thread that created it. In the scheduler instance 'WRK1' 1746 there are three thread pools available and their worker threads run 1747 at priority four. 1748 1749 1750File: libgomp.info, Node: Enabling OpenACC, Next: OpenACC Runtime Library Routines, Prev: Environment Variables, Up: Top 1751 17524 Enabling OpenACC 1753****************** 1754 1755To activate the OpenACC extensions for C/C++ and Fortran, the 1756compile-time flag '-fopenacc' must be specified. This enables the 1757OpenACC directive '#pragma acc' in C/C++ and '!$acc' directives in free 1758form, 'c$acc', '*$acc' and '!$acc' directives in fixed form, '!$' 1759conditional compilation sentinels in free form and 'c$', '*$' and '!$' 1760sentinels in fixed form, for Fortran. The flag also arranges for 1761automatic linking of the OpenACC runtime library (*note OpenACC Runtime 1762Library Routines::). 1763 1764 See <https://gcc.gnu.org/wiki/OpenACC> for more information. 1765 1766 A complete description of all OpenACC directives accepted may be 1767found in the OpenACC (https://www.openacc.org) Application Programming 1768Interface manual, version 2.6. 1769 1770 1771File: libgomp.info, Node: OpenACC Runtime Library Routines, Next: OpenACC Environment Variables, Prev: Enabling OpenACC, Up: Top 1772 17735 OpenACC Runtime Library Routines 1774********************************** 1775 1776The runtime routines described here are defined by section 3 of the 1777OpenACC specifications in version 2.6. They have C linkage, and do not 1778throw exceptions. Generally, they are available only for the host, with 1779the exception of 'acc_on_device', which is available for both the host 1780and the acceleration device. 1781 1782* Menu: 1783 1784* acc_get_num_devices:: Get number of devices for the given device 1785 type. 1786* acc_set_device_type:: Set type of device accelerator to use. 1787* acc_get_device_type:: Get type of device accelerator to be used. 1788* acc_set_device_num:: Set device number to use. 1789* acc_get_device_num:: Get device number to be used. 1790* acc_get_property:: Get device property. 1791* acc_async_test:: Tests for completion of a specific asynchronous 1792 operation. 1793* acc_async_test_all:: Tests for completion of all asynchronous 1794 operations. 1795* acc_wait:: Wait for completion of a specific asynchronous 1796 operation. 1797* acc_wait_all:: Waits for completion of all asynchronous 1798 operations. 1799* acc_wait_all_async:: Wait for completion of all asynchronous 1800 operations. 1801* acc_wait_async:: Wait for completion of asynchronous operations. 1802* acc_init:: Initialize runtime for a specific device type. 1803* acc_shutdown:: Shuts down the runtime for a specific device 1804 type. 1805* acc_on_device:: Whether executing on a particular device 1806* acc_malloc:: Allocate device memory. 1807* acc_free:: Free device memory. 1808* acc_copyin:: Allocate device memory and copy host memory to 1809 it. 1810* acc_present_or_copyin:: If the data is not present on the device, 1811 allocate device memory and copy from host 1812 memory. 1813* acc_create:: Allocate device memory and map it to host 1814 memory. 1815* acc_present_or_create:: If the data is not present on the device, 1816 allocate device memory and map it to host 1817 memory. 1818* acc_copyout:: Copy device memory to host memory. 1819* acc_delete:: Free device memory. 1820* acc_update_device:: Update device memory from mapped host memory. 1821* acc_update_self:: Update host memory from mapped device memory. 1822* acc_map_data:: Map previously allocated device memory to host 1823 memory. 1824* acc_unmap_data:: Unmap device memory from host memory. 1825* acc_deviceptr:: Get device pointer associated with specific 1826 host address. 1827* acc_hostptr:: Get host pointer associated with specific 1828 device address. 1829* acc_is_present:: Indicate whether host variable / array is 1830 present on device. 1831* acc_memcpy_to_device:: Copy host memory to device memory. 1832* acc_memcpy_from_device:: Copy device memory to host memory. 1833* acc_attach:: Let device pointer point to device-pointer target. 1834* acc_detach:: Let device pointer point to host-pointer target. 1835 1836API routines for target platforms. 1837 1838* acc_get_current_cuda_device:: Get CUDA device handle. 1839* acc_get_current_cuda_context::Get CUDA context handle. 1840* acc_get_cuda_stream:: Get CUDA stream handle. 1841* acc_set_cuda_stream:: Set CUDA stream handle. 1842 1843API routines for the OpenACC Profiling Interface. 1844 1845* acc_prof_register:: Register callbacks. 1846* acc_prof_unregister:: Unregister callbacks. 1847* acc_prof_lookup:: Obtain inquiry functions. 1848* acc_register_library:: Library registration. 1849 1850 1851File: libgomp.info, Node: acc_get_num_devices, Next: acc_set_device_type, Up: OpenACC Runtime Library Routines 1852 18535.1 'acc_get_num_devices' - Get number of devices for given device type 1854======================================================================= 1855 1856_Description_ 1857 This function returns a value indicating the number of devices 1858 available for the device type specified in DEVICETYPE. 1859 1860_C/C++_: 1861 _Prototype_: 'int acc_get_num_devices(acc_device_t devicetype);' 1862 1863_Fortran_: 1864 _Interface_: 'integer function acc_get_num_devices(devicetype)' 1865 'integer(kind=acc_device_kind) devicetype' 1866 1867_Reference_: 1868 OpenACC specification v2.6 (https://www.openacc.org), section 1869 3.2.1. 1870 1871 1872File: libgomp.info, Node: acc_set_device_type, Next: acc_get_device_type, Prev: acc_get_num_devices, Up: OpenACC Runtime Library Routines 1873 18745.2 'acc_set_device_type' - Set type of device accelerator to use. 1875================================================================== 1876 1877_Description_ 1878 This function indicates to the runtime library which device type, 1879 specified in DEVICETYPE, to use when executing a parallel or 1880 kernels region. 1881 1882_C/C++_: 1883 _Prototype_: 'acc_set_device_type(acc_device_t devicetype);' 1884 1885_Fortran_: 1886 _Interface_: 'subroutine acc_set_device_type(devicetype)' 1887 'integer(kind=acc_device_kind) devicetype' 1888 1889_Reference_: 1890 OpenACC specification v2.6 (https://www.openacc.org), section 1891 3.2.2. 1892 1893 1894File: libgomp.info, Node: acc_get_device_type, Next: acc_set_device_num, Prev: acc_set_device_type, Up: OpenACC Runtime Library Routines 1895 18965.3 'acc_get_device_type' - Get type of device accelerator to be used. 1897====================================================================== 1898 1899_Description_ 1900 This function returns what device type will be used when executing 1901 a parallel or kernels region. 1902 1903 This function returns 'acc_device_none' if 'acc_get_device_type' is 1904 called from 'acc_ev_device_init_start', 'acc_ev_device_init_end' 1905 callbacks of the OpenACC Profiling Interface (*note OpenACC 1906 Profiling Interface::), that is, if the device is currently being 1907 initialized. 1908 1909_C/C++_: 1910 _Prototype_: 'acc_device_t acc_get_device_type(void);' 1911 1912_Fortran_: 1913 _Interface_: 'function acc_get_device_type(void)' 1914 'integer(kind=acc_device_kind) acc_get_device_type' 1915 1916_Reference_: 1917 OpenACC specification v2.6 (https://www.openacc.org), section 1918 3.2.3. 1919 1920 1921File: libgomp.info, Node: acc_set_device_num, Next: acc_get_device_num, Prev: acc_get_device_type, Up: OpenACC Runtime Library Routines 1922 19235.4 'acc_set_device_num' - Set device number to use. 1924==================================================== 1925 1926_Description_ 1927 This function will indicate to the runtime which device number, 1928 specified by DEVICENUM, associated with the specified device type 1929 DEVICETYPE. 1930 1931_C/C++_: 1932 _Prototype_: 'acc_set_device_num(int devicenum, acc_device_t 1933 devicetype);' 1934 1935_Fortran_: 1936 _Interface_: 'subroutine acc_set_device_num(devicenum, devicetype)' 1937 'integer devicenum' 1938 'integer(kind=acc_device_kind) devicetype' 1939 1940_Reference_: 1941 OpenACC specification v2.6 (https://www.openacc.org), section 1942 3.2.4. 1943 1944 1945File: libgomp.info, Node: acc_get_device_num, Next: acc_get_property, Prev: acc_set_device_num, Up: OpenACC Runtime Library Routines 1946 19475.5 'acc_get_device_num' - Get device number to be used. 1948======================================================== 1949 1950_Description_ 1951 This function returns which device number associated with the 1952 specified device type DEVICETYPE, will be used when executing a 1953 parallel or kernels region. 1954 1955_C/C++_: 1956 _Prototype_: 'int acc_get_device_num(acc_device_t devicetype);' 1957 1958_Fortran_: 1959 _Interface_: 'function acc_get_device_num(devicetype)' 1960 'integer(kind=acc_device_kind) devicetype' 1961 'integer acc_get_device_num' 1962 1963_Reference_: 1964 OpenACC specification v2.6 (https://www.openacc.org), section 1965 3.2.5. 1966 1967 1968File: libgomp.info, Node: acc_get_property, Next: acc_async_test, Prev: acc_get_device_num, Up: OpenACC Runtime Library Routines 1969 19705.6 'acc_get_property' - Get device property. 1971============================================= 1972 1973_Description_ 1974 These routines return the value of the specified PROPERTY for the 1975 device being queried according to DEVICENUM and DEVICETYPE. 1976 Integer-valued and string-valued properties are returned by 1977 'acc_get_property' and 'acc_get_property_string' respectively. The 1978 Fortran 'acc_get_property_string' subroutine returns the string 1979 retrieved in its fourth argument while the remaining entry points 1980 are functions, which pass the return value as their result. 1981 1982 Note for Fortran, only: the OpenACC technical committee corrected 1983 and, hence, modified the interface introduced in OpenACC 2.6. The 1984 kind-value parameter 'acc_device_property' has been renamed to 1985 'acc_device_property_kind' for consistency and the return type of 1986 the 'acc_get_property' function is now a 'c_size_t' integer instead 1987 of a 'acc_device_property' integer. The parameter 1988 'acc_device_property' will continue to be provided, but might be 1989 removed in a future version of GCC. 1990 1991_C/C++_: 1992 _Prototype_: 'size_t acc_get_property(int devicenum, acc_device_t 1993 devicetype, acc_device_property_t property);' 1994 _Prototype_: 'const char *acc_get_property_string(int devicenum, 1995 acc_device_t devicetype, acc_device_property_t 1996 property);' 1997 1998_Fortran_: 1999 _Interface_: 'function acc_get_property(devicenum, devicetype, 2000 property)' 2001 _Interface_: 'subroutine acc_get_property_string(devicenum, 2002 devicetype, property, string)' 2003 'use ISO_C_Binding, only: c_size_t' 2004 'integer devicenum' 2005 'integer(kind=acc_device_kind) devicetype' 2006 'integer(kind=acc_device_property_kind) property' 2007 'integer(kind=c_size_t) acc_get_property' 2008 'character(*) string' 2009 2010_Reference_: 2011 OpenACC specification v2.6 (https://www.openacc.org), section 2012 3.2.6. 2013 2014 2015File: libgomp.info, Node: acc_async_test, Next: acc_async_test_all, Prev: acc_get_property, Up: OpenACC Runtime Library Routines 2016 20175.7 'acc_async_test' - Test for completion of a specific asynchronous operation. 2018================================================================================ 2019 2020_Description_ 2021 This function tests for completion of the asynchronous operation 2022 specified in ARG. In C/C++, a non-zero value will be returned to 2023 indicate the specified asynchronous operation has completed. While 2024 Fortran will return a 'true'. If the asynchronous operation has 2025 not completed, C/C++ returns a zero and Fortran returns a 'false'. 2026 2027_C/C++_: 2028 _Prototype_: 'int acc_async_test(int arg);' 2029 2030_Fortran_: 2031 _Interface_: 'function acc_async_test(arg)' 2032 'integer(kind=acc_handle_kind) arg' 2033 'logical acc_async_test' 2034 2035_Reference_: 2036 OpenACC specification v2.6 (https://www.openacc.org), section 2037 3.2.9. 2038 2039 2040File: libgomp.info, Node: acc_async_test_all, Next: acc_wait, Prev: acc_async_test, Up: OpenACC Runtime Library Routines 2041 20425.8 'acc_async_test_all' - Tests for completion of all asynchronous operations. 2043=============================================================================== 2044 2045_Description_ 2046 This function tests for completion of all asynchronous operations. 2047 In C/C++, a non-zero value will be returned to indicate all 2048 asynchronous operations have completed. While Fortran will return 2049 a 'true'. If any asynchronous operation has not completed, C/C++ 2050 returns a zero and Fortran returns a 'false'. 2051 2052_C/C++_: 2053 _Prototype_: 'int acc_async_test_all(void);' 2054 2055_Fortran_: 2056 _Interface_: 'function acc_async_test()' 2057 'logical acc_get_device_num' 2058 2059_Reference_: 2060 OpenACC specification v2.6 (https://www.openacc.org), section 2061 3.2.10. 2062 2063 2064File: libgomp.info, Node: acc_wait, Next: acc_wait_all, Prev: acc_async_test_all, Up: OpenACC Runtime Library Routines 2065 20665.9 'acc_wait' - Wait for completion of a specific asynchronous operation. 2067========================================================================== 2068 2069_Description_ 2070 This function waits for completion of the asynchronous operation 2071 specified in ARG. 2072 2073_C/C++_: 2074 _Prototype_: 'acc_wait(arg);' 2075 _Prototype 'acc_async_wait(arg);' 2076 (OpenACC 1.0 2077 compatibility)_: 2078 2079_Fortran_: 2080 _Interface_: 'subroutine acc_wait(arg)' 2081 'integer(acc_handle_kind) arg' 2082 _Interface 'subroutine acc_async_wait(arg)' 2083 (OpenACC 1.0 2084 compatibility)_: 2085 'integer(acc_handle_kind) arg' 2086 2087_Reference_: 2088 OpenACC specification v2.6 (https://www.openacc.org), section 2089 3.2.11. 2090 2091 2092File: libgomp.info, Node: acc_wait_all, Next: acc_wait_all_async, Prev: acc_wait, Up: OpenACC Runtime Library Routines 2093 20945.10 'acc_wait_all' - Waits for completion of all asynchronous operations. 2095========================================================================== 2096 2097_Description_ 2098 This function waits for the completion of all asynchronous 2099 operations. 2100 2101_C/C++_: 2102 _Prototype_: 'acc_wait_all(void);' 2103 _Prototype 'acc_async_wait_all(void);' 2104 (OpenACC 1.0 2105 compatibility)_: 2106 2107_Fortran_: 2108 _Interface_: 'subroutine acc_wait_all()' 2109 _Interface 'subroutine acc_async_wait_all()' 2110 (OpenACC 1.0 2111 compatibility)_: 2112 2113_Reference_: 2114 OpenACC specification v2.6 (https://www.openacc.org), section 2115 3.2.13. 2116 2117 2118File: libgomp.info, Node: acc_wait_all_async, Next: acc_wait_async, Prev: acc_wait_all, Up: OpenACC Runtime Library Routines 2119 21205.11 'acc_wait_all_async' - Wait for completion of all asynchronous operations. 2121=============================================================================== 2122 2123_Description_ 2124 This function enqueues a wait operation on the queue ASYNC for any 2125 and all asynchronous operations that have been previously enqueued 2126 on any queue. 2127 2128_C/C++_: 2129 _Prototype_: 'acc_wait_all_async(int async);' 2130 2131_Fortran_: 2132 _Interface_: 'subroutine acc_wait_all_async(async)' 2133 'integer(acc_handle_kind) async' 2134 2135_Reference_: 2136 OpenACC specification v2.6 (https://www.openacc.org), section 2137 3.2.14. 2138 2139 2140File: libgomp.info, Node: acc_wait_async, Next: acc_init, Prev: acc_wait_all_async, Up: OpenACC Runtime Library Routines 2141 21425.12 'acc_wait_async' - Wait for completion of asynchronous operations. 2143======================================================================= 2144 2145_Description_ 2146 This function enqueues a wait operation on queue ASYNC for any and 2147 all asynchronous operations enqueued on queue ARG. 2148 2149_C/C++_: 2150 _Prototype_: 'acc_wait_async(int arg, int async);' 2151 2152_Fortran_: 2153 _Interface_: 'subroutine acc_wait_async(arg, async)' 2154 'integer(acc_handle_kind) arg, async' 2155 2156_Reference_: 2157 OpenACC specification v2.6 (https://www.openacc.org), section 2158 3.2.12. 2159 2160 2161File: libgomp.info, Node: acc_init, Next: acc_shutdown, Prev: acc_wait_async, Up: OpenACC Runtime Library Routines 2162 21635.13 'acc_init' - Initialize runtime for a specific device type. 2164================================================================ 2165 2166_Description_ 2167 This function initializes the runtime for the device type specified 2168 in DEVICETYPE. 2169 2170_C/C++_: 2171 _Prototype_: 'acc_init(acc_device_t devicetype);' 2172 2173_Fortran_: 2174 _Interface_: 'subroutine acc_init(devicetype)' 2175 'integer(acc_device_kind) devicetype' 2176 2177_Reference_: 2178 OpenACC specification v2.6 (https://www.openacc.org), section 2179 3.2.7. 2180 2181 2182File: libgomp.info, Node: acc_shutdown, Next: acc_on_device, Prev: acc_init, Up: OpenACC Runtime Library Routines 2183 21845.14 'acc_shutdown' - Shuts down the runtime for a specific device type. 2185======================================================================== 2186 2187_Description_ 2188 This function shuts down the runtime for the device type specified 2189 in DEVICETYPE. 2190 2191_C/C++_: 2192 _Prototype_: 'acc_shutdown(acc_device_t devicetype);' 2193 2194_Fortran_: 2195 _Interface_: 'subroutine acc_shutdown(devicetype)' 2196 'integer(acc_device_kind) devicetype' 2197 2198_Reference_: 2199 OpenACC specification v2.6 (https://www.openacc.org), section 2200 3.2.8. 2201 2202 2203File: libgomp.info, Node: acc_on_device, Next: acc_malloc, Prev: acc_shutdown, Up: OpenACC Runtime Library Routines 2204 22055.15 'acc_on_device' - Whether executing on a particular device 2206=============================================================== 2207 2208_Description_: 2209 This function returns whether the program is executing on a 2210 particular device specified in DEVICETYPE. In C/C++ a non-zero 2211 value is returned to indicate the device is executing on the 2212 specified device type. In Fortran, 'true' will be returned. If 2213 the program is not executing on the specified device type C/C++ 2214 will return a zero, while Fortran will return 'false'. 2215 2216_C/C++_: 2217 _Prototype_: 'acc_on_device(acc_device_t devicetype);' 2218 2219_Fortran_: 2220 _Interface_: 'function acc_on_device(devicetype)' 2221 'integer(acc_device_kind) devicetype' 2222 'logical acc_on_device' 2223 2224_Reference_: 2225 OpenACC specification v2.6 (https://www.openacc.org), section 2226 3.2.17. 2227 2228 2229File: libgomp.info, Node: acc_malloc, Next: acc_free, Prev: acc_on_device, Up: OpenACC Runtime Library Routines 2230 22315.16 'acc_malloc' - Allocate device memory. 2232=========================================== 2233 2234_Description_ 2235 This function allocates LEN bytes of device memory. It returns the 2236 device address of the allocated memory. 2237 2238_C/C++_: 2239 _Prototype_: 'd_void* acc_malloc(size_t len);' 2240 2241_Reference_: 2242 OpenACC specification v2.6 (https://www.openacc.org), section 2243 3.2.18. 2244 2245 2246File: libgomp.info, Node: acc_free, Next: acc_copyin, Prev: acc_malloc, Up: OpenACC Runtime Library Routines 2247 22485.17 'acc_free' - Free device memory. 2249===================================== 2250 2251_Description_ 2252 Free previously allocated device memory at the device address 'a'. 2253 2254_C/C++_: 2255 _Prototype_: 'acc_free(d_void *a);' 2256 2257_Reference_: 2258 OpenACC specification v2.6 (https://www.openacc.org), section 2259 3.2.19. 2260 2261 2262File: libgomp.info, Node: acc_copyin, Next: acc_present_or_copyin, Prev: acc_free, Up: OpenACC Runtime Library Routines 2263 22645.18 'acc_copyin' - Allocate device memory and copy host memory to it. 2265====================================================================== 2266 2267_Description_ 2268 In C/C++, this function allocates LEN bytes of device memory and 2269 maps it to the specified host address in A. The device address of 2270 the newly allocated device memory is returned. 2271 2272 In Fortran, two (2) forms are supported. In the first form, A 2273 specifies a contiguous array section. The second form A specifies 2274 a variable or array element and LEN specifies the length in bytes. 2275 2276_C/C++_: 2277 _Prototype_: 'void *acc_copyin(h_void *a, size_t len);' 2278 _Prototype_: 'void *acc_copyin_async(h_void *a, size_t len, int 2279 async);' 2280 2281_Fortran_: 2282 _Interface_: 'subroutine acc_copyin(a)' 2283 'type, dimension(:[,:]...) :: a' 2284 _Interface_: 'subroutine acc_copyin(a, len)' 2285 'type, dimension(:[,:]...) :: a' 2286 'integer len' 2287 _Interface_: 'subroutine acc_copyin_async(a, async)' 2288 'type, dimension(:[,:]...) :: a' 2289 'integer(acc_handle_kind) :: async' 2290 _Interface_: 'subroutine acc_copyin_async(a, len, async)' 2291 'type, dimension(:[,:]...) :: a' 2292 'integer len' 2293 'integer(acc_handle_kind) :: async' 2294 2295_Reference_: 2296 OpenACC specification v2.6 (https://www.openacc.org), section 2297 3.2.20. 2298 2299 2300File: libgomp.info, Node: acc_present_or_copyin, Next: acc_create, Prev: acc_copyin, Up: OpenACC Runtime Library Routines 2301 23025.19 'acc_present_or_copyin' - If the data is not present on the device, allocate device memory and copy from host memory. 2303========================================================================================================================== 2304 2305_Description_ 2306 This function tests if the host data specified by A and of length 2307 LEN is present or not. If it is not present, then device memory 2308 will be allocated and the host memory copied. The device address 2309 of the newly allocated device memory is returned. 2310 2311 In Fortran, two (2) forms are supported. In the first form, A 2312 specifies a contiguous array section. The second form A specifies 2313 a variable or array element and LEN specifies the length in bytes. 2314 2315 Note that 'acc_present_or_copyin' and 'acc_pcopyin' exist for 2316 backward compatibility with OpenACC 2.0; use *note acc_copyin:: 2317 instead. 2318 2319_C/C++_: 2320 _Prototype_: 'void *acc_present_or_copyin(h_void *a, size_t len);' 2321 _Prototype_: 'void *acc_pcopyin(h_void *a, size_t len);' 2322 2323_Fortran_: 2324 _Interface_: 'subroutine acc_present_or_copyin(a)' 2325 'type, dimension(:[,:]...) :: a' 2326 _Interface_: 'subroutine acc_present_or_copyin(a, len)' 2327 'type, dimension(:[,:]...) :: a' 2328 'integer len' 2329 _Interface_: 'subroutine acc_pcopyin(a)' 2330 'type, dimension(:[,:]...) :: a' 2331 _Interface_: 'subroutine acc_pcopyin(a, len)' 2332 'type, dimension(:[,:]...) :: a' 2333 'integer len' 2334 2335_Reference_: 2336 OpenACC specification v2.6 (https://www.openacc.org), section 2337 3.2.20. 2338 2339 2340File: libgomp.info, Node: acc_create, Next: acc_present_or_create, Prev: acc_present_or_copyin, Up: OpenACC Runtime Library Routines 2341 23425.20 'acc_create' - Allocate device memory and map it to host memory. 2343===================================================================== 2344 2345_Description_ 2346 This function allocates device memory and maps it to host memory 2347 specified by the host address A with a length of LEN bytes. In 2348 C/C++, the function returns the device address of the allocated 2349 device memory. 2350 2351 In Fortran, two (2) forms are supported. In the first form, A 2352 specifies a contiguous array section. The second form A specifies 2353 a variable or array element and LEN specifies the length in bytes. 2354 2355_C/C++_: 2356 _Prototype_: 'void *acc_create(h_void *a, size_t len);' 2357 _Prototype_: 'void *acc_create_async(h_void *a, size_t len, int 2358 async);' 2359 2360_Fortran_: 2361 _Interface_: 'subroutine acc_create(a)' 2362 'type, dimension(:[,:]...) :: a' 2363 _Interface_: 'subroutine acc_create(a, len)' 2364 'type, dimension(:[,:]...) :: a' 2365 'integer len' 2366 _Interface_: 'subroutine acc_create_async(a, async)' 2367 'type, dimension(:[,:]...) :: a' 2368 'integer(acc_handle_kind) :: async' 2369 _Interface_: 'subroutine acc_create_async(a, len, async)' 2370 'type, dimension(:[,:]...) :: a' 2371 'integer len' 2372 'integer(acc_handle_kind) :: async' 2373 2374_Reference_: 2375 OpenACC specification v2.6 (https://www.openacc.org), section 2376 3.2.21. 2377 2378 2379File: libgomp.info, Node: acc_present_or_create, Next: acc_copyout, Prev: acc_create, Up: OpenACC Runtime Library Routines 2380 23815.21 'acc_present_or_create' - If the data is not present on the device, allocate device memory and map it to host memory. 2382========================================================================================================================== 2383 2384_Description_ 2385 This function tests if the host data specified by A and of length 2386 LEN is present or not. If it is not present, then device memory 2387 will be allocated and mapped to host memory. In C/C++, the device 2388 address of the newly allocated device memory is returned. 2389 2390 In Fortran, two (2) forms are supported. In the first form, A 2391 specifies a contiguous array section. The second form A specifies 2392 a variable or array element and LEN specifies the length in bytes. 2393 2394 Note that 'acc_present_or_create' and 'acc_pcreate' exist for 2395 backward compatibility with OpenACC 2.0; use *note acc_create:: 2396 instead. 2397 2398_C/C++_: 2399 _Prototype_: 'void *acc_present_or_create(h_void *a, size_t len)' 2400 _Prototype_: 'void *acc_pcreate(h_void *a, size_t len)' 2401 2402_Fortran_: 2403 _Interface_: 'subroutine acc_present_or_create(a)' 2404 'type, dimension(:[,:]...) :: a' 2405 _Interface_: 'subroutine acc_present_or_create(a, len)' 2406 'type, dimension(:[,:]...) :: a' 2407 'integer len' 2408 _Interface_: 'subroutine acc_pcreate(a)' 2409 'type, dimension(:[,:]...) :: a' 2410 _Interface_: 'subroutine acc_pcreate(a, len)' 2411 'type, dimension(:[,:]...) :: a' 2412 'integer len' 2413 2414_Reference_: 2415 OpenACC specification v2.6 (https://www.openacc.org), section 2416 3.2.21. 2417 2418 2419File: libgomp.info, Node: acc_copyout, Next: acc_delete, Prev: acc_present_or_create, Up: OpenACC Runtime Library Routines 2420 24215.22 'acc_copyout' - Copy device memory to host memory. 2422======================================================= 2423 2424_Description_ 2425 This function copies mapped device memory to host memory which is 2426 specified by host address A for a length LEN bytes in C/C++. 2427 2428 In Fortran, two (2) forms are supported. In the first form, A 2429 specifies a contiguous array section. The second form A specifies 2430 a variable or array element and LEN specifies the length in bytes. 2431 2432_C/C++_: 2433 _Prototype_: 'acc_copyout(h_void *a, size_t len);' 2434 _Prototype_: 'acc_copyout_async(h_void *a, size_t len, int async);' 2435 _Prototype_: 'acc_copyout_finalize(h_void *a, size_t len);' 2436 _Prototype_: 'acc_copyout_finalize_async(h_void *a, size_t len, int 2437 async);' 2438 2439_Fortran_: 2440 _Interface_: 'subroutine acc_copyout(a)' 2441 'type, dimension(:[,:]...) :: a' 2442 _Interface_: 'subroutine acc_copyout(a, len)' 2443 'type, dimension(:[,:]...) :: a' 2444 'integer len' 2445 _Interface_: 'subroutine acc_copyout_async(a, async)' 2446 'type, dimension(:[,:]...) :: a' 2447 'integer(acc_handle_kind) :: async' 2448 _Interface_: 'subroutine acc_copyout_async(a, len, async)' 2449 'type, dimension(:[,:]...) :: a' 2450 'integer len' 2451 'integer(acc_handle_kind) :: async' 2452 _Interface_: 'subroutine acc_copyout_finalize(a)' 2453 'type, dimension(:[,:]...) :: a' 2454 _Interface_: 'subroutine acc_copyout_finalize(a, len)' 2455 'type, dimension(:[,:]...) :: a' 2456 'integer len' 2457 _Interface_: 'subroutine acc_copyout_finalize_async(a, async)' 2458 'type, dimension(:[,:]...) :: a' 2459 'integer(acc_handle_kind) :: async' 2460 _Interface_: 'subroutine acc_copyout_finalize_async(a, len, async)' 2461 'type, dimension(:[,:]...) :: a' 2462 'integer len' 2463 'integer(acc_handle_kind) :: async' 2464 2465_Reference_: 2466 OpenACC specification v2.6 (https://www.openacc.org), section 2467 3.2.22. 2468 2469 2470File: libgomp.info, Node: acc_delete, Next: acc_update_device, Prev: acc_copyout, Up: OpenACC Runtime Library Routines 2471 24725.23 'acc_delete' - Free device memory. 2473======================================= 2474 2475_Description_ 2476 This function frees previously allocated device memory specified by 2477 the device address A and the length of LEN bytes. 2478 2479 In Fortran, two (2) forms are supported. In the first form, A 2480 specifies a contiguous array section. The second form A specifies 2481 a variable or array element and LEN specifies the length in bytes. 2482 2483_C/C++_: 2484 _Prototype_: 'acc_delete(h_void *a, size_t len);' 2485 _Prototype_: 'acc_delete_async(h_void *a, size_t len, int async);' 2486 _Prototype_: 'acc_delete_finalize(h_void *a, size_t len);' 2487 _Prototype_: 'acc_delete_finalize_async(h_void *a, size_t len, int 2488 async);' 2489 2490_Fortran_: 2491 _Interface_: 'subroutine acc_delete(a)' 2492 'type, dimension(:[,:]...) :: a' 2493 _Interface_: 'subroutine acc_delete(a, len)' 2494 'type, dimension(:[,:]...) :: a' 2495 'integer len' 2496 _Interface_: 'subroutine acc_delete_async(a, async)' 2497 'type, dimension(:[,:]...) :: a' 2498 'integer(acc_handle_kind) :: async' 2499 _Interface_: 'subroutine acc_delete_async(a, len, async)' 2500 'type, dimension(:[,:]...) :: a' 2501 'integer len' 2502 'integer(acc_handle_kind) :: async' 2503 _Interface_: 'subroutine acc_delete_finalize(a)' 2504 'type, dimension(:[,:]...) :: a' 2505 _Interface_: 'subroutine acc_delete_finalize(a, len)' 2506 'type, dimension(:[,:]...) :: a' 2507 'integer len' 2508 _Interface_: 'subroutine acc_delete_async_finalize(a, async)' 2509 'type, dimension(:[,:]...) :: a' 2510 'integer(acc_handle_kind) :: async' 2511 _Interface_: 'subroutine acc_delete_async_finalize(a, len, async)' 2512 'type, dimension(:[,:]...) :: a' 2513 'integer len' 2514 'integer(acc_handle_kind) :: async' 2515 2516_Reference_: 2517 OpenACC specification v2.6 (https://www.openacc.org), section 2518 3.2.23. 2519 2520 2521File: libgomp.info, Node: acc_update_device, Next: acc_update_self, Prev: acc_delete, Up: OpenACC Runtime Library Routines 2522 25235.24 'acc_update_device' - Update device memory from mapped host memory. 2524======================================================================== 2525 2526_Description_ 2527 This function updates the device copy from the previously mapped 2528 host memory. The host memory is specified with the host address A 2529 and a length of LEN bytes. 2530 2531 In Fortran, two (2) forms are supported. In the first form, A 2532 specifies a contiguous array section. The second form A specifies 2533 a variable or array element and LEN specifies the length in bytes. 2534 2535_C/C++_: 2536 _Prototype_: 'acc_update_device(h_void *a, size_t len);' 2537 _Prototype_: 'acc_update_device(h_void *a, size_t len, async);' 2538 2539_Fortran_: 2540 _Interface_: 'subroutine acc_update_device(a)' 2541 'type, dimension(:[,:]...) :: a' 2542 _Interface_: 'subroutine acc_update_device(a, len)' 2543 'type, dimension(:[,:]...) :: a' 2544 'integer len' 2545 _Interface_: 'subroutine acc_update_device_async(a, async)' 2546 'type, dimension(:[,:]...) :: a' 2547 'integer(acc_handle_kind) :: async' 2548 _Interface_: 'subroutine acc_update_device_async(a, len, async)' 2549 'type, dimension(:[,:]...) :: a' 2550 'integer len' 2551 'integer(acc_handle_kind) :: async' 2552 2553_Reference_: 2554 OpenACC specification v2.6 (https://www.openacc.org), section 2555 3.2.24. 2556 2557 2558File: libgomp.info, Node: acc_update_self, Next: acc_map_data, Prev: acc_update_device, Up: OpenACC Runtime Library Routines 2559 25605.25 'acc_update_self' - Update host memory from mapped device memory. 2561====================================================================== 2562 2563_Description_ 2564 This function updates the host copy from the previously mapped 2565 device memory. The host memory is specified with the host address 2566 A and a length of LEN bytes. 2567 2568 In Fortran, two (2) forms are supported. In the first form, A 2569 specifies a contiguous array section. The second form A specifies 2570 a variable or array element and LEN specifies the length in bytes. 2571 2572_C/C++_: 2573 _Prototype_: 'acc_update_self(h_void *a, size_t len);' 2574 _Prototype_: 'acc_update_self_async(h_void *a, size_t len, int 2575 async);' 2576 2577_Fortran_: 2578 _Interface_: 'subroutine acc_update_self(a)' 2579 'type, dimension(:[,:]...) :: a' 2580 _Interface_: 'subroutine acc_update_self(a, len)' 2581 'type, dimension(:[,:]...) :: a' 2582 'integer len' 2583 _Interface_: 'subroutine acc_update_self_async(a, async)' 2584 'type, dimension(:[,:]...) :: a' 2585 'integer(acc_handle_kind) :: async' 2586 _Interface_: 'subroutine acc_update_self_async(a, len, async)' 2587 'type, dimension(:[,:]...) :: a' 2588 'integer len' 2589 'integer(acc_handle_kind) :: async' 2590 2591_Reference_: 2592 OpenACC specification v2.6 (https://www.openacc.org), section 2593 3.2.25. 2594 2595 2596File: libgomp.info, Node: acc_map_data, Next: acc_unmap_data, Prev: acc_update_self, Up: OpenACC Runtime Library Routines 2597 25985.26 'acc_map_data' - Map previously allocated device memory to host memory. 2599============================================================================ 2600 2601_Description_ 2602 This function maps previously allocated device and host memory. 2603 The device memory is specified with the device address D. The host 2604 memory is specified with the host address H and a length of LEN. 2605 2606_C/C++_: 2607 _Prototype_: 'acc_map_data(h_void *h, d_void *d, size_t len);' 2608 2609_Reference_: 2610 OpenACC specification v2.6 (https://www.openacc.org), section 2611 3.2.26. 2612 2613 2614File: libgomp.info, Node: acc_unmap_data, Next: acc_deviceptr, Prev: acc_map_data, Up: OpenACC Runtime Library Routines 2615 26165.27 'acc_unmap_data' - Unmap device memory from host memory. 2617============================================================= 2618 2619_Description_ 2620 This function unmaps previously mapped device and host memory. The 2621 latter specified by H. 2622 2623_C/C++_: 2624 _Prototype_: 'acc_unmap_data(h_void *h);' 2625 2626_Reference_: 2627 OpenACC specification v2.6 (https://www.openacc.org), section 2628 3.2.27. 2629 2630 2631File: libgomp.info, Node: acc_deviceptr, Next: acc_hostptr, Prev: acc_unmap_data, Up: OpenACC Runtime Library Routines 2632 26335.28 'acc_deviceptr' - Get device pointer associated with specific host address. 2634================================================================================ 2635 2636_Description_ 2637 This function returns the device address that has been mapped to 2638 the host address specified by H. 2639 2640_C/C++_: 2641 _Prototype_: 'void *acc_deviceptr(h_void *h);' 2642 2643_Reference_: 2644 OpenACC specification v2.6 (https://www.openacc.org), section 2645 3.2.28. 2646 2647 2648File: libgomp.info, Node: acc_hostptr, Next: acc_is_present, Prev: acc_deviceptr, Up: OpenACC Runtime Library Routines 2649 26505.29 'acc_hostptr' - Get host pointer associated with specific device address. 2651============================================================================== 2652 2653_Description_ 2654 This function returns the host address that has been mapped to the 2655 device address specified by D. 2656 2657_C/C++_: 2658 _Prototype_: 'void *acc_hostptr(d_void *d);' 2659 2660_Reference_: 2661 OpenACC specification v2.6 (https://www.openacc.org), section 2662 3.2.29. 2663 2664 2665File: libgomp.info, Node: acc_is_present, Next: acc_memcpy_to_device, Prev: acc_hostptr, Up: OpenACC Runtime Library Routines 2666 26675.30 'acc_is_present' - Indicate whether host variable / array is present on device. 2668==================================================================================== 2669 2670_Description_ 2671 This function indicates whether the specified host address in A and 2672 a length of LEN bytes is present on the device. In C/C++, a 2673 non-zero value is returned to indicate the presence of the mapped 2674 memory on the device. A zero is returned to indicate the memory is 2675 not mapped on the device. 2676 2677 In Fortran, two (2) forms are supported. In the first form, A 2678 specifies a contiguous array section. The second form A specifies 2679 a variable or array element and LEN specifies the length in bytes. 2680 If the host memory is mapped to device memory, then a 'true' is 2681 returned. Otherwise, a 'false' is return to indicate the mapped 2682 memory is not present. 2683 2684_C/C++_: 2685 _Prototype_: 'int acc_is_present(h_void *a, size_t len);' 2686 2687_Fortran_: 2688 _Interface_: 'function acc_is_present(a)' 2689 'type, dimension(:[,:]...) :: a' 2690 'logical acc_is_present' 2691 _Interface_: 'function acc_is_present(a, len)' 2692 'type, dimension(:[,:]...) :: a' 2693 'integer len' 2694 'logical acc_is_present' 2695 2696_Reference_: 2697 OpenACC specification v2.6 (https://www.openacc.org), section 2698 3.2.30. 2699 2700 2701File: libgomp.info, Node: acc_memcpy_to_device, Next: acc_memcpy_from_device, Prev: acc_is_present, Up: OpenACC Runtime Library Routines 2702 27035.31 'acc_memcpy_to_device' - Copy host memory to device memory. 2704================================================================ 2705 2706_Description_ 2707 This function copies host memory specified by host address of SRC 2708 to device memory specified by the device address DEST for a length 2709 of BYTES bytes. 2710 2711_C/C++_: 2712 _Prototype_: 'acc_memcpy_to_device(d_void *dest, h_void *src, size_t 2713 bytes);' 2714 2715_Reference_: 2716 OpenACC specification v2.6 (https://www.openacc.org), section 2717 3.2.31. 2718 2719 2720File: libgomp.info, Node: acc_memcpy_from_device, Next: acc_attach, Prev: acc_memcpy_to_device, Up: OpenACC Runtime Library Routines 2721 27225.32 'acc_memcpy_from_device' - Copy device memory to host memory. 2723================================================================== 2724 2725_Description_ 2726 This function copies host memory specified by host address of SRC 2727 from device memory specified by the device address DEST for a 2728 length of BYTES bytes. 2729 2730_C/C++_: 2731 _Prototype_: 'acc_memcpy_from_device(d_void *dest, h_void *src, 2732 size_t bytes);' 2733 2734_Reference_: 2735 OpenACC specification v2.6 (https://www.openacc.org), section 2736 3.2.32. 2737 2738 2739File: libgomp.info, Node: acc_attach, Next: acc_detach, Prev: acc_memcpy_from_device, Up: OpenACC Runtime Library Routines 2740 27415.33 'acc_attach' - Let device pointer point to device-pointer target. 2742====================================================================== 2743 2744_Description_ 2745 This function updates a pointer on the device from pointing to a 2746 host-pointer address to pointing to the corresponding device data. 2747 2748_C/C++_: 2749 _Prototype_: 'acc_attach(h_void **ptr);' 2750 _Prototype_: 'acc_attach_async(h_void **ptr, int async);' 2751 2752_Reference_: 2753 OpenACC specification v2.6 (https://www.openacc.org), section 2754 3.2.34. 2755 2756 2757File: libgomp.info, Node: acc_detach, Next: acc_get_current_cuda_device, Prev: acc_attach, Up: OpenACC Runtime Library Routines 2758 27595.34 'acc_detach' - Let device pointer point to host-pointer target. 2760==================================================================== 2761 2762_Description_ 2763 This function updates a pointer on the device from pointing to a 2764 device-pointer address to pointing to the corresponding host data. 2765 2766_C/C++_: 2767 _Prototype_: 'acc_detach(h_void **ptr);' 2768 _Prototype_: 'acc_detach_async(h_void **ptr, int async);' 2769 _Prototype_: 'acc_detach_finalize(h_void **ptr);' 2770 _Prototype_: 'acc_detach_finalize_async(h_void **ptr, int async);' 2771 2772_Reference_: 2773 OpenACC specification v2.6 (https://www.openacc.org), section 2774 3.2.35. 2775 2776 2777File: libgomp.info, Node: acc_get_current_cuda_device, Next: acc_get_current_cuda_context, Prev: acc_detach, Up: OpenACC Runtime Library Routines 2778 27795.35 'acc_get_current_cuda_device' - Get CUDA device handle. 2780============================================================ 2781 2782_Description_ 2783 This function returns the CUDA device handle. This handle is the 2784 same as used by the CUDA Runtime or Driver API's. 2785 2786_C/C++_: 2787 _Prototype_: 'void *acc_get_current_cuda_device(void);' 2788 2789_Reference_: 2790 OpenACC specification v2.6 (https://www.openacc.org), section 2791 A.2.1.1. 2792 2793 2794File: libgomp.info, Node: acc_get_current_cuda_context, Next: acc_get_cuda_stream, Prev: acc_get_current_cuda_device, Up: OpenACC Runtime Library Routines 2795 27965.36 'acc_get_current_cuda_context' - Get CUDA context handle. 2797============================================================== 2798 2799_Description_ 2800 This function returns the CUDA context handle. This handle is the 2801 same as used by the CUDA Runtime or Driver API's. 2802 2803_C/C++_: 2804 _Prototype_: 'void *acc_get_current_cuda_context(void);' 2805 2806_Reference_: 2807 OpenACC specification v2.6 (https://www.openacc.org), section 2808 A.2.1.2. 2809 2810 2811File: libgomp.info, Node: acc_get_cuda_stream, Next: acc_set_cuda_stream, Prev: acc_get_current_cuda_context, Up: OpenACC Runtime Library Routines 2812 28135.37 'acc_get_cuda_stream' - Get CUDA stream handle. 2814==================================================== 2815 2816_Description_ 2817 This function returns the CUDA stream handle for the queue ASYNC. 2818 This handle is the same as used by the CUDA Runtime or Driver 2819 API's. 2820 2821_C/C++_: 2822 _Prototype_: 'void *acc_get_cuda_stream(int async);' 2823 2824_Reference_: 2825 OpenACC specification v2.6 (https://www.openacc.org), section 2826 A.2.1.3. 2827 2828 2829File: libgomp.info, Node: acc_set_cuda_stream, Next: acc_prof_register, Prev: acc_get_cuda_stream, Up: OpenACC Runtime Library Routines 2830 28315.38 'acc_set_cuda_stream' - Set CUDA stream handle. 2832==================================================== 2833 2834_Description_ 2835 This function associates the stream handle specified by STREAM with 2836 the queue ASYNC. 2837 2838 This cannot be used to change the stream handle associated with 2839 'acc_async_sync'. 2840 2841 The return value is not specified. 2842 2843_C/C++_: 2844 _Prototype_: 'int acc_set_cuda_stream(int async, void *stream);' 2845 2846_Reference_: 2847 OpenACC specification v2.6 (https://www.openacc.org), section 2848 A.2.1.4. 2849 2850 2851File: libgomp.info, Node: acc_prof_register, Next: acc_prof_unregister, Prev: acc_set_cuda_stream, Up: OpenACC Runtime Library Routines 2852 28535.39 'acc_prof_register' - Register callbacks. 2854============================================== 2855 2856_Description_: 2857 This function registers callbacks. 2858 2859_C/C++_: 2860 _Prototype_: 'void acc_prof_register (acc_event_t, acc_prof_callback, 2861 acc_register_t);' 2862 2863_See also_: 2864 *note OpenACC Profiling Interface:: 2865 2866_Reference_: 2867 OpenACC specification v2.6 (https://www.openacc.org), section 5.3. 2868 2869 2870File: libgomp.info, Node: acc_prof_unregister, Next: acc_prof_lookup, Prev: acc_prof_register, Up: OpenACC Runtime Library Routines 2871 28725.40 'acc_prof_unregister' - Unregister callbacks. 2873================================================== 2874 2875_Description_: 2876 This function unregisters callbacks. 2877 2878_C/C++_: 2879 _Prototype_: 'void acc_prof_unregister (acc_event_t, 2880 acc_prof_callback, acc_register_t);' 2881 2882_See also_: 2883 *note OpenACC Profiling Interface:: 2884 2885_Reference_: 2886 OpenACC specification v2.6 (https://www.openacc.org), section 5.3. 2887 2888 2889File: libgomp.info, Node: acc_prof_lookup, Next: acc_register_library, Prev: acc_prof_unregister, Up: OpenACC Runtime Library Routines 2890 28915.41 'acc_prof_lookup' - Obtain inquiry functions. 2892================================================== 2893 2894_Description_: 2895 Function to obtain inquiry functions. 2896 2897_C/C++_: 2898 _Prototype_: 'acc_query_fn acc_prof_lookup (const char *);' 2899 2900_See also_: 2901 *note OpenACC Profiling Interface:: 2902 2903_Reference_: 2904 OpenACC specification v2.6 (https://www.openacc.org), section 5.3. 2905 2906 2907File: libgomp.info, Node: acc_register_library, Prev: acc_prof_lookup, Up: OpenACC Runtime Library Routines 2908 29095.42 'acc_register_library' - Library registration. 2910=================================================== 2911 2912_Description_: 2913 Function for library registration. 2914 2915_C/C++_: 2916 _Prototype_: 'void acc_register_library (acc_prof_reg, acc_prof_reg, 2917 acc_prof_lookup_func);' 2918 2919_See also_: 2920 *note OpenACC Profiling Interface::, *note ACC_PROFLIB:: 2921 2922_Reference_: 2923 OpenACC specification v2.6 (https://www.openacc.org), section 5.3. 2924 2925 2926File: libgomp.info, Node: OpenACC Environment Variables, Next: CUDA Streams Usage, Prev: OpenACC Runtime Library Routines, Up: Top 2927 29286 OpenACC Environment Variables 2929******************************* 2930 2931The variables 'ACC_DEVICE_TYPE' and 'ACC_DEVICE_NUM' are defined by 2932section 4 of the OpenACC specification in version 2.0. The variable 2933'ACC_PROFLIB' is defined by section 4 of the OpenACC specification in 2934version 2.6. The variable 'GCC_ACC_NOTIFY' is used for diagnostic 2935purposes. 2936 2937* Menu: 2938 2939* ACC_DEVICE_TYPE:: 2940* ACC_DEVICE_NUM:: 2941* ACC_PROFLIB:: 2942* GCC_ACC_NOTIFY:: 2943 2944 2945File: libgomp.info, Node: ACC_DEVICE_TYPE, Next: ACC_DEVICE_NUM, Up: OpenACC Environment Variables 2946 29476.1 'ACC_DEVICE_TYPE' 2948===================== 2949 2950_Reference_: 2951 OpenACC specification v2.6 (https://www.openacc.org), section 4.1. 2952 2953 2954File: libgomp.info, Node: ACC_DEVICE_NUM, Next: ACC_PROFLIB, Prev: ACC_DEVICE_TYPE, Up: OpenACC Environment Variables 2955 29566.2 'ACC_DEVICE_NUM' 2957==================== 2958 2959_Reference_: 2960 OpenACC specification v2.6 (https://www.openacc.org), section 4.2. 2961 2962 2963File: libgomp.info, Node: ACC_PROFLIB, Next: GCC_ACC_NOTIFY, Prev: ACC_DEVICE_NUM, Up: OpenACC Environment Variables 2964 29656.3 'ACC_PROFLIB' 2966================= 2967 2968_See also_: 2969 *note acc_register_library::, *note OpenACC Profiling Interface:: 2970 2971_Reference_: 2972 OpenACC specification v2.6 (https://www.openacc.org), section 4.3. 2973 2974 2975File: libgomp.info, Node: GCC_ACC_NOTIFY, Prev: ACC_PROFLIB, Up: OpenACC Environment Variables 2976 29776.4 'GCC_ACC_NOTIFY' 2978==================== 2979 2980_Description_: 2981 Print debug information pertaining to the accelerator. 2982 2983 2984File: libgomp.info, Node: CUDA Streams Usage, Next: OpenACC Library Interoperability, Prev: OpenACC Environment Variables, Up: Top 2985 29867 CUDA Streams Usage 2987******************** 2988 2989This applies to the 'nvptx' plugin only. 2990 2991 The library provides elements that perform asynchronous movement of 2992data and asynchronous operation of computing constructs. This 2993asynchronous functionality is implemented by making use of CUDA 2994streams(1). 2995 2996 The primary means by that the asynchronous functionality is accessed 2997is through the use of those OpenACC directives which make use of the 2998'async' and 'wait' clauses. When the 'async' clause is first used with 2999a directive, it creates a CUDA stream. If an 'async-argument' is used 3000with the 'async' clause, then the stream is associated with the 3001specified 'async-argument'. 3002 3003 Following the creation of an association between a CUDA stream and 3004the 'async-argument' of an 'async' clause, both the 'wait' clause and 3005the 'wait' directive can be used. When either the clause or directive 3006is used after stream creation, it creates a rendezvous point whereby 3007execution waits until all operations associated with the 3008'async-argument', that is, stream, have completed. 3009 3010 Normally, the management of the streams that are created as a result 3011of using the 'async' clause, is done without any intervention by the 3012caller. This implies the association between the 'async-argument' and 3013the CUDA stream will be maintained for the lifetime of the program. 3014However, this association can be changed through the use of the library 3015function 'acc_set_cuda_stream'. When the function 'acc_set_cuda_stream' 3016is called, the CUDA stream that was originally associated with the 3017'async' clause will be destroyed. Caution should be taken when changing 3018the association as subsequent references to the 'async-argument' refer 3019to a different CUDA stream. 3020 3021 ---------- Footnotes ---------- 3022 3023 (1) See "Stream Management" in "CUDA Driver API", TRM-06703-001, 3024Version 5.5, for additional information 3025 3026 3027File: libgomp.info, Node: OpenACC Library Interoperability, Next: OpenACC Profiling Interface, Prev: CUDA Streams Usage, Up: Top 3028 30298 OpenACC Library Interoperability 3030********************************** 3031 30328.1 Introduction 3033================ 3034 3035The OpenACC library uses the CUDA Driver API, and may interact with 3036programs that use the Runtime library directly, or another library based 3037on the Runtime library, e.g., CUBLAS(1). This chapter describes the use 3038cases and what changes are required in order to use both the OpenACC 3039library and the CUBLAS and Runtime libraries within a program. 3040 30418.2 First invocation: NVIDIA CUBLAS library API 3042=============================================== 3043 3044In this first use case (see below), a function in the CUBLAS library is 3045called prior to any of the functions in the OpenACC library. More 3046specifically, the function 'cublasCreate()'. 3047 3048 When invoked, the function initializes the library and allocates the 3049hardware resources on the host and the device on behalf of the caller. 3050Once the initialization and allocation has completed, a handle is 3051returned to the caller. The OpenACC library also requires 3052initialization and allocation of hardware resources. Since the CUBLAS 3053library has already allocated the hardware resources for the device, all 3054that is left to do is to initialize the OpenACC library and acquire the 3055hardware resources on the host. 3056 3057 Prior to calling the OpenACC function that initializes the library 3058and allocate the host hardware resources, you need to acquire the device 3059number that was allocated during the call to 'cublasCreate()'. The 3060invoking of the runtime library function 'cudaGetDevice()' accomplishes 3061this. Once acquired, the device number is passed along with the device 3062type as parameters to the OpenACC library function 3063'acc_set_device_num()'. 3064 3065 Once the call to 'acc_set_device_num()' has completed, the OpenACC 3066library uses the context that was created during the call to 3067'cublasCreate()'. In other words, both libraries will be sharing the 3068same context. 3069 3070 /* Create the handle */ 3071 s = cublasCreate(&h); 3072 if (s != CUBLAS_STATUS_SUCCESS) 3073 { 3074 fprintf(stderr, "cublasCreate failed %d\n", s); 3075 exit(EXIT_FAILURE); 3076 } 3077 3078 /* Get the device number */ 3079 e = cudaGetDevice(&dev); 3080 if (e != cudaSuccess) 3081 { 3082 fprintf(stderr, "cudaGetDevice failed %d\n", e); 3083 exit(EXIT_FAILURE); 3084 } 3085 3086 /* Initialize OpenACC library and use device 'dev' */ 3087 acc_set_device_num(dev, acc_device_nvidia); 3088 3089 Use Case 1 3090 30918.3 First invocation: OpenACC library API 3092========================================= 3093 3094In this second use case (see below), a function in the OpenACC library 3095is called prior to any of the functions in the CUBLAS library. More 3096specificially, the function 'acc_set_device_num()'. 3097 3098 In the use case presented here, the function 'acc_set_device_num()' 3099is used to both initialize the OpenACC library and allocate the hardware 3100resources on the host and the device. In the call to the function, the 3101call parameters specify which device to use and what device type to use, 3102i.e., 'acc_device_nvidia'. It should be noted that this is but one 3103method to initialize the OpenACC library and allocate the appropriate 3104hardware resources. Other methods are available through the use of 3105environment variables and these will be discussed in the next section. 3106 3107 Once the call to 'acc_set_device_num()' has completed, other OpenACC 3108functions can be called as seen with multiple calls being made to 3109'acc_copyin()'. In addition, calls can be made to functions in the 3110CUBLAS library. In the use case a call to 'cublasCreate()' is made 3111subsequent to the calls to 'acc_copyin()'. As seen in the previous use 3112case, a call to 'cublasCreate()' initializes the CUBLAS library and 3113allocates the hardware resources on the host and the device. However, 3114since the device has already been allocated, 'cublasCreate()' will only 3115initialize the CUBLAS library and allocate the appropriate hardware 3116resources on the host. The context that was created as part of the 3117OpenACC initialization is shared with the CUBLAS library, similarly to 3118the first use case. 3119 3120 dev = 0; 3121 3122 acc_set_device_num(dev, acc_device_nvidia); 3123 3124 /* Copy the first set to the device */ 3125 d_X = acc_copyin(&h_X[0], N * sizeof (float)); 3126 if (d_X == NULL) 3127 { 3128 fprintf(stderr, "copyin error h_X\n"); 3129 exit(EXIT_FAILURE); 3130 } 3131 3132 /* Copy the second set to the device */ 3133 d_Y = acc_copyin(&h_Y1[0], N * sizeof (float)); 3134 if (d_Y == NULL) 3135 { 3136 fprintf(stderr, "copyin error h_Y1\n"); 3137 exit(EXIT_FAILURE); 3138 } 3139 3140 /* Create the handle */ 3141 s = cublasCreate(&h); 3142 if (s != CUBLAS_STATUS_SUCCESS) 3143 { 3144 fprintf(stderr, "cublasCreate failed %d\n", s); 3145 exit(EXIT_FAILURE); 3146 } 3147 3148 /* Perform saxpy using CUBLAS library function */ 3149 s = cublasSaxpy(h, N, &alpha, d_X, 1, d_Y, 1); 3150 if (s != CUBLAS_STATUS_SUCCESS) 3151 { 3152 fprintf(stderr, "cublasSaxpy failed %d\n", s); 3153 exit(EXIT_FAILURE); 3154 } 3155 3156 /* Copy the results from the device */ 3157 acc_memcpy_from_device(&h_Y1[0], d_Y, N * sizeof (float)); 3158 3159 Use Case 2 3160 31618.4 OpenACC library and environment variables 3162============================================= 3163 3164There are two environment variables associated with the OpenACC library 3165that may be used to control the device type and device number: 3166'ACC_DEVICE_TYPE' and 'ACC_DEVICE_NUM', respectively. These two 3167environment variables can be used as an alternative to calling 3168'acc_set_device_num()'. As seen in the second use case, the device type 3169and device number were specified using 'acc_set_device_num()'. If 3170however, the aforementioned environment variables were set, then the 3171call to 'acc_set_device_num()' would not be required. 3172 3173 The use of the environment variables is only relevant when an OpenACC 3174function is called prior to a call to 'cudaCreate()'. If 'cudaCreate()' 3175is called prior to a call to an OpenACC function, then you must call 3176'acc_set_device_num()'(2) 3177 3178 ---------- Footnotes ---------- 3179 3180 (1) See section 2.26, "Interactions with the CUDA Driver API" in 3181"CUDA Runtime API", Version 5.5, and section 2.27, "VDPAU 3182Interoperability", in "CUDA Driver API", TRM-06703-001, Version 5.5, for 3183additional information on library interoperability. 3184 3185 (2) More complete information about 'ACC_DEVICE_TYPE' and 3186'ACC_DEVICE_NUM' can be found in sections 4.1 and 4.2 of the OpenACC 3187(https://www.openacc.org) Application Programming Interface”, Version 31882.6. 3189 3190 3191File: libgomp.info, Node: OpenACC Profiling Interface, Next: The libgomp ABI, Prev: OpenACC Library Interoperability, Up: Top 3192 31939 OpenACC Profiling Interface 3194***************************** 3195 31969.1 Implementation Status and Implementation-Defined Behavior 3197============================================================= 3198 3199We're implementing the OpenACC Profiling Interface as defined by the 3200OpenACC 2.6 specification. We're clarifying some aspects here as 3201_implementation-defined behavior_, while they're still under discussion 3202within the OpenACC Technical Committee. 3203 3204 This implementation is tuned to keep the performance impact as low as 3205possible for the (very common) case that the Profiling Interface is not 3206enabled. This is relevant, as the Profiling Interface affects all the 3207_hot_ code paths (in the target code, not in the offloaded code). Users 3208of the OpenACC Profiling Interface can be expected to understand that 3209performance will be impacted to some degree once the Profiling Interface 3210has gotten enabled: for example, because of the _runtime_ (libgomp) 3211calling into a third-party _library_ for every event that has been 3212registered. 3213 3214 We're not yet accounting for the fact that 'OpenACC events may occur 3215during event processing'. We just handle one case specially, as 3216required by CUDA 9.0 'nvprof', that 'acc_get_device_type' (*note 3217acc_get_device_type::)) may be called from 'acc_ev_device_init_start', 3218'acc_ev_device_init_end' callbacks. 3219 3220 We're not yet implementing initialization via a 3221'acc_register_library' function that is either statically linked in, or 3222dynamically via 'LD_PRELOAD'. Initialization via 'acc_register_library' 3223functions dynamically loaded via the 'ACC_PROFLIB' environment variable 3224does work, as does directly calling 'acc_prof_register', 3225'acc_prof_unregister', 'acc_prof_lookup'. 3226 3227 As currently there are no inquiry functions defined, calls to 3228'acc_prof_lookup' will always return 'NULL'. 3229 3230 There aren't separate _start_, _stop_ events defined for the event 3231types 'acc_ev_create', 'acc_ev_delete', 'acc_ev_alloc', 'acc_ev_free'. 3232It's not clear if these should be triggered before or after the actual 3233device-specific call is made. We trigger them after. 3234 3235 Remarks about data provided to callbacks: 3236 3237'acc_prof_info.event_type' 3238 It's not clear if for _nested_ event callbacks (for example, 3239 'acc_ev_enqueue_launch_start' as part of a parent compute 3240 construct), this should be set for the nested event 3241 ('acc_ev_enqueue_launch_start'), or if the value of the parent 3242 construct should remain ('acc_ev_compute_construct_start'). In 3243 this implementation, the value will generally correspond to the 3244 innermost nested event type. 3245 3246'acc_prof_info.device_type' 3247 3248 * For 'acc_ev_compute_construct_start', and in presence of an 3249 'if' clause with _false_ argument, this will still refer to 3250 the offloading device type. It's not clear if that's the 3251 expected behavior. 3252 3253 * Complementary to the item before, for 3254 'acc_ev_compute_construct_end', this is set to 3255 'acc_device_host' in presence of an 'if' clause with _false_ 3256 argument. It's not clear if that's the expected behavior. 3257 3258'acc_prof_info.thread_id' 3259 Always '-1'; not yet implemented. 3260 3261'acc_prof_info.async' 3262 3263 * Not yet implemented correctly for 3264 'acc_ev_compute_construct_start'. 3265 3266 * In a compute construct, for host-fallback 3267 execution/'acc_device_host' it will always be 3268 'acc_async_sync'. It's not clear if that's the expected 3269 behavior. 3270 3271 * For 'acc_ev_device_init_start' and 'acc_ev_device_init_end', 3272 it will always be 'acc_async_sync'. It's not clear if that's 3273 the expected behavior. 3274 3275'acc_prof_info.async_queue' 3276 There is no 'limited number of asynchronous queues' in libgomp. 3277 This will always have the same value as 'acc_prof_info.async'. 3278 3279'acc_prof_info.src_file' 3280 Always 'NULL'; not yet implemented. 3281 3282'acc_prof_info.func_name' 3283 Always 'NULL'; not yet implemented. 3284 3285'acc_prof_info.line_no' 3286 Always '-1'; not yet implemented. 3287 3288'acc_prof_info.end_line_no' 3289 Always '-1'; not yet implemented. 3290 3291'acc_prof_info.func_line_no' 3292 Always '-1'; not yet implemented. 3293 3294'acc_prof_info.func_end_line_no' 3295 Always '-1'; not yet implemented. 3296 3297'acc_event_info.event_type', 'acc_event_info.*.event_type' 3298 Relating to 'acc_prof_info.event_type' discussed above, in this 3299 implementation, this will always be the same value as 3300 'acc_prof_info.event_type'. 3301 3302'acc_event_info.*.parent_construct' 3303 3304 * Will be 'acc_construct_parallel' for all OpenACC compute 3305 constructs as well as many OpenACC Runtime API calls; should 3306 be the one matching the actual construct, or 3307 'acc_construct_runtime_api', respectively. 3308 3309 * Will be 'acc_construct_enter_data' or 3310 'acc_construct_exit_data' when processing variable mappings 3311 specified in OpenACC _declare_ directives; should be 3312 'acc_construct_declare'. 3313 3314 * For implicit 'acc_ev_device_init_start', 3315 'acc_ev_device_init_end', and explicit as well as implicit 3316 'acc_ev_alloc', 'acc_ev_free', 'acc_ev_enqueue_upload_start', 3317 'acc_ev_enqueue_upload_end', 'acc_ev_enqueue_download_start', 3318 and 'acc_ev_enqueue_download_end', will be 3319 'acc_construct_parallel'; should reflect the real parent 3320 construct. 3321 3322'acc_event_info.*.implicit' 3323 For 'acc_ev_alloc', 'acc_ev_free', 'acc_ev_enqueue_upload_start', 3324 'acc_ev_enqueue_upload_end', 'acc_ev_enqueue_download_start', and 3325 'acc_ev_enqueue_download_end', this currently will be '1' also for 3326 explicit usage. 3327 3328'acc_event_info.data_event.var_name' 3329 Always 'NULL'; not yet implemented. 3330 3331'acc_event_info.data_event.host_ptr' 3332 For 'acc_ev_alloc', and 'acc_ev_free', this is always 'NULL'. 3333 3334'typedef union acc_api_info' 3335 ... as printed in '5.2.3. Third Argument: API-Specific 3336 Information'. This should obviously be 'typedef _struct_ 3337 acc_api_info'. 3338 3339'acc_api_info.device_api' 3340 Possibly not yet implemented correctly for 3341 'acc_ev_compute_construct_start', 'acc_ev_device_init_start', 3342 'acc_ev_device_init_end': will always be 'acc_device_api_none' for 3343 these event types. For 'acc_ev_enter_data_start', it will be 3344 'acc_device_api_none' in some cases. 3345 3346'acc_api_info.device_type' 3347 Always the same as 'acc_prof_info.device_type'. 3348 3349'acc_api_info.vendor' 3350 Always '-1'; not yet implemented. 3351 3352'acc_api_info.device_handle' 3353 Always 'NULL'; not yet implemented. 3354 3355'acc_api_info.context_handle' 3356 Always 'NULL'; not yet implemented. 3357 3358'acc_api_info.async_handle' 3359 Always 'NULL'; not yet implemented. 3360 3361 Remarks about certain event types: 3362 3363'acc_ev_device_init_start', 'acc_ev_device_init_end' 3364 3365 * Whan a compute construct triggers implicit 3366 'acc_ev_device_init_start' and 'acc_ev_device_init_end' 3367 events, they currently aren't _nested within_ the 3368 corresponding 'acc_ev_compute_construct_start' and 3369 'acc_ev_compute_construct_end', but they're currently observed 3370 _before_ 'acc_ev_compute_construct_start'. It's not clear 3371 what to do: the standard asks us provide a lot of details to 3372 the 'acc_ev_compute_construct_start' callback, without 3373 (implicitly) initializing a device before? 3374 3375 * Callbacks for these event types will not be invoked for calls 3376 to the 'acc_set_device_type' and 'acc_set_device_num' 3377 functions. It's not clear if they should be. 3378 3379'acc_ev_enter_data_start', 'acc_ev_enter_data_end', 'acc_ev_exit_data_start', 'acc_ev_exit_data_end' 3380 3381 * Callbacks for these event types will also be invoked for 3382 OpenACC _host_data_ constructs. It's not clear if they should 3383 be. 3384 3385 * Callbacks for these event types will also be invoked when 3386 processing variable mappings specified in OpenACC _declare_ 3387 directives. It's not clear if they should be. 3388 3389 Callbacks for the following event types will be invoked, but dispatch 3390and information provided therein has not yet been thoroughly reviewed: 3391 3392 * 'acc_ev_alloc' 3393 * 'acc_ev_free' 3394 * 'acc_ev_update_start', 'acc_ev_update_end' 3395 * 'acc_ev_enqueue_upload_start', 'acc_ev_enqueue_upload_end' 3396 * 'acc_ev_enqueue_download_start', 'acc_ev_enqueue_download_end' 3397 3398 During device initialization, and finalization, respectively, 3399callbacks for the following event types will not yet be invoked: 3400 3401 * 'acc_ev_alloc' 3402 * 'acc_ev_free' 3403 3404 Callbacks for the following event types have not yet been 3405implemented, so currently won't be invoked: 3406 3407 * 'acc_ev_device_shutdown_start', 'acc_ev_device_shutdown_end' 3408 * 'acc_ev_runtime_shutdown' 3409 * 'acc_ev_create', 'acc_ev_delete' 3410 * 'acc_ev_wait_start', 'acc_ev_wait_end' 3411 3412 For the following runtime library functions, not all expected 3413callbacks will be invoked (mostly concerning implicit device 3414initialization): 3415 3416 * 'acc_get_num_devices' 3417 * 'acc_set_device_type' 3418 * 'acc_get_device_type' 3419 * 'acc_set_device_num' 3420 * 'acc_get_device_num' 3421 * 'acc_init' 3422 * 'acc_shutdown' 3423 3424 Aside from implicit device initialization, for the following runtime 3425library functions, no callbacks will be invoked for shared-memory 3426offloading devices (it's not clear if they should be): 3427 3428 * 'acc_malloc' 3429 * 'acc_free' 3430 * 'acc_copyin', 'acc_present_or_copyin', 'acc_copyin_async' 3431 * 'acc_create', 'acc_present_or_create', 'acc_create_async' 3432 * 'acc_copyout', 'acc_copyout_async', 'acc_copyout_finalize', 3433 'acc_copyout_finalize_async' 3434 * 'acc_delete', 'acc_delete_async', 'acc_delete_finalize', 3435 'acc_delete_finalize_async' 3436 * 'acc_update_device', 'acc_update_device_async' 3437 * 'acc_update_self', 'acc_update_self_async' 3438 * 'acc_map_data', 'acc_unmap_data' 3439 * 'acc_memcpy_to_device', 'acc_memcpy_to_device_async' 3440 * 'acc_memcpy_from_device', 'acc_memcpy_from_device_async' 3441 3442 3443File: libgomp.info, Node: The libgomp ABI, Next: Reporting Bugs, Prev: OpenACC Profiling Interface, Up: Top 3444 344510 The libgomp ABI 3446****************** 3447 3448The following sections present notes on the external ABI as presented by 3449libgomp. Only maintainers should need them. 3450 3451* Menu: 3452 3453* Implementing MASTER construct:: 3454* Implementing CRITICAL construct:: 3455* Implementing ATOMIC construct:: 3456* Implementing FLUSH construct:: 3457* Implementing BARRIER construct:: 3458* Implementing THREADPRIVATE construct:: 3459* Implementing PRIVATE clause:: 3460* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses:: 3461* Implementing REDUCTION clause:: 3462* Implementing PARALLEL construct:: 3463* Implementing FOR construct:: 3464* Implementing ORDERED construct:: 3465* Implementing SECTIONS construct:: 3466* Implementing SINGLE construct:: 3467* Implementing OpenACC's PARALLEL construct:: 3468 3469 3470File: libgomp.info, Node: Implementing MASTER construct, Next: Implementing CRITICAL construct, Up: The libgomp ABI 3471 347210.1 Implementing MASTER construct 3473================================== 3474 3475 if (omp_get_thread_num () == 0) 3476 block 3477 3478 Alternately, we generate two copies of the parallel subfunction and 3479only include this in the version run by the master thread. Surely this 3480is not worthwhile though... 3481 3482 3483File: libgomp.info, Node: Implementing CRITICAL construct, Next: Implementing ATOMIC construct, Prev: Implementing MASTER construct, Up: The libgomp ABI 3484 348510.2 Implementing CRITICAL construct 3486==================================== 3487 3488Without a specified name, 3489 3490 void GOMP_critical_start (void); 3491 void GOMP_critical_end (void); 3492 3493 so that we don't get COPY relocations from libgomp to the main 3494application. 3495 3496 With a specified name, use omp_set_lock and omp_unset_lock with name 3497being transformed into a variable declared like 3498 3499 omp_lock_t gomp_critical_user_<name> __attribute__((common)) 3500 3501 Ideally the ABI would specify that all zero is a valid unlocked 3502state, and so we wouldn't need to initialize this at startup. 3503 3504 3505File: libgomp.info, Node: Implementing ATOMIC construct, Next: Implementing FLUSH construct, Prev: Implementing CRITICAL construct, Up: The libgomp ABI 3506 350710.3 Implementing ATOMIC construct 3508================================== 3509 3510The target should implement the '__sync' builtins. 3511 3512 Failing that we could add 3513 3514 void GOMP_atomic_enter (void) 3515 void GOMP_atomic_exit (void) 3516 3517 which reuses the regular lock code, but with yet another lock object 3518private to the library. 3519 3520 3521File: libgomp.info, Node: Implementing FLUSH construct, Next: Implementing BARRIER construct, Prev: Implementing ATOMIC construct, Up: The libgomp ABI 3522 352310.4 Implementing FLUSH construct 3524================================= 3525 3526Expands to the '__sync_synchronize' builtin. 3527 3528 3529File: libgomp.info, Node: Implementing BARRIER construct, Next: Implementing THREADPRIVATE construct, Prev: Implementing FLUSH construct, Up: The libgomp ABI 3530 353110.5 Implementing BARRIER construct 3532=================================== 3533 3534 void GOMP_barrier (void) 3535 3536 3537File: libgomp.info, Node: Implementing THREADPRIVATE construct, Next: Implementing PRIVATE clause, Prev: Implementing BARRIER construct, Up: The libgomp ABI 3538 353910.6 Implementing THREADPRIVATE construct 3540========================================= 3541 3542In _most_ cases we can map this directly to '__thread'. Except that OMP 3543allows constructors for C++ objects. We can either refuse to support 3544this (how often is it used?) or we can implement something akin to 3545.ctors. 3546 3547 Even more ideally, this ctor feature is handled by extensions to the 3548main pthreads library. Failing that, we can have a set of entry points 3549to register ctor functions to be called. 3550 3551 3552File: libgomp.info, Node: Implementing PRIVATE clause, Next: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses, Prev: Implementing THREADPRIVATE construct, Up: The libgomp ABI 3553 355410.7 Implementing PRIVATE clause 3555================================ 3556 3557In association with a PARALLEL, or within the lexical extent of a 3558PARALLEL block, the variable becomes a local variable in the parallel 3559subfunction. 3560 3561 In association with FOR or SECTIONS blocks, create a new automatic 3562variable within the current function. This preserves the semantic of 3563new variable creation. 3564 3565 3566File: libgomp.info, Node: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses, Next: Implementing REDUCTION clause, Prev: Implementing PRIVATE clause, Up: The libgomp ABI 3567 356810.8 Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses 3569========================================================================= 3570 3571This seems simple enough for PARALLEL blocks. Create a private struct 3572for communicating between the parent and subfunction. In the parent, 3573copy in values for scalar and "small" structs; copy in addresses for 3574others TREE_ADDRESSABLE types. In the subfunction, copy the value into 3575the local variable. 3576 3577 It is not clear what to do with bare FOR or SECTION blocks. The only 3578thing I can figure is that we do something like: 3579 3580 #pragma omp for firstprivate(x) lastprivate(y) 3581 for (int i = 0; i < n; ++i) 3582 body; 3583 3584 which becomes 3585 3586 { 3587 int x = x, y; 3588 3589 // for stuff 3590 3591 if (i == n) 3592 y = y; 3593 } 3594 3595 where the "x=x" and "y=y" assignments actually have different uids 3596for the two variables, i.e. not something you could write directly in 3597C. Presumably this only makes sense if the "outer" x and y are global 3598variables. 3599 3600 COPYPRIVATE would work the same way, except the structure broadcast 3601would have to happen via SINGLE machinery instead. 3602 3603 3604File: libgomp.info, Node: Implementing REDUCTION clause, Next: Implementing PARALLEL construct, Prev: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses, Up: The libgomp ABI 3605 360610.9 Implementing REDUCTION clause 3607================================== 3608 3609The private struct mentioned in the previous section should have a 3610pointer to an array of the type of the variable, indexed by the thread's 3611TEAM_ID. The thread stores its final value into the array, and after 3612the barrier, the master thread iterates over the array to collect the 3613values. 3614 3615 3616File: libgomp.info, Node: Implementing PARALLEL construct, Next: Implementing FOR construct, Prev: Implementing REDUCTION clause, Up: The libgomp ABI 3617 361810.10 Implementing PARALLEL construct 3619===================================== 3620 3621 #pragma omp parallel 3622 { 3623 body; 3624 } 3625 3626 becomes 3627 3628 void subfunction (void *data) 3629 { 3630 use data; 3631 body; 3632 } 3633 3634 setup data; 3635 GOMP_parallel_start (subfunction, &data, num_threads); 3636 subfunction (&data); 3637 GOMP_parallel_end (); 3638 3639 void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads) 3640 3641 The FN argument is the subfunction to be run in parallel. 3642 3643 The DATA argument is a pointer to a structure used to communicate 3644data in and out of the subfunction, as discussed above with respect to 3645FIRSTPRIVATE et al. 3646 3647 The NUM_THREADS argument is 1 if an IF clause is present and false, 3648or the value of the NUM_THREADS clause, if present, or 0. 3649 3650 The function needs to create the appropriate number of threads and/or 3651launch them from the dock. It needs to create the team structure and 3652assign team ids. 3653 3654 void GOMP_parallel_end (void) 3655 3656 Tears down the team and returns us to the previous 3657'omp_in_parallel()' state. 3658 3659 3660File: libgomp.info, Node: Implementing FOR construct, Next: Implementing ORDERED construct, Prev: Implementing PARALLEL construct, Up: The libgomp ABI 3661 366210.11 Implementing FOR construct 3663================================ 3664 3665 #pragma omp parallel for 3666 for (i = lb; i <= ub; i++) 3667 body; 3668 3669 becomes 3670 3671 void subfunction (void *data) 3672 { 3673 long _s0, _e0; 3674 while (GOMP_loop_static_next (&_s0, &_e0)) 3675 { 3676 long _e1 = _e0, i; 3677 for (i = _s0; i < _e1; i++) 3678 body; 3679 } 3680 GOMP_loop_end_nowait (); 3681 } 3682 3683 GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0); 3684 subfunction (NULL); 3685 GOMP_parallel_end (); 3686 3687 #pragma omp for schedule(runtime) 3688 for (i = 0; i < n; i++) 3689 body; 3690 3691 becomes 3692 3693 { 3694 long i, _s0, _e0; 3695 if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0)) 3696 do { 3697 long _e1 = _e0; 3698 for (i = _s0, i < _e0; i++) 3699 body; 3700 } while (GOMP_loop_runtime_next (&_s0, _&e0)); 3701 GOMP_loop_end (); 3702 } 3703 3704 Note that while it looks like there is trickiness to propagating a 3705non-constant STEP, there isn't really. We're explicitly allowed to 3706evaluate it as many times as we want, and any variables involved should 3707automatically be handled as PRIVATE or SHARED like any other variables. 3708So the expression should remain evaluable in the subfunction. We can 3709also pull it into a local variable if we like, but since its supposed to 3710remain unchanged, we can also not if we like. 3711 3712 If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be able 3713to get away with no work-sharing context at all, since we can simply 3714perform the arithmetic directly in each thread to divide up the 3715iterations. Which would mean that we wouldn't need to call any of these 3716routines. 3717 3718 There are separate routines for handling loops with an ORDERED 3719clause. Bookkeeping for that is non-trivial... 3720 3721 3722File: libgomp.info, Node: Implementing ORDERED construct, Next: Implementing SECTIONS construct, Prev: Implementing FOR construct, Up: The libgomp ABI 3723 372410.12 Implementing ORDERED construct 3725==================================== 3726 3727 void GOMP_ordered_start (void) 3728 void GOMP_ordered_end (void) 3729 3730 3731File: libgomp.info, Node: Implementing SECTIONS construct, Next: Implementing SINGLE construct, Prev: Implementing ORDERED construct, Up: The libgomp ABI 3732 373310.13 Implementing SECTIONS construct 3734===================================== 3735 3736A block as 3737 3738 #pragma omp sections 3739 { 3740 #pragma omp section 3741 stmt1; 3742 #pragma omp section 3743 stmt2; 3744 #pragma omp section 3745 stmt3; 3746 } 3747 3748 becomes 3749 3750 for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ()) 3751 switch (i) 3752 { 3753 case 1: 3754 stmt1; 3755 break; 3756 case 2: 3757 stmt2; 3758 break; 3759 case 3: 3760 stmt3; 3761 break; 3762 } 3763 GOMP_barrier (); 3764 3765 3766File: libgomp.info, Node: Implementing SINGLE construct, Next: Implementing OpenACC's PARALLEL construct, Prev: Implementing SECTIONS construct, Up: The libgomp ABI 3767 376810.14 Implementing SINGLE construct 3769=================================== 3770 3771A block like 3772 3773 #pragma omp single 3774 { 3775 body; 3776 } 3777 3778 becomes 3779 3780 if (GOMP_single_start ()) 3781 body; 3782 GOMP_barrier (); 3783 3784 while 3785 3786 #pragma omp single copyprivate(x) 3787 body; 3788 3789 becomes 3790 3791 datap = GOMP_single_copy_start (); 3792 if (datap == NULL) 3793 { 3794 body; 3795 data.x = x; 3796 GOMP_single_copy_end (&data); 3797 } 3798 else 3799 x = datap->x; 3800 GOMP_barrier (); 3801 3802 3803File: libgomp.info, Node: Implementing OpenACC's PARALLEL construct, Prev: Implementing SINGLE construct, Up: The libgomp ABI 3804 380510.15 Implementing OpenACC's PARALLEL construct 3806=============================================== 3807 3808 void GOACC_parallel () 3809 3810 3811File: libgomp.info, Node: Reporting Bugs, Next: Copying, Prev: The libgomp ABI, Up: Top 3812 381311 Reporting Bugs 3814***************** 3815 3816Bugs in the GNU Offloading and Multi Processing Runtime Library should 3817be reported via Bugzilla (https://gcc.gnu.org/bugzilla/). Please add 3818"openacc", or "openmp", or both to the keywords field in the bug report, 3819as appropriate. 3820 3821 3822File: libgomp.info, Node: Copying, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top 3823 3824GNU General Public License 3825************************** 3826 3827 Version 3, 29 June 2007 3828 3829 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> 3830 3831 Everyone is permitted to copy and distribute verbatim copies of this 3832 license document, but changing it is not allowed. 3833 3834Preamble 3835======== 3836 3837The GNU General Public License is a free, copyleft license for software 3838and other kinds of works. 3839 3840 The licenses for most software and other practical works are designed 3841to take away your freedom to share and change the works. By contrast, 3842the GNU General Public License is intended to guarantee your freedom to 3843share and change all versions of a program-to make sure it remains free 3844software for all its users. We, the Free Software Foundation, use the 3845GNU General Public License for most of our software; it applies also to 3846any other work released this way by its authors. You can apply it to 3847your programs, too. 3848 3849 When we speak of free software, we are referring to freedom, not 3850price. Our General Public Licenses are designed to make sure that you 3851have the freedom to distribute copies of free software (and charge for 3852them if you wish), that you receive source code or can get it if you 3853want it, that you can change the software or use pieces of it in new 3854free programs, and that you know you can do these things. 3855 3856 To protect your rights, we need to prevent others from denying you 3857these rights or asking you to surrender the rights. Therefore, you have 3858certain responsibilities if you distribute copies of the software, or if 3859you modify it: responsibilities to respect the freedom of others. 3860 3861 For example, if you distribute copies of such a program, whether 3862gratis or for a fee, you must pass on to the recipients the same 3863freedoms that you received. You must make sure that they, too, receive 3864or can get the source code. And you must show them these terms so they 3865know their rights. 3866 3867 Developers that use the GNU GPL protect your rights with two steps: 3868(1) assert copyright on the software, and (2) offer you this License 3869giving you legal permission to copy, distribute and/or modify it. 3870 3871 For the developers' and authors' protection, the GPL clearly explains 3872that there is no warranty for this free software. For both users' and 3873authors' sake, the GPL requires that modified versions be marked as 3874changed, so that their problems will not be attributed erroneously to 3875authors of previous versions. 3876 3877 Some devices are designed to deny users access to install or run 3878modified versions of the software inside them, although the manufacturer 3879can do so. This is fundamentally incompatible with the aim of 3880protecting users' freedom to change the software. The systematic 3881pattern of such abuse occurs in the area of products for individuals to 3882use, which is precisely where it is most unacceptable. Therefore, we 3883have designed this version of the GPL to prohibit the practice for those 3884products. If such problems arise substantially in other domains, we 3885stand ready to extend this provision to those domains in future versions 3886of the GPL, as needed to protect the freedom of users. 3887 3888 Finally, every program is threatened constantly by software patents. 3889States should not allow patents to restrict development and use of 3890software on general-purpose computers, but in those that do, we wish to 3891avoid the special danger that patents applied to a free program could 3892make it effectively proprietary. To prevent this, the GPL assures that 3893patents cannot be used to render the program non-free. 3894 3895 The precise terms and conditions for copying, distribution and 3896modification follow. 3897 3898TERMS AND CONDITIONS 3899==================== 3900 3901 0. Definitions. 3902 3903 "This License" refers to version 3 of the GNU General Public 3904 License. 3905 3906 "Copyright" also means copyright-like laws that apply to other 3907 kinds of works, such as semiconductor masks. 3908 3909 "The Program" refers to any copyrightable work licensed under this 3910 License. Each licensee is addressed as "you". "Licensees" and 3911 "recipients" may be individuals or organizations. 3912 3913 To "modify" a work means to copy from or adapt all or part of the 3914 work in a fashion requiring copyright permission, other than the 3915 making of an exact copy. The resulting work is called a "modified 3916 version" of the earlier work or a work "based on" the earlier work. 3917 3918 A "covered work" means either the unmodified Program or a work 3919 based on the Program. 3920 3921 To "propagate" a work means to do anything with it that, without 3922 permission, would make you directly or secondarily liable for 3923 infringement under applicable copyright law, except executing it on 3924 a computer or modifying a private copy. Propagation includes 3925 copying, distribution (with or without modification), making 3926 available to the public, and in some countries other activities as 3927 well. 3928 3929 To "convey" a work means any kind of propagation that enables other 3930 parties to make or receive copies. Mere interaction with a user 3931 through a computer network, with no transfer of a copy, is not 3932 conveying. 3933 3934 An interactive user interface displays "Appropriate Legal Notices" 3935 to the extent that it includes a convenient and prominently visible 3936 feature that (1) displays an appropriate copyright notice, and (2) 3937 tells the user that there is no warranty for the work (except to 3938 the extent that warranties are provided), that licensees may convey 3939 the work under this License, and how to view a copy of this 3940 License. If the interface presents a list of user commands or 3941 options, such as a menu, a prominent item in the list meets this 3942 criterion. 3943 3944 1. Source Code. 3945 3946 The "source code" for a work means the preferred form of the work 3947 for making modifications to it. "Object code" means any non-source 3948 form of a work. 3949 3950 A "Standard Interface" means an interface that either is an 3951 official standard defined by a recognized standards body, or, in 3952 the case of interfaces specified for a particular programming 3953 language, one that is widely used among developers working in that 3954 language. 3955 3956 The "System Libraries" of an executable work include anything, 3957 other than the work as a whole, that (a) is included in the normal 3958 form of packaging a Major Component, but which is not part of that 3959 Major Component, and (b) serves only to enable use of the work with 3960 that Major Component, or to implement a Standard Interface for 3961 which an implementation is available to the public in source code 3962 form. A "Major Component", in this context, means a major 3963 essential component (kernel, window system, and so on) of the 3964 specific operating system (if any) on which the executable work 3965 runs, or a compiler used to produce the work, or an object code 3966 interpreter used to run it. 3967 3968 The "Corresponding Source" for a work in object code form means all 3969 the source code needed to generate, install, and (for an executable 3970 work) run the object code and to modify the work, including scripts 3971 to control those activities. However, it does not include the 3972 work's System Libraries, or general-purpose tools or generally 3973 available free programs which are used unmodified in performing 3974 those activities but which are not part of the work. For example, 3975 Corresponding Source includes interface definition files associated 3976 with source files for the work, and the source code for shared 3977 libraries and dynamically linked subprograms that the work is 3978 specifically designed to require, such as by intimate data 3979 communication or control flow between those subprograms and other 3980 parts of the work. 3981 3982 The Corresponding Source need not include anything that users can 3983 regenerate automatically from other parts of the Corresponding 3984 Source. 3985 3986 The Corresponding Source for a work in source code form is that 3987 same work. 3988 3989 2. Basic Permissions. 3990 3991 All rights granted under this License are granted for the term of 3992 copyright on the Program, and are irrevocable provided the stated 3993 conditions are met. This License explicitly affirms your unlimited 3994 permission to run the unmodified Program. The output from running 3995 a covered work is covered by this License only if the output, given 3996 its content, constitutes a covered work. This License acknowledges 3997 your rights of fair use or other equivalent, as provided by 3998 copyright law. 3999 4000 You may make, run and propagate covered works that you do not 4001 convey, without conditions so long as your license otherwise 4002 remains in force. You may convey covered works to others for the 4003 sole purpose of having them make modifications exclusively for you, 4004 or provide you with facilities for running those works, provided 4005 that you comply with the terms of this License in conveying all 4006 material for which you do not control copyright. Those thus making 4007 or running the covered works for you must do so exclusively on your 4008 behalf, under your direction and control, on terms that prohibit 4009 them from making any copies of your copyrighted material outside 4010 their relationship with you. 4011 4012 Conveying under any other circumstances is permitted solely under 4013 the conditions stated below. Sublicensing is not allowed; section 4014 10 makes it unnecessary. 4015 4016 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 4017 4018 No covered work shall be deemed part of an effective technological 4019 measure under any applicable law fulfilling obligations under 4020 article 11 of the WIPO copyright treaty adopted on 20 December 4021 1996, or similar laws prohibiting or restricting circumvention of 4022 such measures. 4023 4024 When you convey a covered work, you waive any legal power to forbid 4025 circumvention of technological measures to the extent such 4026 circumvention is effected by exercising rights under this License 4027 with respect to the covered work, and you disclaim any intention to 4028 limit operation or modification of the work as a means of 4029 enforcing, against the work's users, your or third parties' legal 4030 rights to forbid circumvention of technological measures. 4031 4032 4. Conveying Verbatim Copies. 4033 4034 You may convey verbatim copies of the Program's source code as you 4035 receive it, in any medium, provided that you conspicuously and 4036 appropriately publish on each copy an appropriate copyright notice; 4037 keep intact all notices stating that this License and any 4038 non-permissive terms added in accord with section 7 apply to the 4039 code; keep intact all notices of the absence of any warranty; and 4040 give all recipients a copy of this License along with the Program. 4041 4042 You may charge any price or no price for each copy that you convey, 4043 and you may offer support or warranty protection for a fee. 4044 4045 5. Conveying Modified Source Versions. 4046 4047 You may convey a work based on the Program, or the modifications to 4048 produce it from the Program, in the form of source code under the 4049 terms of section 4, provided that you also meet all of these 4050 conditions: 4051 4052 a. The work must carry prominent notices stating that you 4053 modified it, and giving a relevant date. 4054 4055 b. The work must carry prominent notices stating that it is 4056 released under this License and any conditions added under 4057 section 7. This requirement modifies the requirement in 4058 section 4 to "keep intact all notices". 4059 4060 c. You must license the entire work, as a whole, under this 4061 License to anyone who comes into possession of a copy. This 4062 License will therefore apply, along with any applicable 4063 section 7 additional terms, to the whole of the work, and all 4064 its parts, regardless of how they are packaged. This License 4065 gives no permission to license the work in any other way, but 4066 it does not invalidate such permission if you have separately 4067 received it. 4068 4069 d. If the work has interactive user interfaces, each must display 4070 Appropriate Legal Notices; however, if the Program has 4071 interactive interfaces that do not display Appropriate Legal 4072 Notices, your work need not make them do so. 4073 4074 A compilation of a covered work with other separate and independent 4075 works, which are not by their nature extensions of the covered 4076 work, and which are not combined with it such as to form a larger 4077 program, in or on a volume of a storage or distribution medium, is 4078 called an "aggregate" if the compilation and its resulting 4079 copyright are not used to limit the access or legal rights of the 4080 compilation's users beyond what the individual works permit. 4081 Inclusion of a covered work in an aggregate does not cause this 4082 License to apply to the other parts of the aggregate. 4083 4084 6. Conveying Non-Source Forms. 4085 4086 You may convey a covered work in object code form under the terms 4087 of sections 4 and 5, provided that you also convey the 4088 machine-readable Corresponding Source under the terms of this 4089 License, in one of these ways: 4090 4091 a. Convey the object code in, or embodied in, a physical product 4092 (including a physical distribution medium), accompanied by the 4093 Corresponding Source fixed on a durable physical medium 4094 customarily used for software interchange. 4095 4096 b. Convey the object code in, or embodied in, a physical product 4097 (including a physical distribution medium), accompanied by a 4098 written offer, valid for at least three years and valid for as 4099 long as you offer spare parts or customer support for that 4100 product model, to give anyone who possesses the object code 4101 either (1) a copy of the Corresponding Source for all the 4102 software in the product that is covered by this License, on a 4103 durable physical medium customarily used for software 4104 interchange, for a price no more than your reasonable cost of 4105 physically performing this conveying of source, or (2) access 4106 to copy the Corresponding Source from a network server at no 4107 charge. 4108 4109 c. Convey individual copies of the object code with a copy of the 4110 written offer to provide the Corresponding Source. This 4111 alternative is allowed only occasionally and noncommercially, 4112 and only if you received the object code with such an offer, 4113 in accord with subsection 6b. 4114 4115 d. Convey the object code by offering access from a designated 4116 place (gratis or for a charge), and offer equivalent access to 4117 the Corresponding Source in the same way through the same 4118 place at no further charge. You need not require recipients 4119 to copy the Corresponding Source along with the object code. 4120 If the place to copy the object code is a network server, the 4121 Corresponding Source may be on a different server (operated by 4122 you or a third party) that supports equivalent copying 4123 facilities, provided you maintain clear directions next to the 4124 object code saying where to find the Corresponding Source. 4125 Regardless of what server hosts the Corresponding Source, you 4126 remain obligated to ensure that it is available for as long as 4127 needed to satisfy these requirements. 4128 4129 e. Convey the object code using peer-to-peer transmission, 4130 provided you inform other peers where the object code and 4131 Corresponding Source of the work are being offered to the 4132 general public at no charge under subsection 6d. 4133 4134 A separable portion of the object code, whose source code is 4135 excluded from the Corresponding Source as a System Library, need 4136 not be included in conveying the object code work. 4137 4138 A "User Product" is either (1) a "consumer product", which means 4139 any tangible personal property which is normally used for personal, 4140 family, or household purposes, or (2) anything designed or sold for 4141 incorporation into a dwelling. In determining whether a product is 4142 a consumer product, doubtful cases shall be resolved in favor of 4143 coverage. For a particular product received by a particular user, 4144 "normally used" refers to a typical or common use of that class of 4145 product, regardless of the status of the particular user or of the 4146 way in which the particular user actually uses, or expects or is 4147 expected to use, the product. A product is a consumer product 4148 regardless of whether the product has substantial commercial, 4149 industrial or non-consumer uses, unless such uses represent the 4150 only significant mode of use of the product. 4151 4152 "Installation Information" for a User Product means any methods, 4153 procedures, authorization keys, or other information required to 4154 install and execute modified versions of a covered work in that 4155 User Product from a modified version of its Corresponding Source. 4156 The information must suffice to ensure that the continued 4157 functioning of the modified object code is in no case prevented or 4158 interfered with solely because modification has been made. 4159 4160 If you convey an object code work under this section in, or with, 4161 or specifically for use in, a User Product, and the conveying 4162 occurs as part of a transaction in which the right of possession 4163 and use of the User Product is transferred to the recipient in 4164 perpetuity or for a fixed term (regardless of how the transaction 4165 is characterized), the Corresponding Source conveyed under this 4166 section must be accompanied by the Installation Information. But 4167 this requirement does not apply if neither you nor any third party 4168 retains the ability to install modified object code on the User 4169 Product (for example, the work has been installed in ROM). 4170 4171 The requirement to provide Installation Information does not 4172 include a requirement to continue to provide support service, 4173 warranty, or updates for a work that has been modified or installed 4174 by the recipient, or for the User Product in which it has been 4175 modified or installed. Access to a network may be denied when the 4176 modification itself materially and adversely affects the operation 4177 of the network or violates the rules and protocols for 4178 communication across the network. 4179 4180 Corresponding Source conveyed, and Installation Information 4181 provided, in accord with this section must be in a format that is 4182 publicly documented (and with an implementation available to the 4183 public in source code form), and must require no special password 4184 or key for unpacking, reading or copying. 4185 4186 7. Additional Terms. 4187 4188 "Additional permissions" are terms that supplement the terms of 4189 this License by making exceptions from one or more of its 4190 conditions. Additional permissions that are applicable to the 4191 entire Program shall be treated as though they were included in 4192 this License, to the extent that they are valid under applicable 4193 law. If additional permissions apply only to part of the Program, 4194 that part may be used separately under those permissions, but the 4195 entire Program remains governed by this License without regard to 4196 the additional permissions. 4197 4198 When you convey a copy of a covered work, you may at your option 4199 remove any additional permissions from that copy, or from any part 4200 of it. (Additional permissions may be written to require their own 4201 removal in certain cases when you modify the work.) You may place 4202 additional permissions on material, added by you to a covered work, 4203 for which you have or can give appropriate copyright permission. 4204 4205 Notwithstanding any other provision of this License, for material 4206 you add to a covered work, you may (if authorized by the copyright 4207 holders of that material) supplement the terms of this License with 4208 terms: 4209 4210 a. Disclaiming warranty or limiting liability differently from 4211 the terms of sections 15 and 16 of this License; or 4212 4213 b. Requiring preservation of specified reasonable legal notices 4214 or author attributions in that material or in the Appropriate 4215 Legal Notices displayed by works containing it; or 4216 4217 c. Prohibiting misrepresentation of the origin of that material, 4218 or requiring that modified versions of such material be marked 4219 in reasonable ways as different from the original version; or 4220 4221 d. Limiting the use for publicity purposes of names of licensors 4222 or authors of the material; or 4223 4224 e. Declining to grant rights under trademark law for use of some 4225 trade names, trademarks, or service marks; or 4226 4227 f. Requiring indemnification of licensors and authors of that 4228 material by anyone who conveys the material (or modified 4229 versions of it) with contractual assumptions of liability to 4230 the recipient, for any liability that these contractual 4231 assumptions directly impose on those licensors and authors. 4232 4233 All other non-permissive additional terms are considered "further 4234 restrictions" within the meaning of section 10. If the Program as 4235 you received it, or any part of it, contains a notice stating that 4236 it is governed by this License along with a term that is a further 4237 restriction, you may remove that term. If a license document 4238 contains a further restriction but permits relicensing or conveying 4239 under this License, you may add to a covered work material governed 4240 by the terms of that license document, provided that the further 4241 restriction does not survive such relicensing or conveying. 4242 4243 If you add terms to a covered work in accord with this section, you 4244 must place, in the relevant source files, a statement of the 4245 additional terms that apply to those files, or a notice indicating 4246 where to find the applicable terms. 4247 4248 Additional terms, permissive or non-permissive, may be stated in 4249 the form of a separately written license, or stated as exceptions; 4250 the above requirements apply either way. 4251 4252 8. Termination. 4253 4254 You may not propagate or modify a covered work except as expressly 4255 provided under this License. Any attempt otherwise to propagate or 4256 modify it is void, and will automatically terminate your rights 4257 under this License (including any patent licenses granted under the 4258 third paragraph of section 11). 4259 4260 However, if you cease all violation of this License, then your 4261 license from a particular copyright holder is reinstated (a) 4262 provisionally, unless and until the copyright holder explicitly and 4263 finally terminates your license, and (b) permanently, if the 4264 copyright holder fails to notify you of the violation by some 4265 reasonable means prior to 60 days after the cessation. 4266 4267 Moreover, your license from a particular copyright holder is 4268 reinstated permanently if the copyright holder notifies you of the 4269 violation by some reasonable means, this is the first time you have 4270 received notice of violation of this License (for any work) from 4271 that copyright holder, and you cure the violation prior to 30 days 4272 after your receipt of the notice. 4273 4274 Termination of your rights under this section does not terminate 4275 the licenses of parties who have received copies or rights from you 4276 under this License. If your rights have been terminated and not 4277 permanently reinstated, you do not qualify to receive new licenses 4278 for the same material under section 10. 4279 4280 9. Acceptance Not Required for Having Copies. 4281 4282 You are not required to accept this License in order to receive or 4283 run a copy of the Program. Ancillary propagation of a covered work 4284 occurring solely as a consequence of using peer-to-peer 4285 transmission to receive a copy likewise does not require 4286 acceptance. However, nothing other than this License grants you 4287 permission to propagate or modify any covered work. These actions 4288 infringe copyright if you do not accept this License. Therefore, 4289 by modifying or propagating a covered work, you indicate your 4290 acceptance of this License to do so. 4291 4292 10. Automatic Licensing of Downstream Recipients. 4293 4294 Each time you convey a covered work, the recipient automatically 4295 receives a license from the original licensors, to run, modify and 4296 propagate that work, subject to this License. You are not 4297 responsible for enforcing compliance by third parties with this 4298 License. 4299 4300 An "entity transaction" is a transaction transferring control of an 4301 organization, or substantially all assets of one, or subdividing an 4302 organization, or merging organizations. If propagation of a 4303 covered work results from an entity transaction, each party to that 4304 transaction who receives a copy of the work also receives whatever 4305 licenses to the work the party's predecessor in interest had or 4306 could give under the previous paragraph, plus a right to possession 4307 of the Corresponding Source of the work from the predecessor in 4308 interest, if the predecessor has it or can get it with reasonable 4309 efforts. 4310 4311 You may not impose any further restrictions on the exercise of the 4312 rights granted or affirmed under this License. For example, you 4313 may not impose a license fee, royalty, or other charge for exercise 4314 of rights granted under this License, and you may not initiate 4315 litigation (including a cross-claim or counterclaim in a lawsuit) 4316 alleging that any patent claim is infringed by making, using, 4317 selling, offering for sale, or importing the Program or any portion 4318 of it. 4319 4320 11. Patents. 4321 4322 A "contributor" is a copyright holder who authorizes use under this 4323 License of the Program or a work on which the Program is based. 4324 The work thus licensed is called the contributor's "contributor 4325 version". 4326 4327 A contributor's "essential patent claims" are all patent claims 4328 owned or controlled by the contributor, whether already acquired or 4329 hereafter acquired, that would be infringed by some manner, 4330 permitted by this License, of making, using, or selling its 4331 contributor version, but do not include claims that would be 4332 infringed only as a consequence of further modification of the 4333 contributor version. For purposes of this definition, "control" 4334 includes the right to grant patent sublicenses in a manner 4335 consistent with the requirements of this License. 4336 4337 Each contributor grants you a non-exclusive, worldwide, 4338 royalty-free patent license under the contributor's essential 4339 patent claims, to make, use, sell, offer for sale, import and 4340 otherwise run, modify and propagate the contents of its contributor 4341 version. 4342 4343 In the following three paragraphs, a "patent license" is any 4344 express agreement or commitment, however denominated, not to 4345 enforce a patent (such as an express permission to practice a 4346 patent or covenant not to sue for patent infringement). To "grant" 4347 such a patent license to a party means to make such an agreement or 4348 commitment not to enforce a patent against the party. 4349 4350 If you convey a covered work, knowingly relying on a patent 4351 license, and the Corresponding Source of the work is not available 4352 for anyone to copy, free of charge and under the terms of this 4353 License, through a publicly available network server or other 4354 readily accessible means, then you must either (1) cause the 4355 Corresponding Source to be so available, or (2) arrange to deprive 4356 yourself of the benefit of the patent license for this particular 4357 work, or (3) arrange, in a manner consistent with the requirements 4358 of this License, to extend the patent license to downstream 4359 recipients. "Knowingly relying" means you have actual knowledge 4360 that, but for the patent license, your conveying the covered work 4361 in a country, or your recipient's use of the covered work in a 4362 country, would infringe one or more identifiable patents in that 4363 country that you have reason to believe are valid. 4364 4365 If, pursuant to or in connection with a single transaction or 4366 arrangement, you convey, or propagate by procuring conveyance of, a 4367 covered work, and grant a patent license to some of the parties 4368 receiving the covered work authorizing them to use, propagate, 4369 modify or convey a specific copy of the covered work, then the 4370 patent license you grant is automatically extended to all 4371 recipients of the covered work and works based on it. 4372 4373 A patent license is "discriminatory" if it does not include within 4374 the scope of its coverage, prohibits the exercise of, or is 4375 conditioned on the non-exercise of one or more of the rights that 4376 are specifically granted under this License. You may not convey a 4377 covered work if you are a party to an arrangement with a third 4378 party that is in the business of distributing software, under which 4379 you make payment to the third party based on the extent of your 4380 activity of conveying the work, and under which the third party 4381 grants, to any of the parties who would receive the covered work 4382 from you, a discriminatory patent license (a) in connection with 4383 copies of the covered work conveyed by you (or copies made from 4384 those copies), or (b) primarily for and in connection with specific 4385 products or compilations that contain the covered work, unless you 4386 entered into that arrangement, or that patent license was granted, 4387 prior to 28 March 2007. 4388 4389 Nothing in this License shall be construed as excluding or limiting 4390 any implied license or other defenses to infringement that may 4391 otherwise be available to you under applicable patent law. 4392 4393 12. No Surrender of Others' Freedom. 4394 4395 If conditions are imposed on you (whether by court order, agreement 4396 or otherwise) that contradict the conditions of this License, they 4397 do not excuse you from the conditions of this License. If you 4398 cannot convey a covered work so as to satisfy simultaneously your 4399 obligations under this License and any other pertinent obligations, 4400 then as a consequence you may not convey it at all. For example, 4401 if you agree to terms that obligate you to collect a royalty for 4402 further conveying from those to whom you convey the Program, the 4403 only way you could satisfy both those terms and this License would 4404 be to refrain entirely from conveying the Program. 4405 4406 13. Use with the GNU Affero General Public License. 4407 4408 Notwithstanding any other provision of this License, you have 4409 permission to link or combine any covered work with a work licensed 4410 under version 3 of the GNU Affero General Public License into a 4411 single combined work, and to convey the resulting work. The terms 4412 of this License will continue to apply to the part which is the 4413 covered work, but the special requirements of the GNU Affero 4414 General Public License, section 13, concerning interaction through 4415 a network will apply to the combination as such. 4416 4417 14. Revised Versions of this License. 4418 4419 The Free Software Foundation may publish revised and/or new 4420 versions of the GNU General Public License from time to time. Such 4421 new versions will be similar in spirit to the present version, but 4422 may differ in detail to address new problems or concerns. 4423 4424 Each version is given a distinguishing version number. If the 4425 Program specifies that a certain numbered version of the GNU 4426 General Public License "or any later version" applies to it, you 4427 have the option of following the terms and conditions either of 4428 that numbered version or of any later version published by the Free 4429 Software Foundation. If the Program does not specify a version 4430 number of the GNU General Public License, you may choose any 4431 version ever published by the Free Software Foundation. 4432 4433 If the Program specifies that a proxy can decide which future 4434 versions of the GNU General Public License can be used, that 4435 proxy's public statement of acceptance of a version permanently 4436 authorizes you to choose that version for the Program. 4437 4438 Later license versions may give you additional or different 4439 permissions. However, no additional obligations are imposed on any 4440 author or copyright holder as a result of your choosing to follow a 4441 later version. 4442 4443 15. Disclaimer of Warranty. 4444 4445 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 4446 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE 4447 COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" 4448 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 4449 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 4450 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE 4451 RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. 4452 SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL 4453 NECESSARY SERVICING, REPAIR OR CORRECTION. 4454 4455 16. Limitation of Liability. 4456 4457 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 4458 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES 4459 AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR 4460 DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 4461 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE 4462 THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA 4463 BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 4464 PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 4465 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF 4466 THE POSSIBILITY OF SUCH DAMAGES. 4467 4468 17. Interpretation of Sections 15 and 16. 4469 4470 If the disclaimer of warranty and limitation of liability provided 4471 above cannot be given local legal effect according to their terms, 4472 reviewing courts shall apply local law that most closely 4473 approximates an absolute waiver of all civil liability in 4474 connection with the Program, unless a warranty or assumption of 4475 liability accompanies a copy of the Program in return for a fee. 4476 4477END OF TERMS AND CONDITIONS 4478=========================== 4479 4480How to Apply These Terms to Your New Programs 4481============================================= 4482 4483If you develop a new program, and you want it to be of the greatest 4484possible use to the public, the best way to achieve this is to make it 4485free software which everyone can redistribute and change under these 4486terms. 4487 4488 To do so, attach the following notices to the program. It is safest 4489to attach them to the start of each source file to most effectively 4490state the exclusion of warranty; and each file should have at least the 4491"copyright" line and a pointer to where the full notice is found. 4492 4493 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. 4494 Copyright (C) YEAR NAME OF AUTHOR 4495 4496 This program is free software: you can redistribute it and/or modify 4497 it under the terms of the GNU General Public License as published by 4498 the Free Software Foundation, either version 3 of the License, or (at 4499 your option) any later version. 4500 4501 This program is distributed in the hope that it will be useful, but 4502 WITHOUT ANY WARRANTY; without even the implied warranty of 4503 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 4504 General Public License for more details. 4505 4506 You should have received a copy of the GNU General Public License 4507 along with this program. If not, see <http://www.gnu.org/licenses/>. 4508 4509 Also add information on how to contact you by electronic and paper 4510mail. 4511 4512 If the program does terminal interaction, make it output a short 4513notice like this when it starts in an interactive mode: 4514 4515 PROGRAM Copyright (C) YEAR NAME OF AUTHOR 4516 This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. 4517 This is free software, and you are welcome to redistribute it 4518 under certain conditions; type 'show c' for details. 4519 4520 The hypothetical commands 'show w' and 'show c' should show the 4521appropriate parts of the General Public License. Of course, your 4522program's commands might be different; for a GUI interface, you would 4523use an "about box". 4524 4525 You should also get your employer (if you work as a programmer) or 4526school, if any, to sign a "copyright disclaimer" for the program, if 4527necessary. For more information on this, and how to apply and follow 4528the GNU GPL, see <http://www.gnu.org/licenses/>. 4529 4530 The GNU General Public License does not permit incorporating your 4531program into proprietary programs. If your program is a subroutine 4532library, you may consider it more useful to permit linking proprietary 4533applications with the library. If this is what you want to do, use the 4534GNU Lesser General Public License instead of this License. But first, 4535please read <https://www.gnu.org/licenses/why-not-lgpl.html>. 4536 4537 4538File: libgomp.info, Node: GNU Free Documentation License, Next: Funding, Prev: Copying, Up: Top 4539 4540GNU Free Documentation License 4541****************************** 4542 4543 Version 1.3, 3 November 2008 4544 4545 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. 4546 <http://fsf.org/> 4547 4548 Everyone is permitted to copy and distribute verbatim copies 4549 of this license document, but changing it is not allowed. 4550 4551 0. PREAMBLE 4552 4553 The purpose of this License is to make a manual, textbook, or other 4554 functional and useful document "free" in the sense of freedom: to 4555 assure everyone the effective freedom to copy and redistribute it, 4556 with or without modifying it, either commercially or 4557 noncommercially. Secondarily, this License preserves for the 4558 author and publisher a way to get credit for their work, while not 4559 being considered responsible for modifications made by others. 4560 4561 This License is a kind of "copyleft", which means that derivative 4562 works of the document must themselves be free in the same sense. 4563 It complements the GNU General Public License, which is a copyleft 4564 license designed for free software. 4565 4566 We have designed this License in order to use it for manuals for 4567 free software, because free software needs free documentation: a 4568 free program should come with manuals providing the same freedoms 4569 that the software does. But this License is not limited to 4570 software manuals; it can be used for any textual work, regardless 4571 of subject matter or whether it is published as a printed book. We 4572 recommend this License principally for works whose purpose is 4573 instruction or reference. 4574 4575 1. APPLICABILITY AND DEFINITIONS 4576 4577 This License applies to any manual or other work, in any medium, 4578 that contains a notice placed by the copyright holder saying it can 4579 be distributed under the terms of this License. Such a notice 4580 grants a world-wide, royalty-free license, unlimited in duration, 4581 to use that work under the conditions stated herein. The 4582 "Document", below, refers to any such manual or work. Any member 4583 of the public is a licensee, and is addressed as "you". You accept 4584 the license if you copy, modify or distribute the work in a way 4585 requiring permission under copyright law. 4586 4587 A "Modified Version" of the Document means any work containing the 4588 Document or a portion of it, either copied verbatim, or with 4589 modifications and/or translated into another language. 4590 4591 A "Secondary Section" is a named appendix or a front-matter section 4592 of the Document that deals exclusively with the relationship of the 4593 publishers or authors of the Document to the Document's overall 4594 subject (or to related matters) and contains nothing that could 4595 fall directly within that overall subject. (Thus, if the Document 4596 is in part a textbook of mathematics, a Secondary Section may not 4597 explain any mathematics.) The relationship could be a matter of 4598 historical connection with the subject or with related matters, or 4599 of legal, commercial, philosophical, ethical or political position 4600 regarding them. 4601 4602 The "Invariant Sections" are certain Secondary Sections whose 4603 titles are designated, as being those of Invariant Sections, in the 4604 notice that says that the Document is released under this License. 4605 If a section does not fit the above definition of Secondary then it 4606 is not allowed to be designated as Invariant. The Document may 4607 contain zero Invariant Sections. If the Document does not identify 4608 any Invariant Sections then there are none. 4609 4610 The "Cover Texts" are certain short passages of text that are 4611 listed, as Front-Cover Texts or Back-Cover Texts, in the notice 4612 that says that the Document is released under this License. A 4613 Front-Cover Text may be at most 5 words, and a Back-Cover Text may 4614 be at most 25 words. 4615 4616 A "Transparent" copy of the Document means a machine-readable copy, 4617 represented in a format whose specification is available to the 4618 general public, that is suitable for revising the document 4619 straightforwardly with generic text editors or (for images composed 4620 of pixels) generic paint programs or (for drawings) some widely 4621 available drawing editor, and that is suitable for input to text 4622 formatters or for automatic translation to a variety of formats 4623 suitable for input to text formatters. A copy made in an otherwise 4624 Transparent file format whose markup, or absence of markup, has 4625 been arranged to thwart or discourage subsequent modification by 4626 readers is not Transparent. An image format is not Transparent if 4627 used for any substantial amount of text. A copy that is not 4628 "Transparent" is called "Opaque". 4629 4630 Examples of suitable formats for Transparent copies include plain 4631 ASCII without markup, Texinfo input format, LaTeX input format, 4632 SGML or XML using a publicly available DTD, and standard-conforming 4633 simple HTML, PostScript or PDF designed for human modification. 4634 Examples of transparent image formats include PNG, XCF and JPG. 4635 Opaque formats include proprietary formats that can be read and 4636 edited only by proprietary word processors, SGML or XML for which 4637 the DTD and/or processing tools are not generally available, and 4638 the machine-generated HTML, PostScript or PDF produced by some word 4639 processors for output purposes only. 4640 4641 The "Title Page" means, for a printed book, the title page itself, 4642 plus such following pages as are needed to hold, legibly, the 4643 material this License requires to appear in the title page. For 4644 works in formats which do not have any title page as such, "Title 4645 Page" means the text near the most prominent appearance of the 4646 work's title, preceding the beginning of the body of the text. 4647 4648 The "publisher" means any person or entity that distributes copies 4649 of the Document to the public. 4650 4651 A section "Entitled XYZ" means a named subunit of the Document 4652 whose title either is precisely XYZ or contains XYZ in parentheses 4653 following text that translates XYZ in another language. (Here XYZ 4654 stands for a specific section name mentioned below, such as 4655 "Acknowledgements", "Dedications", "Endorsements", or "History".) 4656 To "Preserve the Title" of such a section when you modify the 4657 Document means that it remains a section "Entitled XYZ" according 4658 to this definition. 4659 4660 The Document may include Warranty Disclaimers next to the notice 4661 which states that this License applies to the Document. These 4662 Warranty Disclaimers are considered to be included by reference in 4663 this License, but only as regards disclaiming warranties: any other 4664 implication that these Warranty Disclaimers may have is void and 4665 has no effect on the meaning of this License. 4666 4667 2. VERBATIM COPYING 4668 4669 You may copy and distribute the Document in any medium, either 4670 commercially or noncommercially, provided that this License, the 4671 copyright notices, and the license notice saying this License 4672 applies to the Document are reproduced in all copies, and that you 4673 add no other conditions whatsoever to those of this License. You 4674 may not use technical measures to obstruct or control the reading 4675 or further copying of the copies you make or distribute. However, 4676 you may accept compensation in exchange for copies. If you 4677 distribute a large enough number of copies you must also follow the 4678 conditions in section 3. 4679 4680 You may also lend copies, under the same conditions stated above, 4681 and you may publicly display copies. 4682 4683 3. COPYING IN QUANTITY 4684 4685 If you publish printed copies (or copies in media that commonly 4686 have printed covers) of the Document, numbering more than 100, and 4687 the Document's license notice requires Cover Texts, you must 4688 enclose the copies in covers that carry, clearly and legibly, all 4689 these Cover Texts: Front-Cover Texts on the front cover, and 4690 Back-Cover Texts on the back cover. Both covers must also clearly 4691 and legibly identify you as the publisher of these copies. The 4692 front cover must present the full title with all words of the title 4693 equally prominent and visible. You may add other material on the 4694 covers in addition. Copying with changes limited to the covers, as 4695 long as they preserve the title of the Document and satisfy these 4696 conditions, can be treated as verbatim copying in other respects. 4697 4698 If the required texts for either cover are too voluminous to fit 4699 legibly, you should put the first ones listed (as many as fit 4700 reasonably) on the actual cover, and continue the rest onto 4701 adjacent pages. 4702 4703 If you publish or distribute Opaque copies of the Document 4704 numbering more than 100, you must either include a machine-readable 4705 Transparent copy along with each Opaque copy, or state in or with 4706 each Opaque copy a computer-network location from which the general 4707 network-using public has access to download using public-standard 4708 network protocols a complete Transparent copy of the Document, free 4709 of added material. If you use the latter option, you must take 4710 reasonably prudent steps, when you begin distribution of Opaque 4711 copies in quantity, to ensure that this Transparent copy will 4712 remain thus accessible at the stated location until at least one 4713 year after the last time you distribute an Opaque copy (directly or 4714 through your agents or retailers) of that edition to the public. 4715 4716 It is requested, but not required, that you contact the authors of 4717 the Document well before redistributing any large number of copies, 4718 to give them a chance to provide you with an updated version of the 4719 Document. 4720 4721 4. MODIFICATIONS 4722 4723 You may copy and distribute a Modified Version of the Document 4724 under the conditions of sections 2 and 3 above, provided that you 4725 release the Modified Version under precisely this License, with the 4726 Modified Version filling the role of the Document, thus licensing 4727 distribution and modification of the Modified Version to whoever 4728 possesses a copy of it. In addition, you must do these things in 4729 the Modified Version: 4730 4731 A. Use in the Title Page (and on the covers, if any) a title 4732 distinct from that of the Document, and from those of previous 4733 versions (which should, if there were any, be listed in the 4734 History section of the Document). You may use the same title 4735 as a previous version if the original publisher of that 4736 version gives permission. 4737 4738 B. List on the Title Page, as authors, one or more persons or 4739 entities responsible for authorship of the modifications in 4740 the Modified Version, together with at least five of the 4741 principal authors of the Document (all of its principal 4742 authors, if it has fewer than five), unless they release you 4743 from this requirement. 4744 4745 C. State on the Title page the name of the publisher of the 4746 Modified Version, as the publisher. 4747 4748 D. Preserve all the copyright notices of the Document. 4749 4750 E. Add an appropriate copyright notice for your modifications 4751 adjacent to the other copyright notices. 4752 4753 F. Include, immediately after the copyright notices, a license 4754 notice giving the public permission to use the Modified 4755 Version under the terms of this License, in the form shown in 4756 the Addendum below. 4757 4758 G. Preserve in that license notice the full lists of Invariant 4759 Sections and required Cover Texts given in the Document's 4760 license notice. 4761 4762 H. Include an unaltered copy of this License. 4763 4764 I. Preserve the section Entitled "History", Preserve its Title, 4765 and add to it an item stating at least the title, year, new 4766 authors, and publisher of the Modified Version as given on the 4767 Title Page. If there is no section Entitled "History" in the 4768 Document, create one stating the title, year, authors, and 4769 publisher of the Document as given on its Title Page, then add 4770 an item describing the Modified Version as stated in the 4771 previous sentence. 4772 4773 J. Preserve the network location, if any, given in the Document 4774 for public access to a Transparent copy of the Document, and 4775 likewise the network locations given in the Document for 4776 previous versions it was based on. These may be placed in the 4777 "History" section. You may omit a network location for a work 4778 that was published at least four years before the Document 4779 itself, or if the original publisher of the version it refers 4780 to gives permission. 4781 4782 K. For any section Entitled "Acknowledgements" or "Dedications", 4783 Preserve the Title of the section, and preserve in the section 4784 all the substance and tone of each of the contributor 4785 acknowledgements and/or dedications given therein. 4786 4787 L. Preserve all the Invariant Sections of the Document, unaltered 4788 in their text and in their titles. Section numbers or the 4789 equivalent are not considered part of the section titles. 4790 4791 M. Delete any section Entitled "Endorsements". Such a section 4792 may not be included in the Modified Version. 4793 4794 N. Do not retitle any existing section to be Entitled 4795 "Endorsements" or to conflict in title with any Invariant 4796 Section. 4797 4798 O. Preserve any Warranty Disclaimers. 4799 4800 If the Modified Version includes new front-matter sections or 4801 appendices that qualify as Secondary Sections and contain no 4802 material copied from the Document, you may at your option designate 4803 some or all of these sections as invariant. To do this, add their 4804 titles to the list of Invariant Sections in the Modified Version's 4805 license notice. These titles must be distinct from any other 4806 section titles. 4807 4808 You may add a section Entitled "Endorsements", provided it contains 4809 nothing but endorsements of your Modified Version by various 4810 parties--for example, statements of peer review or that the text 4811 has been approved by an organization as the authoritative 4812 definition of a standard. 4813 4814 You may add a passage of up to five words as a Front-Cover Text, 4815 and a passage of up to 25 words as a Back-Cover Text, to the end of 4816 the list of Cover Texts in the Modified Version. Only one passage 4817 of Front-Cover Text and one of Back-Cover Text may be added by (or 4818 through arrangements made by) any one entity. If the Document 4819 already includes a cover text for the same cover, previously added 4820 by you or by arrangement made by the same entity you are acting on 4821 behalf of, you may not add another; but you may replace the old 4822 one, on explicit permission from the previous publisher that added 4823 the old one. 4824 4825 The author(s) and publisher(s) of the Document do not by this 4826 License give permission to use their names for publicity for or to 4827 assert or imply endorsement of any Modified Version. 4828 4829 5. COMBINING DOCUMENTS 4830 4831 You may combine the Document with other documents released under 4832 this License, under the terms defined in section 4 above for 4833 modified versions, provided that you include in the combination all 4834 of the Invariant Sections of all of the original documents, 4835 unmodified, and list them all as Invariant Sections of your 4836 combined work in its license notice, and that you preserve all 4837 their Warranty Disclaimers. 4838 4839 The combined work need only contain one copy of this License, and 4840 multiple identical Invariant Sections may be replaced with a single 4841 copy. If there are multiple Invariant Sections with the same name 4842 but different contents, make the title of each such section unique 4843 by adding at the end of it, in parentheses, the name of the 4844 original author or publisher of that section if known, or else a 4845 unique number. Make the same adjustment to the section titles in 4846 the list of Invariant Sections in the license notice of the 4847 combined work. 4848 4849 In the combination, you must combine any sections Entitled 4850 "History" in the various original documents, forming one section 4851 Entitled "History"; likewise combine any sections Entitled 4852 "Acknowledgements", and any sections Entitled "Dedications". You 4853 must delete all sections Entitled "Endorsements." 4854 4855 6. COLLECTIONS OF DOCUMENTS 4856 4857 You may make a collection consisting of the Document and other 4858 documents released under this License, and replace the individual 4859 copies of this License in the various documents with a single copy 4860 that is included in the collection, provided that you follow the 4861 rules of this License for verbatim copying of each of the documents 4862 in all other respects. 4863 4864 You may extract a single document from such a collection, and 4865 distribute it individually under this License, provided you insert 4866 a copy of this License into the extracted document, and follow this 4867 License in all other respects regarding verbatim copying of that 4868 document. 4869 4870 7. AGGREGATION WITH INDEPENDENT WORKS 4871 4872 A compilation of the Document or its derivatives with other 4873 separate and independent documents or works, in or on a volume of a 4874 storage or distribution medium, is called an "aggregate" if the 4875 copyright resulting from the compilation is not used to limit the 4876 legal rights of the compilation's users beyond what the individual 4877 works permit. When the Document is included in an aggregate, this 4878 License does not apply to the other works in the aggregate which 4879 are not themselves derivative works of the Document. 4880 4881 If the Cover Text requirement of section 3 is applicable to these 4882 copies of the Document, then if the Document is less than one half 4883 of the entire aggregate, the Document's Cover Texts may be placed 4884 on covers that bracket the Document within the aggregate, or the 4885 electronic equivalent of covers if the Document is in electronic 4886 form. Otherwise they must appear on printed covers that bracket 4887 the whole aggregate. 4888 4889 8. TRANSLATION 4890 4891 Translation is considered a kind of modification, so you may 4892 distribute translations of the Document under the terms of section 4893 4. Replacing Invariant Sections with translations requires special 4894 permission from their copyright holders, but you may include 4895 translations of some or all Invariant Sections in addition to the 4896 original versions of these Invariant Sections. You may include a 4897 translation of this License, and all the license notices in the 4898 Document, and any Warranty Disclaimers, provided that you also 4899 include the original English version of this License and the 4900 original versions of those notices and disclaimers. In case of a 4901 disagreement between the translation and the original version of 4902 this License or a notice or disclaimer, the original version will 4903 prevail. 4904 4905 If a section in the Document is Entitled "Acknowledgements", 4906 "Dedications", or "History", the requirement (section 4) to 4907 Preserve its Title (section 1) will typically require changing the 4908 actual title. 4909 4910 9. TERMINATION 4911 4912 You may not copy, modify, sublicense, or distribute the Document 4913 except as expressly provided under this License. Any attempt 4914 otherwise to copy, modify, sublicense, or distribute it is void, 4915 and will automatically terminate your rights under this License. 4916 4917 However, if you cease all violation of this License, then your 4918 license from a particular copyright holder is reinstated (a) 4919 provisionally, unless and until the copyright holder explicitly and 4920 finally terminates your license, and (b) permanently, if the 4921 copyright holder fails to notify you of the violation by some 4922 reasonable means prior to 60 days after the cessation. 4923 4924 Moreover, your license from a particular copyright holder is 4925 reinstated permanently if the copyright holder notifies you of the 4926 violation by some reasonable means, this is the first time you have 4927 received notice of violation of this License (for any work) from 4928 that copyright holder, and you cure the violation prior to 30 days 4929 after your receipt of the notice. 4930 4931 Termination of your rights under this section does not terminate 4932 the licenses of parties who have received copies or rights from you 4933 under this License. If your rights have been terminated and not 4934 permanently reinstated, receipt of a copy of some or all of the 4935 same material does not give you any rights to use it. 4936 4937 10. FUTURE REVISIONS OF THIS LICENSE 4938 4939 The Free Software Foundation may publish new, revised versions of 4940 the GNU Free Documentation License from time to time. Such new 4941 versions will be similar in spirit to the present version, but may 4942 differ in detail to address new problems or concerns. See 4943 <http://www.gnu.org/copyleft/>. 4944 4945 Each version of the License is given a distinguishing version 4946 number. If the Document specifies that a particular numbered 4947 version of this License "or any later version" applies to it, you 4948 have the option of following the terms and conditions either of 4949 that specified version or of any later version that has been 4950 published (not as a draft) by the Free Software Foundation. If the 4951 Document does not specify a version number of this License, you may 4952 choose any version ever published (not as a draft) by the Free 4953 Software Foundation. If the Document specifies that a proxy can 4954 decide which future versions of this License can be used, that 4955 proxy's public statement of acceptance of a version permanently 4956 authorizes you to choose that version for the Document. 4957 4958 11. RELICENSING 4959 4960 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any 4961 World Wide Web server that publishes copyrightable works and also 4962 provides prominent facilities for anybody to edit those works. A 4963 public wiki that anybody can edit is an example of such a server. 4964 A "Massive Multiauthor Collaboration" (or "MMC") contained in the 4965 site means any set of copyrightable works thus published on the MMC 4966 site. 4967 4968 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 4969 license published by Creative Commons Corporation, a not-for-profit 4970 corporation with a principal place of business in San Francisco, 4971 California, as well as future copyleft versions of that license 4972 published by that same organization. 4973 4974 "Incorporate" means to publish or republish a Document, in whole or 4975 in part, as part of another Document. 4976 4977 An MMC is "eligible for relicensing" if it is licensed under this 4978 License, and if all works that were first published under this 4979 License somewhere other than this MMC, and subsequently 4980 incorporated in whole or in part into the MMC, (1) had no cover 4981 texts or invariant sections, and (2) were thus incorporated prior 4982 to November 1, 2008. 4983 4984 The operator of an MMC Site may republish an MMC contained in the 4985 site under CC-BY-SA on the same site at any time before August 1, 4986 2009, provided the MMC is eligible for relicensing. 4987 4988ADDENDUM: How to use this License for your documents 4989==================================================== 4990 4991To use this License in a document you have written, include a copy of 4992the License in the document and put the following copyright and license 4993notices just after the title page: 4994 4995 Copyright (C) YEAR YOUR NAME. 4996 Permission is granted to copy, distribute and/or modify this document 4997 under the terms of the GNU Free Documentation License, Version 1.3 4998 or any later version published by the Free Software Foundation; 4999 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 5000 Texts. A copy of the license is included in the section entitled ``GNU 5001 Free Documentation License''. 5002 5003 If you have Invariant Sections, Front-Cover Texts and Back-Cover 5004Texts, replace the "with...Texts." line with this: 5005 5006 with the Invariant Sections being LIST THEIR TITLES, with 5007 the Front-Cover Texts being LIST, and with the Back-Cover Texts 5008 being LIST. 5009 5010 If you have Invariant Sections without Cover Texts, or some other 5011combination of the three, merge those two alternatives to suit the 5012situation. 5013 5014 If your document contains nontrivial examples of program code, we 5015recommend releasing these examples in parallel under your choice of free 5016software license, such as the GNU General Public License, to permit 5017their use in free software. 5018 5019 5020File: libgomp.info, Node: Funding, Next: Library Index, Prev: GNU Free Documentation License, Up: Top 5021 5022Funding Free Software 5023********************* 5024 5025If you want to have more free software a few years from now, it makes 5026sense for you to help encourage people to contribute funds for its 5027development. The most effective approach known is to encourage 5028commercial redistributors to donate. 5029 5030 Users of free software systems can boost the pace of development by 5031encouraging for-a-fee distributors to donate part of their selling price 5032to free software developers--the Free Software Foundation, and others. 5033 5034 The way to convince distributors to do this is to demand it and 5035expect it from them. So when you compare distributors, judge them 5036partly by how much they give to free software development. Show 5037distributors they must compete to be the one who gives the most. 5038 5039 To make this approach work, you must insist on numbers that you can 5040compare, such as, "We will donate ten dollars to the Frobnitz project 5041for each disk sold." Don't be satisfied with a vague promise, such as 5042"A portion of the profits are donated," since it doesn't give a basis 5043for comparison. 5044 5045 Even a precise fraction "of the profits from this disk" is not very 5046meaningful, since creative accounting and unrelated business decisions 5047can greatly alter what fraction of the sales price counts as profit. If 5048the price you pay is $50, ten percent of the profit is probably less 5049than a dollar; it might be a few cents, or nothing at all. 5050 5051 Some redistributors do development work themselves. This is useful 5052too; but to keep everyone honest, you need to inquire how much they do, 5053and what kind. Some kinds of development make much more long-term 5054difference than others. For example, maintaining a separate version of 5055a program contributes very little; maintaining the standard version of a 5056program for the whole community contributes much. Easy new ports 5057contribute little, since someone else would surely do them; difficult 5058ports such as adding a new CPU to the GNU Compiler Collection contribute 5059more; major new features or packages contribute the most. 5060 5061 By establishing the idea that supporting further development is "the 5062proper thing to do" when distributing free software for a fee, we can 5063assure a steady flow of resources into making more free software. 5064 5065 Copyright (C) 1994 Free Software Foundation, Inc. 5066 Verbatim copying and redistribution of this section is permitted 5067 without royalty; alteration is not permitted. 5068 5069 5070File: libgomp.info, Node: Library Index, Prev: Funding, Up: Top 5071 5072Library Index 5073************* 5074 5075[index] 5076* Menu: 5077 5078* acc_get_property: acc_get_property. (line 6) 5079* acc_get_property_string: acc_get_property. (line 6) 5080* Environment Variable: OMP_CANCELLATION. (line 6) 5081* Environment Variable <1>: OMP_DISPLAY_ENV. (line 6) 5082* Environment Variable <2>: OMP_DEFAULT_DEVICE. (line 6) 5083* Environment Variable <3>: OMP_DYNAMIC. (line 6) 5084* Environment Variable <4>: OMP_MAX_ACTIVE_LEVELS. (line 6) 5085* Environment Variable <5>: OMP_MAX_TASK_PRIORITY. (line 6) 5086* Environment Variable <6>: OMP_NESTED. (line 6) 5087* Environment Variable <7>: OMP_NUM_THREADS. (line 6) 5088* Environment Variable <8>: OMP_PROC_BIND. (line 6) 5089* Environment Variable <9>: OMP_PLACES. (line 6) 5090* Environment Variable <10>: OMP_STACKSIZE. (line 6) 5091* Environment Variable <11>: OMP_SCHEDULE. (line 6) 5092* Environment Variable <12>: OMP_TARGET_OFFLOAD. (line 6) 5093* Environment Variable <13>: OMP_THREAD_LIMIT. (line 6) 5094* Environment Variable <14>: OMP_WAIT_POLICY. (line 6) 5095* Environment Variable <15>: GOMP_CPU_AFFINITY. (line 6) 5096* Environment Variable <16>: GOMP_DEBUG. (line 6) 5097* Environment Variable <17>: GOMP_STACKSIZE. (line 6) 5098* Environment Variable <18>: GOMP_SPINCOUNT. (line 6) 5099* Environment Variable <19>: GOMP_RTEMS_THREAD_POOLS. 5100 (line 6) 5101* FDL, GNU Free Documentation License: GNU Free Documentation License. 5102 (line 6) 5103* Implementation specific setting: OMP_NESTED. (line 6) 5104* Implementation specific setting <1>: OMP_NUM_THREADS. (line 6) 5105* Implementation specific setting <2>: OMP_SCHEDULE. (line 6) 5106* Implementation specific setting <3>: OMP_TARGET_OFFLOAD. (line 6) 5107* Implementation specific setting <4>: GOMP_STACKSIZE. (line 6) 5108* Implementation specific setting <5>: GOMP_SPINCOUNT. (line 6) 5109* Implementation specific setting <6>: GOMP_RTEMS_THREAD_POOLS. 5110 (line 6) 5111* Introduction: Top. (line 6) 5112 5113 5114 5115Tag Table: 5116Node: Top2083 5117Node: Enabling OpenMP4633 5118Node: Runtime Library Routines5409 5119Node: omp_get_active_level8729 5120Node: omp_get_ancestor_thread_num9429 5121Node: omp_get_cancellation10359 5122Node: omp_get_default_device11173 5123Node: omp_get_dynamic11849 5124Node: omp_get_initial_device12733 5125Node: omp_get_level13477 5126Node: omp_get_max_active_levels14104 5127Node: omp_get_max_task_priority14825 5128Node: omp_get_max_threads15445 5129Node: omp_get_nested16204 5130Node: omp_get_num_devices17812 5131Node: omp_get_num_procs18333 5132Node: omp_get_num_teams18872 5133Node: omp_get_num_threads19388 5134Node: omp_get_proc_bind20477 5135Node: omp_get_schedule21398 5136Node: omp_get_supported_active_levels22367 5137Node: omp_get_team_num23153 5138Node: omp_get_team_size23667 5139Node: omp_get_thread_limit24627 5140Node: omp_get_thread_num25246 5141Node: omp_in_parallel26117 5142Node: omp_in_final26766 5143Node: omp_is_initial_device27440 5144Node: omp_set_default_device28133 5145Node: omp_set_dynamic28924 5146Node: omp_set_max_active_levels29810 5147Node: omp_set_nested30732 5148Node: omp_set_num_threads31929 5149Node: omp_set_schedule32797 5150Node: omp_init_lock33878 5151Node: omp_set_lock34531 5152Node: omp_test_lock35386 5153Node: omp_unset_lock36362 5154Node: omp_destroy_lock37293 5155Node: omp_init_nest_lock37970 5156Node: omp_set_nest_lock38705 5157Node: omp_test_nest_lock39620 5158Node: omp_unset_nest_lock40647 5159Node: omp_destroy_nest_lock41662 5160Node: omp_get_wtick42413 5161Node: omp_get_wtime43005 5162Node: omp_fulfill_event43807 5163Node: Environment Variables44828 5164Node: OMP_CANCELLATION46455 5165Node: OMP_DISPLAY_ENV46988 5166Node: OMP_DEFAULT_DEVICE47691 5167Node: OMP_DYNAMIC48471 5168Node: OMP_MAX_ACTIVE_LEVELS49067 5169Node: OMP_MAX_TASK_PRIORITY49994 5170Node: OMP_NESTED50652 5171Node: OMP_NUM_THREADS51681 5172Node: OMP_PROC_BIND52483 5173Node: OMP_PLACES53794 5174Node: OMP_STACKSIZE55971 5175Node: OMP_SCHEDULE56795 5176Node: OMP_TARGET_OFFLOAD57495 5177Node: OMP_THREAD_LIMIT58451 5178Node: OMP_WAIT_POLICY59057 5179Node: GOMP_CPU_AFFINITY59749 5180Node: GOMP_DEBUG61479 5181Node: GOMP_STACKSIZE61986 5182Node: GOMP_SPINCOUNT62817 5183Node: GOMP_RTEMS_THREAD_POOLS64021 5184Node: Enabling OpenACC66199 5185Node: OpenACC Runtime Library Routines67100 5186Node: acc_get_num_devices71381 5187Node: acc_set_device_type72107 5188Node: acc_get_device_type72871 5189Node: acc_set_device_num73884 5190Node: acc_get_device_num74701 5191Node: acc_get_property75500 5192Node: acc_async_test77723 5193Node: acc_async_test_all78711 5194Node: acc_wait79611 5195Node: acc_wait_all80474 5196Node: acc_wait_all_async81235 5197Node: acc_wait_async81987 5198Node: acc_init82695 5199Node: acc_shutdown83340 5200Node: acc_on_device84007 5201Node: acc_malloc85011 5202Node: acc_free85510 5203Node: acc_copyin85937 5204Node: acc_present_or_copyin87524 5205Node: acc_create89302 5206Node: acc_present_or_create90934 5207Node: acc_copyout92720 5208Node: acc_delete95024 5209Node: acc_update_device97271 5210Node: acc_update_self98845 5211Node: acc_map_data100435 5212Node: acc_unmap_data101120 5213Node: acc_deviceptr101641 5214Node: acc_hostptr102211 5215Node: acc_is_present102775 5216Node: acc_memcpy_to_device104302 5217Node: acc_memcpy_from_device104965 5218Node: acc_attach105632 5219Node: acc_detach106279 5220Node: acc_get_current_cuda_device107058 5221Node: acc_get_current_cuda_context107643 5222Node: acc_get_cuda_stream108243 5223Node: acc_set_cuda_stream108834 5224Node: acc_prof_register109505 5225Node: acc_prof_unregister110064 5226Node: acc_prof_lookup110631 5227Node: acc_register_library111152 5228Node: OpenACC Environment Variables111718 5229Node: ACC_DEVICE_TYPE112290 5230Node: ACC_DEVICE_NUM112526 5231Node: ACC_PROFLIB112780 5232Node: GCC_ACC_NOTIFY113111 5233Node: CUDA Streams Usage113331 5234Ref: CUDA Streams Usage-Footnote-1115232 5235Node: OpenACC Library Interoperability115341 5236Ref: OpenACC Library Interoperability-Footnote-1121709 5237Ref: OpenACC Library Interoperability-Footnote-2121961 5238Node: OpenACC Profiling Interface122169 5239Node: The libgomp ABI132193 5240Node: Implementing MASTER construct133046 5241Node: Implementing CRITICAL construct133462 5242Node: Implementing ATOMIC construct134203 5243Node: Implementing FLUSH construct134686 5244Node: Implementing BARRIER construct134959 5245Node: Implementing THREADPRIVATE construct135230 5246Node: Implementing PRIVATE clause135885 5247Node: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses136468 5248Node: Implementing REDUCTION clause137794 5249Node: Implementing PARALLEL construct138353 5250Node: Implementing FOR construct139612 5251Node: Implementing ORDERED construct141612 5252Node: Implementing SECTIONS construct141920 5253Node: Implementing SINGLE construct142688 5254Node: Implementing OpenACC's PARALLEL construct143402 5255Node: Reporting Bugs143662 5256Node: Copying144025 5257Node: GNU Free Documentation License181571 5258Node: Funding206694 5259Node: Library Index209220 5260 5261End Tag Table 5262