Chia-Network / bladebit

A high-performance k32-only, Chia (XCH) plotter supporting in-RAM and disk-based plotting
Apache License 2.0
337 stars 106 forks source link

tmpfs file system #284

Open juelianfy opened 1 year ago

juelianfy commented 1 year ago

Can the output directory support the tmpfs file system? 1T memory is too free

Jsewill commented 1 year ago

I don't know how involved implementing this would be now, but it would be nice to be able to use a tmpfs mount as a destination, rather than having to use brd with a filesystem on top of it.

juelianfy commented 1 year ago

I tested that using ramdisk virtual hard disk as the output directory can't work

juelianfy commented 1 year ago

Under Windows, using ramdisk virtual hard disk as the output directory is not enough. Linux also reports an error when using tmpfs to mount extra memory as the final output directory

juelianfy commented 1 year ago

This is the result of Linux using tmpfs to mount extra memory as the final output directory and reporting errors. It is normal to use gigahorse or madMAx43v3r [ERROR] Fatal Error: [ERROR] Failed to open plot file with error: 22

Evi5 commented 1 year ago

Because tmpfs does't support direct-io, using xfs:

# The unit of this parameter rd_size is k
# create a RAM disk with a capacity of 240G in /dev/ram0
sudo modprobe brd rd_nr=1 rd_size=251658240
# Make a partition use fdisk on /dev/ram0
    1. Start fdisk with the command:
    sudo fdisk /dev/ram0
    2. Type 'p' to print the partition table. This will show you the current partitions on the disk.
    3. Type 'n' to create a new partition.
    4. Follow the prompts to create the partition.
    5. Type 'p' to print the partition table.
    6. Type 'w' to write the changes to the disk.
    7. Type 'q' to exit
# make a xfs filesystem
sudo mkfs.xfs /dev/ram0p1
# mount
sudo mount -t xfs -o rw /dev/ram0p1 /tmp/ramdisk
# grant permission
sudo chmod -R 777 /tmp/ramdisk
# list /tmp/ramdisk
df -h

# go to the bladebit directory
cd /path/bladebit/build-release
# io test
./bladebit_cuda iotest /tmp/ramdisk
# plotting
./bladebit_cuda -w -n 2 -f XXX -c xchxxx --compress 0 cudaplot /tmp/ramdisk

# umount
sudo umount /tmp/ramdisk
# remove /dev/ram0
sudo rmmod brd