$ dd if=/dev/zero of=/swapfile bs=1G count=250 status=progress
$ chmod 600 /swapfile
$ mkswap -U clear /swapfile
$ swapon /swapfile $ ( umask 077; dd if=/dev/zero of=/swapfile bs=1G count=250 status=progress )
$ mkswap /swapfile
$ swapon /swapfileIt's simply because it's an easy way to create a file of a certain size that most Linux users would be familiar with.
The quicker way (and possibly more "proper" way) is to use fallocate, but who has even heard of that vs dd ?
But this does make me wonder if there's any way to allow a graphics card to use regular RAM in a fast way? AFAIK built-in GPU's inside CPU's can but those GPU's are not powerful enough
Integrated GPUs that use a portion of system memory are an exception to this and do not require memcpys when using unified memory. However, I'm not aware of any powerful iGPUs from Nvidia these days.
There does seem to be a zero copy concept as well and I've certainly used direct memory access over pcie before on other proprietary devices.
https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/ind...