-
-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cythonize() from cython for Sage module building. #13031
Comments
Attachment: 13031-cythonize.patch.gz |
comment:2
Is the patch based against sage-5.1beta0? I upgraded a sage installation from sage-5.0rc0 to sage-5.1beta0 and it fails to apply there. I will try a sage-5.1beta0 tarball sometime later. |
Changed keywords from none to sd40.5 |
comment:5
Changing to needs work since -- as mentioned above -- this doesn't apply to sage-5.1.beta0:
|
comment:6
Would you please make the following change: --- a
+++ b
@@ -1,1 +1,5 @@
-ext_modules = cythonize(ext_modules, exclude=exclude_modules, nthreads=nthreads, cache=os.path.join(DOT_SAGE, 'cythoncache')))
+if 'CYCACHE_DIR' in os.environ:
+ CYCACHE_DIR = os.environ['CYCACHE_DIR']
+else:
+ CYCACHE_DIR = os.path.join(DOT_SAGE,'cycache')
+ext_modules = cythonize(ext_modules, exclude=exclude_modules, nthreads=nthreads, cache=CYCACHE_DIR)) This way we can easily specify the cache directory separately from |
Attachment: 13031-cythonize-5.1.beta1.patch.gz |
Author: Robert Bradshaw, R. Andrew Ohana |
comment:8
Attachment: 13031-cythonize-5.1.beta2.patch.gz I attached an updated patch that
That said, there is still some issue with Cython's cythonize, even using the old
You'll find that tons of doctests fail, and frequently they are having |
comment:9
Thanks for looking at this. I fixed the patch, Sage relies on a deprecated "feature" of globals(). Running all tests... |
comment:10
FYI, all tests passed for me. |
comment:11
Ok, looks good to me and works well with 5.1.beta2, so I'm going to mark this back as needing review. As expected, it needs to be rebased again on more recent betas, but since the changes to For whoever reviews this, please use 5.1.beta2 as a basis. |
comment:12
The new patch fixes an issue with |
comment:13
Rather than code like this:
you should use |
This comment has been minimized.
This comment has been minimized.
comment:14
I just rebased on 5.2.beta1 since the dependency was merged into that release. However, in the process I discovered that cycache is not ready for primetime yet:
Neither of these modules changed between 5.1.beta2 and 5.2.beta1, but their dependencies changed, so there is some issue with the hashing that needs to be resolved. For now I've disabled cycache, since it will be trivial to re-add once this ticket gets merged. |
comment:15
Yes, I think it's perfectly fine to disable cycache for now to get this in (as it will then be much easier to work on). Could you expound on what the issue was though? I'm not quite following your grep is trying to show... |
comment:55
The file |
This comment has been minimized.
This comment has been minimized.
comment:56
Attachment: 13031-doctest-fix-rebased.patch.gz |
Merged: sage-5.9.beta3 |
Changed merged from sage-5.9.beta3 to sage-5.9.beta4 |
comment:59
Robert: any plans to add the version checking upstream to |
comment:60
I just found some important bug: it seems the dependencies on the files in
should rebuild all files depending on In sage-5.9.beta3, one gets instead lots of lines like
|
comment:61
I'm on it. |
comment:62
Any progress? |
comment:63
The fix will be in Cython 0.19. |
comment:64
(We could backport it if that takes too long.) |
comment:65
Thanks. Anyway, good to know it's a Cython bug, not Sage bug. |
comment:66
Proposal: unmerge this for sage-5.9, merge in again in sage-5.10 together with #14452. |
comment:67
(or possibly merge #14452 in sage-5.9.rc0) |
comment:68
Alternative proposal: cython-0.18.p1. I really would not like to see this unmerged after it finally got in. |
comment:69
Given that cython-0.19 is released today and we have a workaround for the docbuilder crash at #14452, why not cython-0.19? |
comment:70
There are still serious problems with dependency checking: #14544 |
comment:72
Replying to @nexttime:
Looks like just the fact that (where Also (but this doesn't seem to be the cause), print "Copying over all Cython auto-generated .c, .cpp and .h files..."
def cpdir(src, dest):
if not os.path.isdir(dest):
return
for F in os.listdir(src):
if os.path.isdir(src + '/' + F):
cpdir(src + '/' + F, dest + '/' + F)
else:
ext = os.path.splitext(F)[-1]
if ext in ['.h', '.c', '.cpp']:
if 'Cython' in open(src + '/' + F).readline():
os.link(src + '/' + F, dest + '/' +F)
os.utime(dest + '/' +F, None)
cpdir(os.path.abspath('sage/sage'), os.path.abspath(branch + '/sage')) |
comment:73
Replying to @nexttime:
Furthermore, the above code doesn't copy the Cython-generated files from If I add copying |
comment:74
Replying to @nexttime:
diff --git a/sage-clone b/sage-clone
--- a/sage-clone
+++ b/sage-clone
@@ -53,6 +53,10 @@
cpdir(os.path.abspath('sage/sage'), os.path.abspath(branch + '/sage'))
+if os.path.isfile('sage/.cython_version'):
+ print "Copying over hidden Cython version file..."
+ os.link('sage/.cython_version', branch+'/.cython_version')
+
def copy_dtree(src_dir, dest_dir):
src_root = os.path.abspath(src_dir)
dest_root = os.path.abspath(dest_dir) |
Cython's cythonize is now robust enough to replace our custom dependency logic, with a few extra features such as * syntax for cython extensions and cycache (still needs work).
Apply to the Sage library:
Depends on #13029
Depends on #13432
CC: @jdemeyer @roed314 @ohanar @ppurka @kini @mwhansen
Component: build
Keywords: sd40.5
Author: Robert Bradshaw, R. Andrew Ohana
Reviewer: Jeroen Demeyer, R. Andrew Ohana
Merged: sage-5.9.beta4
Issue created by migration from https://trac.sagemath.org/ticket/13031
The text was updated successfully, but these errors were encountered: