From c099255ffe2c48fb879b8db42f8c189603807d7f Mon Sep 17 00:00:00 2001 From: David Gardner Date: Tue, 18 Jun 2024 11:39:22 -0700 Subject: [PATCH] Misc cleanups --- morpheus/_lib/src/stages/preprocess_fil.cpp | 40 ++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/morpheus/_lib/src/stages/preprocess_fil.cpp b/morpheus/_lib/src/stages/preprocess_fil.cpp index ad1e09c1b4..12619877e2 100644 --- a/morpheus/_lib/src/stages/preprocess_fil.cpp +++ b/morpheus/_lib/src/stages/preprocess_fil.cpp @@ -38,13 +38,14 @@ #include // for column_view #include // for type_id, data_type #include // for cast -#include // for __check_cuda_errors, MRC_CHECK_CUDA -#include // for Builder -#include // for gil_scoped_acquire -#include // for object_api::operator(), operator""_a, arg -#include // for object, str, object_api, generic_item, literals -#include // for cuda_stream_per_thread -#include // for device_buffer +#include +#include // for __check_cuda_errors, MRC_CHECK_CUDA +#include // for Builder +#include // for gil_scoped_acquire +#include // for object_api::operator(), operator""_a, arg +#include // for object, str, object_api, generic_item, literals +#include // for cuda_stream_per_thread +#include // for device_buffer #include // for find #include // for size_t @@ -229,16 +230,18 @@ std::shared_ptr PreprocessFILStage std::shared_ptr PreprocessFILStage::on_control_message( std::shared_ptr x) + { - auto num_rows = x->payload()->get_info().num_rows(); + auto df_meta = this->fix_bad_columns(x); + const auto num_rows = df_meta.num_rows(); + auto packed_data = std::make_shared(m_fea_cols.size() * num_rows * sizeof(float), rmm::cuda_stream_per_thread); - auto df_meta = this->fix_bad_columns(x); + for (size_t i = 0; i < df_meta.num_columns(); ++i) { auto curr_col = df_meta.get_column(i); - - auto curr_ptr = static_cast(packed_data->data()) + i * df_meta.num_rows(); + auto curr_ptr = static_cast(packed_data->data()) + i * num_rows; // Check if we are something other than float if (curr_col.type().id() != cudf::type_id::FLOAT32) @@ -246,15 +249,13 @@ std::shared_ptr PreprocessFILStagerelease(); // Do the copy here before it goes out of scope - MRC_CHECK_CUDA(cudaMemcpy( - curr_ptr, float_data.data->data(), df_meta.num_rows() * sizeof(float), cudaMemcpyDeviceToDevice)); + MRC_CHECK_CUDA( + cudaMemcpy(curr_ptr, float_data.data->data(), num_rows * sizeof(float), cudaMemcpyDeviceToDevice)); } else { - MRC_CHECK_CUDA(cudaMemcpy(curr_ptr, - curr_col.template data(), - df_meta.num_rows() * sizeof(float), - cudaMemcpyDeviceToDevice)); + MRC_CHECK_CUDA(cudaMemcpy( + curr_ptr, curr_col.template data(), num_rows * sizeof(float), cudaMemcpyDeviceToDevice)); } } @@ -279,10 +280,9 @@ std::shared_ptr PreprocessFILStage(num_rows); memory->set_tensor("input__0", std::move(input__0)); memory->set_tensor("seq_ids", std::move(seq_ids)); - auto next = x; - next->tensors(memory); + x->tensors(memory); - return next; + return x; } template class PreprocessFILStage;