-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ install | |
.vscode/ | ||
.idea/ | ||
/tags | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_executable(pretty_printables pretty_printables.cc) | ||
add_celerity_to_target(TARGET pretty_printables SOURCES pretty_printables.cc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import subprocess | ||
import sys | ||
|
||
EXPECTED = b'''// tell GDB to break here so we can examine locals | ||
tid = 10 | ||
bid = 11 | ||
nid = 12 | ||
cid = 13 | ||
cgid = 14 | ||
rid = 15 | ||
hoid = 16 | ||
hyid = 17 | ||
trid = 18 | ||
id = [1, 2, 3] | ||
range = [1, 2, 3] | ||
subrange = [1, 2, 3] + [4, 5, 6] | ||
chunk = celerity::chunk<3> = {offset = [1, 2, 3], range = [4, 5, 6], global_size = [7, 8, 9]} | ||
nd_range = celerity::nd_range<3> = {global_range = [2, 4, 6], local_range = [1, 2, 3], offset = [7, 8, 9]} | ||
box = [1, 2, 3] - [4, 5, 6] | ||
region = celerity::detail::region<3> = {[1, 2, 3] - [4, 5, 6], [11, 2, 3] - [14, 5, 6], [21, 2, 3] - [24, 5, 6]} | ||
region_map = celerity::detail::region_map<int> = {extent = [0, 0, 0] - [10, 10, 10], [[0, 0, 0] - [10, 10, 1]] = 0, [[0, 0, 5] - [10, 10, 10]] = 0, [[0, 0, 1] - [10, 1, 5]] = 0, [[0, 5, 1] - [10, 10, 5]] = 0, [[0, 1, 1] - [1, 5, 5]] = 0, [[1, 1, 1] - [2, 2, 2]] = 1337, [[1, 1, 2] - [3, 3, 3]] = 69, [[1, 2, 1] - [3, 3, 2]] = 69, [[2, 1, 1] - [3, 2, 2]] = 69, [[1, 1, 3] - [5, 5, 5]] = 42, [[3, 1, 1] - [5, 3, 3]] = 42, [[1, 3, 1] - [5, 5, 3]] = 42, [[5, 1, 1] - [10, 5, 5]] = 0} | ||
''' | ||
|
||
# invoke as `pretty-print-test.py build/test/debug/pretty_printables` | ||
assert len(sys.argv) == 2 | ||
|
||
out = subprocess.check_output(['gdb', '-batch', sys.argv[1], '-ex', 'r', '-ex', 'i locals']) | ||
if not out.endswith(EXPECTED): | ||
print(f'=== pretty-print test FAILED: expected GDB output to end with\n\n{EXPECTED}\n\n=== but got\n\n{out}\n', file=sys.stderr) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <csignal> | ||
#include <iostream> | ||
#include <string> | ||
|
||
#include <celerity.h> | ||
#include <region_map.h> | ||
|
||
int main() { | ||
celerity::detail::task_id tid = 10; | ||
celerity::detail::buffer_id bid = 11; | ||
celerity::detail::node_id nid = 12; | ||
celerity::detail::command_id cid = 13; | ||
celerity::detail::collective_group_id cgid = 14; | ||
celerity::detail::reduction_id rid = 15; | ||
celerity::detail::host_object_id hoid = 16; | ||
celerity::detail::hydration_id hyid = 17; | ||
celerity::detail::transfer_id trid = 18; | ||
|
||
celerity::id<3> id(1, 2, 3); | ||
celerity::range<3> range(1, 2, 3); | ||
celerity::subrange<3> subrange(celerity::id(1, 2, 3), celerity::range(4, 5, 6)); | ||
celerity::chunk<3> chunk(celerity::id(1, 2, 3), celerity::range(4, 5, 6), celerity::range(7, 8, 9)); | ||
celerity::nd_range<3> nd_range(celerity::range(2, 4, 6), celerity::range(1, 2, 3), celerity::id(7, 8, 9)); | ||
celerity::detail::box<3> box(celerity::id(1, 2, 3), celerity::id(4, 5, 6)); | ||
celerity::detail::region<3> region({ | ||
celerity::detail::box(celerity::id(1, 2, 3), celerity::id(4, 5, 6)), | ||
celerity::detail::box(celerity::id(11, 2, 3), celerity::id(14, 5, 6)), | ||
celerity::detail::box(celerity::id(21, 2, 3), celerity::id(24, 5, 6)), | ||
}); | ||
|
||
celerity::detail::region_map<int> region_map(celerity::range<3>(10, 10, 10), 3); | ||
region_map.update_region(celerity::detail::box<3>({1, 1, 1}, {5, 5, 5}), 42); | ||
region_map.update_region(celerity::detail::box<3>({1, 1, 1}, {3, 3, 3}), 69); | ||
region_map.update_region(celerity::detail::box<3>({1, 1, 1}, {2, 2, 2}), 1337); | ||
|
||
__builtin_trap(); // tell GDB to break here so we can examine locals | ||
} |