main.cpp 1.47 KB
Newer Older
qon's avatar
qon committed
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
#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[])
{
    /**************************************************************************************/
    /*********************************  Main BioEM code **********************************/
    /************************************************************************************/

#pragma omp parallel
	{
		_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); //Flush denormals to zero in all OpenMP threads
	}
    HighResTimer timer;

    bioem* bio;
    if (getenv("GPU") && atoi(getenv("GPU")))
    {
		bio = bioem_cuda_create();
    }
    else
    {
        bio = new bioem;
	}

    /************  Configuration and Pre-calculating necessary objects *****************/
    printf("Configuring\n");
    bio->configure(argc,argv);

    /*******************************  Run BioEM routine ******************************/
    printf("Running\n");
    timer.Start();
    bio->run();
    timer.Stop();

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

    return(0);
}