Ticket #11574: trac_11574_m4ri_sse2.patch

File trac_11574_m4ri_sse2.patch, 3.7 KB (added by malb, 10 years ago)
  • module_list.py

    # HG changeset patch
    # User Martin Albrecht <malb@informatik.uni-bremen.de>
    # Date 1314631562 -3600
    # Node ID 2498b66c3d46ecae81c02d1f39b0651391135778
    # Parent  4313fad4ecad5c8045f4a7de3a4a4289e38c4bef
    #11574 compile Sage extensions with SSE2 when needed by M4RI
    
    diff -r 4313fad4ecad -r 2498b66c3d46 module_list.py
    a b  
    5858ginac_depends = [SAGE_INC + 'pynac/ginac.h']
    5959
    6060#########################################################
     61### M4RI flags
     62#########################################################
     63
     64import ast
     65m4ri_have_sse2 = False
     66for line in open(SAGE_INC + "m4ri/m4ri_config.h"):
     67    if not line.startswith("#define __M4RI_HAVE_SSE2"):
     68        continue
     69    m4ri_have_sse2 = bool(ast.literal_eval(line[len("#define __M4RI_HAVE_SSE2"):].strip()))
     70    break
     71
     72if m4ri_have_sse2:
     73    m4ri_extra_compile_args = ['-msse', '-msse2']
     74else:
     75    m4ri_extra_compile_args = []
     76
     77#########################################################
    6178### PolyBoRi defines
    6279#########################################################
    6380
    64 import ast
    6581polybori_extra_compile_args = []
    6682for line in open(SAGE_LOCAL + "/share/polybori/flags.conf"):
    6783    if not line.startswith("CPPDEFINES"):
     
    883899    # TODO -- change to use BLAS at some point.
    884900    Extension('sage.matrix.matrix_integer_dense',
    885901              sources = ['sage/matrix/matrix_integer_dense.pyx'],
    886               extra_compile_args = ['-std=c99'],
     902              extra_compile_args = ['-std=c99'] + m4ri_extra_compile_args,
     903              depends = [SAGE_INC + 'm4ri/m4ri.h'],
    887904              # order matters for cygwin!!
    888905              libraries = ['iml', 'pari', 'm', 'gmp', BLAS, BLAS2]),
    889906
     
    894911    Extension('sage.matrix.matrix_mod2_dense',
    895912              sources = ['sage/matrix/matrix_mod2_dense.pyx'],
    896913              libraries = ['gmp','m4ri', 'gd', 'png12', 'z'],
    897               extra_compile_args = ['-std=c99'],
     914              extra_compile_args = ['-std=c99'] + m4ri_extra_compile_args,
    898915              depends = [SAGE_INC + "png.h", SAGE_INC + "m4ri/m4ri.h"]),
    899916
    900917    Extension('sage.matrix.matrix_modn_dense',
     
    10961113    Extension('sage.modules.vector_mod2_dense',
    10971114              sources = ['sage/modules/vector_mod2_dense.pyx'],
    10981115              libraries = ['gmp','m4ri', 'png12', 'gd'],
    1099               extra_compile_args = ['-std=c99'],
     1116              extra_compile_args = ['-std=c99'] + m4ri_extra_compile_args,
    11001117              depends = [SAGE_INC + "png.h", SAGE_INC + "m4ri/m4ri.h"]),
    11011118   
    11021119    Extension('sage.modules.vector_rational_dense',
     
    14791496    Extension('sage.rings.polynomial.polynomial_gf2x',
    14801497              sources = ['sage/rings/polynomial/polynomial_gf2x.pyx'],
    14811498              libraries = ['ntl', 'stdc++', 'gmp'],
     1499              extra_compile_args = m4ri_extra_compile_args,
    14821500              language = 'c++',
     1501              depends = [SAGE_INC + 'm4ri/m4ri.h'],
    14831502              include_dirs = ['sage/libs/ntl/']),
    14841503
    14851504    Extension('sage.rings.polynomial.polynomial_zz_pex',
     
    15291548                              SAGE_INC + 'polybori',
    15301549                              SAGE_INC + 'polybori/groebner',
    15311550                              "sage/libs/polybori"],
    1532               depends = [SAGE_INC + "polybori/polybori.h"],
    1533               extra_compile_args = polybori_extra_compile_args,
     1551              depends = [SAGE_INC + "polybori/polybori.h", SAGE_INC + 'm4ri/m4ri.h'],
     1552              extra_compile_args = polybori_extra_compile_args + m4ri_extra_compile_args,
    15341553              language = 'c++'),
    15351554
    15361555    Extension('sage.rings.polynomial.polynomial_real_mpfr_dense',