You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2017/11/20 17:47:23 UTC

[GitHub] reminisce closed pull request #8371: Add note in the doc for using naive engine in multithreading environment

reminisce closed pull request #8371: Add note in the doc for using naive engine in multithreading environment
URL: https://github.com/apache/incubator-mxnet/pull/8371
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/faq/env_var.md b/docs/faq/env_var.md
index 7a4f8d568d..469df4f361 100644
--- a/docs/faq/env_var.md
+++ b/docs/faq/env_var.md
@@ -56,6 +56,15 @@ export MXNET_GPU_WORKER_NTHREADS=3
     - NaiveEngine: A very simple engine that uses the master thread to do the computation synchronously. Setting this engine disables multi-threading. You can use this type for debugging in case of any error. Backtrace will give you the series of calls that lead to the error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.
     - ThreadedEngine: A threaded engine that uses a global thread pool to schedule jobs.
     - ThreadedEnginePerDevice: A threaded engine that allocates thread per GPU and executes jobs asynchronously.
+  - Note: `ThreadedEngine` and `ThreadedEnginePerDevice` are not thread-safe. Switch to using `NaiveEngine`
+          if you want to have multiple client threads interacting with a single MXNet model at the same time.
+          For example, if you use MXNet from a Gunicorn HTTP server, set the `MXNET_ENGINE_TYPE` to `NaiveEngine`.
+          The Gunicorn HTTP server uses a pre-fork worker model, i.e. it (pre) forks and keeps a group of processes
+          running to handle various incoming HTTP requests and then forks additional processes if the load goes up.
+          Since the fork of a process replicates the complete process address space including threads,
+          keeping MXNet single-threaded via the use of `NaiveEngine` makes it safe.
+          The `NaiveEngine` executes the requests sequentially in the order received per process.
+          This allows you to fork and run multiple processes from the same process using MXNet.
 
 ## Execution Options
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services