修复问题,base版本

This commit is contained in:
YuhangQ 2023-04-18 12:45:22 +00:00
parent 4d35c45365
commit 76470817cf
4 changed files with 20 additions and 15 deletions

9
run.sh
View File

@ -12,10 +12,13 @@
# preprocess 占了特别大内存 # preprocess 占了特别大内存
# 04157f716c1e9606c6a530657bf8f957-Kakuro-easy-125-ext.xml.hg_4.cnf # 04157f716c1e9606c6a530657bf8f957-Kakuro-easy-125-ext.xml.hg_4.cnf
DIR=/pub/data/chenzh/data/sat2022
INSTANCE=0d209cb420326994f9c4898eb10228ab-008-80-8.cnf
make -j 16 && mpirun --bind-to none -np 9 --allow-run-as-root ./light -i $DIR/$INSTANCE --share=1 --threads=16 --times=3600
# 这个存在问题
DIR=/pub/data/chenzh/data/sat2022
INSTANCE=3d2a6e5c2f8f58dee79fd50444009625-cfi-rigid-z2-0088-03-or_2_shuffle_all.cnf
make -j 16 && mpirun --bind-to none -np 5 --allow-run-as-root ./light -i $DIR/$INSTANCE --share=1 --threads=4 --times=3600
#make -j 16 && mpirun --bind-to none -np 9 --allow-run-as-root ./light -i ./data/hard1.cnf --share=1 --threads=16 --times=3600 #make -j 16 && mpirun --bind-to none -np 9 --allow-run-as-root ./light -i ./data/hard1.cnf --share=1 --threads=16 --times=3600

View File

@ -22,8 +22,6 @@
PARA( threads , int , '\0' , false , 32 , 1 , 128 , "Thread number") \ PARA( threads , int , '\0' , false , 32 , 1 , 128 , "Thread number") \
PARA( times , double , '\0' , false , 5000 , 0 , 1e8 , "Cutoff time") \ PARA( times , double , '\0' , false , 5000 , 0 , 1e8 , "Cutoff time") \
PARA( unique , int , '\0' , false , 1 , 0 , 1 , "Whether perform unique checking when receiving clauses from other nodes") PARA( unique , int , '\0' , false , 1 , 0 , 1 , "Whether perform unique checking when receiving clauses from other nodes")
// name, short-name, must-need, default, comments // name, short-name, must-need, default, comments
#define STR_PARAS \ #define STR_PARAS \

View File

@ -30,9 +30,11 @@ void share_clauses_to_next_node(int from, const std::vector<shared_ptr<clause_st
* unsat_group [num_procs/2+1, num_procs-1] * unsat_group [num_procs/2+1, num_procs-1]
*/ */
int target = rank + 1; int target = rank % (num_procs - 1) + 1;
if(target == num_procs / 2 + 1) target = 1;
if(target == num_procs) target = num_procs/2+1; // int target = rank + 1;
// if(target == num_procs / 2 + 1) target = 1;
// if(target == num_procs) target = num_procs/2+1;
// 环形传递,数据来源如果是目的地,说明数据已轮转一圈,停止发送。 // 环形传递,数据来源如果是目的地,说明数据已轮转一圈,停止发送。
if(from == target) return; if(from == target) return;
@ -158,7 +160,7 @@ void sharer::do_clause_sharing() {
auto clk_now = std::chrono::high_resolution_clock::now(); auto clk_now = std::chrono::high_resolution_clock::now();
int solve_time = std::chrono::duration_cast<std::chrono::milliseconds>(clk_now - clk_st).count(); int solve_time = std::chrono::duration_cast<std::chrono::milliseconds>(clk_now - clk_st).count();
printf("c [worker] round %d, time: %d.%d\n", nums, solve_time / 1000, solve_time % 1000); printf("c [node-%d] round %d, time: %d.%d\n", rank, nums, solve_time / 1000, solve_time % 1000);
// 导入外部网络传输的子句 // 导入外部网络传输的子句
std::vector<shared_ptr<clause_store>> clauses; std::vector<shared_ptr<clause_store>> clauses;
@ -166,7 +168,7 @@ void sharer::do_clause_sharing() {
int from = receive_clauses_from_last_node(clauses, transmitter); int from = receive_clauses_from_last_node(clauses, transmitter);
if(from != -1 && clauses.size() > 0) { if(from != -1 && clauses.size() > 0) {
printf("c [node-%d] get %d exported clauses from node-%d\n", rank, clauses.size(), transmitter); printf("c [node-%d] get %d exported clauses from node-%d\n", rank, clauses.size(), transmitter);
printf("c [node-%d] sharing unique reduce percentage: %.2f%%\n", rank, (double) num_skip_clauses_by_network / num_received_clauses_by_network * 100); // printf("c [node-%d] sharing unique reduce percentage: %.2f%%\n", rank, (double) num_skip_clauses_by_network / num_received_clauses_by_network * 100);
for (int j = 0; j < consumers.size(); j++) { for (int j = 0; j < consumers.size(); j++) {
consumers[j]->import_clauses_from(clauses); consumers[j]->import_clauses_from(clauses);

View File

@ -80,11 +80,13 @@ void light::diversity_workers() {
* unsat_group [num_procs/2+1, num_procs-1] * unsat_group [num_procs/2+1, num_procs-1]
*/ */
if(rank <= num_procs / 2) { // if(rank <= num_procs / 2) {
workers[i]->configure("sat", 1); // workers[i]->configure("sat", 1);
} else { // OPT(share_lits) = 1500;
workers[i]->configure("unsat", 1); // } else {
} // workers[i]->configure("unsat", 1);
// OPT(share_lits) = 3000;
// }
if (OPT(shuffle)) { if (OPT(shuffle)) {
if (i) workers[i]->configure("order_reset", i); if (i) workers[i]->configure("order_reset", i);