bioem.h 2.79 KB
Newer Older
1 2 3 4 5
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   < BioEM software for Bayesian inference of Electron Microscopy images>
   Copyright (C) 2016 Pilar Cossio, David Rohr, Fabio Baruffa, Markus Rampp, 
        Volker Lindenstruth and Gerhard Hummer.
   Max Planck Institute of Biophysics, Frankfurt, Germany.
Pilar Cossio's avatar
Pilar Cossio committed
6 7
   Frankfurt Institute for Advanced Studies, Goethe University Frankfurt, Germany.
   Max Planck Computing and Data Facility, Garching, Germany. 
8

Pilar Cossio's avatar
Pilar Cossio committed
9
   Released under the GNU Public License, v3. 
10 11 12 13
   See license statement for terms of distribution.

   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

14 15 16 17 18 19 20 21 22 23 24
#ifndef BIOEM_H
#define BIOEM_H

#include "defs.h"
#include "bioem.h"
#include "model.h"
#include "map.h"
#include "param.h"

class bioem
{
25
	friend class bioem_RefMap;
David Rohr's avatar
David Rohr committed
26
	friend class bioem_Probability;
27

28
public:
29 30 31 32
	bioem();
	virtual ~bioem();

	int configure(int ac, char* av[]);
33 34
	void cleanup(); //Cleanup everything happening during configure

35 36 37 38
	int precalculate(); // Is it better to pass directly the input File names?
	int dopreCalCrossCorrelation(int iRefMap, int iRefMapLocal);
	int run();
	int doProjections(int iMap);
39
	int createConvolutedProjectionMap(int iOreint, int iMap, mycomplex_t* lproj, myfloat_t* Mapconv, mycomplex_t* localmultFFT, myfloat_t& sumC, myfloat_t& sumsquareC);
40

41
	virtual int compareRefMaps(int iOrient, int iConv, myfloat_t amp, myfloat_t pha, myfloat_t env, const myfloat_t* conv_map, mycomplex_t* localmultFFT, myfloat_t sumC, myfloat_t sumsquareC, const int startMap = 0);
42

43 44
	virtual void* malloc_device_host(size_t size);
	virtual void free_device_host(void* ptr);
Luka Stanisic's avatar
Luka Stanisic committed
45
	virtual void rebalance(int workload); //Rebalance GPUWorkload
46
	void rebalanceWrapper(int workload); //Rebalance wrapper
47

48
	int createProjection(int iMap, mycomplex_t* map);
49
	int calcross_cor(myfloat_t* localmap, myfloat_t& sum, myfloat_t& sumsquare);
50
	void calculateCCFFT(int iMap, int iOrient, int iConv, myfloat_t amp, myfloat_t pha, myfloat_t env, myfloat_t sumC, myfloat_t sumsquareC, mycomplex_t* localConvFFT, mycomplex_t* localCCT, myfloat_t* lCC);
51

52
	bioem_Probability pProb;
53

Pilar Cossio's avatar
Pilar Cossio committed
54 55 56 57
        string OutfileName;
	bool yesoutfilename;


58 59 60 61 62
protected:
	virtual int deviceInit();
	virtual int deviceStartRun();
	virtual int deviceFinishRun();

63 64 65 66 67 68
	bioem_param param;
	bioem_model Model;
	bioem_RefMap RefMap;

	int nReferenceMaps;			//Maps in memory at a time
	int nReferenceMapsTotal;	//Maps in total
69

70 71
	int nProjectionMaps;		//Maps in memory at a time
	int nProjectionMapsTotal;	//Maps in total
72

73 74 75
	int FFTAlgo;				//Use the FFT Algorithm (Default 1)
	int DebugOutput;			//Debug Output Level (Default 2)
	int nProjectionsAtOnce;		//Number of projections to do at once via OpenMP (Default 1)
Luka Stanisic's avatar
Luka Stanisic committed
76
	bool Autotuning;				//Do the autotuning of the load-balancing between CPUs and GPUs
77 78 79
};

#endif