Skip to content

Commit b31c10e

Browse files
CarlosLeeGitpymumu
authored andcommitted
fix dlengine compile
1 parent d877733 commit b31c10e

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/drivers/devices/cpu/flowunit/dlengine/dlengine_cpu_inference_flowunit.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "dlengine_cpu_inference_flowunit.h"
1818

19-
static constexpr std::string BACKEND_TYPE = "JwdLCz9nKiM=";
19+
constexpr const char *BACKEND_TYPE = "JwdLCz9nKiM=";
2020

2121
DLEngineCPUInferenceFlowUnit::DLEngineCPUInferenceFlowUnit()
2222
: inference_(std::make_shared<DLEngineInference>()) {}

src/drivers/devices/cuda/flowunit/dlengine/dlengine_cuda_inference_flowunit.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "dlengine_cuda_inference_flowunit.h"
1818

19-
static constexpr std::string BACKEND_TYPE = "PBJAFgZcNjg=";
19+
constexpr const char *BACKEND_TYPE = "PBJAFgZcNjg=";
2020

2121
DLEngineCUDAInferenceFlowUnit::DLEngineCUDAInferenceFlowUnit()
2222
: inference_(std::make_shared<DLEngineInference>()) {}
@@ -45,7 +45,7 @@ modelbox::Status DLEngineCUDAInferenceFlowUnit::CudaProcess(
4545
auto ret = cudaStreamSynchronize(stream);
4646
if (ret != cudaSuccess) {
4747
MBLOG_ERROR << "cuda stream sync failed, err " << ret;
48-
return STATUS_FAULT;
48+
return modelbox::STATUS_FAULT;
4949
}
5050

5151
return inference_->Infer(data_ctx);

src/drivers/inference_engine/dlengine/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ include_directories(${LIBMODELBOX_VIRTUALDRIVER_INFERENCE_INCLUDE})
3636
include_directories(${DLENGINE_INCLUDE_DIR})
3737
include_directories(${MODELBOX_COMMON_INFERENCE_INCLUDE})
3838

39-
link_directories(${DLENGINE_LIBRARY_DIR})
40-
4139
set(MODELBOX_UNIT_SHARED libmodelbox-engine-dlengine)
4240
set(MODELBOX_UNIT_SOURCE_INCLUDE ${CMAKE_CURRENT_LIST_DIR})
4341

@@ -52,7 +50,7 @@ SOVERSION ${MODELBOX_VERSION_MAJOR}
5250
target_link_libraries(${MODELBOX_UNIT_SHARED} pthread)
5351
target_link_libraries(${MODELBOX_UNIT_SHARED} rt)
5452
target_link_libraries(${MODELBOX_UNIT_SHARED} dl)
55-
target_link_libraries(${MODELBOX_UNIT_SHARED} dlengine)
53+
target_link_libraries(${MODELBOX_UNIT_SHARED} ${DLENGINE_LIBRARIES})
5654
target_link_libraries(${MODELBOX_UNIT_SHARED} ${LIBMODELBOX_SHARED})
5755
target_link_libraries(${MODELBOX_UNIT_SHARED} ${LIBMODELBOX_VIRTUALDRIVER_INFERENCE_SHARED})
5856
target_link_libraries(${MODELBOX_UNIT_SHARED} ${MODELBOX_COMMON_INFERENCE_LIBRARY})

src/drivers/inference_engine/dlengine/dlengine_inference.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ modelbox::Status TensorShapeParam::Parse(const std::string &shape_str,
7575
std::vector<size_t> &shape_value) {
7676
auto format_shape_str = shape_str;
7777
std::transform(format_shape_str.begin(), format_shape_str.end(),
78-
format_shape_str.begin(), std::tolower);
78+
format_shape_str.begin(),
79+
[](int c) { return std::tolower(c); });
7980
auto dims = modelbox::StringSplit(format_shape_str, 'x');
8081
if (dims.empty()) {
8182
MBLOG_ERROR << "shape [" << shape_str
@@ -416,7 +417,7 @@ void DLEngineInference::SetBufferInfo(
416417
const std::shared_ptr<modelbox::BufferList> &buffer_list,
417418
dlengine::DataType data_type, const dlengine::DimSize &shape) {
418419
// data_type has been checked
419-
auto mb_data_type = g_dlengine_to_mb_type_map[data_type];
420+
auto mb_data_type = g_dlengine_to_mb_type_map.at(data_type);
420421
std::vector<size_t> out_shape;
421422
out_shape.reserve(shape.num_dims);
422423
const size_t n = 1;
@@ -456,5 +457,5 @@ size_t DLEngineInference::SingleTensorSize(const dlengine::DimSize &shape,
456457
}
457458

458459
// data_type has been checked
459-
return tensor_size * g_dlengine_type_size_map[data_type];
460+
return tensor_size * g_dlengine_type_size_map.at(data_type);
460461
}

0 commit comments

Comments
 (0)