Skip to content

Commit e1a181b

Browse files
authored
Adding contributions for GPUS and gist support (#75)
* initial recipe for binding in some hostlibs * integrating contribution for gpus, and adding gist template to docs/2.3
1 parent cb06a8b commit e1a181b

File tree

5 files changed

+105
-3
lines changed

5 files changed

+105
-3
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
source "https://rubygems.org"
22

3-
# gem "rails"
3+
#gem "rails"
44
gem 'github-pages'
5-
gem 'jekyll'
5+
gem 'jekyll'

_includes/gist.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<style>
2+
/* Better styles for embedding GitHub Gists */
3+
.gist{font-size:13px;line-height:20px;margin-bottom:20px;width:100%}
4+
.gist pre{font-family:Menlo,Monaco,'Bitstream Vera Sans Mono','Courier New',monospace !important}
5+
.gist-meta{font-family:Helvetica,Arial,sans-serif;font-size:13px !important}
6+
.gist-meta a{color:#26a !important;text-decoration:none}
7+
.gist-meta a:hover{color:#0e4071 !important}
8+
</style>
9+
<script src="https://gist.github.com/{{ include.username }}/{{ include.id }}.js?file={{ include.file }}"></script>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: "Using Host libraries: GPU drivers and OpenMPI BTLs"
3+
category: recipes
4+
permalink: tutorial-gpu-drivers-open-mpi-mtls
5+
---
6+
7+
Singularity does a fantastic job of isolating you from the host so you don't
8+
have to muck about with `LD_LIBRARY_PATH`, you just get exactly the library
9+
versions you want. However, in some situations you need to use library
10+
versions that match host exactly. Two common ones are NVIDIA gpu
11+
driver user-space libraries, and OpenMPI transport drivers for high performance
12+
networking. There are many ways to solve these problems. Some people build a container and
13+
copy the version of the libs (installed on the host) into the container.
14+
15+
{% include toc.html %}
16+
17+
## What We will learn today
18+
This document describes how to use a bind mount, symlinks and ldconfig so that when the host
19+
libraries are updated the container does not need to be rebuilt.
20+
21+
**Note** this tutorial is tested with Singularity <a href="https://github.com/singularityware/singularity/commit/945c6ee343a1e6101e22396a90dfdb5944f442b6" target="_blank">commit 945c6ee343a1e6101e22396a90dfdb5944f442b6</a>,
22+
which is part of the (current) development branch, and thus it should work with version 2.3
23+
when that is released. The version of OpenMPI used is 2.1.0 (versions above 2.1 should work).
24+
25+
## Environment
26+
27+
In our environment we run CentOS 7 hosts with:
28+
29+
1. slurm located on `/opt/slurm-<version>` and the slurm user `slurm`
30+
2. Mellanox network cards with drivers installed to `/opt/mellanox` (
31+
Specifically we run a RoCEv1 network for Lustre and MPI communications)
32+
3. NVIDIA GPUs with drivers installed to `/lib64`
33+
4. OpenMPI (by default) for MPI processes
34+
35+
## Creating your image
36+
Since we are building an ubuntu image, it may be easier to create an ubuntu VM
37+
to create the image. Alternatively you can follow the recipe
38+
<a href="/building-ubuntu-rhel-host" target="_blank"> here</a>.
39+
40+
Use the following def file to create the image.
41+
42+
{% include gist.html username='l1ll1' id='89b3f067d5b790ace6e6767be5ea2851' file='hostlibs.def' %}
43+
44+
The mysterious `wget` line gets a list of all the libraries that the CentOS host
45+
has in `/lib64` that *we* think its safe to use in the container. Specifically
46+
these are things like nvidia drivers.
47+
48+
{% include gist.html username='l1ll1' id='89b3f067d5b790ace6e6767be5ea2851' file='desired_hostlibs.txt' %}
49+
50+
Also note:
51+
52+
1. in `hostlibs.def` we create a slurm user. Obviously if your `SlurmUser` is different you should change this name.
53+
2. We make directories for `/opt` and `/usr/local/openmpi`. We're going to bindmount these from the host so we get all the bits of OpenMPI and Mellanox and Slurm that we need.
54+
55+
56+
## Executing your image
57+
On our system we do:
58+
59+
```
60+
SINGULARITYENV_LD_LIBRARY_PATH=/usr/local/openmpi/2.1.0-gcc4/lib:/opt/munge-0.5.11/lib:/opt/slurm-16.05.4/lib:/opt/slurm-16.05.4/lib/slurm:/desired_hostlibs:/opt/mellanox/mxm/lib/
61+
export SINGULARITYENV_LD_LIBRARY_PATH
62+
```
63+
64+
then
65+
66+
```
67+
srun singularity exec -B /usr/local/openmpi:/usr/local/openmpi -B /opt:/opt -B /lib64:/all_hostlibs hostlibs.img <path to binary>
68+
```

pages/docs/admin-docs/docs-hpc.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ One of the architecturally defined features in Singularity is that it can execut
1010

1111
Additionally, because Singularity is not emulating a full hardware level virtualization paradigm, there is no need to separate out any sandboxed networks or file systems because there is no concept of user-escalation within a container. Users can run Singularity containers just as they run any other program on the HPC resource.
1212

13+
1314
## Workflows
1415
We are in the process of developing Singularity Hub, which will allow for generation of workflows using Singularity containers in an online interface, and easy deployment on standard research clusters (e.g., SLURM, SGE). Currently, the Singularity core software is installed on the following research clusters, meaning you can run Singularity containers as part of your jobs:
1516

@@ -30,6 +31,10 @@ Another result of the Singularity architecture is the ability to properly integr
3031

3132
Below are example snippets of building and installing OpenMPI into a container and then running an example MPI program through Singularity.
3233

34+
#### Tutorials
35+
36+
- <a href="/tutorial-gpu-drivers-open-mpi-mtls">Using Host libraries: GPU drivers and OpenMPI BTLs</a>
37+
3338

3439
#### MPI Development Example
3540

pages/docs/contributing/contributing-docs.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,29 @@ Jekyll has this thing they call <a href="https://jekyllrb.com/docs/frontmatter/"
6666
and then write your post after it in <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">Markdown Syntax</a>. All and any HTML tags are fair game as well! Once you add the post, if you have set the category correctly to "news" it should show up in the site feed. It's that easy!
6767

6868
## Contributing to a Page
69-
7069
All of the pages are in the <a href="https://github.com/singularityware/singularityware.github.io/blob/master/pages" target="_blank">pages</a> folder, organized in a somewhat logical manner. If you want to edit content for a page, just edit the corresponding file. If you need to do something more advanced like edit a sidebar, you should look at the <a href="https://github.com/singularityware/singularityware.github.io/blob/master/_data/sidebars" target="_blank">sidebar data</a> yml documents, which render into the navigation.
7170

71+
72+
### Adding gists
73+
You can embed a <a href="https://gist.github.com">Github Gist</a> directly in the page, and we encourage you to keep it under your username to maintain credit for the work. To reduce the additional gem dependencies, instead of using the official `gist include` we have our own wrapper for it that will turn this:
74+
75+
```bash
76+
{{ "{% include gist.html username='l1ll1' id='89b3f067d5b790ace6e6767be5ea2851' file='hostlibs.def'" }}%}
77+
```
78+
79+
into this:
80+
81+
{% include gist.html username='vsoch' id='49709c8ed549155d0a15bde48e893588' file='Singularity' %}
82+
83+
We start with a url that looks like `https://gist.github.com/vsoch/49709c8ed549155d0a15bde48e893588`, under which there is a file called `Singularity`, and the variables are mapped as follows:
84+
85+
- username: `vsoch`
86+
- id: `49709c8ed549155d0a15bde48e893588`
87+
- file: `Singularity`
88+
89+
You can put this single line anywhere on the site, and it will render the gist automatically.
90+
91+
7292
### Recording demos
7393

7494
If you think something could be better explained with a demo, record and embed one! Here's how:

0 commit comments

Comments
 (0)