aboutsummaryrefslogtreecommitdiff
path: root/zh/README.md
diff options
context:
space:
mode:
authorOpportunityLiu <opportunity@live.in>2019-06-02 15:26:26 +0800
committerOpportunityLiu <opportunity@live.in>2019-06-02 15:26:26 +0800
commit8cb46236f41ac5476f2fe38353156db4c8195325 (patch)
treedbfdcebcbad16003659403b66b96236f50f3f7a3 /zh/README.md
parent57095aa985ac1526240563ae1845e360c81db708 (diff)
downloadxmake-docs-8cb46236f41ac5476f2fe38353156db4c8195325.tar.gz
xmake-docs-8cb46236f41ac5476f2fe38353156db4c8195325.zip
add docs for find_cudadevices; improve docs for cuda templates
Related: xmake-io/xmake#430, xmake-io/xmake#431
Diffstat (limited to 'zh/README.md')
-rw-r--r--zh/README.md21
1 files changed, 10 insertions, 11 deletions
diff --git a/zh/README.md b/zh/README.md
index af6ba511..db25f4bb 100644
--- a/zh/README.md
+++ b/zh/README.md
@@ -250,6 +250,7 @@ target("hello")
* c/c++
* objc/c++
+* cuda
* asm
* swift
* dlang
@@ -452,22 +453,19 @@ $ xmake
```
```lua
+-- add helper function add_cugencode
+includes('add_cugencode.lua')
+-- define target
target("cuda_console")
set_kind("binary")
add_files("src/*.cu")
-
- -- generate SASS code for each SM architecture
- for _, sm in ipairs({"30", "35", "37", "50", "52", "60", "61", "70"}) do
- add_cuflags("-gencode arch=compute_" .. sm .. ",code=sm_" .. sm)
- add_ldflags("-gencode arch=compute_" .. sm .. ",code=sm_" .. sm)
- end
-
- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility
- sm = "70"
- add_cuflags("-gencode arch=compute_" .. sm .. ",code=compute_" .. sm)
- add_ldflags("-gencode arch=compute_" .. sm .. ",code=compute_" .. sm)
+ -- generate SASS code for SM architecture of current host
+ add_cugencode("native")
+ -- generate PTX code for the virtual architecture to guarantee compatibility
+ add_cugencode("compute_30")
```
+
默认会自动探测cuda环境,当然也可以指定Cuda SDK环境目录:
```console
@@ -772,6 +770,7 @@ $ xmake
| [--rc-ld](#-rc-ld) | 设置`rust`链接器 |
| [--rc-sh](#-rc-sh) | 设置`rust`共享库链接器 |
| [--rc-ar](#-rc-ar) | 设置`rust`静态库归档器 |
+| [--cu-cxx](#-cu-cxx) | 设置`cuda` host编译器 |
| [--cu-ld](#-cu-ld) | 设置`cuda`链接器 |
| [--cu-sh](#-cu-sh) | 设置`cuda`共享库链接器 |
| [--cu-ar](#-cu-ar) | 设置`cuda`静态库归档器 |