Commit 8c3c729b authored by David Rohr's avatar David Rohr

improve includes, include mpi.h first, start implementing mpi broadcast to distribute parameters

parent ecd93ef4
......@@ -7,6 +7,14 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#include <mpi.h>
#define MPI_CHK(expr) \
if (expr != MPI_SUCCESS) \
{ \
fprintf(stderr, "Error in MPI function %s: %d\n", __FILE__, __LINE__); \
}
#include <fstream>
#include <boost/program_options.hpp>
#include <iostream>
......@@ -215,7 +223,14 @@ int bioem::configure(int ac, char* av[])
}
#ifdef WITH_MPI
MPI_Bcast(&param, sizeof(param), MPI_BYTE, 0, MPI_COMM_WORLD);
//refCtf, CtfParam, angles automatically filled by precalculare function below
MPI_Bcast(&Model, sizeof(Model), MPI_BYTE, 0, MPI_COMM_WORLD);
Model.points = (bioem_model::bioem_model_point*) mallocchk(sizeof(bioem_model::bioem_model_point) * Model.nPointsModel);
MPI_Bcast(Model.points, sizeof(bioem_model::bioem_model_point) * Model.nPointsModel, MPI_BYTE, 0, MPI_COMM_WORLD);
#endif
if (mpi_rank != 0) return(1);
......
#ifndef BIOEM_H
#define BIOEM_H
#include <fstream>
#include <iostream>
#include <complex>
#include "defs.h"
#include "bioem.h"
......
......@@ -99,15 +99,6 @@ 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;
......
......@@ -39,6 +39,8 @@ public:
int Alignment;
mycomplex_t* refCTF;
myfloat3_t* CtfParam;
size_t getRefCtfCount() {return nTotCTFs * FFTMapSize;}
size_t getCtfParamCount() {return nTotCTFs;}
myfloat_t pixelSize;
// Grid Points in Euler angles, assuming uniform sampling d_alpha=d_gamma (in 2pi) & cos(beta)=-1,1
......
#include <mpi.h>
#define MPI_CHK(expr) \
if (expr != MPI_SUCCESS) \
{ \
fprintf(stderr, "Error in MPI function %s: %d\n", __FILE__, __LINE__); \
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......
......@@ -375,10 +375,10 @@ int bioem_param::CalculateRefCTF()
nTotCTFs = numberGridPointsCTF_amp * numberGridPointsCTF_phase * numberGridPointsEnvelop;
delete[] refCTF;
refCTF = new mycomplex_t[nTotCTFs * FFTMapSize];
refCTF = new mycomplex_t[getRefCtfCount()];
delete[] CtfParam;
CtfParam = new myfloat3_t[nTotCTFs];
CtfParam = new myfloat3_t[getCtfParamCount()];
for (int iamp = 0; iamp < numberGridPointsCTF_amp ; iamp++) //Loop over amplitud
{
amp = (myfloat_t) iamp * gridCTF_amp + startGridCTF_amp;
......
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