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 11, 2023
1 parent 735a117 commit 2c3d0c9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
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
23 changes: 16 additions & 7 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,29 @@
// @todo add TOML here
std::map<std::string, bool> openPMD::getVariants()
{
return std::map<std::string, bool>{
{"mpi", bool(openPMD_HAVE_MPI)},
{"json", true},
{"toml", true},
{"hdf5", bool(openPMD_HAVE_HDF5)},
{"adios1", bool(openPMD_HAVE_ADIOS1)},
{"adios2", bool(openPMD_HAVE_ADIOS2)}};
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", bool(openPMD_HAVE_ADIOS1)},
{
"adios2", bool(openPMD_HAVE_ADIOS2)
}
};
}

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_ADIOS1 || 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 @@ -1628,8 +1628,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 2c3d0c9

Please sign in to comment.