如何链接到cublas库在eclipse Nsight? [英] How to link to cublas library in eclipse Nsight?

查看:726
本文介绍了如何链接到cublas库在eclipse Nsight?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Nvidia的示例代码为simpleCUBLAS。该示例带有一个Makefile,或者我可以这样编译:

I am using Nvidia's example code for simpleCUBLAS. The example comes with a Makefile, or I can compile it like this:

g ++ -m32 -I / usr / local / cuda / include -I。 -o simpleCUBLAS.o -c simpleCUBLAS.cc
g ++ -m32 -o simpleCUBLAS simpleCUBLAS.o -L / usr / local / cuda / lib -l cudart -l cublas

g++ -m32 -I/usr/local/cuda/include -I. -o simpleCUBLAS.o -c simpleCUBLAS.cc g++ -m32 -o simpleCUBLAS simpleCUBLAS.o -L/usr/local/cuda/lib -l cudart -l cublas

(-I。包含的文件是cuda_runtime.h helper_cuda.h helper_string.h)

(the files included by the "-I." are cuda_runtime.h helper_cuda.h helper_string.h)

这样编译和运行就好了。
然而,我想使用Eclipse的Nsight编辑器为CUDA。

This compiles and runs just fine. However, I would like to make this using Eclipse's Nsight editor for CUDA.

我的问题是:
如何添加这些选项到Eclipse (-L / usr / local / cuda / lib -l cudart -l cublas,& the -I。)Nsight?

My Question is: How to I add these options to Eclipse (the -L/usr/local/cuda/lib -l cudart -l cublas, & the -I.) Nsight?

其他详细信息:
我使用Linux。
我在Eclipse和其他地方看到了一些信息c / c ++项目,在这里我使用cuda c / c ++项目。

Other details: Am using Linux. I've seen some info elsewhere for Eclipse & c/c++ Project, BUT here I am using cuda c/c++ Project.

谢谢。

推荐答案

我不认为这是特定于Nsight Eclipse版本。您要做的是对使用Eclipse构建的任何C / C ++项目的标准操作。 Nsight EE不以任何主要方式改变这些步骤。您可以使用Nsight EE中的内置Eclipse帮助轻松获得有关这些主题的帮助。例如:

I don't think any of this is specific to Nsight Eclipse Edition. What you are trying to do are standard operations for any C/C++ project built using Eclipse. Nsight EE doesn't change these steps in any major way. You can get help easily enough on these topics using the built-in Eclipse help in Nsight EE. For example:


  • 在搜索中打开帮助(选择帮助...帮助内容)

  • 框类型添加库

  • 点击帮助搜索窗格中返回的第一个项目

您的所有问题(添加库路径,添加库,添加包含路径)都与项目属性有关。我们可以直接通过以下方式访问这些属性:

All of your questions (adding library paths, adding libraries, adding include paths) have to do with the Project Properties. We can access these properties directly by:


  • 在Nsight EE中打开项目

  • 窗格中,右键单击要检查/修改其属性的项目,然后从弹出菜单中选择属性(菜单中的最后一项)

  • 现在,项目属性窗格已打开。

  • 在属性对话框中点击常规旁边的三角形。这将打开常规子菜单。

  • 在常规下,单击路径和符号一般的Eclipse帮助会带你走得更远。

  • 现在点击CUDA C(是,这是一个不同的步骤。)

  • 顶部的选项卡现在包括包括 ,库路径等。通过选择这些标签中的任何一个,您可以添加或修改相应的条目。

  • 例如,我们添加cublas库,

  • 现在点击添加按钮

  • 输入图书馆的名称,它是 cublas ,而不是lcublas,而不是-lcublas

  • 现在单击确定,应用并退出属性,构建项目并确认-lcublas已添加到构建命令

  • Open the project in Nsight EE
  • In the project pane on the left, right-click on the project whose properties you wish to inspect/modify, then select "Properties" from the pop-up menu (the last item in the menu)
  • The project properties pane is now open.
  • Click on the triangle next to "General" in the properties dialog. This will open the "General" sub-menu.
  • Under General, click on "Paths and Symbols" The generic Eclipse help would have taken you this far.
  • Now click on "CUDA C" (Yes this is the one step that is different.)
  • The tabs across the top now include selections for things like "Includes", Libraries", "Library Paths" etc. By selecting any one of these tabs, you can add or modify the appropriate entries.
  • So as one example, let's add the cublas library. Select the "Libraries" tab.
  • Now click the "Add" button
  • Enter the name of the library. It is cublas, not lcublas, and not -lcublas
  • now click "OK", "Apply" and exit out of the properties, build your project, and confirm that -lcublas has been added to the build command

这篇关于如何链接到cublas库在eclipse Nsight?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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