Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTX export not working #255

Closed
A1-TheDarkKnight opened this issue Dec 23, 2024 · 5 comments
Closed

PTX export not working #255

A1-TheDarkKnight opened this issue Dec 23, 2024 · 5 comments
Labels
question further information is requested

Comments

@A1-TheDarkKnight
Copy link

A1-TheDarkKnight commented Dec 23, 2024

Thank you for the beautiful work.
I would like to report that exporting Nvidia PTX code not working.

  • I tried it on the FuildX3D, by uncommenting the "#define PTX" in "opencl.hpp" file. The program compiles fine, but there is no PTX file.
  • I tried the same thing on the "OpenCL-Wrapper" sample project. It didn't compile at all because of an error:
    • "Error C3861 'write_file': identifier not found OpenCL-Wrapper ...\OpenCL-Wrapper\src\opencl.hpp 289"
    • "Error (active) E0020 identifier "write_file" is undefined OpenCL-Wrapper ...\OpenCL-Wrapper\src\opencl.hpp 289"

Specs:
NVidia RTX 3090
Win 11 x64
driver : 551.76 WHQL DCH [r551_71-2]
Visual Sudio 2022

Best Regards

@ProjectPhysX
Copy link
Owner

Hi @A1-TheDarkKnight,

are you running an Nvidia GPU? The PTX export only works with Nvidia hardware.

For the OpenCL-Wrapper, you have to uncomment this line to get it working: https://github.com/ProjectPhysX/OpenCL-Wrapper/blob/master/src/utilities.hpp#L4
I disabled the read_file()/write_file() functions by default to not have the OpenCL-Wrapper include the <fstream>/<filesystem> headers by default, to make it more sleak and reduce compile time.

Kind regards,
Moritz

@A1-TheDarkKnight
Copy link
Author

A1-TheDarkKnight commented Dec 23, 2024

Hi @ProjectPhysX , Yes I am on Nvidia RTX 3090. I forgot to mention the specs. I added the driver specific version too, and visual studio version.
I tried the OpenCL-Wrapper, and It compiled, but still no PTX file.

Best Regards

@ProjectPhysX
Copy link
Owner

Hi @A1-TheDarkKnight,

is it possible that you compiled with latest official Khronos Group OpenCL headers instead of the older OpenCL headers I had shipped?
I have updated to the latest OpenCL headers in v3.1, and during the update I realized that the API return type of cl_program.getInfo<CL_PROGRAM_BINARIES>() was changed so conversion to string now failed. A fix was necessary to accomodate for new return type. Now it is:

string ptx = (char*)&cl_program.getInfo<CL_PROGRAM_BINARIES>()[0][0];

Kind regards,
Moritz

@A1-TheDarkKnight
Copy link
Author

A1-TheDarkKnight commented Feb 10, 2025

@ProjectPhysX Hi there, sorry for being late.
It works now. Thank you very much 👍 .

By the way for anyone who doesn't see the PTX file after compilation, you will not see it.
You need to run the program once, then you will see a folder called "bin" near the program, inside it you will find the ptx file.

Best Regards

@ProjectPhysX
Copy link
Owner

Great! Yes the OpenCL kernels are only compiled at runtime, so have to start the executable once to get PTX output.

Kind regards,
Moritz

@ProjectPhysX ProjectPhysX added the question further information is requested label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants