Set the tmp directory of a Prolog program?

Hi

I’m need to run a Prolog program with swipl which generates very large temporary files. In the program itself I see tmp_file statements. Is there a command line flag or an environment variable to force these files to be written to a particular directory? I tried to run the program as:

TMPDIR=/vol/share/phochste/tmp swipl --stack-limit=20G …

but still my /tmp directory is filling up and the program crashing with

error(io_error(write,(0x30c1300)),context(system:write/1,No space left on device))

In the /tmp directory I see swipl generated files that fill up the complete filesystem

Patrick

Hi, I think you’re looking for the tmp_dir Prolog flag:

tmp_dir(atom, changeable)

Path to the temporary directory. initialised from the environment variable TMP or TEMP in windows. If this variable is not defined a default is used. This default is typically /tmp or c:/temp in windows.

You can change this on the command line by adding e. g. -g "set_prolog_flag(tmp_dir, '/vol/share/phochste/tmp')" to your swipl call.

2 Likes

Thank you!