41 lines
770 B
C++
41 lines
770 B
C++
//
|
|
// main.cpp
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 20.09.18.
|
|
// Copyright © 2018 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#include "simulation.hpp"
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char *argv[]) {
|
|
MPI_Init(&argc, &argv);
|
|
|
|
int size, rank;
|
|
MPI_Comm_size(MPI_COMM_WORLD,&size);
|
|
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
|
|
if (rank==0) {
|
|
cout<<"Number CPUs: "<<size<<"\n"<<endl;
|
|
}
|
|
|
|
/*
|
|
std::cout << "Process " << getpid() << " is " << rank
|
|
<< " of " << size << " processes" << std::endl;
|
|
if (rank == 0) sleep(600);
|
|
*/
|
|
|
|
Simulation Sim;
|
|
|
|
int start_time = MPI_Wtime();
|
|
Sim.doit();
|
|
if (rank == 0) {
|
|
cout<<"Total Time: "<<MPI_Wtime()-start_time<<" s\n";
|
|
}
|
|
MPI_Finalize();
|
|
return 0;
|
|
}
|