Today, when using CryoSPARC for Non-uniform Refinement, the task was terminated unexpectedly. After searching, it was determined that the process may have been killed by the system because of insufficient memory.
There are two ways to increase memory, one is to pay the money, and the other is to increase swap memory.
Because most tasks in the workflow do not have high memory requirements, and according to the task log, only a small amount of memory is needed to solve the problem, so plan to try to increase swap memory first.
All of the following are from ChatGPT4 and are proven to work, with some modifications to ensure readability.
sudo swapoff -a
You can do this with dd
or fallocate
command,fallocate
is faster than dd
, but not all file systems support it.
An example of using fallocate
to resize a swap file to 8GB:
sudo fallocate -l 8G /swapfile
If your system does not support fallocate
, you can use the dd
command:
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
# `bs=1G` indicates that each time a 1GB is written,`count=8` indicates that 8GB total written。
Set permissions on swap files so that only root can read and write:
sudo chmod 600 /swapfile
sudo mkswap /swapfile
To retain the swap setting after the system restart, you need to add it to the /etc/fstab
file. Open the /etc/fstab
file and add the following lines:
In this way, the swap file is automatically enabled each time the system boots.
Note
It seems that the
/swapfile
setting already exists in the/etc/fstab
file, so you can optionally skip the last step.
After increasing the swap memory from 2G to 8G, the task was successfully completed. 800CNY saved, a good day.
sudo swapon /swapfile
/swapfile swap swap defaults 0 0