From 93e414d801da72083eb6e329231ef58f7d0840b4 Mon Sep 17 00:00:00 2001 From: Peter Heywood Date: Fri, 1 Oct 2021 16:02:27 +0100 Subject: [PATCH] Cleanup debugging printfs --- src/flamegpu/model/AgentDescription.cpp | 26 ++----------------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/flamegpu/model/AgentDescription.cpp b/src/flamegpu/model/AgentDescription.cpp index f003da7d8..eee27733f 100644 --- a/src/flamegpu/model/AgentDescription.cpp +++ b/src/flamegpu/model/AgentDescription.cpp @@ -12,12 +12,7 @@ namespace flamegpu { */ AgentDescription::AgentDescription(std::shared_ptr _model, AgentData *const data) : model(_model) - , agent(data) { - - printf("%s::%d agent=%p\n", __FILE__, __LINE__, data); - printf("%s::%d agent=%p\n", __FILE__, __LINE__, this->agent); - printf("%s::%d agent->functions=%p\n", __FILE__, __LINE__, &this->agent->functions); - } + , agent(data) { } bool AgentDescription::operator==(const AgentDescription& rhs) const { @@ -159,20 +154,13 @@ bool AgentDescription::isOutputOnDevice() const { return agent->isOutputOnDevice(); } - AgentFunctionDescription& AgentDescription::newRTCFunction(const std::string& function_name, const std::string& func_src) { - printf("%s::%d agent=%p\n", __FILE__, __LINE__, this->agent); - printf("%s::%d agent->functions=%p\n", __FILE__, __LINE__, &this->agent->functions); if (agent->functions.find(function_name) == agent->functions.end()) { - printf("%s::%d\n", __FILE__, __LINE__); // Use Regex to get agent function name, and input/output message type std::regex rgx(R"###(.*FLAMEGPU_AGENT_FUNCTION\([ \t]*(\w+),[ \t]*([:\w]+),[ \t]*([:\w]+)[ \t]*\))###"); - printf("%s::%d\n", __FILE__, __LINE__); std::smatch match; if (std::regex_search(func_src, match, rgx)) { - printf("%s::%d\n", __FILE__, __LINE__); if (match.size() == 4) { - printf("%s::%d\n", __FILE__, __LINE__); std::string code_func_name = match[1]; // not yet clear if this is required std::string in_type_name = match[2]; std::string out_type_name = match[3]; @@ -187,11 +175,9 @@ AgentFunctionDescription& AgentDescription::newRTCFunction(const std::string& fu func_src_str = func_src_str.append("#include \"flamegpu/runtime/messaging/"+ in_type_include_name + "/" + in_type_include_name + "Device.cuh\"\n"); // If the message input and output types do not match, also include the input type if (in_type_name != out_type_name) { - printf("%s::%d\n", __FILE__, __LINE__); std::string out_type_include_name = out_type_name.substr(out_type_name.find_last_of("::") + 1); func_src_str = func_src_str.append("#include \"flamegpu/runtime/messaging/"+ out_type_include_name + "/" + out_type_include_name + "Device.cuh\"\n"); } - printf("%s::%d\n", __FILE__, __LINE__); // Append line pragma to correct file/line number in same format as OUTPUT_RTC_DYNAMIC_FILES #ifndef OUTPUT_RTC_DYNAMIC_FILES @@ -204,16 +190,8 @@ AgentFunctionDescription& AgentDescription::newRTCFunction(const std::string& fu } else { func_src_str.append(func_src); } - printf("%s::%d\n", __FILE__, __LINE__); auto rtn = std::shared_ptr(new AgentFunctionData(this->agent->shared_from_this(), function_name, func_src_str, in_type_name, out_type_name, code_func_name)); - printf("%s::%d\n", __FILE__, __LINE__); - printf("function_name %s\n", function_name.c_str()); - printf("rtn %p\n", rtn.get()); - printf("rtn->rtc_func_name %s\n", rtn->rtc_func_name.c_str()); - printf("agent->functions.size() %zu\n", agent->functions.size()); - // agent->functions.emplace(function_name, rtn); - agent->functions.insert({function_name, rtn}); // emplace caused nvhpc 21.7 with gcc 9 to segfault - printf("%s::%d\n", __FILE__, __LINE__); + agent->functions.insert({function_name, rtn}); // Switched to insert from emplace to fix NVHPC with GCC 9. AgentDescription::newFunction must use the opposite (emplace) return *rtn->description; } else { THROW exception::InvalidAgentFunc("Runtime agent function('%s') is missing FLAMEGPU_AGENT_FUNCTION arguments e.g. (func_name, message_input_type, message_output_type), "