Class RPCSession

java.lang.Object
org.apache.tvm.rpc.RPCSession

public class RPCSession extends Object
RPC Client session module. Do not directly create the object, use Client.connect.
  • Method Details

    • getFunction

      public Function getFunction(String name)
      Get function from the session.
      Parameters:
      name - The name of the function.
      Returns:
      The result function.
    • device

      public Device device(String devType, int devId)
      Construct a remote device.
      Parameters:
      devType - device type.
      devId - device id.
      Returns:
      The corresponding encoded remote device.
    • device

      public Device device(String devType)
      Construct a remote device.
      Parameters:
      devType - device type.
      Returns:
      The corresponding encoded remote device.
    • device

      public Device device(int devType, int devId)
      Construct a remote device.
      Parameters:
      devType - device type.
      devId - device id.
      Returns:
      The corresponding encoded remote device.
    • device

      public Device device(int devType)
      Construct a remote device.
      Parameters:
      devType - device type.
      Returns:
      The corresponding encoded remote device.
    • cpu

      public Device cpu(int devId)
      Construct remote CPU device.
      Parameters:
      devId - device id.
      Returns:
      Remote CPU device.
    • cpu

      public Device cpu()
      Construct remote CPU device.
      Returns:
      Remote CPU device.
    • cuda

      public Device cuda(int devId)
      Construct remote CUDA GPU device.
      Parameters:
      devId - device id.
      Returns:
      Remote CUDA GPU device.
    • cuda

      public Device cuda()
      Construct remote CUDA GPU device.
      Returns:
      Remote CUDA GPU device.
    • cl

      public Device cl(int devId)
      Construct remote OpenCL device.
      Parameters:
      devId - device id.
      Returns:
      Remote OpenCL device.
    • cl

      public Device cl()
      Construct remote OpenCL device.
      Returns:
      Remote OpenCL device.
    • vulkan

      public Device vulkan(int devId)
      Construct remote OpenCL device.
      Parameters:
      devId - device id.
      Returns:
      Remote OpenCL device.
    • vulkan

      public Device vulkan()
      Construct remote OpenCL device.
      Returns:
      Remote OpenCL device.
    • metal

      public Device metal(int devId)
      Construct remote Metal device.
      Parameters:
      devId - device id.
      Returns:
      Remote metal device.
    • metal

      public Device metal()
      Construct remote Metal device.
      Returns:
      Remote metal device.
    • upload

      public void upload(byte[] data, String target)
      Upload binary to remote runtime temp folder.
      Parameters:
      data - The binary in local to upload.
      target - The path in remote, cannot be null.
    • upload

      public void upload(File data, String target) throws IOException
      Upload file to remote runtime temp folder.
      Parameters:
      data - The file in local to upload.
      target - The path in remote.
      Throws:
      IOException - for network failure.
    • upload

      public void upload(File data) throws IOException
      Upload file to remote runtime temp folder.
      Parameters:
      data - The file in local to upload.
      Throws:
      IOException - for network failure.
    • download

      public byte[] download(String path)
      Download file from remote temp folder.
      Parameters:
      path - The relative location to remote temp folder.
      Returns:
      The result blob from the file.
    • loadModule

      public Module loadModule(String path)
      Load a remote module, the file need to be uploaded first.
      Parameters:
      path - The relative location to remote temp folder.
      Returns:
      The remote module containing remote function.