完全禁用NVCC的优化 [英] Completely disable optimizations on NVCC

查看:388
本文介绍了完全禁用NVCC的优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测量GPU上的峰值单精度触发器,因为我正在修改PTX文件以对寄存器执行连续的MAD指令。不幸的是,编译器删除所有的代码,因为它实际上没有什么有用的,因为我不执行任何加载/存储的数据。是否有编译器标志或编译指令添加到代码,以便编译器不会碰它?

I'm trying to measure peak single-precision flops on my GPU, for that I'm modifying a PTX file to perform successive MAD instructions on registers. Unfortunately the compiler is removing all the code because it actually does nothing usefull since I do not perform any load/store of the data. Is there a compiler flag or pragma to add to the code so the compiler does not touch it?

谢谢。

推荐答案

我不认为有任何方法来关闭这样的优化在编译器。您可以通过添加代码来存储您的值,并将该代码包装在总是false的条件语句中来解决此问题。要使编译器不能确定始终为false,使用至少一个变量(不只是常量)。

I don't think there is any way to turn off such optimization in the compiler. You can work around this by adding code to store your values and wrapping that code in a conditional statement that is always false. To make a conditional that the compiler can't determine to always be false, use at least one variable (not just constants).

这篇关于完全禁用NVCC的优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆