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/ | GSoD: https://developers.google.com/season-of-docs/
hkaiser has quit [Ping timeout: 258 seconds]
jaafar has joined #ste||ar
jaafar has quit [Ping timeout: 265 seconds]
jaafar has joined #ste||ar
nikunj97 has joined #ste||ar
nikun__ has joined #ste||ar
nikunj97 has quit [Ping timeout: 245 seconds]
nikun__ has quit [Read error: Connection reset by peer]
nikun__ has joined #ste||ar
<Yorlik> Allright - that was easy. Boost vs. HPX serialization:
<Yorlik> Yorlik@WHITEHIND C:\__A\arc_2017\_INSTALL\sim\Debug\bin
<Yorlik> > gc_app.exe
<Yorlik> Entering gc_app
<Yorlik> ar size: 112
<Yorlik> ar data: ■ serialization::archive◄ ♦☺ h`$♂¡ç♣
<Yorlik> Done !
<Yorlik>
<Yorlik> Yorlik@WHITEHIND C:\__A\arc_2017\_INSTALL\sim\Debug\bin
<Yorlik> > gc_app.exe
<Yorlik> Entering gc_app
<Yorlik> ar size: 64
<Yorlik> ar data: ☻ ∟¨S♂▒♣
<Yorlik> Done !
<Yorlik> :D
<Yorlik> 48 bytes less.
<Yorlik> So - with 18 bytes data that was 30 bytes header. Time for more tests.
<Yorlik> heller: Indeed - the tests helped - I should look more often at them when having issues with HPX.
<heller> Yorlik: hmmm, 30 bytes header sounds extreme
<heller> let me check that...
<heller> Yorlik: can you share your self contained testcase?
<Yorlik> I used this code:
<Yorlik> std::vector<char> buf;
<Yorlik> hpx::serialization::output_archive ar(buf);
<Yorlik> ar << msg;
<Yorlik> std::cout << "ar size: "<< sizeof(ar) << std::endl;
<Yorlik> // outbound_data_ = archive_stream.str();
<Yorlik> std::cout << "ar data: ";
<Yorlik> for (char c : buf) {
<Yorlik> std::cout << c;
<Yorlik> }
<Yorlik>
<Yorlik> std::cout << std::endl;
<Yorlik> ----
<heller> sizeof(ar) is bullshit
<heller> it should be buf.size()
<Yorlik> woops
<Yorlik> true
<Yorlik> Sec - lol
<heller> and for the boost one, simila
<heller> r
<heller> what's `msg`?
<Yorlik> A struct
<Yorlik> Being used as a network message
<heller> sure...
<heller> a POD?
<Yorlik> a uint16 and two uint64
<heller> so compare sizeof(msg) with buf.size()
<Yorlik> This one:
<Yorlik> struct PongMsg : public NetworkMessage, Payload < std::tuple<uint64_t, uint64_t>> {
<Yorlik> PongMsg( uint64_t incoming_timestamp ) {
<Yorlik> type = net_message::PONG;
<Yorlik> data = std::tuple<uint64_t, uint64_t>( //
<Yorlik> static_cast<uint64_t>( hrclock::now( ).time_since_epoch( ).count( ) ), //
<Yorlik> incoming_timestamp //
<Yorlik> );
<Yorlik> }
<Yorlik> template <class Archive>
<Yorlik> void serialize( Archive& ar, const unsigned int version ) {
<Yorlik> ar& type;
<Yorlik> ar& data;
<Yorlik> }
<Yorlik> };
<Yorlik> ---
<Yorlik> Its an answer to a ping message carrying two timestamps and the type
<Yorlik> Allright - much better now:
<Yorlik> msg size: 10
<Yorlik> ar size: 25
<Yorlik> :D
<Yorlik> Though sth is weid - sec
<Yorlik> I had expected 18 bytes for the message data+type
<Yorlik> Seems I need to learn tuples properly
<Yorlik> Woops - It was aping message - so size was precisely OK. :)
<heller> how is msg size 10
<heller> should be 18, in my book
<heller> ah, ok
<heller> so 15 bytes overhead?
<heller> that's still a little much
<heller> how does boost.serialization compare?
<heller> ok, that's endianess + flags + filter
<heller> sounds about right
<heller> NB: you can also have compression ;)
<Yorlik> Momant - gotta bring in boost again - lol
<Yorlik> Hitting newbie walls as usual ...
<heller> speaking of which...
<heller> if PongMsg both a NetworkMessage and a Payload?
<Yorlik> We have two types of messages
<heller> shouldn't a NetworkMessage contain a Payload?
<Yorlik> One message type just has a type
<Yorlik> the other has a type and a data payload
<Yorlik> the type is used for the deserialization
<Yorlik> But there are some open questions
<Yorlik> E.g. if I deserialize to a NetworkMessage, which is the superclass, I might get errors (didn't try yet)
<Yorlik> I might have to split the serialization and do some trickery
<Yorlik> Still learning a ton here.
<Yorlik> the type is just a uint16 based enum
<heller> well, you can serialize/de-serialize using pointers to (polymorphic) base classes
<heller> that's how actions work
<heller> hey, you could use actions for your messages :P
<heller> problem solved :P
<Yorlik> The main reason not using HPX on the client side is security. But having a custom transport in between, might actually solve these concerns.
<Yorlik> So I might come back to using HPX on the client side.
<Yorlik> I just want a clear separation between server and client.
<Yorlik> msg size: 10
<Yorlik> buf size (HPX) : 33
<Yorlik> ostr size (Boost): 57
<Yorlik> HPX data: --> ☻ \R░õ9┤♣ <--
<Yorlik> Boost data: -->■ serialization::archive◄ ♦☺ \R░õ9┤♣
<Yorlik> ---
<Yorlik> Here we go
<Yorlik> For some reason when using a PongMsg it stops compiling giving weird template errors
<Yorlik> Something must be wrong with my PongMsg
<Yorlik> Seems it doesn't like my tuple. So I geuss a tuple doesn't have a default serializer?
<K-ballo> *your* tuple?
<Yorlik> My pong message has a tuple of two uint64_t as payload
<Yorlik> It's my tuple, because I wrote it down ! :P
<K-ballo> but `std::tuple`, not `your::tuple`, right?
<Yorlik> Yes - I'm using a std::tuple
<K-ballo> let me check which header is needed for serializing that.. hpx own's tuple works out of the box
<Yorlik> No custom impl
<Yorlik> I really would like not to use custom HPX datastructures in my net messages, to have a choice to change the serializer later if necessary.
<Yorlik> Like some HPX specific tuple
<K-ballo> looks like we don't have support for sreializing std::tuple
<K-ballo> just hpx::util::tuple
<K-ballo> why would you change the serializer later? and how does using std::* give you that?
<Yorlik> Allright. I'll make a custom serializable payload then.
<K-ballo> if you were using your::* tuple then sure, you'd be in complete control of serialization, but std::* ones we own too
<Yorlik> I just don't know. But I'm at such an early stage, I don't want to lock myself in
<K-ballo> a real struct is always a win over tuple<>
<Yorlik> What's so bad about tuples?
<Yorlik> Do you serialize any container types or just structs intrusively?
<K-ballo> mh? rephrase?
<Yorlik> Which types are supported by HX to serialize out of the box?
<Yorlik> <<P
<Yorlik> So - came up with this quick and dirty struct:
<Yorlik> template <typename T, typename U = T>
<Yorlik> struct cs_pair {
<Yorlik> T first;
<Yorlik> U second;
<Yorlik> cs_pair( ) = default;
<Yorlik> cs_pair( T f, U s )
<Yorlik> : first { f }
<Yorlik> , second { s } {
<Yorlik> }
<Yorlik> template <class Archive>
<Yorlik> void serialize( Archive& ar, const unsigned int version = 1 ) {
<Yorlik> ar& first;
<Yorlik> ar& second;
<Yorlik> }
<Yorlik> };
<Yorlik> ---
<K-ballo> fundamental types, empty types, hpx own types, and some std and boost types (given the right extra #include)
<Yorlik> Do docs exist for this or do I have to dig sources?
<K-ballo> and I believe there was even an attempt to automatically serialize aggregates via structured bindings, but if there is you should not relay on that
<K-ballo> docs for what, especifically?
<Yorlik> I'll just come up with some custom serializables for my messages
<Yorlik> Docs for the serialization types supported and how to use them.
<Yorlik> Working on a cs_vector now using split serialization
<K-ballo> I doubt it, we used to use boost.serialization and it's unlikely we ported their docs
<Yorlik> OK.
<Yorlik> std::array?
<K-ballo> #include <hpx/runtime/serialization/array.hpp>
<Yorlik> Nice!
<K-ballo> arguably we should have support for std::tuple too
<Yorlik> And possibly vector - you just need an additional size_type
<K-ballo> there is support for std::vector
<Yorlik> Oh? I missed a header then
<K-ballo> the support for std::tuple is going to have to be worse than that for hpx::util::tuple, ours is bitwise serializable
<Yorlik> Argh ... the temptation ...
<Yorlik> So - just to have that clear: including hpx.hpp is not enough, right?
<K-ballo> ttps://github.com/STEllAR-GROUP/hpx/blob/master/tests/unit/serialization/serialization_vector.cpp
<K-ballo> #include <hpx/runtime/serialization/vector.hpp>
<Yorlik> Thanks a ton !
<K-ballo> I wouldn't recommend including hpx.hpp to begin with
<K-ballo> I don't know whether it is expected to include those adaptor headers too or not
<Yorlik> It helps me to get stuff up faster. But I'd love to have a type/header crossreference ....
<K-ballo> you and me both :P
<Yorlik> I really don't want to dig into doxygen over and over again
<Yorlik> Without the doxygen docs I'*d be horribly lost anyways
<K-ballo> for serialization support, specifically, the unit tests are the best place to look at
<Yorlik> Allright.
<K-ballo> if something is supported there's a test for it there
<Yorlik> Seemsd I need to start some more recipes in my custom doc
<Yorlik> Still have to prepare a proper pull request for the stuff I already made.
<Yorlik> It's so tedious - lol
<Yorlik> Allright - seems to work with std::array now. It starts being fun. Now - how would I do the compression part?
<Yorlik> Though we might just do compression on the Datagram layer when we batch messages.
<Yorlik> Same with encryption
<Yorlik> it's not yet decided.
<K-ballo> have you looked at the compression plugin yet? is that insufficient?
<Yorlik> No. It's all totally new to me.
<Yorlik> It doesn't have to compress to heavily - speed is more important.
<Yorlik> But I think I'll just push that back for now
<K-ballo> there's per-parcel compression support for bzip2, zlib, and snappy
<Yorlik> The networking I am currently doing will be replace by our customlibrary anyways - so staying at the message level for now is good
<K-ballo> you just need to enable it
<Yorlik> We are doing a custom UDP library, which hopefully will be near finished end of the year
<Yorlik> It's all about communication with the Unreal Engine.
<Yorlik> Though - the more I think about it - it might make sense to use HPX here too.
<Yorlik> But there is a library boundary.
<Yorlik> Still it could make sense to have hpx sitting in that library and use it to call into UnrealEngine with a thin translation layer
<Yorlik> My original idea was to just map messages to function calls in the adapter
<Yorlik> The client is a dll which is independent of Unreal
<Yorlik> And there is a thin adapter doing the translation - such we could easily use a different client later on if we wish to.
<Yorlik> I need to think about this more a bit later. For now I just want to get something up and running. The main internal interface will be messages anyways, but it might just happen that I succumb to HPXifying everything.
<Yorlik> To fully use HPX for client/server we'd need things like UDP transport, unreliable actions, state snapshots and delta updates. That's all very gaming specific. My fear is if I'd try to model these things as extensions to HPX it might just be a rabbithole sucking up way too much of my resources.
<Yorlik> Game networking is really very different in many ways.
<K-ballo> "game <anything> is really very different" is something I've never ever heard before
<Yorlik> Especially it is not precise, but just trying give clients a good enough, believable approximation of the game state. If you look at multiplayer games precisely, every client is actually playing a different game and everything is made to have everyone believe they are playing the same game.
<Yorlik> Ofc the underlying super low level stuff is always the same.
<Yorlik> But it diverts quickly.
<heller> UDP parcelport would be kinda cool ;)
<Yorlik> heller: If you can afford the time at som point I'd like to chat with you about possibilities here. I am not sure there are real synergies to exploit for us or not. But what I could imagine would be a nice interface in the end.
<heller> Yorlik: if you ask a person working in a specific domain, that person will always say something like "my domain is really very different in many ways"
<heller> our stance is to being general purpose enough to allow to be used in that domain ;)
<Yorlik> It's complicated. But that's something for voice chat. The question for me, and my concern is, that it might be quite a rabbit hole.
<Yorlik> But ofc - I'm opene for exploring the possibilities.
hkaiser has joined #ste||ar
<Yorlik> (away
<Yorlik> woops - lunchtime
nikunj has joined #ste||ar
nikun__ has quit [Ping timeout: 250 seconds]
<Yorlik> Why does this abort()?
<Yorlik> shared_session->bytes_received is clearly below 128
<Yorlik> std::vector<char> buf; buf.reserve( 128 ); hpx::serialization::input_archive ar_hpx( buf, shared_session->bytes_received );
<zao> conflating capacity() and size()?
* Yorlik bangs head on table ...
<Yorlik> lol
<Yorlik> Oh man ...
<Yorlik> Though ...
<Yorlik> where do I use size?
<Yorlik> I think I need to properly understand hpx input archives
<Yorlik> I think it wants a chunk: input_archive (Container &buffer, std::size_t inbound_data_size=0, const std::vector< serialization_chunk > *chunks=nullptr)
<hkaiser> yorlik: it's more a matter of how to use std::vector
<Yorlik> So - what is wrong?
<hkaiser> why do you need to directly use an archive, btw?
<Yorlik> Because I am sending structs with UDP
<Yorlik> HPX is just ma serializer here
<hkaiser> if you reserve(128) that means that you can potentially store at least 128 elements without reallocation, it does not mean that your vector has 128 (default constructed) elements
<Yorlik> Th data arrives, but now I am struggleing with the desrialization
<hkaiser> so capacity() == 128, but size() == 0, still
<Yorlik> I am not really sure about the inner workings here. Ijust wanted tomake sure i have a buffer of 128 at least
<hkaiser> use resize instead of reserve
<Yorlik> Would I have to place a default constructed struct in there instead?
<Yorlik> I think I'm missing a lot here.
<Yorlik> What I have so far is an asio buffer holding my serialized data
<hkaiser> there is an example/test demonstrating zero-copy serialization, if that's what you're after
<Yorlik> OK - I'll check that
<Yorlik> But in the moment its about deserializing
<Yorlik> buffer-> struct
<hkaiser> sure
<hkaiser> input_archive ar;
<hkaiser> serialize(ar, struct)
<Yorlik> struct just the type and it returns it?
<hkaiser> no, the instance of your struct, obviously
<Yorlik> woops ... I am suffering bloodlessness in the brain post lunch ...
<hkaiser> it's even: struct foo s; ar >> s;
<hkaiser> the example I linked above serializes a parcel instance, but the same works with any serializable type
<Yorlik> Can I deserialize to a superclass to pull out a typecode and then deserialize to the derived class?
<hkaiser> if you use polymorphic serialization it should work out of the box
<Yorlik> OK. More stuff to learn.
<Yorlik> How do I make the ar use my rcv_buffer?
<Yorlik> My receive buffer comes from asio
<hkaiser> construct the archive from the buffer
<Yorlik> Just giving the buffer as parameter?
<Yorlik> Or buffer+size?
<hkaiser> look at the code I just linked
<Yorlik> OK
<Yorlik> Huzzah ! Just sent my first struct over UDP ! :D
<Yorlik> output: msg type, uint64, uint64: 1, 5c02db924eaf8, 1e240
<Yorlik> Now the real fun starts . Thanks hkaiser ! :)
<Yorlik> archive just done like this: hpx::serialization::input_archive ar_hpx( shared_session->recv_buffer_, shared_session->bytes_received );
<Yorlik> Time for a nap an then work.
hkaiser has quit [Ping timeout: 240 seconds]
nikunj has quit [Remote host closed the connection]
nikunj has joined #ste||ar
hkaiser has joined #ste||ar
aserio has joined #ste||ar
jaafar has quit [Quit: Konversation terminated!]
jaafar has joined #ste||ar
aserio has quit [Ping timeout: 250 seconds]
jaafar has quit [Ping timeout: 276 seconds]
diehlpk has joined #ste||ar
aserio has joined #ste||ar
diehlpk has quit [Quit: Leaving.]
Yorlik has quit [Read error: Connection reset by peer]
aserio has quit [Ping timeout: 264 seconds]
hkaiser has quit [Ping timeout: 268 seconds]
Yorlik has joined #ste||ar
jaafar has joined #ste||ar