-
Notifications
You must be signed in to change notification settings - Fork 21
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
Network message v2 #1089
Network message v2 #1089
Conversation
TodoAgree whether vertex IDs can be "sparse" (@ptheywood in favour because everyone else does it, me not in favour because it adds an additional indirection (if not more) when accessing the graph via ID) |
Sparse IDs, limited by memory. Users encouraged to keep them contiguous to avoid memory issues. |
7d742a4
to
2032af1
Compare
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
src/flamegpu/simulation/detail/CUDAEnvironmentDirectedGraphBuffers.cu
Outdated
Show resolved
Hide resolved
src/flamegpu/simulation/detail/CUDAEnvironmentDirectedGraphBuffers.cu
Outdated
Show resolved
Hide resolved
Hard stuff is all done (unless i find more edge cases along the way). I've agreed with @ptheywood that we should offer both index and ID access API, and just document index as being preferable for performance. Remaining tasks:
Should be achievable before the end of next week. |
Current discussion is for
User first must resize it with existing They can then insert and update elements, using
|
HostAPI refactor should be complete, with all tests working on C++/Py. Going to make a start on the documentation. |
11f5202
to
e591d1c
Compare
Final changes to do next week are adding python tests around device API edge cases and checking whether there needs to be some IO documentation added. |
e501c7f
to
efcb261
Compare
#endif | ||
unsigned int curve_count[curve::Curve::MAX_VARIABLES]; |
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.
This feels like a bug that was fixed to do with seatbelts elsewhere? Not sure if this is the correct value, mid review. Should double check this works with and without seatbelts just incase.
(this is just a note mid-review so feel free to ignor for now, but doubt I'll get through all of this in one go).
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.
I think there was a bug related to this, that you couldn't build with seatbelts turned off. It was probably in fujitsu and has been fixed here (not enough context in 2 lines of code shown to check off-hand).
#endif | ||
sm()->curve_count[idx] = d_curve_table->count[idx]; |
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.
Looks like it should be ok / intentaional, but again should make sure we test with and without seatbelts.
* @return The requested address | ||
* @throws exception::DeviceError (Only when SEATBELTS==ON) If the specified graph is not found in the cuRVE hashtable, or it's details are invalid. | ||
*/ | ||
__device__ __forceinline__ static unsigned int *getEnvironmentDirectedGraphPBM(VariableHash graphHash); |
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.
I'd prefer CSR/CSC in the names not PBM / IPBM, but prolly not worth the effort to fix / just my bias from doing more graph stuff.
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.
Doesn't bother me if you wish to refactor, so long as "PBM" is in the doc comment for my comprehension.
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
include/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cuh
Outdated
Show resolved
Hide resolved
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.
As discussed I've reviewed this focussing on the headers, and only quickly reviewing the implemntation.
Generally looks good, just some docstrings haven't been updated to reflect changes to the API.
There's an absence of any python tests of the host portion of the graph api, with only codegen tests. Ignore that, i'd ticked the viewed box on that file by accident
Could do with some python tests mirroring atleast some of the c++ tests just to make sure the interface is relatively nice to use in python.
Also would prefer CSR/CSC used in place of PBM/IPBM, but it's not important enough to change.
Should make sure that betls and no belts still build, Think it should be fine, but there's a var moved out of an #ifdef which we had a similar bug for recently too.
Going to need a rebase too.
seatbelts=off builds fail without a rebase, due to the seatbelts=on builds pass all tests (c++ and python) under linux as it stands. I think the conflict wants to be resolved as follows (and changed to avoid the py3.8? bug that has been fixed in master since) but I am not 100% on this, so not force pushing. if t.targets[0].id not in self._locals :
# Special case, catch message.at() where a message is returned outside a message loop
if hasattr(t.value, "func") and isinstance(t.value.func, ast.Attribute) and t.value.func.attr == 'at' :
if t.value.func.value.id == self._input_message_var :
self._standalone_message_var.append(t.targets[0].id)
# Special case, track which variables hold directed graph handles
elif hasattr(t.value, "func") and isinstance(t.value.func, ast.Attribute) and t.value.func.attr == 'getDirectedGraph' :
if t.value.func.value.value.id == "pyflamegpu" and t.value.func.value.attr == "environment" :
self._directed_graph_vars.append(t.targets[0].id)
# Special case, definitions outside of agent fn are made const
if self._indent == 0:
self.write("constexpr ") Edit: That results in a test failure, also needs the test changing to account for the addition of |
Directed graphs can be defined on the Host and accessed and traversed on device (edges in/out of a given vertex). Vertices and Edges are referred to by vertex index on device, however a function exists to convert between vertex ID and vertex index. This approach is the compromise to minimise indirection whilst retaining usability. Graphs can be exported/imported to a JSON format compatible with d3.js via a dedicated HostAPI function. Tests added for all current functionality (C/Python/AgentPython). Also fixed a few GLM_ON build issues, likely a side effect of refactors prior to release. FLAMEGPU_ENABLE_ADVANCED_API CMake option has been added, this currently exposes a few additional (undocumented) HostAPI features such as a function that returns the CUDA stream handle.
d8dcc12
to
90a46ef
Compare
Windows Release SEATBELTS=OFF C & Python tests now pass. |
Linux release seatbelts=ON C tests all pass post-rebase. |
Copied from #883, working in a new branch to avoid breaking FRE project's dependency during development.
Remaining tasks:
HostAPI
auto sync