2023-03-26 19:15:17 +08:00
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
#include <thread>
|
|
|
|
#include <fstream>
|
2023-03-29 07:12:33 +00:00
|
|
|
#include <mpi.h>
|
2023-03-26 19:15:17 +08:00
|
|
|
|
2023-03-27 15:44:39 +08:00
|
|
|
#include "light.hpp"
|
2023-03-26 19:15:17 +08:00
|
|
|
#include "utils/cmdline.h"
|
2023-03-27 15:44:39 +08:00
|
|
|
#include "paras.hpp"
|
|
|
|
|
2023-03-30 09:26:46 +00:00
|
|
|
#include "distributed/leader.hpp"
|
|
|
|
#include "distributed/worker.hpp"
|
|
|
|
|
2023-03-29 07:12:33 +00:00
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
int num_procs, rank;
|
|
|
|
MPI_Init(&argc, &argv);
|
|
|
|
MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
|
|
|
|
2023-03-27 15:44:39 +08:00
|
|
|
light* S = new light();
|
|
|
|
S->arg_parse(argc, argv);
|
|
|
|
|
2023-03-30 09:26:46 +00:00
|
|
|
// leader
|
|
|
|
if(rank == 0) leader_main(S, num_procs, rank);
|
|
|
|
else worker_main(S, num_procs, rank);
|
2023-03-26 19:15:17 +08:00
|
|
|
|
2023-04-03 03:14:28 +00:00
|
|
|
|
|
|
|
MPI_Barrier(MPI_COMM_WORLD);
|
2023-03-29 07:12:33 +00:00
|
|
|
MPI_Finalize();
|
|
|
|
|
2023-03-26 19:15:17 +08:00
|
|
|
return 0;
|
|
|
|
}
|