2018-08-16 15:38:47 +08:00
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <list>
|
|
|
|
|
2013-02-26 17:02:54 +08:00
|
|
|
int main()
|
|
|
|
{
|
2018-08-16 15:38:47 +08:00
|
|
|
std::ostringstream arch;
|
|
|
|
std::list<std::string> archs;
|
|
|
|
|
2013-02-26 17:02:54 +08:00
|
|
|
int count = 0;
|
2018-08-16 15:38:47 +08:00
|
|
|
if (cudaSuccess != cudaGetDeviceCount(&count)){ return -1; }
|
|
|
|
if (count == 0) { return -1; }
|
2013-02-26 17:02:54 +08:00
|
|
|
for (int device = 0; device < count; ++device)
|
|
|
|
{
|
|
|
|
cudaDeviceProp prop;
|
2018-08-16 15:38:47 +08:00
|
|
|
if (cudaSuccess != cudaGetDeviceProperties(&prop, device)){ continue; }
|
|
|
|
arch << prop.major << "." << prop.minor;
|
|
|
|
archs.push_back(arch.str());
|
|
|
|
arch.str("");
|
2013-02-26 17:02:54 +08:00
|
|
|
}
|
2018-08-16 15:38:47 +08:00
|
|
|
archs.unique(); #Some devices might have the same arch
|
|
|
|
for (std::list<std::string>::iterator it=archs.begin(); it!=archs.end(); ++it)
|
|
|
|
std::cout << *it << " ";
|
2013-02-26 17:02:54 +08:00
|
|
|
return 0;
|
2013-08-21 21:26:54 +08:00
|
|
|
}
|