hkaiser changed the topic of #ste||ar to: STE||AR: Systems Technology, Emergent Parallelism, and Algorithm Research | stellar.cct.lsu.edu | HPX: A cure for performance impaired parallel applications | github.com/STEllAR-GROUP/hpx | Buildbot: http://rostam.cct.lsu.edu/ | Log: http://irclog.cct.lsu.edu/ | GSoC2018: https://wp.me/p4pxJf-k1
kisaacs has quit [Ping timeout: 245 seconds]
parsa has joined #ste||ar
kisaacs has joined #ste||ar
hkaiser[[m]] has joined #ste||ar
hkaiser[[m]] has quit [Remote host closed the connection]
hkaiser[m] has quit [Ping timeout: 260 seconds]
diehlpk has quit [Ping timeout: 240 seconds]
eschnett has joined #ste||ar
kisaacs has quit [Ping timeout: 252 seconds]
kisaacs has joined #ste||ar
hkaiser has quit [Quit: bye]
kisaacs has quit [Ping timeout: 260 seconds]
K-ballo has quit [Quit: K-ballo]
kisaacs has joined #ste||ar
nanashi55 has quit [Ping timeout: 240 seconds]
nanashi55 has joined #ste||ar
kisaacs has quit [Ping timeout: 256 seconds]
kisaacs has joined #ste||ar
mcopik has quit [Ping timeout: 260 seconds]
galabc has quit [Read error: Connection reset by peer]
anushi has quit [Remote host closed the connection]
kisaacs has quit [Ping timeout: 240 seconds]
parsa has quit [Quit: Zzzzzzzzzzzz]
parsa has joined #ste||ar
parsa has quit [Client Quit]
jaafar_ has quit [Ping timeout: 256 seconds]
kisaacs has joined #ste||ar
kisaacs has quit [Ping timeout: 248 seconds]
mcopik has joined #ste||ar
<github> [hpx] StellarBot pushed 1 new commit to gh-pages: https://git.io/vhq3a
<github> hpx/gh-pages 16dad5c StellarBot: Updating docs
mcopik has quit [Ping timeout: 245 seconds]
anushi has joined #ste||ar
hkaiser has joined #ste||ar
diehlpk has joined #ste||ar
kisaacs has joined #ste||ar
kisaacs has quit [Ping timeout: 240 seconds]
eschnett has quit [Quit: eschnett]
wash has quit [Ping timeout: 245 seconds]
diehlpk has quit [Remote host closed the connection]
wash has joined #ste||ar
anushi has quit [Ping timeout: 265 seconds]
wash has quit [Ping timeout: 245 seconds]
anushi has joined #ste||ar
wash has joined #ste||ar
wash has quit [Ping timeout: 245 seconds]
wash has joined #ste||ar
wash has quit [Ping timeout: 245 seconds]
K-ballo has joined #ste||ar
wash has joined #ste||ar
<jakub_golinowski> is there an example for hpx::start(nullptr, ...) and hpx(stop)
<jakub_golinowski> ?
wash has quit [Ping timeout: 252 seconds]
<hkaiser> jakub_golinowski: yes
<jakub_golinowski> hkaiser, which one is that?
wash has joined #ste||ar
<jakub_golinowski> hkaiser, I was talking about this mode:
<jakub_golinowski> https://stellar-group.github.io/hpx/docs/html/hpx.html#hpx.manual.applications.flexible0
<jakub_golinowski> When I tried using it as in the example I get some HPX errors
<hkaiser> you still need to call finalize() from somewhere, otherwise stop() will never return
<hkaiser> jakub_golinowski: what errors did you see?
<jakub_golinowski> Oh I understood that it *is* called not that I have to call it
<hkaiser> no
<hkaiser> start() will bring up hpx, stop() will wait for it to shut down
<hkaiser> finalize() triggers shutdown
<hkaiser> I think this example in the docs is wrong
<hkaiser> you shouldn't call hpx::async from a non-HPX thread
<jakub_golinowski> So this is the code:
<jakub_golinowski> (without includes)
<hkaiser> yah, that will fail
<jakub_golinowski> :/
<hkaiser> main() is executed by a non-hpx thread
<jakub_golinowski> so how can I properly use the start() stop() framework?
<hkaiser> I think the problem is not the hpx::async, but rather using hpx::future() from a non-hpx thread
<hkaiser> have you looked at the QT example?
<jakub_golinowski> this is the error: https://pastebin.com/B7qt88qk
<hkaiser> nod, that's exactly what I'd expect seeing
<hkaiser> that essentially says 'you're trying to use hpx from a non-hpx thread'
<hkaiser> here: assertion 'threads::get_self_ptr() != nullptr' failed: HPX(assertion_failure)
<jakub_golinowski> hmm
<hkaiser> there is a handful of hpx function you're allowed to call from a non-hpx thread
<jakub_golinowski> ok, but if I sprecify the executor explicitly like in the qt example will it be ok?
<hkaiser> start/stop/resume/suspend
<hkaiser> the qt example is ok
<jakub_golinowski> but the qt example is using the hpx::init() approach
<hkaiser> right
<hkaiser> you need to somehow get into hpx land
<hkaiser> tell me, what are you trying to achieve?
<jakub_golinowski> so the overall goal is the HPX backend for OpenCV
<hkaiser> ok
<jakub_golinowski> I managed to somehow build the opencv with HPX dependency
<hkaiser> so you want to transparently run any opencv application on top of hpx
<jakub_golinowski> yes
<jakub_golinowski> Now I edited their parallel.cpp file adding #ifdef HAVE_HPX ...
<jakub_golinowski> with HPX code
<jakub_golinowski> the problem is
<hkaiser> the easiest way is to use hpx_main.hpp which will #define main
<hkaiser> then the whole application will run on the hpx side of the fence
<hkaiser> as the original main is now launched as if it was hpx_main
<jakub_golinowski> but should I do it in application?
<hkaiser> yes
<hkaiser> the application file that implements main() needs to include hpx_main.hpp somehow
<jakub_golinowski> so if someone runs the application without doing this - then it fails
<hkaiser> probably
<jakub_golinowski> hmm with hpx_main.hpp it seems to have worked
<hkaiser> jakub_golinowski: :D
kisaacs has joined #ste||ar
kisaacs has quit [Ping timeout: 245 seconds]
kisaacs has joined #ste||ar
parsa has joined #ste||ar
<jakub_golinowski> hkaiser, yt?
<hkaiser> jakub_golinowski: here
<jakub_golinowski> I am having troubles to make hpx::parallel_for_strided accept a functor (that is a clas with overloaded operator())
<hkaiser> k
<hkaiser> show me
<jakub_golinowski> I think I got wind up in the c++ because there is a lot of inheritance and there are in totall 6 classes fyilng around
<jakub_golinowski> (this is opencv parallel backend)
<hkaiser> the for_strided is documented here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0075r0.pdf
jaafar_ has joined #ste||ar
<jakub_golinowski> Requires:
<jakub_golinowski> T
<jakub_golinowski> he parameter pack
<jakub_golinowski> rest
<jakub_golinowski> shall
<jakub_golinowski> have at least one element
<jakub_golinowski> ;
<jakub_golinowski> the last element
<jakub_golinowski> shall
<jakub_golinowski> be an
<jakub_golinowski> invocable
<jakub_golinowski> object,
<jakub_golinowski> f
<jakub_golinowski> , with an argument list composed as described below.
<jakub_golinowski> oh well copy paste from pdf was not a great idea :/
<jakub_golinowski> but the way I was using this parallel_for loop before was passing either pointer to a function (&do_sth) or writing an inline lambda function
<jakub_golinowski> and it worked as described in documentation
<hkaiser> show me your code
<jakub_golinowski> So this is the part in which the abstract class ParallelLoopBody is defined and the mechanism to handle calls to parallel_for_ with both lambda and by inheriting from ParallelLoobBody
<jakub_golinowski> this is part of OpenCV
<K-ballo> "a functor (that is a clas with overloaded operator())"
jakub_golinowski has quit [Ping timeout: 265 seconds]
jaafar has joined #ste||ar
jaafar_ has quit [Ping timeout: 264 seconds]
jakub_golinowski has joined #ste||ar
kisaacs has quit [Ping timeout: 265 seconds]
<jakub_golinowski> K-ballo, could you continue? I got disconnected for a second?
<K-ballo> jakub_golinowski: that was all (for future reference see http://irclog.cct.lsu.edu/)
<jakub_golinowski> I am resending my message because I am not sure if they reached you
<jakub_golinowski> (They are not on the log)
<jakub_golinowski> So this is the part in which the abstract class ParallelLoopBody is defined and the mechanism to handle calls to parallel_for_ with both lambda and by inheriting from ParallelLoobBody
<K-ballo> yeah, those were in the log
<jakub_golinowski> this are two auxiliary classes ParallelLoopBodyWrapperContext and ParallelLoopBodyWrapper
<jakub_golinowski> And lastsly there is the parallel_for_impl followed by ProxyLoopBody in which I want to call hpx::parallel::for_loop_strided()
<jakub_golinowski> snippets 2 and 3 were lost I guess
kisaacs has joined #ste||ar
<jakub_golinowski> I think my question boils down to how to extract an address to function that is embedded in functors () operator
nikunj has joined #ste||ar
<K-ballo> uhm, that last sentence sounds odd
<K-ballo> you can't in general get an address (presumably a function pointer?) to the target of overload resolution for a function object
<K-ballo> you've linked way too much code for me to look into it, could you describe it simpler perhaps with pseudocode? a couple lines at most
<jakub_golinowski> right away
kisaacs has quit [Ping timeout: 256 seconds]
galabc has joined #ste||ar
<jakub_golinowski> K-ballo, ok this is the example:
<jakub_golinowski> should build with HPX
<jakub_golinowski> I take it back it does not build yet
kisaacs has joined #ste||ar
<jakub_golinowski> this is the updated snippet: https://pastebin.com/XXrWNxKS
<jakub_golinowski> K-ballo, so the Question is what to put in commented out ?WHAT_HERE?
<K-ballo> `PLBW`?
<jakub_golinowski> you are right it work
nikunj97 has joined #ste||ar
<jakub_golinowski> works, so now why it does not work in the more complicated example :/
<jakub_golinowski> let me look at it again
nikunj has quit [Ping timeout: 264 seconds]
<jakub_golinowski> Now I get this error:
<jakub_golinowski> part_iterations<const cv::ParallelLoopBody&, int>::f_’ to be of abstract type ‘cv::ParallelLoopBody’
<jakub_golinowski> So one lesson was learnt from the simple example: if we deal with functor then one simply passes the functor object
<jakub_golinowski> to the for_loop_strided
<jakub_golinowski> And from the error:
<jakub_golinowski> error: cannot declare field ‘hpx::parallel::v2::detail::part_iterations<const cv::ParallelLoopBody&, int>::f_’ to be of abstract type ‘cv::ParallelLoopBody’
<K-ballo> function objects are generally required to be copyable (and cheaply as well)
<K-ballo> were you passing a reference of base type before?
nikunj97 has quit [Remote host closed the connection]
nikunj97 has joined #ste||ar
<jakub_golinowski> I was trying to pass a pointer
<K-ballo> unlikely, that would not correspond to the error message above
<jakub_golinowski> now I am not longer passing a pointer
<K-ballo> since you are doing classic old style OOP you are probably interested in maintaining identity of the function object
<K-ballo> for those cases one usually wraps the function object in std::ref and passes that to algorithms
<K-ballo> then it is the std::reference_wrapper that it is copied, not the target function object
<jakub_golinowski> Ok I understand the idea
<jakub_golinowski> So what I have access to at the point when I want to call the parallel_for is:
<jakub_golinowski> const cv::ParallelLoopBody* body;
<jakub_golinowski> which is a pointer to a base (abstract) class of the functor I am interested in
<K-ballo> function object, yes
<K-ballo> so you'd pass std::ref(*body) to the algorithm
<jakub_golinowski> I see what is the problem!
<jakub_golinowski> parallel_for wants a functor that has a single argument of type int
<jakub_golinowski> and this is why in simple example it works
<jakub_golinowski> OpenCV has a functor with a single argument of type range
<K-ballo> ah, so that's the source of this whole "functor" speak rather than "function object"
<jakub_golinowski> ?
<K-ballo> it seems opencv calls "functor" what C++ calls "function object"
<K-ballo> I was wondering why you were insisting on "functor"
<jakub_golinowski> yes, this is what they use
<jakub_golinowski> so is there a difference between functor and function object?
<K-ballo> not when you use functor to mean function object
<jakub_golinowski> and should I differentiate between them
mcopik has joined #ste||ar
galabc has quit [Ping timeout: 240 seconds]
<jakub_golinowski> K-ballo, hkaiser thank you very much for help today!
jakub_golinowski has quit [Quit: Ex-Chat]
wash has quit [Ping timeout: 240 seconds]
wash has joined #ste||ar
<parsa> hkaiser: ping
<hkaiser> parsa: here
<parsa> hkaiser: do we have anything in physl that gives me the size of a list?
<hkaiser> sec
<hkaiser> parsa: apparently not
<hkaiser> feel free to add len() or somesuch
<parsa> i was hoping shape would already work… should add it there?
<parsa> okay, i'll create len… it'd have to work on strings, too
<hkaiser> parsa: yah, I thought about adding it to shape, not sure if that's what we want
<hkaiser> should we inter-mingle the numerics stuff with lists?
<hkaiser> I know we have done that for add(), but that does not make me like it more
nikunj97 has quit [Quit: Leaving]
diehlpk_mobile has joined #ste||ar