Open in new window / Try shogun cloud
--- Log opened Sat Nov 17 00:00:17 2012
-!- zxtx [~zv@] has joined #shogun00:02
-!- zxtx [~zv@] has quit [Ping timeout: 245 seconds]00:17
-!- blackburn [~blackburn@] has quit [Quit: Leaving.]00:34
shogun-buildbotbuild #145 of nightly_all is complete: Failure [failed compile]  Build details are at
shogun-buildbotbuild #151 of nightly_none is complete: Failure [failed compile]  Build details are at
shogun-buildbotbuild #174 of nightly_default is complete: Failure [failed compile]  Build details are at
-!- ptizoom [~christian@] has joined #shogun08:53
-!- zxtx [] has joined #shogun09:34
-!- blackburn [~blackburn@] has joined #shogun10:01
-!- blackburn [~blackburn@] has quit [Quit: Leaving.]12:37
-!- blackburn [~blackburn@] has joined #shogun13:14
blackburnsonney2k: I see you are a fan of russian driving?13:14
-!- blackburn [~blackburn@] has quit [Client Quit]13:14
-!- blackburn [~blackburn@] has joined #shogun13:17
-!- blackburn [~blackburn@] has quit [Client Quit]13:18
-!- blackburn [~blackburn@] has joined #shogun13:24
-!- blackburn [~blackburn@] has quit [Client Quit]13:25
-!- blackburn [~blackburn@] has joined #shogun13:26
-!- blackburn [~blackburn@] has quit [Remote host closed the connection]14:12
wikingNCBM is wooooooooooooooooorking14:18
wikingat least the convex part of it!14:19
-!- blackburn [~blackburn@] has joined #shogun14:32
wikingblackburn: maaan14:43
wikinggood news14:43
wikingncbm started to work!14:43
wikingmaybe even lbfgs14:46
wikingcan compute only the linesearch? :)14:46
wikingit seems not14:46
blackburnyou mean pass a function to let it do linesearch only?14:47
blackburnno idea14:47
wikingas it has the line search algo implemented i need14:47
blackburncopy paste14:47
wikingyeah maybe14:47
wikingor as shogun has it14:47
wikingi should be able to call it as extern14:47
wikinglbfgs can solve min f(x)?14:48
blackburnthat's what it purposed to, no?14:48
wikingi'm wondering what it can solve14:49
blackburnany nonlinear problem I think14:49
blackburnwith continuous gradient at least14:50
wikingi could give it  go i guess ;)14:51
wikinglol it's one big c file14:54
wikingmmm i think i should be able to call it14:54
wikingmmm this'll be an interesting one14:57
wikingi do better with less iterations16:00
wiking115 vs 44 iterations16:01
wikingbut there's 2 times more cutting planes16:01
wikingwell something for someting16:01
blackburnsonney2k: I think you should take a look at the Processing language18:52
wikingsomeone should fix the inline malloc ;)19:13
blackburnwho cares19:13
@sonney2kwiking, I think we should (inside of) SG_INPLACE_MALLOC use new[]() and SG_INPLACE_FREE then to free it20:44
blackburnfree new[] is a good idea ;)20:45
@sonney2kblackburn, what do you want to say?20:45
blackburnjust joking20:45
blackburnI mean we have to be careful to delete[] it20:45
blackburnnot to delete or free20:45
@sonney2kblackburn, sure20:47
@sonney2kit sucks big times that the only reason for the existence of new[] is that new[]() stuff20:47
@sonney2kwhich is so cumbersome in syntax that it really feels broken by design :/20:48
@sonney2kanyways SG_MALLOC has helped us a lot to avoid copying matrices20:48
blackburnwhy? I don't feel new[] is inconsistent20:48
@sonney2knew[]() ?20:48
blackburnwhat is new[]()?20:49
@sonney2kblackburn, that is what we need to call the default constructor20:49
@sonney2kyour placement constructor / inplace new20:49
blackburnnew FuckerClass[30]();20:49
blackburnlike that?20:49
blackburnwell still - isn't really inconsistent20:49
@sonney2knew SGVector<int>[40]();20:49
blackburnI mean it is quite minimal20:49
@sonney2kyou cannot mix any of the stuff above20:50
@sonney2kso you break all api's to C20:50
@sonney2kand we interface to lots of C libraries20:50
blackburninterfacing is not a problem20:50
blackburnpointers are valid still20:50
blackburnand libraries do not free our resources20:51
@sonney2kso we basically need to stay at malloc & friends20:51
@sonney2kyeah but it is not just calling it is owning a ptr allocated by e.g. numpy20:51
@sonney2kand vise versa20:51
blackburnwe let libs own our memory only in sgvector case I think20:52
blackburnso for collections of vectors or anything like that20:52
blackburnwe can use new[]20:52
@sonney2kbut new[] is not enough20:52
blackburnwhat's the problem with new[]() and new[]?20:53
@sonney2kit is a big difference20:53
@sonney2kone will be as bad as malloc()20:53
@sonney2k(requiring the placement constructor call)20:53
@sonney2kand the issue I have with this is that I would have liked to just use one macro for all SG_MALLOC20:54
@sonney2kso now we again have to be cautious which malloc macro we use20:54
blackburnit is possible with templates :D20:54
@sonney2khow so?20:55
blackburnwe specialize template for stypes like float64-t20:55
blackburnto not call in-place20:55
@sonney2kbut we cannot do it for everything20:56
@sonney2kI mean think of people using some structure20:56
blackburnit is actually compiles to inplace say float20:56
blackburn(I think so)20:56
blackburnI mean new float[64]() works20:56
@sonney2kmaybe the other way around would work20:57
@sonney2kwe specialize templates only for SGVector & friends20:57
blackburnyeah it would work too20:57
@sonney2kto call new[]()20:57
@sonney2kand delete[]20:57
@sonney2kso to do this we would need to make the sg_malloc function templated20:58
@sonney2kand then overload the implementation for SGVector20:58
blackburnyes, if we specialize it it would work smoothly20:59
@sonney2kbut will this compile - I mean when we define a  templated function that uses malloc by default?20:59
blackburnwhy not?20:59
@sonney2kwell conflict in function definition? no?21:00
blackburnno, it is not overloading21:00
@sonney2kI mean if we specialize one type - don't we have to specialize all types?21:00
blackburnit is specialization21:00
blackburnjust put it to header21:00
@sonney2ksure about that?21:00
blackburnabsolutely, that's how generic C++ works21:00
@sonney2kwe ignore lib/memory* in interfaces anyways21:00
@sonney2kso then that will solve all our problems21:00
@sonney2kand we can get rid of this sh* extra macro21:01
blackburntemplate<typename T> sg_malloc(...) { default impl }21:02
blackburntemplate<> sg_malloc<SGVector> sg_malloc(...) { inplace }21:02
@sonney2kand we can acturally even return a T*21:02
blackburnah return type21:02
blackburntemplate<> sg_malloc<SGVector> SGVector* sg_malloc(...) { inplace }21:03
blackburntemplate<typename T> T* sg_malloc(...) { default impl }21:03
blackburnthen we use21:03
@sonney2kblackburn, but what about SGVector?21:03
@sonney2kI mean it is templated again21:03
@sonney2kso we would need to do this for all types right?21:03
@sonney2ksg_malloc<SGVector<int> > etc21:03
blackburnwe can use21:04
blackburntemplate<template ..21:04
@sonney2kohh I need the exact syntax21:04
blackburnhah I just don't know how would it work with basic types21:05
@sonney2ktemplate<class T, class U> T* sg_malloc(...) { default impl }21:05
blackburnuh oh21:05
blackburnsounds like a problem :D21:06
blackburnwe can't specialize templated templates21:06
blackburnwe'd need to specialize it for all possible types21:07
blackburnif that's ok - it still would work21:07
@sonney2kluckily sgvector etc use only a couple of fixed numeric types21:08
@sonney2kso yes it would work21:08
blackburnsonney2k: I use partial specialization in tapkee instead of virtual methods21:10
blackburnI have enum parameter 'method' which I specialize with concrete implementation21:11
@sonney2kyeah there is always >1 way and there are pros/cons21:12
@sonney2kso we need to do this for malloc, calloc, realloc21:13
blackburndo we use realloc?21:13
@sonney2kat least we should throw an exception if someone does21:14
@sonney2kfor a user it seems it is all malloc handles so he might be tempted to use realloc21:14
@sonney2kanother reason I hate new[]21:15
@sonney2know realloc available21:15
blackburnI don't know real use-cases of realloc21:15
@sonney2ka dynamically growing array?21:15
blackburnit should be hidden21:16
@sonney2ksomething like std:;vector but fast21:16
blackburnhaha std vector is fast21:16
@sonney2kresize it then21:16
@sonney2kit cannot use realloc21:16
@sonney2kit needs to *copy*21:16
blackburnwhy are you so sure about that?21:17
@sonney2kbecause there is no realloc op in C++21:18
blackburnwhat makes it so impossible to use it in implementation of vector?21:18
@sonney2kand what is worse: if you have a 1G matrix and want to resize it to a 2G matrix21:18
@sonney2kyou not only have to copy 1G21:18
@sonney2kbut you also need 3G of mem21:18
@sonney2ktemporarily but still21:18
@sonney2knew[] delete[] lala21:19
blackburnyou make me have to find it in sources21:19
blackburnsonney2k: okay actually 1G -> 2G resize is something wrong21:24
blackburnI mean you just shouldn't use such data structure21:24
blackburnyou can't *guarantee* realloc will manage to free 1G next to your 1G available21:24
blackburnI'd say it is very unlikely realloc will keep it at its place21:25
@sonney2kblackburn, why?21:29
@sonney2kmemory is for a long time not contiguous (in real world)21:29
blackburnsonney2k: yes it is very non-contiguous21:29
@sonney2ksome weird mapping the kerlneld will do21:30
@sonney2kanyway lets first template sg_malloc and friends and then specialize21:30
@sonney2kwiking, singing in the rain?21:31
@sonney2ktoo bad that we didn't get in doc camp btw but looks like you were right21:32
wikingand by the way this is lol:
wikingsonney2k: hehehe that's alright21:32
wikingin a parallel universe we got in and we wrote a book21:32
@sonney2kI hope these templates won't create dependency hell again21:34
-!- sonney2k [] has left #shogun ["Ex-Chat"]21:35
blackburnC++ programmers go right to dependency hell after passing away21:35
-!- sonney2k [] has joined #shogun21:38
-!- mode/#shogun [+o sonney2k] by ChanServ21:38
@sonney2kblackburn, hum I cannot have the real sg_malloc in the .cpp file any longer right?21:40
blackburnno if you want it to be generic you can't21:40
@sonney2konly if I wanted to allow a certain fixed amount of types21:40
blackburnthat's not generic just some code generation21:41
@sonney2kmaybe I should keep the original sg_malloc in there and then just define a templated one that calls the sg_malloc by default21:41
blackburnyeah why not21:41
blackburnbut template goes to .h21:41
wikingone question21:41
@sonney2konly one?21:42
blackburnthe answer is yes21:42
@sonney2kno 4321:42
blackburnalways say yes21:42
wikingshouldn't we have like line searching methods under optimizers?21:42
wikingi mean now that i'm putting one in for my method as a static function21:42
@sonney2kmakes sense21:42
wikingmaybe in a future21:42
blackburnI consider line search as a part of optimizers21:42
wikingsomebody else will need it as well21:42
wikingblackburn: well yeah i'm writing this optimizer21:43
wikingbut now i need line searching21:43
blackburnwell they are pretty tied to each other21:43
wikingbut i wonder if maybe somebody else will need it21:43
wikingif ever of course..21:43
wikingbtw i have some more code cleanups for the bmrm methods21:43
blackburnproblem is that line-search schemes are usually use a few parameters from the outside21:43
wikingyes indeed21:44
blackburnand it is hard to provide interface so flexible it fits everywhere21:44
wikingyeah that's true21:44
wikingbut yeah you need somekind of a function evaluator to be able to pass21:44
wikingand initial vector with the gradient21:44
wikingthat's kind of like what you need to be able to pass in general21:44
@sonney2kblackburn, ok doing it like this:21:45
@sonney2k#define SG_MALLOC(type, len) sg_generic_malloc<type>(size_t(len), __FILE__, __LINE__)21:45
wikingok then i take it as a yes21:45
wikingand we'll see how it goes...21:45
@sonney2kvoid* sg_malloc(size_t size, const char* file, int line);21:45
@sonney2ktemplate <class T>21:45
@sonney2kT* sg_generic_malloc(size_t len, const char* file, int line)21:45
@sonney2k    return (T*) sg_malloc(sizeof(T)*len, file, line);21:45
@sonney2kCALLOC, REALLOC, FREE21:46
@sonney2kall the same way21:46
blackburnyeah we can do that generic too if you want21:46
@sonney2kblackburn, we do21:46
blackburnI mean CALLOC/REALLOC/FREE21:46
@sonney2kbtw we could simplify the SG_MALLOC * macro21:46
@sonney2kahh now21:47
@sonney2kforget it21:47
blackburnI love templates21:47
blackburnbut actually lets rather copypaste21:47
@sonney2kI don't. They increase compile time and issues21:47
@sonney2kcopy paste where?21:47
blackburnthey are powerful21:48
blackburnsonney2k: have you seen thing I wrote to wiking yesterday?21:48
blackburn 58 ????diffusion_matrix.array().cwiseQuotient((p*p.transpose()).array().pow(timesteps));21:48
blackburnsonney2k: ^ diffusion_matrix is a matrix, p is a vector, timesteps is an integer21:48
blackburn*NO* temporaries21:48
@sonney2kthat certainly is cool21:49
blackburnit is not only shorter but faster21:50
wikingi start to be very annoyed by fucking c/c++21:51
wikingtakes too much time to get something tested21:51
blackburnwrite in processing!21:52
wikingthat shit i hate21:52
@sonney2kwiking, or python :)21:52
wikingyeah python21:52
wikingbut some things i can have as lib function in c21:52
wikingthere's no python eqv21:52
wikingand no bindings either21:52
blackburnwrite in java21:52
wikingjava my ass21:53
wikingnever forget the factory21:53
wikingjava certainly feels like factory toolkit21:53
wikingyou stand in the factory assembly line21:53
wikingand code21:54
wikinglike a monkey21:54
@sonney2kjava has its benefits21:54
@sonney2kif only it were fast21:55
blackburnsonney2k: it is fast21:55
@sonney2kand no latencies21:55
@sonney2kand no memory overhead21:55
blackburnfunction calls in java are as fast as in C++21:55
blackburnvirtual I mean21:55
blackburnsonney2k: what is slow in java? :)21:56
wikingsonney2k: it's fucking fast21:57
wikingsonney2k: have u seen the comparison of languages/performance by google?21:58
wikingit's nicely shows that java is fast21:58
wikingbut i hate the fucking GC21:58
wikingi mean the one thing about java21:58
@sonney2kwiking, you mean like 3x slower?21:58
wikingcheck it out21:58
blackburncome on21:58
blackburnit is not 1999 outside21:58
@sonney2kthen it would be 1000 times slower21:59
blackburnand std::vector is non-contiguous21:59
wikingthat's why you can always use22:00
blackburnsonney2k: if you have latencies you really should check you use caching properly22:00
wikingas a continous memory array22:00
@sonney2khaha in that paper22:01
@sonney2kjava has a 3.7 times higher memory footprint22:01
blackburnthat's ok if you don't multiply matrices22:01
blackburnI'd 90% of software doesn't22:01
@sonney2kand it is 5.8 times slower22:01
wikingof course22:02
wikingand jvm22:02
blackburn5.8 slower on what?22:02
@sonney2kwiking, and that even minimal arrays[] are like std::vector22:02
@sonney2kanyways I didn't say it has its benefits22:03
blackburnwell no frameworks, no EE22:04
blackburnfor C++22:04
@sonney2kbut for high speed stuff were even factor 2 counts it is unbearable22:04
@sonney2kblackburn, yeah sure22:04
blackburnsonney2k: scala is even slower but ask mikio why he uses it :)22:09
@sonney2kwell it is convenient22:10
@sonney2klike java22:10
@sonney2klots of third party libs22:10
@sonney2knice ides22:10
blackburnlife is too short to write in C++22:10
@sonney2kyeah that is why I use python :)22:10
blackburnI spent two years doing inplace malloc22:11
@sonney2kblackburn, only because you didn't impl. proper templated sg_mallocs :(22:11
@sonney2kwe should be more lazy22:11
@sonney2kbut lazy at the right places22:12
blackburnwe have such atmosphere I didn't ever thing about it22:12
blackburnwell we are old-school C and I had no chance to really understand templates22:12
@sonney2kall the templated stuff in shogun is there for a reason22:12
@sonney2kto avoid code duplication22:13
blackburnafter tapkee I do understand much more22:13
wikingdoh motherfuckers22:14
wikingi can haz libqp22:14
@sonney2kblackburn, you talk about pluskid's templated labels or what?22:15
@sonney2kwe didn't really have anyone attempting to use templates for anything22:15
blackburnsonney2k: yeah so I had no chance :)22:16
@sonney2kpluskids label draft didn't work - we needed to expose labels to the outside22:17
blackburnI am not talking about this concrete example22:17
@sonney2kso %template and %rename would have been needed big times22:17
@sonney2kand for everything else we can use it but only if we just use it *internally*22:18
blackburnoops I was wrong about no alloc22:20
@sonney2kno temporaries you mean?22:23
blackburnbut in other not-such-complex cases it works22:26
-shogungit:#shogun- [shogun] sonney2k pushed 2 new commits to master:
-shogungit:#shogun- shogun/master 7d54bf9 Soeren Sonnenburg: next realease will be shogun 2.1.022:27
-shogungit:#shogun- shogun/master dad0687 Soeren Sonnenburg: add templated sg_malloc functions22:27
@sonney2kblackburn, could you please have a look at my sg_malloc stuff?22:27
blackburnlooks good22:28
blackburntime to specialize!22:28
@sonney2kblackburn, do you remember for what parts of the code you called the placement news?22:28
@sonney2kI mean this will cause crashes22:28
shogun-buildbotbuild #647 of deb1 - libshogun is complete: Failure [failed compile]  Build details are at  blamelist: Soeren Sonnenburg <>22:28
blackburnsonney2k: all things that use sgvector arrays22:29
blackburnI reverted sgstring things though22:29
@sonney2kso we do one test for sgvector for now22:29
@sonney2kblackburn, why that?22:29
@sonney2kwas sth still not working?22:29
blackburnI spend 2-3 days trying to fix serialization22:29
@sonney2koh yes - that simply is not implemented22:30
blackburnno success so get back to working22:30
@sonney2kwhile this automagic refcounting stuff in sgvector is nice22:30
@sonney2kit really causes pain in serialzation22:30
shogun-buildbotbuild #648 of deb1 - libshogun is complete: Success [build successful]  Build details are at
@sonney2kcode there assumed to be able to write to some ptr22:31
@sonney2kbut now that would really need a rewrite to work for any sg* datatype explicitly22:31
blackburnmaybe when I get drunk celebrating new year22:32
blackburnI will attempt to fix everything22:32
@sonney2kor when heiko gets his new job22:32
blackburnwhat's up with his job now?22:32
@sonney2k(the better choice ;)22:32
blackburnI see him pretty rare here22:33
@sonney2ktemplate<> SGVector<uint8_t>* sg_generic_malloc(size_t len)22:34
@sonney2k    return new SGVector<uint8_t>[len]();22:34
@sonney2klike this right?22:34
blackburn template<> SGVector<uint8_t>* sg_generic_malloc<SGVector<uint8_t>>(size_t len)22:35
blackburn template<> SGVector<uint8_t>* sg_generic_malloc<SGVector<uint8_t> >(size_t len)22:35
@sonney2kbut with > >22:36
@sonney2k(note the space)22:36
@sonney2kblackburn, do we need that for SGMatrix too?22:37
blackburnno idea22:37
blackburnarrays of matrices.. humm22:37
@sonney2kbtw - I think we could even drop SGString and use SGVector there22:38
@sonney2kbut hey not a big thing22:38
blackburnwhat do you mean?22:38
@sonney2kstring == vector22:38
blackburnit would require quite huge amount of time22:40
@sonney2kblackburn, I am back to dependency hell22:49
@sonney2klib/memory.h now needs to include SGVector22:49
@sonney2kwhich itself uses memory22:50
blackburnextern templates are not possible hah22:50
blackburnonly in C++1122:50
-!- travis-ci [] has joined #shogun22:54
travis-ci[travis-ci] it's Soeren Sonnenburg's turn to pay the next round of drinks for the massacre he caused in shogun-toolbox/shogun:
-!- travis-ci [] has left #shogun []22:54
@sonney2kblackburn, can I do the template specialization only in the .cpp file?22:55
@sonney2kbut then I still need SGVector in header right?22:56
blackburnI don't think you can22:56
@sonney2kahh no22:56
@sonney2kshould work22:56
@sonney2kseems like it compiles23:01
blackburnwith in .cpp specialization?23:01
@sonney2kQ of course is if it works23:03
-!- ptizoom [~christian@] has quit [Quit: Ex-Chat]23:05
-!- ptizoom [~christian@] has joined #shogun23:05
@sonney2kblackburn, please check again23:07
-shogungit:#shogun- [shogun] sonney2k pushed 1 new commit to master:
-shogungit:#shogun- shogun/master 3d23faa Soeren Sonnenburg: add specialization for SGVector and malloc/calloc/realloc/free23:07
@sonney2kin principle the inplace allocations could go now23:07
@sonney2kaswell as the ~ stuff23:07
@sonney2kthat should *significantly* simplify our code23:07
@sonney2kblackburn, so please test and be brave to remove the placement (de)constructors if it works23:09
blackburnwill test23:09
blackburnnot promise to remove it next days though :)23:09
@sonney2kwell test it at least23:10
@sonney2kand tell us :)23:10
-!- ptizoom [~christian@] has quit [Ping timeout: 252 seconds]23:25
-!- ptizoom [] has joined #shogun23:39
--- Log closed Sun Nov 18 00:00:17 2012