From b0326afd875ba6840b641a7db8e9df06791abac4 Mon Sep 17 00:00:00 2001 From: anagainaru Date: Tue, 11 Jan 2022 22:56:21 -0500 Subject: [PATCH] clang format to the correct version --- source/adios2/engine/bp5/BP5Writer.tcc | 8 +++---- source/adios2/helper/adiosMemory.h | 4 ++-- .../toolkit/format/bp5/BP5Serializer.cpp | 22 ++++++++++--------- source/adios2/toolkit/format/buffer/BufferV.h | 3 ++- .../toolkit/format/buffer/chunk/ChunkV.cpp | 21 +++++++++--------- .../toolkit/format/buffer/chunk/ChunkV.h | 5 +++-- .../toolkit/format/buffer/malloc/MallocV.h | 3 ++- 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/source/adios2/engine/bp5/BP5Writer.tcc b/source/adios2/engine/bp5/BP5Writer.tcc index fb4ce58ec7..d563781fde 100644 --- a/source/adios2/engine/bp5/BP5Writer.tcc +++ b/source/adios2/engine/bp5/BP5Writer.tcc @@ -26,10 +26,10 @@ void BP5Writer::PutCommon(Variable &variable, const T *values, bool sync) BeginStep(StepMode::Update); } variable.SetData(values); - // if the user buffer is allocated on the GPU always use sync mode - bool isCudaBuffer = (variable.m_MemorySpace == MemorySpace::CUDA); - if (isCudaBuffer) - sync = true; + // if the user buffer is allocated on the GPU always use sync mode + bool isCudaBuffer = (variable.m_MemorySpace == MemorySpace::CUDA); + if (isCudaBuffer) + sync = true; size_t *Shape = NULL; size_t *Start = NULL; diff --git a/source/adios2/helper/adiosMemory.h b/source/adios2/helper/adiosMemory.h index e3cc9bf7a0..d197876d61 100644 --- a/source/adios2/helper/adiosMemory.h +++ b/source/adios2/helper/adiosMemory.h @@ -47,8 +47,8 @@ template void CopyFromGPUToBuffer(std::vector &buffer, size_t &position, const T *source, const size_t elements = 1) noexcept; template -void CudaMemCopyToBuffer(char *buffer, size_t position, - const T *source, const size_t size) noexcept; +void CudaMemCopyToBuffer(char *buffer, size_t position, const T *source, + const size_t size) noexcept; /** * Wrapper around cudaMemcpy needed for isolating CUDA interface dependency diff --git a/source/adios2/toolkit/format/bp5/BP5Serializer.cpp b/source/adios2/toolkit/format/bp5/BP5Serializer.cpp index b9dee2756d..0902be3bf8 100644 --- a/source/adios2/toolkit/format/bp5/BP5Serializer.cpp +++ b/source/adios2/toolkit/format/bp5/BP5Serializer.cpp @@ -580,12 +580,13 @@ static void GetMinMax(const void *Data, size_t ElemCount, const DataType Type, } #ifdef ADIOS2_HAVE_CUDA #define pertype(T, N) \ - else if (MemSpace == MemorySpace::CUDA && Type == helper::GetDataType())\ - { \ - const size_t size = ElemCount * sizeof(T); \ - const T *values = (const T *)Data; \ - helper::CUDAMinMax(values, ElemCount, MinMax.MinUnion.field_##N, \ - MinMax.MaxUnion.field_##N); \ + else if (MemSpace == MemorySpace::CUDA && \ + Type == helper::GetDataType()) \ + { \ + const size_t size = ElemCount * sizeof(T); \ + const T *values = (const T *)Data; \ + helper::CUDAMinMax(values, ElemCount, MinMax.MinUnion.field_##N, \ + MinMax.MaxUnion.field_##N); \ } ADIOS2_FOREACH_MINMAX_STDTYPE_2ARGS(pertype) #undef pertype @@ -681,7 +682,7 @@ void BP5Serializer::Marshal(void *Variable, const char *Name, if ((m_StatsLevel > 0) && !Span) { GetMinMax(Data, ElemCount, (DataType)Rec->Type, MinMax, - VB->m_MemorySpace); + VB->m_MemorySpace); } if (Rec->OperatorType) @@ -710,9 +711,10 @@ void BP5Serializer::Marshal(void *Variable, const char *Name, { if (!DeferAddToVec) { - DataOffset = m_PriorDataBufferSizeTotal + - CurDataBuffer->AddToVec(ElemCount * ElemSize, Data, - ElemSize, Sync, VB->m_MemorySpace); + DataOffset = + m_PriorDataBufferSizeTotal + + CurDataBuffer->AddToVec(ElemCount * ElemSize, Data, + ElemSize, Sync, VB->m_MemorySpace); } } else diff --git a/source/adios2/toolkit/format/buffer/BufferV.h b/source/adios2/toolkit/format/buffer/BufferV.h index db6bab4700..be1d28be80 100644 --- a/source/adios2/toolkit/format/buffer/BufferV.h +++ b/source/adios2/toolkit/format/buffer/BufferV.h @@ -41,7 +41,8 @@ class BufferV virtual void Reset(); virtual size_t AddToVec(const size_t size, const void *buf, size_t align, - bool CopyReqd, MemorySpace MemSpace=MemorySpace::Host) = 0; + bool CopyReqd, + MemorySpace MemSpace = MemorySpace::Host) = 0; struct BufferPos { diff --git a/source/adios2/toolkit/format/buffer/chunk/ChunkV.cpp b/source/adios2/toolkit/format/buffer/chunk/ChunkV.cpp index b2d1318ef4..94b14adaaf 100644 --- a/source/adios2/toolkit/format/buffer/chunk/ChunkV.cpp +++ b/source/adios2/toolkit/format/buffer/chunk/ChunkV.cpp @@ -7,8 +7,8 @@ */ #include "ChunkV.h" -#include "adios2/toolkit/format/buffer/BufferV.h" #include "adios2/helper/adiosFunctions.h" +#include "adios2/toolkit/format/buffer/BufferV.h" #include #include @@ -121,7 +121,7 @@ size_t ChunkV::AddToVec(const size_t size, const void *buf, size_t align, if (AppendPossible) { // We can use current chunk, just append the data; - CopyDataToBuffer(size, buf, m_TailChunkPos, MemSpace); + CopyDataToBuffer(size, buf, m_TailChunkPos, MemSpace); DataV.back().Size += size; m_TailChunkPos += size; } @@ -133,7 +133,7 @@ size_t ChunkV::AddToVec(const size_t size, const void *buf, size_t align, NewSize = size; m_TailChunk = (char *)malloc(NewSize); m_Chunks.push_back(m_TailChunk); - CopyDataToBuffer(size, buf, 0, MemSpace); + CopyDataToBuffer(size, buf, 0, MemSpace); m_TailChunkPos = size; VecEntry entry = {false, m_TailChunk, 0, size}; DataV.push_back(entry); @@ -144,15 +144,16 @@ size_t ChunkV::AddToVec(const size_t size, const void *buf, size_t align, } void ChunkV::CopyDataToBuffer(const size_t size, const void *buf, size_t pos, - MemorySpace MemSpace){ + MemorySpace MemSpace) +{ #ifdef ADIOS2_HAVE_CUDA - if(MemSpace == MemorySpace::CUDA) - { - helper::CudaMemCopyToBuffer(m_TailChunk, pos, buf, size); - return; - } + if (MemSpace == MemorySpace::CUDA) + { + helper::CudaMemCopyToBuffer(m_TailChunk, pos, buf, size); + return; + } #endif - memcpy(m_TailChunk + pos, buf, size); + memcpy(m_TailChunk + pos, buf, size); } BufferV::BufferPos ChunkV::Allocate(const size_t size, size_t align) diff --git a/source/adios2/toolkit/format/buffer/chunk/ChunkV.h b/source/adios2/toolkit/format/buffer/chunk/ChunkV.h index 14ededfb1a..4642108c5f 100644 --- a/source/adios2/toolkit/format/buffer/chunk/ChunkV.h +++ b/source/adios2/toolkit/format/buffer/chunk/ChunkV.h @@ -32,7 +32,8 @@ class ChunkV : public BufferV virtual std::vector DataVec() noexcept; virtual size_t AddToVec(const size_t size, const void *buf, size_t align, - bool CopyReqd, MemorySpace MemSpace=MemorySpace::Host); + bool CopyReqd, + MemorySpace MemSpace = MemorySpace::Host); virtual BufferPos Allocate(const size_t size, size_t align); virtual void DownsizeLastAlloc(const size_t oldSize, const size_t newSize); @@ -40,7 +41,7 @@ class ChunkV : public BufferV virtual void *GetPtr(int bufferIdx, size_t posInBuffer); void CopyExternalToInternal(); - void CopyDataToBuffer(const size_t size, const void *buf, size_t pos, + void CopyDataToBuffer(const size_t size, const void *buf, size_t pos, MemorySpace MemSpace); private: diff --git a/source/adios2/toolkit/format/buffer/malloc/MallocV.h b/source/adios2/toolkit/format/buffer/malloc/MallocV.h index 4cf8d27024..e78b69b945 100644 --- a/source/adios2/toolkit/format/buffer/malloc/MallocV.h +++ b/source/adios2/toolkit/format/buffer/malloc/MallocV.h @@ -36,7 +36,8 @@ class MallocV : public BufferV virtual void Reset(); virtual size_t AddToVec(const size_t size, const void *buf, size_t align, - bool CopyReqd, MemorySpace MemSpace=MemorySpace::Host); + bool CopyReqd, + MemorySpace MemSpace = MemorySpace::Host); virtual BufferPos Allocate(const size_t size, size_t align); void DownsizeLastAlloc(const size_t oldSize, const size_t newSize);