***cluck` is now known as cluck
***cluck` is now known as cluck
<davexunit>it seems that the biggest problem with matrix multiplication in my game engine is array access. it's really slow! <davexunit>hmm, or maybe not. I guess it really is just all unboxing floats. <davexunit>I'm going to try to do the matrix multiplication elsewhere. either in some C code or using a common library that can do that. <davexunit>all I really need is a 16 element floating point array. <nalaginrut>are you going to change the name of guile-2d? ;-) <davexunit>unfortunately, right after I changed the name, someone forked SLIME and named it SLY. <nalaginrut>there're always name conflicts, maybe we need namespace *davexunit looks into using the GNU scientific library for matrix mults <paroneayea>davexunit: a lot of python people use numpy for their matrix math in pygame/pyglet, so makes sense <davexunit>cblas_sgemm, ah yeah, that obviously multiplies 2 matrices. <cky>(I was Googling for "A NULL argv[0] was passed through an exec system call." since I wrote a program that intentionally ran a program with no arguments (argc == 0), and saw that the GNU programs don't like that.) <cky>I once sent a patch to Boost.Program_options because it used to segfault when argc == 0. <ArneBab>sneek: later tell davexunit: How do you do the matrix multiplication in sly? It’s something I’d like to try, too. <lloda`>sneek: later tell davexunit: however if you do only 4x4 matrices, those calls may have too much overhead. You should try to multiply bigger matrices. ***aburgess_ is now known as aburgess
<Chaos`Eternal>my requirement is read a fixed number of bytes and store them in bytevector <civodul>Chaos`Eternal: yes, bytevectors and (rnrs io ports) <taylanub>Chaos`Eternal: in case you need such a thing: https://gitorious.org/taylan-guile/bytestructures/ notes: 1. it's inherently somewhat slow (see Performance section of README) 2. as seen in the readme, I actually moved the project to my generic scheme repo, but Guile's R7RS support isn't there yet, so if you want I can easily backport features to this Guile-specific repo <civodul>ISTR that guile-opengl has something similar <davexunit>lloda`: hey, saw your messages from sneek. (sneek told me in #guix) <davexunit>your cblas wrapper is cool! at the momment, though, I only need the cblas_sgemm function, so I just wrapped it myself. <davexunit>you might be right about cblas adding too much overhead for simple 4x4 matrices, but compared to doing the multiplication with guile, it's *much* faster. <davexunit>I have a test that renders 200 individual cubes, and performance went from 12fps to 60fps when I re-implemented my multiplication procedure to call cblas_sgemm. <lloda`>cool, I didn't know sneek could do that. <lloda`>I made the wrappers as generic as I could, but if you hardcoded lda/inc/trans... and didn't need the checks, your wrapper is surely faster. <davexunit>so now with the multiplication situation being a lot better, I can optimize other things. <davexunit>like using mutable matrices in the low-level rendering code <lloda`>however it is a real problem that array-ref is so slow <davexunit>it's not really array-ref, that was a mistake. <davexunit>I replaced the array-ref calls with random:uniform and the performance was bad, too. <davexunit>so, until guile has a better story for flonums, which I'm confident it will have in due time, I can just use GSL functions with typed arrays and move on with my life. <ArneBab>davexunit: how did you do mutrix multiplication before? <davexunit>ArneBab: used srfi-42 to iterate over the cells. <ArneBab>so multidimensional arrays? did you implement generic multiplication functions with that? <lloda`>in guile-ploy you can do (dot + * A B) to multiply two matrices. It's done in a couple of different ways. <davexunit>(not using GSL, since that hasn't been committed) <davexunit>by focusing on only 4x4 matrices, I optimize for what 2d/3d games need. <davexunit>I'm so happy that GSL provides adequate performance. this has been a huge barrier for me. <ArneBab>davexunit: wheer do you define transform-matrix? <davexunit>yeah, <transform> is just a wrapper over the underlying array. <ArneBab>lloda`: sounds good., though I don’t think that I really understand it yet. <lloda`>ha, thanks, it's very much unfinished though. <lloda`>I just use 2D arrays of shape [n 2] or [n 3] or [n 4] for that <lloda`>so I can have n vectors compact in memory <davexunit>I could always go that direction if need be, I guess. <ArneBab>lloda`: I have some math here which I would like to test in Guile (Ensemble Kalman Filter) and I had feared that I would have to write all the matrix functions myself. <ArneBab>lloda`: do you also have stuff for calculating the pseudo-inverse and such? <lloda`>I have lapack wrappers, but when I wrote them there was no ffi, they are in C++ <ArneBab>so it would not be as easy as throwing the files into a project :) <ArneBab>lloda`: does cblas.scm work without blis? <lloda`>unfortunately no. importing the lapack routines using the ffi is easy enough, but you'd still need to do some work after that <lloda`>(ffi cblas) and (ffi blis) are totally independent <lloda`>you don't need blis at all to use cblas (or viceversa) <lloda`>I like blis better because it is much more regular as a library, so I decided to wrap it too, but you can ignore it no problem <ArneBab>I just checked whether my Gentoo has it, but it does not <davexunit>I'm new to this BLAS stuff, so I chose GSL because it was GNU and commonly available, most likely. <lloda`>it's BLAS-like library, but with less cruft <davexunit>do you think there's any good reason for me to use this over GSL? <lloda`>actually I don't see why you use the GSL instead of CBLAS directly <lloda`>I guess it's just another implementation of libcblas <civodul>the Netlib one is supposed to be blazingly fast, AIUI <lloda`>in any distro there's a few libcblasses, there's ATLAS, there's OpenBLAS, there's Netlib's <civodul>M-x guix-search-by-regexp suggests it's not there :-) <lloda`>there won't be any difference for small matrices anyway, only for large ones <ArneBab>lloda`: thanks again! I’ll check your code once I get to experiment. <Profpatsch>Why doesn’t the pattern matching work? Some stupid beginner mistake I think. <ijp>well, the main problem is that guile doesn't support haskell <ijp>Profpatsch: but your problem is that pattern matches don't follow | <ijp>those are for testing conditions, not pattern matching <ijp>so you should replace | with the function name "temp" and get rid of the first line <Profpatsch>And I should use Applicatives instead of nested case of, too. <paroneayea>davexunit: I'll say hello to you while you're in the flogging pit <Profpatsch>Oh lol, did I past my problem in #guile instead of Haskell? :D <ijp>Profpatsch: that was even the first thing I said to you in my reply <davexunit>Chaos`Eternal: awesome! I want to use inotify for live reloading media in my game engine. <stis>why not tage floats as 01xxx <stis>number logic will be more convoluted but the overhead in current floats is in heap storage <stis>later on with type checker and fancy compilers the overhead goas away anyway no? <taylanub>stis: it's comfortable to think "that will be fixed anyway one day when we make this and that big improvement" but I'm not sure if it's good practice. <taylanub>I'm guilty of it too; I made my bytestructures library inherently dynamic, thinking that aggressive optimizations should eliminate all the overhead anyway, and then realized that none of the big Scheme implementations can do it... *ArneBab__ is glad to have gotten that far - Guile is awesome for this! <Profpatsch>ijp: I guess I started to read from the first highlight so I missed the first part. :)