Commit ce46a57e authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Merge branch 'JK/fixes' into 'develop'

Small fixes

See merge request !57
parents 5924c81c e594db0a
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -8,6 +8,21 @@ namespace py = pybind11;

#include <TNL/Containers/Array.h>


// pybind11 should actually take care of this inside py::format_descriptor, but apparently it does not work...
// see https://github.com/pybind/pybind11/issues/2135
template< typename T, typename = void >
struct underlying_type
{
   using type = T;
};
template< typename T >
struct underlying_type< T, std::enable_if_t< std::is_enum< T >::value > >
{
   using type = std::underlying_type_t< T >;
};


template< typename ArrayType >
void export_Array(py::module & m, const char* name)
{
@@ -49,7 +64,9 @@ void export_Array(py::module & m, const char* name)
                // Size of one scalar
                sizeof( typename ArrayType::ValueType ),
                // Python struct-style format descriptor
                py::format_descriptor< typename ArrayType::ValueType >::format(),
                py::format_descriptor<
                     typename underlying_type< typename ArrayType::ValueType >::type
                >::format(),
                // Number of dimensions
                1,
                // Buffer dimensions
+0 −5
Original line number Diff line number Diff line
@@ -121,7 +121,6 @@
#include <stdio.h>

#include <TNL/Cuda/CudaCallable.h>
#include <TNL/Debugging/StackBacktrace.h>

namespace TNL {
/**
@@ -164,8 +163,6 @@ printDiagnosticsHost( const char* assertion,
       << "Line: " << line << "\n"
       << "Diagnostics:\n" << diagnostics << std::endl;

   PrintStackBacktrace;

   throw AssertionError( str.str() );
}

@@ -186,8 +183,6 @@ printDiagnosticsHost( const char* assertion,
             << "Function: " << function << "\n"
             << "Line: " << line << "\n"
             << "Diagnostics:\n" << diagnostics << std::endl;

   PrintStackBacktrace;
}
#endif // TNL_THROW_ASSERTION_ERROR

+7 −7
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ else
      std::stringstream __tnl_mpi_print_stream_;                                                                                 \
      __tnl_mpi_print_stream_ << "Node " << TNL::Communicators::MpiCommunicator::GetRank() << " of "                             \
         << TNL::Communicators::MpiCommunicator::GetSize() << " : " << message << std::endl;                                     \
      TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str().c_str() );                                              \
      TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() );                                                      \
      mpiSend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() );                                                  \
   }                                                                                                                             \
   else                                                                                                                          \
@@ -77,8 +77,8 @@ else
         std::stringstream __tnl_mpi_print_stream_;                                                                              \
         __tnl_mpi_print_stream_ << "Node " << TNL::Communicators::MpiCommunicator::GetRank() << " of "                          \
            << TNL::Communicators::MpiCommunicator::GetSize() << " : " << message << std::endl;                                  \
         TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str().c_str() );                                           \
         mpiSsend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() );                                                                                      \
         TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() );                                                   \
         mpiSend( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() );                                               \
      }                                                                                                                          \
   }                                                                                                                             \
   else                                                                                                                          \
+8 −4
Original line number Diff line number Diff line
@@ -80,9 +80,11 @@ allocate( const LocalIndexType& maxValuesCount )
   const IndexType ldSize = getAllocationKeysRange( this->getKeysRange() );
   this->values.setSize( ldSize * this->maxValuesCount );
   this->valuesCounts.setSize( this->getKeysRange() );
   if( this->valuesCounts.getSize() > 0 )
      this->valuesCounts.setValue( maxValuesCount );

   // extra cost at initialization, which allows to have much simpler operator==
   if( this->values.getSize() > 0 )
      values.setValue( 0 );
}

@@ -108,6 +110,7 @@ allocate( const ValuesAllocationVectorType& valuesCounts )
   this->valuesCounts = valuesCounts;

   // extra cost at initialization, which allows to have much simpler operator==
   if( this->values.getSize() > 0 )
      values.setValue( 0 );
}

@@ -128,6 +131,7 @@ setLike( const EllpackIndexMultimap< Index, Device_, LocalIndex, SliceSize_ >& o
   maxValuesCount = other.maxValuesCount;

   // extra cost at initialization, which allows to have much simpler operator==
   if( this->values.getSize() > 0 )
      values.setValue( 0 );
}

+4 −2
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ allocate()
   values.setSize( ldSize * ValuesCount );

   // extra cost at initialization, which allows to have much simpler operator==
   if( ldSize > 0 )
      values.setValue( 0 );
}

@@ -99,6 +100,7 @@ setLike( const StaticEllpackIndexMultimap< ValuesCount, Index, Device_, LocalInd
   values.setSize( ldSize * ValuesCount );

   // extra cost at initialization, which allows to have much simpler operator==
   if( ldSize > 0 )
      values.setValue( 0 );

   keysRange = other.keysRange;
Loading