-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix append mode double attributes (#1302)
* Add failing test * Allow creating file-based Series with Append mode even if the specified directory does not exist * Add Mpi.hpp with MPI helpers Needed later for checking file presence in parallel situations * Add CHECK_FILE IO task and implement in the backends * Only write top-level attributes when really needed * Enable Series creation in Append mode * Add Windows CI workaround * Windows Workaround: Fallback to Create mode * Avoid MPI mocking, use ifdefs Also use parallel logical or for file existence check * Append mode: test in parallel * Don't alias sendbfr and recvbfr * Undo unused changes * Remove unused Mock_MPI_Comm * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Replace MPI specializations by if constexpr * Try making this constexpr I think that this won't work with every MPI implementation * Link ADIOS2 issue ornladios/ADIOS2#3358 Co-authored-by: Axel Huebl <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent
273466e
commit 230afdd
Showing
20 changed files
with
608 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* Copyright 2022 Franz Poeschel | ||
* | ||
* This file is part of openPMD-api. | ||
* | ||
* openPMD-api is free software: you can redistribute it and/or modify | ||
* it under the terms of of either the GNU General Public License or | ||
* the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* openPMD-api is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License and the GNU Lesser General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* and the GNU Lesser General Public License along with openPMD-api. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
|
||
#include "openPMD/config.hpp" | ||
|
||
#if openPMD_HAVE_MPI | ||
#include <mpi.h> | ||
#endif | ||
|
||
#include <type_traits> | ||
|
||
namespace openPMD::auxiliary | ||
{ | ||
#if openPMD_HAVE_MPI | ||
|
||
namespace detail | ||
{ | ||
namespace | ||
{ | ||
// see https://en.cppreference.com/w/cpp/language/if | ||
template <typename> | ||
inline constexpr bool dependent_false_v = false; | ||
} // namespace | ||
} // namespace detail | ||
|
||
namespace | ||
{ | ||
template <typename T> | ||
constexpr MPI_Datatype openPMD_MPI_type() | ||
{ | ||
using T_decay = std::decay_t<T>; | ||
if constexpr (std::is_same_v<T_decay, char>) | ||
{ | ||
return MPI_CHAR; | ||
} | ||
else if constexpr (std::is_same_v<T_decay, unsigned>) | ||
{ | ||
return MPI_UNSIGNED; | ||
} | ||
else if constexpr (std::is_same_v<T_decay, unsigned long>) | ||
{ | ||
return MPI_UNSIGNED_LONG; | ||
} | ||
else if constexpr (std::is_same_v<T_decay, unsigned long long>) | ||
{ | ||
return MPI_UNSIGNED_LONG_LONG; | ||
} | ||
else | ||
{ | ||
static_assert( | ||
detail::dependent_false_v<T>, | ||
"openPMD_MPI_type: Unsupported type."); | ||
} | ||
} | ||
} // namespace | ||
|
||
#endif | ||
} // namespace openPMD::auxiliary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.