獲取本機cuda版本號

2021-10-05 08:30:14 字數 595 閱讀 7778

vs2015 平台x64:

通過安裝cuda的nvidia gpu computing toolkit,引用nvidia gpu computing toolkit\cuda\v10.0\include和對應的lib(cudart_static.lib),使用cudadrivergetversion介面就可以獲取到,返回如10010,版本號對應的是int major=10010/1000;int minor=(10010%1000)/10;即10.1;也可以使用cudaruntimegetversion獲取cuda執行時庫,當時在我的本機上兩個介面的返回值是一樣的,沒太在意這件事,後來把介面給別人使用時,出現編譯不通過和返回值異常問題;

1)首先,如果使用vs2010,win32下,對應的庫應該選擇win32下的庫,新增庫cudart.lib,而不是cudart_static.lib;

2)cudaruntimegetversion在部分機器上沒有返回值,因為我的機器是用來開發,安裝cuda時安裝了nvidia gpu computing toolkit,但是一般客戶電腦上沒有安裝,因此返回值會有問題;

所以要謹慎使用cudadrivergetversion和cudaruntimegetversion;

獲取程式版本號

取程序版本號碼 vc 2008 控制台程式的版本資源需要手動插入 include stdafx.h include pragma comment lib,version.lib dword getver word wver1,word wver2,word wver3,word wver4 int ...

Swift 獲取版本號

swift版本 let infodictionary bundle.main.infodictionary if let infodictionary infodictionaryoc版本 nsdictionary infodictionary nsbundle mainbundle infodic...

獲取版本號 nginx小技巧之隱藏版本號

比如,163映象站,我們隨意訪問乙個不存在的資源,然後看nginx返回的資訊,可以看到只返回了nginx,並沒有看到其版本號。在nginx的配置檔案新增乙個指令 server tokens off 這個指令可以新增在http,server,location中。一般直接新增在http指令塊中。ps 這...