omp initializer not properly set

omp initializer not properly set

hi all

the following code is bugus.

v

 

 ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.106 Build 20131008
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

cat intel_reduction.f90
program test
  use omp_lib
  implicit none
  integer :: i
  !i=0 !omp initializer wrongly set
  !$omp parallel reduction(+:i)
  i=1
  !$omp end parallel
  if(i.ne.omp_get_max_threads()) then
     write(*,*) i
     stop 'err1'
  endif
end program test
export OMP_NUM_THREADS=4; ifort -fopenmp intel_reduction.f90   ;  ./a.out
       32771
err1

 

 

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

... i should have initialized the var.

my mistake!

v

Leave a Comment

Please sign in to add a comment. Not a member? Join today