pytorch/c10/cuda
Sam Gross 7caad0ed33 Free all blocks with outstanding events on OOM-retry (#19222)
Summary:
The caching allocator tries to free all blocks on an out-of-memory
error. Previously, it did not free blocks that still had outstanding
stream uses. This change synchronizes on the outstanding events and
frees those blocks.

See #19219
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19222

Differential Revision: D14925071

Pulled By: colesbury

fbshipit-source-id: a2e9fe957ec11b00ea8e6c0468436c519667c558
2019-04-15 11:29:27 -07:00
..
impl Unify cudaGetDeviceCount implementations. (#18445) 2019-03-26 09:50:14 -07:00
test Add c10 cuda library. (#13900) 2018-11-19 08:20:07 -08:00
CMakeLists.txt Move THCCachingAllocator to c10_cuda. (#16119) 2019-01-24 12:06:56 -08:00
CUDACachingAllocator.cpp Free all blocks with outstanding events on OOM-retry (#19222) 2019-04-15 11:29:27 -07:00
CUDACachingAllocator.h Implement reference counting for shared IPC CUDA tensors (#16854) 2019-03-25 10:24:38 -07:00
CUDAException.h Mark cudaGetLastError return value unused in C10_CUDA_CHECK 2019-03-01 00:05:46 -08:00
CUDAFunctions.h Properly use cudaGetLastError return code. (#18485) 2019-03-26 12:26:44 -07:00
CUDAGuard.h Move files to/from c10/core and c10/util (#15316) 2019-01-10 16:22:22 -08:00
CUDAMacros.h Don't call cudaStreamDestroy at destruction time (#15692) 2019-01-11 12:36:41 -08:00
CUDAMathCompat.h Remove disabled_features in hipify 2018-12-13 15:43:57 -08:00
CUDAStream.cpp Don't call cudaStreamDestroy at destruction time (#15692) 2019-01-11 12:36:41 -08:00
CUDAStream.h Move all Stream and Event Python implementation to C++ (#15937) 2019-01-17 07:29:22 -08:00
README.md Move AT_CUDA_CHECK to c10 2018-11-19 08:20:10 -08:00

c10/cuda is a core library with CUDA functionality. It is distinguished from c10 in that it links against the CUDA library, but like c10 it doesn't contain any kernels, and consists solely of core functionality that is generally useful when writing CUDA code; for example, C++ wrappers for the CUDA C API.

Important notes for developers. If you want to add files or functionality to this folder, TAKE NOTE. The code in this folder is very special, because on our AMD GPU build, we transpile it into c10/hip to provide a ROCm environment. Thus, if you write:

// c10/cuda/CUDAFoo.h
namespace c10 { namespace cuda {

void my_func();

}}

this will get transpiled into:

// c10/hip/HIPFoo.h
namespace c10 { namespace hip {

void my_func();

}}

Thus, if you add new functionality to c10, you must also update C10_MAPPINGS tools/amd_build/pyHIPIFY/cuda_to_hip_mappings.py to transpile occurrences of cuda::my_func to hip::my_func. (At the moment, we do NOT have a catch all cuda:: to hip:: namespace conversion, as not all cuda namespaces are converted to hip::, even though c10's are.)

Transpilation inside this folder is controlled by CAFFE2_SPECIFIC_MAPPINGS (oddly enough.) C10_MAPPINGS apply to ALL source files.

If you add a new directory to this folder, you MUST update both c10/cuda/CMakeLists.txt and c10/hip/CMakeLists.txt