main.cpp 1.43 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[])
{
Pilar Cossio's avatar
Pilar Cossio committed
24
25
26
	//*************************************************************************************
	//*********************************  Main BioEM code **********************************
	//*************************************************************************************
27

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

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

Pilar Cossio's avatar
Pilar Cossio committed
48
	//************  Configuration and Pre-calculating necessary objects *********************
49
	printf("Configuring\n");
50
	bio->configure(argc, argv);
51

Pilar Cossio's avatar
Pilar Cossio committed
52
	//*******************************  Run BioEM routine ************************************
53
54
55
56
	printf("Running\n");
	timer.Start();
	bio->run();
	timer.Stop();
57

Pilar Cossio's avatar
Pilar Cossio committed
58
	//************************************ End ***********************************************
59
60
	printf ("The code ran for %f seconds.\n", timer.GetElapsedTime());
	delete bio;
61

62
	return(0);
63
}