Apply patch to allow users to change path of lock file (#4649)

See - https://github.com/Microsoft/CNTK/issues/62
This commit is contained in:
Jimmy Tang 2017-07-02 14:26:23 +01:00 committed by Adam J. Stewart
parent 182554520f
commit f6e2320ef0
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,20 @@
diff --git a/Source/Common/CrossProcessMutex.h b/Source/Common/CrossProcessMutex.h
index 2f3ce70..f0fcd42 100644
--- a/Source/Common/CrossProcessMutex.h
+++ b/Source/Common/CrossProcessMutex.h
@@ -127,9 +127,13 @@ class CrossProcessMutex
public:
CrossProcessMutex(const std::string& name)
- : m_fd(-1),
- m_fileName("/var/lock/" + name)
+ : m_fd(-1)
{
+ const char * const envLockDir = getenv("CNTK_LOCK_DIR");
+ if (envLockDir != NULL)
+ m_fileName = envLockDir + ('/' + name);
+ else
+ m_fileName = "/var/lock/" + name;
}
// Acquires the mutex. If 'wait' is true and mutex is acquired by someone else then

View File

@ -64,6 +64,8 @@ class Cntk(Package):
patch('build.patch')
# Patch to fix BLAS inconsistency between CNTK and KaldiReader
patch('kaldireader-openblas.patch')
# Patch to change behaviour of lock file - https://github.com/Microsoft/CNTK/issues/62
patch('lock-file.patch')
def install(self, spec, prefix):
args = []