Re: [sage-devel] Cythonization of Sage extensions, wildcards in module_list.py and Cython directives

2015-04-21 Thread Jeroen Demeyer

On 2015-04-21 15:09, Jeroen Demeyer wrote:

On 2015-04-21 10:00, Jean-Pierre Flori wrote:

That is put Cython directives for linking, including C files and so on,
at the top of the pyx file?


Please wait until I fix
http://trac.cython.org/ticket/845


I now have a pull request for this issue:
https://github.com/cython/cython/pull/381

Ideally, declarations like

# distutils: libraries = gmp

would be added to the .pxd files which Cython would pick up transitively.

There is one issue still to be solved: the *order* of libraries obtained 
this way is essentially random. Perhaps the easiest solution for this is 
defining a global fixed library order in src/setup.py and then 
re-ordering the libraries as they are returned by cythonize().


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Cythonization of Sage extensions, wildcards in module_list.py and Cython directives

2015-04-21 Thread Jeroen Demeyer

On 2015-04-21 10:00, Jean-Pierre Flori wrote:

That is put Cython directives for linking, including C files and so on,
at the top of the pyx file?


Please wait until I fix
http://trac.cython.org/ticket/845

Then you will be able to write those library dependencies in the .pxd 
files where they *really* belong.


As for adding C files as sources (see for example sage.graphs.cliquer), 
it's better to just do the following in the .pyx file:


cdef extern from "myfile.c":
...

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Cythonization of Sage extensions, wildcards in module_list.py and Cython directives

2015-04-21 Thread Jean-Pierre Flori
Dear all,

It seems we're shifting from the original way we were building Cython 
extensions where each extension was listed in module_list.py to use 
wildcards in module_list.py.
See #7987 and #15410 for wide coverage tickets, and e.g. #17767 for more 
focused ones.

This is problematic when some file need special linking or should only be 
optionally compiled.
The latter matter was in part dealt with in #18145.
For both one the solution is then to explicitly list the problematic files 
in module_list.py (on top of the wildcard stuff), or to add cython 
directives in the file itself.
That is what was done in #17962.

Should progressively convert all files in this direction?
That is put Cython directives for linking, including C files and so on, at 
the top of the pyx file?
And uses as many wildcards as possible in module_list.py?
If we do so, we definitely need to update the doc at 
http://www.sagemath.org/doc/developer/coding_in_cython.html.

I also take this opportunity to remember everyone that underlinking is bad.
Linux is nice enough not to complain at compile time, but some other 
platforms do.
In particular many extensions use functions from GMP (recently lots of 
files in coding theory and graph theory) but did not list gmp in the 
libraries to link to.
That would be another thing to add to the doc.

Best,
JP

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.