-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
68 lines (52 loc) · 1.41 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Buttons:
// q/Esc - exit
// s - print summary
// i - print best and iteration
// r/spacebar - draw best
#include <stdlib.h> // srand
#include <time.h> // time
#include "globals.h" // DIM, ...
#ifdef USE_OMP
#include <omp.h>
#endif
#ifdef USE_MPI
#include <mpi.h>
#endif
// GLUT and OpenGL libraries
#include <GL/glut.h>
#include <GL/gl.h>
#include "evolution.h" // init
#include "glut_impl.h" // display, reshape, ...
// ----------------------------------------------------------------------------
int main (int argc, char **argv) {
srand ( (unsigned int)time(NULL) );
#ifdef USE_OMP
// Set dynamic thread count
omp_set_dynamic(1);
// Set maximum thread count
omp_set_num_threads(thread_count);
#endif
#ifdef USE_MPI
//init wymagany
MPI_Init(&argc,&argv);
//pobierz id i iloœæ zadañ
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_node_id);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_node_count);
#endif
// Init data
init(argc, argv);
// Glut initializations
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition (100, 100);
glutInitWindowSize (DIM, DIM);
// Main window creation and setup
glutCreateWindow ("Evo-salesman");
glutDisplayFunc (display);
glutReshapeFunc (reshape);
glutKeyboardFunc (keyboard);
glutIdleFunc (idle);
//fprintf(stderr, "Init success\n");
glutMainLoop();
return 0;
}