mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-13 04:13:58 +08:00
Support compile on windows x86 (#49)
* Support compile on windows x86 * fix cmake Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com>
This commit is contained in:
@@ -54,6 +54,23 @@ option(ENABLE_DEBUG "if to enable print debug information, this may reduce perfo
|
|||||||
# Whether to build fastdeply with vision/text/... examples, only for testings.
|
# Whether to build fastdeply with vision/text/... examples, only for testings.
|
||||||
option(WITH_VISION_EXAMPLES "Whether to build fastdeply with vision examples" OFF)
|
option(WITH_VISION_EXAMPLES "Whether to build fastdeply with vision examples" OFF)
|
||||||
|
|
||||||
|
# Check for 32bit system
|
||||||
|
if(WIN32)
|
||||||
|
if(NOT CMAKE_CL_64)
|
||||||
|
message("***********************Compile on non 64-bit system now**********************")
|
||||||
|
add_definitions(-DNON_64_PLATFORM)
|
||||||
|
if(WITH_GPU)
|
||||||
|
message(FATAL_ERROR "-DWITH_GPU=ON doesn't support on non 64-bit system now.")
|
||||||
|
endif()
|
||||||
|
if(ENABLE_PADDLE_BACKEND)
|
||||||
|
message(FATAL_ERROR "-DENABLE_PADDLE_BACKEND=ON doesn't support on non 64-bit system now.")
|
||||||
|
endif()
|
||||||
|
if(ENABLE_VISION)
|
||||||
|
message(FATAL_ERROR "-DENABLE_VISION=ON doesn't support on non 64-bit system now.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_DEBUG)
|
if(ENABLE_DEBUG)
|
||||||
add_definitions(-DFASTDEPLOY_DEBUG)
|
add_definitions(-DFASTDEPLOY_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
#ifndef NON_64_PLATFORM
|
||||||
|
|
||||||
#include "fastdeploy/backends/ort/ops/multiclass_nms.h"
|
#include "fastdeploy/backends/ort/ops/multiclass_nms.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "fastdeploy/core/fd_tensor.h"
|
#include "fastdeploy/core/fd_tensor.h"
|
||||||
@@ -255,3 +257,5 @@ void MultiClassNmsKernel::GetAttribute(const OrtKernelInfo* info) {
|
|||||||
score_threshold = ort_.KernelInfoGetAttribute<float>(info, "score_threshold");
|
score_threshold = ort_.KernelInfoGetAttribute<float>(info, "score_threshold");
|
||||||
}
|
}
|
||||||
} // namespace fastdeploy
|
} // namespace fastdeploy
|
||||||
|
|
||||||
|
#endif
|
@@ -13,7 +13,10 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#ifndef NON_64_PLATFORM
|
||||||
#include "onnxruntime_cxx_api.h" // NOLINT
|
#include "onnxruntime_cxx_api.h" // NOLINT
|
||||||
|
|
||||||
namespace fastdeploy {
|
namespace fastdeploy {
|
||||||
@@ -74,3 +77,5 @@ struct MultiClassNmsOp
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace fastdeploy
|
} // namespace fastdeploy
|
||||||
|
|
||||||
|
#endif
|
@@ -292,6 +292,7 @@ TensorInfo OrtBackend::GetOutputInfo(int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OrtBackend::InitCustomOperators() {
|
void OrtBackend::InitCustomOperators() {
|
||||||
|
#ifndef NON_64_PLATFORM
|
||||||
if (custom_operators_.size() == 0) {
|
if (custom_operators_.size() == 0) {
|
||||||
MultiClassNmsOp* custom_op = new MultiClassNmsOp{};
|
MultiClassNmsOp* custom_op = new MultiClassNmsOp{};
|
||||||
custom_operators_.push_back(custom_op);
|
custom_operators_.push_back(custom_op);
|
||||||
@@ -300,6 +301,7 @@ void OrtBackend::InitCustomOperators() {
|
|||||||
custom_op_domain_.Add(custom_operators_[i]);
|
custom_op_domain_.Add(custom_operators_[i]);
|
||||||
}
|
}
|
||||||
session_options_.Add(custom_op_domain_);
|
session_options_.Add(custom_op_domain_);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace fastdeploy
|
} // namespace fastdeploy
|
||||||
|
@@ -82,7 +82,9 @@ class OrtBackend : public BaseBackend {
|
|||||||
std::shared_ptr<Ort::IoBinding> binding_;
|
std::shared_ptr<Ort::IoBinding> binding_;
|
||||||
std::vector<OrtValueInfo> inputs_desc_;
|
std::vector<OrtValueInfo> inputs_desc_;
|
||||||
std::vector<OrtValueInfo> outputs_desc_;
|
std::vector<OrtValueInfo> outputs_desc_;
|
||||||
|
#ifndef NON_64_PLATFORM
|
||||||
Ort::CustomOpDomain custom_op_domain_ = Ort::CustomOpDomain("Paddle");
|
Ort::CustomOpDomain custom_op_domain_ = Ort::CustomOpDomain("Paddle");
|
||||||
|
#endif
|
||||||
OrtBackendOption option_;
|
OrtBackendOption option_;
|
||||||
void CopyToCpu(const Ort::Value& value, FDTensor* tensor);
|
void CopyToCpu(const Ort::Value& value, FDTensor* tensor);
|
||||||
};
|
};
|
||||||
|
3
external/onnxruntime.cmake
vendored
3
external/onnxruntime.cmake
vendored
@@ -36,6 +36,9 @@ if(WIN32)
|
|||||||
else()
|
else()
|
||||||
set(ONNXRUNTIME_FILENAME "onnxruntime-win-x64-${ONNXRUNTIME_VERSION}.zip")
|
set(ONNXRUNTIME_FILENAME "onnxruntime-win-x64-${ONNXRUNTIME_VERSION}.zip")
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT CMAKE_CL_64)
|
||||||
|
set(ONNXRUNTIME_FILENAME "onnxruntime-win-x86-${ONNXRUNTIME_VERSION}.zip")
|
||||||
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")
|
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")
|
||||||
set(ONNXRUNTIME_FILENAME "onnxruntime-osx-arm64-${ONNXRUNTIME_VERSION}.tgz")
|
set(ONNXRUNTIME_FILENAME "onnxruntime-osx-arm64-${ONNXRUNTIME_VERSION}.tgz")
|
||||||
|
3
external/paddle2onnx.cmake
vendored
3
external/paddle2onnx.cmake
vendored
@@ -46,6 +46,9 @@ set(PADDLE2ONNX_URL_BASE "https://bj.bcebos.com/paddle2onnx/libs/")
|
|||||||
set(PADDLE2ONNX_VERSION "1.0.0rc2")
|
set(PADDLE2ONNX_VERSION "1.0.0rc2")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(PADDLE2ONNX_FILE "paddle2onnx-win-x64-${PADDLE2ONNX_VERSION}.zip")
|
set(PADDLE2ONNX_FILE "paddle2onnx-win-x64-${PADDLE2ONNX_VERSION}.zip")
|
||||||
|
if(NOT CMAKE_CL_64)
|
||||||
|
set(PADDLE2ONNX_FILE "paddle2onnx-win-x86-${PADDLE2ONNX_VERSION}.zip")
|
||||||
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")
|
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")
|
||||||
set(PADDLE2ONNX_FILE "paddle2onnx-osx-arm64-${PADDLE2ONNX_VERSION}.tgz")
|
set(PADDLE2ONNX_FILE "paddle2onnx-osx-arm64-${PADDLE2ONNX_VERSION}.tgz")
|
||||||
|
Reference in New Issue
Block a user