Skip to content

Commit 54a4d58

Browse files
committed
Partially fix issue #43 (only for count)
1 parent f6f44f3 commit 54a4d58

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/cuda/cudf/cudf_aggregate.cu

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ static std::unique_ptr<cudf::reduce_aggregation> make_reduce_aggregation()
2525

2626
void cudf_aggregate(vector<shared_ptr<GPUColumn>>& column, uint64_t num_aggregates, AggregationType* agg_mode)
2727
{
28+
GPUBufferManager *gpuBufferManager = &(GPUBufferManager::GetInstance());
29+
cudf::set_current_device_resource(gpuBufferManager->mr);
2830
if (column[0]->column_length == 0) {
2931
SIRIUS_LOG_DEBUG("Input size is 0");
3032
for (int agg_idx = 0; agg_idx < num_aggregates; agg_idx++) {
3133
if (agg_mode[agg_idx] == AggregationType::COUNT_STAR || agg_mode[agg_idx] == AggregationType::COUNT) {
32-
column[agg_idx] = make_shared_ptr<GPUColumn>(0, ColumnType::INT64, column[agg_idx]->data_wrapper.data);
34+
uint64_t* temp = gpuBufferManager->customCudaMalloc<uint64_t>(1, 0, 0);
35+
cudaMemset(temp, 0, sizeof(uint64_t));
36+
column[agg_idx] = make_shared_ptr<GPUColumn>(1, ColumnType::INT64, reinterpret_cast<uint8_t*>(temp));
3337
} else {
3438
column[agg_idx] = make_shared_ptr<GPUColumn>(0, column[agg_idx]->data_wrapper.type, column[agg_idx]->data_wrapper.data);
3539
}
@@ -42,9 +46,6 @@ void cudf_aggregate(vector<shared_ptr<GPUColumn>>& column, uint64_t num_aggregat
4246
SETUP_TIMING();
4347
START_TIMER();
4448

45-
GPUBufferManager *gpuBufferManager = &(GPUBufferManager::GetInstance());
46-
cudf::set_current_device_resource(gpuBufferManager->mr);
47-
4849
uint64_t size = 0;
4950
for (int agg = 0; agg < num_aggregates; agg++) {
5051
if (column[agg]->data_wrapper.data != nullptr || (column[agg]->data_wrapper.data == nullptr && agg_mode[agg] == AggregationType::COUNT_STAR && column[agg]->column_length > 0)) {

0 commit comments

Comments
 (0)