提交 a277903d 编写于 作者: Q QI JUN 提交者: GitHub

Merge pull request #3398 from QiJune/fix_gcc_version

Switch from GCC 5 that doesn't work with Eigen to 4.8
...@@ -71,6 +71,21 @@ RUN pip install --upgrade pip && \ ...@@ -71,6 +71,21 @@ RUN pip install --upgrade pip && \
RUN apt-get install -y libssl-dev libffi-dev RUN apt-get install -y libssl-dev libffi-dev
RUN pip install certifi urllib3[secure] RUN pip install certifi urllib3[secure]
# TODO(qijun) The template library Eigen doesn't work well with GCC 5
# coming with the default Docker image, so we switch to use GCC 4.8
# by default. And I will check Eigen library later.
RUN ln -sf gcc-4.8 /usr/bin/gcc && \
ln -sf gcc-ar-4.8 /usr/bin/gcc-ar && \
ln -sf gcc-nm-4.8 /usr/bin/gcc-nm && \
ln -sf gcc-ranlib-4.8 /usr/bin/gcc-ranlib && \
ln -sf gcc-4.8 /usr/bin/x86_64-linux-gnu-gcc && \
ln -sf gcc-ar-4.8 /usr/bin/x86_64-linux-gnu-gcc-ar && \
ln -sf gcc-nm-4.8 /usr/bin/x86_64-linux-gnu-gcc-nm && \
ln -sf gcc-ranlib-4.8 /usr/bin/x86_64-linux-gnu-gcc-ranlib && \
ln -sf g++-4.8 /usr/bin/g++ && \
ln -sf g++-4.8 /usr/bin/x86_64-linux-gnu-g++
# Install woboq_codebrowser to /woboq # Install woboq_codebrowser to /woboq
RUN git clone https://github.com/woboq/woboq_codebrowser /woboq && \ RUN git clone https://github.com/woboq/woboq_codebrowser /woboq && \
(cd /woboq \ (cd /woboq \
......
...@@ -33,7 +33,8 @@ class GaussianRandomKernel : public framework::OpKernel { ...@@ -33,7 +33,8 @@ class GaussianRandomKernel : public framework::OpKernel {
int seed = context.op_.GetAttr<int>("seed"); int seed = context.op_.GetAttr<int>("seed");
if (seed == 0) { if (seed == 0) {
seed = std::random_device()(); std::random_device rd;
seed = rd();
} }
curandGenerator_t g; curandGenerator_t g;
PADDLE_ENFORCE(platform::dynload::curandCreateGenerator( PADDLE_ENFORCE(platform::dynload::curandCreateGenerator(
......
...@@ -51,7 +51,8 @@ class GPUUniformRandomKernel : public framework::OpKernel { ...@@ -51,7 +51,8 @@ class GPUUniformRandomKernel : public framework::OpKernel {
unsigned int seed = unsigned int seed =
static_cast<unsigned int>(context.op_.GetAttr<int>("seed")); static_cast<unsigned int>(context.op_.GetAttr<int>("seed"));
if (seed == 0) { if (seed == 0) {
seed = std::random_device()(); std::random_device rd;
seed = rd();
} }
T min = static_cast<T>(context.op_.GetAttr<float>("min")); T min = static_cast<T>(context.op_.GetAttr<float>("min"));
T max = static_cast<T>(context.op_.GetAttr<float>("max")); T max = static_cast<T>(context.op_.GetAttr<float>("max"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册