Skip to content

Commit 0a847e4

Browse files
authored
Merge pull request #4783 from vicentebolea/migrate-c++14-ways
refactor code to utilize c++14 features
2 parents 79a0b56 + 8eee018 commit 0a847e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+121
-125
lines changed
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/bin/bash
22

3-
sudo docker run -itt --mount type=bind,source="$(pwd)",target=/root/adios2 \
3+
CONTAINER_DRIVER=${CONTAINER_DRIVER:-docker}
4+
5+
"${CONTAINER_DRIVER[@]}" run -itt --mount type=bind,source="$(pwd)",target=/root/adios2 \
46
ghcr.io/ornladios/adios2:ci-formatting sh -c \
57
"git config --global --add safe.directory /root/adios2 &&
68
cd /root/adios2 &&
79
./scripts/ci/scripts/run-clang-format.sh"
810

9-
git status --porcelain | awk '{print $2}' | xargs sudo chown "$USER:$(id -g)"
11+
if [ "${CONTAINER_DRIVER[0]}" != "podman" ]
12+
then
13+
git status --porcelain | awk '{print $2}' | xargs sudo chown "$USER:$(id -g)"
14+
fi

source/adios2/common/ADIOSTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ constexpr size_t DefaultMinDeferredSize = 4 * 1024 * 1024;
265265

266266
/** default size for writing/reading files using POSIX/fstream/stdio write
267267
* 2Gb - 100Kb (tolerance)*/
268-
constexpr size_t DefaultMaxFileBatchSize = 2147381248;
268+
constexpr size_t DefaultMaxFileBatchSize = 2147483648 - 102400;
269269

270270
/** default maximum shared memory segment size
271271
* 2 blocks of MaxFileBatchSize */

source/adios2/core/Group.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Group::Group(std::string path, char delimiter, IO &io)
3939
{
4040
if (mapPtr == nullptr)
4141
{
42-
mapPtr = std::shared_ptr<TreeMap>(new TreeMap());
42+
mapPtr = std::make_shared<TreeMap>();
4343
}
4444
}
4545
// copy constructor

source/adios2/core/IO.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,8 @@ VariableDerived &IO::DefineDerivedVariable(const std::string &name, const std::s
980980

981981
// create derived variable with the expression
982982
auto itVariablePair = m_VariablesDerived.emplace(
983-
name, std::unique_ptr<VariableBase>(new VariableDerived(
984-
name, derived_exp, expressionType, isConstant, varType, name_to_type)));
983+
name, std::make_unique<VariableDerived>(name, derived_exp, expressionType, isConstant,
984+
varType, name_to_type));
985985
VariableDerived &variable = static_cast<VariableDerived &>(*itVariablePair.first->second);
986986

987987
// check IO placeholder for variable operations
@@ -1026,9 +1026,8 @@ VariableStruct &IO::DefineStructVariable(const std::string &name, StructDefiniti
10261026
}
10271027
}
10281028

1029-
auto itVariablePair =
1030-
m_Variables.emplace(name, std::unique_ptr<VariableBase>(new VariableStruct(
1031-
name, def, shape, start, count, constantDims)));
1029+
auto itVariablePair = m_Variables.emplace(
1030+
name, std::make_unique<VariableStruct>(name, def, shape, start, count, constantDims));
10321031

10331032
VariableStruct &variable = static_cast<VariableStruct &>(*itVariablePair.first->second);
10341033

source/adios2/engine/bp5/BP5Reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ void BP5Reader::PerformGets()
524524
}
525525
}
526526
}
527-
m_Remote = std::unique_ptr<XrootdRemote>(new XrootdRemote(m_HostOptions));
527+
m_Remote = std::make_unique<XrootdRemote>(m_HostOptions);
528528
m_Remote->Open(XRootDHost, XRootDPort, RemoteName, m_OpenMode, RowMajorOrdering);
529529
}
530530
else

source/adios2/engine/campaign/CampaignReader.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ std::string CampaignReader::SaveRemoteMD(size_t dsIdx, size_t repIdx, adios2::co
313313
// Retrieve key
314314
if (!m_ConnectionManager)
315315
{
316-
m_ConnectionManager =
317-
std::unique_ptr<Remote>(new Remote(core::ADIOS::StaticGetHostOptions()));
316+
m_ConnectionManager = std::make_unique<Remote>(core::ADIOS::StaticGetHostOptions());
318317
}
319318
m_CampaignData.keys[rep.keyIdx].keyHex =
320319
m_ConnectionManager->GetKeyFromConnectionManager(
@@ -1326,14 +1325,14 @@ void CampaignReader::ReadRemoteFile(const std::string &remoteHost, const std::st
13261325
#ifdef ADIOS2_HAVE_XROOTD
13271326
if (getenv("DoXRootD"))
13281327
{
1329-
remote = std::unique_ptr<XrootdRemote>(new XrootdRemote(m_HostOptions));
1328+
remote = std::make_unique<XrootdRemote>(m_HostOptions);
13301329
remote->Open("localhost", 1094, m_Name, m_OpenMode, true);
13311330
}
13321331
else
13331332
#endif
13341333
#ifdef ADIOS2_HAVE_SST
13351334
{
1336-
remote = std::unique_ptr<EVPathRemote>(new EVPathRemote(m_HostOptions));
1335+
remote = std::make_unique<EVPathRemote>(m_HostOptions);
13371336
int localPort = remote->LaunchRemoteServerViaConnectionManager(remoteHost);
13381337
remote->OpenSimpleFile("localhost", localPort, remotePath);
13391338
}

source/adios2/engine/daos/DaosWriter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
#include <daos.h>
3535
#include <daos_obj.h>
3636

37-
#define MAX_AGGREGATE_METADATA_SIZE (5ULL * 1024 * 1024 * 1024)
38-
#define chunk_size_1mb 1048576
37+
#define MAX_AGGREGATE_METADATA_SIZE (5'368'709'120ULL)
38+
#define chunk_size_1mb 1'048'576
3939

4040
namespace adios2
4141
{

source/adios2/engine/hdf5/HDF5ReaderP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,14 @@ bool HDF5ReaderP::CheckRemote()
434434
#ifdef ADIOS2_HAVE_XROOTD
435435
if (getenv("DoXRootD"))
436436
{
437-
m_Remote = std::unique_ptr<XrootdRemote>(new XrootdRemote(m_HostOptions));
437+
m_Remote = std::make_unique<XrootdRemote>(m_HostOptions);
438438
m_Remote->Open("localhost", 1094, m_Name, m_OpenMode, RowMajorOrdering);
439439
}
440440
else
441441
#endif
442442
#ifdef ADIOS2_HAVE_SST
443443
{
444-
m_Remote = std::unique_ptr<EVPathRemote>(new EVPathRemote(m_HostOptions));
444+
m_Remote = std::make_unique<EVPathRemote>(m_HostOptions);
445445
int localPort = m_Remote->LaunchRemoteServerViaConnectionManager(m_H5File.m_RemoteHost);
446446
m_Remote->Open("localhost", localPort, RemoteName, m_OpenMode, RowMajorOrdering);
447447
}

source/adios2/engine/sst/SstWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ StepStatus SstWriter::BeginStep(StepMode mode, const float timeout_sec)
145145
{
146146
// initialize BP serializer, deleted in
147147
// SstWriter::EndStep()::lf_FreeBlocks()
148-
m_BP3Serializer = std::unique_ptr<format::BP3Serializer>(new format::BP3Serializer(m_Comm));
148+
m_BP3Serializer = std::make_unique<format::BP3Serializer>(m_Comm);
149149
m_BP3Serializer->Init(m_IO.m_Parameters, "in call to BP3::Open for writing", "sst");
150150
m_BP3Serializer->ResizeBuffer(m_BP3Serializer->m_Parameters.InitialBufferSize,
151151
"in call to BP3::Open for writing by SST engine");
@@ -156,7 +156,7 @@ StepStatus SstWriter::BeginStep(StepMode mode, const float timeout_sec)
156156
{
157157
if (!m_BP5Serializer)
158158
{
159-
m_BP5Serializer = std::unique_ptr<format::BP5Serializer>(new format::BP5Serializer());
159+
m_BP5Serializer = std::make_unique<format::BP5Serializer>();
160160
m_BP5Serializer->m_StatsLevel = Params.StatsLevel;
161161
}
162162
m_BP5Serializer->InitStep(new format::MallocV("SstWriter", true));

source/adios2/helper/adiosComm.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void Comm::GathervArrays(const T *source, size_t sourceCount,
6161
displs = GetGathervDisplacements(counts, countsSize);
6262
const size_t totalElements =
6363
displs[countsSize - 1] + counts[countsSize - 1];
64-
if (totalElements > 2147483648)
64+
if (totalElements > 2'147'483'648)
6565
{
6666
helper::ThrowNested<std::runtime_error>(
6767
"Helper", "adiosComm", "GathervVectors",

0 commit comments

Comments
 (0)