I made this simplified test code
program openmp_test implicit none type :: t_data integer :: size_ integer, allocatable :: counter(:) end type t_data type t_stat integer :: trc(20) end type t_stat type(t_data) :: td type(t_stat) :: ts integer :: i , ip allocate(td% counter(100)) td%size_ = 100 ts% trc = 3 td% counter = 10 ip = 40 !$OMP SIMD do i = 1, 10 ! the loop I want to vectorize ip = ip + 1 td% counter(ip) = td% counter(ip) + 1 ts% trc(8) = ts% trc(8) + 1 enddo do i = 0, 11 print*, td% counter(i+40) enddo print*, "TRC" , ts% trc(8) end program openmp_test
Now my question is how can I correctly/safely make this loop so my ip is incremented corretly and that I get my ts% trc counter correct?
I am aware of some of the different clauses, however, some seem not to work with simd? For example, if I do !$OMP SIMD SHARED(ip) it complains that it was not expecting such clause. Similarly for firstprivate. Is that purposely made?
Also, seems that there is an internal error when doing reduction(+:ts%trc(8)). Does reduction clause normally accepts declared type?. If so, I will report this to intel Support team
I am using ifort 19.0.1