From 78a9e7d83f0e401f0c2e4d01518fa89b410cc749 Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Tue, 4 Dec 2018 20:07:49 -0800 Subject: [PATCH] Delete defunct files from torch/csrc/distributed (#14785) Summary: Signed-off-by: Edward Z. Yang Pull Request resolved: https://github.com/pytorch/pytorch/pull/14785 Differential Revision: D13333066 Pulled By: ezyang fbshipit-source-id: e7937b4e8e12409b0fa964c34f995f7861ca95ff --- torch/csrc/distributed/copy_utils.h | 55 -------------------------------- torch/csrc/distributed/override_macros.h | 38 ---------------------- torch/csrc/distributed/undef_macros.h | 36 --------------------- torch/csrc/distributed/utils.h | 20 ------------ 4 files changed, 149 deletions(-) delete mode 100644 torch/csrc/distributed/copy_utils.h delete mode 100644 torch/csrc/distributed/override_macros.h delete mode 100644 torch/csrc/distributed/undef_macros.h delete mode 100644 torch/csrc/distributed/utils.h diff --git a/torch/csrc/distributed/copy_utils.h b/torch/csrc/distributed/copy_utils.h deleted file mode 100644 index cdd4391..0000000 --- a/torch/csrc/distributed/copy_utils.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef THDP_COPY_UTILS_H -#define THDP_COPY_UTILS_H - -extern THDTensorDescriptor* THDPModule_makeDescriptor(PyObject *obj); -template -void THDPInsertCopyFunctionFromWorker( - THPCopyList& copyList, - void (*copyFunc)(THDTensorDescriptor* x, TensorSrc *z)) -{ - auto wrapper = [copyFunc](PyObject* dst_, PyObject* src_) { - TensorSrc* src = THPTypeInfo::cdata(src_); - - PyThreadState *_save = nullptr; - try { - Py_UNBLOCK_THREADS; - copyFunc(LIBRARY_STATE THDPModule_makeDescriptor(dst_), src); - Py_BLOCK_THREADS; - } catch (...) { - if (_save) { - Py_BLOCK_THREADS; - } - throw; - } - }; - - PyTypeObject* srcType = THPTypeInfo::pyType(); - copyList.push_back({ srcType, wrapper, false }); -} - -template -void THDPInsertCopyFunctionFromMaster( - THPCopyList& copyList, - void (*copyFunc)(TensorDst *x, THDTensorDescriptor* z), - PyTypeObject *srcType) -{ - auto wrapper = [copyFunc](PyObject* dst_, PyObject* src_) { - TensorDst* dst = THPTypeInfo::cdata(dst_); - - PyThreadState *_save = nullptr; - try { - Py_UNBLOCK_THREADS; - copyFunc(LIBRARY_STATE dst, THDPModule_makeDescriptor(src_)); - Py_BLOCK_THREADS; - } catch (...) { - if (_save) { - Py_BLOCK_THREADS; - } - throw; - } - }; - - copyList.push_back({ srcType, wrapper, false }); -} - -#endif diff --git a/torch/csrc/distributed/override_macros.h b/torch/csrc/distributed/override_macros.h deleted file mode 100644 index e788533..0000000 --- a/torch/csrc/distributed/override_macros.h +++ /dev/null @@ -1,38 +0,0 @@ -#include "undef_macros.h" - -#define THWStoragePtr THDStoragePtr -#define THPStoragePtr THDPStoragePtr -#define THWTensorPtr THDTensorPtr -#define THPTensorPtr THDPTensorPtr - -#define THWStorage THDStorage -#define THWStorage_(NAME) THDStorage_(NAME) -#define THWTensor THDTensor -#define THWTensor_(NAME) THDTensor_(NAME) - -#define THPStorage_(NAME) TH_CONCAT_4(THDP,Real,Storage_,NAME) -#define THPStorage THDPStorage -#define THPStorageBaseStr THDPStorageBaseStr -#define THPStorageStr THDPStorageStr -#define THPStorageClass THDPStorageClass -#define THPStorageType THDPStorageType - -#define THPTensor_(NAME) TH_CONCAT_4(THDP,Real,Tensor_,NAME) -#define THPTensor_stateless_(NAME) TH_CONCAT_4(THDP,Real,Tensor_stateless_,NAME) -#define THPTensor THDPTensor -#define THPTensorStr THDPTensorStr -#define THPTensorBaseStr THDPTensorBaseStr -#define THPTensorClass THDPTensorClass -#define THPTensorType THDPTensorType - -#define THPTensorStatelessType THDPTensorStatelessType -#define THPTensorStateless THDPTensorStateless - -#define LIBRARY_STATE_NOARGS -#define LIBRARY_STATE -#define TH_GENERIC_FILE THD_GENERIC_FILE - -#define THHostTensor TH_CONCAT_3(TH,Real,Tensor) -#define THHostTensor_(NAME) TH_CONCAT_4(TH,Real,Tensor_,NAME) -#define THHostStorage TH_CONCAT_3(TH,Real,Storage) -#define THHostStorage_(NAME) TH_CONCAT_4(TH,Real,Storage_,NAME) diff --git a/torch/csrc/distributed/undef_macros.h b/torch/csrc/distributed/undef_macros.h deleted file mode 100644 index 9698175..0000000 --- a/torch/csrc/distributed/undef_macros.h +++ /dev/null @@ -1,36 +0,0 @@ -#undef TH_GENERIC_FILE -#undef LIBRARY_STATE -#undef LIBRARY_STATE_NOARGS - -#undef THPTensor_ -#undef THPTensor_stateless_ -#undef THPTensor -#undef THPTensorStr -#undef THPTensorBaseStr -#undef THPTensorClass - -#undef THPTensorStatelessType -#undef THPTensorStateless -#undef THPTensorType - -#undef THPStorage_ -#undef THPStorage -#undef THPStorageBaseStr -#undef THPStorageStr -#undef THPStorageClass -#undef THPStorageType - -#undef THWStorage -#undef THWStorage_ -#undef THWTensor -#undef THWTensor_ - -#undef THWStoragePtr -#undef THPStoragePtr -#undef THWTensorPtr -#undef THPTensorPtr - -#undef THHostTensor -#undef THHostTensor_ -#undef THHostStorage -#undef THHostStorage_ diff --git a/torch/csrc/distributed/utils.h b/torch/csrc/distributed/utils.h deleted file mode 100644 index aa0a6ba..0000000 --- a/torch/csrc/distributed/utils.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef THDP_UTILS_H -#define THDP_UTILS_H - -#include "THDP.h" - -#define THDPUtils_(NAME) TH_CONCAT_4(THDP,Real,Utils_,NAME) - -#define THDStoragePtr TH_CONCAT_3(THD,Real,StoragePtr) -#define THDTensorPtr TH_CONCAT_3(THD,Real,TensorPtr) -#define THDPStoragePtr TH_CONCAT_3(THDP,Real,StoragePtr) -#define THDPTensorPtr TH_CONCAT_3(THDP,Real,TensorPtr) - -#include "override_macros.h" - -#define THD_GENERIC_FILE "torch/csrc/generic/utils.h" -#include - -typedef THPPointer THDPTensorDesc; - -#endif -- 2.7.4