...
 
Commits (94)
This diff is collapsed.
This diff is collapsed.
SIZE 8X8X8
LAYER 1
2,35,35,35,15,19,17,9
7,35,37,37,15,15,17,11
7,35,37,39,0,0,0,11
7,35,37,39,0,0,0,11
0,35,37,39,0,0,0,11
0,35,37,39,0,11,11,11
0,11,11,11,11,11,3,4
1,0,0,0,0,0,3,4
LAYER 2
2,33,31,0,43,19,41,9
25,0,31,0,43,15,17,11
25,0,31,0,43,15,17,13
7,7,7,7,0,15,17,13
27,27,27,7,0,15,17,13
0,0,0,7,0,15,17,13
25,25,0,7,0,17,17,0
1,25,0,7,7,7,3,4
LAYER 3
2,33,0,0,41,19,41,9
41,41,41,41,41,19,0,9
25,0,31,0,0,19,0,9
25,31,31,0,19,19,0,9
27,31,27,27,27,27,27,9
25,31,30,30,30,15,9,9
25,31,30,0,19,9,9,0
1,25,25,19,19,9,3,4
LAYER 4
2,33,0,0,41,41,41,21
0,33,47,23,48,48,0,45
0,33,47,23,0,48,0,45
25,33,47,23,19,48,0,45
25,33,0,23,19,48,0,45
25,33,0,23,19,15,0,45
0,30,30,23,19,15,0,45
1,1,1,21,21,15,4,4
LAYER 5
2,6,16,22,22,0,0,21
46,6,16,22,24,29,29,21
46,16,16,22,24,29,34,21
46,16,47,22,24,0,34,21
46,16,47,22,24,48,34,21
46,22,47,22,24,48,34,21
46,22,47,47,24,48,21,21
22,22,1,0,21,21,21,0
LAYER 6
2,5,10,20,20,26,26,26
6,6,10,20,0,32,32,26
10,10,10,29,29,29,0,26
10,28,28,28,28,28,28,28
10,16,16,16,0,0,0,0
10,22,22,22,0,0,34,0
10,42,42,42,42,42,42,42
10,42,1,1,1,1,1,1
LAYER 7
2,5,8,8,8,8,8,0
6,5,18,20,0,32,8,0
14,18,18,20,0,32,8,26
14,18,20,20,0,32,8,8
14,18,20,16,0,32,0,8
14,18,20,44,0,32,34,8
12,18,20,44,0,32,34,8
10,42,20,44,0,32,34,1
LAYER 8
2,2,2,2,2,2,2,2
6,5,0,12,12,12,12,0
12,12,12,12,40,38,36,0
12,0,0,0,40,38,36,0
12,0,0,16,40,38,36,0
12,0,0,16,40,38,36,0
12,18,0,16,38,38,36,8
10,18,20,16,36,36,36,1
SIZE 72X72X8
LINE_NUM 10
LINE#1 (6,22,8) (32,22,8)
LINE#2 (8,26,8) (29,26,8)
LINE#3 (8,27,8) (8,34,8)
LINE#4 (29,27,8) (29,37,8)
LINE#5 (8,35,8) (28,35,8)
LINE#6 (8,36,8) (8,36,1)
LINE#7 (44,23,8) (44,36,8)
LINE#8 (52,24,8) (52,35,8)
LINE#9 (61,23,8) (61,42,8)
LINE#10 (44,37,8) (44,37,1)
SIZE 72X72X8
LINE_NUM 22
LINE#1 (36,71,8) (36,71,2)
LINE#2 (37,71,5) (38,71,5)
LINE#3 (71,39,7) (71,34,7)
LINE#4 (71,34,6) (71,34,3)
LINE#5 (71,39,2) (71,34,2)
LINE#6 (34,1,7) (34,1,3)
LINE#7 (39,1,7) (35,1,7)
LINE#8 (39,1,6) (39,1,2)
LINE#9 (34,1,2) (38,1,2)
LINE#10 (1,35,7) (1,38,7)
LINE#11 (1,34,5) (1,39,5)
LINE#12 (1,36,4) (1,37,4)
LINE#13 (1,35,3) (1,36,3)
LINE#14 (1,34,2) (1,35,2)
LINE#15 (35,21,1) (12,21,1)
LINE#16 (57,55,1) (11,55,1)
LINE#17 (58,24,1) (58,55,1)
LINE#18 (56,5,7) (56,67,7)
LINE#19 (17,5,3) (17,67,3)
LINE#20 (56,22,8) (17,32,2)
LINE#21 (56,36,8) (17,46,2)
LINE#22 (56,50,8) (17,60,2)
SIZE 8X8X8
LINE_NUM 48
LINE#1 (0,7,1) (7,7,8)
LINE#2 (0,0,1) (7,0,8)
LINE#3 (6,6,1) (6,7,3)
LINE#4 (6,7,4) (7,6,1)
LINE#5 (1,1,8) (1,0,6)
LINE#6 (0,1,8) (1,0,5)
LINE#7 (0,1,1) (5,7,2)
LINE#8 (7,6,8) (2,0,7)
LINE#9 (5,7,3) (7,0,1)
LINE#10 (2,0,6) (0,7,8)
LINE#11 (1,6,1) (7,1,2)
LINE#12 (6,1,8) (0,6,7)
LINE#13 (7,2,2) (7,5,2)
LINE#14 (0,2,7) (0,5,7)
LINE#15 (4,0,1) (5,7,4)
LINE#16 (3,7,8) (2,0,5)
LINE#17 (6,0,1) (5,6,2)
LINE#18 (1,7,8) (2,1,7)
LINE#19 (5,0,1) (3,7,3)
LINE#20 (2,7,8) (4,0,6)
LINE#21 (3,7,4) (7,0,4)
LINE#22 (4,0,5) (0,7,5)
LINE#23 (3,1,4) (3,6,4)
LINE#24 (4,1,5) (4,6,5)
LINE#25 (0,1,2) (2,7,3)
LINE#26 (7,2,7) (5,0,6)
LINE#27 (6,4,3) (0,4,3)
LINE#28 (7,3,6) (1,3,6)
LINE#29 (6,1,5) (3,2,6)
LINE#30 (1,6,4) (4,5,3)
LINE#31 (2,0,2) (1,6,3)
LINE#32 (5,7,7) (6,1,6)
LINE#33 (1,0,2) (1,5,4)
LINE#34 (6,7,7) (6,2,5)
LINE#35 (3,0,1) (1,5,1)
LINE#36 (6,2,8) (4,7,8)
LINE#37 (3,1,1) (2,5,1)
LINE#38 (4,6,8) (5,2,8)
LINE#39 (3,2,1) (3,5,1)
LINE#40 (4,2,8) (4,5,8)
LINE#41 (6,0,2) (0,1,3)
LINE#42 (1,7,7) (7,6,6)
LINE#43 (4,0,2) (4,2,2)
LINE#44 (3,5,7) (3,7,7)
LINE#45 (7,1,4) (7,6,4)
LINE#46 (0,1,5) (0,6,5)
LINE#47 (2,1,4) (3,6,5)
LINE#48 (5,6,5) (4,1,4)
SIZE 8X8X8
LINE_NUM 49
LINE#1 (0,7,1) (7,7,8)
LINE#2 (0,0,1) (7,0,8)
LINE#3 (6,6,1) (6,7,3)
LINE#4 (6,7,4) (7,6,1)
LINE#5 (1,1,8) (1,0,6)
LINE#6 (0,1,8) (1,0,5)
LINE#7 (0,1,1) (5,7,2)
LINE#8 (7,6,8) (2,0,7)
LINE#9 (5,7,3) (7,0,1)
LINE#10 (2,0,6) (0,7,8)
LINE#11 (1,6,1) (7,1,2)
LINE#12 (6,1,8) (0,6,7)
LINE#13 (7,2,2) (7,5,2)
LINE#14 (0,2,7) (0,5,7)
LINE#15 (4,0,1) (5,7,4)
LINE#16 (3,7,8) (2,0,5)
LINE#17 (6,0,1) (5,6,2)
LINE#18 (1,7,8) (2,1,7)
LINE#19 (5,0,1) (3,7,3)
LINE#20 (2,7,8) (4,0,6)
LINE#21 (3,7,4) (7,0,4)
LINE#22 (4,0,5) (0,7,5)
LINE#23 (3,1,4) (3,6,4)
LINE#24 (4,1,5) (4,6,5)
LINE#25 (0,1,2) (2,7,3)
LINE#26 (7,2,7) (5,0,6)
LINE#27 (6,4,3) (0,4,3)
LINE#28 (7,3,6) (1,3,6)
LINE#29 (6,1,5) (3,2,6)
LINE#30 (1,6,4) (4,5,3)
LINE#31 (2,0,2) (1,6,3)
LINE#32 (5,7,7) (6,1,6)
LINE#33 (1,0,2) (1,5,4)
LINE#34 (6,7,7) (6,2,5)
LINE#35 (3,0,1) (1,5,1)
LINE#36 (6,2,8) (4,7,8)
LINE#37 (3,1,1) (2,5,1)
LINE#38 (4,6,8) (5,2,8)
LINE#39 (3,2,1) (3,5,1)
LINE#40 (4,2,8) (4,5,8)
LINE#41 (6,0,2) (0,1,3)
LINE#42 (1,7,7) (7,6,6)
LINE#43 (4,0,2) (4,2,2)
LINE#44 (3,5,7) (3,7,7)
LINE#45 (7,1,4) (7,6,4)
LINE#46 (0,1,5) (0,6,5)
LINE#47 (2,1,4) (3,6,5)
LINE#48 (5,6,5) (4,1,4)
LINE#49 (6,5,6) (6,7,6)
This diff is collapsed.
# ADC2018 # ADC2018
---
A cooperative system using multiple FPGAs for a simple 3D-Numberlink puzzle solver A cooperative system using multiple FPGAs for a simple 3D-Numberlink puzzle solver
## Environments
実際のソルバで使用している環境.
+ デバイス
- Raspberry Pi 3 B+
- PYNQ
- ZU3EG
+ ソフトウェア
- Python >= 3.5 (通信プログラム)
* Flask
* gevent
* gevent-websocket
- Vivado (Web Pack) >= 18.1 (FPGAの合成)
## Setups
[Wiki](https://www.togawa.cs.waseda.ac.jp/gitlab/adc2018/adc2018-system/wikis/home)も参照されたい.
各端末でこのリポジトリをCloneする.
```
cd ~
git clone https://www.togawa.cs.waseda.ac.jp/gitlab/adc2018/adc2018-system.git
```
## System
+ サーバ
- [通信用スクリプト](comm/server)
+ ソルバ
- [通信用スクリプト](comm/client)
- [高位合成用プログラム](hls)
+ リゾルバ
- [通信用スクリプト](comm/resolver)
## Our previous works ## Our previous works
* [pynq-router](https://github.com/kotarot/pynq-router) * [pynq-router](https://github.com/kotarot/pynq-router)
* [nl-solver](https://github.com/kotarot/nl-solver) * [nl-solver](https://github.com/kotarot/nl-solver)
## License
This software is released under GPL v3 License, see [LICENSE](LICENSE).
# DAS2017 ADC RaspberryPi・PYNQ間HTTP通信プログラム # DAS2018 ADC RaspberryPi, ソルバ, リゾルバ HTTP通信プログラム
# 概要 # 概要
DAS2017アルゴリズムデザインコンテストに向けた,端末間通信プラグラム. DAS2018アルゴリズムデザインコンテストに向けた,端末間通信プラグラム.
親となるRaspberry Piから,子となる複数のPYNQに対し問題を配信し,結果を受け取る. 親となるRaspberry Piから,子となる複数のソルバ,リゾルバに対し問題を配信し,結果を受け取る.
# 構成 # 構成
+ server: Raspberry Pi上で実行するためのサーバプラグラム.問題をクライアントに配信し,結果を受け取る. + server: Raspberry Pi上で実行するためのサーバプラグラム.問題をソルバに配信し,結果を受け取る.
+ client: PYNQ上で実行するためのクライアントプログラム.問題をサーバから受け取り,問題を解いて回答をサーバに返す. + client: ソルバをFPGA上で実行するためのクライアントプログラム.問題をサーバから受け取り,問題を解いて解けたら結果をリゾルバに送り,解けなかったら結果をサーバに報告する.
+ resolver: ソルバから初期解を受け取り,リゾルバでより良い解に整形する.
+ README.md: このファイル. + README.md: このファイル.
# Requirements # Requirements
......
DAS2017 ADC クライアントプログラム DAS2018 ADC クライアントプログラム
=== ===
DAS2017 アルゴリズムデザインコンテスト用クライアントプログラム DAS2018 アルゴリズムデザインコンテスト用クライアントプログラム
## Description ## Description
問題データをサーバから受信し,結果をサーバへ返すプログラム. 問題データをサーバから受信し,結果をリゾルバやサーバへ送るプログラム.
## Requirements ## Requirements
...@@ -22,7 +22,7 @@ python3 main.py [--port XXXX] [--host XXXX] ...@@ -22,7 +22,7 @@ python3 main.py [--port XXXX] [--host XXXX]
<dl> <dl>
<dt>-H, --host</dt> <dt>-H, --host</dt>
<dd>サーバホストのアドレス (デフォルト:192.168.4.1:5000)</dd> <dd>サーバホストのアドレス (デフォルト:192.168.5.1:5000)</dd>
<dt>-p, --port</dt> <dt>-p, --port</dt>
<dd>使用するポート (デフォルト:5000)</dd> <dd>使用するポート (デフォルト:5000)</dd>
......
...@@ -60,8 +60,10 @@ def resolve(): ...@@ -60,8 +60,10 @@ def resolve():
with open(outpath, "r") as fp: with open(outpath, "r") as fp:
resolved = fp.read() resolved = fp.read()
print(data['req_id'])
res = { res = {
'answer': resolved, 'solution': resolved,
'solved': True, 'solved': True,
'solver': data['client'], 'solver': data['client'],
'resolver': client_baseurl, 'resolver': client_baseurl,
......
...@@ -22,7 +22,11 @@ python3 main.py [--question XXXX] [--port XXXX] [--clients XXXX] ...@@ -22,7 +22,11 @@ python3 main.py [--question XXXX] [--port XXXX] [--clients XXXX]
<dl> <dl>
<dt>-c, --client</dt> <dt>-c, --client</dt>
<dd>クライアントを定義したテキストファイル.1行ずつホスト名を記述する(必要ならばポート番号も記述する),必須</dd> <dd>
クライアントを定義したテキストファイル.1行ずつアドレスと役割を記述する(必要ならばポート番号も記述する),必須.
ホスト名と対応するアイコン画像もオプションで指定できる.<br />
`アドレス 役割 [名前] [画像ファイルへのパス]`
</dd>
<dt>-q, --question</dt> <dt>-q, --question</dt>
<dd>問題ファイルのパス (デフォルト:./)</dd> <dd>問題ファイルのパス (デフォルト:./)</dd>
...@@ -32,8 +36,14 @@ python3 main.py [--question XXXX] [--port XXXX] [--clients XXXX] ...@@ -32,8 +36,14 @@ python3 main.py [--question XXXX] [--port XXXX] [--clients XXXX]
<dt>-p, --port</dt> <dt>-p, --port</dt>
<dd>サーバのポート (デフォルト:5000)</dd> <dd>サーバのポート (デフォルト:5000)</dd>
<dt>-a, --adccli</dt>
<dd>
ADC自動運営システムへのログイン情報を記録したjsonファイルへのパス.
`{"url": XXX, "username": YYY, "password": ZZZ}`の形式で保存する.
</dd>
</dl> </dl>
## Comments ## Comments
This project uses some libraries: jQuery, Bootstrap This project uses some libraries: jQuery, Bootstrap, and three.js.
#!/usr/bin/env python3
import subprocess
PYTHON2 = "/usr/bin/python"
ADCCLI = "/home/pi/adc2018/conmgr/client/adccli"
def _exec_adccli(cmd):
exec_cmd = "{} {} {}".format(PYTHON2, ADCCLI, cmd).strip()
print("ADCCLI: {}".format(exec_cmd))
p = subprocess.run(exec_cmd, stdout=subprocess.PIPE, shell=True)
res = p.stdout.decode().strip()
print(res)
return res
def login(url, username, password):
cmd = "--URL='{}' --username='{}' --password='{}' login".format(url, username, password)
return _exec_adccli(cmd)
def logout():
cmd = "logout"
return _exec_adccli(cmd)
def whoami():
cmd = "whoami"
return _exec_adccli(cmd)
def put_message(message):
cmd = "put-user-alive '{}'"
return _exec_adccli(cmd)
def post_user_q(qnum, filepath):
cmd = "post-user-q {} {}".format(qnum, filepath)
return _exec_adccli(cmd)
def get_q_all(outpath):
cmd = "get-q"
question_list = _exec_adccli(cmd).split("\n")
print("--- ADCCLI questions ---")
print(question_list)
for v in question_list:
if v.startswith("Q"):
qnumber = int(v.replace("Q", ""))
out_file_path = "{}/NL_Q{:02d}.txt".format(outpath, qnumber)
cmd = "--output {} get-q {}".format(out_file_path, qnumber)
r = _exec_adccli(cmd)
return question_list
def put_a(qnum, filepath):
cmd = "put-a {} {}".format(qnum, filepath)
return _exec_adccli(cmd)
def put_a_info(qnum, cpu, mem, misc):
cmd = "put-a-info {} {} {} '{}'".format(qnum, cpu, mem, misc)
return _exec_adccli(cmd)
This diff is collapsed.
html, body{ html, body{
/*width: 800px;*/
/*height: 500px;*/
font-size: 11px; font-size: 11px;
overflow: hidden; overflow: hidden;
} }
...@@ -10,7 +8,7 @@ body{ ...@@ -10,7 +8,7 @@ body{
/* scrollbar settings */ /* scrollbar settings */
::-webkit-scrollbar{ ::-webkit-scrollbar{
width: 25px; width: 20px;
border: 1px solid rgba(0, 0, 50, .2); border: 1px solid rgba(0, 0, 50, .2);
} }
::-webkit-scrollbar-thumb{ ::-webkit-scrollbar-thumb{
...@@ -18,7 +16,7 @@ body{ ...@@ -18,7 +16,7 @@ body{
} }
#question-table-wrapper{ #question-table-wrapper{
height: 300px; height: calc(100vh - 50px);
overflow-y: scroll; overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
} }
...@@ -40,9 +38,12 @@ body{ ...@@ -40,9 +38,12 @@ body{
#question-table-wrapper tr.question-row.q-selected{ #question-table-wrapper tr.question-row.q-selected{
background-color: rgba(200, 100, 100, .3); background-color: rgba(200, 100, 100, .3);
} }
#question-table-wrapper tr.question-row:hover{
background-color: rgba(200, 100, 100, .15);
}
#client-control-pane{ #client-control-pane{
height: 330px; height: calc(100vh - 20px);
overflow-y: scroll; overflow-y: scroll;
} }
...@@ -58,3 +59,17 @@ body{ ...@@ -58,3 +59,17 @@ body{
#question-control-pane h3{ #question-control-pane h3{
display: inline-block; display: inline-block;
} }
#client-control-pane tr.answer-detail-row,
#client-control-pane tr.answer-detail-row td{
cursor: pointer;
}
#client-control-pane tr.answer-detail-row:hover{
background-color: rgba(200, 100, 100, .15);
}
#client-control-pane tr.answer-detail-row.submit-answer{
background-color: rgba(100, 200, 100, .3);
}
This diff is collapsed.
...@@ -63,7 +63,6 @@ var PynqManager = (function(){ ...@@ -63,7 +63,6 @@ var PynqManager = (function(){
}).done(function(res){ }).done(function(res){
var answer = res; var answer = res;
$("#solving-question-status").text(answer["status"]); $("#solving-question-status").text(answer["status"]);
$("#solved-client").text(answer["answer"]["client"]);
if (after !== null){ if (after !== null){
after(); after();
...@@ -110,6 +109,7 @@ $(function(){ ...@@ -110,6 +109,7 @@ $(function(){
var pynqClients = {} var pynqClients = {}
var pm = null; var pm = null;
var last_req = 0;
var refresh_question_table = function(){ var refresh_question_table = function(){
$.ajax({ $.ajax({
...@@ -145,7 +145,41 @@ $(function(){ ...@@ -145,7 +145,41 @@ $(function(){
}).done(function(d){ }).done(function(d){
$("#client-control-pane").html(""); $("#client-control-pane").html("");
$("#client-control-pane").html(d); $("#client-control-pane").html(d);
pm.getStatus();
var button_action_with_ajax = function($obj, url){
$obj.prop("disabled", "disabled");
$.ajax({
type: "GET",
url: url,
dataType: "json",
}).done((data)=>{
$obj.prop("disabled", false);
alert(data['message']);
});
};
$("#adccli-login-button").click(function(){
button_action_with_ajax($(this), "/adccli-login");
});
$("#adccli-logout-button").click(function(){
button_action_with_ajax($(this), "/adccli-logout");
});
$("#adccli-get-all-q").click(function(){
button_action_with_ajax($(this), "/adccli-get-all-q");
});
$.ajax({
type: "GET",
url: "/adccli-whoami",
dataType: "json",
}).done((data)=>{
if(data['status'])
$("#adccli-status").text("ログイン中");
else
$("#adccli-status").text("ログアウト");
});
if(pm) pm.getStatus();
}); });
} }
...@@ -161,11 +195,40 @@ $(function(){ ...@@ -161,11 +195,40 @@ $(function(){
$("#client-control-pane").find(".start-button").eq(0).click(function(){ $("#client-control-pane").find(".start-button").eq(0).click(function(){
var qname = $(this).data("qname"); var qname = $(this).data("qname");
pm.sendQuestion(qname, after=refresh_question_table); pm.sendQuestion(qname);
}); });
$("#client-control-pane").find(".stop-button").eq(0).click(function(){ $("#client-control-pane").find(".stop-button").eq(0).click(function(){
pm.sendStop(); pm.sendStop();
}); });
$("#client-control-pane").find(".save-button").eq(0).click(function(){
var qname = $(this).data("qname");
$.ajax({
type: "POST",
dataType: "json",
url: "/save",
data: {qname: qname}
}).done((data) => {
alert(data['status']);
});
});
$("#client-control-pane").find(".submit-button").eq(0).click(function(){
var qname = $(this).data("qname");
$.ajax({
type: "POST",
dataType: "json",
url: "/adccli-put-a",
data: {qname: qname}
}).done((data) => {
alert(data['message']);
});
});
$(".answer-detail-row td").click(function(){
var json_name = $(this).parent("tr").data("json");
var qname = $(this).parent("tr").data("qname");
var viewer_url = "/board-viewer#" + qname + "," + json_name
window.open(viewer_url, "_blank");
})
}); });
} }
...@@ -178,6 +241,19 @@ $(function(){ ...@@ -178,6 +241,19 @@ $(function(){
} }
}).trigger('hashchange'); }).trigger('hashchange');
var ws = new WebSocket("ws://" + location.host + "/ws");
ws.onmessage = function(e){
var recv = JSON.parse(e.data.replace(/\n/g, "\\n"));
console.log(recv);
var hash = location.hash.replace("#", "");
if(hash == recv['qname']){
show_question_status(hash);
}
refresh_question_table();
};
refresh_question_table(); refresh_question_table();
$.ajax({ $.ajax({
...@@ -187,6 +263,10 @@ $(function(){ ...@@ -187,6 +263,10 @@ $(function(){
}).done(function(d){ }).done(function(d){
pynqClients = d; pynqClients = d;
pm = PynqManager(pynqClients); pm = PynqManager(pynqClients);
if(location.hash.replace("#", "") == ""){
pm.getStatus();
}
}); });
}); });
This diff is collapsed.
This diff is collapsed.
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<div id="wrapper"> <div id="wrapper">
<div id="contorol-panel-wrapper" class="container-fluid"> <div id="control-panel-wrapper" class="container-fluid">
<div class="row"> <div id="control-panel-row" class="row">
<div class="col-5" id="question-control-pane"> <div class="col-5" id="question-control-pane">
<h3>問題一覧</h3>&nbsp; <h3>問題一覧</h3>&nbsp;
<span><a href="/#" id="view-server-status-button">システム状況</a></span> <span><a href="/#" id="view-server-status-button">システム状況</a></span>
......
...@@ -9,6 +9,14 @@ Viewer Mode ...@@ -9,6 +9,14 @@ Viewer Mode
{% endif %} {% endif %}
</p> </p>
{% if local_mode %}
<h4>自動運営システム</h4>
<button type="button" class="btn btn-primary" id="adccli-login-button">Login</button>
<button type="button" class="btn btn-light" id="adccli-logout-button">Logout</button>
<button type="button" class="btn btn-info" id="adccli-get-all-q">問題DL</button>
<span id="adccli-status"></span>
{% endif %}
<h4>クライアント</h4> <h4>クライアント</h4>
<table class="table table-bordered" id="clients-table"> <table class="table table-bordered" id="clients-table">
<tr> <tr>
......
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
<h3> 【{{qname}}】</h3> <h3> 【{{qname}}】</h3>
{% if localmode %}
<p> <p>
<button class="btn btn-primary btn-lg start-button" type="button" data-qname="{{qname}}">Start</button> <button class="btn btn-primary btn-lg start-button" type="button" data-qname="{{qname}}">Start</button>
<button class="btn btn-danger btn-lg stop-button" type="button" data-qname="all">Stop</button> <button class="btn btn-danger btn-lg stop-button" type="button" data-qname="all">Stop</button>
</p> </p>
<p>
<button class="btn btn-info btn-lg save-button" type="button" data-qname="{{qname}}">Save</button>
<button class="btn btn-success btn-lg submit-button" type="button" data-qname="{{qname}}">Up</button>
</p>
{% else %}
[View Only]
{% endif %}
</div> </div>
<div class="col-8"> <div class="col-8">
<p>処理結果</p> <p>処理結果</p>
...@@ -24,7 +32,7 @@ ...@@ -24,7 +32,7 @@
&nbsp;({{c[2]}}) &nbsp;({{c[2]}})
{% endif %} {% endif %}
</td> </td>
<td></td> <td>{{qdata.solver[c[0]]}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
...@@ -39,17 +47,23 @@ ...@@ -39,17 +47,23 @@
<th>Client</th> <th>Client</th>
<th>Score</th> <th>Score</th>
</tr> </tr>
{% for v in qdata.answers %} {% for k, v in qdata.answers.items() %}
<tr> {% if (qdata.best_json == k) and (v.answer != "") %}
<tr class="answer-detail-row submit-answer" data-json="{{k}}" data-qname="{{qname}}">
{% else %}
<tr class="answer-detail-row" data-json="{{k}}" data-qname="{{qname}}">
{% endif %}
<td>{{v.timestamp}}</td> <td>{{v.timestamp}}</td>
<td>{{v.solver}}</td> <td>{{v.solver}}</td>
<td>{{v.nlcheck}}</td> <td>
{% if v.nlcheck == -1 %}
Not solved
{% else %}
{{v.nlcheck}}
{% endif %}
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>
<p>状況:<span id="solving-question-status">{{qdata.status}}</span></p>
<h4>結果</h4>
<p>クライアント:<span id="solved-client">{{qdata.answer.client}}</span></p>
<pre id="solved-result">{{qdata.answer.answer}}</pre>
TARGET = sim
OBJS = $(CPPS:.cpp=.o)
CPPS = $(wildcard *.cpp)
CXX = g++
CXXFLAGS = -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label -DSOFTWARE -DCALCTIME
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -O3 -o $@ $(OBJS)
run:
python3 ../NLGenerator.py -x 20 -y 20 -z 6 -l 100;\
python3 ./gen_boardstr.py Q-20x20x5_100_10.txt |\
./$(TARGET) -
clean:
rm *.o
rm $(TARGET)
# pynq-router (sw)
Vivado HLS 用 pynq-router
## メモ
* Vivado HLS 2016.1
* Vivado 2016.1
高位合成オプション:
* Part: xc7z020clg400-1
* Clock Period: 10.0 ns
* Clock Uncertainty: 3.0 ns, 3.5 ns // 2017/08/04
論理合成・配置配線のオプション:
* Synthesis strategy: ~~Vivado Synthesis Defaults~~ Flow_PerfOptimized_high
* Implementation strategy: ~~Vivado Implementation Defaults~~ Performance_Explore
最適化記録:
* 2017/08/04: クリティカルパス遅延の最適化
* (3.0) Estimated clock: 6.78, Max latency: 1,667,151,745 (1.00)
* (3.5) Estimated clock: 6.38, Max latency: 1,692,438,002 (1.00)
* 2017/08/05: キューpop処理の動作改善
* (3.0) Estimated clock: 6.78, Max latency: 1,530,952,491 (0.92)
* (3.5) Estimated clock: 6.38, Max latency: 1,556,238,748 (0.92)
* 2017/08/07: 剰余演算の書き換え,隣接ノードの探索ループ展開
* (3.0) Estimated clock: 6.78, Max latency: 1,423,592,713 (0.85)
* (3.5) Estimated clock: 6.38, Max latency: 1,428,235,716 (0.84)
* 2017/08/07: 高位合成パラメータの調整
* (3.0) Estimated clock: 6.78, Max latency: 1,284,364,290 (0.77)
* (3.5) Estimated clock: 6.38, Max latency: 1,289,003,291 (0.76)
* 2017/08/11: 隣接ノードの探索ループ展開を戻した (そうしないと論理合成・配置配線でタイミング満たさない)
* (3.0) Estimated clock: 6.78, Max latency: 1,329,761,290 (0.80)
* (3.5) Estimated clock: 6.38, Max latency: 1,355,035,291 (0.80)
* 2017/08/11: starts と goals を FF パーティションした
* (3.0) Estimated clock: 6.78, Max latency: 1,329,245,034 (0.797)
* (3.5) Estimated clock: 6.45, Max latency: 1,354,519,035 (0.800)
* 2017/08/16: MAX_LINES を 256 に増やした
* (3.0) Estimated clock: 6.78, Max latency: 1,905,588,970 (1.143)
* (3.5) Estimated clock: 6.38, Max latency: 1,933,166,972 (1.142)
* 2017/08/16: MAX_LINES を 128 に戻した (そうしないと論理合成・配置配線でタイミング満たさない)
* (3.0) Estimated clock: 6.78, Max latency: 1,329,245,034 (0.797)
* (3.5) Estimated clock: 6.45, Max latency: 1,354,519,035 (0.800)
* 2017/08/16: コスト関数の波形をのこぎり型にした
* (3.0) Estimated clock: 6.78, Max latency: 1,329,245,034 (13.29 sec) (0.797)
* (3.25) Estimated clock: 6.52, Max latency: 1,329,249,035 (13.29 sec)
* (3.5) Estimated clock: 6.45, Max latency: 1,354,519,035 (13.55 sec) (0.800)
* 2017/08/18: 対象ライン選択に剰余演算を用いない方法を試してみた ※あまり変わらないからこれはやらずに元に戻す
* (3.0) Estimated clock: 6.52, Max latency: 1,329,101,007 (13.29 sec) (0.797)
* (3.5) Estimated clock: 6.45, Max latency: 1,354,371,007 (13.54 sec) (0.800)
* 2017/08/18: 対象ラインが連続して同じだったらルーティングスキップする
* (3.0) Estimated clock: 6.78, Max latency: 1,329,245,034 (13.29 sec)
* (3.25) Estimated clock: 6.52, Max latency: 1,329,249,035 (13.29 sec) **←今これ**
* (3.5) Estimated clock: 6.45, Max latency: 1,354,519,035 (13.55 sec)
## 入出力
入力は boardstr という問題ファイルをコンパクトに記述したようなワンラインの文字列。
出力は char 型の配列で、各要素に解答ファイルに相当する数値が入っている。
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* router.hpp
*
* for Vivado HLS
*/
#ifndef __ROUTER_HPP__
#define __ROUTER_HPP__
#ifdef SOFTWARE
#include "ap_int.h"
#else
#include <ap_int.h>
#endif
//#define DEBUG_PRINT // いろいろ表示する
#define USE_ASTAR // A* 探索を使う
#define USE_MOD_CALC // ターゲットラインの選択に剰余演算を用いる
using namespace std;
// 各種設定値
#define MAX_WIDTH 72 // X, Y の最大値 (7ビットで収まる)
#define BITWIDTH_XY 13
#define BITMASK_XY 65528 // 1111 1111 1111 1000
#define MAX_LAYER 8 // Z の最大値 (3ビット)
#define BITWIDTH_Z 3
#define BITMASK_Z 7 // 0000 0000 0000 0111
#define MAX_CELLS 41472 // セルの総数 =72*72*8 (16ビットで収まる)
#define MAX_LINES 1024 // ライン数の最大値 (7ビット)
#define MAX_PATH 256 // 1つのラインが対応するセル数の最大値 (8ビット)
#define MAX_PQ 4096 // 探索時のプライオリティ・キューの最大サイズ (12ビット) 足りないかも?
#define PQ_PRIORITY_WIDTH 16
#define PQ_PRIORITY_MASK 65535 // 0000 0000 0000 0000 1111 1111 1111 1111
#define PQ_DATA_WIDTH 16
#define PQ_DATA_MASK 4294901760 // 1111 1111 1111 1111 0000 0000 0000 0000
#define MAX_WEIGHT 255 // 重みの最大値 (8ビットで収まる)
#define BOARDSTR_SIZE 41472 // ボードストリングの最大文字数 (セル数 72*72*8 あれば良い)
void lfsr_random_init(ap_uint<32> seed);
ap_uint<32> lfsr_random();
//ap_uint<32> lfsr_random_uint32(ap_uint<32> a, ap_uint<32> b);
//ap_uint<32> lfsr_random_uint32_0(ap_uint<32> b);
ap_uint<8> new_weight(ap_uint<16> x);
bool pynqrouter_zu3eg_test(char boardstr[BOARDSTR_SIZE], ap_uint<32> seed, ap_int<32> *status);
#ifdef USE_ASTAR
ap_uint<7> abs_uint7(ap_uint<7> a, ap_uint<7> b);
ap_uint<3> abs_uint3(ap_uint<3> a, ap_uint<3> b);
#endif
void search(ap_uint<8> *path_size, ap_uint<16> path[MAX_PATH], ap_uint<16> start, ap_uint<16> goal, ap_uint<8> w[MAX_WEIGHT]);
void pq_push(ap_uint<16> priority, ap_uint<16> data, ap_uint<12> *pq_len, ap_uint<32> pq_nodes[MAX_PQ]);
void pq_pop(ap_uint<16> *ret_priority, ap_uint<16> *ret_data, ap_uint<12> *pq_len, ap_uint<32> pq_nodes[MAX_PQ]);
#endif /* __ROUTER_HPP__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
TARGET = sim
OBJS = $(CPPS:.cpp=.o)
CPPS = $(wildcard *.cpp)
CXX = g++
CXXFLAGS = -O3 -Wall -Wno-unknown-pragmas -Wno-unused-label -DSOFTWARE -DCALCTIME
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -O3 -Wl,--stack,16777216 -o $@ $(OBJS)
clean:
rm *.o
rm $(TARGET)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.