- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've recently been involved in porting an application to Nvidia's CUDA platform, and now we are looking to also support the Intel Phi platform. It looks like a lot of things are relatively easy to do if you have the parallelism set up with OpenMP on the host, but I had some specific questions about how function pointers are set up to figure out what is the same/different between the CUDA setup and the Intel setup.
I saw in the documentation that one version of the memory model for copying between host RAM and card RAM was the idea of shared memory using Cilk, where you do a "shared malloc" and apparently the compiler does some magic to make the virtual addresses the same on both host and device, thus you can assemble complex classes that actually have the same pointers (such as a linked list). I was wondering if this virtual address space trick was also extended to function locations? Aka if I set a pointer to a function on the host, is the pointer valid on the device (assuming the function is marked as target(mic))? Also along a similar line, if I have classes such as the following:
class A { virtual void foo() = 0; };
class B : public class A { virtual void foo() {} };
can I bitwise-copy an instance of class B to the device and expect to be able to call foo() on that object? Or is the v-table going to be invalid on the device because it is not in the same place as it is on the host?
Essentially, putting these two points together, the overall question would be: Can you use the Cilk shared malloc strategy on classes containing a v-table? Or would the fact that the class is effectively instantiated on the host and implicitly bitwise-copied to the device cause the v-table pointers to be broken on the device?
Thanks for your help answering these questions.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page