Hi Itaru,
The problem we had with std::vector was how it allocates memory. When the memory allocated for a vector is full, its capacity is increased by allocating a bigger chunk of memory (commonly with double the capacity of the original vector), and all elements are moved to the new allocation.
We observed that when connections are all put in one big vector, and the number of connections in the vector becomes large, memory consumption from vector growth becomes problematic. We therefore created a new container, BlockVector, to keep memory consumption under control and avoid moving the elements when increasing the capacity. The BlockVector achieves this by allocating an entire block of a fixed size every time the capacity has to be increased. The BlockVector therefore becomes a vector of vectors, where the entire size of each new block, which is a new vector in the vector of vectors, is allocated only once when the block is created.
Some benchmarks were done during the review of the PR,
https://github.com/nest/nest-simulator/pull/1047
You can find the benchmarks here:
https://github.com/nest/nest-simulator/files/2505835/Bench_214_sq_db70dcc1ed...
Note that BlockVector was called "Seque" at the time.
Best, Håkon ________________________________ From: Itaru Kitayama itaru.kitayama@gmail.com Sent: 10 August 2021 05:51 To: NEST User Mailing List users@nest-simulator.org Subject: [NEST Users] libnestutil BlockVector Implementation
Hello Håkon,
As you implemented, an instance of BlockVector is a vector of vectors but allows users to specify with one index. As I am having a few problems with mapping BlockVetors to the device memory, I am simply wondering as to why we can't just use std::vector< value_type >? If you guys observed significant performance improvements with BlockVectors in the past, would you mind pointing me to the papers or notes?
Thanks, Itaru. _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org