Skip to content
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

Yaml Crash Problem WIP #282

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 10 additions & 29 deletions external/bootstrap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@
# - create build/scripts (mkdir -d build/scripts)
# - cd build/scripts
# - cmake ../..
#
# externals are always built in Release mode, CMake's build type is ignored



FILE(MAKE_DIRECTORY ${REPOSITORY_DIR}/build/ThirdParty)
execute_process(COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-D CMAKE_INSTALL_PREFIX=.
-D NEEDS_BOOST:BOOL=${NEEDS_BOOST}
-D BINDING_BUILD:STRING=${BINDING_BUILD}
-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-G ${CMAKE_GENERATOR}
-D CMAKE_INSTALL_PREFIX=.
-D NEEDS_BOOST:BOOL=${NEEDS_BOOST}
-D BINDING_BUILD:STRING=${BINDING_BUILD}
-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
../../external
WORKING_DIRECTORY ${REPOSITORY_DIR}/build/ThirdParty
RESULT_VARIABLE result
Expand All @@ -47,36 +49,15 @@ execute_process(COMMAND ${CMAKE_COMMAND}
if(result)
message(FATAL_ERROR "CMake step for Third Party builds failed: ${result}")
endif()
if(MSVC)
# for MSVC builds we need to build both Release and Debug builds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not do this (double Release, Debug build). The IDE should fix that, or one can call Clean and Rebuild..
This way, the CI build time is artificially doubled

# because this will not be ran again if we switch modes in the IDE.
execute_process(COMMAND ${CMAKE_COMMAND} --build . --config Release
WORKING_DIRECTORY ${REPOSITORY_DIR}/build/ThirdParty
RESULT_VARIABLE result
# OUTPUT_QUIET ### Disable this to debug external buiilds
)
if(result)
message(FATAL_ERROR "build step for MSVC Relase Third Party builds failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build . --config Debug
WORKING_DIRECTORY ${REPOSITORY_DIR}/build/ThirdParty
RESULT_VARIABLE result
# OUTPUT_QUIET ### Disable this to debug external buiilds
)
if(result)
message(FATAL_ERROR "build step for MSVC Debug Third Party builds failed: ${result}")
endif()
else(MSVC)
# for linux and OSx builds
execute_process(COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}

execute_process(COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${REPOSITORY_DIR}/build/ThirdParty
RESULT_VARIABLE result
# OUTPUT_QUIET ### Disable this to debug external buiilds
# OUTPUT_QUIET ### Disable this to debug external builds
)
if(result)
message(FATAL_ERROR "build step for Third Party builds failed: ${result}")
endif()
endif(MSVC)

# extract the external directory paths
# The external third party modules are being built
Expand Down
2 changes: 1 addition & 1 deletion src/nupic/engine/RegionImplFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ RegionImpl *RegionImplFactory::createRegionImpl(const std::string nodeType,

RegionImpl *impl = nullptr;
std::shared_ptr<Spec>& ns = getSpec(nodeType);
ValueMap vm = YAMLUtils::toValueMap(nodeParams.c_str(), ns->parameters,
ValueMap vm = YAMLUtils::toValueMap(nodeParams, ns->parameters,
nodeType, region->getName());

if (regionTypeMap.find(nodeType) != regionTypeMap.end()) {
Expand Down
9 changes: 3 additions & 6 deletions src/nupic/engine/YAMLUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ static void _toArray(const YAML::Node& node, std::shared_ptr<Array>& a) {

a->allocateBuffer(node.size());
void *buffer = a->getBuffer();
NTA_CHECK(buffer != nullptr) << "buffer is null";

for (size_t i = 0; i < node.size(); i++) {
const YAML::Node &item = node[i];
Expand Down Expand Up @@ -165,14 +166,15 @@ static Value toValue(const YAML::Node &node, NTA_BasicType dataType) {
Value toValue(const std::string& yamlstring, NTA_BasicType dataType)
{
// TODO -- return value? exceptions?
NTA_CHECK(yamlstring.size() > 0) << "string is empty!";
const YAML::Node doc = YAML::Load(yamlstring);
return toValue(doc, dataType);
}

/*
* For converting param specs for Regions and LinkPolicies
*/
ValueMap toValueMap(const char *yamlstring,
ValueMap toValueMap(const std::string yamlstring,
breznak marked this conversation as resolved.
Show resolved Hide resolved
Collection<ParameterSpec> &parameters,
const std::string &nodeType,
const std::string &regionName) {
Expand Down Expand Up @@ -276,11 +278,6 @@ ValueMap toValueMap(const char *yamlstring,
// }

try {
#ifdef YAMLDEBUG
NTA_DEBUG << "Adding default value '" << ps.defaultValue
<< "' to parameter " << item.first << " of type "
<< BasicType::getName(ps.dataType) << " count " << ps.count;
#endif
// NOTE: this can handle both scalers and arrays
// Arrays MUST be in Yaml sequence format even if one element.
// i.e. [1,2,3]
Expand Down
2 changes: 1 addition & 1 deletion src/nupic/engine/YAMLUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace nupic
/*
* For converting param specs for Regions and LinkPolicies
*/
ValueMap toValueMap(const char *yamlstring,
ValueMap toValueMap(const std::string yamlstring,
Collection<ParameterSpec> &parameters,
const std::string &nodeType = "",
const std::string &regionName = "");
Expand Down