 /** 
  * @brief Computes which partition each row of a gdf_table will belong to based
    on hashing each row, and applying a partition function to the hash value. 
-   Also computes the number of rows that belong to each partition.
+   Records the size of each partition for each thread block as well as the global
+   size of each partition across all thread blocks.
  * 
  * @Param[in] the_table The table whose rows will be partitioned
  * @Param[in] num_rows The number of rows in the table
  * @Param[in] num_partitions The number of partitions to divide the rows into
  * @Param[in] the_partitioner The functor that maps a rows hash value to a partition number
  * @Param[out] row_partition_numbers Array that holds which partition each row belongs to
- * @Param[out] partition_sizes The number of rows in each partition.
+ * @Param[out] block_partition_sizes Array that holds the size of each partition for each block,
+ * i.e., { {block0 partition0 size, block1 partition0 size, ...}, 
+         {block0 partition1 size, block1 partition1 size, ...},
+         ...
+         {block0 partition(num_partitions-1) size, block1 partition(num_partitions -1) size, ...} }
+ * @Param[out] global_partition_sizes The number of rows in each partition.
  */
 /* ----------------------------------------------------------------------------*/
 template <template <typename> class hash_function,

  CUDA_TRY( cudaMalloc(&row_partition_numbers, num_rows * sizeof(hash_value_type)) );

  // Array to hold the size of each partition computed by each block
  size_type * block_partition_sizes{nullptr};
  CUDA_TRY(cudaMalloc(&block_partition_sizes, (grid_size * num_partitions) * sizeof(size_type)));

  // Holds the total size of each partition
  size_type * partition_sizes{nullptr};
  CUDA_TRY( cudaMalloc(&partition_sizes, num_partitions * sizeof(size_type)) );
  CUDA_TRY( cudaMemsetAsync(partition_sizes, 0, num_partitions * sizeof(size_type)) );

  // If the number of partitions is a power of two, we can compute the partition 
  // number of each row more efficiently with bitwise operations

                                                                    partitioner_type(num_partitions),
                                                                    row_partition_numbers,
                                                                    block_partition_sizes,
                                                                    global_partition_sizes);

  }
  else
