Skip to content
Snippets Groups Projects
Commit bd8d24eb authored by Guillaume-Helbecque's avatar Guillaume-Helbecque
Browse files

implement helper messages

parent f5483260
No related branches found
No related tags found
No related merge requests found
...@@ -28,4 +28,14 @@ module util ...@@ -28,4 +28,14 @@ module util
} }
} }
} }
proc common_help_message(): void
{
writeln("\n usage: main.out [parameter value] ...");
writeln("\n General Parameters:\n");
writeln(" --m int minimum number of elements to offload on a GPU device");
writeln(" --M int maximum number of elements to offload on a GPU device");
writeln(" --D int number of GPU device(s)");
writeln(" --help (or -h) this message");
}
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Time; use Time;
use util;
use Pool; use Pool;
use NQueens_node; use NQueens_node;
...@@ -40,6 +41,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time ...@@ -40,6 +41,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n N-Queens Benchmark Parameters:\n");
writeln(" --N int number of queens");
writeln(" --g int number of safety check(s) per evaluation\n");
}
// Check queen's safety. // Check queen's safety.
proc isSafe(const board, const queen_num, const row_pos): uint(8) proc isSafe(const board, const queen_num, const row_pos): uint(8)
{ {
...@@ -105,8 +113,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi ...@@ -105,8 +113,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Time; use Time;
use util;
use Pool; use Pool;
use Pool_par; use Pool_par;
use PrivateDist; use PrivateDist;
...@@ -48,6 +49,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time ...@@ -48,6 +49,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n N-Queens Benchmark Parameters:\n");
writeln(" --N int number of queens");
writeln(" --g int number of safety check(s) per evaluation\n");
}
// Check queen's safety. // Check queen's safety.
proc isSafe(const board, const queen_num, const row_pos): uint(8) proc isSafe(const board, const queen_num, const row_pos): uint(8)
{ {
...@@ -327,8 +335,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi ...@@ -327,8 +335,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Time; use Time;
use util;
use Pool; use Pool;
use GpuDiagnostics; use GpuDiagnostics;
...@@ -45,6 +46,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time ...@@ -45,6 +46,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n N-Queens Benchmark Parameters:\n");
writeln(" --N int number of queens");
writeln(" --g int number of safety check(s) per evaluation\n");
}
// Check queen's safety. // Check queen's safety.
proc isSafe(const board, const queen_num, const row_pos): uint(8) proc isSafe(const board, const queen_num, const row_pos): uint(8)
{ {
...@@ -192,8 +200,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi ...@@ -192,8 +200,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Time; use Time;
use util;
use Pool; use Pool;
use GpuDiagnostics; use GpuDiagnostics;
...@@ -46,6 +47,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time ...@@ -46,6 +47,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n N-Queens Benchmark Parameters:\n");
writeln(" --N int number of queens");
writeln(" --g int number of safety check(s) per evaluation\n");
}
// Check queen's safety. // Check queen's safety.
proc isSafe(const board, const queen_num, const row_pos): uint(8) proc isSafe(const board, const queen_num, const row_pos): uint(8)
{ {
...@@ -282,8 +290,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi ...@@ -282,8 +290,18 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Time; use Time;
use util;
use Pool; use Pool;
use PFSP_node; use PFSP_node;
...@@ -76,6 +77,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS ...@@ -76,6 +77,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n PFSP Benchmark Parameters:\n");
writeln(" --inst int Taillard's instance to solve (between 001 and 120)");
writeln(" --lb str lower bound function (lb1, lb1_d, lb2)");
writeln(" --ub int initial upper bound (0, 1)\n");
}
// Evaluate and generate children nodes on CPU. // Evaluate and generate children nodes on CPU.
proc decompose_lb1(const parent: Node, ref tree_loc: uint, ref num_sol: uint, proc decompose_lb1(const parent: Node, ref tree_loc: uint, ref num_sol: uint,
ref best: int, ref pool: SinglePool(Node)) ref best: int, ref pool: SinglePool(Node))
...@@ -206,8 +215,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint ...@@ -206,8 +215,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
...@@ -8,6 +8,7 @@ use GpuDiagnostics; ...@@ -8,6 +8,7 @@ use GpuDiagnostics;
config const BLOCK_SIZE = 512; config const BLOCK_SIZE = 512;
use util;
use Pool_par; use Pool_par;
use PFSP_node; use PFSP_node;
...@@ -78,6 +79,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS ...@@ -78,6 +79,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n PFSP Benchmark Parameters:\n");
writeln(" --inst int Taillard's instance to solve (between 001 and 120)");
writeln(" --lb str lower bound function (lb1, lb1_d, lb2)");
writeln(" --ub int initial upper bound (0, 1)\n");
}
// Evaluate and generate children nodes on CPU. // Evaluate and generate children nodes on CPU.
proc decompose_lb1(const lb1_data, const parent: Node, ref tree_loc: uint, ref num_sol: uint, proc decompose_lb1(const lb1_data, const parent: Node, ref tree_loc: uint, ref num_sol: uint,
ref best: int, ref pool: SinglePool_par(Node)) ref best: int, ref pool: SinglePool_par(Node))
...@@ -515,8 +524,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint ...@@ -515,8 +524,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
...@@ -7,6 +7,7 @@ use GpuDiagnostics; ...@@ -7,6 +7,7 @@ use GpuDiagnostics;
config const BLOCK_SIZE = 512; config const BLOCK_SIZE = 512;
use util;
use Pool; use Pool;
use PFSP_node; use PFSP_node;
...@@ -85,6 +86,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS ...@@ -85,6 +86,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n PFSP Benchmark Parameters:\n");
writeln(" --inst int Taillard's instance to solve (between 001 and 120)");
writeln(" --lb str lower bound function (lb1, lb1_d, lb2)");
writeln(" --ub int initial upper bound (0, 1)\n");
}
// Evaluate and generate children nodes on CPU. // Evaluate and generate children nodes on CPU.
proc decompose_lb1(const parent: Node, ref tree_loc: uint, ref num_sol: uint, proc decompose_lb1(const parent: Node, ref tree_loc: uint, ref num_sol: uint,
ref best: int, ref pool: SinglePool(Node)) ref best: int, ref pool: SinglePool(Node))
...@@ -442,8 +451,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint ...@@ -442,8 +451,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
...@@ -79,6 +79,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS ...@@ -79,6 +79,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS
writeln("=================================================\n"); writeln("=================================================\n");
} }
proc help_message(): void
{
writeln("\n PFSP Benchmark Parameters:\n");
writeln(" --inst int Taillard's instance to solve (between 001 and 120)");
writeln(" --lb str lower bound function (lb1, lb1_d, lb2)");
writeln(" --ub int initial upper bound (0, 1)\n");
}
// Evaluate and generate children nodes on CPU. // Evaluate and generate children nodes on CPU.
proc decompose_lb1(const lb1_data, const parent: Node, ref tree_loc: uint, ref num_sol: uint, proc decompose_lb1(const lb1_data, const parent: Node, ref tree_loc: uint, ref num_sol: uint,
ref best: int, ref pool: SinglePool_par(Node)) ref best: int, ref pool: SinglePool_par(Node))
...@@ -571,8 +579,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint ...@@ -571,8 +579,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint
writeln("\nExploration terminated."); writeln("\nExploration terminated.");
} }
proc main() proc main(args: [] string)
{ {
// Helper
for a in args[1..] {
if (a == "-h" || a == "--help") {
common_help_message();
help_message();
return 1;
}
}
check_parameters(); check_parameters();
print_settings(); print_settings();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment