@@ -50,8 +50,10 @@ namespace stdgpu::cuda
5050void
5151print_device_information ()
5252{
53+ int device = 0 ;
54+
5355 cudaDeviceProp properties;
54- if (cudaGetDeviceProperties (&properties, 0 ) != cudaSuccess)
56+ if (cudaGetDeviceProperties (&properties, device ) != cudaSuccess)
5557 {
5658 printf (" +---------------------------------------------------------+\n " );
5759 printf (" | Invalid CUDA Device |\n " );
@@ -66,6 +68,9 @@ print_device_information()
6668 std::size_t total_memory = 0 ;
6769 STDGPU_CUDA_SAFE_CALL (cudaMemGetInfo (&free_memory, &total_memory));
6870
71+ int clock_rate = 0 ;
72+ cudaDeviceGetAttribute (&clock_rate, cudaDevAttrClockRate, device);
73+
6974 std::string gpu_name = properties.name ;
7075 const int gpu_name_total_width = 57 ;
7176 int gpu_name_size = static_cast <int >(gpu_name.size ());
@@ -77,7 +82,7 @@ print_device_information()
7782 printf (" +---------------------------------------------------------+\n " );
7883 printf (" | Compute Capability : %1d.%1d |\n " , properties.major , properties.minor );
7984 printf (" | Clock rate : %-6.0f MHz |\n " ,
80- static_cast <double >(detail::kilo_to_mega_hertz (static_cast <float >(properties. clockRate ))));
85+ static_cast <double >(detail::kilo_to_mega_hertz (static_cast <float >(clock_rate ))));
8186 printf (" | Global Memory : %-6.3f GiB / %-6.3f GiB |\n " ,
8287 static_cast <double >(detail::byte_to_gibi_byte (static_cast <float >(free_memory))),
8388 static_cast <double >(detail::byte_to_gibi_byte (static_cast <float >(total_memory))));
0 commit comments