Commit 2b3aa359 authored by David Rohr's avatar David Rohr

make FFTALGO default, add MPI initialization, move allocation of sumsquare...

make FFTALGO default, add MPI initialization, move allocation of sumsquare pointer to precalculate function
parent 6765875d
......@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string>
#include <cmath>
#ifdef WITH_OPENMP
#include <omp.h>
#endif
......@@ -52,6 +53,7 @@ const int num_colors = sizeof(colors)/sizeof(colors[0]);
#define cuda_custom_timeslot(name,cid)
#define cuda_custom_timeslot_end
#endif
#include "bioem_algorithm.h"
using namespace boost;
......@@ -69,13 +71,12 @@ ostream& operator<<(ostream& os, const vector<T>& v)
bioem::bioem()
{
FFTAlgo = getenv("FFTALGO") == NULL ? 0 : atoi(getenv("FFTALGO"));
FFTAlgo = getenv("FFTALGO") == NULL ? 1 : atoi(getenv("FFTALGO"));
DebugOutput = getenv("BIOEM_DEBUG_OUTPUT") == NULL ? 2 : atoi(getenv("BIOEM_DEBUG_OUTPUT"));
}
bioem::~bioem()
{
}
int bioem::configure(int ac, char* av[])
......
......@@ -100,4 +100,16 @@ static inline void* reallocchk(void* oldptr, size_t size)
#define omp_get_thread_num() 0
#endif
#ifdef WITH_MPI
#include <mpi.h>
#define MPI_CHK(expr) \
if (expr != MPI_SUCCESS) \
{ \
fprintf(stderr, "Error in MPI function %s: %d\n", __FILE__, __LINE__); \
}
#endif
extern int mpi_rank;
extern int mpi_size;
#endif
......@@ -19,6 +19,14 @@
#include <omp.h>
#endif
#ifdef WITH_MPI
int mpi_rank;
int mpi_size;
#else
const int mpi_rank = 0;
const int mpi_size = 1;
#endif
#include "cmodules/timer.h"
int main(int argc, char* argv[])
......@@ -27,6 +35,12 @@ int main(int argc, char* argv[])
// ********************************* Main BioEM code **********************************
// ************************************************************************************
#ifdef WITH_MPI
MPI_CHK(MPI_Init(&argc, &argv));
MPI_CHK(MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank));
MPI_CHK(MPI_Comm_size(MPI_COMM_WORLD, &mpi_size));
#endif
#ifdef _MM_DENORMALS_ZERO_ON
#pragma omp parallel
{
......@@ -62,5 +76,9 @@ int main(int argc, char* argv[])
bio->cleanup();
delete bio;
#ifdef WITH_MPI
MPI_Finalize();
#endif
return(0);
}
......@@ -194,9 +194,6 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
cout << "Total Number of particles: " << ntotRefMap;
cout << "\n+++++++++++++++++++++++++++++++++++++++++++ \n";
sum_RefMap = (myfloat_t*) mallocchk(sizeof(myfloat_t) * ntotRefMap);
sumsquare_RefMap = (myfloat_t*) mallocchk(sizeof(myfloat_t) * ntotRefMap);
return(0);
}
......@@ -250,6 +247,9 @@ int bioem_RefMap::precalculate(bioem_param& param, bioem& bio)
// *******************************Precalculating Routine for Maps************************
// **************************************************************************************
sum_RefMap = (myfloat_t*) mallocchk(sizeof(myfloat_t) * ntotRefMap);
sumsquare_RefMap = (myfloat_t*) mallocchk(sizeof(myfloat_t) * ntotRefMap);
myfloat_t sum, sumsquare;
//Precalculating cross-correlations of maps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment