OpenMP-Accelerators: interoperability

Forum for the public review of the OpenMP 4.0 API Release Candidates. (Read Only)
Forum rules
This forum is now closed.
Locked
JPoznanovic
Posts: 2
Joined: Fri Nov 30, 2012 1:24 am
Location: Lugano, Switzerland

OpenMP-Accelerators: interoperability

Post by JPoznanovic »

Hello,

How does OpenMP (for accelerator targets) provide interoperability between itself and another programming language or numerical library? (e.g. keeping data persistent on the device between OpenMP accelerator regions and an external accelerator-targeted library call)

Seems like there should be a way to expose and/or use device data addresses on the host side. Without this, it seems like it would be difficult to allow device data persistence between uses of OpenMP and alternative approaches.

Please let me know your plans on this topic and/or if I've overlooked something.

Thanks,

Jeff

RaviNarayanaswamy
Posts: 2
Joined: Mon Dec 17, 2012 2:11 pm

Re: OpenMP-Accelerators: interoperability

Post by RaviNarayanaswamy »

The OpenMP-Accelerator sub-committee understands the need for being able to pass around a device pointer address.
We are discussing 2 alternatives 1) specify "ptr" attribute to a pointer to indicate the value of the pointer should be sent/received as show in Example 1
or 2) if you use “p” instead of p[:] in map clause then the pointer value is sent instead of what it points to


Example 1
foo()
{
int *p;

#pragma target mapfrom(ptr:p) {
p = malloc(100*sizeof(int));
initialize(p);
}

#pragma target mapto(ptr:p)
{
Use(p);
free(p);
}
}

JPoznanovic
Posts: 2
Joined: Fri Nov 30, 2012 1:24 am
Location: Lugano, Switzerland

Re: OpenMP-Accelerators: interoperability

Post by JPoznanovic »

Dear Ravi,

I think this makes sense, as it appears to work in two key situations:

1) If the device data was allocated by the alternative approach and then used by OpenMP

2) If the device data was allocated by OpenMP and then used by the alternative approach

Thanks for the response.

Regards,

Jeff

wapeter
Posts: 1
Joined: Tue Apr 23, 2013 9:30 am

Re: OpenMP-Accelerators: interoperability

Post by wapeter »

JPoznanovic wrote:Dear Ravi,

I think this makes sense, as it appears to work in two key situations:

1) If the device data was allocated by the alternative approach and then used by OpenMP

2) If the device data was allocated by OpenMP and then used by the alternative approach

Thanks for the response.

Regards,

Jeff
Ravi which one did you end up going for? Excuse my newbieness but I'm just curious
Peter
Ever had dreams about snakes? Use dream dictionary now to find out the meaning.

Locked