From 8ce2c12e33e3bc4a641a1309644fca67c7acf9f3 Mon Sep 17 00:00:00 2001 From: Madeleine Thompson <3121668+madeleineth@users.noreply.github.com> Date: Mon, 13 Jun 2022 19:37:52 -0700 Subject: [PATCH] [PYTHON] move ephemeral files to homedir (#549) This prevents potential conflicts with other users on shared machines. --- python/setup.py | 3 ++- python/triton/code_gen.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/setup.py b/python/setup.py index 6a04a4e42..af1fa3068 100644 --- a/python/setup.py +++ b/python/setup.py @@ -27,10 +27,11 @@ def get_llvm(): return '', '' # download if nothing is installed name = 'clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04' - dir = '/tmp' + dir = os.path.join(os.environ["HOME"], ".triton", "llvm") llvm_include_dir = '{dir}/{name}/include'.format(dir=dir, name=name) llvm_library_dir = '{dir}/{name}/lib'.format(dir=dir, name=name) if not os.path.exists(llvm_library_dir): + os.makedirs(dir, exist_ok=True) try: shutil.rmtree(os.path.join(dir, name)) except Exception: diff --git a/python/triton/code_gen.py b/python/triton/code_gen.py index 60feb1740..90a031a30 100644 --- a/python/triton/code_gen.py +++ b/python/triton/code_gen.py @@ -1158,8 +1158,7 @@ class DependenciesFinder(ast.NodeVisitor): def default_cache_dir(): - import getpass - return f'/tmp/triton_{getpass.getuser()}' + return os.path.join(os.environ["HOME"], ".triton", "cache") class JITFunction: