From 2c3d0c9b42a221b398ff6086f22c5cfe71aec26b 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 | 23 ++++++++++++++++------- test/SerialIOTest.cpp | 3 +++ 3 files changed, 30 insertions(+), 8 deletions(-) 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 af5ee17073..83c90f8da7 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -31,20 +31,29 @@ // @todo add TOML here std::map openPMD::getVariants() { - return std::map{ - {"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 + { + {"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 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_ADIOS1 || openPMD_HAVE_ADIOS2 fext.emplace_back("bp"); #endif diff --git a/test/SerialIOTest.cpp b/test/SerialIOTest.cpp index 5745fd2dc1..5eda0b2545 100644 --- a/test/SerialIOTest.cpp +++ b/test/SerialIOTest.cpp @@ -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)