larroy opened a new pull request #15762: Refactor LibraryInitializer so it's 
thread safe. Fixes random sporadical concurrency crashes.
URL: https://github.com/apache/incubator-mxnet/pull/15762
 
 
   ## Description ##
   
   This PR improves initialization of the Library which uses unsafe passing of 
environment variables to child processes through pthread_atfork handlers. 
Calling setenv concurrently with getenv leads to random crashes which have been 
reported in several ocassions but so far haven't been fixed.
   
   This patch avoids using getenv and setenv and it should address those random 
crashes while improving handling of the library intialization in the 
LibraryInitializer object.
   
   Fixes #13438
   Fixes #14979
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [x] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to 
the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) 
created (except PRs with tiny changes)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [x] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - Check the API doc at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [x] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - Instead of changing OMP_NUM_THREADS it directly set_thread_max to 1, even 
though OMP is disabled.
   - LibraryInitializer is run on (library) construction instead of static 
initialization so it's run before any other static initializer.
   - Improve documentation of concurrency environment variables.

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


With regards,
Apache Git Services

Reply via email to