コード例 #1
0
ファイル: THAllocator.c プロジェクト: jacklicn/torch7
THMapAllocatorContext *THMapAllocatorContext_newWithFd(const char *filename, int fd, int flags)
{
  THMapAllocatorContext *ctx = THMapAllocatorContext_new(filename, flags);
  ctx->fd = fd;

  return ctx;
}
コード例 #2
0
ファイル: StorageSharing.cpp プロジェクト: RichieMay/pytorch
static THStorage* THPStorage_(newFdStorage)(ptrdiff_t size)
{
  int flags = TH_ALLOCATOR_MAPPED_SHAREDMEM |
              TH_ALLOCATOR_MAPPED_EXCLUSIVE |
              TH_ALLOCATOR_MAPPED_KEEPFD |
              TH_ALLOCATOR_MAPPED_UNLINK;
  std::string handle = THPStorage_(__newHandle)();
  auto ctx = THMapAllocatorContext_new(handle.c_str(), flags);
  return THStorage_(newWithAllocator)(size, &THMapAllocator, (void*)ctx);
}
コード例 #3
0
ファイル: THAllocator.c プロジェクト: Northrend/pytorch
THMapAllocatorContext *THMapAllocatorContext_newWithFd(const char *filename, int fd, int flags)
{
#ifdef _WIN32
  THError("THMapAllocatorContext_newWithFd is unsupported on Windows");
#else
  THMapAllocatorContext *ctx = THMapAllocatorContext_new(filename, flags);
  ctx->fd = fd;

  return ctx;
#endif
}
コード例 #4
0
ファイル: core.cpp プロジェクト: Jsmilemsj/pytorch
libshm_context * libshm_context_new(const char *manager_handle, const char *filename, int flags) {
  libshm_context *ctx = new libshm_context();
  ctx->manager_handle = "no_manager";
  ctx->th_context = THMapAllocatorContext_new(filename, flags);
  return ctx;
}