Unverified Commit c6a3e4c7 authored by PanZezhong1725's avatar PanZezhong1725 Committed by GitHub
Browse files

Merge pull request #315 from YdrMaster/main

issue/314 修复 nvidia 上编译和测试问题
parents f3a075b7 68107e5e
......@@ -22,7 +22,7 @@ end
option("cpu")
set_default(true)
set_showmenu(true)
set_description("Whether to complie implementations for CPU")
set_description("Whether to compile implementations for CPU")
option_end()
option("omp")
......@@ -44,32 +44,29 @@ end
option("nv-gpu")
set_default(false)
set_showmenu(true)
set_description("Whether to complie implementations for Nvidia GPU")
set_description("Whether to compile implementations for Nvidia GPU")
option_end()
if has_config("nv-gpu") then
add_defines("ENABLE_CUDA_API")
add_defines("ENABLE_NVIDIA_API")
includes("xmake/cuda.lua")
end
-- 天数智芯
option("iluvatar-gpu")
set_default(false)
option("cudnn")
set_default(true)
set_showmenu(true)
set_description("Whether to complie implementations for Iluvatar GPU")
set_description("Whether to compile cudnn for Nvidia GPU")
option_end()
if has_config("iluvatar-gpu") then
add_defines("ENABLE_CUDA_API")
add_defines("ENABLE_ILUVATAR_CUDA_API")
includes("xmake/iluvatar.lua")
if has_config("cudnn") then
add_defines("ENABLE_CUDNN_API")
end
-- 寒武纪
option("cambricon-mlu")
set_default(false)
set_showmenu(true)
set_description("Whether to complie implementations for Cambricon MLU")
set_description("Whether to compile implementations for Cambricon MLU")
option_end()
if has_config("cambricon-mlu") then
......@@ -81,7 +78,7 @@ end
option("ascend-npu")
set_default(false)
set_showmenu(true)
set_description("Whether to complie implementations for Huawei Ascend NPU")
set_description("Whether to compile implementations for Huawei Ascend NPU")
option_end()
if has_config("ascend-npu") then
......@@ -89,11 +86,24 @@ if has_config("ascend-npu") then
includes("xmake/ascend.lua")
end
-- 天数智芯
option("iluvatar-gpu")
set_default(false)
set_showmenu(true)
set_description("Whether to compile implementations for Iluvatar GPU")
option_end()
if has_config("iluvatar-gpu") then
add_defines("ENABLE_CUDA_API")
add_defines("ENABLE_ILUVATAR_CUDA_API")
includes("xmake/iluvatar.lua")
end
-- 沐曦
option("metax-gpu")
set_default(false)
set_showmenu(true)
set_description("Whether to complie implementations for MetaX GPU")
set_description("Whether to compile implementations for MetaX GPU")
option_end()
if has_config("metax-gpu") then
......@@ -105,7 +115,7 @@ end
option("moore-gpu")
set_default(false)
set_showmenu(true)
set_description("Whether to complie implementations for Moore Threads GPU")
set_description("Whether to compile implementations for Moore Threads GPU")
option_end()
if has_config("moore-gpu") then
......@@ -117,11 +127,10 @@ end
option("sugon-dcu")
set_default(false)
set_showmenu(true)
set_description("Whether to complie implementations for Sugon DCU")
set_description("Whether to compile implementations for Sugon DCU")
option_end()
if has_config("sugon-dcu") then
add_defines("ENABLE_CUDA_API")
add_defines("ENABLE_SUGON_CUDA_API")
end
......@@ -142,7 +151,7 @@ option("ccl")
set_default(false)
set_default(false)
set_showmenu(true)
set_description("Wether to complie implementations for InfiniCCL")
set_description("Wether to compile implementations for InfiniCCL")
option_end()
if has_config("ccl") then
......
local CUDA_ROOT = os.getenv("CUDA_ROOT") or os.getenv("CUDA_HOME") or os.getenv("CUDA_PATH")
local CUDNN_ROOT = os.getenv("CUDNN_ROOT") or os.getenv("CUDNN_HOME") or os.getenv("CUDNN_PATH")
if CUDA_ROOT ~= nil then
add_includedirs(CUDA_ROOT .. "/include")
end
if CUDNN_ROOT ~= nil then
add_includedirs(CUDNN_ROOT .. "/include")
end
......@@ -15,10 +10,20 @@ target("infiniop-cuda")
set_policy("build.cuda.devlink", true)
set_toolchains("cuda")
add_links("cuda", "cublas", "cudnn")
add_linkdirs(CUDA_ROOT .. "/lib64/stubs")
add_links("cudart", "cublas")
if has_config("cudnn") then
add_links("cudnn")
end
add_cugencodes("native")
on_load(function (target)
import("lib.detect.find_tool")
local nvcc = find_tool("nvcc")
if nvcc ~= nil then
target:add("linkdirs", path.directory(path.directory(nvcc.program)) .. "/lib64/stubs")
end
end)
if is_plat("windows") then
add_cuflags("-Xcompiler=/utf-8", "--expt-relaxed-constexpr", "--allow-unsupported-compiler")
add_cuflags("-Xcompiler=/W3", "-Xcompiler=/WX")
......@@ -38,6 +43,8 @@ target("infiniop-cuda")
end
end
add_cuflags("-Xcompiler=-Wno-error=deprecated-declarations")
set_languages("cxx17")
add_files("../src/infiniop/devices/cuda/*.cu", "../src/infiniop/ops/*/cuda/*.cu", "../build/ninetoothed/*.c")
target_end()
......@@ -92,5 +99,5 @@ target("infiniccl-cuda")
end
end
set_languages("cxx17")
target_end()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment