00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef FTN_STDCALL
00048 # error The support file kmp_ftn_entry.h should not be compiled by itself.
00049 #endif
00050
00051 #ifdef KMP_STUB
00052 #include "kmp_stub.h"
00053 #endif
00054
00055 #include "kmp_i18n.h"
00056
00057 #ifdef __cplusplus
00058 extern "C" {
00059 #endif // __cplusplus
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #ifdef KMP_GOMP_COMPAT
00072 # if (KMP_FTN_ENTRIES == KMP_FTN_PLAIN) || (KMP_FTN_ENTRIES == KMP_FTN_UPPER)
00073 # define PASS_ARGS_BY_VALUE 1
00074 # endif
00075 #endif
00076 #if KMP_OS_WINDOWS
00077 # if (KMP_FTN_ENTRIES == KMP_FTN_PLAIN) || (KMP_FTN_ENTRIES == KMP_FTN_APPEND)
00078 # define PASS_ARGS_BY_VALUE 1
00079 # endif
00080 #endif
00081
00082
00083 #ifdef PASS_ARGS_BY_VALUE
00084 #define KMP_DEREF
00085 #else
00086 #define KMP_DEREF *
00087 #endif
00088
00089 void FTN_STDCALL
00090 FTN_SET_STACKSIZE( int KMP_DEREF arg )
00091 {
00092 #ifdef KMP_STUB
00093 __kmps_set_stacksize( KMP_DEREF arg );
00094 #else
00095
00096 __kmp_aux_set_stacksize( (size_t) KMP_DEREF arg );
00097 #endif
00098 }
00099
00100 void FTN_STDCALL
00101 FTN_SET_STACKSIZE_S( size_t KMP_DEREF arg )
00102 {
00103 #ifdef KMP_STUB
00104 __kmps_set_stacksize( KMP_DEREF arg );
00105 #else
00106
00107 __kmp_aux_set_stacksize( KMP_DEREF arg );
00108 #endif
00109 }
00110
00111 int FTN_STDCALL
00112 FTN_GET_STACKSIZE( void )
00113 {
00114 #ifdef KMP_STUB
00115 return __kmps_get_stacksize();
00116 #else
00117 if ( ! __kmp_init_serial ) {
00118 __kmp_serial_initialize();
00119 };
00120 return (int)__kmp_stksize;
00121 #endif
00122 }
00123
00124 size_t FTN_STDCALL
00125 FTN_GET_STACKSIZE_S( void )
00126 {
00127 #ifdef KMP_STUB
00128 return __kmps_get_stacksize();
00129 #else
00130 if ( ! __kmp_init_serial ) {
00131 __kmp_serial_initialize();
00132 };
00133 return __kmp_stksize;
00134 #endif
00135 }
00136
00137 void FTN_STDCALL
00138 FTN_SET_BLOCKTIME( int KMP_DEREF arg )
00139 {
00140 #ifdef KMP_STUB
00141 __kmps_set_blocktime( KMP_DEREF arg );
00142 #else
00143 int gtid, tid;
00144 kmp_info_t *thread;
00145
00146 gtid = __kmp_entry_gtid();
00147 tid = __kmp_tid_from_gtid(gtid);
00148 thread = __kmp_thread_from_gtid(gtid);
00149
00150 __kmp_aux_set_blocktime( KMP_DEREF arg, thread, tid );
00151 #endif
00152 }
00153
00154 int FTN_STDCALL
00155 FTN_GET_BLOCKTIME( void )
00156 {
00157 #ifdef KMP_STUB
00158 return __kmps_get_blocktime();
00159 #else
00160 int gtid, tid;
00161 kmp_info_t *thread;
00162 kmp_team_p *team;
00163
00164 gtid = __kmp_entry_gtid();
00165 tid = __kmp_tid_from_gtid(gtid);
00166 thread = __kmp_thread_from_gtid(gtid);
00167 team = __kmp_threads[ gtid ] -> th.th_team;
00168
00169
00170 if ( __kmp_dflt_blocktime == KMP_MAX_BLOCKTIME ) {
00171 KF_TRACE(10, ( "kmp_get_blocktime: T#%d(%d:%d), blocktime=%d\n",
00172 gtid, team->t.t_id, tid, KMP_MAX_BLOCKTIME) );
00173 return KMP_MAX_BLOCKTIME;
00174 }
00175 #ifdef KMP_ADJUST_BLOCKTIME
00176 else if ( __kmp_zero_bt && !get__bt_set( team, tid ) ) {
00177 KF_TRACE(10, ( "kmp_get_blocktime: T#%d(%d:%d), blocktime=%d\n",
00178 gtid, team->t.t_id, tid, 0) );
00179 return 0;
00180 }
00181 #endif
00182 else {
00183 KF_TRACE(10, ( "kmp_get_blocktime: T#%d(%d:%d), blocktime=%d\n",
00184 gtid, team->t.t_id, tid, get__blocktime( team, tid ) ) );
00185 return get__blocktime( team, tid );
00186 };
00187 #endif
00188 }
00189
00190 void FTN_STDCALL
00191 FTN_SET_LIBRARY_SERIAL( void )
00192 {
00193 #ifdef KMP_STUB
00194 __kmps_set_library( library_serial );
00195 #else
00196
00197 __kmp_user_set_library( library_serial );
00198 #endif
00199 }
00200
00201 void FTN_STDCALL
00202 FTN_SET_LIBRARY_TURNAROUND( void )
00203 {
00204 #ifdef KMP_STUB
00205 __kmps_set_library( library_turnaround );
00206 #else
00207
00208 __kmp_user_set_library( library_turnaround );
00209 #endif
00210 }
00211
00212 void FTN_STDCALL
00213 FTN_SET_LIBRARY_THROUGHPUT( void )
00214 {
00215 #ifdef KMP_STUB
00216 __kmps_set_library( library_throughput );
00217 #else
00218
00219 __kmp_user_set_library( library_throughput );
00220 #endif
00221 }
00222
00223 void FTN_STDCALL
00224 FTN_SET_LIBRARY( int KMP_DEREF arg )
00225 {
00226 #ifdef KMP_STUB
00227 __kmps_set_library( KMP_DEREF arg );
00228 #else
00229 enum library_type lib;
00230 lib = (enum library_type) KMP_DEREF arg;
00231
00232 __kmp_user_set_library( lib );
00233 #endif
00234 }
00235
00236 int FTN_STDCALL
00237 FTN_GET_LIBRARY (void)
00238 {
00239 #ifdef KMP_STUB
00240 return __kmps_get_library();
00241 #else
00242 if ( ! __kmp_init_serial ) {
00243 __kmp_serial_initialize();
00244 }
00245 return ((int) __kmp_library);
00246 #endif
00247 }
00248
00249 #if OMP_30_ENABLED
00250
00251 int FTN_STDCALL
00252 FTN_SET_AFFINITY( void **mask )
00253 {
00254 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00255 return -1;
00256 #else
00257 if ( ! TCR_4(__kmp_init_middle) ) {
00258 __kmp_middle_initialize();
00259 }
00260 return __kmp_aux_set_affinity( mask );
00261 #endif
00262 }
00263
00264 int FTN_STDCALL
00265 FTN_GET_AFFINITY( void **mask )
00266 {
00267 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00268 return -1;
00269 #else
00270 if ( ! TCR_4(__kmp_init_middle) ) {
00271 __kmp_middle_initialize();
00272 }
00273 return __kmp_aux_get_affinity( mask );
00274 #endif
00275 }
00276
00277 int FTN_STDCALL
00278 FTN_GET_AFFINITY_MAX_PROC( void )
00279 {
00280 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00281 return 0;
00282 #else
00283
00284
00285
00286 if ( ! TCR_4(__kmp_init_middle) ) {
00287 __kmp_middle_initialize();
00288 }
00289 if ( ! ( KMP_AFFINITY_CAPABLE() ) ) {
00290 return 0;
00291 }
00292
00293 #if KMP_OS_WINDOWS && KMP_ARCH_X86_64
00294 if ( __kmp_num_proc_groups <= 1 ) {
00295 return KMP_CPU_SETSIZE;
00296 }
00297 #endif
00298 return __kmp_xproc;
00299 #endif
00300 }
00301
00302 void FTN_STDCALL
00303 FTN_CREATE_AFFINITY_MASK( void **mask )
00304 {
00305 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00306 *mask = NULL;
00307 #else
00308
00309
00310
00311 if ( ! TCR_4(__kmp_init_middle) ) {
00312 __kmp_middle_initialize();
00313 }
00314 *mask = kmpc_malloc( __kmp_affin_mask_size );
00315 KMP_CPU_ZERO( (kmp_affin_mask_t *)(*mask) );
00316 #endif
00317 }
00318
00319 void FTN_STDCALL
00320 FTN_DESTROY_AFFINITY_MASK( void **mask )
00321 {
00322 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00323
00324 #else
00325
00326
00327
00328 if ( ! TCR_4(__kmp_init_middle) ) {
00329 __kmp_middle_initialize();
00330 }
00331 if ( __kmp_env_consistency_check ) {
00332 if ( *mask == NULL ) {
00333 KMP_FATAL( AffinityInvalidMask, "kmp_destroy_affinity_mask" );
00334 }
00335 }
00336 kmpc_free( *mask );
00337 *mask = NULL;
00338 #endif
00339 }
00340
00341 int FTN_STDCALL
00342 FTN_SET_AFFINITY_MASK_PROC( int KMP_DEREF proc, void **mask )
00343 {
00344 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00345 return -1;
00346 #else
00347 if ( ! TCR_4(__kmp_init_middle) ) {
00348 __kmp_middle_initialize();
00349 }
00350 return __kmp_aux_set_affinity_mask_proc( KMP_DEREF proc, mask );
00351 #endif
00352 }
00353
00354 int FTN_STDCALL
00355 FTN_UNSET_AFFINITY_MASK_PROC( int KMP_DEREF proc, void **mask )
00356 {
00357 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00358 return -1;
00359 #else
00360 if ( ! TCR_4(__kmp_init_middle) ) {
00361 __kmp_middle_initialize();
00362 }
00363 return __kmp_aux_unset_affinity_mask_proc( KMP_DEREF proc, mask );
00364 #endif
00365 }
00366
00367 int FTN_STDCALL
00368 FTN_GET_AFFINITY_MASK_PROC( int KMP_DEREF proc, void **mask )
00369 {
00370 #if defined(KMP_STUB) || !(KMP_OS_WINDOWS || KMP_OS_LINUX)
00371 return -1;
00372 #else
00373 if ( ! TCR_4(__kmp_init_middle) ) {
00374 __kmp_middle_initialize();
00375 }
00376 return __kmp_aux_get_affinity_mask_proc( KMP_DEREF proc, mask );
00377 #endif
00378 }
00379
00380 #endif
00381
00382
00383
00384
00385
00386
00387 void FTN_STDCALL
00388 FTN_SET_NUM_THREADS( int KMP_DEREF arg )
00389 {
00390 #ifdef KMP_STUB
00391
00392 #else
00393 __kmp_set_num_threads( KMP_DEREF arg, __kmp_entry_gtid() );
00394 #endif
00395 }
00396
00397
00398
00399 int FTN_STDCALL
00400 FTN_GET_NUM_THREADS( void )
00401 {
00402 #ifdef KMP_STUB
00403 return 1;
00404 #else
00405
00406 return __kmpc_bound_num_threads(NULL);
00407 #endif
00408 }
00409
00410 int FTN_STDCALL
00411 FTN_GET_MAX_THREADS( void )
00412 {
00413 #ifdef KMP_STUB
00414 return 1;
00415 #else
00416 int gtid;
00417 kmp_info_t *thread;
00418 if ( ! TCR_4(__kmp_init_middle) ) {
00419 __kmp_middle_initialize();
00420 }
00421 gtid = __kmp_entry_gtid();
00422 thread = __kmp_threads[ gtid ];
00423 #if OMP_30_ENABLED
00424
00425 return thread -> th.th_current_task -> td_icvs.nproc;
00426 #else
00427 return thread -> th.th_team -> t.t_set_nproc[ thread->th.th_info.ds.ds_tid ];
00428 #endif
00429 #endif
00430 }
00431
00432 int FTN_STDCALL
00433 FTN_GET_THREAD_NUM( void )
00434 {
00435 #ifdef KMP_STUB
00436 return 0;
00437 #else
00438 int gtid;
00439
00440 #if KMP_OS_DARWIN
00441 gtid = __kmp_entry_gtid();
00442 #elif KMP_OS_WINDOWS
00443 if (!__kmp_init_parallel ||
00444 (gtid = ((kmp_intptr_t)TlsGetValue( __kmp_gtid_threadprivate_key ))) == 0) {
00445
00446
00447 return 0;
00448 }
00449 --gtid;
00450 #elif KMP_OS_LINUX
00451 #ifdef KMP_TDATA_GTID
00452 if ( __kmp_gtid_mode >= 3 ) {
00453 if ((gtid = __kmp_gtid) == KMP_GTID_DNE) {
00454 return 0;
00455 }
00456 } else {
00457 #endif
00458 if (!__kmp_init_parallel ||
00459 (gtid = (kmp_intptr_t)(pthread_getspecific( __kmp_gtid_threadprivate_key ))) == 0) {
00460 return 0;
00461 }
00462 --gtid;
00463 #ifdef KMP_TDATA_GTID
00464 }
00465 #endif
00466 #else
00467 #error Unknown or unsupported OS
00468 #endif
00469
00470 return __kmp_tid_from_gtid( gtid );
00471 #endif
00472 }
00473
00474 int FTN_STDCALL
00475 FTN_GET_NUM_KNOWN_THREADS( void )
00476 {
00477 #ifdef KMP_STUB
00478 return 1;
00479 #else
00480 if ( ! __kmp_init_serial ) {
00481 __kmp_serial_initialize();
00482 }
00483
00484
00485 return TCR_4(__kmp_nth);
00486 #endif
00487 }
00488
00489 int FTN_STDCALL
00490 FTN_GET_NUM_PROCS( void )
00491 {
00492 #ifdef KMP_STUB
00493 return 1;
00494 #else
00495 int gtid;
00496 if ( ! TCR_4(__kmp_init_middle) ) {
00497 __kmp_middle_initialize();
00498 }
00499 return __kmp_avail_proc;
00500 #endif
00501 }
00502
00503 void FTN_STDCALL
00504 FTN_SET_NESTED( int KMP_DEREF flag )
00505 {
00506 #ifdef KMP_STUB
00507 __kmps_set_nested( KMP_DEREF flag );
00508 #else
00509 kmp_info_t *thread;
00510
00511 thread = __kmp_entry_thread();
00512 __kmp_save_internal_controls( thread );
00513 set__nested( thread, ( (KMP_DEREF flag) ? TRUE : FALSE ) );
00514 #endif
00515 }
00516
00517
00518 int FTN_STDCALL
00519 FTN_GET_NESTED( void )
00520 {
00521 #ifdef KMP_STUB
00522 return __kmps_get_nested();
00523 #else
00524 kmp_info_t *thread;
00525 thread = __kmp_entry_thread();
00526 return get__nested( thread );
00527 #endif
00528 }
00529
00530 void FTN_STDCALL
00531 FTN_SET_DYNAMIC( int KMP_DEREF flag )
00532 {
00533 #ifdef KMP_STUB
00534 __kmps_set_dynamic( KMP_DEREF flag ? TRUE : FALSE );
00535 #else
00536 kmp_info_t *thread;
00537
00538 thread = __kmp_entry_thread();
00539
00540 __kmp_save_internal_controls( thread );
00541 set__dynamic( thread, KMP_DEREF flag ? TRUE : FALSE );
00542 #endif
00543 }
00544
00545
00546 int FTN_STDCALL
00547 FTN_GET_DYNAMIC( void )
00548 {
00549 #ifdef KMP_STUB
00550 return __kmps_get_dynamic();
00551 #else
00552 kmp_info_t *thread;
00553 thread = __kmp_entry_thread();
00554 return get__dynamic( thread );
00555 #endif
00556 }
00557
00558 int FTN_STDCALL
00559 FTN_IN_PARALLEL( void )
00560 {
00561 #ifdef KMP_STUB
00562 return 0;
00563 #else
00564 return ( __kmp_entry_thread() -> th.th_root ->
00565 r.r_in_parallel ? FTN_TRUE : FTN_FALSE );
00566 #endif
00567 }
00568
00569 #if OMP_30_ENABLED
00570
00571 void FTN_STDCALL
00572 FTN_SET_SCHEDULE( kmp_sched_t KMP_DEREF kind, int KMP_DEREF modifier )
00573 {
00574 #ifdef KMP_STUB
00575 __kmps_set_schedule( KMP_DEREF kind, KMP_DEREF modifier );
00576 #else
00577
00578
00579 __kmp_set_schedule( __kmp_entry_gtid(), KMP_DEREF kind, KMP_DEREF modifier );
00580 #endif
00581 }
00582
00583 void FTN_STDCALL
00584 FTN_GET_SCHEDULE( kmp_sched_t * kind, int * modifier )
00585 {
00586 #ifdef KMP_STUB
00587 __kmps_get_schedule( kind, modifier );
00588 #else
00589
00590
00591 __kmp_get_schedule( __kmp_entry_gtid(), kind, modifier );
00592 #endif
00593 }
00594
00595 void FTN_STDCALL
00596 FTN_SET_MAX_ACTIVE_LEVELS( int KMP_DEREF arg )
00597 {
00598 #ifdef KMP_STUB
00599
00600 #else
00601
00602
00603 __kmp_set_max_active_levels( __kmp_entry_gtid(), KMP_DEREF arg );
00604 #endif
00605 }
00606
00607 int FTN_STDCALL
00608 FTN_GET_MAX_ACTIVE_LEVELS( void )
00609 {
00610 #ifdef KMP_STUB
00611 return 0;
00612 #else
00613
00614
00615 return __kmp_get_max_active_levels( __kmp_entry_gtid() );
00616 #endif
00617 }
00618
00619 int FTN_STDCALL
00620 FTN_GET_ACTIVE_LEVEL( void )
00621 {
00622 #ifdef KMP_STUB
00623 return 0;
00624 #else
00625
00626
00627 return __kmp_entry_thread() -> th.th_team -> t.t_active_level;
00628 #endif
00629 }
00630
00631 int FTN_STDCALL
00632 FTN_GET_LEVEL( void )
00633 {
00634 #ifdef KMP_STUB
00635 return 0;
00636 #else
00637
00638
00639 return __kmp_entry_thread() -> th.th_team -> t.t_level;
00640 #endif
00641 }
00642
00643 int FTN_STDCALL
00644 FTN_GET_ANCESTOR_THREAD_NUM( int KMP_DEREF level )
00645 {
00646 #ifdef KMP_STUB
00647 return ( KMP_DEREF level ) ? ( -1 ) : ( 0 );
00648 #else
00649 return __kmp_get_ancestor_thread_num( __kmp_entry_gtid(), KMP_DEREF level );
00650 #endif
00651 }
00652
00653 int FTN_STDCALL
00654 FTN_GET_TEAM_SIZE( int KMP_DEREF level )
00655 {
00656 #ifdef KMP_STUB
00657 return ( KMP_DEREF level ) ? ( -1 ) : ( 1 );
00658 #else
00659 return __kmp_get_team_size( __kmp_entry_gtid(), KMP_DEREF level );
00660 #endif
00661 }
00662
00663 int FTN_STDCALL
00664 FTN_GET_THREAD_LIMIT( void )
00665 {
00666 #ifdef KMP_STUB
00667 return 1;
00668 #else
00669 if ( ! __kmp_init_serial ) {
00670 __kmp_serial_initialize();
00671 };
00672
00673 return __kmp_max_nth;
00674 #endif
00675 }
00676
00677 int FTN_STDCALL
00678 FTN_IN_FINAL( void )
00679 {
00680 #ifdef KMP_STUB
00681 return 0;
00682 #else
00683 if ( ! TCR_4(__kmp_init_parallel) ) {
00684 return 0;
00685 }
00686 return __kmp_entry_thread() -> th.th_current_task -> td_flags.final;
00687 #endif
00688 }
00689
00690 #endif // OMP_30_ENABLED
00691
00692 #if OMP_40_ENABLED
00693
00694
00695 kmp_proc_bind_t FTN_STDCALL
00696 FTN_GET_PROC_BIND( void )
00697 {
00698 #ifdef KMP_STUB
00699 return __kmps_get_proc_bind();
00700 #else
00701 return get__proc_bind( __kmp_entry_thread() );
00702 #endif
00703 }
00704
00705 #endif // OMP_40_ENABLED
00706
00707 #ifdef KMP_STUB
00708 typedef enum { UNINIT = -1, UNLOCKED, LOCKED } kmp_stub_lock_t;
00709 #endif
00710
00711
00712 void FTN_STDCALL
00713 FTN_INIT_LOCK( void **user_lock )
00714 {
00715 #ifdef KMP_STUB
00716 *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
00717 #else
00718 __kmpc_init_lock( NULL, __kmp_entry_gtid(), user_lock );
00719 #endif
00720 }
00721
00722
00723 void FTN_STDCALL
00724 FTN_INIT_NEST_LOCK( void **user_lock )
00725 {
00726 #ifdef KMP_STUB
00727 *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
00728 #else
00729 __kmpc_init_nest_lock( NULL, __kmp_entry_gtid(), user_lock );
00730 #endif
00731 }
00732
00733 void FTN_STDCALL
00734 FTN_DESTROY_LOCK( void **user_lock )
00735 {
00736 #ifdef KMP_STUB
00737 *((kmp_stub_lock_t *)user_lock) = UNINIT;
00738 #else
00739 __kmpc_destroy_lock( NULL, __kmp_entry_gtid(), user_lock );
00740 #endif
00741 }
00742
00743 void FTN_STDCALL
00744 FTN_DESTROY_NEST_LOCK( void **user_lock )
00745 {
00746 #ifdef KMP_STUB
00747 *((kmp_stub_lock_t *)user_lock) = UNINIT;
00748 #else
00749 __kmpc_destroy_nest_lock( NULL, __kmp_entry_gtid(), user_lock );
00750 #endif
00751 }
00752
00753 void FTN_STDCALL
00754 FTN_SET_LOCK( void **user_lock )
00755 {
00756 #ifdef KMP_STUB
00757 if ( *((kmp_stub_lock_t *)user_lock) == UNINIT ) {
00758
00759 };
00760 if ( *((kmp_stub_lock_t *)user_lock) != UNLOCKED ) {
00761
00762 };
00763 *((kmp_stub_lock_t *)user_lock) = LOCKED;
00764 #else
00765 __kmpc_set_lock( NULL, __kmp_entry_gtid(), user_lock );
00766 #endif
00767 }
00768
00769 void FTN_STDCALL
00770 FTN_SET_NEST_LOCK( void **user_lock )
00771 {
00772 #ifdef KMP_STUB
00773 if ( *((kmp_stub_lock_t *)user_lock) == UNINIT ) {
00774
00775 };
00776 (*((int *)user_lock))++;
00777 #else
00778 __kmpc_set_nest_lock( NULL, __kmp_entry_gtid(), user_lock );
00779 #endif
00780 }
00781
00782 void FTN_STDCALL
00783 FTN_UNSET_LOCK( void **user_lock )
00784 {
00785 #ifdef KMP_STUB
00786 if ( *((kmp_stub_lock_t *)user_lock) == UNINIT ) {
00787
00788 };
00789 if ( *((kmp_stub_lock_t *)user_lock) == UNLOCKED ) {
00790
00791 };
00792 *((kmp_stub_lock_t *)user_lock) = UNLOCKED;
00793 #else
00794 __kmpc_unset_lock( NULL, __kmp_entry_gtid(), user_lock );
00795 #endif
00796 }
00797
00798 void FTN_STDCALL
00799 FTN_UNSET_NEST_LOCK( void **user_lock )
00800 {
00801 #ifdef KMP_STUB
00802 if ( *((kmp_stub_lock_t *)user_lock) == UNINIT ) {
00803
00804 };
00805 if ( *((kmp_stub_lock_t *)user_lock) == UNLOCKED ) {
00806
00807 };
00808 (*((int *)user_lock))--;
00809 #else
00810 __kmpc_unset_nest_lock( NULL, __kmp_entry_gtid(), user_lock );
00811 #endif
00812 }
00813
00814 int FTN_STDCALL
00815 FTN_TEST_LOCK( void **user_lock )
00816 {
00817 #ifdef KMP_STUB
00818 if ( *((kmp_stub_lock_t *)user_lock) == UNINIT ) {
00819
00820 };
00821 if ( *((kmp_stub_lock_t *)user_lock) == LOCKED ) {
00822 return 0;
00823 };
00824 *((kmp_stub_lock_t *)user_lock) = LOCKED;
00825 return 1;
00826 #else
00827 return __kmpc_test_lock( NULL, __kmp_entry_gtid(), user_lock );
00828 #endif
00829 }
00830
00831 int FTN_STDCALL
00832 FTN_TEST_NEST_LOCK( void **user_lock )
00833 {
00834 #ifdef KMP_STUB
00835 if ( *((kmp_stub_lock_t *)user_lock) == UNINIT ) {
00836
00837 };
00838 return ++(*((int *)user_lock));
00839 #else
00840 return __kmpc_test_nest_lock( NULL, __kmp_entry_gtid(), user_lock );
00841 #endif
00842 }
00843
00844 double FTN_STDCALL
00845 FTN_GET_WTIME( void )
00846 {
00847 #ifdef KMP_STUB
00848 return __kmps_get_wtime();
00849 #else
00850 double data;
00851 #if ! KMP_OS_LINUX
00852
00853
00854 if ( ! __kmp_init_serial ) {
00855 __kmp_serial_initialize();
00856 };
00857 #endif
00858 __kmp_elapsed( & data );
00859 return data;
00860 #endif
00861 }
00862
00863 double FTN_STDCALL
00864 FTN_GET_WTICK( void )
00865 {
00866 #ifdef KMP_STUB
00867 return __kmps_get_wtick();
00868 #else
00869 double data;
00870 if ( ! __kmp_init_serial ) {
00871 __kmp_serial_initialize();
00872 };
00873 __kmp_elapsed_tick( & data );
00874 return data;
00875 #endif
00876 }
00877
00878
00879
00880 void * FTN_STDCALL
00881 FTN_MALLOC( size_t KMP_DEREF size )
00882 {
00883
00884 return kmpc_malloc( KMP_DEREF size );
00885 }
00886
00887 void * FTN_STDCALL
00888 FTN_CALLOC( size_t KMP_DEREF nelem, size_t KMP_DEREF elsize )
00889 {
00890
00891 return kmpc_calloc( KMP_DEREF nelem, KMP_DEREF elsize );
00892 }
00893
00894 void * FTN_STDCALL
00895 FTN_REALLOC( void * KMP_DEREF ptr, size_t KMP_DEREF size )
00896 {
00897
00898 return kmpc_realloc( KMP_DEREF ptr, KMP_DEREF size );
00899 }
00900
00901 void FTN_STDCALL
00902 FTN_FREE( void * KMP_DEREF ptr )
00903 {
00904
00905 kmpc_free( KMP_DEREF ptr );
00906 }
00907
00908 void FTN_STDCALL
00909 FTN_SET_WARNINGS_ON( void )
00910 {
00911 #ifndef KMP_STUB
00912 __kmp_generate_warnings = kmp_warnings_explicit;
00913 #endif
00914 }
00915
00916 void FTN_STDCALL
00917 FTN_SET_WARNINGS_OFF( void )
00918 {
00919 #ifndef KMP_STUB
00920 __kmp_generate_warnings = FALSE;
00921 #endif
00922 }
00923
00924 void FTN_STDCALL
00925 FTN_SET_DEFAULTS( char const * str
00926 #ifndef PASS_ARGS_BY_VALUE
00927 , int len
00928 #endif
00929 )
00930 {
00931 #ifndef KMP_STUB
00932 #ifdef PASS_ARGS_BY_VALUE
00933 int len = strlen( str );
00934 #endif
00935 __kmp_aux_set_defaults( str, len );
00936 #endif
00937 }
00938
00939
00940
00941
00942 #ifdef __cplusplus
00943 }
00944 #endif // __cplusplus
00945
00946