-
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
DeviceAPI::isAgent() DeviceAPI::isState() #1116
Conversation
With new C/Python tests Closes #1108 Currently only RTC implemented with Python test.
@@ -132,7 +132,7 @@ void CUDAAgent::setPopulationData(const AgentVector& population, const std::stri | |||
if (state_name == ModelData::DEFAULT_STATE) { | |||
THROW exception::InvalidAgentState("Agent '%s' does not use the default state, so the state must be passed explicitly, " | |||
"in CUDAAgent::setPopulationData()", | |||
state_name.c_str(), population.getAgentName().c_str()); |
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.
Had this exception thrown whilst writing test, noticed it was wrong.
* | ||
* @note Implementation based on https://stackoverflow.com/a/34873763/1646387 | ||
*/ | ||
__device__ __forceinline__ int dstrcmp(const char *s1, const char *s2) { |
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 will not be resolved at compile time for RTC due to the use of the while loop. If we really wanted to have this resolve at compile time we would have to find a way for this to work with constexpr
or a through template recursion. I don't think this is necessary though and we should flag that string comparisons are not particularly fast in the docs.
With new C/Python tests
Closes #1108
Todo
Note
strcmp()
is not defined in device code, so ripped a small correct looking implementation off stack overflow (found inutil/dstring.h
).Branch should be squashed