summaryrefslogtreecommitdiff
path: root/xmake/rules
diff options
context:
space:
mode:
authorruki <[email protected]>2022-01-25 00:27:06 +0800
committerruki <[email protected]>2022-01-25 00:27:06 +0800
commitdee5ebd8220b3695a0ebf43d88fee06d910766ee (patch)
treecdb1641b18baced30fbad284fa29455395454f7f /xmake/rules
parenta1ecc4de70ff0e108bcf89fbccfd25189239071c (diff)
improve find cuda devices
Diffstat (limited to 'xmake/rules')
-rw-r--r--xmake/rules/cuda/gencodes/xmake.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/rules/cuda/gencodes/xmake.lua b/xmake/rules/cuda/gencodes/xmake.lua
index c7ee45050..f83ce4740 100644
--- a/xmake/rules/cuda/gencodes/xmake.lua
+++ b/xmake/rules/cuda/gencodes/xmake.lua
@@ -52,7 +52,14 @@ rule("cuda.gencodes")
end
archs = archs:trim():lower()
if archs == "native" then
- local device = find_cudadevices({ skip_compute_mode_prohibited = true, order_by_flops = true })[1]
+ local cuda_envs
+ for _, toolchain_inst in ipairs(target:toolchains()) do
+ if toolchain_inst:name() == "cuda" then
+ cuda_envs = toolchain_inst:runenvs()
+ break
+ end
+ end
+ local device = find_cudadevices({skip_compute_mode_prohibited = true, order_by_flops = true, envs = cuda_envs})[1]
if device then
return nf_cugencode("sm_" .. device.major .. device.minor)
end