Commit 945ff662 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Adding cmake test to installation script.

Adding CUDA architecure and CUDA cores to log.
parent 6e7288b2
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -5,6 +5,21 @@ BUILD_RELEASE="yes"

OPTIONS=""

CMAKE_TEST=`which cmake`
echo ${CMAKE_TEST}
if test x${CMAKE_TEST} = "x";
then
    echo "Cmake is not installed on your system. Please install it by:"
    echo ""
    echo "   sudo apt-get install cmake     on Ubuntu and Debian based systems"
    echo "   sudo yum install cmake         on RedHat, Fedora or CentOS"
    echo "   sudo zypper install cmake      on OpenSuse"
    echo ""
    echo "You may also install it from the source code at:"
    echo " http://www.cmake.org/download/"
    exit 1
fi

for option in "$@"
do
    case $option in
+29 −0
Original line number Diff line number Diff line
@@ -33,6 +33,20 @@ getDeviceName( int deviceNum )
   return tnlString( "" );
}

int
tnlCudaDeviceInfo::
getArchitectureMajor( int deviceNum )
{
    return 0;
}
      
int
tnlCudaDeviceInfo::
getArchitectureMinor( int deviceNum )
{
    return 0;
}

int
tnlCudaDeviceInfo::
getClockRate( int deviceNum )
@@ -67,4 +81,19 @@ getCudaMultiprocessors( int deviceNum )
   return 0;
}

int
tnlCudaDeviceInfo::
getCudaCoresPerMultiprocessors( int deviceNum )
{
   return 0;
}

int
tnlCudaDeviceInfo::
getCudaCores( int deviceNum )
{
   return 0;
}


#endif
 No newline at end of file
+54 −0
Original line number Diff line number Diff line
@@ -38,6 +38,24 @@ getDeviceName( int deviceNum )
    return tnlString( properties.name );
}

int
tnlCudaDeviceInfo::
getArchitectureMajor( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return properties.major;
}
      
int
tnlCudaDeviceInfo::
getArchitectureMinor( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return properties.minor;
}
      
int
tnlCudaDeviceInfo::
getClockRate( int deviceNum )
@@ -83,4 +101,40 @@ getCudaMultiprocessors( int deviceNum )
    return properties.multiProcessorCount;
}

int
tnlCudaDeviceInfo::
getCudaCoresPerMultiprocessors( int deviceNum )
{
    int major = tnlCudaDeviceInfo::getArchitectureMajor( deviceNum );
    int minor = tnlCudaDeviceInfo::getArchitectureMinor( deviceNum );
    switch( major )
    {
        case 1:   // Tesla generation, G80, G8x, G9x classes
            return 8;
        case 2:   // Fermi generation
        switch( minor )
        {
            case 0:  // GF100 class
                return 32; 
            case 1:  // GF10x class
                return 48;
        }
        case 3: // Kepler generation -- GK10x, GK11x classes
            return 192;
        case 5: // Maxwell generation -- GM10x, GM20x classes
            return 128;
        default:
            return -1;
    }
}

int
tnlCudaDeviceInfo::
getCudaCores( int deviceNum )
{
    return tnlCudaDeviceInfo::getCudaMultiprocessors( deviceNum ) *
           tnlCudaDeviceInfo::getCudaCoresPerMultiprocessors( deviceNum );
}


#endif
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@ class tnlCudaDeviceInfo
      
      static tnlString getDeviceName( int deviceNum );
      
      static int getArchitectureMajor( int deviceNum );
      
      static int getArchitectureMinor( int deviceNum );
      
      static int getClockRate( int deviceNum );
      
      static int getGlobalMemory( int deviceNum );
@@ -38,6 +42,10 @@ class tnlCudaDeviceInfo

      static int getCudaMultiprocessors( int deviceNum );      
      
      static int getCudaCoresPerMultiprocessors( int deviceNum );      
      
      static int getCudaCores( int deviceNum );      
      
};


+4 −1
Original line number Diff line number Diff line
@@ -145,6 +145,9 @@ bool tnlLogger :: writeSystemInformation( const tnlParameterContainer& parameter
      {
         writeParameter< int >( "Device no.", i, 1 );       
         writeParameter< tnlString >( "Name", tnlCudaDeviceInfo::getDeviceName( i ), 2 );
         tnlString deviceArch = tnlString( tnlCudaDeviceInfo::getArchitectureMajor( i ) ) + "." +
                                tnlString( tnlCudaDeviceInfo::getArchitectureMinor( i ) );
         writeParameter< tnlString >( "Architecture", deviceArch, 2 );
         double clockRate = ( double ) tnlCudaDeviceInfo::getClockRate( i ) / 1.0e3;
         writeParameter< double >( "Clock rate (in MHz)", clockRate, 2 );
         double globalMemory = ( double ) tnlCudaDeviceInfo::getGlobalMemory( i ) / 1.0e9;
@@ -152,7 +155,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< int >( "CUDA multiprocessors", tnlCudaDeviceInfo::getCudaMultiprocessors( i ), 2 );
         writeParameter< int >( "CUDA cores", tnlCudaDeviceInfo::getCudaCores( i ), 2 );
      }
    }
   file. close();