Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d764bca
Merge remote-tracking branch 'origin/develop' into feat/dudes/perfora…
arng40 Feb 2, 2026
87a4eec
first attempt new version of log table perforation
arng40 Feb 6, 2026
5638062
doxygen + add const
arng40 Feb 6, 2026
3b7ade4
remove logPerfo header
arng40 Feb 6, 2026
dbee251
revert modif on wellElementSubRegion
arng40 Feb 10, 2026
b6f5ca6
new method to get cell id & region / subregion
arng40 Feb 10, 2026
f10caa5
wip MPI for table perfo
arng40 Feb 10, 2026
7dcac44
Merge remote-tracking branch 'origin/develop' into feat/dudes/perfora…
arng40 Feb 10, 2026
f29df71
MPI gather string - code MPI duplicate with negative pressure cell
arng40 Feb 13, 2026
673eae7
Merge remote-tracking branch 'origin/develop' into feat/dudes/perfora…
arng40 Feb 13, 2026
c09f8bf
Squashed commit of the following:
arng40 Feb 13, 2026
66863a1
1st version mpi table
arng40 Feb 18, 2026
d6128ee
new version mpi table : sorted
arng40 Feb 18, 2026
254f20e
add sorting method
arng40 Feb 20, 2026
4600be3
extract outputLine function
arng40 Feb 20, 2026
bbae597
sorted mpi table
arng40 Feb 20, 2026
77b28da
use sorting method
arng40 Feb 20, 2026
863e969
add test in invert comparator
arng40 Feb 20, 2026
2b80760
fix sort method + doxygen + add rank column
arng40 Feb 20, 2026
ff7e66d
remove mpi code
arng40 Mar 12, 2026
ef3e09c
Merge remote-tracking branch 'origin/develop' into feat/dudes/perfora…
arng40 Mar 12, 2026
0261d8f
refactor gatherString using gatherBuffer
arng40 Mar 13, 2026
86e5cd7
fix test
arng40 Mar 13, 2026
6d1a918
fix typo remove unused header
arng40 Mar 13, 2026
9c9fdd1
minor clean
arng40 Mar 13, 2026
805c7b1
ranaming, reorg variable first step
arng40 Mar 13, 2026
7400922
some cleanup
arng40 Mar 13, 2026
d2925fb
doxygen
arng40 Mar 16, 2026
ebdadd8
Improve structure 🎨
arng40 Mar 16, 2026
b0eb0f6
Remove code :fire:
arng40 Mar 16, 2026
57d5802
Fix a bug. :bug:
arng40 Mar 16, 2026
ec41004
Merge remote-tracking branch 'origin/develop' into feat/dudes/perfora…
arng40 Mar 16, 2026
a06b548
Merge branch 'develop' into feat/dudes/perforations-table-detail
arng40 Mar 17, 2026
763103a
:green_heart: uncrustify
arng40 Mar 17, 2026
bfdf8c5
:lipstick: set rank column to the right
arng40 Mar 18, 2026
d15042d
:label: renaming & cde style
arng40 Mar 19, 2026
44ac609
Squashed commit of the following:
arng40 Mar 19, 2026
824deb6
Squashed commit of the following:
arng40 Mar 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/coreComponents/common/MpiWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,28 @@ template<> MPI_Datatype getMpiPairType< double, double >()

} /* namespace internal */

template<>
void MpiWrapper::gatherStringOnRank0< std::function< void(string_view) > >
( string_view rankStr, std::function< void(string_view) > && func )
{
Comment on lines +521 to +524
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By declaring this in the CPP instead of in the HPP, you're basically constraining the templated type FUNC to be std::function< void(string_view) >. What about removing the template and be explicit on the expected type in the HPP?

std::vector< buffer_unit_type > localbuffer;
localbuffer.reserve( rankStr.size());
localbuffer.insert( localbuffer.end(), rankStr.begin(), rankStr.end());
auto [globalLogRecords, counts, offsets] =
MpiWrapper::gatherBufferRank0< std::vector< buffer_unit_type > >( localbuffer );
if( MpiWrapper::commRank() == 0 )
{
for( integer rankId = 0; rankId < MpiWrapper::commSize(); ++rankId )
{
if( counts[rankId] > 0 )
{
func( string( globalLogRecords.begin() + offsets[rankId],
globalLogRecords.begin() + offsets[rankId]+ counts[rankId] ) );
}
}
}
}

} /* namespace geos */

#if defined(__clang__)
Expand Down
83 changes: 83 additions & 0 deletions src/coreComponents/common/MpiWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,89 @@ struct MpiWrapper
*/
static int nodeCommSize();

/**
* @brief Structure holding the result from all the gather operation
* @tparam CONTAINER The container type holding the data.
* The underlying storage in CONTAINER must be contiguous
*/
template< typename CONTAINER >
struct GatherResult
{
// Collected data who must be trivially copyable
CONTAINER data;
// Number of elements per row
stdVector< integer > counts;
// Starting index for each row in 'data'
stdVector< integer > offsets;
};

/**
* @brief Gather buffers of varying sizes from all ranks to rank 0.
* @tparam CONTAINER The container type holding the data.
* @tparam VALUE_T The trivially copyable underlying data type (deduced automatically).
* @param localBuffer The local buffer to be gathered on rank 0.
* @return A struct containing:
* - 'data': all the gathered data on rank 0
* - 'counts': number of elements for each rank
* - 'offsets': starting index for each rank in 'data'
*/
template<
typename CONTAINER,
typename VALUE_T = typename CONTAINER::value_type,
typename = std::enable_if_t<
std::is_trivially_copyable_v< VALUE_T > &&
std::is_same_v< decltype(std::declval< CONTAINER >().data()), VALUE_T * > &&
std::is_same_v< decltype(std::declval< CONTAINER >().size()), std::size_t >
>
>
static GatherResult< CONTAINER >
gatherBufferRank0( CONTAINER const & localBuffer )
{
integer const numRanks = MpiWrapper::commSize();
integer const numLocalValues = static_cast< integer >(localBuffer.size());

GatherResult< CONTAINER > gatherResult;

if( MpiWrapper::commRank() == 0 )
{
gatherResult.counts.resize( numRanks );
gatherResult.offsets.resize( numRanks );
}


MpiWrapper::gather( &numLocalValues , 1, gatherResult.counts.data(), 1, 0 );

if( MpiWrapper::commRank() == 0 )
{
integer totalSize = 0;
for( integer i = 0; i < numRanks; ++i )
{
gatherResult.offsets[i] = totalSize;
totalSize += gatherResult.counts[i];
}
gatherResult.data.resize( totalSize );
}

MpiWrapper::gatherv( localBuffer.data(),
numLocalValues ,
gatherResult.data.data(),
gatherResult.counts.data(),
gatherResult.offsets.data(),
0 );

return gatherResult;
}

/**
* @brief Gather srting from all ranks to rank 0
* @tparam FUNC Callable type invoked as void(string_view) for each non-empty rank string.
* @param str The local string to send from the calling rank.
* @param func Callback invoked on rank 0 for each non-empty received string.
*/
template< typename FUNC >
static void gatherStringOnRank0( string_view str,
FUNC && func );

/**
* @brief Strongly typed wrapper around MPI_Allgather.
* @tparam T_SEND The pointer type for \p sendbuf
Expand Down
61 changes: 60 additions & 1 deletion src/coreComponents/common/format/table/TableData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,27 @@ TableData & TableData::operator=( TableData const & other )

bool TableData::operator<( TableData const & other ) const
{
return m_rows < other.m_rows;
if( other.getCellsData().size()!= getCellsData().size())
return false;

for( size_t i = 0; i < getCellsData().size(); i++ )
{
if( getCellsData()[i].data()->value > other.getCellsData()[i].data()->value )
return false;
}
return true;
}

bool TableData::operator==( TableData const & comparingTable ) const
{
if( comparingTable.getCellsData().size()!= getCellsData().size())
return false;
for( size_t i = 0; i < getCellsData().size(); i++ )
{
if( getCellsData()[i].data()->value != comparingTable.getCellsData()[i].data()->value )
return false;
}
return true;
}


Expand Down Expand Up @@ -180,4 +200,43 @@ TableData2D::TableDataHolder TableData2D::buildTableData( string_view targetUnit

return tableData1D;
}

bool tabledatasorting::positiveNumberStringComp( string_view s1, string_view s2 )
{
auto split = []( string_view s, string & intPart, string & decPart )
{
size_t dotPos = s.find( '.' );
if( dotPos == string::npos )
{
intPart = s;
decPart = "";
}
else
{
intPart = s.substr( 0, dotPos );
decPart = s.substr( dotPos + 1 );
}
};

string s1Int, s1Dec, s2Int, s2Dec;
split( s1, s1Int, s1Dec );
split( s2, s2Int, s2Dec );

if( s1Int.length() != s2Int.length())
return s1Int.length() < s2Int.length();

if( s1Int != s2Int )
return s1Int < s2Int;

size_t minLen = std::min( s1Dec.length(), s2Dec.length());
for( size_t i = 0; i < minLen; ++i )
{
if( s1Dec[i] != s2Dec[i] )
return s1Dec[i] < s2Dec[i];
}


return false;
}

}
49 changes: 28 additions & 21 deletions src/coreComponents/common/format/table/TableData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "common/DataTypes.hpp"
#include "common/format/Format.hpp"
#include "TableTypes.hpp"
#include <cstddef>

namespace geos
{
Expand Down Expand Up @@ -54,6 +55,13 @@ class TableData
*/
bool operator<( TableData const & other ) const;

/**
* @brief Comparison operator for data rows
* @param comparingTable The tableData values to compare
* @return The comparison result
*/
bool operator==( TableData const & comparingTable ) const;

/**
* @brief Representing a data in TableData
*/
Expand All @@ -63,20 +71,7 @@ class TableData
CellType type;
/// The cell value
string value;

/// @cond DO_NOT_DOCUMENT
bool operator==( CellData const & other ) const
{
return value == other.value;
}

bool operator<( CellData const & other ) const
{
return value < other.value;
}
///@endcond
};

/// Alias for table data rows with cells values
using DataRows = stdVector< stdVector< CellData > >;

Expand Down Expand Up @@ -129,14 +124,6 @@ class TableData
DataRows & getCellsData()
{ return m_rows; }

/**
* @brief Comparison operator for data rows
* @param comparingTable The tableData values to compare
* @return The comparison result
*/
inline bool operator==( TableData const & comparingTable ) const
{ return getCellsData() == comparingTable.getCellsData(); }

/**
* @brief Get all error messages
* @return The list of error messages
Expand All @@ -148,8 +135,16 @@ class TableData
* @brief Get all error messages
* @return The list of error messages
*/

TableErrorListing & getErrorsList()
{ return *m_errors; }

/**
* @brief Gather all the TableData rows to the rank 0
* @param func The callable comparison function object to sort TableData rows, by default none
*/
template< typename SortingFunc = std::nullptr_t >
void gatherRowsRank0( SortingFunc && func );

private:
/// @brief vector containing all rows with cell values
Expand Down Expand Up @@ -302,5 +297,17 @@ void TableData2D::addCell( real64 const rowValue, real64 const columnValue, T co
m_data.get_inserted( rowValue ).get_inserted( columnValue ) = GEOS_FMT( "{}", value );
}

// Custom Comp function;
namespace tabledatasorting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • code style: tableDataSorting
  • As it is declared at this level (TableData.hpp and not TableMpiComponents.hpp), I would have expected a sorting mecanism available in TableData. Could the sorting function be easily moved? (TableData::sort(functor) -> std::sort())

{
/**
* @brief Compare two string number string by in ascending numerical order.
* @param a The string to compare
* @param b The string to compare
* @return True if a is greater than b
*/
bool positiveNumberStringComp( string_view a, string_view b );
}

}
#endif /* GEOS_COMMON_FORMAT_TABLE_TABLEDATA_HPP */
Loading
Loading