Commit 6e7288b2 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Small fixis in tnlGrid and logs.

parent 2bfc2596
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ navierStokesSolverMonitor< Real, Index > :: navierStokesSolverMonitor()
template< typename Real, typename Index >
void navierStokesSolverMonitor< Real, Index > :: refresh()
{
   if( this -> verbose > 0 && this -> refreshing % this -> outputPeriod == 0 )
   if( this -> verbose > 0 && this -> refresRate % this -> refreshRate == 0 )
   {
      cout << "V=( " << uMax
           << " , " << uAvg
+22 −20
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ set (headers tnlAssert.h
             tnlConstants.h
             tnlCurve.h
      	     tnlCuda.h
             tnlCudaDeviceInfo.h
             tnlDataElement.h
  	     tnlDevice.h
             tnlDynamicTypeTag.h
@@ -56,6 +57,7 @@ IF( BUILD_CUDA )
        ${tnl_core_vectors_CUDA__SOURCES}
        ${common_SOURCES} 
        ${CURRENT_DIR}/tnlCuda.cu
        ${CURRENT_DIR}/tnlCudaDeviceInfo.cu
        PARENT_SCOPE )
ENDIF()    

+70 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlCudaDeviceInfo.cpp  -  description
                             -------------------
    begin                : Jun 21, 2015
    copyright            : (C) 2007 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef HAVE_CUDA

#include <core/tnlCudaDeviceInfo.h>

int
tnlCudaDeviceInfo::
getNumberOfDevices()
{
   return -1;
}
      
tnlString
tnlCudaDeviceInfo::
getDeviceName( int deviceNum )
{
   return tnlString( "" );
}
      
int
tnlCudaDeviceInfo::
getClockRate( int deviceNum )
{
   return 0;
}
      
int
tnlCudaDeviceInfo::
getGlobalMemory( int deviceNum )
{
   return 0;
}

int
getMemoryClockRate( int deviceNum )
{
   return 0;
}

bool
tnlCudaDeviceInfo::
getECCEnabled( int deviceNum )
{
   return 0;
}

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

#endif
 No newline at end of file
+86 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlCudaDeviceInfo.cu  -  description
                             -------------------
    begin                : Jun 21, 2015
    copyright            : (C) 2007 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CUDA

#include <core/tnlCudaDeviceInfo.h>
#include <core/tnlCuda.h>

int
tnlCudaDeviceInfo::
getNumberOfDevices()
{
    int devices;
    cudaGetDeviceCount( &devices );
    return devices;
}
      
tnlString
tnlCudaDeviceInfo::
getDeviceName( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return tnlString( properties.name );
}
      
int
tnlCudaDeviceInfo::
getClockRate( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return properties.clockRate;
}
      
int
tnlCudaDeviceInfo::
getGlobalMemory( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return properties.totalGlobalMem;
}

int
tnlCudaDeviceInfo::
getMemoryClockRate( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return properties.memoryClockRate;
}

bool
tnlCudaDeviceInfo::
getECCEnabled( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return properties.ECCEnabled;
}

int
tnlCudaDeviceInfo::
getCudaMultiprocessors( int deviceNum )
{
    cudaDeviceProp properties;
    cudaGetDeviceProperties( &properties, deviceNum );
    return properties.multiProcessorCount;
}

#endif
 No newline at end of file
+47 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlCudaDeviceInfo.h  -  description
                             -------------------
    begin                : Jun 21, 2015
    copyright            : (C) 2007 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TNLCUDADEVICEINFO_H
#define	TNLCUDADEVICEINFO_H

#include <core/tnlCuda.h>

class tnlCudaDeviceInfo
{
   public:
      
      static int getNumberOfDevices();
      
      static tnlString getDeviceName( int deviceNum );
      
      static int getClockRate( int deviceNum );
      
      static int getGlobalMemory( int deviceNum );

      static int getMemoryClockRate( int deviceNum );

      static bool getECCEnabled( int deviceNum );

      static int getCudaMultiprocessors( int deviceNum );      
      
};




#endif	/* TNLCUDADEVICEINFO_H */
Loading