Skip to content

Add FAQ page#3324

Merged
faxu merged 26 commits intomicrosoft:masterfrom
faxu:faq
May 6, 2020
Merged

Add FAQ page#3324
faxu merged 26 commits intomicrosoft:masterfrom
faxu:faq

Conversation

@faxu
Copy link
Contributor

@faxu faxu commented Mar 26, 2020

Adding a FAQ page with common questions and issues to help troubleshooting.

@faxu faxu requested a review from a team as a code owner March 26, 2020 00:17
@prasanthpul prasanthpul requested a review from natke March 27, 2020 20:18
@snnn
Copy link
Contributor

snnn commented Apr 9, 2020

Q: How to force to single threaded execution
By default, session.run() uses all my computer's cores, how to limit use to a single thread only?

A:
It requires onnxruntime version >=1.3.0.

Please do both of the following:

  • Build with openmp disabled or set environment variable OMP_NUM_THREADS to 1.
  • Set the session options intra_op_num_threads and inter_op_num_threads to 1 each.

Python example:

#!/usr/bin/python3
os.environ["OMP_NUM_THREADS"] = "1"
import onnxruntime

opts = onnxruntime.SessionOptions()
opts.intra_op_num_threads = 1
opts.inter_op_num_threads = 1
opts.execution_mode = onnxruntime.ExecutionMode.ORT_SEQUENTIAL
ort_session = onnxruntime.InferenceSession('/path/to/model.onnx', sess_options=opts)

C++ example:

// initialize  enviroment...one enviroment per process
Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "test");

// initialize session options if needed
Ort::SessionOptions session_options;
session_options.SetIntraOpNumThreads(1);
session_options.SetInterOpNumThreads(1);
#ifdef _WIN32
  const wchar_t* model_path = L"squeezenet.onnx";
#else
  const char* model_path = "squeezenet.onnx";
#endif

Ort::Session session(env, model_path, session_options);

natke
natke previously approved these changes Apr 23, 2020
Copy link
Contributor

@natke natke left a comment

Choose a reason for hiding this comment

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

I've left a few wording suggestions. Overall, looks great, much improved!

Co-Authored-By: Nat Kershaw (MSFT) <nakersha@microsoft.com>
@faxu faxu dismissed stale reviews from natke via 483bb85 April 24, 2020 00:50
faxu and others added 3 commits April 23, 2020 17:50
Co-Authored-By: Nat Kershaw (MSFT) <nakersha@microsoft.com>
Co-Authored-By: Nat Kershaw (MSFT) <nakersha@microsoft.com>
Co-Authored-By: Nat Kershaw (MSFT) <nakersha@microsoft.com>
@faxu faxu requested a review from prasanthpul April 24, 2020 00:52
prasanthpul
prasanthpul previously approved these changes May 2, 2020
@faxu
Copy link
Contributor Author

faxu commented May 6, 2020

/azp run Linux CPU CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,MacOS CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,MacOS NoContribops CI Pipeline,Linux CPU x64 NoContribops CI Pipeline,Windows CPU CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@faxu faxu merged commit 9cca219 into microsoft:master May 6, 2020
@faxu faxu deleted the faq branch May 6, 2020 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants