-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agent IDs #512
Conversation
Copying these ideas from #240
Questions from #240
Yes, some models will have agents track other agent ids (e.g. @MILeach's scharr disease model)
This is already answered in #199, IDs are initialised the first time an agent part of an CUDASimulation which executes init functions or steps. Imported agent pops are a special case, where an exception is thrown in case of conflict, with some workaround to purge IDs.
No, this just adds complication, to save a small amount of mem, worst case we can fiddle with the typedef to reduce var size.
Per agent.
ID because there is no guarantee that they form a contiguous block (or begin from 1) which is what I feel is implied by index. The only guarantee is that they are unique (assuming they don't exceed UINT_MAX). |
I think this comment/question was more that we need to make it clear its an ID, and that we might also want to expose the index within a population to the user. |
Ah that makes sense. We already have an internal global thread index method on I can make that part of this PR too. |
2bea090
to
2855bc4
Compare
Have discussed how device agent birth id's should work. Agreed to use atomics (contrary to an earlier decision), and each |
With the latest changes (and this Jitify fix for As noted in it's commit message, 7ae4a88 will likely be reverted in future and swapped for a version where the typedef is moved. Lint is even failing, because it's unhappy that I moved the includes of |
Rough test plan
|
I've added |
Final Changes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed the diff (mostly to see why it was so large, forgot there were some tracked XML files) and generally looks fine other than the .gv files which are being tracked (that I don't believe should be).
This is managed by FLAMEGPU and can be accessed with getID() in all places where getVariable is available. IDs are assigned when a simulation begins, but can be exported and reimported to/from AgentVector/file. Users cannot change or disable agent IDs. id_t is the type of ID, is currently a typedef to unsigned int, but can be changed to uint64_t if desired. If an id_t type agent/message/env variable is required in Python, newVariableID() or similar can be used. Closes #199
Follow up to 0ccde81, C tests were leaving artifacts on Windows. Added dep graph outputs to gitignore, so they shouldn't get caught by mistake in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests all pass under linux (Release, Seatbelts=ON). 5 disabled tests are expected (performance tests which would currently fail, but should be re-enabled in the future).
[==========] 811 tests from 57 test suites ran. (481914 ms total)
[ PASSED ] 811 tests.
YOU HAVE 5 DISABLED TESTS
469 passed in 1015.62s (0:16:55)
Plan of Action
_id
AgentDescription
AgentVector::Agent
HostNewAgentAPI
DeviceAPI
(with seatbelts)(Not applicable, none of these methods change agent data, beyond sorting agents)HostAgentAPI
CUDASimulation::setPopulationData()
is calledCUDAAgent::setPopulationData()
which performs the check)CUDASimulation::setAgentPopulation()
/file loader has an optional argument to reset IDs.AgentVector::Agent
HostNewAgentAPI
DeviceAPI
DeviceNewAgentAPI
CUDASimulation::simulate()
, agent's with an unset ID are assigned an ID prior to init functions executingCUDASimulation::step()
assigns agent ids on first run, if not already assigned.HostNewAgentAPI
agents have an ID generated instantlyDeviceAgentVector
new agents have an ID generated instantlyAgentVector
insert/copy methods all reset copied id to unset flag_id
for any bound agents?Add stream support and device buffer reuse to(Concluded not really worthwhile)CUDAAgent::validateIDCollisions()
stream support anddevice buffer reuse toCUDAFatAgent::assignIDs()
Review(Existing copy/assign copy a pointer not the data, so copies create copy interfaces to the same data).HostNewAgentAPI
copy/assign behaviour. Block agent type mixing, and gen new ID (how?).Py testsDocumentation (mostly user guide, rather than api docs)(I've put relevant info into an issue)Closes #199 (when finished)
Replaces #240 (now closed)