I am starting trainings on the gcp AI Plaform using container built by the gcp cloud build service. I need a ram-disk inside said container to speed up the training.
I understand that tmpfs is mounted using the -tmpfs options of docker or google cloud runner.
There is a special parameter for doing this inside the gcp compute engine:
gcloud compute instances create-with-container busybox-vm \
--container-image docker.io/busybox:1.27 \
--container-mount-tmpfs mount-path=/cache
However, I can't find a tmpfs parameter or similar for starting a training job.
How do I solve this?
Let us see if my solution will work on your end. Make sure your instance has enough available memory, and connect to your instance through SSH. Go to the VM instances page and click the SSH button next to the instance where you want to add a RAM disk.
Here's the code to create a mount for your RAM disk.
Create and mount a new tmpfs RAM disk. You must determine a value for the size property that meets your storage requirements without competing with your applications for memory or expending all of the available memory.
For this example, the instance has a n1-highmem-32 machine type with 208 GB of memory, so a 50g RAM disk size is appropriate.
Add the RAM disk to the /etc/fstab file so that the device automatically mounts again if you restart the instance:
Output :
I have checked in my environment and above steps are working fine :
Here, instance-1 is my VM and I have checked available partitions in the VM.