https://github.com/Microsoft/CNTK
Raw File
Tip revision: a6de5f8f21d015462ed69bdd18b66b99043aa1cf authored by Amit Agarwal on 29 April 2016, 01:45:12 UTC
Merge branch 'master' of https://github.com/Microsoft/CNTK into amitaga/cudaErrorBugFix
Tip revision: a6de5f8
CUDAPageLockedMemAllocator.h
#pragma once

#include "MemAllocator.h"

namespace Microsoft { namespace MSR { namespace CNTK {

#ifdef _WIN32
#ifdef MATH_EXPORTS
#define MATH_API __declspec(dllexport)
#else
#define MATH_API __declspec(dllimport)
#endif
#else // no DLLs on Linux
#define MATH_API
#endif

class MATH_API CUDAPageLockedMemAllocator : public MemAllocator
{
public:
    CUDAPageLockedMemAllocator(int deviceID);

    int GetDeviceId() const;
    void* Malloc(size_t size) override;
    void Free(void* p) override;
    static void* Malloc(size_t size, int deviceId);
    static void Free(void* p, int deviceId);

private:
    int m_deviceID;
};
} } }
back to top