Showing results for 
Search instead for 
Did you mean: 

OpenMP 4.0 task depend too limited would TBB be better?


I have been looking at task depend in OpenMP 4.0 but it looks like it is too limited for what I want to do.

To do what I want it would need to take a vector subscript in the array section in the depend clause.

My code would look something like ths:

type cell_type
    procedure :: process
end type cell_type

type(cell_type), dimension(n) :: cells

type edge_type
    integer, dimension(:), allocatable :: icells
    procedure :: process
end type edge_type

type(edge_type), dimension(m) :: edges ! a bit like a c++ std::vector<std::vector<int>>

edges(1)%icells = [1, 5, 7, 8, 100] ! edge 1 depends on cells 1, 5, 7, 8 and 100
edges(2)%icells = [1, 2, 4] ! edge 2 depends on cells 1, 2 and 4

do i=1,n
!$omp task depend(out:cells(i))
      call cells(i)%process()
!$omp end task
end do

do j=1,m
! next line not allowed
!$omp task depend(out:edges(j)) depend(in:cells(edges(j)%icells))
      call edges(j)%process(cells)
!$omp end task
end do

I could put a barrier between the first loop and the second one but that would mean I could have idle threads while the last few cells in the first loop are being processed.

Am missing something I can do with OpenMP?

Could I use C++ and TBB for this type of problem?

(Are there any issues with TBB calling Fortran via extern "C" and iso_c_binding?)


Tags (1)
0 Kudos
0 Replies