Skip to content

Commit 04714f4

Browse files
Merge branch 'develop' into feature/nameless-shared-shim
2 parents cf6e442 + 17f31fd commit 04714f4

File tree

10 files changed

+103
-48
lines changed

10 files changed

+103
-48
lines changed

.gitlab/jobs/corona.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
# This job intentionally tests our umpire package.py because although this job does not
3131
# explicitly have the ~tools, the package.py should still disable tools from being built.
3232
###
33-
rocmcc_5_7_0_hip_openmp_device_alloc:
33+
rocmcc_5_7_1_hip_openmp_device_alloc:
3434
variables:
35-
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx906 %rocmcc@=5.7.0 ^hip@5.7.0"
35+
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx906 %rocmcc@=5.7.1 ^hip@5.7.1"
3636
extends: .job_on_corona
3737

.gitlab/jobs/lassen.yml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@
1717
# We keep ${PROJECT_<MACHINE>_VARIANTS} and ${PROJECT_<MACHINE>_DEPS} So that
1818
# the comparison with the original job is easier.
1919

20-
# Overriden to increase allocation
21-
xl_2022_08_19_gcc_8_3_1_cuda_11_2_0:
22-
variables:
23-
SPEC: "${PROJECT_LASSEN_VARIANTS} +cuda %xl@=16.1.1.12.gcc.8.3.1 ^cuda@11.2.0+allow-unsupported-compilers ${PROJECT_LASSEN_DEPS}"
24-
MODULE_LIST: "cuda/11.2.0"
25-
LASSEN_JOB_ALLOC: "1 -W 20 -q pci"
26-
extends: .job_on_lassen
27-
20+
# No overridden jobs so far
2821

2922
############
3023
# Extra jobs
@@ -72,12 +65,6 @@ gcc_8_3_1_dev_benchmarks:
7265
SPEC: "~shared +dev_benchmarks +tools build_type=Release %gcc@=8.3.1"
7366
extends: .job_on_lassen
7467

75-
xl_2022_08_19_default_omp_target:
76-
variables:
77-
SPEC: "~shared +tools +openmp +openmp_target tests=basic %xl@=16.1.1.12"
78-
allow_failure: true
79-
extends: .job_on_lassen
80-
8168
gcc_8_3_1_numa:
8269
variables:
8370
SPEC: "~shared +fortran +numa +tools tests=basic %gcc@=8.3.1"
@@ -96,15 +83,19 @@ gcc_8_3_1_tpls:
9683
SPEC: "~shared +fortran +tools tests=basic %gcc@=8.3.1"
9784
extends: .job_on_lassen
9885

86+
gcc_11_2_1_tpls:
87+
variables:
88+
SPEC: "~shared +fortran +tools tests=basic %gcc@=11.2.1"
89+
extends: .job_on_lassen
90+
9991
ibm_clang_14_0_5_gcc_8_3_1_cuda_11_7_0_tpls:
10092
variables:
10193
SPEC: "~shared +fortran +cuda +tools tests=basic %clang@=14.0.5.ibm.gcc.8.3.1 ^cuda@11.7.0+allow-unsupported-compilers"
10294
MODULE_LIST: "cuda/11.7.0"
10395
extends: .job_on_lassen
10496

105-
xl_2022_08_19_gcc_8_3_1_cuda_11_2_tpls:
97+
ibm_clang_16_0_6_gcc_11_2_1_cuda_11_8_tpls:
10698
variables:
107-
SPEC: "~shared +fortran +cuda +tools tests=basic %xl@=16.1.1.12.gcc.8.3.1 ^cuda@11.7.0+allow-unsupported-compilers"
108-
MODULE_LIST: "cuda/11.7.0"
109-
LASSEN_JOB_ALLOC: "1 -W 20 -q pci"
99+
SPEC: "~shared +fortran +cuda +tools tests=basic %clang@=16.0.6.ibm.cuda.11.8.0.gcc.11.2.1 ^cuda@11.8.0+allow-unsupported-compilers"
100+
MODULE_LIST: "cuda/11.8.0"
110101
extends: .job_on_lassen

.gitlab/jobs/poodle.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
# We keep ${PROJECT_<MACHINE>_VARIANTS} and ${PROJECT_<MACHINE>_DEPS} So that
1818
# the comparison with the original job is easier.
1919

20-
# Allow failure due to compiler internal error building wrapfumpire.f
21-
intel_2022_1_0:
22-
variables:
23-
SPEC: "${PROJECT_RUBY_VARIANTS} %intel@=2022.1.0 ${PROJECT_RUBY_DEPS}"
24-
extends: .job_on_poodle
25-
allow_failure: true
26-
2720
############
2821
# Extra jobs
2922
############

.gitlab/jobs/ruby.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
# We keep ${PROJECT_<MACHINE>_VARIANTS} and ${PROJECT_<MACHINE>_DEPS} So that
1818
# the comparison with the original job is easier.
1919

20-
# Allow failure due to compiler internal error building wrapfumpire.f
21-
intel_2022_1_0:
22-
variables:
23-
SPEC: "${PROJECT_RUBY_VARIANTS} %intel@=2022.1.0 ${PROJECT_RUBY_DEPS}"
24-
extends: .job_on_ruby
25-
allow_failure: true
26-
2720
############
2821
# Extra jobs
2922
############

.gitlab/jobs/tioga.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
# the comparison with the original job is easier.
1818

1919
# We override the cce job because we can’t use +device-alloc with it
20-
cce_16_0_1:
20+
cce_18_0_0:
2121
variables:
22-
SPEC: "~shared +fortran tests=basic %cce@=16.0.1"
22+
SPEC: "~shared +fortran tests=basic %cce@=18.0.0"
2323
extends: .job_on_tioga
2424

2525
############
@@ -33,8 +33,8 @@ cce_16_0_1:
3333
# This job intentionally tests our umpire package.py because although this job does not
3434
# explicitly have the ~tools, the package.py should still prevent tools from being built.
3535
###
36-
rocmcc_6_1_1_hip_openmp_device_alloc:
36+
rocmcc_6_2_0_hip_openmp_device_alloc:
3737
variables:
38-
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx90a %rocmcc@=6.1.1 ^hip@6.1.1"
38+
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx90a %rocmcc@=6.2.0 ^hip@6.2.0"
3939
extends: .job_on_tioga
4040

docs/sphinx/cookbook.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ that have introspection disabled for improved performance, and applying CUDA
2929
cookbook/mixed_pool.rst
3030
cookbook/thread_safe.rst
3131
cookbook/file_allocation.rst
32-
cookbook/strategy_name.rst
32+
cookbook/shared_memory.rst
33+
cookbook/strategy_name.rst
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
.. _shared_memory:
2+
3+
=======================
4+
Using IPC Shared Memory
5+
=======================
6+
7+
Umpire supports the use of Inter-Process Communication (IPC) Shared Memory on the HOST memory resource. IPC Shared Memory refers to
8+
the mechanisms that allow processes to communicate with each other and synchronize their actions and involves a method where multiple
9+
processes can access a common memory space.
10+
11+
To use Umpire's IPC Shared Memory allocators, the ``UMPIRE_ENABLE_IPC_SHARED_MEMORY`` flag
12+
should be set to ``On``. Note that you can use IPC Shared Memory with MPI enabled or disabled.
13+
14+
First, to get started with the shared memory allocator, set up the traits. For example:
15+
16+
.. code-block:: cpp
17+
18+
auto traits{umpire::get_default_resource_traits("SHARED")};
19+
20+
The ``traits`` above is a struct of different properties for your shared allocator. You can
21+
set the maximum size of the allocator with ``traits.size`` and set the scope of the allocator.
22+
23+
For example, you can set the scope to socket:
24+
25+
.. code-block:: cpp
26+
27+
traits.scope = umpire::MemoryResourceTraits::shared_scope::socket;
28+
29+
However, by default the scope will be set to "node".
30+
31+
Next, create the shared memory allocator:
32+
33+
.. code-block:: cpp
34+
35+
auto node_allocator{rm.makeResource("SHARED::node_allocator", traits)};
36+
37+
.. note::
38+
The name of the Shared Memory allocators MUST have "SHARED" in the name. This will help
39+
Umpire distinguish the allocators as Shared Memory allocators. It is also used for discovery
40+
by other ranks on node.
41+
42+
Now you can allocate and deallocate shared memory with:
43+
44+
.. code-block:: cpp
45+
46+
void* ptr{node_allocator.allocate("allocation_name_2", sizeof(uint64_t))};
47+
...
48+
node_allocator.deallocate(ptr);
49+
50+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51+
Important Notes About Shared Memory
52+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53+
54+
Because we are dealing with shared memory there are a few unique characteristics of the Shared Memory allocators
55+
which set it apart from other Umpire allocators.
56+
57+
1. Once you allocate shared memory, that block of memory is fixed. If you need a bigger size, you will have to create a new one.
58+
2. If you want to see how much memory is available for a shared memory allocator, use the ``getActualSize()`` function.
59+
3. File descriptors are used for the shared memory. These files will be under ``/dev/shm``.
60+
4. Although Umpire does not need to have MPI enabled in order to provide IPC Shared Memory, if users wish to associate shared memory with MPI communicators, Umpire will need to be built with MPI enabled.
61+
62+
There are a few helper functions provided in the ``Umpire.hpp`` header that will be useful when working with
63+
Shared Memory allocators. For example, you can grab the MPI communicator for a particular Shared Memory allocator with:
64+
65+
.. code-block:: cpp
66+
67+
MPI_Comm shared_allocator_comm = umpire::get_communicator_for_allocator(node_allocator, MPI_COMM_WORLD);
68+
69+
Note that the ``node_allocator`` is the Shared Memory allocator we created above.
70+
Additionally, we can double check that an allocator has the ``SHARED`` memory resource by asserting:
71+
72+
.. code-block:: cpp
73+
74+
UMPIRE_ASSERT(node_allocator.getAllocationStrategy()->getTraits().resource == umpire::MemoryResourceTraits::resource_type::shared);
75+
76+
You can see a full example here:
77+
78+
.. literalinclude:: ../../../examples/cookbook/recipe_shared_memory.cpp
79+
:language: cpp

scripts/gitlab/build_and_test.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ fi
5757

5858
if [[ -n ${module_list} ]]
5959
then
60-
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
61-
echo "~~~~~ Modules to load: ${module_list}"
62-
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
60+
timed_message "Modules to load: ${module_list}"
6361
module load ${module_list}
6462
fi
6563

@@ -79,7 +77,7 @@ then
7977
prefix="${prefix}-${job_unique_id}"
8078
else
8179
# We set the prefix in the parent directory so that spack dependencies are not installed inside the source tree.
82-
prefix="$(pwd)/../spack-and-build-root"
80+
prefix="${project_dir}/../spack-and-build-root"
8381
fi
8482

8583
echo "Creating directory ${prefix}"

src/umpire/strategy/QuickPool.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void QuickPool::deallocate(void* ptr, std::size_t UMPIRE_UNUSED_ARG(size))
147147

148148
if (chunk->prev && chunk->prev->free == true) {
149149
auto prev = chunk->prev;
150-
UMPIRE_LOG(Debug, "Removing chunk" << prev << " from size map");
150+
UMPIRE_LOG(Debug, "Removing chunk " << prev << " from size map");
151151

152152
m_size_map.erase(prev->size_map_it);
153153

@@ -157,7 +157,7 @@ void QuickPool::deallocate(void* ptr, std::size_t UMPIRE_UNUSED_ARG(size))
157157
if (prev->next)
158158
prev->next->prev = prev;
159159

160-
UMPIRE_LOG(Debug, "Merging with prev" << prev << " and " << chunk);
160+
UMPIRE_LOG(Debug, "Merging with prev " << prev << " and " << chunk);
161161
UMPIRE_LOG(Debug, "New size: " << prev->size);
162162

163163
m_chunk_pool.deallocate(chunk);
@@ -171,10 +171,10 @@ void QuickPool::deallocate(void* ptr, std::size_t UMPIRE_UNUSED_ARG(size))
171171
if (chunk->next)
172172
chunk->next->prev = chunk;
173173

174-
UMPIRE_LOG(Debug, "Merging with next" << chunk << " and " << next);
174+
UMPIRE_LOG(Debug, "Merging with next " << chunk << " and " << next);
175175
UMPIRE_LOG(Debug, "New size: " << chunk->size);
176176

177-
UMPIRE_LOG(Debug, "Removing chunk" << next << " from size map");
177+
UMPIRE_LOG(Debug, "Removing chunk " << next << " from size map");
178178
m_size_map.erase(next->size_map_it);
179179

180180
m_chunk_pool.deallocate(next);

0 commit comments

Comments
 (0)