Skip to content

Commit

Permalink
Merge pull request #2446 from eisenhauer/SstNumericType
Browse files Browse the repository at this point in the history
Switch to numeric type spec in SST/FFS
  • Loading branch information
eisenhauer authored Aug 27, 2020
2 parents 3707834 + b2eb096 commit b2efa2b
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 213 deletions.
17 changes: 9 additions & 8 deletions source/adios2/engine/sst/SstReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ SstReader::SstReader(IO &io, const std::string &name, const Mode mode,
SstReaderGetParams(m_Input, &m_WriterMarshalMethod);

auto varFFSCallback = [](void *reader, const char *variableName,
const char *type, void *data) {
adios2::DataType Type(helper::GetDataTypeFromString(type));
const int type, void *data) {
adios2::DataType Type = (adios2::DataType)type;
class SstReader::SstReader *Reader =
reinterpret_cast<class SstReader::SstReader *>(reader);
if (Type == adios2::DataType::Compound)
{
return (void *)NULL;
}

#define declare_type(T) \
else if (Type == helper::GetDataType<T>()) \
{ \
Expand All @@ -76,16 +77,16 @@ SstReader::SstReader(IO &io, const std::string &name, const Mode mode,
};

auto attrFFSCallback = [](void *reader, const char *attrName,
const char *type, void *data) {
const int type, void *data) {
class SstReader::SstReader *Reader =
reinterpret_cast<class SstReader::SstReader *>(reader);
adios2::DataType Type = (adios2::DataType)type;
if (attrName == NULL)
{
// if attrName is NULL, prepare for attr reinstallation
Reader->m_IO.RemoveAllAttributes();
return;
}
adios2::DataType Type(helper::GetDataTypeFromString(type));
try
{
if (Type == adios2::DataType::Compound)
Expand Down Expand Up @@ -120,12 +121,12 @@ SstReader::SstReader(IO &io, const std::string &name, const Mode mode,
};

auto arrayFFSCallback = [](void *reader, const char *variableName,
const char *type, int DimCount, size_t *Shape,
const int type, int DimCount, size_t *Shape,
size_t *Start, size_t *Count) {
std::vector<size_t> VecShape;
std::vector<size_t> VecStart;
std::vector<size_t> VecCount;
adios2::DataType Type(helper::GetDataTypeFromString(type));
adios2::DataType Type = (adios2::DataType)type;
class SstReader::SstReader *Reader =
reinterpret_cast<class SstReader::SstReader *>(reader);
/*
Expand Down Expand Up @@ -169,12 +170,12 @@ SstReader::SstReader(IO &io, const std::string &name, const Mode mode,
};

auto arrayBlocksInfoCallback =
[](void *reader, void *variable, const char *type, int WriterRank,
[](void *reader, void *variable, const int type, int WriterRank,
int DimCount, size_t *Shape, size_t *Start, size_t *Count) {
std::vector<size_t> VecShape;
std::vector<size_t> VecStart;
std::vector<size_t> VecCount;
adios2::DataType Type(helper::GetDataTypeFromString(type));
adios2::DataType Type = (adios2::DataType)type;
class SstReader::SstReader *Reader =
reinterpret_cast<class SstReader::SstReader *>(reader);
size_t currentStep = SstCurrentStep(Reader->m_Input);
Expand Down
10 changes: 4 additions & 6 deletions source/adios2/engine/sst/SstWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ void SstWriter::FFSMarshalAttributes()
//
}

SstFFSMarshalAttribute(m_Output, name.c_str(),
ToString(type).c_str(), sizeof(char *),
element_count, data_addr);
SstFFSMarshalAttribute(m_Output, name.c_str(), (int)type,
sizeof(char *), element_count, data_addr);
}
#define declare_type(T) \
else if (type == helper::GetDataType<T>()) \
Expand All @@ -199,9 +198,8 @@ void SstWriter::FFSMarshalAttributes()
element_count = attribute.m_Elements; \
data_addr = attribute.m_DataArray.data(); \
} \
SstFFSMarshalAttribute(m_Output, attribute.m_Name.c_str(), \
ToString(type).c_str(), sizeof(T), \
element_count, data_addr); \
SstFFSMarshalAttribute(m_Output, attribute.m_Name.c_str(), (int)type, \
sizeof(T), element_count, data_addr); \
}

ADIOS2_FOREACH_ATTRIBUTE_PRIMITIVE_STDTYPE_1ARG(declare_type)
Expand Down
4 changes: 2 additions & 2 deletions source/adios2/engine/sst/SstWriter.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ void SstWriter::PutSyncCommon(Variable<T> &variable, const T *values)
Count = variable.m_Count.data();
}
SstFFSMarshal(m_Output, (void *)&variable, variable.m_Name.c_str(),
ToString(variable.m_Type).c_str(), variable.m_ElementSize,
DimCount, Shape, Count, Start, values);
(int)variable.m_Type, variable.m_ElementSize, DimCount,
Shape, Count, Start, values);
}
else if (Params.MarshalMethod == SstMarshalBP)
{
Expand Down
Loading

0 comments on commit b2efa2b

Please sign in to comment.