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
OpenMP-Accelerators: interoperability
Forum rules
This forum is now closed.
This forum is now closed.
-
- Posts: 2
- Joined: Fri Nov 30, 2012 1:24 am
- Location: Lugano, Switzerland
-
- Posts: 2
- Joined: Mon Dec 17, 2012 2:11 pm
Re: OpenMP-Accelerators: interoperability
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);
}
}
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);
}
}
-
- Posts: 2
- Joined: Fri Nov 30, 2012 1:24 am
- Location: Lugano, Switzerland
Re: OpenMP-Accelerators: interoperability
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
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
Re: OpenMP-Accelerators: interoperability
Ravi which one did you end up going for? Excuse my newbieness but I'm just curiousJPoznanovic 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