2013-04-21 74 views
1

您好我想安装在Ubuntu nVidia的Optix的SDK 3.0.0版本献给LINUX64。安装NVIDIA Optix的SDK 3.0.0的Ubuntu 12.04

我已下载.run文件。当执行结束我有一个叫做〜/ NVIDIA-Optix公司-SDK-3.0.0-LINUX64 /文件夹

这是在我的主文件夹。

预编译的例子很好地工作,但是当我尝试编译我自己的代码编译器似乎处理.CU文件作为CUDA文件,并试图将它们编译到.cu.o。我的程序错误的 一个输出是:

Building NVCC (Device) object CMakeFiles/RayTracerExec.dir/src/Tracy/ObjectLoader/optixcu/./RayTracerExec_generated_triangle_mesh_target.cu.o 

通常情况下,文件应该编译成某种PTX文件?

以下的错误是:

ptxas /tmp/tmpxft_00000eef_00000000-5_triangle_mesh_target.ptx, line 94; error : Label expected for argument 0 of instruction 'call' 
ptxas /tmp/tmpxft_00000eef_00000000-5_triangle_mesh_target.ptx, line 94; error : Call target not recognized 
ptxas /tmp/tmpxft_00000eef_00000000-5_triangle_mesh_target.ptx, line 94; error : Function '_rt_buffer_get_64' not declared in this scope 

中没有找到功能_rt_buffer_get_64的让我觉得有些事情是不正确安装。

在文件夹命名为 文档的子文件夹包括lib64的SDK SDK-预编译样本 我所做的就是复制内容包括到/ usr /本地/包括 和lib64的内容到/ usr /本地/ lib

任何想法? 问候

回答

1

看起来你正在使用的CMake来构建你的样品从输出的文本判断。它看起来像构建系统认为你想编译目标文件,而不是PTX文件。您所看到的错误消息也表明了这种症状。

有几种从CMake内部编译CUDA代码的方法。

如果您使用的是CUDA运行时间,那么你通常执行以下操作:

cuda_add_executable(myprogram main.cpp mycuda.cu myheader.h) 

这将创建一个由两个目标文件的可执行文件名为myprogram:main.cpp.o和mycuda.cu的.o。 CUDA运行时期望cuda文件内的代码符合CUDA运行时API。

除了cuda_add_executable还有cuda_add_library,其编译一个库,而不是可执行的。这两个宏都使用另一个名为cuda_wrap_srcs的宏,它可以完成大部分繁重的工作,只要生成构建命令即可编译CUDA代码。除此之外,此宏有一个参数用于指定您是要使用CUDA运行时还是仅指定PTX(参数为OBJ或PTX)。

为了让OptiX着色器编译,您必须定位PTX。在我们发货的SDK中,这是通过一个名为OPTIX_add_sample_executable的CMake函数处理的,可以在<install>/SDK/CMakeLists.txt中找到。大多数情况下,该功能的作用是使用指定的PTX选项拨打cuda_wrap_srcs。我在这里也包含了这个函数供参考。

######################################################### 
# OPTIX_add_sample_executable 
# 
# Convenience function for adding samples to the code. You can copy the contents of this 
# function into your individual project if you wish to customize the behavior. Note that 
# in CMake, functions have their own scope, whereas macros use the scope of the caller. 
function(OPTIX_add_sample_executable target_name) 

    # These calls will group PTX and CUDA files into their own directories in the Visual 
    # Studio projects. 
    source_group("PTX Files" REGULAR_EXPRESSION ".+\\.ptx$") 
    source_group("CUDA Files" REGULAR_EXPRESSION ".+\\.cu$") 

    # Separate the sources from the CMake and CUDA options fed to the macro. This code 
    # comes from the CUDA_COMPILE_PTX macro found in FindCUDA.cmake. We are copying the 
    # code here, so that we can use our own name for the target. target_name is used in the 
    # creation of the output file names, and we want this to be unique for each target in 
    # the SDK. 
    CUDA_GET_SOURCES_AND_OPTIONS(source_files cmake_options options ${ARGN}) 

    # Create the rules to build the PTX from the CUDA files. 
    CUDA_WRAP_SRCS(${target_name} PTX generated_files ${source_files} ${cmake_options} 
    OPTIONS ${options}) 

    # Here is where we create the rule to make the executable. We define a target name and 
    # list all the source files used to create the target. In addition we also pass along 
    # the cmake_options parsed out of the arguments. 
    add_executable(${target_name} 
    ${source_files} 
    ${generated_files} 
    ${cmake_options} 
    ) 

    # Most of the samples link against the sutil library and the optix library. Here is the 
    # rule that specifies this linkage. 
    target_link_libraries(${target_name} 
    sutil 
    optix 
    ${optix_rpath} 
    ) 
endfunction()