Skip to content

Issue 868: Fix 5.1/target/test_target_map_iterators.{F90,c} #869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions tests/5.1/target/test_target_map_iterators.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,28 @@ PROGRAM test_target_map_iterator
CONTAINS
INTEGER FUNCTION test_map_iterator()
INTEGER :: errors, i, listsum
INTEGER, DIMENSION(N) :: test_lst
TYPE t
INTEGER, POINTER :: ptr
END TYPE t
TYPE(t), DIMENSION(N) :: test_lst

errors = 0
listsum = 0

DO i=1, N
test_lst(i) = 1
allocate(test_lst(i)%ptr)
test_lst(i)%ptr = 1
END DO

!$omp target map(iterator(it = 1:N), tofrom: test_lst(it))
!$omp target map(iterator(it = 1:N), tofrom: test_lst(it)%ptr) map(test_lst)
DO i=1, N
test_lst(i) = 2
test_lst(i)%ptr = 2
END DO
!$omp end target

DO i=1, N
listsum = listsum + test_lst(i)
listsum = listsum + test_lst(i)%ptr
deallocate(test_lst(i)%ptr)
END DO

OMPVV_TEST_AND_SET(errors, listsum .NE. 2*N)
Expand Down
12 changes: 7 additions & 5 deletions tests/5.1/target/test_target_map_iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@
int test_case(){
int errors = 0;
int sum = 0;
int test_lst[N];
int *test_lst[N];
for (int i = 0; i<N; i++){
test_lst[i] = 1;
test_lst[i] = (int *) malloc(sizeof(int));
test_lst[i][0] = 1;
}
#pragma omp target map(iterator(it = 0:N), tofrom: test_lst[it])
#pragma omp target map(iterator(it = 0:N), tofrom: test_lst[it][:1]) map(to: test_lst)
{
for(int i = 0; i < N; i++){
test_lst[i] = 2;
test_lst[i][0] = 2;
}
}
for (int i = 0; i < N; i++){
sum += test_lst[i];
sum += test_lst[i][0];
free(test_lst[i]);
}
OMPVV_TEST_AND_SET(errors, (sum != 2*N));
return (errors);
Expand Down