Score:0

Is there any ways for me to load files into RAM for faster calculation

cn flag

I'm studying with Bioinformatics now. I'm working with alignment programs like BWA. I'm wonder is there any commands or directories that allow me to copy the fastq file from hard drives into RAM and perform all alignments and calculation on it, only print the output to hard drive. Or at least it can work with RAM

in flag
Yes, you could use a RAM disk. How much RAM do you have and how large are the files that you want to work with?
khanhlpbao avatar
cn flag
@matigo I'm having 20gb of RAM and each fastq file is about 2-3gb at max
in flag
Those files aren't too large. I wouldn't be surprised if they're loaded into the file system buffers (RAM) automatically if the software is reading through them a lot. That said, you can certainly use one of the two answers below to dedicate some memory and perform some comparison tests to see if copying the files into RAM reduce the overall processing time
vanadium avatar
cn flag
I agree with matigo. Chances are, if you sacrifice the ram for a ramdisk, you may not see improvements because it goes to the expense of disk cache.
Score:3
pe flag

you could use RAMFS to create/mount a directory into RAM then copy your files into it. There is also another way to achieve what you want with vmtouch

sudo mkdir -p /mnt/ram
sudo mount -t ramfs /mnt/ram
sudo chmod 755 /mnt/ram

cp /path/to/myFile /mnt/ram/myFile

Of course, the content of /mnt/ram will be lost when unmounting or/and rebooting

Free the temporary mounted ram files :

sudo umount /mnt/ram
sudo rmdir /mnt/ram
khanhlpbao avatar
cn flag
Thanks, I only need it temporarily for calculation, is there a command to reboot the mount after I finished calculation?
pe flag
@khanhlpbao see edited answer, i added commands for unmounting temp ram when calculation are done
Score:1
cn flag

Mkusb Frugal Persistent Live Install with toram

mkusb: https://help.ubuntu.com/community/mkusb, creates Persistent Live Frugal installs that will boot toram.

The Frugal install can be loaded to USB or to internal disk.

I think this makes a very fast system, if you have enough RAM.

Between sessions data is saved on a persistent ext4 overlay partition. You can also add FAT32 and NTFS Data partitions.

Score:0
vn flag

Ubuntu (and other Linux distros) already come with a pre-mounted ramdisk in /dev/shm. The size of this ramdisk is half your RAM (so in the OP's case 10 GB).

Instead of creating yet another ramdisk, it's perfectly fine to make a folder inside /dev/shm, copy your files there, and remove the folder again afterwards.

Examples:

$ mkdir /dev/shm/myfiles
$ cp /path/to/myfiles /dev/shm/myfiles
$ do whatever /dev/shm/myfiles
$ rm -R /dev/shm/myfiles
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.