Commit 7f3e64bd authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Merge branch 'string' into 'develop'

Fixes in String

Closes #18

See merge request !17
parents 0813dd89 2f9831c0
Loading
Loading
Loading
Loading
+19 −19
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ public:
      closeTable();
      writeTitle( title );
      // add loops to metadata
      metadata["loops"] = String(loops);
      metadata["loops"] = convertToString(loops);
      writeMetadata( metadata );
   }

@@ -488,14 +488,14 @@ Benchmark::MetadataMap getHardwareMetadata()
{
   const int cpu_id = 0;
   Devices::CacheSizes cacheSizes = Devices::SystemInfo::getCPUCacheSizes( cpu_id );
   String cacheInfo = String( cacheSizes.L1data ) + ", "
                       + String( cacheSizes.L1instruction ) + ", "
                       + String( cacheSizes.L2 ) + ", "
                       + String( cacheSizes.L3 );
   String cacheInfo = convertToString( cacheSizes.L1data ) + ", "
                       + convertToString( cacheSizes.L1instruction ) + ", "
                       + convertToString( cacheSizes.L2 ) + ", "
                       + convertToString( cacheSizes.L3 );
#ifdef HAVE_CUDA
   const int activeGPU = Devices::CudaDeviceInfo::getActiveDevice();
   const String deviceArch = String( Devices::CudaDeviceInfo::getArchitectureMajor( activeGPU ) ) + "." +
                             String( Devices::CudaDeviceInfo::getArchitectureMinor( activeGPU ) );
   const String deviceArch = convertToString( Devices::CudaDeviceInfo::getArchitectureMajor( activeGPU ) ) + "." +
                             convertToString( Devices::CudaDeviceInfo::getArchitectureMinor( activeGPU ) );
#endif
   Benchmark::MetadataMap metadata {
       { "host name", Devices::SystemInfo::getHostname() },
@@ -504,25 +504,25 @@ Benchmark::MetadataMap getHardwareMetadata()
       { "system release", Devices::SystemInfo::getSystemRelease() },
       { "start time", Devices::SystemInfo::getCurrentTime() },
#ifdef HAVE_MPI
       { "number of MPI processes", String( (Communicators::MpiCommunicator::IsInitialized())
       { "number of MPI processes", convertToString( (Communicators::MpiCommunicator::IsInitialized())
                                       ? Communicators::MpiCommunicator::GetSize( Communicators::MpiCommunicator::AllGroup )
                                       : 1 ) },
#endif
       { "OpenMP enabled", String( Devices::Host::isOMPEnabled() ) },
       { "OpenMP threads", String( Devices::Host::getMaxThreadsCount() ) },
       { "OpenMP enabled", convertToString( Devices::Host::isOMPEnabled() ) },
       { "OpenMP threads", convertToString( Devices::Host::getMaxThreadsCount() ) },
       { "CPU model name", Devices::SystemInfo::getCPUModelName( cpu_id ) },
       { "CPU cores", String( Devices::SystemInfo::getNumberOfCores( cpu_id ) ) },
       { "CPU threads per core", String( Devices::SystemInfo::getNumberOfThreads( cpu_id ) / Devices::SystemInfo::getNumberOfCores( cpu_id ) ) },
       { "CPU max frequency (MHz)", String( Devices::SystemInfo::getCPUMaxFrequency( cpu_id ) / 1e3 ) },
       { "CPU cores", convertToString( Devices::SystemInfo::getNumberOfCores( cpu_id ) ) },
       { "CPU threads per core", convertToString( Devices::SystemInfo::getNumberOfThreads( cpu_id ) / Devices::SystemInfo::getNumberOfCores( cpu_id ) ) },
       { "CPU max frequency (MHz)", convertToString( Devices::SystemInfo::getCPUMaxFrequency( cpu_id ) / 1e3 ) },
       { "CPU cache sizes (L1d, L1i, L2, L3) (kiB)", cacheInfo },
#ifdef HAVE_CUDA
       { "GPU name", Devices::CudaDeviceInfo::getDeviceName( activeGPU ) },
       { "GPU architecture", String( deviceArch ) },
       { "GPU CUDA cores", String( Devices::CudaDeviceInfo::getCudaCores( activeGPU ) ) },
       { "GPU clock rate (MHz)", String( (double) Devices::CudaDeviceInfo::getClockRate( activeGPU ) / 1e3 ) },
       { "GPU global memory (GB)", String( (double) Devices::CudaDeviceInfo::getGlobalMemory( activeGPU ) / 1e9 ) },
       { "GPU memory clock rate (MHz)", String( (double) Devices::CudaDeviceInfo::getMemoryClockRate( activeGPU ) / 1e3 ) },
       { "GPU memory ECC enabled", String( Devices::CudaDeviceInfo::getECCEnabled( activeGPU ) ) },
       { "GPU architecture", deviceArch },
       { "GPU CUDA cores", convertToString( Devices::CudaDeviceInfo::getCudaCores( activeGPU ) ) },
       { "GPU clock rate (MHz)", convertToString( (double) Devices::CudaDeviceInfo::getClockRate( activeGPU ) / 1e3 ) },
       { "GPU global memory (GB)", convertToString( (double) Devices::CudaDeviceInfo::getGlobalMemory( activeGPU ) / 1e9 ) },
       { "GPU memory clock rate (MHz)", convertToString( (double) Devices::CudaDeviceInfo::getMemoryClockRate( activeGPU ) / 1e3 ) },
       { "GPU memory ECC enabled", convertToString( Devices::CudaDeviceInfo::getECCEnabled( activeGPU ) ) },
#endif
   };

+5 −5
Original line number Diff line number Diff line
@@ -177,11 +177,11 @@ struct SpmvBenchmark
      benchmark.setMetadataColumns( Benchmark::MetadataColumns({
         // TODO: strip the device
//         { "matrix type", matrix.getType() },
         {"rows", String( matrix.getRows() ) },
         {"columns", String( matrix.getColumns() ) },
         { "rows", convertToString( matrix.getRows() ) },
         { "columns", convertToString( matrix.getColumns() ) },
         // FIXME: getMaxRowLengths() returns 0 for matrices loaded from file
//         { "max elements per row", matrix.getMaxRowLength() },
         {"max elements per row", String( maxRowLength ) },
         { "max elements per row", convertToString( maxRowLength ) },
      } ));

      const bool reorder = parameters.getParameter< bool >( "reorder-dofs" );
+10 −10
Original line number Diff line number Diff line
@@ -214,11 +214,11 @@ template< typename Real,
          typename Index >
String Meshes::Grid< 2, Real, Device, Index > :: getType()
{
   return TNL::String( "Meshes::Grid< " ) +
          TNL::String( getMeshDimension() ) + ", " +
          TNL::String( ::getType< RealType >() ) + ", " +
          TNL::String( Device :: getDeviceType() ) + ", " +
          TNL::String( ::getType< IndexType >() ) + " >";
   return String( "Meshes::Grid< " ) +
          convertToString( getMeshDimension() ) + ", " +
          String( ::getType< RealType >() ) + ", " +
          String( Device :: getDeviceType() ) + ", " +
          String( ::getType< IndexType >() ) + " >";
}

template< typename Real,
@@ -979,11 +979,11 @@ template< typename Real,
          typename Index >
String Meshes::Grid< 2, Real, Device, Index > :: getType()
{
   return TNL::String( "Meshes::Grid< " ) +
          TNL::String( getMeshDimension() ) + ", " +
          TNL::String( ::getType< RealType >() ) + ", " +
          TNL::String( Device :: getDeviceType() ) + ", " +
          TNL::String( ::getType< IndexType >() ) + " >";
   return String( "Meshes::Grid< " ) +
          convertToString( getMeshDimension() ) + ", " +
          String( ::getType< RealType >() ) + ", " +
          String( Device :: getDeviceType() ) + ", " +
          String( ::getType< IndexType >() ) + " >";
}

template< typename Real,
+8 −8
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ benchmarkIterativeSolvers( Benchmark& benchmark,
         benchmark.setOperation("BiCGstab (Jacobi)");
         for( int ell = 1; ell <= ell_max; ell++ ) {
            parameters.template setParameter< int >( "bicgstab-ell", ell );
            benchmark.setOperation("BiCGstab(" + String(ell) + ") (Jacobi)");
            benchmark.setOperation("BiCGstab(" + convertToString(ell) + ") (Jacobi)");
            benchmarkSolver< BICGStabL, Diagonal >( benchmark, parameters, matrixPointer, x0, b );
            #ifdef HAVE_CUDA
            benchmarkSolver< BICGStabL, Diagonal >( benchmark, parameters, cudaMatrixPointer, cuda_x0, cuda_b );
@@ -244,7 +244,7 @@ benchmarkIterativeSolvers( Benchmark& benchmark,
      if( solvers.count( "bicgstab-ell" ) ) {
         for( int ell = 1; ell <= ell_max; ell++ ) {
            parameters.template setParameter< int >( "bicgstab-ell", ell );
            benchmark.setOperation("BiCGstab(" + String(ell) + ") (ILU0)");
            benchmark.setOperation("BiCGstab(" + convertToString(ell) + ") (ILU0)");
            benchmarkSolver< BICGStabL, ILU0 >( benchmark, parameters, matrixPointer, x0, b );
            #ifdef HAVE_CUDA
            benchmarkSolver< BICGStabL, ILU0 >( benchmark, parameters, cudaMatrixPointer, cuda_x0, cuda_b );
@@ -300,7 +300,7 @@ benchmarkIterativeSolvers( Benchmark& benchmark,
      if( solvers.count( "bicgstab-ell" ) ) {
         for( int ell = 1; ell <= ell_max; ell++ ) {
            parameters.template setParameter< int >( "bicgstab-ell", ell );
            benchmark.setOperation("BiCGstab(" + String(ell) + ") (ILUT)");
            benchmark.setOperation("BiCGstab(" + convertToString(ell) + ") (ILUT)");
            benchmarkSolver< BICGStabL, ILUT >( benchmark, parameters, matrixPointer, x0, b );
            #ifdef HAVE_CUDA
            benchmarkSolver< BICGStabL, ILUT >( benchmark, parameters, cudaMatrixPointer, cuda_x0, cuda_b );
@@ -347,11 +347,11 @@ struct LinearSolversBenchmark
      benchmark.setMetadataColumns( Benchmark::MetadataColumns({
         // TODO: strip the device
//         { "matrix type", matrixPointer->getType() },
         {"rows", String( matrixPointer->getRows() ) },
         {"columns", String( matrixPointer->getColumns() ) },
         { "rows", convertToString( matrixPointer->getRows() ) },
         { "columns", convertToString( matrixPointer->getColumns() ) },
         // FIXME: getMaxRowLengths() returns 0 for matrices loaded from file
//         { "max elements per row", matrixPointer->getMaxRowLength() },
         {"max elements per row", String( maxRowLength ) },
         { "max elements per row", convertToString( maxRowLength ) },
      } ));

      const bool reorder = parameters.getParameter< bool >( "reorder-dofs" );
+2 −2
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ int main( int argc, char* argv[] )
    String str1;
    String str2( "xxstringxxx", 2, 3 );
    String str3( str2 );                    // copy constructor
    String str4( 28.4 );                    // converts to string
    String str4 = convertToString( 28.4 );  // converts to string

    cout << "str1:" << str1 << endl;
    cout << "str2:" << str2 << endl;
@@ -93,7 +93,7 @@ int main( int argc, char* argv[] )
    cout << "h:" << h << endl;

    String i;
    i = 'a' + 'b';
    i = convertToString( 'a' ) + 'b';
    cout << "i:" << i << endl;

    String letter1( "u" );
Loading