Mapping pointers in C/C++

Discuss the OpenMP 4.0 API Specifications released July 2013 (Read Only)

Mapping pointers in C/C++

Postby omperminator » Thu Sep 17, 2015 4:39 am

Lets' consider this piece of code:
Code: Select all
void foo(int* a){
    #pragma omp target map(a)
    {
        a++;
    }
}


I didn't find exact mention about passing pointer to map clause in the specification.
Does this mapping mean mapping the value of a pointer - address 'a', mapping value pointed by 'a' or something different?

C/C++ examples only pass pointers together with array section but there is no explicit requirement that pointers need to be mapped with array sections.

The same problem occurs when mapping arrays as pointers:
Code: Select all
void foo(int* a){
    #pragma omp target map(a)
    {
        //Can we write 'a[0] = 1' and expect assignment of 1 to the first element of tab?
        //Can we write a++ and expect 'a' to point to the second element after exiting target region?
    }
}

void bar(){
    int tab[100];
    foo(tab);
}
omperminator
 
Posts: 1
Joined: Thu Sep 17, 2015 4:00 am

Return to OpenMP 4.0 API Specifications

Who is online

Users browsing this forum: No registered users and 2 guests