OpenAtom  Version1.5a
util.C File Reference
#include "src_piny_physics_v1.0/include/class_defs/piny_constants.h"
#include "util.h"
#include "para_grp_parse.h"
#include "main/CPcharmParaInfoGrp.h"
#include "src_piny_physics_v1.0/friend_lib/proto_friend_lib_entry.h"
#include "src_mathlib/mathlib.h"
#include "src_piny_physics_v1.0/include/class_defs/allclass_gen.h"
#include "src_piny_physics_v1.0/include/class_defs/allclass_cp.h"
#include "src_piny_physics_v1.0/include/class_defs/PINY_INIT/PhysicsParamTrans.h"
#include <assert.h>
#include "src_piny_physics_v1.0/include/class_defs/allclass_strip_gen.h"
#include "src_piny_physics_v1.0/include/class_defs/allclass_strip_cp.h"

Go to the source code of this file.

Macros

#define CHARM_ON
 
#define M_PI   3.14159265358979323846
 

Functions

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 readStateIntoRuns (int nPacked, int ncoef, complex *arrCP, CkVec< RunDescriptor > &runs, const char *fromFile, int ibinary_opt, int *nline_tot_ret, int *nplane_ret, int *istrt_lgrp, int *iend_lgrp, int *npts_lgrp, int *nline_lgrp, int **kx_line_ret, int **ky_line_ret, int **kx_ret, int **ky_ret, int **kz_ret, int iget_decomp, int gen_wave, int nx_in, int ny_in, int nz_in)
 
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 processState (int nPacked, int nktot, complex *arrCP, const char *fromFile, int ibinary_opt, int *nline_tot_ret, int *nplane_ret, int *kx, int *ky, int *kz, int *istrt_lgrp, int *iend_lgrp, int *npts_lgrp, int *nline_lgrp, int iget_decomp, int iget_vstate, int iopt, int ny)
 
void create_line_decomp_descriptor (CPcharmParaInfo *sim)
 /////////////////////////////////////////////////////////////////////////cc More...
 
void writeStateFile (int ncoef, complex *psi, complex *vpsi, int *k_x, int *k_y, int *k_z, int cp_min_opt, int sizeX, int sizeY, int sizeZ, char *psiName, char *vpsiName, int ibinary_write_opt, int iteration, int istate, int ispin, int ikpt, int ibead, int itemper)
 
void sort_psi_output (int n, int *kx, int *ky, int *kz, int *index, int *ktemp, int *istrt_ret)
 
void sort_kxky (int n, int *kx, int *ky, int *index, int *ktemp, int sizeY)
 
void sort_kxky_old (int n, int *kx, int *ky, int *index, int *kyt)
 
void getSplitDecomp (int *istrt_ret, int *iend_ret, int *n_ret, int ntot, int ndiv, int idiv)
 Initialization Function /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////.
 
void create_subPlane_decomp (int nplane_x, int *listGx, int *mapGrpGx, int nchareRhoGEext, int *numSubGx, int *nline_lgrp_eext, int *kx_line, int **nline_send_eext_y, int rhoRsubplanes)
 Create some decompositions and find the best one. /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////. More...
 
void score_subPlane_decomp (int nchareRhoGEext, int rhoRsubplanes, int *nline_lgrp_eext, int *mapGrpGx, int *kx_line, int **nline_send_eext_y, int *Rhart_max)
 Score a decomposition /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////. More...
 
void create_gx_decomp (int nktot, int nline, int *kx_line, int *mapl, int nchare, int *nline_grp)
 
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
 

Variables

Config config
 addtogroup Uber More...
 
int sizeX
 

Function Documentation

void create_gx_decomp ( int  nktot,
int  nline,
int *  kx_line,
int *  mapl,
int  nchare,
int *  nline_grp 
)

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  nplane_x,
int *  listGx,
int *  mapGrpGx,
int  nchareRhoGEext,
int *  numSubGx,
int *  nline_lgrp_eext,
int *  kx_line,
int **  nline_send_eext_y,
int  rhoRsubplanes 
)

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  nPacked,
int  nktot,
complex arrCP,
const char *  fromFile,
int  ibinary_opt,
int *  nline_tot_ret,
int *  nplane_ret,
int *  kx,
int *  ky,
int *  kz,
int *  istrt_lgrp,
int *  iend_lgrp,
int *  npts_lgrp,
int *  nline_lgrp,
int  iget_decomp,
int  iget_vstate,
int  iopt,
int  ny 
)

== 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  nPacked,
int  ncoef,
complex arrCP,
CkVec< RunDescriptor > &  runs,
const char *  fromFile,
int  ibinary_opt,
int *  nline_tot_ret,
int *  nplane_ret,
int *  istrt_lgrp,
int *  iend_lgrp,
int *  npts_lgrp,
int *  nline_lgrp,
int **  kx_line_ret,
int **  ky_line_ret,
int **  kx_ret,
int **  ky_ret,
int **  kz_ret,
int  iget_decomp,
int  gen_wave,
int  nx_in,
int  ny_in,
int  nz_in 
)

== 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  nchareRhoGEext,
int  rhoRsubplanes,
int *  nline_lgrp_eext,
int *  mapGrpGx,
int *  kx_line,
int **  nline_send_eext_y,
int *  Rhart_max 
)

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  n,
int *  kx,
int *  ky,
int *  index,
int *  ktemp,
int  sizeY 
)

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  n,
int *  kx,
int *  ky,
int *  kz,
int *  index,
int *  ktemp,
int *  istrt_ret 
)

Find max and min

Create a sortable 1d array and sort

Find g=0 term

Definition at line 2149 of file util.C.