Module openj9.cuda
Package com.ibm.cuda

Class CudaLinker


  • public final class CudaLinker
    extends Object
    The CudaLinker class supports combining one or more code fragments to form a module that can be then loaded on a CUDA-capable device.

    When no longer required, a linker must be destroyed (see destroy()).

    • Constructor Detail

      • CudaLinker

        public CudaLinker​(CudaDevice device)
                   throws CudaException
        Creates a new linker for the specified device using default options.
        Parameters:
        device - the device on which the resulting module is to be loaded
        Throws:
        CudaException - if a CUDA exception occurs
      • CudaLinker

        public CudaLinker​(CudaDevice device,
                          CudaJitOptions options)
                   throws CudaException
        Creates a new linker for the specified device using the specified options.
        Parameters:
        device - the device on which the resulting module is to be loaded
        options - the desired options, or null for the default options
        Throws:
        CudaException - if a CUDA exception occurs
    • Method Detail

      • add

        public CudaLinker add​(CudaJitInputType type,
                              byte[] data,
                              String name)
                       throws CudaException
        Adds a new code fragment to be linked into the module under construction using the default options.
        Parameters:
        type - the type of input data
        data - the content of the new code fragment
        name - the name to be used in log messages in reference to this code fragment
        Returns:
        this linker object
        Throws:
        CudaException - if a CUDA exception occurs
        IllegalStateException - if this linker has been destroyed (see destroy())
      • add

        public CudaLinker add​(CudaJitInputType type,
                              byte[] data,
                              String name,
                              CudaJitOptions options)
                       throws CudaException
        Adds a new code fragment to be linked into the module under construction using the specified options.
        Parameters:
        type - the type of input data
        data - the content of the new code fragment
        name - the name to be used in log messages in reference to this code fragment
        options - the desired options
        Returns:
        this linker object
        Throws:
        CudaException - if a CUDA exception occurs
        IllegalStateException - if this linker has been destroyed (see destroy())
      • complete

        public byte[] complete()
                        throws CudaException
        Completes the module under construction and return an image suitable for loading.
        Returns:
        the image suitable for loading
        Throws:
        CudaException - if a CUDA exception occurs
        IllegalStateException - if this linker has been destroyed (see destroy())
      • destroy

        public void destroy()
                     throws CudaException
        Destroys this linker, releasing associated resources.
        Throws:
        CudaException - if a CUDA exception occurs
      • getErrorLogBuffer

        public String getErrorLogBuffer()
        Returns the contents of the error log.

        The result will be empty unless this linker was created with options which specified a positive error log buffer size (see CudaJitOptions.setErrorLogBufferSize(int)) and errors were reported.

        Returns:
        the contents of the error log
      • getInfoLogBuffer

        public String getInfoLogBuffer()
        Returns the contents of the information log.

        The result will be empty unless this linker was created with options which specified a positive information log buffer size (see CudaJitOptions.setInfoLogBufferSize(int)) and informational messages were reported.

        Returns:
        the contents of the information log
      • getWallTime

        public float getWallTime()
        Answers the total elapsed time, in milliseconds, spent in the compiler and linker.

        Applies to: compiler and linker.

        Returns:
        the total elapsed time, in milliseconds, spent in the compiler and linker