[Openmp-commits] [openmp] r248178 - Fix the OpenMP 3.0 build

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Mon Sep 21 10:24:47 PDT 2015


Author: jlpeyton
Date: Mon Sep 21 12:24:46 2015
New Revision: 248178

URL: http://llvm.org/viewvc/llvm-project?rev=248178&view=rev
Log:
Fix the OpenMP 3.0 build

This change adds guards to the code in places where they are missing to enable
the OpenMP 3.0 build.

Patch by Diego Caballero and Johnny Peyton

Mailing List: http://lists.llvm.org/pipermail/openmp-dev/2015-September/000935.html

Modified:
    openmp/trunk/runtime/src/kmp_barrier.cpp
    openmp/trunk/runtime/src/kmp_debugger.c
    openmp/trunk/runtime/src/kmp_dispatch.cpp
    openmp/trunk/runtime/src/kmp_omp.h
    openmp/trunk/runtime/src/kmp_runtime.c
    openmp/trunk/runtime/src/kmp_sched.cpp
    openmp/trunk/runtime/src/kmp_settings.c

Modified: openmp/trunk/runtime/src/kmp_barrier.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_barrier.cpp?rev=248178&r1=248177&r2=248178&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_barrier.cpp (original)
+++ openmp/trunk/runtime/src/kmp_barrier.cpp Mon Sep 21 12:24:46 2015
@@ -735,9 +735,11 @@ __kmp_hierarchical_barrier_gather(enum b
     register kmp_uint64 new_state;
 
     int level = team->t.t_level;
+#if OMP_40_ENABLED
     if (other_threads[0]->th.th_teams_microtask)    // are we inside the teams construct?
         if (this_thr->th.th_teams_size.nteams > 1)
             ++level; // level was not increased in teams construct for team_of_masters
+#endif
     if (level == 1) thr_bar->use_oncore_barrier = 1;
     else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested
 
@@ -908,12 +910,14 @@ __kmp_hierarchical_barrier_release(enum
     }
 
     int level = team->t.t_level;
+#if OMP_40_ENABLED
     if (team->t.t_threads[0]->th.th_teams_microtask ) {    // are we inside the teams construct?
         if (team->t.t_pkfn != (microtask_t)__kmp_teams_master && this_thr->th.th_teams_level == level)
             ++level; // level was not increased in teams construct for team_of_workers
         if( this_thr->th.th_teams_size.nteams > 1 )
             ++level; // level was not increased in teams construct for team_of_masters
     }
+#endif
     if (level == 1) thr_bar->use_oncore_barrier = 1;
     else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested
     nproc = this_thr->th.th_team_nproc;

Modified: openmp/trunk/runtime/src/kmp_debugger.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_debugger.c?rev=248178&r1=248177&r2=248178&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_debugger.c (original)
+++ openmp/trunk/runtime/src/kmp_debugger.c Mon Sep 21 12:24:46 2015
@@ -110,11 +110,13 @@ __kmp_omp_debug_struct_info = {
     offset_and_size_of( kmp_base_info_t,   th_bar ),
     offset_and_size_of( kmp_bstate_t,      b_worker_arrived ),
 
+#if OMP_40_ENABLED
     // teams information
     offset_and_size_of( kmp_base_info_t, th_teams_microtask),
     offset_and_size_of( kmp_base_info_t, th_teams_level),
     offset_and_size_of( kmp_teams_size_t, nteams ),
     offset_and_size_of( kmp_teams_size_t, nth ),
+#endif
 
     // kmp_desc structure (for info field above)
     sizeof( kmp_desc_base_t ),
@@ -140,7 +142,9 @@ __kmp_omp_debug_struct_info = {
     offset_and_size_of( kmp_base_team_t,   t_pkfn       ),
     offset_and_size_of( kmp_base_team_t,   t_task_team ),
     offset_and_size_of( kmp_base_team_t,   t_implicit_task_taskdata ),
+#if OMP_40_ENABLED
     offset_and_size_of( kmp_base_team_t,   t_cancel_request ),
+#endif
     offset_and_size_of( kmp_base_team_t,   t_bar ),
     offset_and_size_of( kmp_balign_team_t, b_master_arrived ),
     offset_and_size_of( kmp_balign_team_t, b_team_arrived ),
@@ -200,6 +204,7 @@ __kmp_omp_debug_struct_info = {
     offset_and_size_of( kmp_taskdata_t, td_taskwait_counter ),
     offset_and_size_of( kmp_taskdata_t, td_taskwait_thread  ),
 
+#if OMP_40_ENABLED
     offset_and_size_of( kmp_taskdata_t, td_taskgroup        ),
     offset_and_size_of( kmp_taskgroup_t, count              ),
     offset_and_size_of( kmp_taskgroup_t, cancel_request     ),
@@ -211,6 +216,7 @@ __kmp_omp_debug_struct_info = {
     offset_and_size_of( kmp_base_depnode_t, task            ),
     offset_and_size_of( kmp_base_depnode_t, npredecessors   ),
     offset_and_size_of( kmp_base_depnode_t, nrefs           ),
+#endif
     offset_and_size_of( kmp_task_t, routine                 ),
 
     // thread_data_t.

Modified: openmp/trunk/runtime/src/kmp_dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.cpp?rev=248178&r1=248177&r2=248178&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.cpp (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.cpp Mon Sep 21 12:24:46 2015
@@ -2224,9 +2224,9 @@ __kmp_dist_get_bounds(
         }
     }
     th = __kmp_threads[gtid];
-    KMP_DEBUG_ASSERT(th->th.th_teams_microtask);   // we are in the teams construct
     team = th->th.th_team;
     #if OMP_40_ENABLED
+    KMP_DEBUG_ASSERT(th->th.th_teams_microtask);   // we are in the teams construct
     nteams = th->th.th_teams_size.nteams;
     #endif
     team_id = team->t.t_master_tid;

Modified: openmp/trunk/runtime/src/kmp_omp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_omp.h?rev=248178&r1=248177&r2=248178&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_omp.h (original)
+++ openmp/trunk/runtime/src/kmp_omp.h Mon Sep 21 12:24:46 2015
@@ -109,11 +109,13 @@ typedef struct {
     offset_and_size_t  th_bar;
     offset_and_size_t  th_b_worker_arrived; // the worker increases it by 1 when it arrives to the barrier
 
+#if OMP_40_ENABLED
     /* teams information */
     offset_and_size_t th_teams_microtask;// entry address for teams construct
     offset_and_size_t th_teams_level;    // initial level of teams construct
     offset_and_size_t th_teams_nteams;   // number of teams in a league
     offset_and_size_t th_teams_nth;      // number of threads in each team of the league
+#endif
 
     /* kmp_desc structure (for info field above) */
     kmp_int32          ds_sizeof_struct;
@@ -133,7 +135,9 @@ typedef struct {
     offset_and_size_t  t_pkfn;
     offset_and_size_t  t_task_team;      // task team structure
     offset_and_size_t  t_implicit_task;  // taskdata for the thread's implicit task
+#if OMP_40_ENABLED
     offset_and_size_t  t_cancel_request;
+#endif
     offset_and_size_t  t_bar;
     offset_and_size_t  t_b_master_arrived; // increased by 1 when master arrives to a barrier
     offset_and_size_t  t_b_team_arrived;   // increased by one when all the threads arrived
@@ -194,6 +198,7 @@ typedef struct {
     offset_and_size_t  td_taskwait_counter;
     offset_and_size_t  td_taskwait_thread;          // gtid + 1 of thread encountered taskwait
 
+#if OMP_40_ENABLED
     /* Taskgroup */
     offset_and_size_t  td_taskgroup;                // pointer to the current taskgroup
     offset_and_size_t  td_task_count;               // number of allocated and not yet complete tasks
@@ -207,6 +212,7 @@ typedef struct {
     offset_and_size_t  dn_task;
     offset_and_size_t  dn_npredecessors;
     offset_and_size_t  dn_nrefs;
+#endif
     offset_and_size_t  dn_routine;
 
     /* kmp_thread_data_t */

Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=248178&r1=248177&r2=248178&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Mon Sep 21 12:24:46 2015
@@ -2362,9 +2362,11 @@ __kmp_join_call(ident_t *loc, int gtid
         //     But there is barrier for external team (league).
         __kmp_internal_join( loc, gtid, team );
     }
+#if OMP_40_ENABLED
     else {
         master_th->th.th_task_state = 0; // AC: no tasking in teams (out of any parallel)
     }
+#endif /* OMP_40_ENABLED */
 
     KMP_MB();
 

Modified: openmp/trunk/runtime/src/kmp_sched.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_sched.cpp?rev=248178&r1=248177&r2=248178&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_sched.cpp (original)
+++ openmp/trunk/runtime/src/kmp_sched.cpp Mon Sep 21 12:24:46 2015
@@ -424,10 +424,10 @@ __kmp_dist_for_static_init(
     }
     tid = __kmp_tid_from_gtid( gtid );
     th = __kmp_threads[gtid];
-    KMP_DEBUG_ASSERT(th->th.th_teams_microtask);   // we are in the teams construct
     nth = th->th.th_team_nproc;
     team = th->th.th_team;
     #if OMP_40_ENABLED
+    KMP_DEBUG_ASSERT(th->th.th_teams_microtask);   // we are in the teams construct
     nteams = th->th.th_teams_size.nteams;
     #endif
     team_id = team->t.t_master_tid;
@@ -662,9 +662,9 @@ __kmp_team_static_init(
         }
     }
     th = __kmp_threads[gtid];
-    KMP_DEBUG_ASSERT(th->th.th_teams_microtask);   // we are in the teams construct
     team = th->th.th_team;
     #if OMP_40_ENABLED
+    KMP_DEBUG_ASSERT(th->th.th_teams_microtask);   // we are in the teams construct
     nteams = th->th.th_teams_size.nteams;
     #endif
     team_id = team->t.t_master_tid;

Modified: openmp/trunk/runtime/src/kmp_settings.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.c?rev=248178&r1=248177&r2=248178&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.c (original)
+++ openmp/trunk/runtime/src/kmp_settings.c Mon Sep 21 12:24:46 2015
@@ -2926,11 +2926,12 @@ __kmp_stg_parse_proc_bind( char const *
             // OMP_PROC_BIND => granularity=core,scatter elsewhere
             //
             __kmp_affinity_type = affinity_scatter;
-            if( __kmp_mic_type != non_mic ) {
+#  if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+            if( __kmp_mic_type != non_mic )
                 __kmp_affinity_gran = affinity_gran_fine;
-            } else {
+            else
+#  endif
                 __kmp_affinity_gran = affinity_gran_core;
-            }
     }
     else {
         __kmp_affinity_type = affinity_none;




More information about the Openmp-commits mailing list