main.cpp 1.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <omp.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"
#include <omp.h>

#include "cmodules/timer.h"

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

28
	#pragma omp parallel
29
30
31
	{
		_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); //Flush denormals to zero in all OpenMP threads
	}
32
	HighResTimer timer;
33

34
	bioem* bio;
35
#ifdef WITH_CUDA
36
37
	if (getenv("GPU") && atoi(getenv("GPU")))
	{
38
		bio = bioem_cuda_create();
39
40
	}
	else
41
#endif
42
43
	{
		bio = new bioem;
44
45
	}

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

David Rohr's avatar
David Rohr committed
50
	// *******************************  Run BioEM routine ******************************
51
52
53
54
	printf("Running\n");
	timer.Start();
	bio->run();
	timer.Stop();
55

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

61
	return(0);
62
}