同步代码

This commit is contained in:
YuhangQ 2023-03-30 10:50:38 +00:00
parent 1c01d8ed1f
commit 4101767f0b
5 changed files with 27 additions and 24 deletions

View File

@ -1,8 +1,9 @@
FROM satcomp-infrastructure:common FROM satcomp-infrastructure:common
USER root USER root
# Install required softwares # Install required softwares
RUN apt-get update \ RUN apt update
&& DEBIAN_FRONTEND=noninteractive apt install -y cmake build-essential zlib1g-dev libopenmpi-dev wget unzip build-essential zlib1g-dev cmake python3 build-essential gfortran wget curl libboost-all-dev RUN DEBIAN_FRONTEND=noninteractive apt install -y cmake build-essential zlib1g-dev libopenmpi-dev wget unzip python3 gfortran curl
RUN apt install -y libboost-all-dev
WORKDIR / WORKDIR /
@ -17,4 +18,4 @@ RUN ./configure
RUN make -j 16 RUN make -j 16
WORKDIR /cloud-sat/ WORKDIR /cloud-sat/
RUN make -j RUN make -j 16

View File

@ -4,6 +4,8 @@ USER root
FROM satcomp-infrastructure:leader AS mallob_liaison FROM satcomp-infrastructure:leader AS mallob_liaison
WORKDIR / WORKDIR /
COPY ./files /competition/files
COPY --from=builder /cloud-sat/light light COPY --from=builder /cloud-sat/light light
COPY --chown=ecs-user ./init_leader.sh /competition/init_solver.sh COPY --chown=ecs-user ./init_leader.sh /competition/init_solver.sh

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
mpirun --host worker1,worker2,worker3 light -i ./files/class_1_easy_10_0.cnf mpirun --host worker1,worker2,worker3 /light -i ./files/class_1_easy_10_0.cnf

View File

@ -33,21 +33,21 @@ void leader_main(light* S, int num_procs, int rank) {
printf("[leader] reading and do simplify ...\n"); printf("[leader] reading and do simplify ...\n");
// read file // read file
std::stringstream ss; // std::stringstream ss;
do_simplify(S, ss); // do_simplify(S, ss);
const auto& str_ref = ss.str(); // const auto& str_ref = ss.str();
const char* cstr = str_ref.c_str(); // const char* cstr = str_ref.c_str();
printf("[leader] hand out simplified cnf ...\n"); // printf("[leader] hand out simplified cnf ...\n");
HeartBeat *hb = new HeartBeat(num_procs); // HeartBeat *hb = new HeartBeat(num_procs);
printf("[leader] waiting for connection...\n"); // printf("[leader] waiting for connection...\n");
hb->waiting_all(); // hb->waiting_all();
for(int i=1; i<=10; i++) { // for(int i=1; i<=10; i++) {
printf("[leader] check: %d\n", i); // printf("[leader] check: %d\n", i);
hb->update(); // hb->update();
std::this_thread::sleep_for(std::chrono::seconds(1)); // std::this_thread::sleep_for(std::chrono::seconds(1));
} // }
} }

View File

@ -12,16 +12,16 @@ void worker_main(light* S, int num_procs, int rank) {
printf("[worker] i'm worker\n"); printf("[worker] i'm worker\n");
std::this_thread::sleep_for(std::chrono::seconds(1)); // std::this_thread::sleep_for(std::chrono::seconds(1));
time_t now = time(NULL); // time_t now = time(NULL);
MPI_Send(&now, 1, MPI_INT, 0, 0, MPI_COMM_WORLD); // MPI_Send(&now, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
int buf[2]; // int buf[2];
MPI_Recv(buf, 2, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); // MPI_Recv(buf, 2, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
int next = buf[0], last = buf[1]; // int next = buf[0], last = buf[1];
printf("my %d next: %d last: %d\n", rank, next, last); // printf("my %d next: %d last: %d\n", rank, next, last);
int res = S->run(); int res = S->run();
if (res == 10) { if (res == 10) {