summaryrefslogtreecommitdiff
path: root/xmake/modules/lib/detect
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/lib/detect')
-rw-r--r--xmake/modules/lib/detect/find_cudadevices.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/modules/lib/detect/find_cudadevices.lua b/xmake/modules/lib/detect/find_cudadevices.lua
index dcf4a4229..71ee12e3b 100644
--- a/xmake/modules/lib/detect/find_cudadevices.lua
+++ b/xmake/modules/lib/detect/find_cudadevices.lua
@@ -113,7 +113,7 @@ function _parse_result(lines, verbose)
end
-- find devices
-function _find_devices(verbose, envs)
+function _find_devices(verbose, opt)
-- find nvcc
local nvcc = assert(find_tool("nvcc"), "nvcc not found")
@@ -131,7 +131,12 @@ function _find_devices(verbose, envs)
{
function ()
local args = { sourcefile, "-run", "-o", outfile , '-DPRINT_SUFFIX="' .. _PRINT_SUFFIX .. '"' }
- return os.iorunv(nvcc.program, args, {envs = envs})
+ if opt.arch == "x86" then
+ table.insert(args, "-m32")
+ elseif opt.arch == "x64" or opt.arch == "x86_64" then
+ table.insert(args, "-m64")
+ end
+ return os.iorunv(nvcc.program, args, {envs = opt.envs})
end,
catch
{
@@ -187,7 +192,7 @@ function _get_devices(opt)
end
local verbose = opt.verbose or option.get("verbose") or option.get("diagnosis")
- local devices = _find_devices(verbose, opt.envs)
+ local devices = _find_devices(verbose, opt)
if devices then
cachedata = { succeed = true, data = devices }
else