Skip to content

Commit d37532d

Browse files
authored
updating pytaskr as suggested (#14)
* updating pytaskr as suggested * style fixing
1 parent feb1945 commit d37532d

File tree

34 files changed

+167
-157
lines changed

34 files changed

+167
-157
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242

4343
- name: Build Pybind11
4444
run: |
45+
/usr/bin/python3 -m pip install --upgrade pip pytest
46+
4547
cd extern/pybind11
4648
mkdir -p build
4749
cd build
@@ -60,8 +62,6 @@ jobs:
6062
EOF
6163
6264
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)/mock_install/share/pkgconfig" >> $GITHUB_ENV
63-
64-
export LD_PRELOAD=/usr/local/lib/libnosv.so
6565
6666
- name: Setup
6767
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
@@ -71,6 +71,8 @@ jobs:
7171

7272
- name: Running tests and creating coverage report
7373
shell: bash
74+
env:
75+
LD_PRELOAD: /usr/local/lib/libnosv.so
7476
run: |
7577
echo "Running Tests..."
7678
source /home/hicr/.bashrc

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ jobs:
272272

273273
- name: Build Pybind11
274274
run: |
275+
/usr/bin/python3 -m pip install --upgrade pip pytest
276+
275277
cd extern/pybind11
276278
mkdir -p build
277279
cd build
@@ -290,8 +292,6 @@ jobs:
290292
EOF
291293
292294
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)/mock_install/share/pkgconfig" >> $GITHUB_ENV
293-
294-
export LD_PRELOAD=/usr/local/lib/libnosv.so
295295
296296
- name: Setup
297297
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
@@ -301,6 +301,8 @@ jobs:
301301

302302
- name: Running tests and creating coverage report
303303
shell: bash
304+
env:
305+
LD_PRELOAD: /usr/local/lib/libnosv.so
304306
run: |
305307
echo "Running Tests..."
306308
source /home/hicr/.bashrc

examples/abcTasks/python/abcTasks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
ITERATIONS = 100
55

66
def abcTasks(runtime):
7-
# TODO: Setting onTaskFinish callback to free up task memory when it finishes (not sure if we will have this)
8-
# runtime.setTaskCallbackHandler(HiCR::tasking::Task::callback_t::onTaskFinish, [&taskr](taskr::Task *task) { delete task; })
9-
# runtime.setTaskCallbackHandler(taskr.onTaskFinish, lambda task : del task)
107

118
# Create the taskr Tasks
129
taskAfc = taskr.Function(lambda task : print(f"Task A {task.getLabel()}"))
@@ -47,7 +44,7 @@ def abcTasks(runtime):
4744
runtime.run()
4845

4946
# Waiting current repetition to end
50-
runtime.await_()
47+
runtime.wait()
5148

5249
# Finalizing taskr
5350
runtime.finalize()

examples/abcTasks/python/main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
def main():
55

66
# Initialize taskr with the wanted compute manager backend and number of PUs
7-
t = taskr.taskr(taskr.HiCRBackend.threading, 2)
8-
9-
# Get the runtime
10-
runtime = t.get_runtime()
7+
t = taskr.create(backend="threading", num_workers=2)
118

129
# Running simple example
13-
abcTasks.abcTasks(runtime)
10+
abcTasks.abcTasks(t)
1411

1512
if __name__ == "__main__":
1613
main()

examples/conditionVariable/python/conditionVariableWait.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def fc(task):
6868
runtime.run()
6969

7070
# Waiting for task to finish
71-
runtime.await_()
71+
runtime.wait()
7272

7373
# Finalizing taskr
7474
runtime.finalize()

examples/conditionVariable/python/conditionVariableWaitCondition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def fc(task):
8484
runtime.run()
8585

8686
# Waiting for task to finish
87-
runtime.await_()
87+
runtime.wait()
8888

8989
# Finalizing taskr
9090
runtime.finalize()

examples/conditionVariable/python/conditionVariableWaitFor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def fc(task):
9797
runtime.run()
9898

9999
# Waiting for task to finish
100-
runtime.await_()
100+
runtime.wait()
101101

102102
# Finalizing taskr
103103
runtime.finalize()

examples/conditionVariable/python/conditionVariableWaitForCondition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def fc(task):
130130
runtime.run()
131131

132132
# Waiting for task to finish
133-
runtime.await_()
133+
runtime.wait()
134134

135135
# Finalizing taskr
136136
runtime.finalize()

examples/conditionVariable/python/main.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@
2626
def main():
2727

2828
# Initialize taskr with the wanted compute manager backend and number of PUs
29-
t = taskr.taskr()
29+
t = taskr.create()
3030

31-
# Get the runtime
32-
runtime = t.get_runtime()
33-
34-
runtime.setTaskCallbackHandler(taskr.TaskCallback.onTaskSuspend, lambda task : runtime.resumeTask(task))
31+
t.setTaskCallbackHandler(taskr.TaskCallback.onTaskSuspend, lambda task : t.resumeTask(task))
3532

3633
# Get the enviromnent variable for which function to call
3734
test_function_name = os.getenv('__TEST_FUNCTION_')
@@ -40,11 +37,11 @@ def main():
4037
test_function = globals()[test_function_name]
4138

4239
# Call the function
43-
test_function(runtime)
40+
test_function(t)
4441

4542
# Overwrite the onTaskSuspend fc to be None such that runtime no longer has
46-
# a dependency to the previous fc and runtime can call the destructor
47-
runtime.setTaskCallbackHandler(taskr.TaskCallback.onTaskSuspend, None)
43+
# a dependency to the previous fc and can call the destructor
44+
t.setTaskCallbackHandler(taskr.TaskCallback.onTaskSuspend, None)
4845

4946

5047
if __name__ == "__main__":

examples/energySaver/python/energySaver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def energySaver(runtime, workTaskCount, secondsDelay, iterations):
8181
# Running taskr
8282
print("Starting (open 'htop' in another console to see the workers going to sleep during the long task)...\n")
8383
runtime.run()
84-
runtime.await_()
84+
runtime.wait()
8585
print("Finished.\n")
8686

8787
# Finalizing taskr

0 commit comments

Comments
 (0)