소스 검색

mention lazy reallocation

Samuel Thibault 5 년 전
부모
커밋
3f57bf96b0
1개의 변경된 파일11개의 추가작업 그리고 2개의 파일을 삭제
  1. 11 2
      doc/doxygen/chapters/310_data_management.doxy

+ 11 - 2
doc/doxygen/chapters/310_data_management.doxy

@@ -783,8 +783,17 @@ interface->size += increase;
 so that the allocated area has the expected properties and the allocation is accounted for properly.
 
 Depending on the interface (vector, CSR, etc.) you may have to fix several
-members of the data interface: e.g. both nx and allocsize for vectors, and store
-the pointer both in ptr and dev_handle.
+members of the data interface: e.g. both <c>nx</c> and <c>allocsize</c> for
+vectors, and store the pointer both in <c>ptr</c> and <c>dev_handle</c>.
+
+Some interfaces make a distinction between the actual number of elements
+stored in the data and the actually allocated buffer. For instance, the vector
+interface uses the <c>nx</c> field for the former, and the <c>allocsize</c> for
+the latter. This allows for lazy reallocation to avoid reallocating the buffer
+everytime to exactly match the actual number of elements. Computations and data
+transfers will use <c>nx</c> field, while allocation functions will use the
+<c>allocsize</c>. One just has to make sure that <c>allocsize</c> is always
+bigger or equal to <c>nx</c>.
 
 Important note: one can not change the size of a partitioned data.