From a4369ff0d51f2d3066fc0e6e968a59249c73d8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Mon, 20 Mar 2023 12:26:10 +0100 Subject: [PATCH] Hide/deactivate/warn Toml backend on nvcc compilers https://github.com/ToruNiina/toml11/issues/205 --- src/IO/JSON/JSONIOHandler.cpp | 12 +++++++++++- src/config.cpp | 8 ++++++++ test/SerialIOTest.cpp | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/IO/JSON/JSONIOHandler.cpp b/src/IO/JSON/JSONIOHandler.cpp index 7eb8a57278..54e1db829b 100644 --- a/src/IO/JSON/JSONIOHandler.cpp +++ b/src/IO/JSON/JSONIOHandler.cpp @@ -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 JSONIOHandler::flush(internal::ParsedFlushParams &) { diff --git a/src/config.cpp b/src/config.cpp index ff1a0cb471..11a064a5dd 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -31,20 +31,28 @@ // @todo add TOML here std::map openPMD::getVariants() { + // clang-format off return std::map{ {"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 openPMD::getFileExtensions() { std::vector 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 diff --git a/test/SerialIOTest.cpp b/test/SerialIOTest.cpp index 7438965771..8c66d695f9 100644 --- a/test/SerialIOTest.cpp +++ b/test/SerialIOTest.cpp @@ -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)