<html><body><p>Hi Ahmed,<br><br>I am experimenting with LTO, but as you said, it's still *very* hacky.<br><br>Here's what I did.  First compile the CUDA GPU OMP runtime with Clang (rather than nvcc) to bitcode.  When I looked at Clang-CUDA a couple of weeks ago I could only get device side bitcode by using the temporary files generated after passing -save-temps to Clang.  The OMP-GPU version of LLVM that you are using is not up to date with trunk, so I had to do a bit of massaging on the generated IR.<br><br>I then had to manually link the various device side bitcodes, call opt, llc, ptxas, and finally link it with the host object file.<br><br>We don't have support for this in the driver as yet but once we move to trunk I will look into streamlining this.<br><br>Thanks,<br>Arpith<br><br><img width="16" height="16" src="cid:1__=8FBBF5D3DFC225E58f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Ahmed ElTantawy ---01/20/2016 08:44:38 AM---Hi, I see now that the linking happens at the binary leve"><font color="#424282">Ahmed ElTantawy ---01/20/2016 08:44:38 AM---Hi, I see now that the linking happens at the binary level. I was wondering</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Ahmed ElTantawy <ahmede@ece.ubc.ca></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Arpith C Jacob/Watson/IBM@IBMUS</font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">llvm-dev@lists.llvm.org, "Bataev, Alexey" <alexey.bataev@intel.com></font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">01/20/2016 08:44 AM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: Executing OpenMP 4.0 code on Nvidia's GPU</font><br><font size="2" color="#5F5F5F">Sent by:        </font><font size="2">ahmed.mohammed.eltantawy@gmail.com</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><font size="4">Hi,<br></font><br><font size="4">I see now that the linking happens at the binary level. I was wondering whether it is possible to link to the OpenMP runtime library at the LLVM IR level (to enable LTO optimizations for the code after library calls has been replaced). <br><br>I have done this before by linking to the bitcode of a file that contains the compiled CUDA implementation of the OpenMP runtime library. But it was a bit hacky, and offloading was not supported yet. Is it there a cleaner/standard way to do this ?<br></font><br><font size="4">Thanks.</font><br><br><font size="4">On Wed, Jan 20, 2016 at 5:09 AM, Ahmed ElTantawy <</font><a href="mailto:ahmede@ece.ubc.ca" target="_blank"><u><font size="4" color="#0000FF">ahmede@ece.ubc.ca</font></u></a><font size="4">> wrote:</font><ul><font size="4">Hi Arpith,<br></font><br><font size="4">That is exactly what it is :). <br><br>My bad, I thought I copied over the libraries to where LIBRARY_PATH pointing but apparently it was copied to a wrong destination.<br></font><br><font size="4">Thanks a lot.</font><br><br><font size="4">On Wed, Jan 20, 2016 at 4:51 AM, Arpith C Jacob <</font><a href="mailto:acjacob@us.ibm.com" target="_blank"><u><font size="4" color="#0000FF">acjacob@us.ibm.com</font></u></a><font size="4">> wrote:</font><br><font size="4">Hi Ahmed,<br><br>nvlink is unable to find the GPU OMP runtime library in its path. Does LIBRARY_PATH point to the right location? You could try passing the "-v" option to clang to get more information.<br><br>Regards,<br>Arpith</font><p></ul><br><BR>
</body></html>