I am running a Jupyter notebook on a remote server. Part of this notebook calls a Cython .pyx
file cython_file
which contains a c++ function definition called cpp_function
and is called from the notebook like this:
from clibs.cython_file import cpp_function
Inside the .pyx
file I am calling a c++ header file cpp_file.h
like this:
cdef extern from "/home/user/cpp_file.h":
Inside this header file I have the function as defined in cython which, for argument sake, is just a simple logic function.
My issue is this; sometimes when I change the .h
c++ file and restart the notebook kernel and re-run the code, nothing changes. It still uses the old version of the .h
file. As if it's being cached somewhere.
I have deleted all .pyxbldc
and .pyc
files before restarting the kernel to no avail.
My .pyxbld
file looks like this:
def make_ext(modname, pyxfilename):
from distutils.extension import Extension
return Extension(name=modname,
sources=[pyxfilename], extra_compile_args=['-fopenmp', '-w'], extra_link_args=['-fopenmp'], language='c++')
Any ideas on how to stop the c++ file from being cached?!
~/.ipython/cython
, so I runrm -rf ~/.ipython/cython
every time I change Cython code in my Jupyter notebook. I'm not sure how to extend this solution for your situation, but maybe that'll get you started./home/<user_name>/.cache/ipython/cython