Skip to content

Commit

Permalink
fixed some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Aapo Kyrola committed Jan 22, 2013
1 parent e74a0d4 commit c35db42
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions example_apps/matrix_factorization/als_vertices_inmem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @section DESCRIPTION
*
* Matrix factorizatino with the Alternative Least Squares (ALS) algorithm.
* Matrix factorization with the Alternative Least Squares (ALS) algorithm.
* This code is based on GraphLab's implementation of ALS by Joey Gonzalez
* and Danny Bickson (CMU). A good explanation of the algorithm is
* given in the following paper:
Expand Down Expand Up @@ -102,7 +102,7 @@ struct ALSVerticesInMemProgram : public GraphChiProgram<VertexDataType, EdgeData
* Vertex update function.
*/
void update(graphchi_vertex<VertexDataType, EdgeDataType> &vertex, graphchi_context &gcontext) {
if (gcontext.iteration == 0) {
if (gcontext.iteration == 0) {
/* On first iteration, initialize vertex (and its edges). This is usually required, because
on each run, GraphChi will modify the data files. To start from scratch, it is easiest
do initialize the program in code. Alternatively, you can keep a copy of initial data files. */
Expand Down
2 changes: 1 addition & 1 deletion example_apps/randomwalks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,5 @@ int main(int argc, const char ** argv) {

/* Report execution metrics */
metrics_report(m);
return 0;
return 0;
}
14 changes: 8 additions & 6 deletions src/preprocessing/conversions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ namespace graphchi {
// Read next line
linenum += num + 1;
for(vid_t i=0; i < num; i++) {
fgets(s, maxlen, inf);
s = fgets(s, maxlen, inf);
FIXLINE(s);
vid_t to = atoi(s);
if (from != to) {
Expand Down Expand Up @@ -386,9 +386,10 @@ namespace graphchi {
vid_t from;
vid_t to;

fread(&from, 1, sizeof(vid_t), inf);
fread(&to, 1, sizeof(vid_t), inf);
int res1 = fread(&from, sizeof(vid_t), 1, inf);
int res2 = fread(&to, sizeof(vid_t), 1, inf);

assert(res1 > 0 && res2 > 0);
if (from != to) {
sharderobj.preprocessing_add_edge(from, to, EdgeDataType());
}
Expand Down Expand Up @@ -427,9 +428,10 @@ namespace graphchi {
vid_t to;
EdgeDataType edgeval;

fread(&from, 1, sizeof(vid_t), inf);
fread(&to, 1, sizeof(vid_t), inf);
fread(&edgeval, 1, sizeof(EdgeDataType), inf);
int res1 = fread(&from, sizeof(vid_t), 1, inf);
int res2 = fread(&to, sizeof(vid_t), 1, inf);
int res3 = fread(&edgeval, sizeof(EdgeDataType), 1, inf);
assert(res1 > 0 && res2 > 0 && res3 > 0);
if (from != to) {
sharderobj.preprocessing_add_edge(from, to, edgeval);
}
Expand Down
7 changes: 6 additions & 1 deletion src/preprocessing/formats/binary_adjacency_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ namespace graphchi {
logstream(LOG_FATAL) << "Could not open file " << filename << " for writing. " <<
" Error: " << strerror(errno) << std::endl;
}
ftruncate(fd, 0);
int res = ftruncate(fd, 0);
if (res != 0) {
logstream(LOG_FATAL) << "Could not truncate file " << filename <<
" Error: " << strerror(errno) << std::endl;
}
assert(res == 0);

header.format_version = FORMAT_VERSION;
header.max_vertex_id = 0;
Expand Down

0 comments on commit c35db42

Please sign in to comment.