Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove host_parse_nested_json. #15674

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions cpp/src/io/json/nested_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,16 @@ reduce_to_column_tree(tree_meta_t& tree,
cudf::io::parse_options parsing_options(cudf::io::json_reader_options const& options,
rmm::cuda_stream_view stream);

/** @copydoc host_parse_nested_json
/**
* @brief Parses the given JSON string and generates table from the given input.
*
* All processing is done in device memory.
*
* @param input The JSON input
* @param options Parsing options specifying the parsing behaviour
* @param stream The CUDA stream to which kernels are dispatched
* @param mr Optional, resource with which to allocate
* @return The data parsed from the given JSON input
*/
table_with_metadata device_parse_nested_json(device_span<SymbolT const> input,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename device_parse_nested_json to parse_nested_json? We are removing the host implementation in this PR, which previously existed only for debugging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with keeping the name.

cudf::io::json_reader_options const& options,
Expand Down Expand Up @@ -337,20 +344,6 @@ struct path_from_tree {
std::vector<path_rep> get_path(NodeIndexT this_col_id);
};

/**
* @brief Parses the given JSON string and generates table from the given input.
*
* @param input The JSON input
* @param options Parsing options specifying the parsing behaviour
* @param stream The CUDA stream to which kernels are dispatched
* @param mr Optional, resource with which to allocate
* @return The data parsed from the given JSON input
*/
table_with_metadata host_parse_nested_json(device_span<SymbolT const> input,
cudf::io::json_reader_options const& options,
rmm::cuda_stream_view stream,
rmm::device_async_resource_ref mr);

} // namespace detail

} // namespace cudf::io::json
1 change: 0 additions & 1 deletion cpp/src/io/json/read_json.cu
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ table_with_metadata read_json(host_span<std::unique_ptr<datasource>> sources,
cudf::device_span<char const>(reinterpret_cast<char const*>(bufview.data()), bufview.size());
stream.synchronize();
return device_parse_nested_json(buffer, reader_opts, stream, mr);
// For debug purposes, use host_parse_nested_json()
}

} // namespace cudf::io::json::detail
37 changes: 13 additions & 24 deletions cpp/tests/io/nested_json_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,12 @@ TEST_F(JsonTest, TokenStream2)
}
}

struct JsonParserTest : public cudf::test::BaseFixture, public testing::WithParamInterface<bool> {};
INSTANTIATE_TEST_SUITE_P(IsFullGPU, JsonParserTest, testing::Bool());
struct JsonParserTest : public cudf::test::BaseFixture {};

TEST_P(JsonParserTest, ExtractColumn)
TEST_F(JsonParserTest, ExtractColumn)
{
using cuio_json::SymbolT;
bool const is_full_gpu = GetParam();
auto json_parser = is_full_gpu ? cuio_json::detail::device_parse_nested_json
: cuio_json::detail::host_parse_nested_json;
auto json_parser = cuio_json::detail::device_parse_nested_json;

// Prepare cuda stream for data transfers & kernels
auto const stream = cudf::get_default_stream();
Expand Down Expand Up @@ -867,14 +864,12 @@ TEST_F(JsonTest, PostProcessTokenStream)
}
}

TEST_P(JsonParserTest, UTF_JSON)
TEST_F(JsonParserTest, UTF_JSON)
{
// Prepare cuda stream for data transfers & kernels
auto const stream = cudf::get_default_stream();
auto mr = rmm::mr::get_current_device_resource();
bool const is_full_gpu = GetParam();
auto json_parser = is_full_gpu ? cuio_json::detail::device_parse_nested_json
: cuio_json::detail::host_parse_nested_json;
auto const stream = cudf::get_default_stream();
auto mr = rmm::mr::get_current_device_resource();
auto json_parser = cuio_json::detail::device_parse_nested_json;

// Default parsing options
cudf::io::json_reader_options default_options{};
Expand Down Expand Up @@ -924,12 +919,10 @@ TEST_P(JsonParserTest, UTF_JSON)
CUDF_EXPECT_NO_THROW(json_parser(d_utf_pass, default_options, stream, mr));
}

TEST_P(JsonParserTest, ExtractColumnWithQuotes)
TEST_F(JsonParserTest, ExtractColumnWithQuotes)
{
using cuio_json::SymbolT;
bool const is_full_gpu = GetParam();
auto json_parser = is_full_gpu ? cuio_json::detail::device_parse_nested_json
: cuio_json::detail::host_parse_nested_json;
auto json_parser = cuio_json::detail::device_parse_nested_json;

// Prepare cuda stream for data transfers & kernels
auto const stream = cudf::get_default_stream();
Expand Down Expand Up @@ -959,12 +952,10 @@ TEST_P(JsonParserTest, ExtractColumnWithQuotes)
CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected_col2, parsed_col2);
}

TEST_P(JsonParserTest, ExpectFailMixStructAndList)
TEST_F(JsonParserTest, ExpectFailMixStructAndList)
{
using cuio_json::SymbolT;
bool const is_full_gpu = GetParam();
auto json_parser = is_full_gpu ? cuio_json::detail::device_parse_nested_json
: cuio_json::detail::host_parse_nested_json;
auto json_parser = cuio_json::detail::device_parse_nested_json;

// Prepare cuda stream for data transfers & kernels
auto const stream = cudf::get_default_stream();
Expand Down Expand Up @@ -1002,12 +993,10 @@ TEST_P(JsonParserTest, ExpectFailMixStructAndList)
}
}

TEST_P(JsonParserTest, EmptyString)
TEST_F(JsonParserTest, EmptyString)
{
using cuio_json::SymbolT;
bool const is_full_gpu = GetParam();
auto json_parser = is_full_gpu ? cuio_json::detail::device_parse_nested_json
: cuio_json::detail::host_parse_nested_json;
auto json_parser = cuio_json::detail::device_parse_nested_json;

// Prepare cuda stream for data transfers & kernels
auto const stream = cudf::get_default_stream();
Expand Down
Loading