Dear All, Help I have a subroutine search value for array below PART1
Can I use openmp derivative increase search speed? like PART2
PART1
subroutine p_search(array, length, value, location) implicit none integer length integer,dimension(length) :: array logical,dimension(length) :: ref integer value integer location ref = .false. where( array .eq. value) ref = .true. if( count( ref ) .ne. 1 )then write(*,*)"p_search: error count(ref)=",count(ref) write(*,*)"array=",array write(*,*)"value=",value stop else location = maxloc(array,1,ref) endif return end subroutine p_search
PART2
subroutine p_search(array, length, value, location) implicit none integer length integer,dimension(length) :: array logical,dimension(length) :: ref integer value integer location ref = .false. !$OMP PARALLEL where( array .eq. value) ref = .true. !$OMP PARALLEL if( count( ref ) .ne. 1 )then write(*,*)"p_search: error count(ref)=",count(ref) write(*,*)"array=",array write(*,*)"value=",value stop else location = maxloc(array,1,ref) endif return end subroutine p_search