diff --git a/docker/common.dockerfile b/docker/common.dockerfile index 065f669..62a3e0c 100644 --- a/docker/common.dockerfile +++ b/docker/common.dockerfile @@ -4,7 +4,7 @@ USER root RUN sed -i s@/archive.ubuntu.com/@/mirrors.bfsu.edu.cn/@g /etc/apt/sources.list RUN apt update -RUN DEBIAN_FRONTEND=noninteractive apt install -y cmake build-essential zlib1g-dev libopenmpi-dev wget unzip python3 gfortran curl +RUN DEBIAN_FRONTEND=noninteractive apt install -y vim cmake build-essential zlib1g-dev libopenmpi-dev wget unzip python3 gfortran curl RUN apt install -y libboost-all-dev diff --git a/docker/light b/docker/light index c8247fd..1bb3c81 100755 Binary files a/docker/light and b/docker/light differ diff --git a/docker/run_solver.sh b/docker/run_solver.sh index b556e3e..d76850b 100755 --- a/docker/run_solver.sh +++ b/docker/run_solver.sh @@ -1,3 +1,3 @@ #!/bin/bash -mpirun --host localhost,worker1,worker2,worker3 /light -i ./files/class_1_easy_10_0.cnf \ No newline at end of file +mpirun --host localhost,worker1,worker2,worker3 /light -i ./files/class_1_easy_10_0.cnf --share=1 \ No newline at end of file diff --git a/makefile b/makefile index 21a9c6a..cacecbf 100644 --- a/makefile +++ b/makefile @@ -6,7 +6,7 @@ OBJECTS := $(addprefix build/,$(SOURCES:%=%.o)) # 声明编译器和编译选项 CXX := mpicxx -CXXFLAGS := -O0 -Wall -Wextra -MMD -MP +CXXFLAGS := -O0 -Wall -Wextra -MMD -MP -g LIBS := -Wl,-Bstatic -lkissat -L kissat-inc/build -I kissat-inc/ \ -lm4ri -L m4ri-20140914/.libs -I m4ri-20140914/ \ diff --git a/run.sh b/run.sh index 41960fa..44650f2 100755 --- a/run.sh +++ b/run.sh @@ -1,3 +1,7 @@ #!/bin/bash -make -j 16 && mpirun -np 4 --allow-run-as-root ./light -i data/class_1_easy_10_0.cnf --share=1 --threads=4 --times=60 \ No newline at end of file +#make -j 16 && mpirun -np 4 --allow-run-as-root valgrind ./light -i data/class_1_easy_10_0.cnf --share=1 --threads=32 --times=60 + +#valgrind + +make -j 16 && mpirun -np 4 --allow-run-as-root ./light -i data/class_1_easy_10_0.cnf --share=1 --threads=32 --times=60 \ No newline at end of file diff --git a/src/workers/sharer.cpp b/src/workers/sharer.cpp index 2a6c122..235e344 100644 --- a/src/workers/sharer.cpp +++ b/src/workers/sharer.cpp @@ -21,7 +21,7 @@ void share_clauses_to_next_node(std::vector> &send_ } // 与数组最后一个交换,然后 pop_back; - std::swap(send_data_struct[0], send_data_struct[send_data_struct.size()-1]); + std::swap(send_data_struct[i], send_data_struct[send_data_struct.size()-1]); send_data_struct.pop_back(); } @@ -64,13 +64,11 @@ void share_clauses_to_next_node(std::vector> &send_ LOGGER->info("send clauses: %v", send_length); } - -const int BUF_SIZE = 1024 * 1024; +const int BUF_SIZE = 1024 * 1024 * 1024; bool receive_clauses_from_last_node(MPI_Request &receive_request, int *buf, vec &clauses) { clauses.clear(); - int flag; MPI_Status status; @@ -81,7 +79,6 @@ bool receive_clauses_from_last_node(MPI_Request &receive_request, int *buf, vec< int count; MPI_Get_count(&status, MPI_INT, &count); - while(index < count) { clause_store* cl = new clause_store(buf[index++]); cl->lbd = buf[index++]; @@ -148,28 +145,27 @@ void * share_worker(void *arg) { LOGGER->info("thread-%v: get %v exported clauses", i, number); - // 分享当前节点产生的子句 - share_clauses_to_next_node(send_data_struct, sq->cls); + // //分享当前节点产生的子句 + // share_clauses_to_next_node(send_data_struct, sq->cls); - // 导入外部网络传输的子句 - vec clauses; - if(receive_clauses_from_last_node(receive_request, buf, clauses)) { - for (int j = 0; j < sq->consumers.size(); j++) { - for (int k = 0; k < clauses.size(); k++) - clauses[k]->increase_refs(1); - sq->consumers[j]->import_clauses_from(clauses); - } + // // 导入外部网络传输的子句 + // vec clauses; + // if(receive_clauses_from_last_node(receive_request, buf, clauses)) { + // for (int j = 0; j < sq->consumers.size(); j++) { + // for (int k = 0; k < clauses.size(); k++) + // clauses[k]->increase_refs(1); + // sq->consumers[j]->import_clauses_from(clauses); + // } - // 传递外部网络传输的子句给下个节点 - share_clauses_to_next_node(send_data_struct, clauses); + // // 传递外部网络传输的子句给下个节点 + // share_clauses_to_next_node(send_data_struct, clauses); - for (int k = 0; k < clauses.size(); k++) { - clauses[k]->free_clause(); - } - } + // for (int k = 0; k < clauses.size(); k++) { + // clauses[k]->free_clause(); + // } + // } - // 导入当前节点产生的子句 int percent = sq->sort_clauses(i); if (percent < 75) {