MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / setCudaDevice

Function setCudaDevice

samples/common/sampleDevice.h:514–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512};
513
514inline void setCudaDevice(int device, std::ostream& os)
515{
516 cudaCheck(cudaSetDevice(device));
517
518 cudaDeviceProp properties;
519 cudaCheck(cudaGetDeviceProperties(&properties, device));
520
521 // clang-format off
522 os << "=== Device Information ===" << std::endl;
523 os << "Selected Device: " << properties.name << std::endl;
524 os << "Compute Capability: " << properties.major << "." << properties.minor << std::endl;
525 os << "SMs: " << properties.multiProcessorCount << std::endl;
526 os << "Device Global Memory: " << (properties.totalGlobalMem >> 20) << " MiB" << std::endl;
527 os << "Shared Memory per SM: " << (properties.sharedMemPerMultiprocessor >> 10) << " KiB" << std::endl;
528 os << "Memory Bus Width: " << properties.memoryBusWidth << " bits"
529 << " (ECC " << (properties.ECCEnabled != 0 ? "enabled" : "disabled") << ")" << std::endl;
530 os << "Application Compute Clock Rate: " << properties.clockRate / 1000000.0F << " GHz" << std::endl;
531 os << "Application Memory Clock Rate: " << properties.memoryClockRate / 1000000.0F << " GHz" << std::endl;
532 os << std::endl;
533 os << "Note: The application clock rates do not reflect the actual clock rates that the GPU is "
534 << "currently running at." << std::endl;
535 // clang-format on
536}
537
538inline int32_t getCudaDriverVersion()
539{

Callers 1

mainFunction · 0.85

Calls 1

cudaCheckFunction · 0.85

Tested by

no test coverage detected