antocuni changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://botbot.me/freenode/pypy/ ) | use cffi for calling C | "PyPy: the Gradual Reduction of Magic (tm)"
jcea has joined #pypy
jcea has quit [Client Quit]
jcea has joined #pypy
drolando has joined #pypy
yuyichao_ has quit [Ping timeout: 268 seconds]
adamholmberg has joined #pypy
adamholmberg has quit [Read error: No route to host]
adamholm_ has joined #pypy
adamholm_ has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
yuyichao_ has joined #pypy
adamholmberg has quit [Ping timeout: 260 seconds]
aboudreault has quit [Excess Flood]
amaury has quit [Quit: Konversation terminated!]
amaury has joined #pypy
aboudreault has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
amaury has quit [Ping timeout: 240 seconds]
jneen_ is now known as jneen
tbodt has joined #pypy
ceridwen has quit [Ping timeout: 276 seconds]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tbodt has joined #pypy
ceridwen has joined #pypy
marr has quit [Ping timeout: 268 seconds]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tbodt has joined #pypy
tbodt has quit [Client Quit]
tav` has joined #pypy
tbodt has joined #pypy
tav has quit [Ping timeout: 260 seconds]
tav` is now known as tav
tbodt has quit [Client Quit]
tbodt has joined #pypy
tbodt has quit [Client Quit]
ArneBab has joined #pypy
ArneBab_ has quit [Ping timeout: 268 seconds]
dddddd has quit [Remote host closed the connection]
jcea has quit [Ping timeout: 240 seconds]
jamesaxl has joined #pypy
asmeurer____ has joined #pypy
asmeurer__ has quit [Ping timeout: 240 seconds]
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #pypy
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #pypy
dmalcolm has quit [Ping timeout: 260 seconds]
dmalcolm has joined #pypy
fryguybob has quit [Read error: Connection reset by peer]
fryguybob has joined #pypy
fryguybob has quit [Read error: Connection reset by peer]
fryguybob has joined #pypy
solarjoe4 has joined #pypy
<solarjoe4> I have a question about member padding in C structs, cffi.buffer and numpy.frombuffer, it can be found here: https://stackoverflow.com/questions/48423725/how-to-handle-member-padding-in-struct-when-reading-cffi-buffer-with-numpy-fromb any ideas how to handle this clean and dynamically?
tayfun26 has joined #pypy
drolando has quit [Remote host closed the connection]
drolando has joined #pypy
<arigato> solarjoe4: I added an answer yesterday, are you looking for something else?
<arigato> as for "why does the padding happen", cffi tries as best as possible to emulate the C compiler for your platform, so on Windows (only) it aligns "double" on 8 bytes
<solarjoe4> arigato, oh, that's you :) I responded earlier, the structs are not defined within my code, but a thrird party dll, so I can't pack them. basically I am looking for no-worry hassle free way to handle this, because there are a lot of structs...
<arigato> I guess either numpy doesn't add any alignment, or they have their own rules that says that "doublre" is only 4 bytes-aligned
<arigato> ah I see
<arigato> then it's really a question for numpy
<solarjoe4> bascically I need either numpy or cffi to be smart enough to handle the padding
<arigato> how to have numpy accept the particular extra padding that you don't really control
<arigato> how is that a cffi issue?
<arigato> well I guess, you could have two structures declared in the cdef
<arigato> one with packed=True and the other without (so two calls to ffi.cdef())
<arigato> and copy the fields manually from one to the other
<solarjoe4> didn't mean that, I am just not that familiar in detail with C
<solarjoe4> and cffi...
<arigato> so, the C compiler can add padding and depends a bit on which exact C compiler is used
<solarjoe4> or is there a completely different way to do this? instead of cffi.buffer and np.frombuffer? or is this generally the right way?
<arigato> if your input is really a C structure with such padding, then using cffi like you do is probably the sanest option
<arigato> but then if you want to pass it to numpy, you can't use the same structure directly
<arigato> so, either you copy the fields one by one into the numpy array (slow unless you're on pypy)
<arigato> or you convert into packed data, like a struct declared with packed=True
<arigato> or, indeed, you add padding in the numpy array declaration
<arigato> if you want an automated way to know the padding, you can do that:
<solarjoe4> yes, but I need to know where to insert the paddings
<arigato> ok
<arigato> you can use for example ffi.offsetof("mystruct", "a")
<arigato> and ffi.sizeof("mystruct")
<arigato> and use this info to build the dtype list with padding
<arigato> (painfully)
<solarjoe4> hm ok, thanks, I have to read on the functions
<arigato> (you don't have to add a 'f4' for padding; it's more general to add a number of bytes ('i1') instead)
<solarjoe4> I will probably run into problems :)
<solarjoe4> because the effect is the same?
<arigato> yes
<arigato> well if your structure really has got only one place where it could need padding,
<arigato> you can also go for the special solution
<arigato> and insert an 'f4' only if ffi.offsetof("mystruct", "d") > ffi.offsetof("mystruct", "c") + 4, for example
<solarjoe4> hm there are many structs, probably no special cases, they are not even sorted by size. would I use ffi.typeof to find the fields of the struct, then get their type and offset and check from there?
<arigato> yes
<solarjoe4> would ffi.alignof be of any use?
<arigato> it looks harder to use, there
<arigato> it's used inside cffi itself to know which offsetof should be applied
<arigato> but in this case, you're really interested in these offsetofs
yuyichao_ has quit [Ping timeout: 240 seconds]
yuyichao_ has joined #pypy
oberstet has joined #pypy
yuyichao has joined #pypy
yuyichao_ has quit [Ping timeout: 252 seconds]
oberstet has quit [Ping timeout: 240 seconds]
asmeurer____ has quit [Quit: asmeurer____]
dddddd has joined #pypy
antocuni has joined #pypy
oberstet has joined #pypy
igitoor has quit [Ping timeout: 256 seconds]
marr has joined #pypy
igitoor has joined #pypy
igitoor has quit [Changing host]
igitoor has joined #pypy
Kronuz has quit [Ping timeout: 240 seconds]
Kronuz has joined #pypy
antocuni has quit [Ping timeout: 260 seconds]
drolando has quit [Remote host closed the connection]
drolando has joined #pypy
larsivi has joined #pypy
marky1991 has joined #pypy
jcea has joined #pypy
raynold has quit [Quit: Connection closed for inactivity]
adamholmberg has joined #pypy
antocuni has joined #pypy
amaury has joined #pypy
amaury has quit [Quit: Konversation terminated!]
marky1991 has quit [Remote host closed the connection]
amaury has joined #pypy
marky1991 has joined #pypy
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
Rhy0lite has joined #pypy
dddddd has quit [Remote host closed the connection]
amaury has quit [Quit: Konversation terminated!]
amaury has joined #pypy
d0x0b has joined #pypy
amaury has quit [Quit: Konversation terminated!]
yuyichao has quit [Ping timeout: 248 seconds]
amaury has joined #pypy
yuyichao has joined #pypy
realitix has joined #pypy
dddddd has joined #pypy
squeaky_pl has joined #pypy
mat^2 has joined #pypy
amaury has quit [Ping timeout: 276 seconds]
tbodt has joined #pypy
amaury has joined #pypy
d0x0b has quit [Quit: d0x0b]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tayfun26 has quit [Quit: tayfun26]
yuyichao has quit [Ping timeout: 268 seconds]
amaury has quit [Ping timeout: 240 seconds]
solarjoe4 has quit [Quit: Leaving]
yuyichao has joined #pypy
tbodt has joined #pypy
tbodt has quit [Client Quit]
tbodt has joined #pypy
tbodt has quit [Client Quit]
tbodt has joined #pypy
tbodt has quit [Client Quit]
yuyichao has quit [Quit: Konversation terminated!]
yuyichao_ has joined #pypy
jcea has quit [Read error: Connection reset by peer]
jcea has joined #pypy
raynold has joined #pypy
yuyichao_ has quit [Ping timeout: 264 seconds]
realitix has quit [Quit: realitix]
yuyichao_ has joined #pypy
squeaky_pl has quit [Ping timeout: 240 seconds]
oberstet has quit [Ping timeout: 240 seconds]
demonimin has quit [Ping timeout: 268 seconds]
demonimin has joined #pypy
lritter has joined #pypy
kenaan_ has joined #pypy
<kenaan_> cfbolz mapdict-size-limit cad94dfb7a45 /pypy/objspace/std/: test mixing of slots and dict items, fix translation
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/5233 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
<bbot2> Started: http://buildbot.pypy.org/builders/own-linux-x86-64/builds/6520 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
<bbot2> Started: http://buildbot.pypy.org/builders/own-linux-x86-32/builds/5694 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-32/builds/4460 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
<kenaan_> cfbolz mapdict-size-limit eb5baafd0c6e /pypy/doc/whatsnew-head.rst: document branch
forgottenone has joined #pypy
mattip has joined #pypy
<kenaan_> mattip default 24a8129c7c62 /rpython/: fix some win32 rpython failures
<mattip> there are test_rgil failures on both TestGILAsmGcc and TestGILShadowStack
<mattip> rgil.invoke_after_thread_switch(seeme) is being called twice as often as expected
antocuni has quit [Ping timeout: 248 seconds]
marky1991 has quit [Ping timeout: 240 seconds]
forgottenone has quit [Quit: Konversation terminated!]
adamholm_ has joined #pypy
adamholmberg has quit [Ping timeout: 240 seconds]
<bbot2> Failure: http://buildbot.pypy.org/builders/own-linux-x86-64/builds/6520 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
<bbot2> Failure: http://buildbot.pypy.org/builders/own-linux-x86-32/builds/5694 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
adamholm_ has quit [Read error: Connection reset by peer]
adamholmberg has joined #pypy
marky1991 has joined #pypy
tbodt has joined #pypy
webmeister has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bbot2> Success: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/5233 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
lritter has quit [Quit: Leaving]
<bbot2> Success: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-32/builds/4460 [Carl Friedrich Bolz-Tereick: force build, mapdict-size-limit]
tbodt has joined #pypy
marky1991 has quit [Remote host closed the connection]
<kenaan_> mattip default 5dbbf103b988 /: update cffi to 1.11.4
Rhy0lite has quit [Quit: Leaving]
mattip has left #pypy ["Leaving"]
inad922 has joined #pypy
forgottenone has joined #pypy
marky1991 has joined #pypy
webmeister has quit [Quit: Quit]
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
inad922 has quit [Ping timeout: 240 seconds]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
webmeister has joined #pypy
tbodt has joined #pypy
marky1991 has quit [Ping timeout: 268 seconds]
marky1991 has joined #pypy
forgottenone has quit [Ping timeout: 252 seconds]
marky1991_2 has joined #pypy
marky1991 has quit [Ping timeout: 268 seconds]
marky1991_2 has quit [Ping timeout: 240 seconds]
amaury has joined #pypy
amaury has quit [Client Quit]
amaury has joined #pypy
marky1991 has joined #pypy
cjwelborn has quit [Remote host closed the connection]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tbodt has joined #pypy
adamholmberg has quit [Remote host closed the connection]
Code4Dopamine has quit [Ping timeout: 260 seconds]