Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
eb6f9dd5
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
eb6f9dd5
编写于
4月 30, 2018
作者:
D
dzhwinter
提交者:
GitHub
4月 30, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feature/cuda9 cudnn7 (#10140)
* "re-commit " * "picked up" * "fix ci" * "fix pdb hang up issue in cuda 9"
上级
c2620402
变更
35
隐藏空白更改
内联
并排
Showing
35 changed file
with
70 addition
and
63 deletion
+70
-63
Dockerfile
Dockerfile
+2
-3
cmake/cuda.cmake
cmake/cuda.cmake
+2
-0
cmake/external/eigen.cmake
cmake/external/eigen.cmake
+3
-1
paddle/cuda/src/hl_cuda_lstm.cu
paddle/cuda/src/hl_cuda_lstm.cu
+5
-5
paddle/cuda/src/hl_top_k.cu
paddle/cuda/src/hl_top_k.cu
+1
-1
paddle/fluid/operators/accuracy_op.cu
paddle/fluid/operators/accuracy_op.cu
+1
-1
paddle/fluid/operators/adagrad_op.cu
paddle/fluid/operators/adagrad_op.cu
+1
-1
paddle/fluid/operators/box_coder_op.cu
paddle/fluid/operators/box_coder_op.cu
+1
-1
paddle/fluid/operators/conv_shift_op.cu
paddle/fluid/operators/conv_shift_op.cu
+1
-1
paddle/fluid/operators/edit_distance_op.cu
paddle/fluid/operators/edit_distance_op.cu
+1
-1
paddle/fluid/operators/elementwise_op_function.h
paddle/fluid/operators/elementwise_op_function.h
+5
-16
paddle/fluid/operators/lookup_table_op.cu
paddle/fluid/operators/lookup_table_op.cu
+1
-1
paddle/fluid/operators/math/concat.cu
paddle/fluid/operators/math/concat.cu
+1
-1
paddle/fluid/operators/math/cos_sim_functor.cu
paddle/fluid/operators/math/cos_sim_functor.cu
+1
-1
paddle/fluid/operators/math/cross_entropy.cu
paddle/fluid/operators/math/cross_entropy.cu
+6
-5
paddle/fluid/operators/math/depthwise_conv.cu
paddle/fluid/operators/math/depthwise_conv.cu
+1
-1
paddle/fluid/operators/math/detail/gru_gpu_kernel.h
paddle/fluid/operators/math/detail/gru_gpu_kernel.h
+1
-1
paddle/fluid/operators/math/detail/lstm_gpu_kernel.h
paddle/fluid/operators/math/detail/lstm_gpu_kernel.h
+1
-1
paddle/fluid/operators/math/im2col.cu
paddle/fluid/operators/math/im2col.cu
+1
-1
paddle/fluid/operators/math/maxouting.cu
paddle/fluid/operators/math/maxouting.cu
+1
-1
paddle/fluid/operators/math/pooling.cu
paddle/fluid/operators/math/pooling.cu
+1
-1
paddle/fluid/operators/math/selected_rows_functor.cu
paddle/fluid/operators/math/selected_rows_functor.cu
+1
-1
paddle/fluid/operators/math/sequence_pooling.cu
paddle/fluid/operators/math/sequence_pooling.cu
+1
-1
paddle/fluid/operators/math/sequence_scale.cu
paddle/fluid/operators/math/sequence_scale.cu
+1
-1
paddle/fluid/operators/math/unpooling.cu
paddle/fluid/operators/math/unpooling.cu
+1
-1
paddle/fluid/operators/math/vol2col.cu
paddle/fluid/operators/math/vol2col.cu
+1
-1
paddle/fluid/operators/one_hot_op.cu
paddle/fluid/operators/one_hot_op.cu
+1
-1
paddle/fluid/operators/roi_pool_op.cu
paddle/fluid/operators/roi_pool_op.cu
+1
-1
paddle/fluid/operators/row_conv_op.cu
paddle/fluid/operators/row_conv_op.cu
+3
-3
paddle/fluid/operators/sequence_erase_op.cu
paddle/fluid/operators/sequence_erase_op.cu
+1
-1
paddle/fluid/operators/sequence_expand_op.cu
paddle/fluid/operators/sequence_expand_op.cu
+1
-1
paddle/fluid/operators/sgd_op.cu
paddle/fluid/operators/sgd_op.cu
+1
-1
paddle/fluid/platform/cuda_primitives.h
paddle/fluid/platform/cuda_primitives.h
+17
-0
paddle/scripts/docker/build.sh
paddle/scripts/docker/build.sh
+1
-1
python/paddle/fluid/tests/unittests/test_batch_norm_op.py
python/paddle/fluid/tests/unittests/test_batch_norm_op.py
+1
-4
未找到文件。
Dockerfile
浏览文件 @
eb6f9dd5
# A image for building paddle binaries
# Use cuda devel base image for both cpu and gpu environment
# When you modify it, please be aware of cudnn-runtime version
# When you modify it, please be aware of cudnn-runtime version
# and libcudnn.so.x in paddle/scripts/docker/build.sh
FROM
nvidia/cuda:8.0-cudnn7-devel-ubuntu16.04
MAINTAINER
PaddlePaddle Authors <paddle-dev@baidu.com>
...
...
@@ -24,7 +23,7 @@ ENV HOME /root
COPY
./paddle/scripts/docker/root/ /root/
RUN
apt-get update
&&
\
apt-get
install
-y
\
apt-get
install
-y
--allow-downgrades
\
git python-pip python-dev openssh-server bison
\
libnccl2
=
2.1.2-1+cuda8.0 libnccl-dev
=
2.1.2-1+cuda8.0
\
wget unzip unrar
tar
xz-utils bzip2
gzip
coreutils ntp
\
...
...
cmake/cuda.cmake
浏览文件 @
eb6f9dd5
...
...
@@ -172,6 +172,8 @@ set(CUDA_PROPAGATE_HOST_FLAGS OFF)
list
(
APPEND CUDA_NVCC_FLAGS
"-std=c++11"
)
list
(
APPEND CUDA_NVCC_FLAGS
"--use_fast_math"
)
list
(
APPEND CUDA_NVCC_FLAGS
"-Xcompiler -fPIC"
)
# in cuda9, suppress cuda warning on eigen
list
(
APPEND CUDA_NVCC_FLAGS
"-w"
)
# Set :expt-relaxed-constexpr to suppress Eigen warnings
list
(
APPEND CUDA_NVCC_FLAGS
"--expt-relaxed-constexpr"
)
...
...
cmake/external/eigen.cmake
浏览文件 @
eb6f9dd5
...
...
@@ -22,7 +22,9 @@ else()
extern_eigen3
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/RLovelett/eigen.git"
GIT_TAG 70661066beef694cadf6c304d0d07e0758825c10
# eigen on cuda9.1 missing header of math_funtions.hpp
# https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen
GIT_TAG 917060c364181f33a735dc023818d5a54f60e54c
PREFIX
${
EIGEN_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
...
...
paddle/cuda/src/hl_cuda_lstm.cu
浏览文件 @
eb6f9dd5
...
...
@@ -344,9 +344,9 @@ __device__ __forceinline__ void transpose_32x32(real a[], const int idx) {
int
addr
=
idx
%
32
;
#pragma unroll
for
(
int
k
=
1
;
k
<
32
;
k
++
)
{
// rSrc[k] = __shfl(rSrc[k], (threadIdx.x + k) % 32, 32);
addr
=
__shfl
(
addr
,
(
idx
+
1
)
%
32
,
32
);
a
[
k
]
=
__shfl
(
a
[
k
],
addr
,
32
);
// rSrc[k] = __shfl
_sync
(rSrc[k], (threadIdx.x + k) % 32, 32);
addr
=
__shfl
_sync
(
addr
,
(
idx
+
1
)
%
32
,
32
);
a
[
k
]
=
__shfl
_sync
(
a
[
k
],
addr
,
32
);
}
#pragma unroll
...
...
@@ -362,8 +362,8 @@ __device__ __forceinline__ void transpose_32x32(real a[], const int idx) {
addr
=
(
32
-
idx
)
%
32
;
#pragma unroll
for
(
int
k
=
0
;
k
<
32
;
k
++
)
{
a
[
k
]
=
__shfl
(
a
[
k
],
addr
,
32
);
addr
=
__shfl
(
addr
,
(
idx
+
31
)
%
32
,
32
);
a
[
k
]
=
__shfl
_sync
(
a
[
k
],
addr
,
32
);
addr
=
__shfl
_sync
(
addr
,
(
idx
+
31
)
%
32
,
32
);
}
}
...
...
paddle/cuda/src/hl_top_k.cu
浏览文件 @
eb6f9dd5
...
...
@@ -250,7 +250,7 @@ __device__ __forceinline__ void blockReduce(Pair* shTopK,
}
}
if
(
maxId
[
0
]
/
32
==
warp
)
{
if
(
__shfl
(
beam
,
(
maxId
[
0
])
%
32
,
32
)
==
maxLength
)
break
;
if
(
__shfl
_sync
(
beam
,
(
maxId
[
0
])
%
32
,
32
)
==
maxLength
)
break
;
}
}
}
...
...
paddle/fluid/operators/accuracy_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#include <thrust/execution_policy.h>
#include <thrust/reduce.h>
#include "paddle/fluid/operators/accuracy_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
#include "paddle/fluid/platform/gpu_info.h"
namespace
paddle
{
...
...
paddle/fluid/operators/adagrad_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -16,7 +16,7 @@ limitations under the License. */
#include "paddle/fluid/operators/adagrad_op.h"
#include "paddle/fluid/operators/math/math_function.h"
#include "paddle/fluid/operators/math/selected_rows_functor.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/box_coder_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -10,7 +10,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/box_coder_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/conv_shift_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -14,7 +14,7 @@ limitations under the License. */
#include "paddle/fluid/operators/conv_shift_op.h"
#include "paddle/fluid/operators/math/math_function.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/edit_distance_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -16,7 +16,7 @@ limitations under the License. */
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/edit_distance_op.h"
#include "paddle/fluid/operators/math/math_function.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
#include "paddle/fluid/platform/gpu_info.h"
namespace
paddle
{
...
...
paddle/fluid/operators/elementwise_op_function.h
浏览文件 @
eb6f9dd5
...
...
@@ -22,6 +22,7 @@ limitations under the License. */
#ifdef __NVCC__
#include <cuda.h>
#include <thrust/iterator/iterator_adaptor.h>
#include "paddle/fluid/platform/cuda_primitives.h"
constexpr
int
ELEMWISE_MAX_BLOCK_DIM
=
1024
;
#endif
...
...
@@ -333,24 +334,12 @@ static void ElemwiseGradBroadcast1CPU(const T* x, const T* y, const T* out,
}
}
}
#ifdef __NVCC__
// __shfl_down has been deprecated as of CUDA 9.0.
#if CUDA_VERSION < 9000
template
<
typename
T
>
__forceinline__
__device__
T
__shfl_down_sync
(
unsigned
,
T
val
,
int
delta
)
{
return
__shfl_down
(
val
,
delta
);
}
#define CREATE_SHFL_MASK(mask, predicate) mask = 0u;
#else
#define FULL_WARP_MASK 0xFFFFFFFF
#define CREATE_SHFL_MASK(mask, predicate) \
mask = __ballot_sync(FULL_WARP_MASK, (predicate))
#endif
#ifdef __NVCC__
template
<
typename
T
>
__device__
T
reduceSum
(
T
val
,
int
tid
,
int
len
)
{
//
TODO
(zcd): The warp size should be taken from the
//
NOTE
(zcd): The warp size should be taken from the
// parameters of the GPU but not specified as 32 simply.
// To make the reduceSum more efficiently,
// I use Warp-Level Parallelism and assume the Warp size
...
...
@@ -362,7 +351,7 @@ __device__ T reduceSum(T val, int tid, int len) {
CREATE_SHFL_MASK
(
mask
,
tid
<
len
);
for
(
int
offset
=
warpSize
/
2
;
offset
>
0
;
offset
/=
2
)
val
+=
__shfl_down_sync
(
mask
,
val
,
offset
);
val
+=
platform
::
__shfl_down_sync
(
mask
,
val
,
offset
);
if
(
tid
<
warpSize
)
shm
[
tid
]
=
0
;
...
...
@@ -378,7 +367,7 @@ __device__ T reduceSum(T val, int tid, int len) {
if
(
tid
<
warpSize
)
{
val
=
shm
[
tid
];
for
(
int
offset
=
warpSize
/
2
;
offset
>
0
;
offset
/=
2
)
val
+=
__shfl_down_sync
(
mask
,
val
,
offset
);
val
+=
platform
::
__shfl_down_sync
(
mask
,
val
,
offset
);
}
return
val
;
...
...
paddle/fluid/operators/lookup_table_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -16,7 +16,7 @@ limitations under the License. */
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/lookup_table_op.h"
#include "paddle/fluid/platform/assert.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/concat.cu
浏览文件 @
eb6f9dd5
...
...
@@ -14,7 +14,7 @@ limitations under the License. */
#include "paddle/fluid/framework/mixed_vector.h"
#include "paddle/fluid/operators/math/concat.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/cos_sim_functor.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/math/cos_sim_functor.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/cross_entropy.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/math/cross_entropy.h"
#include "paddle/fluid/platform/cuda_primitives.h"
namespace
paddle
{
namespace
operators
{
...
...
@@ -31,11 +32,11 @@ __global__ void CrossEntropyKernel(T* Y, const T* X, const int64_t* label,
template
<
typename
T
>
__device__
__forceinline__
T
sum_single_warp
(
T
val
)
{
val
+=
__shfl_down
(
val
,
16
);
val
+=
__shfl_down
(
val
,
8
);
val
+=
__shfl_down
(
val
,
4
);
val
+=
__shfl_down
(
val
,
2
);
val
+=
__shfl_down
(
val
,
1
);
val
+=
platform
::
__shfl_down_sync
(
0
,
val
,
16
);
val
+=
platform
::
__shfl_down_sync
(
0
,
val
,
8
);
val
+=
platform
::
__shfl_down_sync
(
0
,
val
,
4
);
val
+=
platform
::
__shfl_down_sync
(
0
,
val
,
2
);
val
+=
platform
::
__shfl_down_sync
(
0
,
val
,
1
);
return
val
;
}
...
...
paddle/fluid/operators/math/depthwise_conv.cu
浏览文件 @
eb6f9dd5
...
...
@@ -14,7 +14,7 @@ limitations under the License. */
#include <vector>
#include "paddle/fluid/operators/math/depthwise_conv.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/detail/gru_gpu_kernel.h
浏览文件 @
eb6f9dd5
...
...
@@ -16,7 +16,7 @@ limitations under the License. */
#include <type_traits>
#include "paddle/fluid/operators/math/detail/activation_functions.h"
#include "paddle/fluid/operators/math/gru_compute.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
#include "paddle/fluid/platform/device_context.h"
namespace
paddle
{
...
...
paddle/fluid/operators/math/detail/lstm_gpu_kernel.h
浏览文件 @
eb6f9dd5
...
...
@@ -17,7 +17,7 @@ limitations under the License. */
#include "paddle/fluid/operators/math/detail/activation_functions.h"
#include "paddle/fluid/operators/math/lstm_compute.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
#include "paddle/fluid/platform/device_context.h"
namespace
paddle
{
...
...
paddle/fluid/operators/math/im2col.cu
浏览文件 @
eb6f9dd5
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#include <algorithm>
#include <vector>
#include "paddle/fluid/operators/math/im2col.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/maxouting.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/math/maxouting.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/pooling.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/math/pooling.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/selected_rows_functor.cu
浏览文件 @
eb6f9dd5
...
...
@@ -17,7 +17,7 @@ limitations under the License. */
#include "paddle/fluid/operators/math/math_function.h"
#include "paddle/fluid/operators/math/selected_rows_functor.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/sequence_pooling.cu
浏览文件 @
eb6f9dd5
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#include <string>
#include "paddle/fluid/operators/math/math_function.h"
#include "paddle/fluid/operators/math/sequence_pooling.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/sequence_scale.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/math/sequence_scale.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/unpooling.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/math/unpooling.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/math/vol2col.cu
浏览文件 @
eb6f9dd5
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#include <algorithm>
#include <vector>
#include "paddle/fluid/operators/math/vol2col.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/one_hot_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#include "paddle/fluid/operators/one_hot_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
#include "paddle/fluid/platform/gpu_info.h"
namespace
paddle
{
...
...
paddle/fluid/operators/roi_pool_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/roi_pool_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/row_conv_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -14,7 +14,7 @@ limitations under the License. */
#include "paddle/fluid/operators/math/math_function.h"
#include "paddle/fluid/operators/row_conv_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
@@ -220,7 +220,7 @@ __global__ void RowConvGradFilterImproved(const T *in, const T *dout,
for
(
int
offset
=
16
;
offset
>
0
;
offset
=
offset
/
2
)
{
// blockDim.x is 32.
val
+=
__shfl_down
(
val
,
offset
);
val
+=
platform
::
__shfl_down_sync
(
0
,
val
,
offset
);
}
__syncthreads
();
...
...
@@ -276,7 +276,7 @@ __global__ void RowConvGradFilter(const T *in, const T *dout, int num_sequence,
for
(
int
offset
=
16
;
offset
>
0
;
offset
=
offset
/
2
)
{
// blockDim.x is 32.
val
+=
__shfl_down
(
val
,
offset
);
val
+=
platform
::
__shfl_down_sync
(
0
,
val
,
offset
);
}
__syncthreads
();
...
...
paddle/fluid/operators/sequence_erase_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include "paddle/fluid/operators/sequence_erase_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/sequence_expand_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -14,7 +14,7 @@ limitations under the License. */
#include <algorithm>
#include "paddle/fluid/operators/sequence_expand_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/sgd_op.cu
浏览文件 @
eb6f9dd5
...
...
@@ -14,7 +14,7 @@ limitations under the License. */
#define EIGEN_USE_GPU
#include "paddle/fluid/operators/sgd_op.h"
#include "paddle/fluid/platform/cuda_
helper
.h"
#include "paddle/fluid/platform/cuda_
primitives
.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/platform/cuda_
helper
.h
→
paddle/fluid/platform/cuda_
primitives
.h
浏览文件 @
eb6f9dd5
...
...
@@ -66,5 +66,22 @@ CUDA_ATOMIC_WRAPPER(Add, double) {
}
#endif
// __shfl_down has been deprecated as of CUDA 9.0.
#if CUDA_VERSION < 9000
template
<
typename
T
>
__forceinline__
__device__
T
__shfl_down_sync
(
unsigned
,
T
val
,
int
delta
)
{
return
__shfl_down
(
val
,
delta
);
}
#define CREATE_SHFL_MASK(mask, predicate) mask = 0u;
#else
template
<
typename
T
>
__forceinline__
__device__
T
__shfl_down_sync
(
unsigned
mask
,
T
val
,
int
delta
)
{
return
__shfl_down
(
mask
,
val
,
delta
);
}
#define FULL_WARP_MASK 0xFFFFFFFF
#define CREATE_SHFL_MASK(mask, predicate) \
mask = __ballot_sync(FULL_WARP_MASK, (predicate))
#endif
}
// namespace platform
}
// namespace paddle
paddle/scripts/docker/build.sh
浏览文件 @
eb6f9dd5
...
...
@@ -155,7 +155,7 @@ EOF
function
gen_dockerfile
()
{
# Set BASE_IMAGE according to env variables
if
[[
${
WITH_GPU
}
==
"ON"
]]
;
then
BASE_IMAGE
=
"nvidia/cuda:8.0-cudnn7-
runtime
-ubuntu16.04"
BASE_IMAGE
=
"nvidia/cuda:8.0-cudnn7-
devel
-ubuntu16.04"
else
BASE_IMAGE
=
"ubuntu:16.04"
fi
...
...
python/paddle/fluid/tests/unittests/test_batch_norm_op.py
浏览文件 @
eb6f9dd5
...
...
@@ -275,10 +275,7 @@ class TestFP16BatchNormOpInference(TestBatchNormOpInference):
class
TestBatchNormOpTraining
(
unittest
.
TestCase
):
def
__assert_close
(
self
,
tensor
,
np_array
,
msg
,
atol
=
1e-4
):
if
not
np
.
allclose
(
np
.
array
(
tensor
),
np_array
,
atol
=
atol
):
import
pdb
pdb
.
set_trace
()
self
.
assertTrue
(
np
.
allclose
(
np
.
array
(
tensor
),
np_array
,
atol
=
atol
),
msg
)
np
.
allclose
(
np
.
array
(
tensor
),
np_array
,
atol
=
atol
)
def
test_forward_backward
(
self
):
def
test_with_place
(
place
,
data_layout
,
shape
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录