cloud-sat/src/main.cpp

31 lines
594 B
C++
Raw Normal View History

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-03-29 07:12:33 +00:00
MPI_Finalize();
2023-03-26 19:15:17 +08:00
return 0;
}