Commit 2ed77ac4 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Logger should print only the active GPU, not all of them.

parent b2e40cba
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -26,6 +26,13 @@ getNumberOfDevices()
   return -1;
}

int
tnlCudaDeviceInfo::
getActiveDevice()
{
   return -1;
}

tnlString
tnlCudaDeviceInfo::
getDeviceName( int deviceNum )
+15 −6
Original line number Diff line number Diff line
@@ -29,6 +29,15 @@ getNumberOfDevices()
    return devices;
}

int
tnlCudaDeviceInfo::
getActiveDevice()
{
    int device;
    cudaGetDevice( &device );
    return device;
}

tnlString
tnlCudaDeviceInfo::
getDeviceName( int deviceNum )
+14 −12
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ class tnlCudaDeviceInfo

      static int getNumberOfDevices();

      static int getActiveDevice();

      static tnlString getDeviceName( int deviceNum );

      static int getArchitectureMajor( int deviceNum );
+10 −6
Original line number Diff line number Diff line
@@ -73,12 +73,16 @@ bool tnlLogger :: writeSystemInformation( const tnlParameterContainer& parameter
   writeParameter< tnlString >( "Cache (L1d, L1i, L2, L3):", cacheInfo, 1 );
   if( parameters.getParameter< tnlString >( "device" ) == "cuda" )
   {      
      int devices = tnlCudaDeviceInfo::getNumberOfDevices();
      writeParameter< tnlString >( "CUDA GPU info", tnlString("") );   
      writeParameter< int >( "Number of devices", devices,1 );
      for( int i = 0; i < devices; i++ )
      {
        writeParameter< int >( "Device no.", i, 1 );       
      // TODO: Printing all devices does not make sense, but in the future TNL
      //       might use more than one device for computations. Printing only
      //       the active device for now...
//      int devices = tnlCudaDeviceInfo::getNumberOfDevices();
//      writeParameter< int >( "Number of devices", devices, 1 );
//      for( int i = 0; i < devices; i++ )
//      {
//        writeParameter< int >( "Device no.", i, 1 );
        int i = tnlCudaDeviceInfo::getActiveDevice();
        writeParameter< tnlString >( "Name", tnlCudaDeviceInfo::getDeviceName( i ), 2 );
        tnlString deviceArch = tnlString( tnlCudaDeviceInfo::getArchitectureMajor( i ) ) + "." +
                                tnlString( tnlCudaDeviceInfo::getArchitectureMinor( i ) );
@@ -91,7 +95,7 @@ bool tnlLogger :: writeSystemInformation( const tnlParameterContainer& parameter
        double memoryClockRate = ( double ) tnlCudaDeviceInfo::getMemoryClockRate( i ) / 1.0e3;
        writeParameter< double >( "Memory clock rate (in Mhz)", memoryClockRate, 2 );
        writeParameter< bool >( "ECC enabled", tnlCudaDeviceInfo::getECCEnabled( i ), 2 );         
      }
//      }
   }
   writeParameter< tnlString >( "System:", systemInfo.getSystemName() );
   writeParameter< tnlString >( "Release:", systemInfo.getSystemRelease() );