nbdkit-vram-plugin(1)

NAME
nbdkit-vram-plugin - use GPU Video RAM as a network block device

SYNOPSIS
 nbdkit vram -f [device=NAME|N] [SIZE]

 nbdkit vram --dump-plugin

DESCRIPTION
"nbdkit-vram-plugin" is a plugin for nbdkit(1) which uses Video RAM from an OpenCL-capable graphics card (GPU) as a block device.

You currently must run the plugin in the foreground ("nbdkit -f" option).

Video RAM is volatile. As soon as nbdkit exits or the machine is turned off, the disk and all data on it is deleted.

  Checking for compatible GPUs
To check that OpenCL is installed and sees your GPU, run clinfo(1):

 $ clinfo --list
 Platform #0: AMD Accelerated Parallel Processing
  +-- Device #0: gfx1101
  `-- Device #1: gfx1036

 $ clinfo
 Number of platforms    1
   Platform Name        AMD Accelerated Parallel Processing
   Platform Vendor      Advanced Micro Devices, Inc.
   Platform Version     OpenCL 2.1 AMD-APP (3649.0)
 ...
 Number of devices      2
  Device Name           gfx1101
  Device Vendor         Advanced Micro Devices, Inc.
  Device Vendor ID      0x1002
  Device Version        OpenCL 2.0
 ...
  Global memory size    17163091968 (15.98GiB)
 ...
  Device Name           gfx1036
  Device Vendor         Advanced Micro Devices, Inc.
  Device Vendor ID      0x1002
  Device Version        OpenCL 2.0
 ...
  Global memory size    33247174656 (30.96GiB)

If there is more than one device in the system, use the "device" parameter with the device name or index (counting from 0). For example:

 $ nbdkit -f vram device=gfx1101

 $ nbdkit -f vram device=0

To see what devices the plugin sees, use:

 $ nbdkit vram --dump-plugin
 ...
 vram_num_devices=2
 vram_device_index=0
 vram_device_name=gfx1101
 ...
 vram_device_index=1
 vram_device_name=gfx1036

  Setting video RAM size
By default, the plugin will try to use as much of the video RAM on the device as possible. You can limit the RAM to a smaller amount using the optional "size" parameter, eg:

 $ nbdkit -f vram 10G

  Video RAM is lazily allocated
The plugin allocates video RAM on demand as you fill it up with data. This means that if there are other users of the GPU (for example, you are running a game at the same time), it is possible to run out of space. In this case, writes will return ENOSPC "No space left on device" errors.

To limit the maximum amount of video RAM that will be used, use the optional "size" parameter.

If you trim the block device (see blkdiscard(8) and fstrim(8)), video RAM is given back to the system.

Currently you cannot limit the video RAM used independently of the virtual size of the disk (because it's not a good idea).

  Integrated graphics
Integrated graphics GPUs (where the GPU is part of the CPU) usually use system RAM as video RAM. Therefore there is no point using this plugin with integrated graphics. Use nbdkit-memory-plugin(1) to use system RAM as a RAM disk instead.

PARAMETERS

device=NAME
device=N
    Choose the GPU by OpenCL name or by device index (counting from 0).

    To list the devices known to OpenCL, use the clinfo(1) command.

    If you are not sure what device name or index to use, consult the output of "nbdkit vram --dump-plugin"

[size=]SIZE
    Limit the size of the video RAM disk. If omitted, the plugin will try to use all available video RAM on the device.

    Note this may be rounded up by the plugin (currently to a multiple of 64K).

    "size=" prefix may be omitted in most cases. See "Magic parameters" in nbdkit(1).

ENVIRONMENT VARIABLES
Various environment variables are passed through to OpenCL and the OpenCL driver. Please consult documentation for your GPU.

FILES

$plugindir/nbdkit-vram-plugin.so
    The plugin.

    Use "nbdkit --dump-config" to find the location of $plugindir.

VERSION
"nbdkit-vram-plugin" first appeared in nbdkit 1.46.

SEE ALSO
nbdkit(1), nbdkit-plugin(3), nbdkit-memory-plugin(1), clinfo(1), radeontop(1), blkdiscard(8), fstrim(8).

AUTHORS
Richard W.M. Jones

This plugin was heavily inspired by vramfs, a FUSE module written by Alexander Overvoorde (https://github.com/Overv/vramfs).

COPYRIGHT
Copyright Red Hat

LICENSE
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

•   Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

•   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

•   Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.