Hello,
I encounter an error when compiling my software when activating openMP. This is a small program showing what I want to do :
program test_threadsafety use omp_lib implicit none integer :: i, nb nb = 20 !$omp parallel default(shared) !$omp do schedule(runtime) do i = 1, nb call make_save_variable(i) end do !$omp end do !$omp end parallel contains subroutine make_save_variable(i) implicit none integer, intent(in) :: i !$omp threadprivate(thread_id) integer, save :: thread_id = -1 if( thread_id == -1 ) then print *,'getting thread id ' thread_id = omp_get_thread_num() end if print *, 'in thread ', thread_id, ' iterator : ', i end subroutine end program
I have to say that it works fine with gfortran.... I run a 17.0.4 version of ifort.
Is this a bug or am I doing something wrong ?
Thanks for the help...