Skip to content

Commit

Permalink
Add tracing flag and fix FUSE workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbasoglu committed Feb 25, 2016
1 parent 18d65de commit 24acd99
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions Source/CNTK/CNTK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ void DoCommands(const ConfigParameters& config)
// set up progress tracing for compute cluster management
if (progressTracing && ((g_mpi == nullptr) || g_mpi->IsMainNode()))
{
ProgressTracing::SetTracingFlag();
ProgressTracing::TraceTotalNumberOfSteps(fullTotalMaxEpochs); // enable tracing, using this as the total number of epochs
}

Expand Down
14 changes: 13 additions & 1 deletion Source/Common/Include/ProgressTracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ namespace Microsoft { namespace MSR { namespace CNTK {
/*static*/ class ProgressTracing
{
bool m_enabled;
bool m_tracingFlag;
size_t m_totalNumberOfSteps; // total number of epochs in entire training run
size_t m_currentStepOffset; // current offset
Timer m_progressTracingTimer;

ProgressTracing()
: m_enabled(false), m_totalNumberOfSteps(0), m_currentStepOffset(0)
: m_enabled(false), m_tracingFlag(false), m_totalNumberOfSteps(0), m_currentStepOffset(0)
{
}

Expand All @@ -49,6 +50,17 @@ namespace Microsoft { namespace MSR { namespace CNTK {
return GetStaticInstance().m_enabled;
}

static bool GetTracingFlag()
{
return GetStaticInstance().m_tracingFlag;
}

static void SetTracingFlag()
{
auto& us = GetStaticInstance();
us.m_tracingFlag = true;
}

// call TraceTotalNumberOfSteps() to set the total number of steps
// Calling this with totalNumberOfSteps>0 will enable progress tracing.
static void TraceTotalNumberOfSteps(size_t totalNumberOfSteps)
Expand Down
2 changes: 1 addition & 1 deletion Source/Common/fileutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void renameOrDie(const std::string& from, const std::string& to)
}

// workaround for FUSE rename when running on Philly
if (ProgressTracing::IsEnabled())
if (ProgressTracing::GetTracingFlag())
{
fprintf(stderr, "sleep for 120 sec as workaround for FUSE write.\n");
sleep(120);
Expand Down

0 comments on commit 24acd99

Please sign in to comment.