标签: nvapi

如何获取dll-function的id(内存地址)?

我想在C#"NvAPI_DRS_EnumProfiles"中使用来自nvapi的函数.我必须使用函数的id调用QueryInterface(id).一切都工作正常,我发现我需要在网络上的其他功能的ID,但我找不到这个单一功能的ID,我不知道如何得到它.我尝试了很多东西,甚至一个打印我内存地址的c程序也行不通.

我的代码看起来像这样:http://www.drivenbynostalgia.com/files/SOP.cs

谢谢您的帮助 :)

c# dll queryinterface memory-address nvapi

10
推荐指数
3
解决办法
4412
查看次数

NvAPI NVAPI_INTERFACE 缺少显式类型

我是 c++/cli 的新手,想为 nvapi 编写一个小的托管包装器。
现在,当尝试访问某些函数(例如 NvAPI_Initialize)时,
Visual Studio 告诉我该函数未定义:

#include "nvapi.h";    

NvAPIStatus Nv_GPU_ThermalAPI::M_NvAPI_GPU_GetThermalSettings(System::UIntPtr gpuHandle,
                                                              Nv_Thermal_Target sensorIndex,
                                                              [Out] array<Nv_GPU_Thermal_Settings^>^% settings)
{
    NvAPI_Status res = NvAPI_Status::NVAPI_OK;             // OK
    NvPhysicalGpuHandle handle;                            // OK
    NV_GPU_THERMAL_SETTINGS *settings;                     // OK

    res = NvAPI_Initialize();                              // Error
    res = NvAPI_GPU_GetThermalStatus(handle, 0, settings); // same here
}
Run Code Online (Sandbox Code Playgroud)

我已经按照此处的描述包含了 nvapi.lib 。

额外的 VS 告诉我,在例如

NVAPI_INTERFACE NvAPI_Initialize();
Run Code Online (Sandbox Code Playgroud)

NVAPI_INTERFACE 缺少显式类型,将假定为 'int'。
尝试构建我的代码此消息变成 C2059: 语法错误 'return' 并且 VS 在 100 个错误后取消构建。我正在使用 VS 2013 Pro。

编辑: NVAPI_INTERFACE 定义如下:
'#define NVAPI_INTERFACE extern …

c++ nvapi visual-studio-2013

4
推荐指数
1
解决办法
799
查看次数

包含 Nvidia 的 nvapi.h 会导致编译错误

我正在尝试使用 NVIDIA 的nvapi,但出现了我不完全理解的编译错误。也许我使用了错误的编译器?

#include "nvapi.h"
#include <iostream>

int main()
{
    printf("Hello nvapi!");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

汇编: g++ nvapi_hello.cpp

输出(因太长而被截断):

In file included from nvapi_lite_d3dext.h:35:0,
                 from nvapi.h:6,
                 from nvapi_hello.cpp:1:
nvapi_lite_salstart.h:821:41: warning: '__success' initialized and declared 'extern'
 #define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl
                                         ^
nvapi.h:99:1: note: in expansion of macro 'NVAPI_INTERFACE'
 NVAPI_INTERFACE NvAPI_Initialize();
 ^~~~~~~~~~~~~~~
nvapi_lite_salstart.h:821:42: error: expected primary-expression before 'return'
 #define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl
                                          ^
nvapi.h:99:1: note: in expansion of macro 'NVAPI_INTERFACE'
 NVAPI_INTERFACE NvAPI_Initialize(); …
Run Code Online (Sandbox Code Playgroud)

c++ nvidia nvapi

4
推荐指数
1
解决办法
2151
查看次数

如何在Linux上获取连接显示器到gpu的数量?

我需要确定给定的CUDA设备是否已连接显示器.我知道没有CUDA功能可以做到这一点.

在Windows上,我可以使用NVAPI获取连接显示器的数量以及每个设备的PCI总线/插槽ID.使用后者,我可以找到匹配的CUDA设备(通过调用cudaGetDeviceProperties).

如何在没有NVAPI的Linux上做同样的事情?

从技术上讲,我需要的是Linux替代以下代码:

NvAPI_Initialize();

NvPhysicalGpuHandle gpuHandles[64];
NvU32 numOfGPUs;
NvAPI_EnumPhysicalGPUs(gpuHandles, &numOfGPUs);

for (int i = 0; i < numOfGPUs; i++)
{
    NvU32 connected_displays = 0;
    NvU32 busId = 0;
    NvU32 busSlotId = 0;

    NvAPI_GPU_GetConnectedDisplayIds(gpuHandles[i], NULL, &connected_displays, NULL);
    NvAPI_GPU_GetBusId(gpuHandles[i], &busId);
    NvAPI_GPU_GetBusSlotId(gpuHandles[i], &busSlotId);

    printf("Current device: %d\n", i);
    printf("Number of connected displays: %u\n", connected_displays);
    printf("Bus id: %u\tBus slot id: %u\n", busId, busSlotId);
}

NvAPI_Unload();
Run Code Online (Sandbox Code Playgroud)

linux cuda gpu nvidia nvapi

3
推荐指数
1
解决办法
1577
查看次数

标签 统计

nvapi ×4

c++ ×2

nvidia ×2

c# ×1

cuda ×1

dll ×1

gpu ×1

linux ×1

memory-address ×1

queryinterface ×1

visual-studio-2013 ×1