diff --git a/lib/common/util.chpl b/lib/common/util.chpl index 4cdf5f70999e2e4dda0c86e53f4b60fe5ed46984..a2b2470b2c22dd8b47265495143c6afd7a3322cb 100644 --- a/lib/common/util.chpl +++ b/lib/common/util.chpl @@ -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"); + } } diff --git a/nqueens_chpl.chpl b/nqueens_chpl.chpl index 0c472cea0daa7253a0142d20c8e49f7e5a06e86c..2ea9cbe1ff07d61b7afc814aa6e0109464d60bf6 100644 --- a/nqueens_chpl.chpl +++ b/nqueens_chpl.chpl @@ -4,6 +4,7 @@ use Time; +use util; use Pool; use NQueens_node; @@ -40,6 +41,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time 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. 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 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(); print_settings(); diff --git a/nqueens_dist_multigpu_chpl.chpl b/nqueens_dist_multigpu_chpl.chpl index be3e76326eaeb551621b876b563c3351956196fc..ef48df50a5f20ded9dc09dd9d6977b6ddb689ead 100644 --- a/nqueens_dist_multigpu_chpl.chpl +++ b/nqueens_dist_multigpu_chpl.chpl @@ -4,6 +4,7 @@ use Time; +use util; use Pool; use Pool_par; use PrivateDist; @@ -48,6 +49,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time 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. 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 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(); print_settings(); diff --git a/nqueens_gpu_chpl.chpl b/nqueens_gpu_chpl.chpl index eca737d29c10d25ecd0b651dbf0f8b9a5e03bf1d..cede27494f7b5387e65bb64ae9db9c5dca5fe267 100644 --- a/nqueens_gpu_chpl.chpl +++ b/nqueens_gpu_chpl.chpl @@ -4,6 +4,7 @@ use Time; +use util; use Pool; use GpuDiagnostics; @@ -45,6 +46,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time 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. 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 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(); print_settings(); diff --git a/nqueens_multigpu_chpl.chpl b/nqueens_multigpu_chpl.chpl index fb0ce3189aefc1d29ed3cf8a82f116aba1a81e46..bd6b335822b0af5829bf1e2e654f655e99f209c3 100644 --- a/nqueens_multigpu_chpl.chpl +++ b/nqueens_multigpu_chpl.chpl @@ -4,6 +4,7 @@ use Time; +use util; use Pool; use GpuDiagnostics; @@ -46,6 +47,13 @@ proc print_results(const exploredTree: uint, const exploredSol: uint, const time 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. 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 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(); print_settings(); diff --git a/pfsp_chpl.chpl b/pfsp_chpl.chpl index 7204930471ea3b0f0a10ee711c40dd6e06076a6f..2cbc2ade2f1999435ef04da5ef3ea9910134d8e6 100644 --- a/pfsp_chpl.chpl +++ b/pfsp_chpl.chpl @@ -4,6 +4,7 @@ use Time; +use util; use Pool; use PFSP_node; @@ -76,6 +77,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS 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. proc decompose_lb1(const parent: Node, ref tree_loc: uint, ref num_sol: uint, ref best: int, ref pool: SinglePool(Node)) @@ -206,8 +215,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint 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(); print_settings(); diff --git a/pfsp_dist_multigpu_chpl.chpl b/pfsp_dist_multigpu_chpl.chpl index d2410e38715ec41c92d34f1458f296481339c51b..7281675fd7f87f9aaa01f9bf24a17d26dafe7028 100644 --- a/pfsp_dist_multigpu_chpl.chpl +++ b/pfsp_dist_multigpu_chpl.chpl @@ -8,6 +8,7 @@ use GpuDiagnostics; config const BLOCK_SIZE = 512; +use util; use Pool_par; use PFSP_node; @@ -78,6 +79,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS 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. 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)) @@ -515,8 +524,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint 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(); print_settings(); diff --git a/pfsp_gpu_chpl.chpl b/pfsp_gpu_chpl.chpl index 1b85273dfb5e3b40b3412c52368b853ae822f7ce..617f9ceff04a31b14aec4b4b520982bafc503c47 100644 --- a/pfsp_gpu_chpl.chpl +++ b/pfsp_gpu_chpl.chpl @@ -7,6 +7,7 @@ use GpuDiagnostics; config const BLOCK_SIZE = 512; +use util; use Pool; use PFSP_node; @@ -85,6 +86,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS 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. proc decompose_lb1(const parent: Node, ref tree_loc: uint, ref num_sol: uint, ref best: int, ref pool: SinglePool(Node)) @@ -442,8 +451,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint 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(); print_settings(); diff --git a/pfsp_multigpu_chpl.chpl b/pfsp_multigpu_chpl.chpl index 7fb980274a2338e32c2fd9ddbfca96f9a79f6546..2bb3ae22c4ceb07c5ddefe3c6fadeb9b76a773ca 100644 --- a/pfsp_multigpu_chpl.chpl +++ b/pfsp_multigpu_chpl.chpl @@ -79,6 +79,14 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS 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. 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)) @@ -571,8 +579,18 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint 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(); print_settings();