i m getting problem solving this out... if somenone please help me run this
program using MPI so to reduce execution time......help will be
appreaciated.....
#include "libs/first.h"
#include "mpi.h"
// Initialize broadly used libraries, etc
// This also initializes the parameters file.
// Then define all the different surface generators we're using:
#include "geometry.h"
// (Actually, most geometry for this setup is defined within Main.
// And source field generators:
#include "libs/esourcelib.h"
// Make fixed buffers. Need at least three for calculating interference
// patterns (or two for self-interference.) One as source, and two to
calculate two interfering
// fields, if we want to have a split interferometer style pattern.
// (the 'fld' stands for field) (For now, just two fields.)
surface surf1;
surface surf2;
EBS ebs1;
EBS ebs2;
int main(int argc, char *argv[])
{
int done = 0, n, myid, numprocs, i;
double startwtime = 0.0, endwtime;
int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
MPI_Comm_rank(MPI_COMM_WORLD,&myid);
MPI_Get_processor_name(processor_name,&namelen);
double gamma = 5;
double bunchR = .001;
double filenum = 1;
if (argc == 2) {
filenum = atoi(argv[1]);
}
else {
return 1;
}
double lamda = double(filenum)*134e-6 + 300e-6; // Pick wavelength
based on index.
// Also need to intelligently select radius of "big window" to get ~all
radiation.
double rscanmax;
if (.081534 > lamda * gamma * gamma)
rscanmax = 3.0 * .081534 / gamma;
else
rscanmax = 3.0 *sqrt(.081534*lamda);
if (rscanmax < .015)
rscanmax = .015;
// Then define some different shapes using libraries,
// as they apply to the "simplified model".
parabolicGen parabola2 = {
.0508,
.0762,
0,
90,
0,
{-.428625, .1524, .0508}
};
planeGen quartzWindowBig = {
2*rscanmax,
2*rscanmax,
{1,0,0},
-90,
{0,0,0},
0,
{0,.081534,0},
rscanmax
};
planeGen finalDetectorFocus = {
.00635,
.00635,
{0,0,1},
.001,
{0,0,0},
0,
{-.428625, .1524, .0508},
.00317
};
planeGen foil2 = {
.1,
.1,
{1,0,0},
45,
{0,0,0},
0,
{0,0,0},
.05
};
rintf("%d\t%d\t%s\n",myid,numprocs,processor_name);
foil2.makePlane(&surf1); // Turn surf1 into the foil
// Zero out (initialize) both field object buffers.
zeroFillField(&ebs1);
zeroFillField(&ebs2);
double eLocation[3] = {0,0,-0.0001}; // Specificy where the relativistic
electron is (not exactly zero to avoid singularity)
relZChgField(&ebs1, &surf1, eLocation, gamma, lamda); // Fill ebs1 with
field of rel. elec. at surf1 location.
makePoyntingVector(&ebs1); // Once complex E and B are stored in ebs1,
must calculate poynting vector S in khat direction.
ebs1.doReflection(&surf1); // Foil is reflective surface.
quartzWindowBig.makePlane(&surf2); // Make "big quartz window". For
output only to get an integrated reference.
transportFromTo(&surf1, &ebs1, &surf2, &ebs2, lamda); // Transport field
at foil to the "big window"
char fileHeader1[500], filename1[50];
sprintf(fileHeader1, "Lamda= %.6g Gamma= %.6g BigWindow", lamda, gamma);
sprintf(filename1, "%.1idtr%.2g.dat", 1, filenum);
ebs2.exportIntensity(&surf2, filename1, fileHeader1); // Output
intensity at surf2.
quartzWindow.makePlane(&surf2); //Now use surf2 as the physical
quartzwindow.
transportFromTo(&surf1, &ebs1, &surf2, &ebs2, lamda); // Transport field
at foil to smaller window grid at surf2.
char fileHeader2[500], filename2[50];
sprintf(fileHeader2, "Lamda= %.6g Gamma= %.6g LilWindow", lamda, gamma);
sprintf(filename2, "%.1idtr%.2g.dat", 2, filenum);
ebs2.exportIntensity(&surf2, filename2, fileHeader2); // Save this
intensity data.
para1.makeParabola(&surf1); // Now using quartz window (surf2, ebs2) as
source. Make surf1 the first parabolic mirror.
transportFromTo(&surf2, &ebs2, &surf1, &ebs1, lamda); // Transport field
at window to first mirror (surf1).
ebs1.doReflection(&surf1); // It's a mirror, so do reflection.
parabola2.makeParabola(&surf2); // Now use surf1 as source, making surf2
the new output.
transportFromTo(&surf1, &ebs1, &surf2, &ebs2, lamda); // Transport the
image from the first parabolic mirror to the second one.
ebs2.doReflection(&surf2); // Again, it's a mirror, so reflect the
radiation.
printf("%d\t%d\t%s\n",myid,numprocs,processor_name);
finalDetectorFocus.makePlane(&surf1); // Now make detector plane the new
recipient at surf1 using surf2 as source.
transportFromTo(&surf2, &ebs2, &surf1, &ebs1, lamda); // Transport image
from second parabolic mirror to the detecting region.
char fileHeader3[500], filename3[50];
sprintf(fileHeader3, "Lamda= %.6g Gamma= %.6g Focus", lamda, gamma);
sprintf(filename3, "%.1idtr%.2g.dat", 3, filenum);
ebs1.exportIntensity(&surf1, filename3, fileHeader3); // Save the
distribution at final detector.
printf("%d\t%d\t%s\n",myid,numprocs,processor_name);
MPI_Finalize();
return 0;
}
please help me.....
|