Centralized PrintCallStack calls
This commit is contained in:
Родитель
0155e9e195
Коммит
2cf85dac99
|
@ -271,8 +271,7 @@ void BestGpu::Init()
|
||||||
{
|
{
|
||||||
const char* errmsg = cudaGetErrorString(err);
|
const char* errmsg = cudaGetErrorString(err);
|
||||||
fprintf(stderr, "!!!!!!!!CUDA EXCEPTION: %s\n", errmsg);
|
fprintf(stderr, "!!!!!!!!CUDA EXCEPTION: %s\n", errmsg);
|
||||||
Microsoft::MSR::CNTK::DebugUtil::PrintCallStack();
|
RuntimeError(errmsg);
|
||||||
throw std::runtime_error(errmsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1220,30 +1220,6 @@ using namespace msra::basetypes; // for compatibility
|
||||||
|
|
||||||
#pragma warning (pop)
|
#pragma warning (pop)
|
||||||
|
|
||||||
// RuntimeError - throw a std::runtime_error with a formatted error string
|
|
||||||
__declspec_noreturn
|
|
||||||
static inline void RuntimeError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start(args, format);
|
|
||||||
vsprintf(buffer, format, args);
|
|
||||||
throw std::runtime_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// LogicError - throw a std::logic_error with a formatted error string
|
|
||||||
__declspec_noreturn
|
|
||||||
static inline void LogicError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start(args, format);
|
|
||||||
vsprintf(buffer, format, args);
|
|
||||||
throw std::logic_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// dynamic loading of modules
|
// dynamic loading of modules
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "basetypes.h"
|
#include "basetypes.h"
|
||||||
|
#include "Basics.h"
|
||||||
#include "fileutil.h"
|
#include "fileutil.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using Microsoft::MSR::CNTK::RuntimeError;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// fopenOrDie(): like fopen() but terminate with err msg in case of error.
|
// fopenOrDie(): like fopen() but terminate with err msg in case of error.
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "basetypes.h"
|
#include "basetypes.h"
|
||||||
|
#include "Basics.h"
|
||||||
#include "fileutil.h" // for opening/reading the ARPA file
|
#include "fileutil.h" // for opening/reading the ARPA file
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -17,6 +18,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
namespace msra { namespace lm {
|
namespace msra { namespace lm {
|
||||||
|
using Microsoft::MSR::CNTK::RuntimeError;
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// core LM interface -- LM scores are accessed through this exclusively
|
// core LM interface -- LM scores are accessed through this exclusively
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "basetypes.h" // for attempt()
|
#include "basetypes.h" // for attempt()
|
||||||
|
#include "Basics.h"
|
||||||
#include "htkfeatio.h" // for htkmlfreader
|
#include "htkfeatio.h" // for htkmlfreader
|
||||||
#include "latticearchive.h" // for reading HTK phoneme lattices (MMI training)
|
#include "latticearchive.h" // for reading HTK phoneme lattices (MMI training)
|
||||||
#include "minibatchsourcehelpers.h"
|
#include "minibatchsourcehelpers.h"
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
#include "unordered_set"
|
#include "unordered_set"
|
||||||
|
|
||||||
namespace msra { namespace dbn {
|
namespace msra { namespace dbn {
|
||||||
|
using Microsoft::MSR::CNTK::LogicError;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// minibatchutterancesource -- feature source to provide randomized utterances
|
// minibatchutterancesource -- feature source to provide randomized utterances
|
||||||
|
|
|
@ -1072,34 +1072,6 @@ using namespace msra::basetypes; // for compatibility
|
||||||
|
|
||||||
#pragma warning (pop)
|
#pragma warning (pop)
|
||||||
|
|
||||||
// RuntimeError - throw a std::runtime_error with a formatted error string
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
__declspec(noreturn)
|
|
||||||
#endif
|
|
||||||
static inline void RuntimeError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start (args, format);
|
|
||||||
vsprintf (buffer, format, args);
|
|
||||||
throw std::runtime_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// LogicError - throw a std::logic_error with a formatted error string
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
__declspec(noreturn)
|
|
||||||
#endif
|
|
||||||
static inline void LogicError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start(args, format);
|
|
||||||
vsprintf(buffer, format, args);
|
|
||||||
throw std::logic_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// dynamic loading of modules
|
// dynamic loading of modules
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1072,34 +1072,6 @@ using namespace msra::basetypes; // for compatibility
|
||||||
|
|
||||||
#pragma warning (pop)
|
#pragma warning (pop)
|
||||||
|
|
||||||
// RuntimeError - throw a std::runtime_error with a formatted error string
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
__declspec(noreturn)
|
|
||||||
#endif
|
|
||||||
static inline void RuntimeError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start (args, format);
|
|
||||||
vsprintf (buffer, format, args);
|
|
||||||
throw std::runtime_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// LogicError - throw a std::logic_error with a formatted error string
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
__declspec(noreturn)
|
|
||||||
#endif
|
|
||||||
static inline void LogicError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start(args, format);
|
|
||||||
vsprintf(buffer, format, args);
|
|
||||||
throw std::logic_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// dynamic loading of modules
|
// dynamic loading of modules
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -816,34 +816,6 @@ using namespace msra::basetypes; // for compatibility
|
||||||
|
|
||||||
#pragma warning (pop)
|
#pragma warning (pop)
|
||||||
|
|
||||||
// RuntimeError - throw a std::runtime_error with a formatted error string
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
__declspec(noreturn)
|
|
||||||
#endif
|
|
||||||
static inline void RuntimeError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start(args, format);
|
|
||||||
vsprintf(buffer, format, args);
|
|
||||||
throw std::runtime_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// LogicError - throw a std::logic_error with a formatted error string
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
__declspec(noreturn)
|
|
||||||
#endif
|
|
||||||
static inline void LogicError(const char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start(args, format);
|
|
||||||
vsprintf(buffer, format, args);
|
|
||||||
throw std::logic_error(buffer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// dynamic loading of modules
|
// dynamic loading of modules
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -51,8 +51,7 @@ static inline DEVICEID_TYPE EnforceOneGPUOnly(DEVICEID_TYPE requestedDeviceId)
|
||||||
#define NOT_IMPLEMENTED \
|
#define NOT_IMPLEMENTED \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, "Inside File: %s Line: %d Function: %s -> Feature Not Implemented.\n", __FILE__, __LINE__, __FUNCTION__); \
|
fprintf(stderr, "Inside File: %s Line: %d Function: %s -> Feature Not Implemented.\n", __FILE__, __LINE__, __FUNCTION__); \
|
||||||
Microsoft::MSR::CNTK::DebugUtil::PrintCallStack(); \
|
LogicError("Not Implemented"); \
|
||||||
throw std::logic_error("Not Implemented"); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GPUSPARSE_INDEX_TYPE int //cuSparse only supports int array indexes
|
#define GPUSPARSE_INDEX_TYPE int //cuSparse only supports int array indexes
|
||||||
|
|
Загрузка…
Ссылка в новой задаче