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/
jbjnr has quit [Read error: Connection reset by peer]
eschnett has joined #ste||ar
Yorlik has joined #ste||ar
parsa is now known as parsa_
K-ballo has quit [Quit: K-ballo]
Yorlik has quit [Read error: Connection reset by peer]
hkaiser has quit [Quit: bye]
eschnett has quit [Quit: eschnett]
Guest70467 has quit [Ping timeout: 240 seconds]
Guest70467 has joined #ste||ar
Yorlik has joined #ste||ar
<Yorlik>
I just found out that converting an enum to an enum class doesn't allow me anymore to use comparison operators on the underlying class. E.g. I have a typed enum class with uint64_t underlying and since I added the class keyword I can't use < and > on it against another uint64_t anymore. Is there any good workaround?
<Yorlik>
I could ofc just remove the class keyword, but I really like the scoping of the enum
diehlpk_work has quit [Remote host closed the connection]
diehlpk_work has joined #ste||ar
eschnett has quit [Quit: eschnett]
eschnett has joined #ste||ar
aserio has joined #ste||ar
bita has quit [Read error: Connection reset by peer]
aserio has quit [Ping timeout: 240 seconds]
aserio has joined #ste||ar
aserio has quit [Ping timeout: 246 seconds]
bibek has joined #ste||ar
eschnett has quit [Quit: eschnett]
eschnett has joined #ste||ar
tianyi93 has joined #ste||ar
jbjnr__ has joined #ste||ar
nikunj has joined #ste||ar
<Yorlik>
Is there a way to get a unique pointer from a typed pointer or to create a unique pointer with an object at a fixed location, like vector emplace does?
<Yorlik>
So unique_pointer + I give the address of t he object
<Yorlik>
?
<K-ballo>
suspicious..
<K-ballo>
you can create a unique_ptr by giving it ownership of a raw pointer, yes
<K-ballo>
you are not calling a constructor in that line
<hkaiser>
line 48 doesn't look right
<hkaiser>
you use operator=() on a not-fully constructed object
<K-ballo>
your placement new attempt isn't placement new either
<Yorlik>
I tried this one too: entPtr_ = std::unique<concept>( new(mSize, entPtr) );
<Yorlik>
new(mSize, entPtr) is placement iirc
<K-ballo>
no, you are missing your type in there, and optionally it's construction arguments
<K-ballo>
::new (ptr) int{42};
<K-ballo>
is mSize the construction argument? I'm assuming you meant to call standard library's non-allocating placement new form
<Yorlik>
Can't I just get a unique from that * new returns?
<Yorlik>
mSize is sizeof(T)
<K-ballo>
there's too much confusion entangled here
<Yorlik>
line 77
<K-ballo>
you can construct a unique_ptr from a raw pointer, yes
<K-ballo>
placement new does return a raw pointer to the emplaced object, yes
<Yorlik>
What's the syntax for that ?
<K-ballo>
it's unlikely that you want unique_ptr to delete the memory in which you manually emplaced an object
<K-ballo>
what's your type and arguments, what's your storage location?
<Yorlik>
The memory is in a vector holding entities
<Yorlik>
I am retrieving the pointer from the vector
<K-ballo>
you certainly don't want unique_ptr to delete the memory a vector is managing
<Yorlik>
So I'm using the vector like a memory arena
<K-ballo>
what do you want to use unique_ptr for?
<Yorlik>
The vector never gets moved
<Yorlik>
unique ptr is the link from the mother object to its entity
<Yorlik>
The entity is just data belonging to the main object
<Yorlik>
When the main opbject goes, that data has to go too
<K-ballo>
I give up, there's way too much, this should be taken one step at a time
<Yorlik>
Lets start with the placement new and unique construction
<K-ballo>
I'll happily answer concrete questions as long as properly specified
<zao>
An owning pointer type should be for owned data.
<Yorlik>
The data is owned
<K-ballo>
that's two orthogonal things, pick just one
<zao>
Data owned by the owned pointer type.
<K-ballo>
you can't have both unique ptr and vector owning that memory
<zao>
Anyway, I'll go grab some popcorn.
<K-ballo>
you'll corrupt the vector
<Yorlik>
I am just abusing the vector as a memory pool for development - it will be replaced later with a proper allocator
<Yorlik>
The vector never moves or shrinks
<K-ballo>
you said that, but it doesn't change anything
<Yorlik>
Forget the vector for now - its a makeshift thing
<Yorlik>
It just hold place I use
<Yorlik>
The point is you have a typed pointer to an area I want the unique to take over
<Yorlik>
Thus I can make the object owning the unique own the data
<K-ballo>
I'll ignore that and blindly assume you can (you can't)
<K-ballo>
::new (ptr) T{args...}; is placement new, it returns a T*
<Yorlik>
For now just play stupid :D
aserio has joined #ste||ar
<Yorlik>
Would that look like htis? entPtr_ = std::unique<ENT>( ::new (entPtr) ENT{} );
<Yorlik>
where entPtr is the typed pointer and entPtr_ the unique
<hkaiser>
entPtr should be referring to non-initialized memory large enough to hold ENT
<K-ballo>
that's move assigning into entPtr_ a temporary unique_ptr<ENT> that takes ownership of an ENT constructed with no arguments at entPtr
<K-ballo>
bonus points for naming: entPtr vs entPtr_
<Yorlik>
:D
<zao>
You've got four phases of object lifetime - acquisition of storage, object construction, object destruction, returning of storage. The default deleter of unique_ptr assumes that you want to use `delete` to destroy the object and return storage.
<zao>
If you have other desires for what should happen at the end, you provide a different deleter as part of the unique_ptr type.
<Yorlik>
The custom deleter of entity (not in the example code) will just set a bitmask flag to FLAG_DELETED
<Yorlik>
Its all PODs
<Yorlik>
For the few non Pods I'll make specialized deleters
<Yorlik>
The storage gest never returned
<Yorlik>
Its a pool
<Yorlik>
So - I return the pointer of deleted objects to a set
<Yorlik>
next construction goes into the next free slot or to the end
<Yorlik>
So I keep my objects packed as dense as possible with few corner cases that will be solved later
<zao>
I mean returned not necessarily in the means of being free'd/deallocated, but returned to where it came from, considering it unoccupied.
<zao>
Vague enough terms to include any form of pool/arena/etc.
aserio has quit [Ping timeout: 252 seconds]
<Yorlik>
Its test and learning code - nothing anywhere close to finished. For me it's all about having a new unique pointer controlling that area until its being given back
bita has joined #ste||ar
aserio has joined #ste||ar
jbjnr__ has quit [Ping timeout: 252 seconds]
jbjnr__ has joined #ste||ar
hkaiser has quit [Ping timeout: 240 seconds]
hkaiser has joined #ste||ar
<jbjnr__>
hkaiser: I tried to join meeting, but the link is invalid. Kevin says not for 2.5 hours. is that right?
<hkaiser>
jbjnr__: yah, OB call is 4pm CDT today, late for you
<jbjnr__>
grrr.
<hkaiser>
jbjnr__: 10pm your time
<jbjnr__>
yup. Got it thanks. Pity I got out of the bath for a 7:30 call and let all the hot water go.
<jbjnr__>
hkaiser: I didn't manage to pass an executor to async_cb btw. Will have to wrap it in a lambda probably though not having exec support for remote actions might be annoying
<hkaiser>
what would be the semantics of a remote call using a executor?
<hkaiser>
jbjnr__: ^^
<jbjnr__>
similar to a gpu executor. I would like a network executor
<jbjnr__>
I need to clean up my throttling code
<jbjnr__>
I'll just do it in th sender I suppose
<Yorlik>
Is there a way to prevent free() being called on a typed pointer ? I am overwriting a memory place from a typed pointer with a new instance of the same type which gets managed by a unique, but I think unique or sth. else tries to call free() on it.
<Yorlik>
So - my output is basically OK, but the free blows up, because there is nothing to free left ofc
<Yorlik>
Still a mess ofc, but the main mechanics starts taking shape
<Yorlik>
My guess is, the unique constructor is messing with the pointer
<K-ballo>
you mean the unique destructor?
<Yorlik>
The error messages moves btw - seems to come out async
<K-ballo>
you have memory being uniquely owned by two things at the same time, as we warned you about an hour ago
<Yorlik>
Well - obviously the unique is trying to call delete on the pointer
<Yorlik>
Thats what I guess - but might be totally wrong
<Yorlik>
If you look at the output: "Alf" is the intruder and being called from the abstract interface
<Yorlik>
Then comes the output from the remaining valid pointers
<Yorlik>
But the unique obviously has its data
<Yorlik>
You can even remove the comment from using p2 later and see the data is accessed in both ways
<K-ballo>
I'm not even going to try to follow the code when it contains such a glaring bug that matches the behavior you are seeing, even if there's still a chance the behavior you are seeing is caused by something else
<Yorlik>
By the unique, and the old pointer still pointing to the memory location
<Yorlik>
The only remaining question for me is, where it's trying to call free, and I'm afraid it's in the unique
<Yorlik>
I might just not use a unique pointer at all and manage the data myself
<K-ballo>
you know delete calls free, right?
<Yorlik>
unique probably tries to do something which is usually good and the ruight thng
<Yorlik>
Yes. But I think its all happening inside the unique
<K-ballo>
and you do know unique_ptr calls delete
<K-ballo>
you've said as much
<Yorlik>
Then thats the reason why it explodes
<Yorlik>
I don't know exactly - if you say so I believe its the case
<Yorlik>
Still learning and figuring out what exactly is going on
<K-ballo>
and you know you should really not be passing the result of placement new to a unique_ptr<T>, as we've told you before, because now the memory is being uniquely handled by two things at once
<Yorlik>
I probably should just use another typed pointer
<K-ballo>
at worst you need a custom deleter, to have unique_ptr manage something other than the storage instead
aserio has quit [Ping timeout: 252 seconds]
<Yorlik>
I'll play with it. Eventually it'll get solved. But now I need a break.
* Yorlik
waves and fades.
aserio has joined #ste||ar
<jbjnr__>
I admire your patience K-ballo :)
<K-ballo>
not much else I can do
<Yorlik>
Interestingly cl refuses to compile it
<Yorlik>
Totally different behavior on this operator =
<Yorlik>
Where gcc just emitted a warning because of missing return type cl just explodes it
<zao>
Yorlik: Remember the four phases I mentioned? The "deleter" of unique_ptr encompasses the last two, destruction and releasing storage. The standard deleter simply invokes `delete` or `delete[]`.
<zao>
If you want a different deleter, you need to pass in a different deleter type in the unique_ptr type, as it's part of the type as a template argument.
<Yorlik>
I'll play with that tomorrow. I'll just use a nop deleter or that mask ORing
<bita>
hkaiser, I was testing slice, I didn't find any problem with 1d or 2d. I believe slicing for 3d is not implemented yet. Is it correct?
<Yorlik>
Its a whole new thing to learn - for today I'm done and happy how far I got
<hkaiser>
bita: yes, working on it
<hkaiser>
as we speak
<bita>
In Keras there is only one test for slice and it is 3d
<hkaiser>
nod, I knew it :/
<aserio>
hkaiser: will you be joining the Phylanx Meeting?
<hkaiser>
bibek: I will not implement all of the variations, but will try to get the basic cases done by Monday
<bita>
thank you
<hkaiser>
aserio: no, I'm going to leave in 5 mins
<hkaiser>
bita: ^^
<hkaiser>
sorry bibek, it happened again
<aserio>
hkaiser: ok
<hkaiser>
aserio: please say hello from me ;-)
<bita>
hkaiser, gather also needs indexing and it has >3d tests, too