You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a note which may be useful for people using ccache:
Using virtualenv+pip causes stuff to be built in directories whose names have random components.
As a consequence, ccache seems to produce mostly cache misses when compiling.
# Required to make ccache work properly --- pip builds and installs stuff
# to paths with random components in directory names, which confuses ccache.
#
# To work around this, we need to encourage ccache to be sloppy, and to
# remove the -g flag from compiler flags --- it causes file names to be
# embedded to the object files, which ccache apparently does not like.
import sysconfig
os.environ['CCACHE_SLOPPINESS'] = 'file_macro,time_macros'
os.environ['CCACHE_UNIFY'] = '1'
os.environ['CFLAGS'] = drop_g_flag(sysconfig.get_config_var('CFLAGS'))
os.environ['OPT'] = drop_g_flag(sysconfig.get_config_var('OPT'))
os.environ['LDSHARED'] = drop_g_flag(sysconfig.get_config_var('LDSHARED'))
def drop_g_flag(flags):
"""
Drop -g from command line flags
"""
if not flags:
return flags
return " ".join(x for x in flags.split() if x not in ('-g', '-g1', '-g2', '-g3'))
Not sure whether all of the above are needed, but it appeared that at least UNIFY and dropping -g were necessary to make ccache work with Scipy/Numpy. Files produced by Cython however still seem to produce cache misses --- didn't manage to figure that out yet.
Making asv define the above seems very dirty, but mentioning the pitfall and workaround in docs might be useful.
The text was updated successfully, but these errors were encountered:
Thanks. An earlier version of asv used pip install --editable which builds things in the same place everytime. But that had other issues. I'll play with this suggestion when I get a chance.
Just a note which may be useful for people using ccache:
Using virtualenv+pip causes stuff to be built in directories whose names have random components.
As a consequence, ccache seems to produce mostly cache misses when compiling.
A possible workaround is here: https://github.com/pv/scipy-bench/blob/master/run.py#L29
Not sure whether all of the above are needed, but it appeared that at least UNIFY and dropping
-g
were necessary to make ccache work with Scipy/Numpy. Files produced by Cython however still seem to produce cache misses --- didn't manage to figure that out yet.Making
asv
define the above seems very dirty, but mentioning the pitfall and workaround in docs might be useful.The text was updated successfully, but these errors were encountered: