moved DeviceFromConfig() for CPUONLY mode back to BestGpu.h since it otherwise caused link errors for reader projects that did not include BestGpu.cpp;
.CU files now include BestGpu.h to get access to CPUONLY flag; CPUONLY mode set from BestGpu.h now compiles in VS with SDK installed
This commit is contained in:
Родитель
b2d77c5d8b
Коммит
35e2211147
|
@ -6,8 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// #define CPUONLY // #define this to build without GPU support nor needing the SDK installed
|
||||
#define CPUONLY // #define this to build without GPU support nor needing the SDK installed
|
||||
|
||||
namespace Microsoft { namespace MSR { namespace CNTK {
|
||||
#ifndef CPUONLY
|
||||
short DeviceFromConfig(const class ConfigParameters& config);
|
||||
#else
|
||||
static inline short DeviceFromConfig(const class ConfigParameters& /*config*/) { return -1/*CPUDEVICE*/; } // tells runtime system to not try to use GPUs
|
||||
// TODO: find a way to use CPUDEVICE without a huge include overhead; OK so far since CPUONLY mode is sorta special...
|
||||
#endif
|
||||
}}}
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
// </copyright>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "BestGpu.h"
|
||||
|
||||
#ifndef CPUONLY
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cublas_v2.h"
|
||||
#include <assert.h>
|
||||
#include <cuda.h>
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
// </copyright>
|
||||
//
|
||||
|
||||
#include "BestGpu.h"
|
||||
|
||||
#ifndef CPUONLY
|
||||
|
||||
#include <float.h>
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
// </copyright>
|
||||
//
|
||||
|
||||
#include "BestGpu.h"
|
||||
|
||||
#ifndef CPUONLY
|
||||
|
||||
#include "GPUSparseMatrix.h"
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
// </copyright>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "BestGpu.h"
|
||||
|
||||
#ifndef CPUONLY
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GPUWatcher.h"
|
||||
#include <cuda.h>
|
||||
#include <cuda_runtime.h>
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#pragma warning (disable: 4702) // unreachable code, which we get from the NOT_IMPLEMENTED macro which is OK
|
||||
|
||||
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);
|
||||
|
@ -39,8 +37,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
// PrepareDevice - Setup the correct cuda context for an operation
|
||||
// deviceId - the device on which the operation will take place
|
||||
// defaults to -1, which means use matrices current device
|
||||
template<class ElemType> void GPUSparseMatrix<ElemType>::PrepareDevice(short deviceId /*=-1*/) const
|
||||
{}
|
||||
template<class ElemType> void GPUSparseMatrix<ElemType>::PrepareDevice(short deviceId /*=-1*/) const {}
|
||||
|
||||
template<class ElemType> void GPUSparseMatrix<ElemType>::DeepCopy(const GPUSparseMatrix<ElemType>& deepCopy) { }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче