Force a certain ptx version

Hi,

is it possible to define the ptx version that nvrtcCompileProgram creates?

Thanks,
Daniel

Did you check the documentation? https://docs.nvidia.com/cuda/nvrtc/index.html#group__options

Hi,

yes - I did. That is the reason why I’m asking here. I think you are pointing to the “compute/architecture” version which you can define by setting the --gpu-architecture value, but this is not what I asked. I’m looking for the version of the generated ptx file. The 11.6 cuda JIT compiler generates a ptx file of the version 7.6, but I want the compiler to generate a ptx file that is compatible to a different - lower - version.

Thank you for clarification. In that case I have misunderstood your question

No, its not possible. Anything you build with CUDA toolkit 11.6 requires a GPU driver on the target machine that supports CUDA 11.6. In such a situation, the ptx version will work. Likewise, anything built with an older CUDA toolkit will work on a target machine that has a GPU driver compatible with CUDA 11.6

Those are the compatibility scenarios, and in those cases the PTX version will not be an issue. There is no defined compatibility path for CUDA 11.6 to build things that are usable in machine that does not support CUDA 11.6, either by direct driver support or by the compatibility library method.

Hi- Yes, this was my question. Thanks a lot for the information.

I run still into an issue where I could need some help. In my application I like to be able to run the kernel on the customers configuration. I do not know it in advance, but I like to give best performance at the same time. In my application I use JIT compilation to be able to react on the customer computer configuration.

So assume that I have 3 customers:

  1. 1070 with an old driver that allows cuda 10.2
  2. 1070 with latest driver that allows cuda 11.6
  3. 1050 Ti with almost new driver allowing cuda 11.5

If my understanding is correct I can get the best available cuda version calling:

int iCudaVersionInstalled;
nvmlReturn_t l_nError =nvmlSystemGetCudaDriverVersion( &iCudaVersionInstalled );

And I can get the compute version of the device ( cuDevice → cuda device id):

int nComputeMajor;
cuDeviceGetAttribute(&nComputeMajor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice);

int nComputeMinor;
cuDeviceGetAttribute(&nComputeMinor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice);

Is there any way, that my application can load the correct libraries at runtime (LoadLibrary) to support the customer configuration - independed from the installed cuda version? For example: I can load to support a cuda 11.2 environment the library “nvrtc64_112_0.dll” and get the entry points of the required functions. Or do I need to provide the customers with binaries compiled for each of these cuda version? One for 10.2, one for 11.6 and one for 11.5?

Thanks for your help.

The issue is the GPU driver installed on each customer’s machine, not the installed CUDA version.

The customer with the “old driver” will prevent you from using any CUDA tookit version or component version (eg. nvrtc library component) that comes from a newer CUDA toolkit version than what is supported by that old driver.

Thanks for your fast reply. Yes, but what are my options for this situation? Do I need to create/compile binaries for each possible cuda version that I need because the customer do not want to update the driver? Or can I ‘somehow’ develop a generic binary that can react on the different cuda requirements (what I would prefer)?

Thanks for your help.

A typical option would be to

  • determine what is the oldest driver version in your fleet or customer base (that you want to support)
  • use a CUDA toolkit for development that is supported by that driver version
  • build SASS for the GPUs recognized by that driver version (that you want to support)
  • build PTX against the highest architecture supported by that driver version, to support all other/newer GPUs

The makefile system in the CUDA sample codes does “roughly” this.

You could also ship multiple binaries.
You could also expect customers to update the GPU driver on older machines (indicate the lowest driver version you can support.)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.