首页 \ 问答 \ 编译CUDA程序(Compiling CUDA program)

编译CUDA程序(Compiling CUDA program)

我正在使用CUDA并行化RayTracing程序。 我有顺序代码,我已经写了并行代码(内核)。

运行程序时,我遇到以下错误(从VS2010复制)

Error   1   error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_21,code=\"sm_21,compute_21\" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include"    --keep-dir "Release" -maxrregcount=0  --machine 32 --compile      -Xcompiler "/EHsc /nologo /Od /Zi  /MD  " -o "Release\CUDAraytracer.cu.obj" "c:\Users\mc.choice\Desktop\CUDAraytracer.cu"" exited with code -1.  C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets    361

我想我已正确包含所有库和标题。

关于如何成功编译和运行它的想法,以及错误的原因是什么?

Tnx提前


I am strugling with parallelizing a RayTracing program, using CUDA. I have the sequential code, and I have wrote the parallel code (kernel).

When running the program, I encounter the following error (copied from VS2010)

Error   1   error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_21,code=\"sm_21,compute_21\" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include"    --keep-dir "Release" -maxrregcount=0  --machine 32 --compile      -Xcompiler "/EHsc /nologo /Od /Zi  /MD  " -o "Release\CUDAraytracer.cu.obj" "c:\Users\mc.choice\Desktop\CUDAraytracer.cu"" exited with code -1.  C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets    361

I think I have all libs and headers included correctly.

And ideas on how to compile & run it successfully, and what the cause of the error would be?

Tnx in advance


原文:https://stackoverflow.com/questions/21609830
更新时间:2023-08-02 22:08

最满意答案

直到哈德利和他的团队能够开发staticdocs及其文​​档更多这里是我的工作在一个非常粗糙的包中找到

#' Change read.me File
#'
#' Alter the read.me file with a preset.
#' 
#' @param path Path to the index.html file.
#' @param readme Path to the readme file.
#' @param file The path/file name to output.
readme_statdoc <- function(path, readme, file = NULL) {
    if (length(path) > 1) {
        x <- path
    } else {
        x <- suppressWarnings(readLines(path))
    }
    y <- suppressWarnings(readLines(readme))
    start <- which(grepl("<h1></h1>", x))
    end <- which(grepl("<h2>Help topics</h2>", x))
    x <- c(x[1:start], "", y, "", x[end:length(x)])
    if (!is.null(file)) {
        cat(paste(x, collapse="\n"), file = file)
    }
    return(x)
}

基本上你创建一个外部文件来插入读取我的部分。 我在qdap中使用了它,您可以通过此脚本查看如何使用它创建staticdoc网站


Until Hadley and his team are able to develop staticdocs and its documentation more here is my work around found in a very rough package:

#' Change read.me File
#'
#' Alter the read.me file with a preset.
#' 
#' @param path Path to the index.html file.
#' @param readme Path to the readme file.
#' @param file The path/file name to output.
readme_statdoc <- function(path, readme, file = NULL) {
    if (length(path) > 1) {
        x <- path
    } else {
        x <- suppressWarnings(readLines(path))
    }
    y <- suppressWarnings(readLines(readme))
    start <- which(grepl("<h1></h1>", x))
    end <- which(grepl("<h2>Help topics</h2>", x))
    x <- c(x[1:start], "", y, "", x[end:length(x)])
    if (!is.null(file)) {
        cat(paste(x, collapse="\n"), file = file)
    }
    return(x)
}

Basically you create an external document to insert into the read me portion. I used this in qdap and you can see how I use it in creating a staticdoc web site via this script.

相关问答

更多
  • 您可以通过在solutions explorer查找text file ,右键单击然后转到properties ,通过创建自述text file并将其放入应用程序contents来轻松添加自述text file 。 在属性中将build action更改为content ,我假设您需要copy if newer在copy to output folder选择了copy if newer 从这里只需进入您的Installer project的file system ,转到application folder然 ...
  • 许多不同的方式取决于github如何访问它,你可以在文档根目录(或自述文件所在的位置)的htaccess文件中添加一些内容。 使用mod_authz: Order Deny,Allow Deny from all 对于/readme.md 所有请求 ,这将返回403禁止。 如果要将特定IP列入白名单,可以Deny from all行的Deny from all上方添加: Allow from 12.34.56.78 这将把12.3 ...
  • 您必须将HTTP请求的Accept标头设置为application/vnd.github.html 。 $.ajax({ url: 'https://api.github.com/repos/just95/toml.dart/readme', headers: { 'Accept': 'application/vnd.github.html' } }).done(function(data) { alert(data); });