https://github.com/Microsoft/CNTK
Raw File
Tip revision: 824963e7824baadbf31f6e84849ba5f542cfaac1 authored by Nikola Velickovic (E-Search) on 09 May 2017, 08:35:44 UTC
Supress mem sharing
Tip revision: 824963e
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