00001
00002
00003
00009
00010
00011
00012
00013
00014
00015 #include <stdlib.h>
00016 #include "ad_bgl.h"
00017 #include "ad_bgl_pset.h"
00018 #include "mpidimpl.h"
00019
00020 ADIOI_BGL_ProcInfo_t *
00021 ADIOI_BGL_ProcInfo_new()
00022 {
00023 ADIOI_BGL_ProcInfo_t *p = (ADIOI_BGL_ProcInfo_t *) ADIOI_Malloc (sizeof(ADIOI_BGL_ProcInfo_t));
00024 AD_BGL_assert ((p != NULL));
00025 return p;
00026 }
00027
00028 ADIOI_BGL_ProcInfo_t *
00029 ADIOI_BGL_ProcInfo_new_n( int n )
00030 {
00031 ADIOI_BGL_ProcInfo_t *p = (ADIOI_BGL_ProcInfo_t *) ADIOI_Malloc (n * sizeof(ADIOI_BGL_ProcInfo_t));
00032 AD_BGL_assert ((p != NULL));
00033 return p;
00034 }
00035
00036 void
00037 ADIOI_BGL_ProcInfo_free( ADIOI_BGL_ProcInfo_t *info )
00038 {
00039 if (info != NULL) ADIOI_Free (info);
00040 }
00041
00042 static
00043 void
00044 ADIOI_BGL_ProcInfo_set(ADIOI_BGL_ProcInfo_t *info, const DCMF_Hardware_t *hw, int r)
00045 {
00046 info->psetNum = hw->idOfPset;
00047 info->xInPset = hw->xCoord;
00048 info->yInPset = hw->yCoord;
00049 info->zInPset = hw->zCoord;
00050 info->cpuid = hw->tCoord;
00051 info->rank = r;
00052 info->rankInPset = hw->rankInPset;
00053 }
00054
00055
00056 ADIOI_BGL_ConfInfo_t *
00057 ADIOI_BGL_ConfInfo_new ()
00058 {
00059 ADIOI_BGL_ConfInfo_t *p = (ADIOI_BGL_ConfInfo_t *) ADIOI_Malloc (sizeof(ADIOI_BGL_ConfInfo_t));
00060 AD_BGL_assert ((p != NULL));
00061 return p;
00062 }
00063
00064 static
00065 void
00066 ADIOI_BGL_ConfInfo_set(ADIOI_BGL_ConfInfo_t *info, const DCMF_Hardware_t *hw, int s, int n_aggrs)
00067 {
00068 info->PsetSize = hw->sizeOfPset;
00069 info->numPsets = (hw->xSize * hw->ySize *
00070 hw->zSize) / hw->sizeOfPset;
00071 info->isVNM = (hw->tSize != 1);
00072 info->cpuidSize = hw->tSize;
00073 info->virtualPsetSize = hw->sizeOfPset * hw->tSize;
00074 info->nProcs = s;
00075
00076
00077 info->nAggrs = n_aggrs;
00078 if ( info->nAggrs <=0 || MIN(info->nProcs, info->virtualPsetSize) < info->nAggrs )
00079 info->nAggrs = ADIOI_BGL_NAGG_PSET_DFLT;
00080 if ( info->nAggrs > info->virtualPsetSize ) info->nAggrs = info->virtualPsetSize;
00081
00082 info->aggRatio = 1. * info->nAggrs / info->virtualPsetSize;
00083 if (info->aggRatio > 1) info->aggRatio = 1.;
00084 }
00085
00086 void
00087 ADIOI_BGL_ConfInfo_free( ADIOI_BGL_ConfInfo_t *info )
00088 {
00089 if (info != NULL) ADIOI_Free (info);
00090 }
00091
00092 void
00093 ADIOI_BGL_persInfo_init(ADIOI_BGL_ConfInfo_t *conf,
00094 ADIOI_BGL_ProcInfo_t *proc,
00095 int s, int r, int n_aggrs)
00096 {
00097 DCMF_Hardware_t hw;
00098 DCMF_Hardware(&hw);
00099
00100 ADIOI_BGL_ConfInfo_set (conf, &hw, s, n_aggrs);
00101 ADIOI_BGL_ProcInfo_set (proc, &hw, r);
00102 }
00103
00104 void
00105 ADIOI_BGL_persInfo_free( ADIOI_BGL_ConfInfo_t *conf, ADIOI_BGL_ProcInfo_t *proc )
00106 {
00107 ADIOI_BGL_ConfInfo_free( conf );
00108 ADIOI_BGL_ProcInfo_free( proc );
00109 }