是否可以使用 autoconf 检查 nvcc 编译?
我正在尝试在配置过程中测试一些典型的cuda功能。我怎样才能把它写在我的configure.ac中?类似于:
AC_TRY_COMPILE([],
[
__global__ static void test_cuda() {
const int tid = threadIdx.x;
const int bid = blockIdx.x;
__syncthreads();
}
],
[cuda_comp=ok],[cuda_comp=no])
但是AC_LANG中没有定义nvcc。我必须创建自己的 m4 宏吗?
I am trying to test some typical cuda functions during the configure process. How can I write it in my configure.ac? Something like:
AC_TRY_COMPILE([],
[
__global__ static void test_cuda() {
const int tid = threadIdx.x;
const int bid = blockIdx.x;
__syncthreads();
}
],
[cuda_comp=ok],[cuda_comp=no])
But nvcc is not defined in AC_LANG. Must I create my own m4 macros?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我非常怀疑是否可以干净地挂钩 AC_LANG、AC_TRY_COMPILE 等系列宏而不实际重写 autoconf 的部分内容。
对您来说,安全的选择是只编写一个测试。除非您需要在多个项目中进行该测试,否则您甚至不需要将测试包装在 m4 宏中。
该测试将首先检查
nvcc
,然后创建一些测试源文件,最后尝试使用$NVCC
进行编译。然后它需要检查编译结果(返回代码和生成的文件),最后清理它可能生成的任何文件。类似的东西
I am highly doubtful whether it is possible to cleanly hook into the AC_LANG, AC_TRY_COMPILE etc. series of macros without actually rewriting parts of autoconf.
The safe bet for you is to just write a test. Unless you need that test in several projects, you do not even need to wrap the test in m4 macros.
The test would first check for
nvcc
, then create some test source file and finally try compiling that using$NVCC
. Then it needs to examine the results of the compilation (return code and generated files), and finally to clean up any files it might have generated.Something like