Skip to content
lukemartinlogan edited this page Mar 1, 2023 · 12 revisions

Installation Guide

We use spack for installing hermes_shm.

# Install spack
cd ${HOME}
git clone https://github.com/spack/spack
cd spack
git checkout v0.18.1
echo . `pwd`/share/spack/setup-env.sh >> ~/.bashrc
source ~/.bashrc

# Add our repo and install hermes_shm
cd ${HOME}
git clone https://github.com/lukemartinlogan/hermes_shm.git
cd hermes_shm
spack repo add scripts/hermes_shm
spack install hermes_shm
spack load hermes_shm

After performing spack load, CMake will be able to find libhermes_shm_data_structures.so:

#CMake example
add_executable(my_new_project ...)
target_link_libraries(my_new_project hermes_shm_data_structures)

For Developers / Contributors

To install hermes_shm, the installation steps are similar. The main difference is that contributors need to be able to re-compile hermes_shm as changes are made. Spack can be used to install all the necessary hermes_shm dependencies, but it can't be used to re-compile hermes-shm when changes are made. The installation steps for developers are as follows:

# Install spack
cd ${HOME}
git clone https://github.com/spack/spack
cd spack
git checkout v0.18.1
echo . `pwd`/share/spack/setup-env.sh >> ~/.bashrc
source ~/.bashrc

# Add our repo and install the hermes_shm dependencies
cd ${HOME}
git clone https://github.com/lukemartinlogan/hermes_shm.git
cd hermes_shm
spack repo add scripts/hermes_shm
spack install hermes_shm
spack load --only dependencies hermes_shm

# Build hermes_shm
mkdir build
cd build
cmake ../
make -j8

What is shared memory?

Shared memory is used to share information between processes running in separate address spaces, without the use of sockets or any kernel-based interfaces.

There are two general types of single-node shared memory:

  1. User-level Threads (ULT) and Lightweight Processes (LWP): Threads run in the context of a single process. They can be executed concurrently on separate cores. Threads share address spaces by nature.
  2. Shared Memory Objects: Processes execute in entirely separate address spaces. To share data between them, shared memory objects (e.g., POSIX shared memory objects) are used.

Using shared memory for data structures has a number of considerations

  1. CPU synchronization overheads for modifying a data structure across CPU cores
  2. CPU cache coherency. When can a value modified by one process be accessed by another process?
  3. Non-Uniform Memory Access (NUMA) effects. What if a process needs data stored on a separate NUMA node?
Clone this wiki locally