PaddlePaddle / Anakin

High performance Cross-platform Inference-engine, you could run Anakin on x86-cpu,arm, nv-gpu, amd-gpu,bitmain and cambricon devices.
https://anakin.baidu.com/
Apache License 2.0
532 stars 135 forks source link

Help!! Crash in Net init. #195

Open Alan-Turing-Ko opened 6 years ago

Alan-Turing-Ko commented 6 years ago

Thanks for the great library. I want to run mobilenet (in benchmark example) on ARM in jni and model was converted successfully. I follow the arm inference example classification.cpp. Model loaded successfully and graph.get_outs() returns OK. But when call Net<ARM, AK_FLOAT, Precision::FP32, OpRunType::SYNC> net_executer(graph, ctx1, true); app crashes. Crash context is following module in net.cpp.

template<typename Ttype, DataType Dtype, Precision Ptype, OpRunType RunType> void Net<Ttype, Dtype, Ptype, RunType>::init(graph::Graph<Ttype, Dtype, Ptype>& graph, \ OpContextPtr ctx) {

init_env(graph);
// shallow copy
_graph_p->CopyFrom(graph);
auto node_names_in_exec_order = graph.get_nodes_in_order();
// infer basic shape and parsing parameter from graph
for (auto& node_name : node_names_in_exec_order) {
    auto node_ptr = (*_graph_p)[node_name];
    //LOG(ERROR) << "get node " << node_name << ", op type " << node_ptr->get_op_name();
    if (node_ptr->get_op_name() == "Output") {
        continue;
    }

    // create operations
    auto* op_pointer = OpFactory<Ttype, Dtype, Ptype>::Global()[node_ptr->get_op_name()]; // Crash

node_ptr->get_op_name() is "Input". Global().get_list_op_name() returns empty list.

What can be the issue? Hope to any suggestions.

xyoungli commented 6 years ago

if you linked static lib in your project, please add "-Wl,--whole-archive ${anakin_lib_static} -Wl,--no-whole-archive" in "target_link_libraries" in your CMakeList