Browse Source

Change index type from int to uint64_t

Christoph Stelz 6 tháng trước cách đây
mục cha
commit
fcb104a257
4 tập tin đã thay đổi với 7 bổ sung4 xóa
  1. 3 1
      include/binary_tree_summation.h
  2. 1 1
      src/binary_tree.cpp
  3. 1 1
      src/binary_tree.hpp
  4. 2 1
      src/c_wrapper.cpp

+ 3 - 1
include/binary_tree_summation.h

@@ -1,6 +1,8 @@
 #ifndef BINARY_TREE_SUMMATION_H_
 #define BINARY_TREE_SUMMATION_H_
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -16,7 +18,7 @@ typedef void * ReductionContext;
 void set_default_reduction_context_communicator(void *communicator);
 ReductionContext new_reduction_context(int global_start_idx, int local_summands);
 ReductionContext new_reduction_context_comm(int global_start_idx, int local_summands, void *communicator);
-void store_summand(ReductionContext context, int local_idx, double val);
+void store_summand(ReductionContext context, uint64_t local_idx, double val);
 double reproducible_reduce(ReductionContext);
 double *get_reduction_buffer(ReductionContext ctx);
 void free_reduction_context(ReductionContext);

+ 1 - 1
src/binary_tree.cpp

@@ -222,7 +222,7 @@ BinaryTreeSummation::~BinaryTreeSummation() {
 double *BinaryTreeSummation::getBuffer() {
     return accumulationBuffer.data();
 }
-void BinaryTreeSummation::storeSummand(int localIndex, double val) {
+void BinaryTreeSummation::storeSummand(uint64_t localIndex, double val) {
     accumulationBuffer[localIndex] = val;
 }
 

+ 1 - 1
src/binary_tree.hpp

@@ -99,7 +99,7 @@ public:
     uint64_t rankFromIndexMap(const uint64_t index) const;
 
     double *getBuffer();
-    void storeSummand(int localIndex, double val);
+    void storeSummand(uint64_t localIndex, double val);
 
 
     /* Sum all numbers. Will return the total sum on rank 0

+ 2 - 1
src/c_wrapper.cpp

@@ -1,4 +1,5 @@
 #include <vector>
+#include <stdint.h>
 #include <mpi.h>
 #include <binary_tree_summation.h>
 #include <numeric>
@@ -54,7 +55,7 @@ void __attribute__((optimize("O0"))) free_reduction_context(ReductionContext ctx
 
     delete ptr;
 }
-void __attribute__((optimize("O0"))) store_summand(ReductionContext ctx, int local_idx, double val) {
+void __attribute__((optimize("O0"))) store_summand(ReductionContext ctx, uint64_t local_idx, double val) {
     auto *ptr = static_cast<BinaryTreeSummation *>(ctx);
 
     ptr->storeSummand(local_idx, val);