forked from BVLC/caffe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide boost rng behind facade for osx compatibility
Split boost random number generation from the common Caffe singleton and add a helper function for rng. This resolves a build conflict in OSX between boost rng and nvcc compilation of cuda code. Refer to BVLC#165 for a full discussion. Thanks to @satol for suggesting a random number generation facade rather than a total split of cpp and cu code, which is far more involved.
- Loading branch information
Showing
4 changed files
with
120 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2014 Evan Shelhamer | ||
|
||
#ifndef CAFFE_RNG_CPP_HPP_ | ||
#define CAFFE_RNG_CPP_HPP_ | ||
|
||
#include <boost/random/mersenne_twister.hpp> | ||
#include "caffe/common.hpp" | ||
|
||
namespace caffe { | ||
|
||
typedef boost::mt19937 rng_t; | ||
inline rng_t& caffe_rng() { | ||
Caffe::RNG &generator = Caffe::rng_stream(); | ||
return *(caffe::rng_t*) generator.generator(); | ||
} | ||
|
||
} // namespace caffe | ||
|
||
#endif // CAFFE_RNG_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters