MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / loadParamData

Function loadParamData

src/library/tools/tune/storage_io.c:109–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109int
110loadParamData(HfInfo* file, BlasParamInfo* bParam)
111{
112 int status = 0;
113 int i = 0;
114 int ret = 0;
115 bool dimExist = true;
116
117 for (i =0; i < MAX_SUBDIMS; i++){
118 unsigned int temp;
119 status+= hfRead(file, &temp, 1, sizeof(temp));
120 bParam->sDim[i].x = (size_t)temp;
121 status+= hfRead(file, &temp, 1, sizeof(temp));
122 bParam->sDim[i].y = (size_t)temp;
123 status+= hfRead(file, &temp, 1, sizeof(temp));
124 bParam->sDim[i].itemX = (temp >= SUBDIM_UNUSED_FILE_VALUE)
125 ? SUBDIM_UNUSED
126 : (size_t)temp;
127 status+= hfRead(file, &temp, 1, sizeof(temp));
128 bParam->sDim[i].itemY = (temp >= SUBDIM_UNUSED_FILE_VALUE)
129 ? SUBDIM_UNUSED
130 : (size_t)temp;
131 status+= hfRead(file, &temp, 1, sizeof(temp));
132 bParam->sDim[i].bwidth = (size_t)temp;
133
134 }
135
136 status += hfRead(file, &bParam->pGran, 1, sizeof(PGranularity));
137 status += hfRead(file, bParam->kernel, 1, sizeof(POSFILE) * MAX_CLBLAS_KERNELS_PER_STEP);
138 status += hfRead(file, bParam->kSize, 1, sizeof(bParam->kSize));
139 status += hfRead(file, &bParam->time, 1, sizeof(double) );
140
141 if ((status == FILE_OK) && (bParam->sDim[0].y == 0)) {
142 dimExist = false;
143 }
144
145 status += hfCheckCRC(file);
146
147 if (!dimExist && (status == FILE_ERROR_CRC)) {
148 ret = 1; // file is valid but doesn't have actual data
149 }
150 else if (!checkFile(file, (size_t)bParam->offset + bParam->size, status)) {
151 ret = -1; // file is corrupted
152 }
153 else if (bParam->time > 10000.0) {
154 ret = 1;
155 }
156
157 if (ret) {
158 memset(bParam->sDim, 0, sizeof(SubproblemDim) * MAX_SUBDIMS);
159 memset(&bParam->pGran, 0, sizeof(PGranularity) );
160 memset(bParam->kernel, 0, sizeof(POSFILE) * MAX_CLBLAS_KERNELS_PER_STEP );
161 memset(bParam->kSize, 0, sizeof(unsigned int) * MAX_CLBLAS_KERNELS_PER_STEP );
162
163 bParam->time = 1e50; // any large number;
164 }
165
166 return ret;

Callers 1

readExtraDataFunction · 0.85

Calls 3

hfReadFunction · 0.85
hfCheckCRCFunction · 0.85
checkFileFunction · 0.85

Tested by

no test coverage detected