Python multiprocessing RawArray no disk space, or very slow

It seems that Python writes to /tmp on linux base os when allocating python.multiprocessing.sharedctypes.RawArray. If the disk space on that path is not sufficient, “no disk space” error occurs.
The solution is to change the default TMPDIR environment, using one of below methods:

  • bash: export TMPDIR='/the/new/path'
  • bash: TMPDIR=/the/new/path python3
  • python: os.environ['TMPDIR']='/your/new/path'

By the way, using /dev/shm as the tmpdir enhances performance to me~

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.