Skip to content
Snippets Groups Projects
Commit 637c1c3c authored by Prakalp Srivastava's avatar Prakalp Srivastava
Browse files

Fixed writing output to file in opencl version

parent e10ea014
No related branches found
No related tags found
No related merge requests found
......@@ -278,7 +278,7 @@ int setup(int argc, char **argv) {
}
fwrite(&max_nclusters, sizeof(int), 1, outfile);
fwrite(&nfeatures, sizeof(int), 1, outfile);
fwrite(cluster_centres, sizeof(float), max_nclusters*nfeatures, outfile);
fwrite(&cluster_centres[0][0], sizeof(float), max_nclusters*nfeatures, outfile);
fclose(outfile);
//printf("\n================= Centroid Coordinates =================\n");
//for(i = 0; i < max_nclusters; i++) {
......@@ -292,7 +292,6 @@ int setup(int argc, char **argv) {
len = (float) ((max_nclusters - min_nclusters + 1)*nloops);
printf("Number of Iteration: %d\n", nloops);
//printf("Time for I/O: %.5fsec\n", io_timing);
//printf("Time for Entire Clustering: %.5fsec\n", cluster_timing);
......
......@@ -33,7 +33,7 @@ def Run():
fy = struct.unpack("i", dy[4:8])[0]
except:
Exit(False)
data_r = hx.read()
data_c = hy.read()
......@@ -50,13 +50,13 @@ def Run():
print "Compare: sanity check failed"
Exit(False)
for i in range(0, lx*fx*4, 4):
r = struct.unpack('f', data_r[i:i+4])[0]
c = struct.unpack('f', data_c[i:i+4])[0]
r = struct.unpack('<'+'f'*(lx*fx), data_r)
c = struct.unpack('<'+'f'*(lx*fx), data_c)
for i in range(0, lx*fx):
diff = abs(r - c)
if not (diff <= tol_diff or diff < tol_ratio * abs(r)):
print r, c, "at" , (i/4)/fx, (i/4)%fx
diff = abs(r[i] - c[i])
if not (diff <= tol_diff or diff < tol_ratio * abs(r[i])):
print i/fx, i%fx, ":" , r[i] , c[i]
Exit(False)
Exit(True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment