Skip to content

Commit ae5a35e

Browse files
committed
meson updated the yml codes
1 parent d37d75c commit ae5a35e

8 files changed

Lines changed: 35 additions & 16 deletions

File tree

.github/workflows/master-test-workflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
EOF
6161
6262
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)/mock_install/share/pkgconfig" >> $GITHUB_ENV
63+
64+
export LD_PRELOAD=/usr/local/lib/libnosv.so
6365
6466
- name: Setup
6567
run: source /home/hicr/.bashrc && meson setup build -Dbuildtype=debug -Db_coverage=true -DdistributedEngine=mpi -DbuildTests=true -DbuildExamples=true -DcompileWarningsAsErrors=true -DexecutionStateType=nosv,boost -DprocessingUnitType=nosv,pthreads -DbuildPyTaskR=true

.github/workflows/pr-development-workflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ jobs:
290290
EOF
291291
292292
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)/mock_install/share/pkgconfig" >> $GITHUB_ENV
293+
294+
export LD_PRELOAD=/usr/local/lib/libnosv.so
293295
294296
- name: Setup
295297
run: source /home/hicr/.bashrc && meson setup build -Dbuildtype=debug -Db_coverage=true -DdistributedEngine=mpi -DbuildTests=true -DbuildExamples=true -DcompileWarningsAsErrors=true -DexecutionStateType=nosv,boost -DprocessingUnitType=nosv,pthreads -DbuildPyTaskR=true

examples/matmul/python/matmul.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@
1919

2020
#include <taskr/taskr.hpp>
2121

22+
#ifdef ENABLE_INSTRUMENTATION
23+
#include <tracr.hpp>
24+
#endif
25+
2226
#define mytype float
2327

2428
/**
2529
* Compute mmm
2630
*/
2731
void matmul(taskr::Task *)
2832
{
29-
const size_t N = 1000;
33+
#ifdef ENABLE_INSTRUMENTATION
34+
INSTRUMENTATION_VMARKER_SET(MARK_COLOR_RED);
35+
#endif
36+
37+
const size_t N = 200;
3038

3139
// Allocate memory
3240
volatile mytype *A = (mytype *)calloc(1, N * N * sizeof(mytype));
@@ -56,6 +64,10 @@ void matmul(taskr::Task *)
5664
free((mytype *)A);
5765
free((mytype *)B);
5866
free((mytype *)C);
67+
68+
#ifdef ENABLE_INSTRUMENTATION
69+
INSTRUMENTATION_VMARKER_RESET();
70+
#endif
5971
}
6072

6173
PYBIND11_MODULE(cpp_matmul, m)

examples/matmul/python/matmul.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@ def matmul_cpp_Driver(runtime):
4545

4646

4747

48-
49-
5048
def matmul_numpy_Driver(runtime):
5149
# Initializing taskr
5250
runtime.initialize()
5351

5452
def matmul_numpy(task):
5553
N = 1000
56-
A = np.zeros((N,N))
54+
A = np.empty((N,N))
5755
B = np.empty((N,N))
5856
C = np.empty((N,N))
5957

examples/simple/python/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
"""
16-
1716
import taskr
17+
1818
import simple
1919

20+
NWORKERS = 4
21+
2022
def main():
21-
# Initialize taskr with the wanted compute manager backend and number of PUs
22-
t = taskr.taskr(taskr.HiCRBackend.nosv, 2)
23+
# Initialize taskr with the wanted HiCR backend and number of Workers
24+
t = taskr.taskr(backend=taskr.HiCRBackend.nosv, num_workers=NWORKERS)
2325

2426
# Get the runtime
2527
runtime = t.get_runtime()

examples/simple/python/simple.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
"""
16-
1716
import taskr
1817

1918
NTASKS = 2
@@ -22,8 +21,8 @@ def simple(runtime):
2221
# Initializing taskr
2322
runtime.initialize()
2423

24+
# Create tasks
2525
fc = lambda task : print(f"Hello, I am task {task.getLabel()}")
26-
2726
taskfc = taskr.Function(fc)
2827

2928
# Adding to tasks to taskr

include/pytaskr/meson.build

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
# Manually compile like this:
33
# c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3-config --includes) -Iextern/pybind11/include example.cpp -o example$(python3-config --extension-suffix)
44

5-
py = import('python').find_installation(
6-
python_executable: '/usr/bin/python3',
7-
pure: false
8-
)
5+
python_mod = import('python')
6+
7+
py = python_mod.find_installation(pure: false)
8+
9+
if not py.found()
10+
py = python_mod.find_installation('/usr/bin/python3', pure: false)
11+
endif
12+
913
pybind11_dep = dependency('pybind11', required: true)
1014

1115
py.extension_module('taskr',

include/pytaskr/pytaskr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PYBIND11_MODULE(taskr, m)
4848
.def("setServiceWorkerCallbackHandler", &Runtime::setServiceWorkerCallbackHandler)
4949
.def("setTaskWorkerCallbackHandler", &Runtime::setTaskWorkerCallbackHandler)
5050
.def("initialize", &Runtime::initialize)
51-
.def("addTask", &Runtime::addTask, py::keep_alive<1, 2>()) // keep_alive as the task should be alive until runtime's destructor
51+
.def("addTask", &Runtime::addTask, py::keep_alive<1, 2>(), py::arg("task")) // keep_alive as the task should be alive until runtime's destructor
5252
.def("resumeTask", &Runtime::resumeTask)
5353
.def("run", &Runtime::run, py::call_guard<py::gil_scoped_release>())
5454
.def("await_", &Runtime::await, py::call_guard<py::gil_scoped_release>()) // Release GIL is important otherwise non-finished tasks are getting blocked
@@ -57,12 +57,12 @@ PYBIND11_MODULE(taskr, m)
5757
.def("addService", &Runtime::addService);
5858

5959
// TaskR's Function class
60-
py::class_<Function>(m, "Function").def(py::init<const function_t>());
60+
py::class_<Function>(m, "Function").def(py::init<const function_t>(), py::arg("fc"));
6161

6262
// TaskR's Task class
6363
py::class_<Task>(m, "Task")
6464
.def(py::init<Function *, const workerId_t>(), py::arg("fc"), py::arg("workerAffinity") = -1)
65-
.def(py::init<const label_t, Function *, const workerId_t>(), py::arg("label"), py::arg("fc"), py::arg("workerAffinity") = -1)
65+
.def(py::init<const label_t, Function *, const workerId_t>(), py::arg("label"), py::arg("taskfc"), py::arg("workerAffinity") = -1)
6666
.def("getLabel", &Task::getLabel)
6767
.def("setLabel", &Task::setLabel)
6868
.def("getWorkerAffinity", &Task::getWorkerAffinity)

0 commit comments

Comments
 (0)