- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am currently trying to use the *task* construct of OpenMP 4.0 including the *depend* statement for my Fortran codes. Therefore, I create the following example, which should fill up the first row of a matrix with the numbers 1 to M by a task and fill up the remaining elements by a task each whenever the element in the first row is ready. This results in the following piece of code:
PROGRAM OMP_TEST
IMPLICIT NONE
INTEGER K,L
INTEGER M
PARAMETER (M = 8)
INTEGER A(M,M)
A(1:M, 1:M) = 0
!$omp parallel
!$omp single
DO L=1, M
!$omp task depend(out:A(1,L)) default(shared)
A(1,L) = L
!$omp end task
DO K = 2, M
!$omp task depend(in:A(1,L)) default(shared)
A(K,L) = A(1,L)
!$omp end task
END DO
END DO
!$omp taskwait
!$omp end single
!$omp end parallel
DO K =1 , M
WRITE(*,*) A(K,1:M)
END DO
END PROGRAM
Compile with the Intel Fortran 15 compiler, which is according to the documentation aware of the *depend* statement. But the result printed to the screen is different at every execution. Even the initial zeros of the matrix stay at some positions. For example:
1 2 3 4 5 6
7 8
0 0 0 0 0 0
0 0
0 0 3 4 0 0
0 8
1 0 3 4 0 6
0 8
1 0 3 4 5 6
0 8
1 2 3 4 5 6
7 8
0 2 3 4 5 6
7 0
1 2 3 4 5 6
0 8
Why does the dependencies between the task do not work correctly as I expect it such that the values 1 to 8 are in each row?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see similar results with more than two threads. It appears to be a defect. I escalated to Development and will let you know what I hear back.
(Internal tracking id: DPD200413379)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried the same example with icc 15 and ported the code to C and the same happens.
Here is the code in this case:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int M = 16;
int i,j;
int A[M*M];
for (i = 0; i < M; i++) {
for (j = 0; j < M; j++) {
A[j*M+i] = 0;
}
}
#pragma omp parallel
{
#pragma omp single
{
for (j = 0; j < M; j++) {
#pragma omp task depend(out:A[M*j]) default(shared)
{
A[M*j] = (j+1);
}
for (i = 1; i < M; i++) {
#pragma omp task depend(in:A[M*j]) default(shared)
A[i+j*M] = A[M*j];
}
}
}
#pragma omp taskwait
}
for (i = 0; i < M; i++) {
for (j = 0; j < M; j++) {
printf("%4d", A[i+M*j]);
}
printf("\n");
}
return 0;
}
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page