# clCreateProgramFromBinary() failing with CUDA 3.0 Toolkit

**URL:** <https://forums.developer.nvidia.com/t/clcreateprogramfrombinary-failing-with-cuda-3-0-toolkit/15648>\
**Category:** CUDA Programming and Performance\
**Created:** [March 23, 2010, 12:43pm UTC](https://forums.developer.nvidia.com/t/clcreateprogramfrombinary-failing-with-cuda-3-0-toolkit/15648 "2010-03-23T12:43:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MJH22](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@MJH22](https://forums.developer.nvidia.com/u/MJH22)\
**Post date:** [March 23, 2010, 12:43pm UTC](https://forums.developer.nvidia.com/t/clcreateprogramfrombinary-failing-with-cuda-3-0-toolkit/15648/1 "2010-03-23T12:43:32Z")

</div>

Hi

I have a library with uses clCreateProgramWithBinary() to instantiate a program from a binary object obtained from clGetProgramInfo( CL\_PROGRAM\_BINARY\_INFO ).

This worked happily with previous releases but with 3.0, the clCPWB() call returns error -42 (INVALID\_BINARY). The program binary retrieved with cGPI() is PTX code, as in previous releases, but it seems that the runtime no longer accepts PTX binary objects.

Is this a known issue? What type of binary object is now acceptable, and how can I obtain it?

Ta,

MJH

---

<div class="post-metadata">

**Author:** ![Keldor314](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keldor314](https://forums.developer.nvidia.com/u/Keldor314)\
**Post date:** [May 6, 2010, 11:55am UTC](https://forums.developer.nvidia.com/t/clcreateprogramfrombinary-failing-with-cuda-3-0-toolkit/15648/2 "2010-05-06T11:55:01Z")

</div>

Yeah, I’m having the same problem. It would be nice to be able to a. reuse compiled code on multiple identical devices, and b. work around the lack of thread safety in the compiler by offloading compilation to another process. Compilation time is currently the bottleneck in my application, so this is a big issue.

Note that the failure actually occurs on clCreateKernel, which then returns CL\_INVALID\_PROGRAM\_EXECUTABLE.

---

<div class="post-metadata">

**Author:** ![Keldor314](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keldor314](https://forums.developer.nvidia.com/u/Keldor314)\
**Post date:** [May 6, 2010, 12:19pm UTC](https://forums.developer.nvidia.com/t/clcreateprogramfrombinary-failing-with-cuda-3-0-toolkit/15648/3 "2010-05-06T12:19:05Z")

</div>

I figured it out. You have to call clBuildProgram after you call clCreateProgramWithBinary. Unintuitive, but it works!
