Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17047 Discussions

Combine Altera OpenCL SDK with other OpenCL platform

Altera_Forum
Honored Contributor II
1,060 Views

Hi, 

 

is it possible to combine Altera OpenCL platform with other OpenCL platform (e.g. NVIDIA) so that I can use both devices together in my host application? I wrote a code to list all available platforms on my machine. I could only list one platform either it's Altera or NVIDIA, depends on to which library I linked the compilation, libalterahalmmd.so or libOpenCL.so. How can I get both devices work together? 

 

Thanks, 

Daes
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
288 Views

At the moment the OpenCL SDK does not support ICD. I don't remember what ICD stands for but that's what allows SDKs from multiple vendors to coexist on a single host which is why you are running into the behavior you are seeing. Since OpenCL is a standard what ICD does is ensure that when linking occurs you don't end up with multiple libraries (in this case Altera and Nvidia) providing the same APIs (just like how you can't have an application with two functions like main, or foo for example). 

 

I have not attempted to try either of these but two ways I can think of to work around this: 

 

1) Split the application into two and pass data between them when necessary. That would allow you to target the SDKs independently 

 

2) Compile the Altera specific portion into a static library that your host application can use so that it uses different libraries than the other SDK. 

 

If you attempt to do this I recommend creating a very simple test case such as "Hello world" and seeing if you can utilize both SDKs concurrently. If you are sucessful please post your findings since there are a few users that would be interested (including myself).
0 Kudos
Altera_Forum
Honored Contributor II
288 Views

I tried to use both OpenCL libraries from NVIDIA and Altera using dynamic loading. I modified the code for listing OpenCL platform from here (http://dhruba.name/2012/08/13/opencl-cookbook-listing-all-platforms-and-their-attributes/) by loading all OpenCL libraries from Altera (version 13.0sp1.234). I also loaded their dependencies along. Now, I can list the platform from Altera and NVIDIA separately but in one host application.  

 

However, I found problem when loading NVIDIA library first, followed by Altera. There's segmentation fault after I allocate memory for cl_platform_id and call clgetplatformids(). The order matters here. I still couldn't figure out why. I attached the source code and library files that I used. You can adjust them to your machine's environment. I would really appreciate if somebody could give me the idea why this error happened. 

 

Cheers!
0 Kudos
Reply