cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
<tos9>
mattip: what did we end up thinking about MACOSX_DEVELOPMENT_TARGET -- I forget who else here was talking about it recently
<tos9>
mattip: In https://github.com/Julian/svmlight-loader/blob/master/tox.ini#L25 bumping it to 10.9 made numpy at least install, but I actually remember now I forgot to check that it doesn't just fail somewhere down the line, so probably I should run numpy.test or whatever it's called
<michelp>
I was going to spend some time today trying and try to avoid using literal C code, was hoping it was possible to user a numba.types.Record instead of the cdef code but haven't found a way around that yet
<arigato>
data = ffi.new('BF_tuple[1]')
<arigato>
ptr = ffi.cast('BF_tuple*', data)
<arigato>
here 'data' and 'ptr' are roughly the same thing, so you really only need "data = ffi.new('BF_tuple *')"
<arigato>
or 'BF_tuple[1]', that's almost equivalent
<arigato>
the point is that the cast that follows is never necessary
<michelp>
but I see what you mean, I'll fix that up
<arigato>
to answer your question, if you really don't want to write ffi.new('BF_tuple *') with a string, you can also write ffi.new(ffi.typeof('BF_tuple *')), and then move the ffi.typeof('BF_tuple *') into some global constant and use that
<arigato>
it's a constant that represents the same type in a non-string fashion
<michelp>
that's a good idea, the string I was hoping to avoid was having to write out the struct and function prototypes and instead build those structures programatically
<arigato>
ah, the string you pass in cdef()? sorry I misunderstood
<michelp>
and sort of hide the machinery behind some abstractions
<arigato>
yes, it's a nice idea to hide the machinery behind abstractions in general
<michelp>
all the users care about are the struct and the two functions (bf_min/bf_plus) those are the essential bits to build operations
<arigato>
note that I see you call ffi.set_source(), but go on using this ffi for operations like ffi.new()
<arigato>
that set_source() is only meaningful if you're doing offline building
<michelp>
ah yeah, sorry that vestigial to my example from me playing around
<arigato>
OK
<arigato>
so no, there is no alternative to providing cdef() with one (or a few) big strings
<arigato>
maybe you can build that string from some other places instead of having it hard-coded, but in the end you need the string
<michelp>
what's got me there is there's two ffi object, the one from the library wouldn't let me do somethign, sorry i can't remember it after sleeping it got flushed out, but it was giving me an error that it was "CompiledFFI" or something like that, so I had to make a new one
<arigato>
in terms of that overview.html web page, a "CompiledFFI" is the type of the ffi object you get from "from _pi_cffi import ffi, lib"
<arigato>
and indeed such an ffi object doesn't have the cdef() method any more, because it's supposed to be already built from the _pi_cffi module (in this case)
<michelp>
ok, that makes sense as follows basically what i was guessing at there
<arigato>
sorry, I don't really know numba's cffi_support, so I'm not sure about the details there
<michelp>
was thinking that might be another approach, users write jitclasses with operations that map to the matrix operators
<arigato>
sorry, I really know next to nothing about numba
<michelp>
that's fine, you've been super helpful thank you! and cffi is one of my favorite libraries, and a python and C programmer it's the best of both worlds :)
<arigato>
:-)
<michelp>
once i get around this hurdle pygraphblas will be essentially 100% feature complete which i'm pretty excited about
<arigato>
yes, I can only repeat that ideally, you're supposed to use cffi "under the hood" when designing some nicer Pythonic interface on top of it
<arigato>
:-)
<michelp>
yeah most of graphblas is hidden away, the User Defined Type stuff is where there's some exposure of the lower level stuff, it might be unavoidable as it's the most advanced usage of the library
Cheery_ has quit [Quit: Reconnecting]
Cheery has joined #pypy
<michelp>
unfortunately it's pretty critical to solving any advanced problems so i'm going to keep trying to simplify until I get there
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 265 seconds]
jcea has quit [Ping timeout: 245 seconds]
xcm has joined #pypy
<mattip>
marmoute: ping
<marmoute>
mattip: pong
altendky has quit [Quit: Connection closed for inactivity]