main.cpp 1.38 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[])
{
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
	}

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

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

56
57
58
	/************************************ End **********************************/
	printf ("The code ran for %f seconds.\n", timer.GetElapsedTime());
	delete bio;
59

60
	return(0);
61
}