问题标签 [ptx]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
cuda - 当内核代码在 PTX 文件中并且主机代码也生成 PTX 文件时,在 Cuda 中使用纹理
我无法在 Windows 上使用 Cuda [4.2] 读取纹理。
我的程序读取一个包含所有内核模块的 ptx 文件。此外,编译过程会从一个简短的主机代码例程中生成一个额外的 ptx 文件。这是带有仅主机代码的 .cuh 文件和 .cu 文件:
在我的内核代码中对 tex2d 的每次调用都返回值 0 但我已经检查过并且数组中有有效数据。
我想知道我是否还需要加载 myBind.ptx,如果需要,它是如何加载的,何时何地加载?还是不需要?
谢谢你的帮助。
c++ - 一种使用 PTX 在 C++/CUDA 程序中计算浮点运算的方法
我有一个有点大的 CUDA 应用程序,我需要计算获得的 GFLOP。我正在寻找一种简单且通用的方法来计算浮点运算的数量。
是否可以使用汇编语言中预定义的 fpo 列表从生成的 PTX 代码(如下所示)中计算浮点运算?根据代码,计数可以通用吗?例如,是否add.s32 %r58, %r8, -2;
算作一次浮点运算?
例子:
还是有更简单的计算 FPO 的方法,这是浪费时间?
cuda - 如何找到活跃的SM?
有什么方法可以让我知道免费/活跃 SM 的数量吗?或者至少读取每个 SM 的电压/功率或温度值,我可以通过它知道它是否工作?(在 gpu 设备上执行某些作业时实时)。
%smid 帮助我知道了每个 SM 的 ID。类似的东西会有所帮助。
谢谢和问候, 拉克什
cuda - Cuda 错误 CUDA_ERROR_NO_BINARY_FOR_GPU
我有一些无法加载的 PTX 代码。我在 650M 上使用 OSX 运行它。其他 CUDA 示例在系统上运行良好,但在加载模块时,我总是收到错误 209:CUDA_ERROR_NO_BINARY_FOR_GPU
我错过了什么?
cuda - 在 PTX 中使用共享内存时出现“意外的地址空间”编译错误
我编写了一个简单的内核,在其中我将共享内存数组声明为
在我的内核启动中,我指定了共享内存的 number_of_bytes。编译内核(到 PTX)时出现错误“意外的地址空间”。我正在使用来自 svn 的相当新版本的 LLVM(3.3 正在进行中)。有什么想法我在这里做错了吗?问题似乎与 extern 关键字有关,但是我还要如何指定它呢?(共享内存)。我应该使用不同的 LLVM 构建吗?
配置 CUDA 5.0 , Nvidia Tesla C1060
clang - UNREACHABLE 执行!尝试生成 PTX 时出错
我正在尝试使用 clang/LLVM 3.2 版为“nbody”示例程序的内核(nbody_kernel.cu)生成 PTX 代码。nbody CUDA 程序在 Nvidia 的 SDK 中可用。
我指的是https://github.com/jholewinski/llvm-ptx-samples项目。
以下是我的命令,
clang++ -O4 -S -I/usr/local/cuda/include -emit-llvm -target nvptx64 nbody_kernel.cu -o nbody_kernel.ll
选择 -O3 -loop-unroll -unroll-allow-partial nbody_kernel.ll -o nbody_kernel.ll
llc nbody_kernel.ll -o nbody_kernel.ptx
执行最后一个命令(llc)后,我执行了一个 UNREACHABLE !以下堆栈跟踪错误
我用 __builtin_ptx_read_tid_x() 等替换了全局索引,例如 threadIdx.x。生成 LLVM IR(即 .ll)没有问题。尝试使用 llc 从 IR 生成 PTX 时弹出错误。
关于这里可能发生的事情的任何指示?
struct - 如何创建 LLVM 结构值?
我正在尝试创建结构类型的 LLVM 值。我正在使用 LLVM-C 接口并找到一个函数:
如果所有成员都是由 LLVMConstXXX() 创建的常量值,这将正常工作,它将生成如下代码:
但问题是如果成员不是恒定的,它会产生类似的东西:
当我将这段 LLVM 代码发送到 NVVM(Nvidia PTX 后端)时,它会说:
模块 0 (27, 39):解析错误:函数本地名称的使用无效
所以,我不知道这个结构值创建是否正确。我需要的是一个值,而不是分配的内存。
有人有想法吗?
问候,翔。
c - 将 PTX 程序直接传递给 CUDA 驱动程序
CUDA 驱动程序 API 提供从文件系统加载包含 PTX 代码的文件。通常会执行以下操作:
如果在运行时(即时)生成 PTX 文件,则通过文件 IO 似乎是一种浪费(因为驱动程序必须再次加载它)。
有没有办法将 PTX 程序直接传递给 CUDA 驱动程序(例如作为 C 字符串)?
dll - CUDA Expression Templates and Just in Time Compilation (JIT)
I have some questions about Just-In-Time (JIT) compilation with CUDA.
I have implemented a library based on Expression Templates according to the paper
J.M. Cohen, "Processing Device Arrays with C++ Metaprogramming", GPU Computing Gems - Jade Edition
It seems to work fairly good. If I compare the computing time of the matrix elementwise operation
D_D=A_D*B_D-sin(C_D)+3.;
with that of a purposely developed CUDA kernel, I have the following results (in parentheses, the matrix size):
time [ms] hand-written kernel: 2.05 (1024x1024) 8.16 (2048x2048) 57.4 (4096*4096)
time [ms] LIBRARY: 2.07 (1024x1024) 8.17 (2048x2048) 57.4 (4096*4096)
The library seems to need approximately the same computing time of the hand-written kernel. I'm also using the C++11 keyword auto to evaluate expressions only when they are actually needed, according to Expression templates: improving performance in evaluating expressions?. My first question is
1. Which kind of further benefit (in terms of code optimization) would JIT provide to the library? Would JIT introduce any further burdening due to runtime compilation?
It is known that a library based on Expression Templates cannot be put inside a .dll library, see for example http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/00edbe1d-4906-4d91-b710-825b503787e2. My second question is:
2. Would JIT help in hiding the implementation to a third-party user? If yes, how?
The CUDA SDK include the ptxjit example in which the ptx code is not loaded at runtime, but defined at compile time. My third question is:
3. How should I implement JIT in my case? Are there examples of JIT using PTX loaded at runtime?
Thank you very much for any help.
EDIT following Talonmies' comment
From the Cuda kernel just-in-time (jit) compilation possible? post, it reads that
cuda code can be compiled to an intermediate format ptx code, which will then be jit-compiled to the actual device architecture machine code at runtime
A doubt I have is whether the above can be applied to an Expression Templates library. I know that, due to instantiation problems, a CUDA/C++ template code cannot be compiled to a PTX. But perhaps if I instantiate all the possible combinations of Type/Operators for Unary and Binary Expressions, at least a part of the implementation can be compiled (and then masked to third-party users) to PTX which can be in turn JIT compiled to the architecture at hand.
cuda - 重载CUDA shuffle函数使原来的不可见
我正在尝试在 CUDA 中实现我自己的 64 位随机播放功能。但是,如果我这样做:
对 __shfl_xor 的所有后续调用都将从这个 64 位版本实例化,无论参数的类型是什么。例如,如果我正在做
它仍然会使用双重版本。解决方法可能是使用不同的函数名称。但是由于我是从模板函数中调用这个 shuffle 函数,所以使用不同的名称意味着我必须为 64 位浮点制作不同的版本,这不是很整洁。
那么如何在重载 __shfl_xor(double,...) 函数的同时仍然确保可以适当地调用 __shfl_xor(int,...) 呢?