Skip to content

Commit

Permalink
Merge pull request BVLC#812 from Yangqing/sweep
Browse files Browse the repository at this point in the history
gflags 2.1 bugfix (or rather a hack).
  • Loading branch information
sergeyk committed Jul 28, 2014
2 parents d842f4a + cd1313f commit 7752032
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/caffe/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
#include "caffe/common.hpp"
#include "caffe/util/rng.hpp"

// gflags 2.1 issue: namespace google was changed to gflags without warning.
// Luckily we will be able to use GFLAGS_GFAGS_H_ to detect if it is version
// 2.1. If yes , we will add a temporary solution to redirect the namespace.
// TODO(Yangqing): Once gflags solves the problem in a more elegant way, let's
// remove the following hack.
#ifdef GFLAGS_GFLAGS_H_
namespace google {
using ::gflags::ParseCommandLineFlags;
} // namespace google
#endif // GFLAGS_GFLAGS_H_

namespace caffe {

Expand All @@ -25,7 +35,7 @@ int64_t cluster_seedgen(void) {

void GlobalInit(int* pargc, char*** pargv) {
// Google flags.
::gflags::ParseCommandLineFlags(pargc, pargv, true);
::google::ParseCommandLineFlags(pargc, pargv, true);
// Google logging.
::google::InitGoogleLogging(*(pargv)[0]);
}
Expand Down

0 comments on commit 7752032

Please sign in to comment.