Hello,

I'm also unable to use openmp.

I did the following:

File setup.py:
==========================================
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_module = Extension(
    "test",
    ["test.pyx"],
    extra_compile_args=['-fopenmp'],
    extra_link_args=['-fopenmp'],
)

setup(
    name = 'test',
    cmdclass = {'build_ext': build_ext},
    ext_modules = [ext_module],
)
==========================================

File test.pyx
==========================================
from cython.parallel cimport parallel, prange 
 
def toto(long N): 
    cdef long i,j,k 
    cdef long ret = 0 
    with nogil, parallel(): 
        for i in prange(N, schedule='dynamic'): 
            ret = i*i 
    return ret 
 
 
def titi(long N): 
    cdef long i,j,k 
    cdef long ret = 0 
    for i in xrange(N): 
        ret = i*i 
    return ret 
==========================================


When loading file setup.py in sage (5.2.beta0), I have the following error 
message
==========================================
sage: load ~/tmp/setup2.py
---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)

/path-to-sage/devel/sage-myclone/<ipython console> in <module>()

/path-to-sage/local/lib/python2.7/site-packages/sage/misc/preparser.pyc in 
load(filename, globals, attach)
   1646
   1647     if fpath.endswith('.py'):
-> 1648         execfile(fpath, globals)
   1649     elif fpath.endswith('.sage'):
   1650         if (attach and attach_debug_mode) or ((not attach) and 
load_debug_mode):

/user/dcoudert/home/tmp/setup2.py in <module>()
     12 setup(
     13     name = 'test2',
     14     cmdclass = {'build_ext': build_ext},
---> 15     ext_modules = [ext_module],
     16 )

/path-to-sage/local/lib/python/distutils/core.pyc in setup(**attrs)
    138         ok = dist.parse_command_line()
    139     except DistutilsArgError, msg:
--> 140         raise SystemExit, gen_usage(dist.script_name) + "\nerror: 
%s" % msg
    141
    142     if DEBUG:

SystemExit: usage: sage-ipython [global_opts] cmd1 [cmd1_opts] [cmd2 
[cmd2_opts] ...]
   or: sage-ipython --help [cmd1 cmd2 ...]
   or: sage-ipython --help-commands
   or: sage-ipython cmd --help

error: option -i not recognized
Type %exit or %quit to exit IPython (%Exit or %Quit do so unconditionally).
sage: %exit
==========================================


Any help to get it working is more than welcome !

Best,
David.

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to