简体   繁体   English

在CUDA中,Nsight在时间轴上不显示cuInit(0)调用

[英]In CUDA, Nsight doesn't show cuInit(0) call in timeline

I have following code in my program that works with pure driver API, 我的程序中有以下与纯驱动程序API兼容的代码,

cuInit(0)

and Nvidia Visual Profiler 8.0 is not showing it on timeline graph. Nvidia Visual Profiler 8.0不在时间轴图上显示它。

Can I call it once in a while, or as frequently as pc wake-ups or should it be called only maximum once per process(which would need a singleton-like or some globally synchronized initializer wrapper for the application)? 我可以不定期调用一次,还是可以像唤醒计算机一样频繁地调用它,还是应该在每个进程中仅调用一次最大值(对于应用程序,它需要类似单例或全局同步的初始化程序包装器)?

Should I expect a trivial time loss per call always? 我是否应该总是希望每次通话都浪费很少的时间?

Does cuda driver API has an internal counter for it so that if somehow driver API unloads, it automatically re-loads it so I don't have to run it again later? cuda驱动程序API是否具有内部计数器,以便如果以某种方式卸载驱动程序API,它会自动重新加载它,因此我以后不必再次运行它?

What if this C++ is a DLL and will be called from C#, Java, Phyton? 如果此C ++是DLL并从C#,Java,Phyton中调用,该怎么办? Can other third-party libraries initialize it before my application? 其他第三方库可以在我的应用程序之前对其进行初始化吗? I know GPU does context switching between processes(is driver API independent per process?) but does this initialization command hinder others' work by accident(for example, in a cloud computer where N other users run CUDA too)? 我知道GPU是否在进程之间进行上下文切换(每个进程的驱动程序API是否独立吗?),但是此初始化命令是否会偶然阻止其他人的工作(例如,在N个其他用户也运行CUDA的云计算机中)?

cuInit() should be called once per application, before any other cuda driver API calls are used . 在使用任何其他cuda驱动程序API调用之前 ,应每个应用程序一次调用cuInit()

I think the fact that it does not show up in the timeline is expected behavior. 我认为它没有显示在时间表中的事实是预期的行为。

There will be some time cost associated with cuInit() . cuInit()相关的时间成本会有所增加。 I wouldn't call it "trivial". 我不会称其为“琐碎的”。 It will vary based on a variety of system configuration parameters. 它会根据各种系统配置参数而有所不同。

There is no concept of the driver API "unloading". 没有驱动程序API“卸载”的概念。

If you use any driver API calls in a library, this call must precede them as well, in library code. 如果您在库中使用任何驱动程序API调用,则此调用也必须在库代码中位于它们之前。

I think you might be getting this confused with a CUDA context . 我认为您可能会将此与CUDA 上下文混淆。 cuInit() does not create a context (ignoring the primary context). cuInit()不会创建上下文(忽略主要上下文)。 If you have a context created, it is possible to pass that context to other routines, even if they are in a dynamically linked library. 如果创建了上下文,则可以将该上下文传递给其他例程,即使它们位于动态链接的库中也是如此。

This call has no bearing on CUDA running in another process. 该调用与在另一个进程中运行的CUDA无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM