|
1 | 1 | using System; |
2 | 2 | using System.Runtime.InteropServices; |
| 3 | +using TFE_Executor = System.IntPtr; |
3 | 4 |
|
4 | 5 | namespace Tensorflow |
5 | 6 | { |
@@ -196,5 +197,55 @@ public partial class c_api |
196 | 197 | /// <param name="h">TFE_TensorHandle*</param> |
197 | 198 | [DllImport(TensorFlowLibName)] |
198 | 199 | public static extern void TFE_DeleteTensorHandle(IntPtr h); |
| 200 | + |
| 201 | + /// <summary> |
| 202 | + /// Creates a new eager Executor. Nodes in one executor are guaranteed to be |
| 203 | + /// executed in sequence. Assigning nodes to different executors allows executing |
| 204 | + /// nodes in parallel. |
| 205 | + /// </summary> |
| 206 | + /// <param name="is_async"></param> |
| 207 | + /// <returns>TFE_Executor*</returns> |
| 208 | + [DllImport(TensorFlowLibName)] |
| 209 | + public static extern IntPtr TFE_NewExecutor(bool is_async); |
| 210 | + |
| 211 | + /// <summary> |
| 212 | + /// Deletes the eager Executor without waiting for enqueued nodes. Please call |
| 213 | + /// TFE_ExecutorWaitForAllPendingNodes before calling this API if you want to |
| 214 | + /// make sure all nodes are finished. |
| 215 | + /// </summary> |
| 216 | + /// <param name="e">TFE_Executor*</param> |
| 217 | + [DllImport(TensorFlowLibName)] |
| 218 | + public static extern void TFE_DeleteExecutor(IntPtr executor); |
| 219 | + |
| 220 | + /// <summary> |
| 221 | + /// Causes the calling thread to block till all ops dispatched in this executor |
| 222 | + /// have been executed. Note that "execution" here refers to kernel execution / |
| 223 | + /// scheduling of copies, etc. Similar to sync execution, it doesn't guarantee |
| 224 | + /// that lower level device queues (like GPU streams) have been flushed. |
| 225 | + /// |
| 226 | + /// This call may not block for execution of ops enqueued concurrently with this |
| 227 | + /// call. |
| 228 | + /// </summary> |
| 229 | + /// <param name="executor">TFE_Executor*</param> |
| 230 | + /// <param name="status">TF_Status*</param> |
| 231 | + [DllImport(TensorFlowLibName)] |
| 232 | + public static extern void TFE_ExecutorWaitForAllPendingNodes(TFE_Executor executor, IntPtr status); |
| 233 | + |
| 234 | + /// <summary> |
| 235 | + /// Sets a custom Executor for current thread. All nodes created by this thread |
| 236 | + /// will be added to this Executor. It will override current executor. |
| 237 | + /// </summary> |
| 238 | + /// <param name="ctx"></param> |
| 239 | + /// <param name="executor"></param> |
| 240 | + [DllImport(TensorFlowLibName)] |
| 241 | + public static extern void TFE_ContextSetExecutorForThread(IntPtr ctx, TFE_Executor executor); |
| 242 | + |
| 243 | + /// <summary> |
| 244 | + /// Returns the Executor for current thread. |
| 245 | + /// </summary> |
| 246 | + /// <param name="ctx"></param> |
| 247 | + /// <returns>TFE_Executor*</returns> |
| 248 | + [DllImport(TensorFlowLibName)] |
| 249 | + public static extern TFE_Executor TFE_ContextGetExecutorForThread(IntPtr ctx); |
199 | 250 | } |
200 | 251 | } |
0 commit comments