From 37d17db0ea1168c8e1e144525328516afd2f1b25 Mon Sep 17 00:00:00 2001 From: littlemine Date: Mon, 1 Apr 2024 21:57:35 +0800 Subject: [PATCH] tdg WIP --- projects/CUDA/CMakeLists.txt | 2 + projects/CUDA/graph/Task.cpp | 73 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 projects/CUDA/graph/Task.cpp diff --git a/projects/CUDA/CMakeLists.txt b/projects/CUDA/CMakeLists.txt index 2b829391af..bf43ef1c12 100644 --- a/projects/CUDA/CMakeLists.txt +++ b/projects/CUDA/CMakeLists.txt @@ -172,6 +172,8 @@ target_sources(zeno PRIVATE utils/Tracing.cu utils/Noise.cu utils/Groom.cpp + + graph/Task.cpp ) add_subdirectory(remesh) diff --git a/projects/CUDA/graph/Task.cpp b/projects/CUDA/graph/Task.cpp new file mode 100644 index 0000000000..a2e96847f8 --- /dev/null +++ b/projects/CUDA/graph/Task.cpp @@ -0,0 +1,73 @@ +#include "zensim/ZpcTuple.hpp" +#include "zensim/zpc_tpls/fmt/format.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace zeno { + +using GenericWorkAttribute = + std::variant, std::vector>; + +struct WorkNode : IObject { + int localIndex; + + std::map attributes; + std::map> deps; +}; + +struct CommandGenerator : INode { + void apply() override { + auto tag = get_input2("name_tag"); + if (tag.empty()) + throw std::runtime_error("work name must not be empty!"); + + auto cmdFmtStr = get_input2("cmd_fmt_string"); + auto cmd = fmt::format(cmdFmtStr, 0); + + // fmt::print("parsed: [[{}]]\n", cmd); + auto ret = std::make_shared(); + + set_output("job", ret); + } +}; + +ZENO_DEFNODE(CommandGenerator) +({/* inputs: */ + { + {"string", "name_tag", ""}, + {"count"}, // int, int list, int range + {"int", "batch_size", "1"}, + + {"string", "cmd_fmt_string", ""}, + {"list", "arguments"}, + {"DictObject", "options"}, + + {"DictObject", "attributes"}, + }, + /* outputs: */ + { + {"JobNode", "job"}, + }, + /* params: */ + {}, + /* category: */ + { + "task", + }}); + +} // namespace zeno \ No newline at end of file