support for msvc gpu

This commit is contained in:
qiuzhongya 2022-10-10 21:31:10 +08:00
parent ab8485f036
commit a248360556
2 changed files with 7 additions and 2 deletions

View File

@ -60,7 +60,7 @@ IF "%1%" == "lite" (
) ELSE (
IF "%1%" == "ms_vs_gpu" (
echo "======Start gen VS2019 Project for MS gpu ======"
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_GPU=ON -DMS_REQUIRE_CUDA_VERSION=11.1 -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_GPU=ON -DGPU_BACKEND_CUDA=ON -DMS_REQUIRE_CUDA_VERSION=11.1 -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
-G "Visual Studio 16 2019" -A x64 ../..
) ELSE (
IF "%1%" == "ms_vs_cpu" (

View File

@ -29,9 +29,14 @@ function(set_nvcc_flag CUDA_NVCC_FLAGS)
" return 0;\n"
"}\n")
# Build and run cu_file, get the result from properties.
if(NOT MSVC)
set(CUDA_LIB_PATH ${CUDA_PATH}/lib64/libcudart.so)
else()
set(CUDA_LIB_PATH ${CUDA_PATH}/lib/x64/cudart.lib)
endif()
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_SOURCE_DIR}/build/mindspore/ccsrc/ ${cu_file}
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS}"
LINK_LIBRARIES ${CUDA_PATH}/lib64/libcudart.so
LINK_LIBRARIES ${CUDA_LIB_PATH}
RUN_OUTPUT_VARIABLE compute_cap)
set(cuda_archs_bin)
if(RUN_RESULT_VAR EQUAL 0)