Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

[OMP, C++] Threadprivate with Intel Compiler decreases performance

schulz__christof
Beginner
386 Views

Hi, 
I have parallelized  my program with OpenMP. I have many of these "#pragma omp threadprivate" directives in my code:

static float cost_penalty;
static float bc_penalty;
static float explicit_cost;
static float time_penal_piece_link_below;
static float time_penal_piece_link_above;
static float time_penal_piece_below;
static float time_penal_piece_above;
static float time_penal_paid_below;
static float time_penal_paid_above;
static float time_penal_work_below;
static float time_penal_work_above;
static float br_cost_penalty;
static float br_bc_penalty;
static int   is_tripper_pre = 0;
static int   is_tripper_h_res = 0;
static int   is_tripper = 0;
static int   have_break_rule = 0;
static int   have_break_intervals = SCHED_FALSE;

#ifdef _OPENMP
#pragma omp threadprivate ( cost_penalty,       \
                            bc_penalty,         \
                            br_cost_penalty,    \
                            br_bc_penalty,    \
                            is_tripper_pre,     \
                            is_tripper_h_res,   \
                            is_tripper,         \
                            have_break_rule,    \
														explicit_cost,                    \
                            time_penal_piece_link_below,    \
                            time_penal_piece_link_above, \
                            time_penal_piece_below,       \
                            time_penal_piece_above,        \
                            time_penal_paid_below,      \
                            time_penal_paid_above,        \
                            time_penal_work_below,  \
                            time_penal_work_above )
#endif

With the msvc 2017 Professional Compiler I get the following running times:

  • Without OpenMP:                   15 seconds
  • With OpenMP and one thread: 15 seconds

Now I have build my program with the free Trial version of Intel Parallel Studio XE 2017. When I switch to the Intel Compiler I have these running times:

  • Without OpenMP:                                                  14 seconds
  • With OpenMP and one thread:                                25 seconds
  • With OpenMP and one thread without threadprivate: 15 seconds

Why is the Intel Compiler so slow in comparison to the msvc 2017 Compiler? Do I have to set any compiler flag to fix this problem?

Thank you for your Help,

Christof

 

0 Kudos
0 Replies
Reply