Skip to content

Commit 0ca68d5

Browse files
committed
feat: uplaod new results and benchmarks
1 parent 950dcd2 commit 0ca68d5

15 files changed

+1757
-177
lines changed

include/py_ff_node.hpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <ff/ff.hpp>
66
#include <iostream>
77
#include "error_macros.hpp"
8+
#include "py_ff_constant.hpp"
89

910
class py_ff_node: public ff::ff_node {
1011
public:
@@ -58,23 +59,18 @@ class py_ff_node: public ff::ff_node {
5859
// Release the main GIL
5960
PyEval_SaveThread();
6061

62+
// if we have a FastFlow's constant, return it
63+
if (PyObject_TypeCheck(py_result, &py_ff_constant_type) != 0) {
64+
py_ff_constant_object* _const_result = reinterpret_cast<py_ff_constant_object*>(py_result);
65+
return _const_result->ff_const;
66+
}
67+
68+
// map None to GO_ON
6169
if (py_result == Py_None) {
62-
return NULL;
70+
return ff::FF_GO_ON;
6371
}
64-
return (void*) py_result;
65-
}
6672

67-
void cleanup() {
68-
// Cleanup of objects created
69-
Py_DECREF(svc_func);
70-
Py_DECREF(node);
71-
svc_func = nullptr;
72-
node = nullptr;
73-
PyEval_SaveThread();
74-
/*// cleanup thread state with main interpreter
75-
PyThreadState_Clear(tstate);
76-
PyThreadState_Delete(tstate);*/
77-
tstate = nullptr;
73+
return (void*) py_result;
7874
}
7975

8076
void svc_end() override {
@@ -91,7 +87,16 @@ class py_ff_node: public ff::ff_node {
9187
}
9288
}
9389

94-
cleanup();
90+
// Cleanup of objects created
91+
Py_DECREF(svc_func);
92+
Py_DECREF(node);
93+
svc_func = nullptr;
94+
node = nullptr;
95+
PyEval_SaveThread();
96+
/*// cleanup thread state with main interpreter
97+
PyThreadState_Clear(tstate);
98+
PyThreadState_Delete(tstate);*/
99+
tstate = nullptr;
95100
}
96101

97102
private:

res.txt

Lines changed: 224 additions & 0 deletions
Large diffs are not rendered by default.

thesis/benchbytes.ipynb

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

thesis/farm/plot_512_1ms_new.ipynb

Lines changed: 377 additions & 150 deletions
Large diffs are not rendered by default.
428 KB
Loading

thesis/nomapping.png

399 KB
Loading

thesis/nomapping_blockingmode.ipynb

Lines changed: 511 additions & 0 deletions
Large diffs are not rendered by default.

thesis/sequential.ipynb

Lines changed: 100 additions & 0 deletions
Large diffs are not rendered by default.

thesis/sequential.png

224 KB
Loading

thesis/sequential.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import argparse
2+
from concurrent.futures import ThreadPoolExecutor, wait
3+
import threading
4+
import time
5+
import busy_wait
6+
7+
def task():
8+
busy_wait.wait(100)
9+
10+
if __name__ == "__main__":
11+
parser = argparse.ArgumentParser(description='Process some tasks.')
12+
parser.add_argument('--workers', type=int, help='Number of worker threads to use', required=True)
13+
args = parser.parse_args()
14+
start = time.clock_gettime_ns(time.CLOCK_MONOTONIC)
15+
16+
with ThreadPoolExecutor(max_workers=args.workers) as exe:
17+
# issue tasks to the thread pool
18+
futures = [exe.submit(task) for _ in range(64) ]
19+
wait(futures)
20+
21+
end = time.clock_gettime_ns(time.CLOCK_MONOTONIC)
22+
print(args.workers, ((end - start)/1000))

0 commit comments

Comments
 (0)