Ticket #12690: dumb_code.patch

File dumb_code.patch, 1.2 KB (added by jdemeyer, 9 years ago)

very basic code demonstrating the issue

  • module_list.py

    # HG changeset patch
    # User R. Andrew Ohana <andrew.ohana@gmail.com>
    # Date 1338070846 25200
    # Node ID 7a30f7caa8134874c8381cf0e20ec59cdd376945
    # Parent  7e53dee0ce5cf2da112447be22b5ef2723b849d2
    [mq]: dumb_code.patch
    
    diff --git a/module_list.py b/module_list.py
    a b  
    20212021   
    20222022    Extension('sage.tests.cython',
    20232023              sources = ['sage/tests/cython.pyx']),
     2024
     2025    Extension('sage.dumb', sources=['sage/dumb.pyx'], extra_compile_args=['-fopenmp'], extra_link_args=['-fopenmp']),
    20242026   
    20252027    ################################
    20262028    ##
  • sage/all.py

    diff --git a/sage/all.py b/sage/all.py
    a b  
    166166
    167167from sage.matroids.all   import *
    168168
     169from sage.dumb import *
     170
    169171from copy import copy, deepcopy
    170172
    171173# The code executed here uses a large amount of Sage components
  • new file sage/dumb.pyx

    diff --git a/sage/dumb.pyx b/sage/dumb.pyx
    new file mode 100644
    - +  
     1from cython.parallel import prange
     2
     3include 'ext/interrupt.pxi'
     4
     5def dumb_function():
     6    cdef int i,x
     7    sig_on()
     8    while True:
     9        for i in prange(1<<30,nogil=True):
     10            x += i
     11    sig_off()
     12    return x