'MPI - Send (unordered) map

I am trying to find a way to send an unordered map from one node to another using MPI. The exact data structure I am trying to send is a nested unordered map (std::unordered_map<int, std::unordered_map<int, int>>).

This answer suggests possibly using MPI_Pack/Unpack or defining a custom datatype when sending a hashtable. Can this be used in this situation? How would you yourself approach this problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source