BestGpu.h is now the place to #define CPUONLY in source code if needed (which you would do when compiling from Visual Studio. You can also define it on the compiler command line, which you would do when compiling from an explicit makefile);
references to CUDA libs moved from BestGpu.h to the .cpp, which is will soon be moved into the CNTKMathCUDA project and thus not get compiled if no CUDA SDK is installed; no-CUDA implementation of DeviceFromConfig() moved from BestGpu.cpp to NoGPU.cpp; removed several no-longer-needed CUDA references from project files--two referenced-lib settings are now again identical between Debug and Release, they were inconsistent before
This commit is contained in:
Родитель
11a7c05c23
Коммит
beb24799fe
|
@ -7,18 +7,16 @@
|
||||||
#define _CRT_SECURE_NO_WARNINGS // "secure" CRT not available on all platforms --add this at the top of all CPP files that give "function or variable may be unsafe" warnings
|
#define _CRT_SECURE_NO_WARNINGS // "secure" CRT not available on all platforms --add this at the top of all CPP files that give "function or variable may be unsafe" warnings
|
||||||
|
|
||||||
#include "BestGpu.h"
|
#include "BestGpu.h"
|
||||||
|
#ifndef CPUONLY
|
||||||
|
#pragma comment (lib, "cudart.lib")
|
||||||
|
#pragma comment (lib, "nvml.lib")
|
||||||
|
#include <cuda_runtime.h>
|
||||||
|
#include <nvml.h>
|
||||||
|
#include <vector>
|
||||||
|
#endif
|
||||||
#include "CommonMatrix.h" // for CPUDEVICE and AUTOPLACEMATRIX
|
#include "CommonMatrix.h" // for CPUDEVICE and AUTOPLACEMATRIX
|
||||||
|
|
||||||
#ifdef CPUONLY // #define this to disable GPUs
|
#ifndef CPUONLY // #define this to disable GPUs
|
||||||
|
|
||||||
namespace Microsoft { namespace MSR { namespace CNTK {
|
|
||||||
short DeviceFromConfig(const ConfigParameters& /*config*/)
|
|
||||||
{
|
|
||||||
return CPUDEVICE;
|
|
||||||
}
|
|
||||||
}}}
|
|
||||||
|
|
||||||
#else // CPUONLY
|
|
||||||
|
|
||||||
// CUDA-C includes
|
// CUDA-C includes
|
||||||
#include <cuda.h>
|
#include <cuda.h>
|
||||||
|
|
|
@ -6,12 +6,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef CPUONLY
|
// #define CPUONLY // #define this to build without GPU support nor needing the SDK installed
|
||||||
#pragma comment (lib, "cudart.lib")
|
|
||||||
#include <cuda_runtime.h>
|
|
||||||
#include <nvml.h>
|
|
||||||
#include <vector>
|
|
||||||
#endif
|
|
||||||
#include "commandArgUtil.h"
|
#include "commandArgUtil.h"
|
||||||
|
|
||||||
namespace Microsoft { namespace MSR { namespace CNTK {
|
namespace Microsoft { namespace MSR { namespace CNTK {
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>cudart.lib;Delayimp.lib;nvml.lib;cntkMath.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>Delayimp.lib;cntkMath.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)\;..\..\math\$(Platform)\$(Configuration);..\$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)\;..\..\math\$(Platform)\$(Configuration);..\$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
|
||||||
<DelayLoadDLLs>CNTKMath.dll;nvml.dll</DelayLoadDLLs>
|
<DelayLoadDLLs>CNTKMath.dll;nvml.dll</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>Delayimp.lib;nvml.lib;cudart.lib;cntkMath.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>Delayimp.lib;cntkMath.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>..\..\math\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\..\math\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
<Profile>true</Profile>
|
<Profile>true</Profile>
|
||||||
<DelayLoadDLLs>CNTKMath.dll;nvml.dll</DelayLoadDLLs>
|
<DelayLoadDLLs>CNTKMath.dll;nvml.dll</DelayLoadDLLs>
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
#include "GPUSparseMatrix.h"
|
#include "GPUSparseMatrix.h"
|
||||||
#include <iostream> // for cout
|
#include <iostream> // for cout
|
||||||
|
|
||||||
|
#pragma comment (lib, "cudart.lib") // instruct linker to reference these libs
|
||||||
|
#pragma comment (lib, "cublas.lib")
|
||||||
|
#pragma comment (lib, "cusparse.lib")
|
||||||
|
#pragma comment (lib, "curand.lib")
|
||||||
|
|
||||||
#pragma warning (disable: 4267) // conversion from 'size_t' to 'unsigned int'; happens in CUDA <<<a,b>>> syntax if a and b are size_t
|
#pragma warning (disable: 4267) // conversion from 'size_t' to 'unsigned int'; happens in CUDA <<<a,b>>> syntax if a and b are size_t
|
||||||
#pragma warning (disable: 4127) // conditional expression is constant; "if (sizeof(ElemType)==sizeof(float))" triggers this
|
#pragma warning (disable: 4127) // conditional expression is constant; "if (sizeof(ElemType)==sizeof(float))" triggers this
|
||||||
#pragma warning (disable: 4702) // unreachable code; triggered for unknown reasons
|
#pragma warning (disable: 4702) // unreachable code; triggered for unknown reasons
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Helpers.h"
|
#include "Helpers.h"
|
||||||
#include "CommonMatrix.h"
|
#include "CommonMatrix.h"
|
||||||
|
#include "BestGpu.h" // for CPUONLY macro
|
||||||
|
|
||||||
#ifndef CPUONLY
|
#ifndef CPUONLY
|
||||||
#pragma comment (lib, "CNTKMathCUDA.lib") // built by CNTKMathCUDA
|
#pragma comment (lib, "CNTKMathCUDA.lib") // built by CNTKMathCUDA
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>cudart.lib;cuda.lib;cublas.lib;cusparse.lib;curand.lib;libacml_mp_dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>libacml_mp_dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>
|
||||||
</AdditionalLibraryDirectories>
|
</AdditionalLibraryDirectories>
|
||||||
<DelayLoadDLLs>cublas64_65.dll;cusparse64_65.dll;curand64_65.dll;cudart64_65.dll;nvcuda.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>cublas64_65.dll;cusparse64_65.dll;curand64_65.dll;cudart64_65.dll;nvcuda.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>
|
||||||
</AdditionalLibraryDirectories>
|
</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>cusparse.lib;cublas.lib;cuda.lib;cudart.lib;curand.lib;libacml_mp_dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>libacml_mp_dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<Profile>true</Profile>
|
<Profile>true</Profile>
|
||||||
<DelayLoadDLLs>cublas64_65.dll;cusparse64_65.dll;curand64_65.dll;cudart64_65.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>cublas64_65.dll;cusparse64_65.dll;curand64_65.dll;cudart64_65.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -12,8 +12,13 @@
|
||||||
#include "GPUSparseMatrix.h"
|
#include "GPUSparseMatrix.h"
|
||||||
|
|
||||||
#pragma warning (disable: 4100) // unreferenced formal parameter, which is OK since all functions in here are dummies; disabling this allows to copy-paste prototypes here when we add new functions
|
#pragma warning (disable: 4100) // unreferenced formal parameter, which is OK since all functions in here are dummies; disabling this allows to copy-paste prototypes here when we add new functions
|
||||||
|
#pragma warning (disable: 4702) // unreachable code, which we get from the NOT_IMPLEMENTED macro which is OK
|
||||||
|
|
||||||
namespace Microsoft { namespace MSR { namespace CNTK {
|
namespace Microsoft { namespace MSR { namespace CNTK {
|
||||||
|
short DeviceFromConfig(const ConfigParameters& /*config*/) { return CPUDEVICE; } // tells runtime system to not try to use GPUs
|
||||||
|
|
||||||
|
// the reset below are dummy implementations
|
||||||
|
|
||||||
void PrepareDevice(short deviceId);
|
void PrepareDevice(short deviceId);
|
||||||
|
|
||||||
#pragma region Constructors and Destructor
|
#pragma region Constructors and Destructor
|
||||||
|
|
Загрузка…
Ссылка в новой задаче