/usr/local/lib64/python3.6/site-packages/torch/include/ATen
NameSizeModeActions
core/-0755rm
cpu/-0755rm
cuda/-0755rm
cudnn/-0755rm
detail/-0755rm
hip/-0755rm
native/-0755rm
quantized/-0755rm
AccumulateType.h44380644editdlrm
ArrayRef.h440644editdlrm
ATen.h9980644editdlrm
autocast_mode.h67160644editdlrm
Backend.h430644editdlrm
Backtrace.h460644editdlrm
BatchedFallback.h9650644editdlrm
BatchedTensorImpl.h53830644editdlrm
CompositeExplicitAutogradFunctions.h16220644editdlrm
CompositeExplicitAutogradFunctions_inl.h540750644editdlrm
CompositeImplicitAutogradFunctions.h16220644editdlrm
CompositeImplicitAutogradFunctions_inl.h1420820644editdlrm
Config.h7340644editdlrm
Context.h127670644editdlrm
cpp_custom_type_hack.h53260644editdlrm
CPUApplyUtils.h125820644editdlrm
CPUFixedAllocator.h8300644editdlrm
CPUFunctions.h16000644editdlrm
CPUFunctions_inl.h1719240644editdlrm
CPUGeneratorImpl.h14310644editdlrm
CUDAFunctions.h16010644editdlrm
CUDAFunctions_inl.h1856960644editdlrm
CUDAGeneratorImpl.h46950644editdlrm
Device.h420644editdlrm
DeviceGuard.h11340644editdlrm
Dimname.h310644editdlrm
DimVector.h460644editdlrm
Dispatch.h521370644editdlrm
div_rtn.h2040644editdlrm
DLConvertor.h5760644editdlrm
dlpack.h52440644editdlrm
DynamicLibrary.h3690644editdlrm
ExpandUtils.h145060644editdlrm
Formatting.h340644editdlrm
Functions.h8463260644editdlrm
Generator.h460644editdlrm
InferSize.h21430644editdlrm
InitialTensorOptions.h4450644editdlrm
Layout.h420644editdlrm
MapAllocator.h29990644editdlrm
MatrixRef.h30160644editdlrm
MemoryOverlap.h11170644editdlrm
MetaFunctions.h16010644editdlrm
MetaFunctions_inl.h840060644editdlrm
NamedTensor.h350644editdlrm
NamedTensorUtils.h57470644editdlrm
NativeFunctions.h3546510644editdlrm
NativeMetaFunctions.h354450644editdlrm
NumericUtils.h27870644editdlrm
OpaqueTensorImpl.h60800644editdlrm
Operators.h17071990644editdlrm
OpMathType.h4600644editdlrm
Parallel.h48750644editdlrm
ParallelNative.h24430644editdlrm
ParallelNativeTBB.h29340644editdlrm
ParallelOpenMP.h30490644editdlrm
PTThreadPool.h3940644editdlrm
record_function.h240440644editdlrm
RedispatchFunctions.h11128860644editdlrm
RegistrationDeclarations.h5457770644editdlrm
SavedTensorHooks.h3280644editdlrm
Scalar.h440644editdlrm
ScalarOps.h22720644editdlrm
ScalarType.h1290644editdlrm
SequenceNumber.h3730644editdlrm
SmallVector.h470644editdlrm
SparseCsrTensorImpl.h20450644editdlrm
SparseCsrTensorUtils.h5230644editdlrm
SparseTensorImpl.h124170644editdlrm
SparseTensorUtils.h42190644editdlrm
Storage.h430644editdlrm
Tensor.h480644editdlrm
TensorAccessor.h510644editdlrm
TensorGeometry.h18550644editdlrm
TensorIndexing.h219230644editdlrm
TensorIterator.h299620644editdlrm
TensorIteratorInternal.h18620644editdlrm
TensorMeta.h29170644editdlrm
TensorNames.h25190644editdlrm
TensorOperators.h32750644editdlrm
TensorOptions.h490644editdlrm
TensorUtils.h56870644editdlrm
ThreadLocalState.h32890644editdlrm
TracerMode.h55760644editdlrm
TypeDefault.h6800644editdlrm
Utils.h59930644editdlrm
Version.h3400644editdlrm
VmapMode.h9520644editdlrm
VmapTransforms.h76540644editdlrm
WrapDimUtils.h34380644editdlrm
WrapDimUtilsMulti.h7680644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/ATen/Parallel.h (4875B)
#pragma once #include #include #include namespace at { inline int64_t divup(int64_t x, int64_t y) { return (x + y - 1) / y; } // Called during new thread initialization TORCH_API void init_num_threads(); // Sets the number of threads to be used in parallel region TORCH_API void set_num_threads(int); // Returns the maximum number of threads that may be used in a parallel region TORCH_API int get_num_threads(); // Returns the current thread number (starting from 0) // in the current parallel region, or 0 in the sequential region TORCH_API int get_thread_num(); // Checks whether the code runs in parallel region TORCH_API bool in_parallel_region(); namespace internal { // Initialise num_threads lazily at first parallel call inline TORCH_API void lazy_init_num_threads() { thread_local bool init = false; if (C10_UNLIKELY(!init)) { at::init_num_threads(); init = true; } } TORCH_API void set_thread_num(int); class TORCH_API ThreadIdGuard { public: ThreadIdGuard(int new_id): old_id_(at::get_thread_num()) { set_thread_num(new_id); } ~ThreadIdGuard() { set_thread_num(old_id_); } private: int old_id_; }; } // namespace internal /* parallel_for begin: index at which to start applying user function end: index at which to stop applying user function grain_size: number of elements per chunk. impacts the degree of parallelization f: user function applied in parallel to the chunks, signature: void f(int64_t begin, int64_t end) Warning: parallel_for does NOT copy thread local states from the current thread to the worker threads. This means for example that Tensor operations CANNOT be used in the body of your function, only data pointers. */ template inline void parallel_for( const int64_t begin, const int64_t end, const int64_t grain_size, const F& f); /* parallel_reduce begin: index at which to start applying reduction end: index at which to stop applying reduction grain_size: number of elements per chunk. impacts number of elements in intermediate results tensor and degree of parallelization. ident: identity for binary combination function sf. sf(ident, x) needs to return x. f: function for reduction over a chunk. f needs to be of signature scalar_t f(int64_t partial_begin, int64_t partial_end, scalar_t identifiy) sf: function to combine two partial results. sf needs to be of signature scalar_t sf(scalar_t x, scalar_t y) For example, you might have a tensor of 10000 entires and want to sum together all the elements. Parallel_reduce with a grain_size of 2500 will then allocate an intermediate result tensor with 4 elements. Then it will execute the function "f" you provide and pass the beginning and end index of these chunks, so 0-2499, 2500-4999, etc. and the combination identity. It will then write out the result from each of these chunks into the intermediate result tensor. After that it'll reduce the partial results from each chunk into a single number using the combination function sf and the identity ident. For a total summation this would be "+" and 0 respectively. This is similar to tbb's approach [1], where you need to provide a function to accumulate a subrange, a function to combine two partial results and an identity. Warning: parallel_reduce does NOT copy thread local states from the current thread to the worker threads. This means for example that Tensor operations CANNOT be used in the body of your function, only data pointers. [1] https://software.intel.com/en-us/node/506154 */ template inline scalar_t parallel_reduce( const int64_t begin, const int64_t end, const int64_t grain_size, const scalar_t ident, const F& f, const SF& sf); // Returns a detailed string describing parallelization settings TORCH_API std::string get_parallel_info(); // Sets number of threads used for inter-op parallelism TORCH_API void set_num_interop_threads(int); // Returns the number of threads used for inter-op parallelism TORCH_API int get_num_interop_threads(); // Launches inter-op parallel task TORCH_API void launch(std::function func); namespace internal { void launch_no_thread_state(std::function fn); } // namespace internal // Launches intra-op parallel task TORCH_API void intraop_launch(std::function func); // Launches intra-op parallel task, returns a future TORCH_API c10::intrusive_ptr intraop_launch_future( std::function func); // Returns number of intra-op threads used by default TORCH_API int intraop_default_num_threads(); } // namespace at #if AT_PARALLEL_OPENMP #include #elif AT_PARALLEL_NATIVE #include #elif AT_PARALLEL_NATIVE_TBB #include #endif