Commit 52267d2d authored by Ruonan Wang's avatar Ruonan Wang Committed by Wang, Ruonan
Browse files

add F to C tests

parent db6fb95a
......@@ -35,14 +35,27 @@ template <class T>
void SscReader::GetDeferredCommon(Variable<T> &variable, T *data)
{
TAU_SCOPED_TIMER_FUNC();
variable.SetData(data);
Dims vStart = variable.m_Start;
Dims vCount = variable.m_Count;
Dims vShape = variable.m_Shape;
if (!helper::IsRowMajor(m_IO.m_HostLanguage))
{
std::reverse(vStart.begin(), vStart.end());
std::reverse(vCount.begin(), vCount.end());
std::reverse(vShape.begin(), vShape.end());
}
if (m_CurrentStep == 0)
{
m_LocalReadPattern.emplace_back();
auto &b = m_LocalReadPattern.back();
b.name = variable.m_Name;
b.count = variable.m_Count;
b.start = variable.m_Start;
b.shape = variable.m_Shape;
b.count = vCount;
b.start = vStart;
b.shape = vShape;
b.type = helper::GetType<T>();
for (const auto &d : b.count)
......@@ -58,9 +71,9 @@ void SscReader::GetDeferredCommon(Variable<T> &variable, T *data)
auto &jref = m_LocalReadPatternJson["Variables"].back();
jref["Name"] = variable.m_Name;
jref["Type"] = helper::GetType<T>();
jref["Start"] = variable.m_Start;
jref["Count"] = variable.m_Count;
jref["Shape"] = variable.m_Shape;
jref["Start"] = vStart;
jref["Count"] = vCount;
jref["Shape"] = vShape;
jref["BufferStart"] = 0;
jref["BufferCount"] = 0;
......@@ -93,10 +106,10 @@ void SscReader::GetDeferredCommon(Variable<T> &variable, T *data)
{
if (b.name == variable.m_Name)
{
helper::NdCopy<T>(
m_Buffer.data() + b.bufferStart, b.start, b.count, true,
true, reinterpret_cast<char *>(data), variable.m_Start,
variable.m_Count, true, true);
helper::NdCopy<T>(m_Buffer.data() + b.bufferStart, b.start,
b.count, true, true,
reinterpret_cast<char *>(data), vStart,
vCount, true, true);
}
}
}
......
......@@ -12,6 +12,7 @@
#define ADIOS2_ENGINE_SSCWRITER_TCC_
#include "SscWriter.h"
#include "adios2/helper/adiosSystem.h"
#include <iostream>
namespace adios2
......@@ -28,26 +29,35 @@ void SscWriter::PutDeferredCommon(Variable<T> &variable, const T *data)
variable.SetData(data);
if (variable.m_Start.empty())
Dims vStart = variable.m_Start;
Dims vCount = variable.m_Count;
Dims vShape = variable.m_Shape;
if (!helper::IsRowMajor(m_IO.m_HostLanguage))
{
variable.m_Start.push_back(0);
std::reverse(vStart.begin(), vStart.end());
std::reverse(vCount.begin(), vCount.end());
std::reverse(vShape.begin(), vShape.end());
}
if (variable.m_Count.empty())
if (vStart.empty())
{
vStart.push_back(0);
}
if (vCount.empty())
{
variable.m_Count.push_back(1);
vCount.push_back(1);
}
if (variable.m_Shape.empty())
if (vShape.empty())
{
variable.m_Shape.push_back(1);
vShape.push_back(1);
}
bool found = false;
for (const auto &b : m_GlobalWritePattern[m_StreamRank])
{
if (b.name == variable.m_Name and
ssc::AreSameDims(variable.m_Start, b.start) and
ssc::AreSameDims(variable.m_Count, b.count) and
ssc::AreSameDims(variable.m_Shape, b.shape))
if (b.name == variable.m_Name and ssc::AreSameDims(vStart, b.start) and
ssc::AreSameDims(vCount, b.count) and
ssc::AreSameDims(vShape, b.shape))
{
std::memcpy(m_Buffer.data() + b.bufferStart, data, b.bufferCount);
found = true;
......@@ -62,9 +72,9 @@ void SscWriter::PutDeferredCommon(Variable<T> &variable, const T *data)
auto &b = m_GlobalWritePattern[m_StreamRank].back();
b.name = variable.m_Name;
b.type = helper::GetType<T>();
b.shape = variable.m_Shape;
b.start = variable.m_Start;
b.count = variable.m_Count;
b.shape = vShape;
b.start = vStart;
b.count = vCount;
b.bufferStart = m_Buffer.size();
b.bufferCount = ssc::TotalDataSize(b.count, b.type);
m_Buffer.resize(b.bufferStart + b.bufferCount);
......
......@@ -236,7 +236,7 @@ if(ADIOS2_HAVE_MPI)
endif()
if(ADIOS2_HAVE_SSC)
set (SSC_TESTS "1x1;1x1.Attrs;2x1;1x2;2x1ZeroDataVar;2x1ZeroDataR64;3x5;5x3;3x5LockGeometry;TimeoutOnOpen")
set (SSC_TESTS "1x1;1x1.Attrs;2x1;1x2;2x1ZeroDataVar;2x1ZeroDataR64;3x5;5x3;3x5LockGeometry;FtoC.1x1;FtoC.3x5;TimeoutOnOpen")
foreach(test ${SSC_TESTS})
add_common_test(${test} SSC)
endforeach()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment