Merge branch 'master' of https://github.com/Microsoft/CNTK into fseide/s2s
This commit is contained in:
Коммит
cb61f42902
1
CNTK.sln
1
CNTK.sln
|
@ -358,6 +358,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Text", "Text", "{97AAB0C8-D
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReaderTests", "Tests\UnitTests\ReaderTests\ReaderTests.vcxproj", "{A4FC3467-4787-43E8-BBC0-D79AE56B468D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9BD0A711-0BBD-45B6-B81C-053F03C26CFB} = {9BD0A711-0BBD-45B6-B81C-053F03C26CFB}
|
||||
{33D2FD22-DEF2-4507-A58A-368F641AEBE5} = {33D2FD22-DEF2-4507-A58A-368F641AEBE5}
|
||||
{60BDB847-D0C4-4FD3-A947-0C15C08BCDB5} = {60BDB847-D0C4-4FD3-A947-0C15C08BCDB5}
|
||||
{7B7A51ED-AA8E-4660-A805-D50235A02120} = {7B7A51ED-AA8E-4660-A805-D50235A02120}
|
||||
|
|
|
@ -1088,7 +1088,7 @@ Input: The number of input nodes in the network divided by the dimensionality
|
|||
|
||||
\begin_layout Description
|
||||
Output: The TIMIT data is labeled with 61 different phonemes, and the network
|
||||
is trained to recognize tri-phones.
|
||||
is trained to recognize monophone states.
|
||||
Thus there are 61x3=183 output nodes.
|
||||
\end_layout
|
||||
|
||||
|
|
|
@ -45,11 +45,6 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
} // wrap static state in an accessor, so we won't need a CPP file
|
||||
|
||||
public:
|
||||
static bool IsEnabled()
|
||||
{
|
||||
return GetStaticInstance().m_enabled;
|
||||
}
|
||||
|
||||
static bool GetTracingFlag()
|
||||
{
|
||||
return GetStaticInstance().m_tracingFlag;
|
||||
|
|
|
@ -402,7 +402,7 @@ void GPUSparseMatrix<ElemType>::ChangeDeviceTo(DEVICEID_TYPE to_id)
|
|||
}
|
||||
else
|
||||
{
|
||||
ElemType* d_dst = (ElemType*)TracingGPUMemoryAllocator::Allocate<char>(to_id, m_totalBufferSizeAllocated);
|
||||
ElemType* d_dst = reinterpret_cast<ElemType*>(TracingGPUMemoryAllocator::Allocate<char>(to_id, m_totalBufferSizeAllocated));
|
||||
|
||||
// first try peer access
|
||||
int canAccessPeer = false;
|
||||
|
@ -625,7 +625,7 @@ void GPUSparseMatrix<ElemType>::Reshape(const size_t numRows, const size_t numCo
|
|||
|
||||
size_t bufferSizeNeeded = BufferSizeNeeded(numRows, numCols, m_elemSizeAllocated, m_format);
|
||||
|
||||
ElemType* pArray = (ElemType*)TracingGPUMemoryAllocator::Allocate<char>(m_computeDevice, bufferSizeNeeded);
|
||||
ElemType* pArray = reinterpret_cast<ElemType*>(TracingGPUMemoryAllocator::Allocate<char>(m_computeDevice, bufferSizeNeeded));
|
||||
|
||||
if (m_pArray != nullptr)
|
||||
{
|
||||
|
@ -683,7 +683,7 @@ void GPUSparseMatrix<ElemType>::Resize(const size_t numRows, const size_t numCol
|
|||
|
||||
if (reallocate)
|
||||
{
|
||||
ElemType* pArray = (ElemType*)TracingGPUMemoryAllocator::Allocate<char>(m_computeDevice, bufferSizeNeeded);
|
||||
ElemType* pArray = reinterpret_cast<ElemType*>(TracingGPUMemoryAllocator::Allocate<char>(m_computeDevice, bufferSizeNeeded));
|
||||
|
||||
if (m_pArray != nullptr)
|
||||
{
|
||||
|
|
|
@ -83,8 +83,6 @@
|
|||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /D /I /Y "$(ACML_PATH)\lib\*.dll" $(OutputPath)</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copying ACML DLLs</Message>
|
||||
</PostBuildEvent>
|
||||
<CudaCompile>
|
||||
|
@ -214,4 +212,4 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -80,11 +80,11 @@
|
|||
<AdditionalDependencies>ReaderLib.lib;Math.lib;$(OpenCVLib);$(ZipLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command Condition="$(HasOpenCV)">xcopy /Y "$(OPENCV_PATH)\x64\vc12\bin\opencv_world300.dll" $(TargetDir)</Command>
|
||||
<Command Condition="$(UseZip)">
|
||||
copy /Y "$(ZLIB_PATH)\bin\zip.dll" "$(TargetDir)"
|
||||
if exist "$(ZLIB_PATH)\bin\zlib1.dll" (copy /Y "$(ZLIB_PATH)\bin\zlib1.dll" "$(TargetDir)") else (copy /Y "$(ZLIB_PATH)\bin\zlib.dll" "$(TargetDir)\zlib1.dll")
|
||||
</Command>
|
||||
<Command>if "$(HasOpenCv)" == "true" xcopy /Y "$(OPENCV_PATH)\x64\vc12\bin\opencv_world300.dll" $(TargetDir)
|
||||
if "$(UseZip)" == "true" copy /Y "$(ZLIB_PATH)\bin\zip.dll" "$(TargetDir)"
|
||||
if "$(UseZip)" == "true" if exist "$(ZLIB_PATH)\bin\zlib1.dll" (copy /Y "$(ZLIB_PATH)\bin\zlib1.dll" "$(TargetDir)") else (copy /Y "$(ZLIB_PATH)\bin\zlib.dll" "$(TargetDir)\zlib1.dll")
|
||||
</Command>
|
||||
<Message>Copying dependencies</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(DebugBuild)">
|
||||
|
|
|
@ -424,7 +424,7 @@ bool BlockRandomizer::GetNextSequenceIds(size_t sampleCount, std::vector<size_t>
|
|||
const auto& seqDesc = m_randomTimeline[m_sequencePositionInSweep];
|
||||
originalIds.push_back(seqDesc.m_id);
|
||||
|
||||
const auto & currentChunk = m_randomizedChunks[GetChunkIndexForSequencePosition(seqDesc.m_id)];
|
||||
const auto & currentChunk = m_randomizedChunks[GetChunkIndexForSequencePosition(m_sequencePositionInSweep)];
|
||||
const size_t windowBegin = currentChunk.m_windowBegin;
|
||||
const size_t windowEnd = currentChunk.m_windowEnd;
|
||||
|
||||
|
|
|
@ -1320,7 +1320,7 @@ bool SGD<ElemType>::PreCompute(ComputationNetworkPtr net,
|
|||
|
||||
net->ForwardProp(nodes);
|
||||
|
||||
if (ProgressTracing::IsEnabled())
|
||||
if (ProgressTracing::GetTracingFlag())
|
||||
{
|
||||
numItersSinceLastPrintOfProgress++;
|
||||
if (numItersSinceLastPrintOfProgress >= numIterationsBeforePrintingProgress)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "ComputationNetwork.h"
|
||||
#include "DataReaderHelpers.h"
|
||||
#include "TrainingNodes.h" // TODO: we should move the functions that depend on these to the .cpp
|
||||
#include "ProgressTracing.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
@ -95,6 +96,8 @@ public:
|
|||
dataReader->StartMinibatchLoop(mbSize, 0, testSize);
|
||||
m_net->StartEvaluateMinibatchLoop(evalNodes);
|
||||
|
||||
const size_t numIterationsBeforePrintingProgress = 100;
|
||||
size_t numItersSinceLastPrintOfProgress = 0;
|
||||
while (DataReaderHelpers::GetMinibatchIntoNetwork<ElemType>(*dataReader, m_net, nullptr, false, false, inputMatrices, actualMBSize))
|
||||
{
|
||||
ComputationNetwork::BumpEvalTimeStamp(featureNodes);
|
||||
|
@ -130,6 +133,18 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (ProgressTracing::GetTracingFlag())
|
||||
{
|
||||
numItersSinceLastPrintOfProgress++;
|
||||
if (numItersSinceLastPrintOfProgress >= numIterationsBeforePrintingProgress)
|
||||
{
|
||||
// TODO: For now just print 0.0 instead of calculating actual progress
|
||||
printf("PROGRESS: %.2f%%\n", 0.0f);
|
||||
numItersSinceLastPrintOfProgress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// call DataEnd to check if end of sentence is reached
|
||||
// datareader will do its necessary/specific process for sentence ending
|
||||
dataReader->DataEnd();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
#include "ProgressTracing.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -103,6 +104,8 @@ public:
|
|||
size_t totalEpochSamples = 0;
|
||||
std::map<std::wstring, void*, nocase_compare> outputMatrices;
|
||||
|
||||
const size_t numIterationsBeforePrintingProgress = 100;
|
||||
size_t numItersSinceLastPrintOfProgress = 0;
|
||||
size_t actualMBSize;
|
||||
while (DataReaderHelpers::GetMinibatchIntoNetwork<ElemType>(dataReader, m_net, nullptr, false, false, inputMatrices, actualMBSize))
|
||||
{
|
||||
|
@ -126,6 +129,17 @@ public:
|
|||
|
||||
totalEpochSamples += actualMBSize;
|
||||
|
||||
if (ProgressTracing::GetTracingFlag())
|
||||
{
|
||||
numItersSinceLastPrintOfProgress++;
|
||||
if (numItersSinceLastPrintOfProgress >= numIterationsBeforePrintingProgress)
|
||||
{
|
||||
// TODO: For now just print 0.0 instead of calculating actual progress
|
||||
printf("PROGRESS: %.2f%%\n", 0.0f);
|
||||
numItersSinceLastPrintOfProgress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// call DataEnd function in dataReader to do
|
||||
// reader specific process if sentence ending is reached
|
||||
dataReader.DataEnd();
|
||||
|
@ -221,6 +235,8 @@ public:
|
|||
std::string valueFormatString = "%" + formattingOptions.precisionFormat + formatChar; // format string used in fprintf() for formatting the values
|
||||
|
||||
size_t actualMBSize;
|
||||
const size_t numIterationsBeforePrintingProgress = 100;
|
||||
size_t numItersSinceLastPrintOfProgress = 0;
|
||||
while (DataReaderHelpers::GetMinibatchIntoNetwork<ElemType>(dataReader, m_net, nullptr, false, false, inputMatrices, actualMBSize))
|
||||
{
|
||||
ComputationNetwork::BumpEvalTimeStamp(inputNodes);
|
||||
|
@ -334,6 +350,17 @@ public:
|
|||
|
||||
fprintf(stderr, "Minibatch[%lu]: ActualMBSize = %lu\n", ++numMBsRun, actualMBSize);
|
||||
|
||||
if (ProgressTracing::GetTracingFlag())
|
||||
{
|
||||
numItersSinceLastPrintOfProgress++;
|
||||
if (numItersSinceLastPrintOfProgress >= numIterationsBeforePrintingProgress)
|
||||
{
|
||||
// TODO: For now just print 0.0 instead of calculating actual progress
|
||||
printf("PROGRESS: %.2f%%\n", 0.0f);
|
||||
numItersSinceLastPrintOfProgress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// call DataEnd function in dataReader to do
|
||||
// reader specific process if sentence ending is reached
|
||||
dataReader.DataEnd();
|
||||
|
|
|
@ -10,12 +10,10 @@ else
|
|||
fi
|
||||
|
||||
# cntkrun <CNTK config file name> <additional CNTK args>
|
||||
# Note: always use legacy for now.
|
||||
imageLayout=legacy
|
||||
#if [ "$TEST_DEVICE" == "cpu" ]; then
|
||||
# imageLayout=legacy
|
||||
#else
|
||||
# imageLayout=cudnn
|
||||
#fi
|
||||
if [ "$TEST_DEVICE" == "cpu" ]; then
|
||||
imageLayout=legacy
|
||||
else
|
||||
imageLayout=cudnn
|
||||
fi
|
||||
|
||||
cntkrun 02_Convolution.cntk "train=[reader=[file=$CleanDataDir/Train.txt]] test=[reader=[file=$CleanDataDir/Test.txt]] train=[SGD=[maxEpochs=1]] train=[SGD=[epochSize=128]] train=[reader=[randomize=none]] imageLayout=\"$imageLayout\"" || exit $?
|
||||
|
|
|
@ -536,6 +536,8 @@ def listCommand(args):
|
|||
for device in args.devices:
|
||||
for os in args.oses:
|
||||
for build_sku in args.buildSKUs:
|
||||
if build_sku=="cpu" and device=="gpu":
|
||||
continue
|
||||
tag = test.matchesTag(args.tag, flavor, device, os, build_sku) if args.tag else '*'
|
||||
if tag:
|
||||
if tag in testsByTag.keys():
|
||||
|
@ -587,6 +589,8 @@ def runCommand(args):
|
|||
for build_sku in args.buildSKUs:
|
||||
if args.tag and args.tag != '' and not test.matchesTag(args.tag, flavor, device, 'windows' if windows else 'linux', build_sku):
|
||||
continue
|
||||
if build_sku=="cpu" and device=="gpu":
|
||||
continue
|
||||
totalCount = totalCount + 1
|
||||
if len(test.testCases)==0:
|
||||
# forcing verbose mode (showing all output) for all test which are based on exit code (no pattern-based test cases)
|
||||
|
@ -699,6 +703,9 @@ if (args.build_sku):
|
|||
print >>sys.stderr, "--build-sku must be one of", args.buildSKUs
|
||||
sys.exit(1)
|
||||
args.buildSKUs = [args.build_sku]
|
||||
if args.build_sku == "cpu" and args.devices == ["gpu"]:
|
||||
print >>sys.stderr, "Invalid combination: --build-sku cpu and --device gpu"
|
||||
sys.exit(1)
|
||||
|
||||
if args.func == runCommand and not args.build_location:
|
||||
args.build_location = os.path.realpath(os.path.join(thisDir, "../..", "x64" if windows else "build/"))
|
||||
|
|
|
@ -173,6 +173,39 @@ BOOST_AUTO_TEST_CASE(BlockRandomizerOneEpoch)
|
|||
actual.begin(), actual.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(BlockRandomizerOneEpochSmallWindow)
|
||||
{
|
||||
std::vector<float> data { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
|
||||
auto mockDeserializer = std::make_shared<MockDeserializer>(5, 2, data);
|
||||
|
||||
auto randomizer = std::make_shared<BlockRandomizer>(0, 10, mockDeserializer);
|
||||
|
||||
EpochConfiguration epochConfiguration;
|
||||
epochConfiguration.m_numberOfWorkers = 1;
|
||||
epochConfiguration.m_workerRank = 0;
|
||||
epochConfiguration.m_minibatchSizeInSamples = 0;
|
||||
epochConfiguration.m_totalEpochSizeInSamples = 10;
|
||||
epochConfiguration.m_epochIndex = 0;
|
||||
randomizer->StartEpoch(epochConfiguration);
|
||||
|
||||
std::vector<float> expected { 9.0, 8.0, 3.0, 6.0, 2.0, 1.0, 4.0, 7.0, 5.0, 0.0 };
|
||||
std::vector<float> actual;
|
||||
for (int i = 0; i < 11; i++)
|
||||
{
|
||||
Sequences sequences = randomizer->GetNextSequences(1);
|
||||
BOOST_CHECK_EQUAL(sequences.m_data.size(), 1 - (i / 10));
|
||||
if (i < 10)
|
||||
{
|
||||
auto data = reinterpret_cast<DenseSequenceData&>(*sequences.m_data[0][0]);
|
||||
BOOST_CHECK_EQUAL(data.m_numberOfSamples, 1);
|
||||
actual.push_back(*((float*)data.m_data));
|
||||
}
|
||||
BOOST_CHECK_EQUAL(sequences.m_endOfEpoch, (9 <= i));
|
||||
}
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(),
|
||||
actual.begin(), actual.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(BlockRandomizerOneEpochLegacyRandomization)
|
||||
{
|
||||
std::vector<float> data { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
# WARNING. This will run in Microsoft Internal Environment ONLY
|
||||
# Generating CNTK Binary drops in Jenkins environment
|
||||
|
||||
# Command line parameters
|
||||
# Verbose command line parameter (-verbose) is automatically added
|
||||
# because of CmdletBinding
|
||||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
# Supposed to be taken from Jenkins BUILD_CONFIGURATION
|
||||
[string]$buildConfig,
|
||||
|
||||
# Supposed to be taken from Jenkins TARGET_CONFIGURATION
|
||||
[string]$targetConfig,
|
||||
|
||||
# File share path. Supposed to have sub-folders corresponding to $targetConfig
|
||||
[string]$sharePath
|
||||
)
|
||||
|
||||
# Set to Stop on Error
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Manual parameters check rather than using [Parameter(Mandatory=$True)]
|
||||
# to avoid the risk of interactive prompts inside a Jenkins job
|
||||
$usage = " parameter is missing. Usage example: make_binary_drop_windows.ps1 -buildConfig Release -targetConfig gpu -sharePath \\server\share"
|
||||
If (-not $buildConfig) {Throw "buildConfig" + $usage}
|
||||
If (-not $targetConfig) {Throw "targetConfig" + $usage}
|
||||
If (-not $sharePath) {Throw "sharePath" + $usage}
|
||||
|
||||
# Set Verbose mode
|
||||
If ($verbose)
|
||||
{
|
||||
$VerbosePreference = "continue"
|
||||
}
|
||||
|
||||
Write-Verbose "Making binary drops..."
|
||||
|
||||
# If not a Release build quit
|
||||
If ($buildConfig -ne "Release")
|
||||
{
|
||||
Write-Verbose "Not a release build. No binary drops generation"
|
||||
Exit
|
||||
}
|
||||
|
||||
# Set Paths
|
||||
$basePath = "BinaryDrops\ToZip"
|
||||
$baseDropPath = Join-Path $basePath -ChildPath cntk
|
||||
$zipFile = "BinaryDrops\BinaryDrops.zip"
|
||||
$buildPath = "x64\Release"
|
||||
If ($targetConfig -eq "CPU")
|
||||
{
|
||||
$buildPath = "x64\Release_CpuOnly"
|
||||
}
|
||||
$sharePath = Join-Path $sharePath -ChildPath $targetConfig
|
||||
|
||||
|
||||
# Make binary drop folder
|
||||
New-Item -Path $baseDropPath -ItemType directory
|
||||
|
||||
# Copy build binaries
|
||||
Write-Verbose "Copying build binaries ..."
|
||||
Copy-Item $buildPath -Recurse -Destination $baseDropPath\cntk
|
||||
|
||||
# Clean unwanted items
|
||||
If (Test-Path $baseDropPath\cntk\UnitTests)
|
||||
{
|
||||
Remove-Item $baseDropPath\cntk\UnitTests -Recurse
|
||||
}
|
||||
Remove-Item $baseDropPath\cntk\*test*.exe
|
||||
Remove-Item $baseDropPath\cntk\*.pdb
|
||||
Remove-Item $baseDropPath\cntk\*.lib
|
||||
Remove-Item $baseDropPath\cntk\*.exp
|
||||
Remove-Item $baseDropPath\cntk\*.metagen
|
||||
|
||||
# Copy Examples
|
||||
Write-Verbose "Copying Examples ..."
|
||||
Copy-Item Examples -Recurse -Destination $baseDropPath\Examples
|
||||
|
||||
# Copy all items from the share
|
||||
# For whatever reason Copy-Item in the line below does not work
|
||||
# Copy-Item $sharePath"\*" -Recurse -Destination $baseDropPath
|
||||
# Copying with Robocopy. Maximum 2 retries, 30 sec waiting times in between
|
||||
Write-Verbose "Copying dependencies and other files from Remote Share ..."
|
||||
robocopy $sharePath $baseDropPath /s /e /r:2 /w:30
|
||||
# Check that Robocopy finished OK.
|
||||
# Any exit code greater than 7 indicates error
|
||||
# See http://ss64.com/nt/robocopy-exit.html
|
||||
If ($LastExitCode -gt 7)
|
||||
{
|
||||
Throw "Copying from Remote Share failed. Robocopy exit code is " + $LastExitCode
|
||||
}
|
||||
|
||||
Write-Verbose "Making ZIP and cleaning up..."
|
||||
|
||||
# Make ZIP file
|
||||
$source = Join-Path $PWD.Path -ChildPath $basePath
|
||||
$destination = Join-Path $PWD.Path -ChildPath $zipFile
|
||||
Add-Type -assembly "system.io.compression.filesystem"
|
||||
[io.compression.zipfile]::CreateFromDirectory($source, $destination)
|
||||
|
||||
# Remove ZIP sources
|
||||
If (Test-Path $basePath)
|
||||
{
|
||||
Remove-Item $basePath -Recurse
|
||||
}
|
Загрузка…
Ссылка в новой задаче