Class NVRTC


  • public class NVRTC
    extends java.lang.Object
    Contains bindings to NVRTC, a runtime compilation library for CUDA C++.
    • Method Detail

      • getLibrary

        public static org.lwjgl.system.SharedLibrary getLibrary()
        Returns the NVRTC SharedLibrary.
      • nnvrtcGetErrorString

        public static long nnvrtcGetErrorString​(int result)
        Unsafe version of: GetErrorString
      • nvrtcGetErrorString

        @Nullable
        public static java.lang.String nvrtcGetErrorString​(int result)
        A helper function that returns a string describing the given nvrtcResult code, e.g., SUCCESS to "NVRTC_SUCCESS".

        For unrecognized enumeration values, it returns "NVRTC_ERROR unknown".

        Parameters:
        result - CUDA Runtime Compilation API result code
        Returns:
        message string for the given nvrtcResult code
      • nnvrtcVersion

        public static int nnvrtcVersion​(long major,
                                        long minor)
        Unsafe version of: Version
      • nvrtcVersion

        public static int nvrtcVersion​(java.nio.IntBuffer major,
                                       java.nio.IntBuffer minor)
        Sets the output parameters major and minor with the CUDA Runtime Compilation version number.
        Parameters:
        major - CUDA Runtime Compilation major version number
        minor - CUDA Runtime Compilation minor version number
      • nnvrtcGetNumSupportedArchs

        public static int nnvrtcGetNumSupportedArchs​(long numArchs)
        Unsafe version of: GetNumSupportedArchs
      • nvrtcGetNumSupportedArchs

        public static int nvrtcGetNumSupportedArchs​(java.nio.IntBuffer numArchs)
        Sets the output parameter numArchs with the number of architectures supported by NVRTC.

        This can then be used to pass an array to GetSupportedArchs to get the supported architectures.

        Parameters:
        numArchs - number of supported architectures
      • nnvrtcGetSupportedArchs

        public static int nnvrtcGetSupportedArchs​(long supportedArchs)
        Unsafe version of: GetSupportedArchs
      • nvrtcGetSupportedArchs

        public static int nvrtcGetSupportedArchs​(java.nio.IntBuffer supportedArchs)
        Populates the array passed via the output parameter supportedArchs with the architectures supported by NVRTC.

        The array is sorted in the ascending order. The size of the array to be passed can be determined using GetNumSupportedArchs.

        Parameters:
        supportedArchs - sorted array of supported architectures
      • nnvrtcCreateProgram

        public static int nnvrtcCreateProgram​(long prog,
                                              long src,
                                              long name,
                                              int numHeaders,
                                              long headers,
                                              long includeNames)
        Unsafe version of: CreateProgram
        Parameters:
        numHeaders - number of headers used. numHeaders must be greater than or equal to 0.
      • nvrtcCreateProgram

        public static int nvrtcCreateProgram​(org.lwjgl.PointerBuffer prog,
                                             java.nio.ByteBuffer src,
                                             @Nullable
                                             java.nio.ByteBuffer name,
                                             @Nullable
                                             org.lwjgl.PointerBuffer headers,
                                             @Nullable
                                             org.lwjgl.PointerBuffer includeNames)
        
        public static int nvrtcCreateProgram​(org.lwjgl.PointerBuffer prog,
                                             java.lang.CharSequence src,
                                             @Nullable
                                             java.lang.CharSequence name,
                                             @Nullable
                                             org.lwjgl.PointerBuffer headers,
                                             @Nullable
                                             org.lwjgl.PointerBuffer includeNames)
        
        Creates an instance of nvrtcProgram with the given input parameters, and sets the output parameter prog with it.
        Parameters:
        prog - CUDA Runtime Compilation program
        src - CUDA program source
        name - CUDA program name. name can be NULL; "default_program" is used when name is NULL or "".
        headers - sources of the headers. headers can be NULL when numHeaders is 0.
        includeNames - name of each header by which they can be included in the CUDA program source. includeNames can be NULL when numHeaders is 0.
      • nnvrtcDestroyProgram

        public static int nnvrtcDestroyProgram​(long prog)
        Unsafe version of: DestroyProgram
      • nvrtcDestroyProgram

        public static int nvrtcDestroyProgram​(org.lwjgl.PointerBuffer prog)
        Destroys the given program.
        Parameters:
        prog - CUDA Runtime Compilation program
      • nnvrtcCompileProgram

        public static int nnvrtcCompileProgram​(long prog,
                                               int numOptions,
                                               long options)
        Unsafe version of: CompileProgram
        Parameters:
        numOptions - number of compiler options passed
      • nvrtcCompileProgram

        public static int nvrtcCompileProgram​(long prog,
                                              @Nullable
                                              org.lwjgl.PointerBuffer options)
        Compiles the given program.

        It supports compile options listed in options.

        Parameters:
        prog - CUDA Runtime Compilation program
        options - compiler options in the form of C string array. options can be NULL when numOptions is 0.
      • nnvrtcGetPTXSize

        public static int nnvrtcGetPTXSize​(long prog,
                                           long ptxSizeRet)
        Unsafe version of: GetPTXSize
      • nvrtcGetPTXSize

        public static int nvrtcGetPTXSize​(long prog,
                                          org.lwjgl.PointerBuffer ptxSizeRet)
        Sets ptxSizeRet with the size of the PTX generated by the previous compilation of prog (including the trailing NULL).
        Parameters:
        prog - CUDA Runtime Compilation program
        ptxSizeRet - size of the generated PTX (including the trailing NULL)
      • nnvrtcGetPTX

        public static int nnvrtcGetPTX​(long prog,
                                       long ptx)
        Unsafe version of: GetPTX
      • nvrtcGetPTX

        public static int nvrtcGetPTX​(long prog,
                                      java.nio.ByteBuffer ptx)
        Stores the PTX generated by the previous compilation of prog in the memory pointed by ptx.
        Parameters:
        prog - CUDA Runtime Compilation program
        ptx - compiled result
      • nnvrtcGetCUBINSize

        public static int nnvrtcGetCUBINSize​(long prog,
                                             long cubinSizeRet)
        Unsafe version of: GetCUBINSize
      • nvrtcGetCUBINSize

        public static int nvrtcGetCUBINSize​(long prog,
                                            org.lwjgl.PointerBuffer cubinSizeRet)
        Sets cubinSizeRet with the size of the cubin generated by the previous compilation of prog.

        The value of cubinSizeRet is set to 0 if the value specified to -arch is a virtual architecture instead of an actual architecture.

        Parameters:
        prog - CUDA Runtime Compilation program
        cubinSizeRet - size of the generated cubin
      • nnvrtcGetCUBIN

        public static int nnvrtcGetCUBIN​(long prog,
                                         long cubin)
        Unsafe version of: GetCUBIN
      • nvrtcGetCUBIN

        public static int nvrtcGetCUBIN​(long prog,
                                        java.nio.ByteBuffer cubin)
        Stores the cubin generated by the previous compilation of prog in the memory pointed by cubin.

        No cubin is available if the value specified to -arch is a virtual architecture instead of an actual architecture.

        Parameters:
        prog - CUDA Runtime Compilation program
        cubin - compiled and assembled result
      • nnvrtcGetNVVMSize

        public static int nnvrtcGetNVVMSize​(long prog,
                                            long nvvmSizeRet)
        Unsafe version of: GetNVVMSize
      • nvrtcGetNVVMSize

        public static int nvrtcGetNVVMSize​(long prog,
                                           org.lwjgl.PointerBuffer nvvmSizeRet)
        Sets nvvmSizeRet with the size of the NVVM generated by the previous compilation of prog.

        The value of nvvmSizeRet is set to 0 if the program was not compiled with -dlto.

        Parameters:
        prog - CUDA Runtime Compilation program
        nvvmSizeRet - size of the generated NVVM
      • nnvrtcGetNVVM

        public static int nnvrtcGetNVVM​(long prog,
                                        long nvvm)
        Unsafe version of: GetNVVM
      • nvrtcGetNVVM

        public static int nvrtcGetNVVM​(long prog,
                                       java.nio.ByteBuffer nvvm)
        Stores the NVVM generated by the previous compilation of prog in the memory pointed by nvvm.

        The program must have been compiled with -dlto, otherwise will return an error.

        Parameters:
        prog - CUDA Runtime Compilation program
        nvvm - compiled result
      • nnvrtcGetProgramLogSize

        public static int nnvrtcGetProgramLogSize​(long prog,
                                                  long logSizeRet)
        Unsafe version of: GetProgramLogSize
      • nvrtcGetProgramLogSize

        public static int nvrtcGetProgramLogSize​(long prog,
                                                 org.lwjgl.PointerBuffer logSizeRet)
        Sets logSizeRet with the size of the log generated by the previous compilation of prog (including the trailing NULL).

        Note that compilation log may be generated with warnings and informative messages, even when the compilation of prog succeeds.

        Parameters:
        prog - CUDA Runtime Compilation program
        logSizeRet - size of the compilation log (including the trailing NULL)
      • nnvrtcGetProgramLog

        public static int nnvrtcGetProgramLog​(long prog,
                                              long log)
        Unsafe version of: GetProgramLog
      • nvrtcGetProgramLog

        public static int nvrtcGetProgramLog​(long prog,
                                             java.nio.ByteBuffer log)
        Stores the log generated by the previous compilation of prog in the memory pointed by log.
        Parameters:
        prog - CUDA Runtime Compilation program
        log - compilation log
      • nnvrtcAddNameExpression

        public static int nnvrtcAddNameExpression​(long prog,
                                                  long name_expression)
        Unsafe version of: AddNameExpression
      • nvrtcAddNameExpression

        public static int nvrtcAddNameExpression​(long prog,
                                                 java.nio.ByteBuffer name_expression)
        
        public static int nvrtcAddNameExpression​(long prog,
                                                 java.lang.CharSequence name_expression)
        
        Notes the given name expression denoting the address of a __global__ function or __device__/__constant__ variable.

        The identical name expression string must be provided on a subsequent call to GetLoweredName to extract the lowered name.

        Parameters:
        prog - CUDA Runtime Compilation program
        name_expression - constant expression denoting the address of a __global__ function or __device__/__constant__ variable
      • nnvrtcGetLoweredName

        public static int nnvrtcGetLoweredName​(long prog,
                                               long name_expression,
                                               long lowered_name)
        Unsafe version of: GetLoweredName
      • nvrtcGetLoweredName

        public static int nvrtcGetLoweredName​(long prog,
                                              java.nio.ByteBuffer name_expression,
                                              org.lwjgl.PointerBuffer lowered_name)
        
        public static int nvrtcGetLoweredName​(long prog,
                                              java.lang.CharSequence name_expression,
                                              org.lwjgl.PointerBuffer lowered_name)
        
        Extracts the lowered (mangled) name for a __global__ function or __device__/__constant__ variable, and updates *lowered_name to point to it.

        The memory containing the name is released when the NVRTC program is destroyed by DestroyProgram. The identical name expression must have been previously provided to AddNameExpression.

        Parameters:
        prog - CUDA Runtime Compilation program
        name_expression - constant expression denoting the address of a __global__ function or __device__/__constant__ variable
        lowered_name - initialized by the function to point to a C string containing the lowered (mangled) name corresponding to the provided name expression