1 #pragma once 2 3 #include <ATen/MapAllocator.h> 4 5 #ifdef __cplusplus 6 7 #ifdef SHM_EXPORTS 8 #define SHM_API __declspec(dllexport) 9 #else 10 #define SHM_API __declspec(dllimport) 11 #endif 12 13 SHM_API void libshm_init(const char* manager_exec_path); 14 15 class SHM_API THManagedMapAllocator : public at::RefcountedMapAllocator { 16 public: THManagedMapAllocator(const char * manager_handle,const char * filename,int flags,size_t size)17 THManagedMapAllocator( 18 const char* manager_handle, 19 const char* filename, 20 int flags, 21 size_t size) 22 : at::RefcountedMapAllocator(filename, flags, size) {} 23 24 static at::DataPtr makeDataPtr( 25 const char* manager_handle, 26 const char* filename, 27 int flags, 28 size_t size); 29 static THManagedMapAllocator* fromDataPtr(const at::DataPtr&); 30 manager_handle()31 const char* manager_handle() const { 32 return "no_manager"; 33 } 34 }; 35 36 #endif 37