Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
73c635b9
Commit
73c635b9
authored
7 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Better default paths for config and cache using appdirs module
parent
abb11958
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cache.py
+2
-1
2 additions, 1 deletion
cache.py
cpu/cpujit.py
+9
-16
9 additions, 16 deletions
cpu/cpujit.py
with
11 additions
and
17 deletions
cache.py
+
2
−
1
View file @
73c635b9
...
...
@@ -8,7 +8,8 @@ except ImportError:
try
:
from
joblib
import
Memory
diskcache
=
Memory
(
cachedir
=
"
/tmp/pystencils/joblib_memcache
"
,
verbose
=
False
).
cache
from
appdirs
import
user_cache_dir
diskcache
=
Memory
(
cachedir
=
user_cache_dir
(
'
pystencils
'
),
verbose
=
False
).
cache
except
ImportError
:
# fallback to in-memory caching if joblib is not available
diskcache
=
memorycache
(
maxsize
=
64
)
...
...
This diff is collapsed.
Click to expand it.
cpu/cpujit.py
+
9
−
16
View file @
73c635b9
...
...
@@ -69,6 +69,7 @@ import platform
import
glob
import
atexit
import
shutil
from
appdirs
import
user_config_dir
,
user_cache_dir
from
ctypes
import
cdll
from
pystencils.backends.cbackend
import
generateC
,
getHeaders
from
collections
import
OrderedDict
,
Mapping
...
...
@@ -142,10 +143,7 @@ def _recursiveDictUpdate(d, u):
def
getConfigurationFilePath
():
if
platform
.
system
().
lower
()
==
'
linux
'
:
configPathInHome
=
os
.
path
.
expanduser
(
os
.
path
.
join
(
"
~
"
,
'
.config
'
,
'
pystencils
'
,
'
config.json
'
))
else
:
configPathInHome
=
os
.
path
.
expanduser
(
os
.
path
.
join
(
"
~
"
,
'
.pystencils
'
,
'
config.json
'
))
configPathInHome
=
os
.
path
.
join
(
user_config_dir
(
'
pystencils
'
),
'
config.json
'
)
# 1) Read path from environment variable if found
if
'
PYSTENCILS_CONFIG
'
in
os
.
environ
:
...
...
@@ -177,12 +175,7 @@ def readConfig():
(
'
flags
'
,
'
-Ofast -DNDEBUG -fPIC -march=native -fopenmp -std=c++11
'
),
(
'
restrictQualifier
'
,
'
__restrict__
'
)
])
defaultCacheConfig
=
OrderedDict
([
(
'
readFromSharedLibrary
'
,
False
),
(
'
objectCache
'
,
'
/tmp/pystencils/objectcache
'
),
(
'
clearCacheOnStart
'
,
False
),
(
'
sharedLibrary
'
,
'
/tmp/pystencils/cache.so
'
),
])
elif
platform
.
system
().
lower
()
==
'
windows
'
:
defaultCompilerConfig
=
OrderedDict
([
(
'
os
'
,
'
windows
'
),
...
...
@@ -191,12 +184,12 @@ def readConfig():
(
'
flags
'
,
'
/Ox /fp:fast /openmp /arch:avx
'
),
(
'
restrictQualifier
'
,
'
__restrict
'
)
])
defaultCacheConfig
=
OrderedDict
([
(
'
readFromSharedLibrary
'
,
False
),
(
'
objectCache
'
,
os
.
path
.
join
(
'
~
'
,
'
.
pystencils
'
,
'
objectcache
'
)),
(
'
clearCacheOnStart
'
,
False
),
(
'
sharedLibrary
'
,
os
.
path
.
join
(
'
~
'
,
'
.
pystencils
'
,
'
cache.
dll
'
)),
])
defaultCacheConfig
=
OrderedDict
([
(
'
readFromSharedLibrary
'
,
False
),
(
'
objectCache
'
,
os
.
path
.
join
(
user_cache_dir
(
'
pystencils
'
)
,
'
objectcache
'
)),
(
'
clearCacheOnStart
'
,
False
),
(
'
sharedLibrary
'
,
os
.
path
.
join
(
user_cache_dir
(
'
pystencils
'
)
,
'
cache.
so
'
)),
])
defaultConfig
=
OrderedDict
([(
'
compiler
'
,
defaultCompilerConfig
),
(
'
cache
'
,
defaultCacheConfig
)])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment