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

enable the extensions custom build for java and android #11823

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion cmake/external/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ endif()

# when onnxruntime-extensions is not a subdirectory of onnxruntime,
# output binary directory must be explicitly specified.
add_subdirectory(${onnxruntime_EXTENSIONS_PATH} ${onnxruntime_EXTENSIONS_PATH}/_subbuild EXCLUDE_FROM_ALL)
# and the output binary path is the same as CMake FetchContent pattern
add_subdirectory(${onnxruntime_EXTENSIONS_PATH} ${CMAKE_BINARY_DIR}/_deps/extensions-subbuild EXCLUDE_FROM_ALL)

# target library or executable are defined in CMakeLists.txt of onnxruntime-extensions
target_include_directories(ocos_operators PRIVATE ${RE2_INCLUDE_DIR} external/json/include)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ JNIEXPORT jlong JNICALL Java_ai_onnxruntime_OrtSession_00024SessionOptions_creat
OrtSessionOptions* opts;
checkOrtStatus(jniEnv,api,api->CreateSessionOptions(&opts));
checkOrtStatus(jniEnv,api,api->SetInterOpNumThreads(opts, 1));
#ifdef ENABLE_EXTENSION_CUSTOM_OPS
// including all custom ops from onnxruntime-extensions
checkOrtStatus(jniEnv,api,api->EnableOrtCustomOps(opts));
#endif
// Commented out due to constant OpenMP warning as this API is invalid when running with OpenMP.
// Not sure how to detect that from within the C API though.
//checkOrtStatus(jniEnv,api,api->SetIntraOpNumThreads(opts, 1));
Expand Down