Skip to content

Commit eb6f9dd

Browse files
authored
Feature/cuda9 cudnn7 (#10140)
* "re-commit " * "picked up" * "fix ci" * "fix pdb hang up issue in cuda 9"
1 parent c262040 commit eb6f9dd

35 files changed

+70
-63
lines changed

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# A image for building paddle binaries
22
# Use cuda devel base image for both cpu and gpu environment
3-
4-
# When you modify it, please be aware of cudnn-runtime version
3+
# When you modify it, please be aware of cudnn-runtime version
54
# and libcudnn.so.x in paddle/scripts/docker/build.sh
65
FROM nvidia/cuda:8.0-cudnn7-devel-ubuntu16.04
76
MAINTAINER PaddlePaddle Authors <[email protected]>
@@ -24,7 +23,7 @@ ENV HOME /root
2423
COPY ./paddle/scripts/docker/root/ /root/
2524

2625
RUN apt-get update && \
27-
apt-get install -y \
26+
apt-get install -y --allow-downgrades \
2827
git python-pip python-dev openssh-server bison \
2928
libnccl2=2.1.2-1+cuda8.0 libnccl-dev=2.1.2-1+cuda8.0 \
3029
wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \

cmake/cuda.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ set(CUDA_PROPAGATE_HOST_FLAGS OFF)
172172
list(APPEND CUDA_NVCC_FLAGS "-std=c++11")
173173
list(APPEND CUDA_NVCC_FLAGS "--use_fast_math")
174174
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -fPIC")
175+
# in cuda9, suppress cuda warning on eigen
176+
list(APPEND CUDA_NVCC_FLAGS "-w")
175177
# Set :expt-relaxed-constexpr to suppress Eigen warnings
176178
list(APPEND CUDA_NVCC_FLAGS "--expt-relaxed-constexpr")
177179

cmake/external/eigen.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ else()
2222
extern_eigen3
2323
${EXTERNAL_PROJECT_LOG_ARGS}
2424
GIT_REPOSITORY "https://github.com/RLovelett/eigen.git"
25-
GIT_TAG 70661066beef694cadf6c304d0d07e0758825c10
25+
# eigen on cuda9.1 missing header of math_funtions.hpp
26+
# https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen
27+
GIT_TAG 917060c364181f33a735dc023818d5a54f60e54c
2628
PREFIX ${EIGEN_SOURCE_DIR}
2729
UPDATE_COMMAND ""
2830
CONFIGURE_COMMAND ""

paddle/cuda/src/hl_cuda_lstm.cu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ __device__ __forceinline__ void transpose_32x32(real a[], const int idx) {
344344
int addr = idx % 32;
345345
#pragma unroll
346346
for (int k = 1; k < 32; k++) {
347-
// rSrc[k] = __shfl(rSrc[k], (threadIdx.x + k) % 32, 32);
348-
addr = __shfl(addr, (idx + 1) % 32, 32);
349-
a[k] = __shfl(a[k], addr, 32);
347+
// rSrc[k] = __shfl_sync(rSrc[k], (threadIdx.x + k) % 32, 32);
348+
addr = __shfl_sync(addr, (idx + 1) % 32, 32);
349+
a[k] = __shfl_sync(a[k], addr, 32);
350350
}
351351

352352
#pragma unroll
@@ -362,8 +362,8 @@ __device__ __forceinline__ void transpose_32x32(real a[], const int idx) {
362362
addr = (32 - idx) % 32;
363363
#pragma unroll
364364
for (int k = 0; k < 32; k++) {
365-
a[k] = __shfl(a[k], addr, 32);
366-
addr = __shfl(addr, (idx + 31) % 32, 32);
365+
a[k] = __shfl_sync(a[k], addr, 32);
366+
addr = __shfl_sync(addr, (idx + 31) % 32, 32);
367367
}
368368
}
369369

paddle/cuda/src/hl_top_k.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ __device__ __forceinline__ void blockReduce(Pair* shTopK,
250250
}
251251
}
252252
if (maxId[0] / 32 == warp) {
253-
if (__shfl(beam, (maxId[0]) % 32, 32) == maxLength) break;
253+
if (__shfl_sync(beam, (maxId[0]) % 32, 32) == maxLength) break;
254254
}
255255
}
256256
}

paddle/fluid/operators/accuracy_op.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License. */
1515
#include <thrust/execution_policy.h>
1616
#include <thrust/reduce.h>
1717
#include "paddle/fluid/operators/accuracy_op.h"
18-
#include "paddle/fluid/platform/cuda_helper.h"
18+
#include "paddle/fluid/platform/cuda_primitives.h"
1919
#include "paddle/fluid/platform/gpu_info.h"
2020

2121
namespace paddle {

paddle/fluid/operators/adagrad_op.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License. */
1616
#include "paddle/fluid/operators/adagrad_op.h"
1717
#include "paddle/fluid/operators/math/math_function.h"
1818
#include "paddle/fluid/operators/math/selected_rows_functor.h"
19-
#include "paddle/fluid/platform/cuda_helper.h"
19+
#include "paddle/fluid/platform/cuda_primitives.h"
2020

2121
namespace paddle {
2222
namespace operators {

paddle/fluid/operators/box_coder_op.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ See the License for the specific language governing permissions and
1010
limitations under the License. */
1111

1212
#include "paddle/fluid/operators/box_coder_op.h"
13-
#include "paddle/fluid/platform/cuda_helper.h"
13+
#include "paddle/fluid/platform/cuda_primitives.h"
1414

1515
namespace paddle {
1616
namespace operators {

paddle/fluid/operators/conv_shift_op.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ limitations under the License. */
1414

1515
#include "paddle/fluid/operators/conv_shift_op.h"
1616
#include "paddle/fluid/operators/math/math_function.h"
17-
#include "paddle/fluid/platform/cuda_helper.h"
17+
#include "paddle/fluid/platform/cuda_primitives.h"
1818

1919
namespace paddle {
2020
namespace operators {

paddle/fluid/operators/edit_distance_op.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License. */
1616
#include "paddle/fluid/framework/op_registry.h"
1717
#include "paddle/fluid/operators/edit_distance_op.h"
1818
#include "paddle/fluid/operators/math/math_function.h"
19-
#include "paddle/fluid/platform/cuda_helper.h"
19+
#include "paddle/fluid/platform/cuda_primitives.h"
2020
#include "paddle/fluid/platform/gpu_info.h"
2121

2222
namespace paddle {

0 commit comments

Comments
 (0)