main.cpp 1.45 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fenv.h>

#ifdef _WIN32
#include <Windows.h>
#include <WinBase.h>
#endif

#include <iostream>
#include <algorithm>
#include <iterator>
#include "bioem.h"
#include "bioem_cuda.h"
17
18

#ifdef WITH_OPENMP
19
#include <omp.h>
20
#endif
21
22
23
24
25

#include "cmodules/timer.h"

int main(int argc, char* argv[])
{
David Rohr's avatar
David Rohr committed
26
27
28
	// **************************************************************************************
	// *********************************  Main BioEM code **********************************
	// ************************************************************************************
29

30
#ifdef _MM_DENORMALS_ZERO_ON
31
	#pragma omp parallel
32
33
34
	{
		_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); //Flush denormals to zero in all OpenMP threads
	}
35
#endif
36
	HighResTimer timer;
37

38
	bioem* bio;
39
#ifdef WITH_CUDA
40
41
	if (getenv("GPU") && atoi(getenv("GPU")))
	{
42
		bio = bioem_cuda_create();
43
44
	}
	else
45
#endif
46
47
	{
		bio = new bioem;
48
49
	}

David Rohr's avatar
David Rohr committed
50
	// ************  Configuration and Pre-calculating necessary objects *****************
51
	printf("Configuring\n");
52
	if (bio->configure(argc, argv)) return(1);
53

David Rohr's avatar
David Rohr committed
54
	// *******************************  Run BioEM routine ******************************
55
56
57
58
	printf("Running\n");
	timer.Start();
	bio->run();
	timer.Stop();
59

David Rohr's avatar
David Rohr committed
60
	// ************************************ End **********************************
61
	printf ("The code ran for %f seconds.\n", timer.GetElapsedTime());
62
	bio->cleanup();
63
	delete bio;
64

65
	return(0);
66
}