Skip to content

Commit

Permalink
CUDA12.0 integration (#49539)
Browse files Browse the repository at this point in the history
* Update warpctc for cuda-12

* Deprecate cudaProfilerInitialize for CUDA > 11

* Deprecate CUSPARSE_MV_ALG_DEFAULT for CUDA_VERSION >= 11040

* Add the missing thrust header
  • Loading branch information
zlsh80826 authored Jan 16, 2023
1 parent ea2e249 commit 1885d55
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/external/warpctc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set(WARPCTC_INSTALL_DIR ${THIRD_PARTY_PATH}/install/warpctc)
# in case of low internet speed
#set(WARPCTC_REPOSITORY https://gitee.com/tianjianhe/warp-ctc.git)
set(WARPCTC_REPOSITORY ${GIT_URL}/baidu-research/warp-ctc.git)
set(WARPCTC_TAG 37ece0e1bbe8a0019a63ac7e6462c36591c66a5b)
set(WARPCTC_TAG bdc2b4550453e0ef2d3b5190f9c6103a84eff184)

set(WARPCTC_INCLUDE_DIR
"${WARPCTC_INSTALL_DIR}/include"
Expand Down
2 changes: 2 additions & 0 deletions paddle/fluid/platform/device/gpu/cuda/cuda_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace platform {
void CudaProfilerInit(const std::string& output_file,
const std::string& output_mode,
const std::string& config_file) {
#if CUDA_VERSION < 11000
PADDLE_ENFORCE(output_mode == "kvp" || output_mode == "csv",
platform::errors::InvalidArgument(
"Unsupported cuda profiler output mode, expect `kvp` or "
Expand All @@ -28,6 +29,7 @@ void CudaProfilerInit(const std::string& output_file,
cudaOutputMode_t mode = output_mode == "csv" ? cudaCSV : cudaKeyValuePair;
PADDLE_ENFORCE_GPU_SUCCESS(
cudaProfilerInitialize(config_file.c_str(), output_file.c_str(), mode));
#endif
}

void CudaProfilerStart() { PADDLE_ENFORCE_GPU_SUCCESS(cudaProfilerStart()); }
Expand Down
8 changes: 8 additions & 0 deletions paddle/phi/kernels/funcs/sparse/sparse_blas_impl.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ void SparseBlas<phi::GPUContext>::SPMV(bool transa,
&beta,
out_descriptor.descriptor(),
gpu_type,
#if CUDA_VERSION >= 11040
CUSPARSE_SPMV_ALG_DEFAULT,
#else
CUSPARSE_MV_ALG_DEFAULT,
#endif
&buffer_size);
});

Expand All @@ -399,7 +403,11 @@ void SparseBlas<phi::GPUContext>::SPMV(bool transa,
&beta,
out_descriptor.descriptor(),
gpu_type,
#if CUDA_VERSION >= 11040
CUSPARSE_SPMV_ALG_DEFAULT,
#else
CUSPARSE_MV_ALG_DEFAULT,
#endif
tmp_buffer_ptr);
});
}
Expand Down
1 change: 1 addition & 0 deletions paddle/phi/kernels/gpu/send_u_recv_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "paddle/phi/kernels/send_u_recv_kernel.h"

#include <thrust/device_vector.h>
#include <thrust/execution_policy.h>
#include <thrust/fill.h>

#include <algorithm>
Expand Down
1 change: 1 addition & 0 deletions paddle/phi/kernels/gpu/send_ue_recv_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "paddle/phi/kernels/send_ue_recv_kernel.h"

#include <thrust/device_vector.h>
#include <thrust/execution_policy.h>
#include <thrust/fill.h>
#include <algorithm>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions paddle/phi/kernels/gpu/unique_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <thrust/functional.h>
#include <thrust/scatter.h>
#include <thrust/sequence.h>
#include <thrust/sort.h>
#include <thrust/unique.h>

#include <iostream>
Expand Down
3 changes: 3 additions & 0 deletions paddle/phi/kernels/sparse/gpu/coalesce_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ limitations under the License. */

#include "paddle/phi/kernels/sparse/coalesce_kernel.h"

#include <thrust/sort.h>
#include <thrust/unique.h>

#include "paddle/phi/backends/gpu/gpu_info.h"
#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/core/kernel_registry.h"
Expand Down

0 comments on commit 1885d55

Please sign in to comment.