Comments (4)
Hi @marioroy , if you want to guarantee that your map is cleared, you can swap it with a temporary map, for example:
MyMap map;
map.emplace(....);
...
MyMap().swap(map); // swap map with an empty temporary, which is immediately destroyed
from parallel-hashmap.
Thank you. Your suggestion works.
from parallel-hashmap.
Ah, the vector is already fully allocated initially. Never mind. The maximum memory consumption is reached.
I'm updating the llil4map demonstrations and checking gcc++
, clang++
, including nvc++
. Nvc++ is the reason for the update. I'm resolving nvc++
slow compile and slow program output.
from parallel-hashmap.
Hi, @greg7mdp. I met to ask another question. Is it possible to clear/destroy a sub map individually, inside the top-level parallel loop? This will help minimize total memory consumption.
// Store the properties into a vector
vec_str_int_type propvec;
size_t prev_num_keys;
propvec.resize(map.size());
std::vector<vec_str_int_type::iterator> I; I.resize(map.subcnt());
I[0] = propvec.begin();
for (size_t i = 0; i < map.subcnt(); ++i) {
map.with_submap(i, [&](const map_str_int_type::EmbeddedSet& set) {
if (i == 0) {
prev_num_keys = set.size();
} else {
I[i] = I[i-1] + prev_num_keys;
prev_num_keys = set.size();
}
});
}
#pragma omp parallel for schedule(static, 1) num_threads(4)
for (size_t i = 0; i < map.subcnt(); ++i) {
map.with_submap(i, [&](const map_str_int_type::EmbeddedSet& set) {
auto it = I[i];
for (auto& x : set)
*it++ = std::make_pair(std::move(x.first), x.second);
// here, I like to reclaim memory after the inner-for-loop completes
});
}
// swap map with an empty temporary, which is immediately destroyed
map_str_int_type().swap(map);
from parallel-hashmap.
Related Issues (20)
- Suggestion: lazy_emplace_l without last argument HOT 12
- Unused variable warning HOT 2
- question about performance of `at(...)` HOT 4
- Iteration Order Differs on Arm64 Architecture HOT 4
- Very minor optimization: _mm_abs_epi8 instead of _mm_sign_epi8 HOT 1
- Slow in a specific case HOT 20
- asan build on linux failed with memory error HOT 3
- In template: constexpr variable 'kFirst' must be initialized by a constant expression HOT 6
- phmap_dump saving a lot more than needed HOT 4
- Thread safe way to check existence of items HOT 8
- is it possible to miss the necessary .cmake in the conda packaging? HOT 1
- nvc++: integer conversion resulted in a change of sign HOT 9
- Need a tag about `reserve` bug HOT 3
- Need help speeding up large hash map HOT 6
- merging maps HOT 8
- Release memory after shrinking HOT 6
- Ability to reset the inner sub map HOT 64
- issue under mac? HOT 4
- hash_multimap HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parallel-hashmap.