GPU內存不夠用怎麼辦?(5分鐘擴充顯存到32GB)

爲什麼需要swap?

在我使用TENSORFLOW期間,我發現我16GB內存不夠用,交換 內存可以將存儲空間的一部分用於內存使用。該方法在jetson xavier上實測有效。

在ubuntu上安全快速的創建永久的交換分區(SWAP)方法

開始

  1. -$ df -h

    This will show your file system and how much space you have left.

  2. -$ sudo fallocate -l 8.0G /swapfile

    Create a 8 GB of swap

  3. -$ sudo chmod 600 /swapfile

    Change file permissions

  4. -$ sudo mkswap /swapfile

  5. -$ sudo swapon /swapfile

  6. -$ free -m

    This will show you the swap file is on. You can also pull up the System Monitor

    However this is only temporary. If you reboot, swap file is gone.

  7. -$ sudo nano /etc/fstab

  8. Within this file add the line “/swapfile none swap 0 0”. Do not include the quotes.

    Exit and save file

  9. Now you can reboot and your Swap will be activated.

  10. Then you can successfully train the CIFAR-10 dataset.

Ideally you would want to create a swap partition on an attached SSD or M.2 SSD and not use any of the internal memory.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章