Commit f57e2494 authored by Andrey Valitov's avatar Andrey Valitov
Browse files

Added new test for network. Fixed MEASURE ouput info

parent 3b617995
This diff is collapsed.
{"paths": {"0": "./test.fa"}, "text": []}
\ No newline at end of file
{
"0": {
"pos": 76,
"comment": "initial launcher: sub main()"
},
"1": {
"pos": 76,
"comment": "sub main"
},
"2": {
"pos": 104,
"comment": "entry (migrate) cf a: init(777, x);"
},
"3": {
"pos": 148,
"comment": "entry (migrate) for i=1..50;"
},
"4": {
"pos": 164,
"comment": "entry (migrate) cf _l15: work(x, i);"
},
"5": {
"pos": 164,
"comment": "request x"
},
"6": {
"pos": 164,
"comment": "execute cf _l15: work(x, i);"
}
}
\ No newline at end of file
{"paths": {"0": "#include \"ucenv.h\"\n\n"}, "text": [[0, null, 0, "#"], [0, null, 1, "i"], [0, null, 2, "n"], [0, null, 3, "c"], [0, null, 4, "l"], [0, null, 5, "u"], [0, null, 6, "d"], [0, null, 7, "e"], [0, null, 8, " "], [0, null, 9, "\""], [0, null, 10, "u"], [0, null, 11, "c"], [0, null, 12, "e"], [0, null, 13, "n"], [0, null, 14, "v"], [0, null, 15, "."], [0, null, 16, "h"], [0, null, 17, "\""], [0, null, 18, "\n"], [0, null, 19, "\n"]]}
\ No newline at end of file
import c_init(int, name) as init;
import c_do_working(int, int) as work;
sub main()
{
df x;
cf a: init(777, x) @ {
locator_cyclic: 0;
};
for i=1..50 {
work(x, i) @ {
locator_cyclic: i;
};
}
}
{"paths": {"0": "./test.fa"}, "text": [[0, 2, 2, "\n"], [0, 3, 0, "\n"], [0, 4, 0, "i"], [0, 4, 1, "m"], [0, 4, 2, "p"], [0, 4, 3, "o"], [0, 4, 4, "r"], [0, 4, 5, "t"], [0, 4, 6, " "], [0, 4, 7, "c"], [0, 4, 8, "_"], [0, 4, 9, "i"], [0, 4, 10, "n"], [0, 4, 11, "i"], [0, 4, 12, "t"], [0, 4, 13, "("], [0, 4, 14, "i"], [0, 4, 15, "n"], [0, 4, 16, "t"], [0, 4, 17, ","], [0, 4, 18, " "], [0, 4, 19, "n"], [0, 4, 20, "a"], [0, 4, 21, "m"], [0, 4, 22, "e"], [0, 4, 23, ")"], [0, 4, 24, " "], [0, 4, 25, "a"], [0, 4, 26, "s"], [0, 4, 27, " "], [0, 4, 28, "i"], [0, 4, 29, "n"], [0, 4, 30, "i"], [0, 4, 31, "t"], [0, 4, 32, ";"], [0, 4, 33, "\n"], [0, 5, 0, "i"], [0, 5, 1, "m"], [0, 5, 2, "p"], [0, 5, 3, "o"], [0, 5, 4, "r"], [0, 5, 5, "t"], [0, 5, 6, " "], [0, 5, 7, "c"], [0, 5, 8, "_"], [0, 5, 9, "d"], [0, 5, 10, "o"], [0, 5, 11, "_"], [0, 5, 12, "w"], [0, 5, 13, "o"], [0, 5, 14, "r"], [0, 5, 15, "k"], [0, 5, 16, "i"], [0, 5, 17, "n"], [0, 5, 18, "g"], [0, 5, 19, "("], [0, 5, 20, "i"], [0, 5, 21, "n"], [0, 5, 22, "t"], [0, 5, 23, ","], [0, 5, 24, " "], [0, 5, 25, "i"], [0, 5, 26, "n"], [0, 5, 27, "t"], [0, 5, 28, ")"], [0, 5, 29, " "], [0, 5, 30, "a"], [0, 5, 31, "s"], [0, 5, 32, " "], [0, 5, 33, "w"], [0, 5, 34, "o"], [0, 5, 35, "r"], [0, 5, 36, "k"], [0, 5, 37, ";"], [0, 5, 38, "\n"], [0, 6, 0, "\n"], [0, 7, 0, "s"], [0, 7, 1, "u"], [0, 7, 2, "b"], [0, 7, 3, " "], [0, 7, 4, "m"], [0, 7, 5, "a"], [0, 7, 6, "i"], [0, 7, 7, "n"], [0, 7, 8, "("], [0, 7, 9, ")"], [0, 7, 10, "\n"], [0, 8, 0, "{"], [0, 8, 1, "\n"], [0, 9, 0, "\t"], [0, 9, 1, "d"], [0, 9, 2, "f"], [0, 9, 3, " "], [0, 9, 4, "x"], [0, 9, 5, ";"], [0, 9, 6, "\n"], [0, 10, 0, "\n"], [0, 11, 0, "\t"], [0, 11, 1, "c"], [0, 11, 2, "f"], [0, 11, 3, " "], [0, 11, 4, "a"], [0, 11, 5, ":"], [0, 11, 6, " "], [0, 11, 7, "i"], [0, 11, 8, "n"], [0, 11, 9, "i"], [0, 11, 10, "t"], [0, 11, 11, "("], [0, 11, 12, "7"], [0, 11, 13, "7"], [0, 11, 14, "7"], [0, 11, 15, ","], [0, 11, 16, " "], [0, 11, 17, "x"], [0, 11, 18, ")"], [0, 11, 19, " "], [0, 11, 20, "@"], [0, 11, 21, " "], [0, 11, 22, "{"], [0, 11, 23, "\n"], [0, 12, 0, "\t"], [0, 12, 1, "\t"], [0, 12, 2, "l"], [0, 12, 3, "o"], [0, 12, 4, "c"], [0, 12, 5, "a"], [0, 12, 6, "t"], [0, 12, 7, "o"], [0, 12, 8, "r"], [0, 12, 9, "_"], [0, 12, 10, "c"], [0, 12, 11, "y"], [0, 12, 12, "c"], [0, 12, 13, "l"], [0, 12, 14, "i"], [0, 12, 15, "c"], [0, 12, 16, ":"], [0, 12, 17, " "], [0, 12, 18, "0"], [0, 12, 19, ";"], [0, 12, 20, "\n"], [0, 13, 0, "\t"], [0, 13, 1, "}"], [0, 13, 2, ";"], [0, 13, 3, "\n"], [0, 14, 0, "\n"], [0, 15, 0, "\t"], [0, 15, 1, "f"], [0, 15, 2, "o"], [0, 15, 3, "r"], [0, 15, 4, " "], [0, 15, 5, "i"], [0, 15, 6, "="], [0, 15, 7, "1"], [0, 15, 8, "."], [0, 15, 9, "."], [0, 15, 10, "5"], [0, 15, 11, "0"], [0, 15, 12, " "], [0, 15, 13, "{"], [0, 15, 14, "\n"], [0, 16, 0, "\t"], [0, 16, 1, "\t"], [0, 16, 2, "w"], [0, 16, 3, "o"], [0, 16, 4, "r"], [0, 16, 5, "k"], [0, 16, 6, "("], [0, 16, 7, "x"], [0, 16, 8, ","], [0, 16, 9, " "], [0, 16, 10, "i"], [0, 16, 11, ")"], [0, 16, 12, " "], [0, 16, 13, "@"], [0, 16, 14, " "], [0, 16, 15, "{"], [0, 16, 16, "\n"], [0, 17, 0, "\t"], [0, 17, 1, "\t"], [0, 17, 2, "\t"], [0, 17, 3, "l"], [0, 17, 4, "o"], [0, 17, 5, "c"], [0, 17, 6, "a"], [0, 17, 7, "t"], [0, 17, 8, "o"], [0, 17, 9, "r"], [0, 17, 10, "_"], [0, 17, 11, "c"], [0, 17, 12, "y"], [0, 17, 13, "c"], [0, 17, 14, "l"], [0, 17, 15, "i"], [0, 17, 16, "c"], [0, 17, 17, ":"], [0, 17, 18, " "], [0, 17, 19, "i"], [0, 17, 20, ";"], [0, 17, 21, "\n"], [0, 18, 0, "\t"], [0, 18, 1, "\t"], [0, 18, 2, "}"], [0, 18, 3, ";"], [0, 18, 4, "\n"], [0, 19, 0, "\t"], [0, 19, 1, "}"], [0, 19, 2, "\n"], [0, 20, 0, "\n"], [0, 21, 0, "}"], [0, 21, 1, "\n"], [0, 22, 0, "\n"]]}
\ No newline at end of file
{
"init": {
"type": "extern",
"code": "c_init",
"args": [
{
"type": "int"
},
{
"type": "name"
}
],
"cuda_support": "false",
"nocpu": "false"
},
"work": {
"type": "extern",
"code": "c_do_working",
"args": [
{
"type": "int"
},
{
"type": "int"
}
],
"cuda_support": "false",
"nocpu": "false"
},
"main": {
"type": "struct",
"where": {
"type": "luna"
},
"args": [],
"body": [
{
"type": "dfs",
"names": [
"x"
]
},
{
"type": "exec",
"id": [
"a"
],
"code": "init",
"args": [
{
"is_expr": true,
"type": "iconst",
"value": 777
},
{
"is_expr": true,
"type": "id",
"ref": [
"x"
],
"begin": 114
}
],
"rules": [
{
"ruletype": "expr",
"begin": 123,
"type": "rule",
"property": "locator_cyclic",
"expr": {
"is_expr": true,
"type": "iconst",
"value": 0
}
}
],
"begin": 104
},
{
"type": "for",
"var": "i",
"first": {
"is_expr": true,
"type": "iconst",
"value": 1
},
"last": {
"is_expr": true,
"type": "iconst",
"value": 50
},
"where": {
"type": "luna"
},
"begin": 148,
"body_begin": 160,
"body": [
{
"type": "dfs",
"names": []
},
{
"type": "exec",
"id": [
"_l15"
],
"code": "work",
"args": [
{
"is_expr": true,
"type": "id",
"ref": [
"x"
],
"begin": 169
},
{
"is_expr": true,
"type": "id",
"ref": [
"i"
],
"begin": 172
}
],
"rules": [
{
"ruletype": "expr",
"begin": 182,
"type": "rule",
"property": "locator_cyclic",
"expr": {
"is_expr": true,
"type": "id",
"ref": [
"i"
],
"begin": 198
}
}
],
"begin": 164
}
]
}
],
"begin": 76,
"end": 211
}
}
\ No newline at end of file
{"init": {"type": "extern", "code": "c_init", "args": [{"type": "int"}, {"type": "name"}], "cuda_support": "false", "nocpu": "false"}, "work": {"type": "extern", "code": "c_do_working", "args": [{"type": "int"}, {"type": "int"}], "cuda_support": "false", "nocpu": "false"}, "main": {"type": "struct", "where": {"type": "luna"}, "args": [], "body": [{"type": "dfs", "names": ["x"]}, {"type": "exec", "id": ["a"], "code": "init", "args": [{"is_expr": true, "type": "iconst", "value": 777}, {"is_expr": true, "type": "id", "ref": ["x"], "begin": 114}], "rules": [{"ruletype": "expr", "begin": 123, "type": "rule", "property": "locator_cyclic", "expr": {"is_expr": true, "type": "iconst", "value": 0}}], "begin": 104}, {"type": "for", "var": "i", "first": {"is_expr": true, "type": "iconst", "value": 1}, "last": {"is_expr": true, "type": "iconst", "value": 50}, "where": {"type": "luna"}, "begin": 148, "body_begin": 160, "body": [{"type": "dfs", "names": []}, {"type": "exec", "id": ["_l15"], "code": "work", "args": [{"is_expr": true, "type": "id", "ref": ["x"], "begin": 169}, {"is_expr": true, "type": "id", "ref": ["i"], "begin": 172}], "rules": [{"ruletype": "expr", "begin": 182, "type": "rule", "property": "locator_cyclic", "expr": {"is_expr": true, "type": "id", "ref": ["i"], "begin": 198}}], "begin": 164}]}], "begin": 76, "end": 211}}
\ No newline at end of file
{
"init": {
"args": [
{
"type": "int"
},
{
"type": "name"
}
],
"code": "c_init",
"cuda_support": "false",
"nocpu": "false",
"type": "extern"
},
"main": {
"args": [],
"begin": 76,
"body": [
{
"names": [
"x"
],
"type": "dfs"
},
{
"args": [
{
"is_expr": true,
"type": "iconst",
"value": 777
},
{
"begin": 114,
"is_expr": true,
"ref": [
"x"
],
"type": "id"
}
],
"begin": 104,
"code": "init",
"id": [
"a"
],
"rules": [
{
"begin": 123,
"expr": {
"is_expr": true,
"type": "iconst",
"value": 0
},
"property": "locator_cyclic",
"ruletype": "expr",
"type": "rule"
},
{
"begin": 104,
"items": [
[
"x"
]
],
"property": "req_unlimited",
"ruletype": "enum"
}
],
"type": "exec"
},
{
"begin": 148,
"body": [
{
"names": [],
"type": "dfs"
},
{
"args": [
{
"begin": 169,
"is_expr": true,
"ref": [
"x"
],
"type": "id"
},
{
"begin": 172,
"is_expr": true,
"ref": [
"i"
],
"type": "id"
}
],
"begin": 164,
"code": "work",
"id": [
"_l15"
],
"rules": [
{
"begin": 182,
"expr": {
"begin": 198,
"is_expr": true,
"ref": [
"i"
],
"type": "id"
},
"property": "locator_cyclic",
"ruletype": "expr",
"type": "rule"
},
{
"begin": 164,
"items": [],
"property": "req_unlimited",
"ruletype": "enum"
},
{
"begin": 164,
"items": [
[
"x"
]
],
"property": "request",
"ruletype": "enum"
}
],
"type": "exec"
}
],
"body_begin": 160,
"first": {
"is_expr": true,
"type": "iconst",
"value": 1
},
"last": {
"is_expr": true,
"type": "iconst",
"value": 50
},
"rules": [
{
"begin": 148,
"items": [],
"property": "req_unlimited",
"ruletype": "enum"
}
],
"type": "for",
"var": "i",
"where": {
"type": "luna"
}
}
],
"end": 211,
"type": "struct",
"where": {
"type": "luna"
}
},
"work": {
"args": [
{
"type": "int"
},
{
"type": "int"
}
],
"code": "c_do_working",
"cuda_support": "false",
"nocpu": "false",
"type": "extern"
}
}
\ No newline at end of file
#include "ucenv.h"
extern "C" void c_init(int, OutputDF &); // as init
extern "C" void c_do_working(int, int); // as work
// MAIN
BlockRetStatus block_0(CF &self)
{
self.NextBlock=1;
return CONTINUE;
}
// STRUCT: sub main()
BlockRetStatus block_1(CF &self)
{
Id _id_0=self.create_id(); // x
// GEN BODY: sub main()
{ // FORK_BI: cf a: init(777, x);
CF *child=self.fork(2);
child->id(0)=_id_0;
}
{ // FORK_BI: for i=1..50;
CF *child=self.fork(3);
child->id(0)=_id_0;
}
return EXIT;
}
// BI_EXEC: cf a: init(777, x);
BlockRetStatus block_2(CF &self)
{
if (self.migrate(CyclicLocator(0))) {
return MIGRATE;
}
{
DF _out_0;
// EXEC_EXTERN cf a: init(777, x);
c_init(
// int 777
777,
// name x
_out_0);
{
DF stored=_out_0;
self.store(self.id(0), stored);
}
}
// req_unlimited: x
{ DF posted=self.wait(self.id(0));
self.post(self.id(0), posted, CyclicLocator(0), -1);
}
return EXIT;
}
// BI_FOR: for i = 1 .. 50
BlockRetStatus block_3(CF &self)
{
if (self.migrate(CyclicLocator(0))) {
return MIGRATE;
}
for (int _lc_i=1; _lc_i<=50; _lc_i++) {
// GEN BODY: for i = 1 .. 50
{ // FORK_BI: cf _l15: work(x, i);
CF *child=self.fork(4);
child->arg(0)=_lc_i;
child->id(0)=self.id(0);
}
} // for
return EXIT;
}
// BI_EXEC: cf _l15: work(x, i);
BlockRetStatus block_4(CF &self)
{
if (self.migrate(CyclicLocator(self.arg(0).get_int()))) {
return MIGRATE;
}
// request x
self.request(self.id(0), CyclicLocator(0));
self.NextBlock=5;
return CONTINUE;
}
// Request : cf _l15: work(x, i);
BlockRetStatus block_5(CF &self)
{
// wait x
if (self.wait(self.id(0)).is_unset()) {
return WAIT;
}
self.NextBlock=6;
return CONTINUE;
}
// After requests: cf _l15: work(x, i);
BlockRetStatus block_6(CF &self)
{
{
// EXEC_EXTERN cf _l15: work(x, i);
c_do_working(
// int x
(self.wait(self.id(0))).get_int(),
// int i
self.arg(0).get_int());
}
return EXIT;
}
extern "C" void init_blocks(BlocksAppender add)
{
bool ok=true;
ok = ok && add(block_0)==0;
ok = ok && add(block_1)==1;
ok = ok && add(block_2)==2;
ok = ok && add(block_3)==3;
ok = ok && add(block_4)==4;
ok = ok && add(block_5)==5;
ok = ok && add(block_6)==6;
assert(ok);
}
payload = 0
real = 0
np = 0
with open("output.txt") as f:
lines = f.readlines()
for line in lines[:-2]:
words = line.split(" ")
payload += float(words[len(words) - 2])
sys_stop = lines[len(lines) - 2].split(" ")
real = float(sys_stop[len(sys_stop) - 2])
np_line = lines[len(lines) - 1].split(" ")
np = int(np_line[len(np_line) - 1])
print(f"NP = {np}")
print(f"Payload = {payload} secs")
print(f"Real = {real} secs")
print(f"Delta = {real - payload} secs")
c_do_working | Task 1 | done in 1.098355 secs
c_do_working | Task 2 | done in 1.870953 secs
c_do_working | Task 3 | done in 3.160557 secs
c_do_working | Task 4 | done in 4.170945 secs
c_do_working | Task 5 | done in 5.148258 secs
c_do_working | Task 6 | done in 5.622880 secs
c_do_working | Task 12 | done in 7.254601 secs
c_do_working | Task 7 | done in 7.518490 secs
c_do_working | Task 8 | done in 8.775612 secs
c_do_working | Task 9 | done in 9.618405 secs
c_do_working | Task 10 | done in 10.660419 secs
/*
Initialization of data fragments and data dependencies.
*/
import c_init(int, name) as init;
import c_do_working(int, int) as work;
sub main()
{
df x;
cf a: init(777, x) @ {
locator_cyclic: 0;
};
for i=1..50 {
work(x, i) @ {
locator_cyclic: i;
};
}
}
update:
make -C /home/andrvat/luna/luna
make -C /home/mac
create: update
echo "Build luna program..."