Move exception to C10 (#12354)

Summary:
There are still a few work to be done:

- Move logging and unify AT_WARN with LOG(ERROR).
- A few header files are still being plumbed through, need cleaning.
- caffe2::EnforceNotMet aliasing is not done yet.
- need to unify the macros. See c10/util/Exception.h

This is mainly a codemod and not causing functional changes. If you find your job failing and trace back to this diff, usually it can be fixed by the following approaches:

(1) add //caffe2/c10:c10 to your dependency (or transitive dependency).
(2) change objects such as at::Error, at::Optional to the c10 namespace.
(3) change functions to the c10 namespace. Especially, caffe2::MakeString is not overridden by the unified c10::str function. Nothing else changes.

Please kindly consider not reverting this diff - it involves multiple rounds of rebasing and the fix is usually simple. Contact jiayq@ or AI Platform Dev for details.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/12354

Reviewed By: orionr

Differential Revision: D10238910

Pulled By: Yangqing

fbshipit-source-id: 7794d5bf2797ab0ca6ebaccaa2f7ebbd50ff8f32
This commit is contained in:
Yangqing Jia
2018-10-15 13:28:08 -07:00
committed by Facebook Github Bot
parent aef8cadb9a
commit 713e706618
169 changed files with 1216 additions and 1113 deletions

View File

@ -853,7 +853,9 @@ include_dirs += [
library_dirs.append(lib_path)
# we specify exact lib names to avoid conflict with lua-torch installs
CAFFE2_LIBS = [os.path.join(lib_path, 'libcaffe2.so')]
CAFFE2_LIBS = [
os.path.join(lib_path, 'libcaffe2.so'),
os.path.join(lib_path, 'libc10.so')]
if USE_CUDA:
CAFFE2_LIBS.extend(['-Wl,--no-as-needed', os.path.join(lib_path, 'libcaffe2_gpu.so'), '-Wl,--as-needed'])
if USE_ROCM:
@ -877,7 +879,10 @@ if IS_DARWIN:
NCCL_LIB = os.path.join(lib_path, 'libnccl.2.dylib')
if IS_WINDOWS:
CAFFE2_LIBS = [os.path.join(lib_path, 'caffe2.lib')]
CAFFE2_LIBS = [
os.path.join(lib_path, 'caffe2.lib'),
os.path.join(lib_path, 'c10.lib')
]
if USE_CUDA:
CAFFE2_LIBS.append(os.path.join(lib_path, 'caffe2_gpu.lib'))
if USE_ROCM: