1 : |
agomez |
1 |
#include "mpi.h"
|
2 : |
|
|
#include "paramin.h" |
3 : |
|
|
#include "optimizer.h" |
4 : |
|
|
#include "errorhandler.h"
|
5 : |
|
|
|
6 : |
|
|
ErrorHandler handle;
|
7 : |
|
|
|
8 : |
|
|
int main(int argc, char* argv[]) {
|
9 : |
|
|
// Tékka hvort viðföng séu í lagi þegar mpirun er notað.
|
10 : |
|
|
//cout << "argc = " << argc << endl;
|
11 : |
|
|
// for(int i = 0; i < argc; i++)
|
12 : |
|
|
// cout << "argv[" << i << "] = " << argv[i] << endl;
|
13 : |
|
|
time_t startExec;
|
14 : |
|
|
startExec = time(NULL);
|
15 : |
|
|
cout << "Starting Paramin version " << PARAMINVERSION << " at " << ctime(&startExec) << endl;
|
16 : |
|
|
int i;
|
17 : |
|
|
NetCommunication* net;
|
18 : |
|
|
Optimizer* optimize;
|
19 : |
|
|
NetInterface* netInt;
|
20 : |
|
|
ProcessManager* processM;
|
21 : |
|
|
CommandLineInfo* commandline;
|
22 : |
|
|
commandline = new CommandLineInfo();
|
23 : |
|
|
// Find out options given on command line
|
24 : |
|
|
commandline->read(argc, argv);
|
25 : |
|
|
net = new MasterCommunication(commandline);
|
26 : |
|
|
processM = new WorkLoadScheduler(commandline);
|
27 : |
|
|
netInt = new NetInterface(net, processM, commandline);
|
28 : |
|
|
optimize = new Optimizer(commandline, netInt);
|
29 : |
|
|
optimize->OptimizeFunc();
|
30 : |
|
|
optimize->printResult();
|
31 : |
|
|
|
32 : |
|
|
// clean up
|
33 : |
|
|
delete netInt;
|
34 : |
|
|
delete processM;
|
35 : |
|
|
delete net;
|
36 : |
|
|
delete optimize;
|
37 : |
|
|
|
38 : |
|
|
time_t stopExec;
|
39 : |
|
|
stopExec = time(NULL);
|
40 : |
|
|
cout << "\nParamin finished at " << ctime(&stopExec) << "The time taken for this Paramin run was "
|
41 : |
|
|
<< difftime(stopExec, startExec) << " seconds\n\n";
|
42 : |
|
|
// Write time to outputfile specified G.E.
|
43 : |
|
|
ofstream outfile;
|
44 : |
|
|
outfile.open(commandline->getOutputFilename(),ios::out | ios::app);
|
45 : |
|
|
delete commandline;
|
46 : |
|
|
outfile << "; Time taken for Paramin was: " << difftime(stopExec, startExec) << " seconds\n\n";
|
47 : |
|
|
outfile.close();
|
48 : |
|
|
return EXIT_SUCCESS;
|
49 : |
|
|
}
|