Changeset e1769f27 in rtems
- Timestamp:
- Sep 3, 2015, 12:45:44 PM (6 years ago)
- Branches:
- 5, master
- Children:
- 252e244
- Parents:
- dafa5d88
- git-author:
- Sebastian Huber <sebastian.huber@…> (09/03/15 12:45:44)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (09/04/15 11:44:47)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/smp.t
rdafa5d88 re1769f27 466 466 The only remaining user of task variables in the RTEMS code base is the Ada 467 467 support. So basically Ada is not available on RTEMS SMP. 468 469 @subsection OpenMP 470 471 OpenMP support for RTEMS is available via the GCC provided libgomp. There is 472 libgomp support for RTEMS in the POSIX configuration of libgomp since GCC 4.9 473 (requires a Newlib snapshot after 2015-03-12). In GCC 6.1 or later (requires a 474 Newlib snapshot after 2015-07-30 for <sys/lock.h> provided self-contained 475 synchronization objects) there is a specialized libgomp configuration for RTEMS 476 which offers a significantly better performance compared to the POSIX 477 configuration of libgomp. In addition application configurable thread pools 478 for each scheduler instance are available in GCC 6.1 or later. 479 480 The run-time configuration of libgomp is done via environment variables 481 documented in the @uref{https://gcc.gnu.org/onlinedocs/libgomp/, libgomp 482 manual}. The environment variables are evaluated in a constructor function 483 which executes in the context of the first initialization task before the 484 actual initialization task function is called (just like a global C++ 485 constructor). To set application specific values, a higher priority 486 constructor function must be used to set up the environment variables. 487 488 @example 489 @group 490 #include <stdlib.h> 491 492 void __attribute__((constructor(1000))) config_libgomp( void ) 493 @{ 494 setenv( "OMP_DISPLAY_ENV", "VERBOSE", 1 ); 495 setenv( "GOMP_SPINCOUNT", "30000", 1 ); 496 setenv( "GOMP_RTEMS_THREAD_POOLS", "1$2@@SCHD", 1 ); 497 @} 498 @end group 499 @end example 500 501 The environment variable @env{GOMP_RTEMS_THREAD_POOLS} is RTEMS specific. It 502 determines the thread pools for each scheduler instance. The format for 503 @env{GOMP_RTEMS_THREAD_POOLS} is a list of optional 504 @code{<thread-pool-count>[$<priority>]@@<scheduler-name>} configurations 505 separated by @code{:} where: 506 507 @itemize @bullet 508 @item @code{<thread-pool-count>} is the thread pool count for this scheduler 509 instance. 510 @item @code{$<priority>} is an optional priority for the worker threads of a 511 thread pool according to @code{pthread_setschedparam}. In case a priority 512 value is omitted, then a worker thread will inherit the priority of the OpenMP 513 master thread that created it. The priority of the worker thread is not 514 changed by libgomp after creation, even if a new OpenMP master thread using the 515 worker has a different priority. 516 @item @code{@@<scheduler-name>} is the scheduler instance name according to the 517 RTEMS application configuration. 518 @end itemize 519 520 In case no thread pool configuration is specified for a scheduler instance, 521 then each OpenMP master thread of this scheduler instance will use its own 522 dynamically allocated thread pool. To limit the worker thread count of the 523 thread pools, each OpenMP master thread must call @code{omp_set_num_threads}. 524 525 Lets suppose we have three scheduler instances @code{IO}, @code{WRK0}, and 526 @code{WRK1} with @env{GOMP_RTEMS_THREAD_POOLS} set to 527 @code{"1@@WRK0:3$4@@WRK1"}. Then there are no thread pool restrictions for 528 scheduler instance @code{IO}. In the scheduler instance @code{WRK0} there is 529 one thread pool available. Since no priority is specified for this scheduler 530 instance, the worker thread inherits the priority of the OpenMP master thread 531 that created it. In the scheduler instance @code{WRK1} there are three thread 532 pools available and their worker threads run at priority four. 468 533 469 534 @subsection Thread Dispatch Details
Note: See TracChangeset
for help on using the changeset viewer.