Skip to content

Commit 38489a8

Browse files
committed
Cleanup debugging printfs
1 parent 5d61c04 commit 38489a8

1 file changed

Lines changed: 2 additions & 24 deletions

File tree

src/flamegpu/model/AgentDescription.cpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ namespace flamegpu {
1212
*/
1313
AgentDescription::AgentDescription(std::shared_ptr<const ModelData> _model, AgentData *const data)
1414
: model(_model)
15-
, agent(data) {
16-
17-
printf("%s::%d agent=%p\n", __FILE__, __LINE__, data);
18-
printf("%s::%d agent=%p\n", __FILE__, __LINE__, this->agent);
19-
printf("%s::%d agent->functions=%p\n", __FILE__, __LINE__, &this->agent->functions);
20-
}
15+
, agent(data) { }
2116

2217

2318
bool AgentDescription::operator==(const AgentDescription& rhs) const {
@@ -159,20 +154,13 @@ bool AgentDescription::isOutputOnDevice() const {
159154
return agent->isOutputOnDevice();
160155
}
161156

162-
163157
AgentFunctionDescription& AgentDescription::newRTCFunction(const std::string& function_name, const std::string& func_src) {
164-
printf("%s::%d agent=%p\n", __FILE__, __LINE__, this->agent);
165-
printf("%s::%d agent->functions=%p\n", __FILE__, __LINE__, &this->agent->functions);
166158
if (agent->functions.find(function_name) == agent->functions.end()) {
167-
printf("%s::%d\n", __FILE__, __LINE__);
168159
// Use Regex to get agent function name, and input/output message type
169160
std::regex rgx(R"###(.*FLAMEGPU_AGENT_FUNCTION\([ \t]*(\w+),[ \t]*([:\w]+),[ \t]*([:\w]+)[ \t]*\))###");
170-
printf("%s::%d\n", __FILE__, __LINE__);
171161
std::smatch match;
172162
if (std::regex_search(func_src, match, rgx)) {
173-
printf("%s::%d\n", __FILE__, __LINE__);
174163
if (match.size() == 4) {
175-
printf("%s::%d\n", __FILE__, __LINE__);
176164
std::string code_func_name = match[1]; // not yet clear if this is required
177165
std::string in_type_name = match[2];
178166
std::string out_type_name = match[3];
@@ -187,11 +175,9 @@ AgentFunctionDescription& AgentDescription::newRTCFunction(const std::string& fu
187175
func_src_str = func_src_str.append("#include \"flamegpu/runtime/messaging/"+ in_type_include_name + "/" + in_type_include_name + "Device.cuh\"\n");
188176
// If the message input and output types do not match, also include the input type
189177
if (in_type_name != out_type_name) {
190-
printf("%s::%d\n", __FILE__, __LINE__);
191178
std::string out_type_include_name = out_type_name.substr(out_type_name.find_last_of("::") + 1);
192179
func_src_str = func_src_str.append("#include \"flamegpu/runtime/messaging/"+ out_type_include_name + "/" + out_type_include_name + "Device.cuh\"\n");
193180
}
194-
printf("%s::%d\n", __FILE__, __LINE__);
195181

196182
// Append line pragma to correct file/line number in same format as OUTPUT_RTC_DYNAMIC_FILES
197183
#ifndef OUTPUT_RTC_DYNAMIC_FILES
@@ -204,16 +190,8 @@ AgentFunctionDescription& AgentDescription::newRTCFunction(const std::string& fu
204190
} else {
205191
func_src_str.append(func_src);
206192
}
207-
printf("%s::%d\n", __FILE__, __LINE__);
208193
auto rtn = std::shared_ptr<AgentFunctionData>(new AgentFunctionData(this->agent->shared_from_this(), function_name, func_src_str, in_type_name, out_type_name, code_func_name));
209-
printf("%s::%d\n", __FILE__, __LINE__);
210-
printf("function_name %s\n", function_name.c_str());
211-
printf("rtn %p\n", rtn.get());
212-
printf("rtn->rtc_func_name %s\n", rtn->rtc_func_name.c_str());
213-
printf("agent->functions.size() %zu\n", agent->functions.size());
214-
// agent->functions.emplace(function_name, rtn);
215-
agent->functions.insert({function_name, rtn}); // emplace caused nvhpc 21.7 with gcc 9 to segfault
216-
printf("%s::%d\n", __FILE__, __LINE__);
194+
agent->functions.insert({function_name, rtn}); // Switched to insert from emplace to fix NVHPC with GCC 9. AgentDescription::newFunction must use the opposite (emplace)
217195
return *rtn->description;
218196
} else {
219197
THROW exception::InvalidAgentFunc("Runtime agent function('%s') is missing FLAMEGPU_AGENT_FUNCTION arguments e.g. (func_name, message_input_type, message_output_type), "

0 commit comments

Comments
 (0)