Move intraop_launch_future from Parallel.h (#64166)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64166

Test Plan: Imported from OSS

Reviewed By: gchanan

Differential Revision: D30728585

Pulled By: dagitses

fbshipit-source-id: 75a41418ae9218bec9bac27597051295222b6eee
This commit is contained in:
Peter Bell
2021-10-08 09:04:21 -07:00
committed by Facebook GitHub Bot
parent 2d885ab73d
commit 0cad2c0615
10 changed files with 24 additions and 5 deletions

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <c10/util/Exception.h>
#include <c10/util/SmallVector.h> #include <c10/util/SmallVector.h>
namespace at { namespace at {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <ATen/Config.h> #include <ATen/Config.h>
#include <ATen/core/ivalue.h>
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <functional>
namespace at { namespace at {
@ -144,10 +144,6 @@ void launch_no_thread_state(std::function<void()> fn);
// Launches intra-op parallel task // Launches intra-op parallel task
TORCH_API void intraop_launch(std::function<void()> func); TORCH_API void intraop_launch(std::function<void()> func);
// Launches intra-op parallel task, returns a future
TORCH_API c10::intrusive_ptr<c10::ivalue::Future> intraop_launch_future(
std::function<void()> func);
// Returns number of intra-op threads used by default // Returns number of intra-op threads used by default
TORCH_API int intraop_default_num_threads(); TORCH_API int intraop_default_num_threads();

View File

@ -0,0 +1,13 @@
#pragma once
#include <ATen/core/ivalue.h>
#include <c10/macros/Macros.h>
#include <functional>
namespace at {
// Launches intra-op parallel task, returns a future
TORCH_API c10::intrusive_ptr<c10::ivalue::Future> intraop_launch_future(
std::function<void()> func);
} // namespace at

View File

@ -1,6 +1,7 @@
#include <ATen/Config.h> #include <ATen/Config.h>
#if AT_PARALLEL_NATIVE #if AT_PARALLEL_NATIVE
#include <ATen/Parallel.h> #include <ATen/Parallel.h>
#include <ATen/ParallelFuture.h>
#include <ATen/PTThreadPool.h> #include <ATen/PTThreadPool.h>
#ifndef C10_MOBILE #ifndef C10_MOBILE

View File

@ -4,6 +4,8 @@
#include <cstddef> #include <cstddef>
#include <exception> #include <exception>
#include <c10/util/Exception.h>
#define INTRA_OP_PARALLEL #define INTRA_OP_PARALLEL
namespace at { namespace at {

View File

@ -1,6 +1,7 @@
#include <ATen/Config.h> #include <ATen/Config.h>
#if AT_PARALLEL_NATIVE_TBB #if AT_PARALLEL_NATIVE_TBB
#include <ATen/Parallel.h> #include <ATen/Parallel.h>
#include <ATen/ParallelFuture.h>
#include <ATen/PTThreadPool.h> #include <ATen/PTThreadPool.h>
#include <atomic> #include <atomic>

View File

@ -4,6 +4,8 @@
#include <cstddef> #include <cstddef>
#include <exception> #include <exception>
#include <c10/util/Exception.h>
#ifdef _WIN32 #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN

View File

@ -2,6 +2,7 @@
#include <ATen/core/jit_type.h> #include <ATen/core/jit_type.h>
#if AT_PARALLEL_OPENMP #if AT_PARALLEL_OPENMP
#include <ATen/Parallel.h> #include <ATen/Parallel.h>
#include <ATen/ParallelFuture.h>
#include <atomic> #include <atomic>

View File

@ -3,6 +3,7 @@
#include <ATen/ATen.h> #include <ATen/ATen.h>
#include <ATen/DLConvertor.h> #include <ATen/DLConvertor.h>
#include <ATen/Parallel.h> #include <ATen/Parallel.h>
#include <ATen/ParallelFuture.h>
#include <iostream> #include <iostream>
// NOLINTNEXTLINE(modernize-deprecated-headers) // NOLINTNEXTLINE(modernize-deprecated-headers)

View File

@ -3,6 +3,7 @@
#include "c10/util/Flags.h" #include "c10/util/Flags.h"
#include "caffe2/core/init.h" #include "caffe2/core/init.h"
#include <atomic>
#include <chrono> #include <chrono>
#include <condition_variable> #include <condition_variable>
#include <iostream> #include <iostream>