forked from mindspore-Ecosystem/mindspore
ready for adapt to rocm
This commit is contained in:
parent
47d9ab4e04
commit
e4b2bd4bb5
|
@ -56,7 +56,7 @@ if(MSVC)
|
|||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/dirent.cmake)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GPU)
|
||||
if(ENABLE_GPU AND GPU_BACKEND_CUDA)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/cub.cmake)
|
||||
if(ENABLE_MPI)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/nccl.cmake)
|
||||
|
|
|
@ -208,7 +208,7 @@ if(ENABLE_GPU)
|
|||
DESTINATION ${INSTALL_LIB_DIR}
|
||||
COMPONENT mindspore
|
||||
)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND GPU_BACKEND_CUDA)
|
||||
install(FILES ${nccl_LIBPATH}/libnccl.so.2.7.6 DESTINATION ${INSTALL_LIB_DIR}
|
||||
RENAME libnccl.so.2 COMPONENT mindspore)
|
||||
endif()
|
||||
|
|
|
@ -92,7 +92,7 @@ function(set_nvcc_flag CUDA_NVCC_FLAGS)
|
|||
set(${CUDA_NVCC_FLAGS} ${${CUDA_NVCC_FLAGS}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(ENABLE_GPU)
|
||||
if(ENABLE_GPU AND GPU_BACKEND_CUDA)
|
||||
find_package(CUDA REQUIRED)
|
||||
find_package(Threads)
|
||||
if(${CUDA_VERSION} VERSION_LESS ${MS_REQUIRE_CUDA_VERSION})
|
||||
|
@ -508,11 +508,15 @@ if(ENABLE_D)
|
|||
add_subdirectory(plugin/device/ascend)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GPU)
|
||||
if(ENABLE_GPU AND GPU_BACKEND_CUDA)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/plugin/device/gpu)
|
||||
add_subdirectory(plugin/device/gpu)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GPU AND GPU_BACKEND_ROCM)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/plugin/device/amd)
|
||||
add_subdirectory(plugin/device/amd)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
target_link_libraries(mindspore PUBLIC mindspore::pybind11_module)
|
||||
if(NOT MSVC)
|
||||
|
|
|
@ -65,7 +65,13 @@ build_mindspore()
|
|||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_D=ON"
|
||||
fi
|
||||
if [[ "X$ENABLE_GPU" = "Xon" ]]; then
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GPU=ON -DUSE_CUDA=ON -DCUDA_PATH=$CUDA_PATH -DMS_REQUIRE_CUDA_VERSION=${CUDA_VERSION}"
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GPU=ON"
|
||||
fi
|
||||
if [[ "X$GPU_BACKEND" = "Xrocm" ]]; then
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DGPU_BACKEND_ROCM=ON -DROCM_PATH=$ROCM_PATH"
|
||||
fi
|
||||
if [[ "X$GPU_BACKEND" = "Xcuda" ]]; then
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DGPU_BACKEND_CUDA=ON -DUSE_CUDA=ON -DCUDA_PATH=$CUDA_PATH -DMS_REQUIRE_CUDA_VERSION=${CUDA_VERSION}"
|
||||
fi
|
||||
if [[ "X$ENABLE_CPU" = "Xon" ]]; then
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_CPU=ON -DX86_64_SIMD=${X86_64_SIMD} -DARM_SIMD=${ARM_SIMD}"
|
||||
|
|
|
@ -32,6 +32,7 @@ parse_device()
|
|||
do
|
||||
if [[ "X$D" == "Xgpu" ]]; then
|
||||
export ENABLE_GPU="on"
|
||||
export GPU_BACKEND="cuda"
|
||||
ENABLE_CPU="on"
|
||||
ENABLE_MPI="on"
|
||||
# version default 10.1
|
||||
|
@ -46,6 +47,12 @@ parse_device()
|
|||
export CUDA_VERSION="$DEVICE_VERSION"
|
||||
export ENABLE_AKG="on"
|
||||
export DEVICE_VERSION=
|
||||
elif [[ "X$D" == "Xrocm" ]]; then
|
||||
export ENABLE_GPU="on"
|
||||
export GPU_BACKEND="rocm"
|
||||
ENABLE_CPU="on"
|
||||
ENABLE_MPI="on"
|
||||
export ENABLE_AKG="off"
|
||||
elif [[ "X$D" == "Xd" || "X$D" == "Xascend" ]]; then
|
||||
# version default 910
|
||||
if [[ "X$DEVICE_VERSION" == "X" ]]; then
|
||||
|
|
Loading…
Reference in New Issue