IRC channel logs

2014-11-06.log

back to list of logs

***cluck` is now known as cluck
***cluck` is now known as cluck
<nalaginrut>morning guilers~
<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.
<nalaginrut>for the 3D engine?
<davexunit>yeah
<nalaginrut>ah~so cool
<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.
<davexunit>to give OpenGL
<nalaginrut>are you going to change the name of guile-2d? ;-)
<davexunit>nalaginrut: it is now called Sly.
<davexunit>unfortunately, right after I changed the name, someone forked SLIME and named it SLY.
<nalaginrut>oh I didn't know it
<nalaginrut>nice~
<davexunit>but I'm not keen on changing it
<davexunit>again
<nalaginrut>there're always name conflicts, maybe we need namespace
<nalaginrut>guile.sly
<nalaginrut>hmm...guile-sly
<davexunit>I even have a little ascii art mascot https://gitorious.org/sly/sly/raw/5361a105fdcb097def20caa980b1956973810b94:data/mascot.txt
<davexunit>though I guess SLY does, too.
<nalaginrut>so it could generate ASCII art as output
<nalaginrut>any possible for animation? in ascii
<davexunit>hmm? sly doesn't generate textual graphics
<paroneayea>davexunit: I love that ascii art mascot! ;D
<davexunit>:)
*davexunit looks into using the GNU scientific library for matrix mults
<paroneayea>oooh cool idea.
<paroneayea>davexunit: a lot of python people use numpy for their matrix math in pygame/pyglet, so makes sense
<davexunit>this BLAS thing is very confusing
<davexunit>the function names are extremely cryptic
<davexunit>cblas_sgemm, ah yeah, that obviously multiplies 2 matrices.
<davexunit>14 parameters? sounds good!
<cky> https://lists.gnu.org/archive/html/guile-devel/2011-12/msg00172.html <-- hehehe, small world. :-)
<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.
<sneek>Will do.
<ArneBab>sneek: botsnack
<sneek>:)
<lloda`>sneek: later tell davexunit: https://lists.gnu.org/archive/html/guile-user/2014-10/msg00023.html, I also have the beginnings of a wrapper for BLIS in there now
<sneek>Got it.
<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.
<sneek>Okay.
<Chaos`Eternal>who is authoring the guile-inotify
<Chaos`Eternal>i found something weird with that module
<nalaginrut>Chaos`Eternal: you may leave message to him
<Chaos`Eternal>who?
<nalaginrut>b4283
<Chaos`Eternal>i mean, is he in this channel?
<nalaginrut>seems not now
<Chaos`Eternal>well, i c
<nalaginrut>but he'll come I think
<civodul>Hello Guilers!
***aburgess_ is now known as aburgess
<dsmith-work>Morning Greetings, Guilers
<Chaos`Eternal>anybody has idea of handling binary input/output ?
<Chaos`Eternal>reading the documents, but can't get the point
<Chaos`Eternal>my requirement is read a fixed number of bytes and store them in bytevector
<Chaos`Eternal>ok, forget it
<Chaos`Eternal>solved
<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>oh right, this is really cool
<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>yeah, I just hardcode that stuff
<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>it was unboxing floats.
<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?
<davexunit>no, it's specific to 4x4 matrices.
<ArneBab>ah, ok
<lloda`>in guile-ploy you can do (dot + * A B) to multiply two matrices. It's done in a couple of different ways.
<ArneBab>lloda`: nice!
<davexunit>ArneBab: here's my current code: https://gitorious.org/sly/sly/source/14cad2fd445392e46916a6dffbc376376bd014c7:sly/transform.scm
<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.
<ArneBab>jupp
<davexunit>I'm so happy that GSL provides adequate performance. this has been a huge barrier for me.
<lloda`>Arnebab: I wrote to the ml about it here: https://lists.gnu.org/archive/html/guile-devel/2013-03/msg00040.html
<ArneBab>davexunit: wheer do you define transform-matrix?
<davexunit>ArneBab: line 45
<davexunit>it's just an accessor for a record type.
<ArneBab>ah, in define-record-type
<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.
<davexunit>that's cool stuff, lloda`
<davexunit>for sly, I created dedicated types for 2d, 3d, and 4d vectors https://gitorious.org/sly/sly/source/14cad2fd445392e46916a6dffbc376376bd014c7:sly/math/vector.scm
<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>yeah, that's a good point.
<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)
<ArneBab>ok
<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
<davexunit>what's blis?
<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`>blis is https://code.google.com/p/blis
<lloda`>it's BLAS-like library, but with less cruft
<davexunit>ah cool.
<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
<davexunit>I dynamic-link libgslcblas
<davexunit>is that what you mean by cblas directly?
<lloda`>I guess it's just another implementation of libcblas
<lloda`>so yes, that's directly.
<civodul>GSL is unoptimized and sequential
<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
<davexunit>so I guess I'll try netlib.
<davexunit>is that in guix?
<civodul>there's ATLAS in Guix
<civodul>not sure about Netlib's
<civodul>M-x guix-search-by-regexp suggests it's not there :-)
<davexunit>:)
<lloda`>there won't be any difference for small matrices anyway, only for large ones
<davexunit>okay.
<davexunit>so maybe I'll stick with GSL for now.
<ArneBab>lloda`: thanks again! I’ll check your code once I get to experiment.
<lloda`>you're welcome!
<Profpatsch>I don’t get these “not in scope” errors: https://bigmac.caelum.uberspace.de/paste/notinscope.html
<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>yet
<ijp>Profpatsch: but your problem is that pattern matches don't follow |
<ijp>those are for testing conditions, not pattern matching
<Profpatsch>Ah, right.
<ijp>so you should replace | with the function name "temp" and get rid of the first line
<Profpatsch>Dang.
<Profpatsch>And I should use Applicatives instead of nested case of, too.
<davexunit>#guile: Haskell help and support
<dsmith-work>heh
<paroneayea>hello, friends
<Chaos`Eternal>taylanub, thanks
<paroneayea>who's coming to libreplanet, btw?
<paroneayea>I know davexunit and I will
<paroneayea>davexunit has to ;)
<davexunit>yes, I will be there against my will.
<paroneayea>I'd love to meet more guilers
<davexunit>do say hi if you see me.
<paroneayea>davexunit: hehe
<paroneayea>davexunit: I'll say hello to you while you're in the flogging pit
<davexunit>haha sounds good
<paroneayea>alternately, I'll probably also be at FOSDEM
<davexunit>oh cool
<davexunit>you'll be able to see civodul there
<paroneayea>sweet
<civodul>yup
<Profpatsch>Oh lol, did I past my problem in #guile instead of Haskell? :D
<Profpatsch>I’m lucky ijp idles here, too.
<ijp>Profpatsch: that was even the first thing I said to you in my reply
<Chaos`Eternal>helo all
<Chaos`Eternal>a brand new version of guile-inotify is here:
<Chaos`Eternal> https://github.com/ChaosEternal/guile-inotify2
<Chaos`Eternal>totally FFI
<Chaos`Eternal>no c code
<davexunit>Chaos`Eternal: awesome! I want to use inotify for live reloading media in my game engine.
<davexunit>this will be great for that :)
<Chaos`Eternal>davexunit, this is primitive version
<Chaos`Eternal>no errno check
<Chaos`Eternal>no exception
<Chaos`Eternal>but works
<davexunit>still cool :)
<Chaos`Eternal>thx
<Chaos`Eternal>goto sleep
<Chaos`Eternal>i will
<davexunit>sleep: print "night night"
<davexunit>goto sleep
<stis>why not tage floats as 01xxx
<stis>integer as 001xx
<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?
<ArneBab__>wisp 0.8.0 released! http://draketo.de/light/english/wisp-lisp-indentation-preprocessor#v0.8.0
<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__>in short: wget https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.8.0.tar.gz; tar xf wisp-0.8.0.gz ; cd wisp-0.8.0/; ./configure; make check; guile -L . --language=wisp tests/factorial.w
*ArneBab__ is glad to have gotten that far - Guile is awesome for this!
<davexunit>ArneBab: congrats on the release!
<ArneBab__>sneek: later tell davexunit: Thanks!
<sneek>Got it.
<ArneBab__>sneek: botnsack
<Profpatsch>ijp: I guess I started to read from the first highlight so I missed the first part. :)