LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 02-13-2024, 09:59 AM   #1
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
Mounting video RAM on Linux


Title: Mounting video ram on Linux
Author: Solène
Date: 10 February 2024
Tags: linux
Description: In this article, you will learn how to store data in your
GPU memory on Linux

Introduction

Hi, did you ever wonder if you could use your GPU memory as a mount
point, like one does with tmpfs and RAM?

Well, there is a project named vramfs that allows you to do exactly
this on FUSE compatible operating system.

In this test, I used an NVIDIA GTX 1060 6GB in an external GPU case
connected with a thunderbolt cable to a Lenovo T470 laptop running
Gentoo.

ramfs official GitHub project page
<https://github.com/Overv/vramfs>

Setup

Install the dependencies, you need a C++ compiler and OpenCL headers
for C++ (the package name usually contains "clhpp").

Download the sources, either with git or using an archive.

Run `make` and you should obtain a binary in `bin/vramfs`.

Usage

It's pretty straightforward to use, as root, run `vramfs /mountpoint
3G` to mount a 3 GB storage on `/mountpoint`.

The program will stay in foreground, use Ctrl+C to unmount and stop the
mount point.

Speed test

I've been doing a simple speed test using `dd` to measure the write
speed compare to a tmpfs.

The vramfs mount point was able to achieve 971 MB/s, it was CPU bound
by the FUSE program because FUSE isn't very efficient compared to a
kernel module handling a file system.

Code:
    # env LC_ALL=C dd if=/dev/zero of=here.disk bs=64k count=30000
    30000+0 records in
    30000+0 records out
    1966080000 bytes (2.0 GB, 1.8 GiB) copied, 2.02388 s, 971 MB/s
Meanwhile, the good old tmpfs reached 3.2 GB/s without using much CPU,
this is a clear winner.

Code:
    # env LC_ALL=C dd if=/dev/zero of=here.disk bs=64k count=30000
    30000+0 records in
    30000+0 records out
    1966080000 bytes (2.0 GB, 1.8 GiB) copied, 0.611312 s, 3.2 GB/s
Limitations

I tried to use the vram mount point as a temporary directory for
portage (the Gentoo tool building packages), but it didn't work due to
an error. After this error, I had to umount and recreate the mount
point otherwise I was left with an irremovable directory. There are
bugs in vramfs, no doubts here :-)

Arch Linux wiki has a guide explaining how to use vramfs to store a
swap file, but it seems to be risky for the system stability.

ArchWiki: Swap on video
<https://wiki.archlinux.org/title/Swa...USE_filesystem>

Conclusion

It's pretty cool to know that on Linux you can do almost what you want,
even store data in your GPU memory.

However, I'm still trying to figure a real use case for vramfs except
that it's pretty cool and impressive. If you figure a useful
situation, please let me know.

From:
<gopher://dataswamp.org/1/~solene/art...-vram-on-linux>

Reminds me of VGADISK.SYS
<ftp://ftp.oldskool.org/pub/simtelnet...sk/vgadisk.zip>
 
Old 02-23-2024, 04:25 AM   #2
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
Have you figured out a use case? I am very curious why in the world you'd want to do this? But it sounds interesting enough for me to want to ask you that!
 
Old 02-23-2024, 09:40 AM   #3
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,784

Rep: Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434
Now if you could just mount the GOU's firmware....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why size of swap space is 2x of RAM??? Why not 1.5x of RAM or 2.5x of RAM??? Saurav Ghosh Linux - Newbie 7 11-01-2011 03:49 AM
Video RAM as System RAM rahulkya Linux - Hardware 2 06-23-2010 03:02 PM
All RAM not being recognized on Linux RHEL after adding RAM manouche Linux - Enterprise 4 04-18-2008 10:31 AM
RAM: Does linux require as much ram as Windows XP? hanzj Linux - Newbie 48 04-18-2007 12:14 AM
Win98SE Pentium166MMX/64MB RAM vs Linux AthlonXP+ 3000/512MB RAM : Lucent LT WinModem t3gah Linux - Software 2 04-22-2005 01:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration