以程式設計方式查詢GPU裝置屬性

2021-10-10 17:52:47 字數 684 閱讀 9829

由於 gpu 上的 sm 數量會因所用的特定 gpu 而異,因此為支援可移植性,您不得將 sm 數量硬編碼到**庫中。相反,應該以程式設計方式獲取此資訊。

以下所示為在 cuda c/c++ 中獲取 c 結構的方法,該結構包含當前處於活動狀態的 gpu 裝置的多個屬性,其中包括裝置的 sm 數量:

int deviceid;

cudagetdevice(&deviceid); // `deviceid` now points to the id of the currently active gpu.

cudadeviceprop props;

cudagetdeviceproperties(&props, deviceid); // `props` now has many useful properties about

// the active gpu device.

#include int main()

tesla v100 的裝置屬性:

device id: 0

number of sms: 80

compute capability major: 7

compute capability minor: 0

warp size: 32

以程式設計方式建立使用者控制項

與普通伺服器控制項一樣,使用者控制項也可以以程式設計方式建立。通過傳入使用者控制項原始檔的虛擬路徑,可使用頁的 loadcontrol 方法載入使用者控制項 control c1 loadcontrol usercontrol.ascx usercontrol c1 category busines...

009 裝置樹屬性的獲取 以LED為例

linux引入裝置樹,把硬體分到裝置樹檔案中,驅動中仍然需要硬體資訊。所以必須將裝置樹中的硬體資訊傳到驅動中。裝置樹屬性獲取函式標頭檔案 include linux of.h 裝置樹中使用 device node 結構體描述節點,of.h中的api需要device node作為引數傳入。struct...

MyBatis學習筆記(二) 以介面方式程式設計

前面已經搭建好了eclipse,mybatis,mysql的環境,並且實現了乙個簡單的查詢。請注意,這種方式是用sqlsession例項來直接執行已對映的sql語句 其實還有更簡單的方法,而且是更好的方法,使用合理描述引數和sql語句返回值的介面 比如iuseroperation.class 這樣現...