75 #include "orthoConfig.h"
76 #include "ortho.decl.h"
77 #include "pcSectionManager.h"
78 #include "CLA_Matrix.h"
79 using namespace cp::ortho;
85 #define INVSQR_TOLERANCE 1.0e-15
86 #define INVSQR_MAX_ITER 10
88 #ifdef CP_PAIRCALC_USES_COMPLEX_MATH
91 #define myabs std::abs
110 Ortho(CkMigrateMessage *m){}
117 CkArrayID step2Helper,
118 int timeKeep, CkGroupID _oMCastGID, CkGroupID _oRedGID);
121 void makeSections(
const pc::pcConfig &cfgSymmPC,
const pc::pcConfig &cfgAsymmPC, CkArrayID symAID, CkArrayID asymAID);
124 void start_calc(CkReductionMsg *msg);
126 void do_iteration(
void);
132 void recvStep2(CkDataMsg *msg);
136 void tolerance_check();
138 void collect_error(CkReductionMsg *msg);
142 void collect_results(
void);
146 void sendOrthoTtoAsymm();
149 void acceptSectionLambda(CkReductionMsg *msg);
154 inline double array_diag_max(
int sizem,
int sizen, internalType *array);
156 void maxCheck(CkReductionMsg *msg);
158 void resumeV(CkReductionMsg *msg);
161 void print_results(
void);
163 virtual void pup(PUP::er &p);
164 void orthoCookieinit(
initCookieMsg *msg) { CkGetSectionInfo(orthoCookie,msg);
delete msg; }
166 void all_ready() {
if(++num_ready == 9) thisProxy.ready(); }
179 static inline void step_3_cb(
void *obj) { ((
Ortho*) obj)->step_3(); }
180 static inline void gamma_done_cb(
void *obj) { ((
Ortho*) obj)->gamma_done(); }
181 static inline void tol_cb(
void *obj)
183 ((
Ortho*) obj)->step3done=
true;
184 if(((
Ortho*) obj)->parallelStep2)
187 if(((
Ortho*) obj)->step2done)
188 ((
Ortho*) obj)->tolerance_check();
191 ((
Ortho*) obj)->tolerance_check();
201 internalType *orthoT;
206 CProxySection_Ortho multiproxy;
207 CkSectionInfo orthoCookie;
219 bool toleranceCheckOrthoT;
220 internalType *A, *B, *C, *tmp_arr;
223 double invsqr_tolerance;
226 #ifdef _CP_ORTHO_DEBUG_COMPARE_TMAT_
229 #ifdef _CP_ORTHO_DEBUG_COMPARE_LMAT_
232 #ifdef _CP_ORTHO_DEBUG_COMPARE_SMAT_
235 #ifdef _CP_ORTHO_DEBUG_COMPARE_GMAT_
243 #include "ckcallback-ccs.h"
251 CmiMemcpy(tmp_arr, msg->getData(), m * n *
sizeof(internalType));
265 snprintf(outname,80,
"tmatrix_t:%d_%d_%d.out",numGlobalIter,thisIndex.x,thisIndex.y);
266 FILE *outfile = fopen(outname,
"w");
267 for(
int i=0; i<m; i++)
268 for(
int j=0; j<n; j++)
269 fprintf(outfile,
"%d %d %.12g \n",i+thisIndex.x*n+1,j+thisIndex.y*n+1, A[i*n+j]);
281 double absval, max_ret;
282 if(thisIndex.x!=thisIndex.y)
284 max_ret = myabs(array[0]);
285 for(
int i=0;i<sizem;i++)
287 for(
int j=0;j<sizen;j++)
289 absval = myabs(array[i*sizen+j]);
290 max_ret = (max_ret>absval) ? max_ret : absval;
296 max_ret = myabs(array[0]-2.0);
297 for(
int i=0;i<sizem;i++)
299 for(
int j=0;j<sizen;j++)
301 absval = myabs(array[i*sizen+j]);
303 absval = myabs(absval - 2.0);
304 max_ret = (max_ret>absval) ? max_ret : absval;
311 #endif // #ifndef _ortho_h_
void ready()
Startup/Init synchronization. When all elements (PC, CLA_Matrix etc) are ready, first iteration is tr...
PCSectionManager asymmSectionMgr
Section of asymmetric PC chare array used by an Ortho chare.
For definition of CkDataMsg.
CProxy_OrthoHelper step2Helper
The proxy of the step 2 helper chare array.
Class that manages the paircalc sections that each Ortho chare communicates with. ...
PCSectionManager symmSectionMgr
Section of symmetric PC chare array used by an Ortho chare.
void do_iteration(orthoMtrigger *m)
Used when array broadcasts in ortho are delegated to comlib/CkMulticast so as to not involve all PEs ...
static void step_2_cb(void *obj)
Static methods used as callbacks. Could be replaced by CkCallbacks.
Ortho()
Default empty constructor. For?
Configuration settings for the ortho world.
void print_results(void)
Dumps the T matrix to an appropriately named file.
bool fakeTorus
readonly defined in cpaimd.C
void collect_results(orthoMtrigger *m)
Used when ortho redn/bcasts are delegated to comlib/CkMulticast because charm array broadcasts involv...
CkGroupID oMCastGID
Group IDs for the multicast manager groups.
double array_diag_max(int sizem, int sizen, internalType *array)
S should be equal to 2I. This returns max value of deviation from that in this ortho's portion of the...
void all_ready()
called from each CLA_Matrix array (3 per multiplication, 3 mults)
Dumb structure that holds all the configuration inputs required for paircalc instantiation, functioning and interaction.
void recvStep2(CkDataMsg *msg)
Receives the results of the call to OrthoHelper from step_2.