Class NVRTC
- java.lang.Object
-
- org.lwjgl.cuda.NVRTC
-
public class NVRTC extends java.lang.ObjectContains bindings to NVRTC, a runtime compilation library for CUDA C++.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNVRTC.FunctionsContains the function pointers loaded from the NVRTCSharedLibrary.
-
Field Summary
Fields Modifier and Type Field Description static intNVRTC_ERROR_BUILTIN_OPERATION_FAILURE
NVRTC_ERROR_COMPILATION
NVRTC_ERROR_INTERNAL_ERROR
NVRTC_ERROR_INVALID_INPUT
NVRTC_ERROR_INVALID_OPTION
NVRTC_ERROR_INVALID_PROGRAM
NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID
NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION
NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION
NVRTC_ERROR_OUT_OF_MEMORY
NVRTC_ERROR_PROGRAM_CREATION_FAILURE
NVRTC_SUCCESSThe enumerated typenvrtcResultdefines API call result codes.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.lwjgl.system.SharedLibrarygetLibrary()Returns the NVRTCSharedLibrary.static intnnvrtcAddNameExpression(long prog, long name_expression)Unsafe version of:AddNameExpressionstatic intnnvrtcCompileProgram(long prog, int numOptions, long options)Unsafe version of:CompileProgramstatic intnnvrtcCreateProgram(long prog, long src, long name, int numHeaders, long headers, long includeNames)Unsafe version of:CreateProgramstatic intnnvrtcDestroyProgram(long prog)Unsafe version of:DestroyProgramstatic intnnvrtcGetCUBIN(long prog, long cubin)Unsafe version of:GetCUBINstatic intnnvrtcGetCUBINSize(long prog, long cubinSizeRet)Unsafe version of:GetCUBINSizestatic longnnvrtcGetErrorString(int result)Unsafe version of:GetErrorStringstatic intnnvrtcGetLoweredName(long prog, long name_expression, long lowered_name)Unsafe version of:GetLoweredNamestatic intnnvrtcGetNumSupportedArchs(long numArchs)Unsafe version of:GetNumSupportedArchsstatic intnnvrtcGetNVVM(long prog, long nvvm)Unsafe version of:GetNVVMstatic intnnvrtcGetNVVMSize(long prog, long nvvmSizeRet)Unsafe version of:GetNVVMSizestatic intnnvrtcGetProgramLog(long prog, long log)Unsafe version of:GetProgramLogstatic intnnvrtcGetProgramLogSize(long prog, long logSizeRet)Unsafe version of:GetProgramLogSizestatic intnnvrtcGetPTX(long prog, long ptx)Unsafe version of:GetPTXstatic intnnvrtcGetPTXSize(long prog, long ptxSizeRet)Unsafe version of:GetPTXSizestatic intnnvrtcGetSupportedArchs(long supportedArchs)Unsafe version of:GetSupportedArchsstatic intnnvrtcVersion(long major, long minor)Unsafe version of:Versionstatic intnvrtcAddNameExpression(long prog, java.lang.CharSequence name_expression)Notes the given name expression denoting the address of a__global__function or__device__/__constant__variable.static intnvrtcAddNameExpression(long prog, java.nio.ByteBuffer name_expression)Notes the given name expression denoting the address of a__global__function or__device__/__constant__variable.static intnvrtcCompileProgram(long prog, org.lwjgl.PointerBuffer options)Compiles the given program.static intnvrtcCreateProgram(org.lwjgl.PointerBuffer prog, java.lang.CharSequence src, java.lang.CharSequence name, org.lwjgl.PointerBuffer headers, org.lwjgl.PointerBuffer includeNames)Creates an instance ofnvrtcProgramwith the given input parameters, and sets the output parameterprogwith it.static intnvrtcCreateProgram(org.lwjgl.PointerBuffer prog, java.nio.ByteBuffer src, java.nio.ByteBuffer name, org.lwjgl.PointerBuffer headers, org.lwjgl.PointerBuffer includeNames)Creates an instance ofnvrtcProgramwith the given input parameters, and sets the output parameterprogwith it.static intnvrtcDestroyProgram(org.lwjgl.PointerBuffer prog)Destroys the given program.static intnvrtcGetCUBIN(long prog, java.nio.ByteBuffer cubin)Stores thecubingenerated by the previous compilation ofprogin the memory pointed bycubin.static intnvrtcGetCUBINSize(long prog, org.lwjgl.PointerBuffer cubinSizeRet)SetscubinSizeRetwith the size of thecubingenerated by the previous compilation ofprog.static java.lang.StringnvrtcGetErrorString(int result)A helper function that returns a string describing the givennvrtcResultcode, e.g.,SUCCESSto"NVRTC_SUCCESS".static intnvrtcGetLoweredName(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_nameto point to it.static intnvrtcGetLoweredName(long prog, java.nio.ByteBuffer name_expression, org.lwjgl.PointerBuffer lowered_name)Extracts the lowered (mangled) name for a__global__function or__device__/__constant__variable, and updates*lowered_nameto point to it.static intnvrtcGetNumSupportedArchs(java.nio.IntBuffer numArchs)Sets the output parameternumArchswith the number of architectures supported by NVRTC.static intnvrtcGetNVVM(long prog, java.nio.ByteBuffer nvvm)Stores the NVVM generated by the previous compilation ofprogin the memory pointed bynvvm.static intnvrtcGetNVVMSize(long prog, org.lwjgl.PointerBuffer nvvmSizeRet)SetsnvvmSizeRetwith the size of the NVVM generated by the previous compilation ofprog.static intnvrtcGetProgramLog(long prog, java.nio.ByteBuffer log)Stores the log generated by the previous compilation ofprogin the memory pointed bylog.static intnvrtcGetProgramLogSize(long prog, org.lwjgl.PointerBuffer logSizeRet)SetslogSizeRetwith the size of the log generated by the previous compilation ofprog(including the trailingNULL).static intnvrtcGetPTX(long prog, java.nio.ByteBuffer ptx)Stores the PTX generated by the previous compilation ofprogin the memory pointed byptx.static intnvrtcGetPTXSize(long prog, org.lwjgl.PointerBuffer ptxSizeRet)SetsptxSizeRetwith the size of the PTX generated by the previous compilation ofprog(including the trailingNULL).static intnvrtcGetSupportedArchs(java.nio.IntBuffer supportedArchs)Populates the array passed via the output parametersupportedArchswith the architectures supported by NVRTC.static intnvrtcVersion(java.nio.IntBuffer major, java.nio.IntBuffer minor)Sets the output parametersmajorandminorwith the CUDA Runtime Compilation version number.
-
-
-
Field Detail
-
NVRTC_SUCCESS, NVRTC_ERROR_OUT_OF_MEMORY, NVRTC_ERROR_PROGRAM_CREATION_FAILURE, NVRTC_ERROR_INVALID_INPUT, NVRTC_ERROR_INVALID_PROGRAM, NVRTC_ERROR_INVALID_OPTION, NVRTC_ERROR_COMPILATION, NVRTC_ERROR_BUILTIN_OPERATION_FAILURE, NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION, NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION, NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID, NVRTC_ERROR_INTERNAL_ERROR
The enumerated typenvrtcResultdefines API call result codes.NVRTC API functions return
nvrtcResultto indicate the call result.Enum values:
SUCCESSERROR_OUT_OF_MEMORYERROR_PROGRAM_CREATION_FAILUREERROR_INVALID_INPUTERROR_INVALID_PROGRAMERROR_INVALID_OPTIONERROR_COMPILATIONERROR_BUILTIN_OPERATION_FAILUREERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATIONERROR_NO_LOWERED_NAMES_BEFORE_COMPILATIONERROR_NAME_EXPRESSION_NOT_VALIDERROR_INTERNAL_ERROR
-
-
Method Detail
-
getLibrary
public static org.lwjgl.system.SharedLibrary getLibrary()
Returns the NVRTCSharedLibrary.
-
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 givennvrtcResultcode, e.g.,SUCCESSto"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
nvrtcResultcode
-
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 parametersmajorandminorwith the CUDA Runtime Compilation version number.- Parameters:
major- CUDA Runtime Compilation major version numberminor- 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 parameternumArchswith the number of architectures supported by NVRTC.This can then be used to pass an array to
GetSupportedArchsto 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 parametersupportedArchswith 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.numHeadersmust 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 ofnvrtcProgramwith the given input parameters, and sets the output parameterprogwith it.- Parameters:
prog- CUDA Runtime Compilation programsrc- CUDA program sourcename- CUDA program name.namecan beNULL;"default_program"is used whennameisNULLor "".headers- sources of the headers.headerscan beNULLwhennumHeadersis 0.includeNames- name of each header by which they can be included in the CUDA program source.includeNamescan beNULLwhennumHeadersis 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 programoptions- compiler options in the form of C string array.optionscan beNULLwhennumOptionsis 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)SetsptxSizeRetwith the size of the PTX generated by the previous compilation ofprog(including the trailingNULL).- Parameters:
prog- CUDA Runtime Compilation programptxSizeRet- size of the generated PTX (including the trailingNULL)
-
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 ofprogin the memory pointed byptx.- Parameters:
prog- CUDA Runtime Compilation programptx- 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)SetscubinSizeRetwith the size of thecubingenerated by the previous compilation ofprog.The value of
cubinSizeRetis set to 0 if the value specified to-archis a virtual architecture instead of an actual architecture.- Parameters:
prog- CUDA Runtime Compilation programcubinSizeRet- 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 thecubingenerated by the previous compilation ofprogin the memory pointed bycubin.No
cubinis available if the value specified to-archis a virtual architecture instead of an actual architecture.- Parameters:
prog- CUDA Runtime Compilation programcubin- 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)SetsnvvmSizeRetwith the size of the NVVM generated by the previous compilation ofprog.The value of
nvvmSizeRetis set to 0 if the program was not compiled with-dlto.- Parameters:
prog- CUDA Runtime Compilation programnvvmSizeRet- 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 ofprogin the memory pointed bynvvm.The program must have been compiled with
-dlto, otherwise will return an error.- Parameters:
prog- CUDA Runtime Compilation programnvvm- 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)SetslogSizeRetwith the size of the log generated by the previous compilation ofprog(including the trailingNULL).Note that compilation log may be generated with warnings and informative messages, even when the compilation of
progsucceeds.- Parameters:
prog- CUDA Runtime Compilation programlogSizeRet- size of the compilation log (including the trailingNULL)
-
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 ofprogin the memory pointed bylog.- Parameters:
prog- CUDA Runtime Compilation programlog- 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
GetLoweredNameto extract the lowered name.- Parameters:
prog- CUDA Runtime Compilation programname_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_nameto 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 toAddNameExpression.- Parameters:
prog- CUDA Runtime Compilation programname_expression- constant expression denoting the address of a__global__function or__device__/__constant__variablelowered_name- initialized by the function to point to a C string containing the lowered (mangled) name corresponding to the provided name expression
-
-