Skip to content

Commit 46bc2d3

Browse files
committed
updated sanitizer
1 parent eb18c50 commit 46bc2d3

6 files changed

Lines changed: 55 additions & 2 deletions

File tree

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ list(APPEND TF_EXAMPLES
2020
limited_concurrency
2121
cancel
2222
cancel_async
23+
sanitizer
2324
)
2425

2526
foreach(example IN LISTS TF_EXAMPLES)

examples/sanitizer.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <taskflow/taskflow.hpp>
2+
#include <taskflow/sanitizer/sanitizer.hpp>
3+
4+
int main() {
5+
6+
tf::Taskflow taskflow;
7+
8+
// create tasks in taskflow ...
9+
10+
tf::Sanitizer sanitizer;
11+
12+
sanitizer.check_nonreachable(taskflow, std::cout);
13+
14+
15+
return 0;
16+
}

taskflow/core/declarations.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class syclGraph;
4343
class syclTask;
4444
class syclFlow;
4545

46+
// clas
47+
class Sanitizer;
48+
4649

4750
} // end of namespace tf -----------------------------------------------------
4851

taskflow/core/graph.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Graph {
3535
friend class Node;
3636
friend class Taskflow;
3737
friend class Executor;
38+
friend class Sanitizer;
3839

3940
public:
4041

@@ -77,6 +78,7 @@ class Node {
7778
friend class Executor;
7879
friend class FlowBuilder;
7980
friend class Subflow;
81+
friend class Sanitizer;
8082

8183
TF_ENABLE_POOLABLE_ON_THIS;
8284

taskflow/cuda/cuda_capturer.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ That is, the callable that describes a %cudaFlowCapturer
4949
will be executed sequentially.
5050
Inside a %cudaFlow capturer task, different GPU tasks (tf::cudaTask) may run
5151
in parallel depending on the selected optimization algorithm.
52-
By default, we use tf::cudaSequentialCapturing to generate a sequential
53-
CUDA graph.
52+
By default, we use tf::cudaRoundRobinCapturing to transform a user-level
53+
graph into a native CUDA graph.
5454
5555
Please refer to @ref GPUTaskingcudaFlowCapturer for details.
5656
*/
@@ -125,6 +125,11 @@ class cudaFlowCapturer {
125125
a user-described %cudaFlow:
126126
+ tf::cudaSequentialCapturing
127127
+ tf::cudaRoundRobinCapturing
128+
+ tf::cudaLinearCapturing
129+
130+
By default, tf::cudaFlowCapturer uses the round-robin optimization
131+
algorithm with four streams to transform a user-level graph into
132+
a native CUDA graph.
128133
*/
129134
template <typename OPT, typename... ArgsT>
130135
OPT& make_optimizer(ArgsT&&... args);
@@ -1126,6 +1131,7 @@ inline cudaTask cudaFlowCapturer::memcpy(
11261131
});
11271132
}
11281133

1134+
// Function: copy
11291135
template <typename T, std::enable_if_t<!std::is_same_v<T, void>, void>*>
11301136
cudaTask cudaFlowCapturer::copy(T* tgt, const T* src, size_t num) {
11311137
return on([tgt, src, num] (cudaStream_t stream) mutable {

taskflow/sanitizer/sanitizer.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
3+
#include "../core/taskflow.hpp"
4+
5+
namespace tf {
6+
7+
class Sanitizer {
8+
9+
10+
public:
11+
12+
bool check_nonreachable(const Taskflow& taskflow, std::ostream& os) {
13+
14+
os << "hello I am checking your taskflow with nonreachable tasks\n";
15+
16+
// TODO (McKay): design the graph data structure extracted from taskflow
17+
// understand tf::Taskflow::dump
18+
19+
return false;
20+
}
21+
22+
};
23+
24+
25+
} // end of namespace tf

0 commit comments

Comments
 (0)