Integrate alrezni/quick_fix into master

This commit is contained in:
Project Philly 2017-03-09 11:11:32 -08:00
Родитель 4668a6d6e8 66c922b2e0
Коммит a0c30a309d
4 изменённых файлов: 23 добавлений и 14 удалений

Просмотреть файл

@ -1188,6 +1188,7 @@ UNITTEST_MATH_SRC = \
$(SOURCEDIR)/../Tests/UnitTests/MathTests/MatrixLearnerTests.cpp \
$(SOURCEDIR)/../Tests/UnitTests/MathTests/stdafx.cpp \
UNITTEST_MATH_SRC += $(CNTK_COMMON_SRC)
UNITTEST_MATH_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(UNITTEST_MATH_SRC))
UNITTEST_MATH := $(BINDIR)/mathtests

Просмотреть файл

@ -34,7 +34,9 @@
<Import Project="$(SolutionDir)\CNTK.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="$(GpuBuild)" Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(CudaVersion).props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@ -56,6 +58,15 @@
<AdditionalOptions>/d2Zi+ %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="$(GpuBuild)">
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(CudaInclude)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(CudaLibPath)</AdditionalLibraryDirectories>
<DelayLoadDLLs>%(DelayLoadDLLs);nvml.dll;$(CudaRuntimeDll)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="$(CpuOnlyBuild)">
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);CPUONLY</PreprocessorDefinitions>
@ -63,6 +74,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Math\NcclComm.cpp" />
<ClCompile Include="BestGpu.cpp" />
<ClCompile Include="Config.cpp" />
<ClCompile Include="DataReader.cpp" />
<ClCompile Include="DataWriter.cpp" />
@ -76,5 +88,7 @@
<ClCompile Include="TimerUtility.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
<ImportGroup Condition="$(GpuBuild)" Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(CudaVersion).targets" />
</ImportGroup>
</Project>

Просмотреть файл

@ -15,8 +15,6 @@ namespace Microsoft { namespace MSR { namespace ScriptableObjects { struct IConf
namespace Microsoft { namespace MSR { namespace CNTK {
using namespace std;
#ifndef CPUONLY
enum class GpuValidity
{

Просмотреть файл

@ -7,6 +7,7 @@
#include "stdafx.h"
#include "../../../Source/Math/GPUMatrix.h"
#include "../../../Source/Math/Matrix.h"
#include "BestGpu.h"
using namespace Microsoft::MSR::CNTK;
@ -16,18 +17,13 @@ BOOST_AUTO_TEST_SUITE(GPUMatrixSuite)
BOOST_FIXTURE_TEST_CASE(MatrixCopyAssignAccrossDevices, RandomSeedFixture)
{
bool hasTwoGpus = false;
#ifndef CPUONLY
auto gpus = GetAllGpusData();
hasTwoGpus = (gpus.size() > 1);
#endif
std::array<float, 6> array = { 1, 2, 3, 4, 5, 6 };
bool hasTwoGpus = true;
try
{
Matrix<float> m_gpu(2, 3, array.data(), c_deviceIdZero + 1, matrixFlagNormal);
}
catch (...)
{
hasTwoGpus = false;
}
{
Matrix<float> m_gpu(2, 3, array.data(), c_deviceIdZero, matrixFlagNormal);
Matrix<float> m_copy_gpu_0(m_gpu, c_deviceIdZero);