Skip to content

Instantly share code, notes, and snippets.

View mattip's full-sized avatar

Matti Picus mattip

  • Quansight Labs
View GitHub Profile
@mattip
mattip / gist:d8f093d408a62305c386
Created December 22, 2014 19:20
A convenience snippet to ease attaching a debugger when compiled with "make debug"
--- a/rpython/translator/c/genc.py Sun Dec 21 17:45:01 2014 +0200
+++ b/rpython/translator/c/genc.py Thu Dec 18 07:07:00 2014 +0200
@@ -462,7 +462,7 @@
else:
if self.translator.platform.name == 'msvc':
- mk.definition('DEBUGFLAGS', '-MD -Zi')
+ mk.definition('DEBUGFLAGS', '-MD -Zi -D_DEBUG')
else:
if self.config.translation.shared:
@mattip
mattip / inverse.py
Last active August 29, 2015 14:15
test inverse of square matrices of arbitrary size
# Benchmark linalg.inv for square matrices.
# Copyright Matti Picus, 2015
# This is free and unencumbered software released into the public domain.
#Anyone is free to copy, modify, publish, use, compile, sell, or
#distribute this software, either in source code form or as a compiled
#binary, for any purpose, commercial or non-commercial, and by any
#means.
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
@mattip
mattip / gist:2d38368b15841a32004a
Created February 12, 2015 23:15
results of running inverse.py - pypy is 3 times slower than cpython
$ ../pypy-virt/bin/pypy inverse.py 5 10 20 50 100 1000
../pypy-virt/site-packages/numpy/linalg/_umath_linalg.py:79: UserWarning: npy_clear_floatstatus, npy_set_floatstatus_invalid not found
warn('npy_clear_floatstatus, npy_set_floatstatus_invalid not found')
after 3999999, for n= 5, time=47.15, 11.79 msec/1000 loops
after 999999, for n= 10, time=19.93, 19.93 msec/1000 loops
after 249999, for n= 20, time=11.85, 47.38 msec/1000 loops
after 39999, for n= 50, time=9.89, 247.18 msec/1000 loops
after 9999, for n=100, time=11.05, 1105.08 msec/1000 loops
after 99, for n=1000, time=29.17, 294613.17 msec/1000 loops
@mattip
mattip / gist:76d48924ee2e8ed8ea0e
Created June 23, 2015 18:47
poor choice of function name
#The function __A_ctor becomes _A__A_ctor automatically, causing
# https://bitbucket.org/pypy/numpy/issue/30
class A():
def get_ctor(self):
return __A_ctor()
def __A_ctor():
return A()
@mattip
mattip / gist:2e6f05f1900eb6a9fd99
Last active November 22, 2015 04:23
numpy test suite results after merginig numpy-1.10: FAILED (KNOWNFAIL=3, SKIP=18, errors=670, failures=113)
grep '\(^[A-Z][a-z][a-zA-Z]*:\)\|\(^AssertionError$\)' numpy_test.log |cut -f1,2 -d, | sort |uniq -c |sort -n -r
74 AssertionError:
45 AttributeError: 'numpy.ndarray' object has no attribute 'partition'
42 TypeError: data type not understood
29 NotImplementedError: einsum not implemented yet
29 NotImplementedError: broadcast not implemented yet
25 ValueError: outer product only supported for binary functions
24 NotImplementedError: digitize not implemented yet
22 TypeError: unsupported operand type(s) for *: 'float64' and 'Polynomial'
19 NotImplementedError: bincount not implemented yet
@mattip
mattip / gist:862860921b06a3527bb7
Created October 30, 2015 01:29
Reply to PyPy deniers
You might be surprised, give it a chance. There are use cases for pure Python JIT accelerated code especially when dealing with small ndarrays since the Python-to-c conversions can require memcpy.
The MyHDL project shows some nice performance boost when using PyPy [0], simulations were comparable to commercial VHDL and HDL simulators.
The puppy team demonstrated real time image processing (30 fps Sobel filtering) a few years ago, in pure Python [1]
[0] http://old.myhdl.org/doku.php/performance
[1] http://morepypy.blogspot.com/2011/07/realtime-image-processing-in-python.html
$ hg heads --template '{node|short}:{branches}:{author|user}\n' |cut -f3 -d: | sort |uniq -c |sort -n -r
41 arigo
16 ronan
14 amauryfa
10 cfbolz
10 alex
7 vincent
7 pjenvey
6 hakan
5 numerodix
@mattip
mattip / gist:18a531daa39e14660a18
Created March 7, 2016 20:05
numpy test failures for release 5.0, 754 total (127 failures, 627 errors) out of 3945 tests
$ grep '\(^[A-Z][a-z][a-zA-Z]*:\)\|\(^AssertionError$\)' /tmp/numpy.log |cut -f1,2 -d, | sort |uniq -c |sort -n -r
87 AssertionError:
48 TypeError: data type not understood
29 NotImplementedError: einsum not implemented yet
29 NotImplementedError: broadcast not implemented yet
25 ValueError: outer product only supported for binary functions
24 NotImplementedError: digitize not implemented yet
22 TypeError: unsupported operand type(s) for *: 'float64' and 'Polynomial'
20 NotImplementedError: 1-arg where unsupported right now
19 ValueError: axes don't match array
@mattip
mattip / gist:05130c84a0e8be73560a
Created March 28, 2016 04:52
setenv.bat for win32 and PyPy
set PATH=d:\pypy_stuff\cpython-release\Scripts;d:\pypy_stuff\local\bin;d:\pypy_stuff\local\tcltk\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;c:\Program Files\TortoiseHg;d:\pypy_stuff\pypy-4.0.1-win32
set INCLUDE=d:\pypy_stuff\local\include;d:\pypy_stuff\local\tcltk\include
set LIBPATH=d:\pypy_stuff\local\lib;d:\pypy_stuff\local\tcltk\lib
set LIB=d:\pypy_stuff\local\lib;d:\pypy_stuff\local\tcltk\lib
set MSRKINECTSDK=
set VS100COMNTOOLS=
set PATHEXT=.COM;.EXE;.BAT;.CMD;.MSC
set PSMODULEPATH=
rem prevent colorama from screwing up the colors
set PY_COLORS=0
@mattip
mattip / gist:0fab727538cfa27f42c6220b84a886e0
Last active May 18, 2016 20:25
upstream numpy after 09e1cffcbf04: Ran 6177 tests FAILED (KNOWNFAIL=12, SKIP=25, errors=141, failures=91)
$ grep -a '\(^[A-Z][a-z][a-zA-Z]*:\)\|\(^AssertionError$\)' test.out |cut -f1,2 -d, | sort |uniq -c |sort -n -r
66 AssertionError:
34 AttributeError: 'module' object has no attribute 'getrefcount'
21 AttributeError: 'method' object has no attribute 'im_func'
17 TypeError: expected a readable buffer object
15 NotImplementedError: settting a slice of a PySequence_Fast is not supported
12 AssertionError
9 TypeError: sys.getsizeof() not implemented on PyPy
6 ValueError: EOF: reading array data, expected 32 bytes got 0
4 UnboundLocalError: local variable 'arr_reloaded' referenced before assignment