OpenAtom  Version1.5a
util.h File Reference
#include "converse.h"
#include "ckcomplex.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <fftw.h>
#include <rfftw.h>
#include <charm++.h>
#include "../../include/RunDescriptor.h"
#include "configure.h"

Go to the source code of this file.

Classes

class  size2d
 == Size or location in a regular 2D array More...
 
class  array2d< T >
 == Regular rectangular 2D array More...
 

Macros

#define CAREFUL   1
 much hate for this
 
#define ENERGY_EHART   0
 
#define ENERGY_ENL   1
 
#define ENERGY_EKE   2
 
#define ENERGY_EGGA   3
 
#define ENERGY_EEXC   4
 
#define ENERGY_EEXT   5
 
#define ENERGY_EWD   6
 
#define ENERGY_FMAG   7
 
#define ENERGY_FICTEKE   8
 
#define NUM_ENERGIES   9
 
#define MAX_CHAR_ARRAY_LENGTH   1024
 

Functions

 PUPbytes (size2d)
 
void make_rho_runs (CPcharmParaInfo *sim)
 == rho space run descriptors for spherical cutoff fft support More...
 
void get_rho_kvectors (double ecut4, double *hmati, int **kx_ret, int **ky_ret, int **kz_ret, int *nline_tot_ret, int *nPacked_ret, int ka_max, int kb_max, int kc_max)
 
void readStateInfo (int &, int &, int &, int &, int &, int &, const char *, int)
 == input/output routines, including states, run descriptors, and line balancing
 
void readStateIntoRuns (int, int, complex *, CkVec< RunDescriptor > &, const char *, int, int *, int *, int *, int *, int *, int *, int **, int **, int **, int **, int **, int, int, int, int, int)
 
void readState (int nPacked, complex *arrCP, const char *fromFile, int ibinary_opt, int *nline_tot_ret, int *nplane_ret, int *kx, int *ky, int *kz, int *nx_ret, int *ny_ret, int *nz_ret, int *istrt_lgrp, int *iend_lgrp, int *npts_lgrp, int *nline_lgrp, int iget_decomp, int iget_vstate)
 
void create_line_decomp_descriptor (CPcharmParaInfo *sim)
 /////////////////////////////////////////////////////////////////////////cc More...
 
void sort_kxky (int, int *, int *, int *, int *, int)
 
void writeStateFile (int, complex *, complex *, int *, int *, int *, int, int, int, int, char *, char *, int, int, int, int, int, int, int)
 
void sort_psi_output (int, int *, int *, int *, int *, int *, int *)
 
void getSplitDecomp (int *, int *, int *, int, int, int)
 Initialization Function /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////.
 
void create_subPlane_decomp (int, int *, int *, int, int *, int *, int *, int **, int)
 Create some decompositions and find the best one. /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////. More...
 
void score_subPlane_decomp (int, int, int *, int *, int *, int **, int *)
 Score a decomposition /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////. More...
 
void create_gx_decomp (int, int, int *, int *, int, int *)
 
void processState (int, int, complex *, const char *, int, int *, int *, int *, int *, int *, int *, int *, int *, int *, int, int, int, int)
 
FILE * openScreenfWrite (const char *dirnameBase, const char *fname, int temper, int bead, bool beadfile)
 this stuff is in a C file because multiple includes of .def will give you too many implementations of this tiny thing for linktime joy
 

Function Documentation

void create_gx_decomp ( int  ,
int  ,
int *  ,
int *  ,
int  ,
int *   
)

count the pts in the lines

Find the best division

= Store the good decomposition

Definition at line 2403 of file util.C.

Referenced by make_rho_runs().

void create_line_decomp_descriptor ( CPcharmParaInfo sim)

/////////////////////////////////////////////////////////////////////////cc

Set the file name and data points

Get the complex data, Psi(g) and the run descriptor (z-lines in g-space)

setup the non-local stuff

Create the line decomposition and a sorted run descriptor There are two rundescriptors per line : Noah's arc sort

Figure out the unique/redundent communication : Send out the unique : Receive and over write the redudant.

Pack up the stuff, clean up the memory and exit

Definition at line 1651 of file util.C.

References readStateIntoRuns().

void create_subPlane_decomp ( int  ,
int *  ,
int *  ,
int  ,
int *  ,
int *  ,
int *  ,
int **  ,
int   
)

Create some decompositions and find the best one. /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////.

try out some several decomps and find the best

Definition at line 2295 of file util.C.

References score_subPlane_decomp().

Referenced by make_rho_runs().

void get_rho_kvectors ( double  ecut4,
double *  hmati,
int **  kx_ret,
int **  ky_ret,
int **  kz_ret,
int *  nline_tot_ret,
int *  nPacked_ret,
int  ka_max,
int  kb_max,
int  kc_max 
)

count the k-vectors : preserve nice symmetry for non-cubic boxes even though you need more kvectors

fill the k-vectors

Count the lines

Set return values

Definition at line 777 of file util.C.

Referenced by make_rho_runs().

void make_rho_runs ( CPcharmParaInfo sim)

== rho space run descriptors for spherical cutoff fft support

== set up the rho kvectors


Reorder the kvectors to produce better balance for the lines :


Create runs using reorder k-vectors


Decompose lines to balance points

Create the line decomposition and a sorted run descriptor There are two rundescriptors per line : Noah's arc sort

variables that could be used for mapping but aren't yet.

Check for rhoghelper size

Rejigger the stuff for subplane parallelization : RHOG

nt pts sent from subplane to g-chare

Pack up the stuff

Analyze the Send and Receives

Clean up the memory

Definition at line 34 of file util.C.

References create_gx_decomp(), create_subPlane_decomp(), ParaGrpParse::get_chareG_line_prms(), get_rho_kvectors(), and getSplitDecomp().

void processState ( int  ,
int  ,
complex ,
const char *  ,
int  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int  ,
int  ,
int  ,
int   
)

== Set up some variables


Add the bottom half of plane zero because the code likes to have it.


Process the state data


Reorder the data to produce better balance for the lines :


Decompose if necessary : note istrt_lgrp, iend_lgrp only define when iget_decomp==1


For each decomposd chunk : sort on kx note istrt_lgrp, iend_lgrp only define when iget_decomp==1


Debug output


Fix !double pack


A little output to the screen!

Definition at line 1332 of file util.C.

References ParaGrpParse::flip_data_set(), ParaGrpParse::get_chareG_line_prms(), and sort_kxky().

Referenced by CP_State_GSpacePlane::readFile(), readState(), and readStateIntoRuns().

void readState ( int  nPacked,
complex arrCP,
const char *  fromFile,
int  ibinary_opt,
int *  nline_tot_ret,
int *  nplane_ret,
int *  kx,
int *  ky,
int *  kz,
int *  nx_ret,
int *  ny_ret,
int *  nz_ret,
int *  istrt_lgrp,
int *  iend_lgrp,
int *  npts_lgrp,
int *  nline_lgrp,
int  iget_decomp,
int  iget_vstate 
)

== A little screen output for the fans


First read in the state and k-vectors : allows parsing of doublePack option

Definition at line 1108 of file util.C.

References processState().

Referenced by CP_State_GSpacePlane::readFile(), and readStateIntoRuns().

void readStateIntoRuns ( int  ,
int  ,
complex ,
CkVec< RunDescriptor > &  ,
const char *  ,
int  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int **  ,
int **  ,
int **  ,
int **  ,
int **  ,
int  ,
int  ,
int  ,
int  ,
int   
)

== A little screen output for the fans


First read in the state and k-vectors : allows parsing of doublePack option


Read the state into the rundescriptor puppy dog


A little output to the screen!

Definition at line 862 of file util.C.

References processState(), and readState().

Referenced by create_line_decomp_descriptor().

void score_subPlane_decomp ( int  ,
int  ,
int *  ,
int *  ,
int *  ,
int **  ,
int *   
)

Score a decomposition /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////.

Count the sends

Find the total number of send/recvs

Definition at line 2365 of file util.C.

Referenced by create_subPlane_decomp().

void sort_kxky ( int  ,
int *  ,
int *  ,
int *  ,
int *  ,
int   
)

Sort on kx

Sort on ky for each kx

Definition at line 2192 of file util.C.

Referenced by processState().

void sort_psi_output ( int  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *  ,
int *   
)

Find max and min

Create a sortable 1d array and sort

Find g=0 term

Definition at line 2149 of file util.C.