Skip to content

Commit

Permalink
Hide/deactivate/warn Toml backend on nvcc compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Apr 12, 2023
1 parent 816252c commit 6007988
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/IO/JSON/JSONIOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ JSONIOHandler::JSONIOHandler(
std::string originalExtension)
: AbstractIOHandler{path, at}
, m_impl{this, std::move(jsonCfg), format, std::move(originalExtension)}
{}
{
// https://github.com/ToruNiina/toml11/issues/205
#if !defined(__NVCC__) || !__NVCC__
if (format == JSONIOHandlerImpl::FileFormat::Toml)
{
std::cerr << "[Warning] Toml backend is broken on NVCC compilers (see "
"https://github.com/ToruNiina/toml11/issues/205)."
<< std::endl;
}
#endif
}

std::future<void> JSONIOHandler::flush(internal::ParsedFlushParams &)
{
Expand Down
8 changes: 8 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,28 @@
// @todo add TOML here
std::map<std::string, bool> openPMD::getVariants()
{
// clang-format off
return std::map<std::string, bool>{
{"mpi", bool(openPMD_HAVE_MPI)},
{"json", true},
// https://github.com/ToruNiina/toml11/issues/205
#if !defined(__NVCC__) || !__NVCC__
{"toml", true},
#endif
{"hdf5", bool(openPMD_HAVE_HDF5)},
{"adios1", false},
{"adios2", bool(openPMD_HAVE_ADIOS2)}};
// clang-format on
}

std::vector<std::string> openPMD::getFileExtensions()
{
std::vector<std::string> fext;
fext.emplace_back("json");
// https://github.com/ToruNiina/toml11/issues/205
#if !defined(__NVCC__) || !__NVCC__
fext.emplace_back("toml");
#endif
#if openPMD_HAVE_ADIOS2
fext.emplace_back("bp");
#endif
Expand Down
3 changes: 3 additions & 0 deletions test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,11 @@ TEST_CASE("dtype_test", "[serial]")
dtype_test(t);
}
}
// https://github.com/ToruNiina/toml11/issues/205
#if !defined(__NVCC__) || !__NVCC__
dtype_test("toml");
dtype_test("toml", R"(toml.mode = "template")");
#endif
}

inline void write_test(const std::string &backend)
Expand Down

0 comments on commit 6007988

Please sign in to comment.