Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • title-2-csigerson
  • master
  • hackathon2
  • lbusching2-master-patch-57588
  • preview/nginx
  • ksf2025-challenge
  • site_url
  • sislam2-master-patch-51693
  • FAQ
  • test
  • good-hcc-practice-rep-workflow
  • data_share
  • ipynb-doc
  • hchen2016-faq-home-is-full
  • sislam2-master-patch-86974
  • atticguidelines
  • rclone-fix
  • UNL_OneDrive
  • globus-auto-backups
  • RDPv10
20 results

Target

Select target project
  • Cale Sigerson / HCC docs
  • Derek J Weitzel / HCC docs
  • O. William McClung / HCC docs
  • Salman Djingueinabaye / HCC docs
  • Holland Computing Center / HCC docs
5 results
Select Git revision
  • patch-12
  • patch-11
  • patch-10
  • patch-9
  • patch-8
  • patch-7
  • patch-6
  • patch-5
  • patch-4
  • patch-3
  • master
  • overview-page-for-handling-data
  • submitting-jobs-overview
  • 28-overview-page-for-connecting-2
  • RDPv10
  • 26-add-screenshots-for-newer-rdp-v10-client
  • patch-2
  • patch-1
  • gpu_update
  • runTime
20 results
Show changes
887 files
+ 15822
6647
Compare changes
  • Side-by-side
  • Inline

Files

+4 −0
Original line number Diff line number Diff line
public/
.cache/
__pycache__/
site/
**/.DS_Store
+27 −12
Original line number Diff line number Diff line
variables:
  BASE_URL: "//hcc.unl.edu/docs"
  DEPLOY_ROOT: "/var/www/html/hcc-docs"
  HUGO_TARBALL:  "https://github.com/gohugoio/hugo/releases/download/v0.51/hugo_0.51_Linux-64bit.tar.gz"
  GIT_SUBMODULE_STRATEGY: recursive
  MKDOCS_PREFIX: /tmp/gitlab-${CI_JOB_ID}-${CI_COMMIT_SHORT_SHA}/mkdocs
  MICROMAMBA_ROOT_PREFIX: /tmp/gitlab-${CI_JOB_ID}-${CI_COMMIT_SHORT_SHA}/micromamba

.fetch_external_files: &fetch_external_files
  - curl -L https://raw.githubusercontent.com/unlhcc/singularity-dockerfiles/master/IMAGELIST.md > docs/static/markdown/singularity-images.md
  - curl -L http://swan-head.unl.edu:8192/bio/data/json > docs/static/json/biodata.json
  - curl -L http://swan-head.unl.edu:8192/lmod/spider/json > docs/static/json/lmod.json
  - curl -L http://swan-head.unl.edu:8192/slurm/partitions/json > docs/static/json/swan_partitions.json

stages:
  - test
@@ -10,15 +16,19 @@ stages:

test:
  stage: test
  image: unlhcc/docker-glibc
  image: python:3.11
  except:
    - master
  tags:
    - docker
  before_script:
    - curl -L -o - ${HUGO_TARBALL} | tar -zxv -C /usr/local/bin
    - apt-get -q update
    - apt-get -q -y install zip pandoc
    - pip install -q -r requirements.txt
    - *fetch_external_files
  script:
    - hugo --ignoreCache -v
    - mkdocs build
    - ./pandoc-build.sh

deploy:
  stage: deploy
@@ -29,11 +39,16 @@ deploy:
    - master
  tags:
    - hcc-docs-prod
  before_script:
    - mkdir -p ${MICROMAMBA_ROOT_PREFIX} ${MKDOCS_PREFIX}
    - *fetch_external_files
    - micromamba create -y -q -p ${MKDOCS_PREFIX}/mkdocs python=3.11 pip cairo pandoc
    - micromamba run -p ${MKDOCS_PREFIX}/mkdocs pip install -q -r requirements.txt
  script:
    - export HUGOTMP=`mktemp -d`
    - curl -L -o - ${HUGO_TARBALL} | tar -zx -C ${HUGOTMP}
    - curl -L https://raw.githubusercontent.com/unlhcc/singularity-dockerfiles/master/IMAGELIST.md > static/markdown/singularity-images.md
    - ${HUGOTMP}/hugo --ignoreCache -b ${BASE_URL} -v
    - pandoc -s content/facilities.md -o public/facilities.docx
    - rsync -avz --delete public/ $DEPLOY_ROOT
    - rm -rf ${HUGOTMP}
    - micromamba run -p ${MKDOCS_PREFIX}/mkdocs mkdocs build
    - find site/ -type f -name "*.html" -exec sed -i -e 's/src="\//src="\/docs\//g' -e 's/href="\//href="\/docs\//g' {} +
    - micromamba run -p ${MKDOCS_PREFIX}/mkdocs ./pandoc-build.sh
    - rsync -avz --delete site/ ${DEPLOY_ROOT}
  after_script:
    - rm -rf /tmp/gitlab-${CI_JOB_ID}-${CI_COMMIT_SHORT_SHA}
+3 −3
Original line number Diff line number Diff line
@@ -42,10 +42,10 @@ or a factual error.
1.  Checking for outstanding [issues](https://git.unl.edu/hcc/hcc-docs/issues) is a quick way to identify contribution areas. Additionally,
    review an comments on existing merge requests are welcome.

2.  All documentation content can be found within the `content` folder. Subdirectories indicate menu items,
    with the top level document called `_index.md` within each subdirectory.
2.  All documentation content can be found within the `docs` folder. Subdirectories indicate menu items,
    with the top level document called `index.md` within each subdirectory.

Note: please do not submit modifications to theme or CSS items, `_header` or `_footer` files unless they 
Note: please do not submit modifications to theme or CSS items unless they 
adhere to [UNL style guidelines](https://wdn.unl.edu/unl-web-framework-5-standards-guide).

## What to Contribute
+148 −72
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@ HCC-DOCS

This is the repository for HCC's user documentation.  The documentation is a
combination of [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
for the source and the [Hugo](https://gohugo.io) static site generator.  Currently, 
the theme used is [docDock](https://themes.gohugo.io/docdock/).
for the source and the [MkDocs](https://www.mkdocs.org/) static site generator.  Currently, 
the theme used is [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/).

The website is viewable at https://hcc.unl.edu/docs.

@@ -12,121 +12,183 @@ How to contribute
-----------------

Since the documentation is a git repo, the standard git workflow of creating a branch for your
changes and opening a merge request applies.  The steps below detail how to install Hugo, 
changes and opening a merge request applies.  The steps below detail how to install MkDocs, 
edit/create content, and preview your changes locally before creating the MR/PR.

### Setup your environment

#### Clone the repo (including submodules) and create a new branch

Clone the repo somewhere convenient.  The DocDock theme is provided via a git submodule,
so after cloning, run `git submodule update --init --recursive` in the root of the repo.
Run `git checkout -b <mybranch>` to create a new branch for your changes.
Clone the repo somewhere convenient. 

#### Download and install Hugo
#### Download and install MkDocs

Download the appropriate Hugo tarball from the Hugo [releases page](https://github.com/gohugoio/hugo/releases).
MkDocs, the Material for MkDocs theme, and all plugins are installable with pip. 

(Direct links for [Linux](https://github.com/gohugoio/hugo/releases/download/v0.51/hugo_0.51_Linux-64bit.tar.gz), [Mac](https://github.com/gohugoio/hugo/releases/download/v0.51/hugo_0.51_macOS-64bit.tar.gz), and [Windows](https://github.com/gohugoio/hugo/releases/download/v0.51/hugo_0.51_Windows-64bit.zip))

The `hugo` program is a single binary with no dependencies and does not require root priviledges, 
so just place it somewhere convenient in your `PATH` (i.e. `~/bin`).

Verify it works by running the command `hugo version`:
```
bash-4.4# hugo version
Hugo Static Site Generator v0.51 linux/amd64 BuildDate: 2018-11-07T10:10:13Z
```bash
pip install mkdocs mkdocs-material mkdocs-nav-weight \
    mkdocs-material[imaging] mkdocs-awesome-nav mkdocs-macros-plugin \
    mkdocs-table-reader-plugin mkdocs-include-markdown-plugin
```

### Previewing the site and adding content

#### Use hugo server to preview the site
#### Use mkdocs serve to preview the site

The `hugo server` command will build the site and run a small webserver to allow you to
The `mkdocs serve` command will build the site and run a small webserver to allow you to
preview it.  Depending whether you're working on your local machine or a VM on Anvil,
the option you pass needs to be slightly different.  The `hugo server` command should be
run from the root of the repository (i.e. the same directory the `config.toml` file
the option you pass needs to be slightly different.  The `mkdocs serve` command should be
run from the root of the repository (i.e. the same directory the `mkdocs.yml` file
resides in).

**If you're working on your local laptop/deskop:**
This will allow you to view the webiste by going to `http://localhost:8080` in your web browser. 

Run the command:
```
hugo server -b http://127.0.0.1
```
Alternatively you can build the HTML files to view in a web browser using the `mkdocs build` command 
from the root of the repository. 

You should now be able to preview the website by going to `http://localhost:1313` in your web
browser. 

**If you're working in a VM on Anvil:**

You'll first need to allow port 1313.  If your VM is under the `swanson` project, there is
already an existing "Hugo" security group.  Just add that group to your VM.  Otherwise, first
create it and allow TCP port 1313 though.  You may also need to allow port 1313 through your
You'll first need to allow port 8080.  If your VM is under the `swanson` project, there is
already an existing "Port 8080" security group.  Just add that group to your VM.  Otherwise, first
create it and allow TCP port 8080 though.  You may also need to allow port 8080 through your
instance's firewall.

Once that is done, run the command:
```
hugo server -b http://<instance IP> --bind <instance IP>
mkdocs serve
```
where *\<instance IP\>* is the 10.71.x.x address of your instance.

You should now be able to preview the website by going to `http://<instance IP>:1313` in your web
browser.
You should now be able to preview the website by going to `http://<instance IP>:8080` in your web
browser, where *\<instance IP\>* is the 10.71.x.x address of your instance.

*Note:  The hugo server command will watch the filesystem for changes and force an update in your browswer,
*Note:  The mkdocs serve command will watch the filesystem for changes and force an update in your browswer,
so you can simply leave the server running as you work.*

**Note that the `mkdocs serve` command will not serve image files. If you need to preview images, you'll need to
run nginx via Docker as noted below.**

#### Running nginx using Docker

The built-in mkdocs server doesn't serve images. To fully preview the site either locally or on your VM
you'll need to run an nginx container. Install Docker and ensure port 8080 is allowed through to your VM as above if needed.

First build the site by running

```
mkdocs build
```

in the repo root. Still in the top-level folder of the repo, then run

```
docker run -d --name nginx-hcc-docs -v "${PWD}/site:/usr/share/nginx/html:ro" -p 8080:80 nginx:latest
```

This will start an nginx container in the background. You can then access the site at port 8080 either on localhost
or your VM's IP.  Note that the autorebuild function does not work here.
So you'll need to manually run `mkdocs rebuild` to pick up changes.

Once you're done, remove the container by running

```
docker rm -f nginx-docs
```

#### Adding content

The page content for the site is under the `content/` directory.  The directory structure will determine
The page content for the site is under the `docs/` directory.  The directory structure will determine
how the site itself is structured, so place content based on where in the site you would like it to be.
Each level in the tree will need to have an `_index.md` file to designate it as a new section.  The content
itself is almost all standard markdown.  However, there are a few things that are specific to Hugo that
Each level in the tree will need to have an `index.md` file to designate it as a new section.  The content
itself is almost all standard markdown.  However, there are a few things that are specific to MkDocs that
are used:

1.  *Front matter*  
    [Front matter](https://gohugo.io/content-management/front-matter) is Hugo-specific metadata added
    to the page.  The format can be TOML, YAML, or JSON.  The example here uses TOML, which is identified
    by opening and closing `+++`.  At minimum, each page should have a title and description:  
1.  *YAML Style Metadata*  
    [YAML Style Metadata](https://www.mkdocs.org/user-guide/writing-your-docs/#yaml-style-meta-data) is mkdocs-specific metadata added
    to the page.  The format needs to be YAML.  The example here is for our contact-us page, and is identified
    by opening and closing `---`  At minimum, each page should have a title and description:  
    ```
    +++
    title = "Contact Us"
    description = "Contact Information for HCC"
    +++
    ---
    title: "Contact Us"
    description: "Contact Information for HCC"
    ---
    ```  
    Another useful parameter is the `weight` option.  This will determine the order of display in the navigation tree;
    lower numbers are displayed before higher numbers.

2.  *Shortcodes*  
    [Shortcodes](https://gohugo.io/content-management/shortcodes) are "helper functions" to add content
    that would otherwise require using raw HTML.  Hugo provides some [built-in](https://gohugo.io/content-management/shortcodes/#use-hugo-s-built-in-shortcodes)
    shortcodes. The DocDock theme also provides its own [shortcodes](http://docdock.netlify.com/shortcodes).
    Shortcodes are added via a `{{% shortcodename parameters %}}` declaration.  For example, to embed a YouTube
    video with ID `-Vh7SyC-3mA`:  
    ```
    {{< youtube -Vh7SyC-3mA >}}
    ```  
    Other useful shortcodes include language-specific syntax highlighting, figures, and automatic listing
    of page children for navgiation/summary pages.

3.  *Using `relref` for link generation*  
    The `relref` shortcode should generally be used for linking to other pages within the site.  This will
    generate relative links that should work no matter what the base URL is.  For example, assume you're
    editing "my\_page.md" and want to link to the page "my\_other\_page.md" in the subdirectory "mystuff".
    To do so, add the line  
2.  *Macros and variables*  
    [Macros](https://mkdocs-macros-plugin.readthedocs.io/en/latest/) are "helper functions" to add content
    that would otherwise require using raw HTML.  

    Currently, a few custom ones are implemented. 
    - `{{ youtube('Emded_URL_OR_Share_Code') }}` - Embeds a youtube video into the docs
    - `{{ md_table('path_or_url') }}` - Embeds a markdown table as a sortable table. 
    - `{{ json_table('path_or_url') }}` - Embeds a JSON table as a sortable table. 

    Variables allow for the use of defining shorthand codes for using the same value in multiple places in the documentation.

    These are all defined in the `mkdocs.yml` file in the `extra:` section. 
    Variables are called using `{{ variable.path.to.value }}` where the path starts after the `extra:` block. 

    ```yaml
    extra:
      hcc:  
      # Swan Cluster Specific Information
        swan:
          xfer: "swan-xfer.unl.edu"
          ood:
            name: "Swan Open OnDemand"
            url: "https://swan-ood.unl.edu"
          work:
            block: "100 TiB"
    ```
    [My other page]({{< relref "mystuff/my_other_page" >}})

    Using a section of the YAML above we can get the following exampls:

    - `{{ hcc.swan.xfer }}` would yield the URL for Swan's high speed transfer node
    - `{{ hcc.swan.ood.url }}` would yield the block quota for Swan's $WORK filesystem
    - `{{ hcc.swan.work.block }}` would yield the Open OnDemand URL for Swan
    - ` {{ children('path_after_docs') }} ` - List child pages and Descriptions - do not add trailing `/`

    A good file for examples of the use of these variables is `docs/handling_data/index.md` where many variables 
    are used to discuss the filesystems.

3.  Code Blocks

    Code blocks are able to use language specific formatting and use the standard markdown format for codeblocks. 
    ```` markdown title="Example Code Block"
    ``` python
    print('Hello World!')
    ```
    ````

4.  Links 
    MkDocs uses standard markdown links, `[Text to Display](URL or path/to/file)`
    
    Note that you can omit the `.md` suffix from the filename.

4.  *Static content*  
    Hugo has special handling for static content (images, linked zip files, etc.).  In the root of the repo,
    there is a `static/` directory; all static content should go there.  Subdirectories can be made to keep
    things organized; there are existing directories for `images` and `attachments`.  Feel free to create
    additional directories if it makes sense.  To link to static content, you can use an absolute path from
    any page.  For example, assuming there is an image in the repo at `static/images/my_image.png`,
    you can link to it using the `figure` shortcode as `{{< figure src="/images/my_image.png" >}}`.
5.  *Static content*  
    
    1.  Images
        Images are stored in `docs/images`. 

        Images can then be embeded in one of two methods. The path starts from the `images` directory. 

        Using markdown: `![Optional Image Title](/image/picture.png)`

        Using HTML: `<img src="/images/picture.png">`
        - HTML will also allow the use of standard `img` embedding and customization. 
    
    2.  Markdown and HTML Files
        Sometimes there are cases where information is stored statically elsewhere. These files are organized in `docs/static`

        ``` markdown
        {% 
            include "relative/path/to/file.html"
        %}
        ```
    
    
    -  **Special note for .png files**:  In order to keep the repo size as small as possible, all images
       should be png's if possible, and further processed using the [pngquant](https://pngquant.org) compression
       tool.  This will reduce the size by ~3-4x while keeping good quality.  For example, to process and
@@ -134,6 +196,20 @@ are used:
       prior to committing the files to the repo, otherwise git will be forced to keep multiple copies as the files
       are binary.*

6. Callouts
    These are the callouts used to highlight information and have a few customization options. 
    
    Callout Template:
    
    ``` markdown
    !!! type "Optional Title"
        Content goes here. It is important to make sure to have space in the markdown file above and below the callout. 
        Content must also be indented 
    ```

    A full list of callout types and additional usage information is available in the [Material for MkDocs documentation page](https://squidfunk.github.io/mkdocs-material/reference/admonitions/#supported-types).


#### Adding your changes

Once you've got your set of changes, add and commit them to your branch.  Push the branch and

archetypes/default.md

deleted100644 → 0
+0 −6
Original line number Diff line number Diff line
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

config.toml

deleted100644 → 0
+0 −46
Original line number Diff line number Diff line
#baseURL = "http://hcc-docs.unl.edu/"
languageCode = "en-us"
title = "HCC-DOCS"
theme = "docdock"
contentdir    = "content"
layoutdir     = "layouts"
publishdir    = "public"
baseURL = "/"
canonifyURLs = "true"
relativeURLs = "true"

DefaultContentLanguage = "en"
pygmentsCodeFences = true
pygmentsStyle = "monokailight"

defaultContentLanguage = "en"
defaultContentLanguageInSubdir= false
enableMissingTranslationPlaceholders = false

[params]
editURL = "https://git.unl.edu/hcc/hcc-docs/edit/master/content/"
showVisitedLinks = true # default is false
themeStyle = "original" # "original" or "flex" # default "flex"
themeVariant = "blue" # choose theme variant "green", "gold" , "gray", "blue" (default)
ordersectionsby = "weight" # ordersectionsby = "title"
disableHomeIcon = false # default is false
disableSearch = false # default is false
disableNavChevron = false # set true to hide next/prev chevron, default is false
highlightClientSide = false # set true to use highlight.pack.js instead of the default hugo chroma highlighter
menushortcutsnewtab = true # set true to open shortcuts links to a new tab/window
enableGitInfo = true

[outputs]
home = [ "HTML", "RSS", "JSON"]


[[menu.shortcuts]]
name = "hcc.unl.edu"
identifier = "ds"
url = "https://hcc.unl.edu"
weight = 10

# Hugo v0.60+ switched renderer from blackfriday to goldmark
# - Allow unsafe for docdock template rendering
[markup.goldmark.renderer]
unsafe = true

content/Events/2012/_index.md

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
+++
title = "2012"
description = "Historical listing of various HCC events for the year 2012."
weight = "70"
+++

Historical listing of HCC Events
----------

{{% children %}}

content/Events/2013/_index.md

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
+++
title = "2013"
description = "Historical listing of various HCC events for the year 2013."
weight = "60"
+++

Historical listing of HCC Events
----------

{{% children %}}

content/Events/2014/_index.md

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
+++
title = "2014"
description = "Historical listing of various HCC events for the year 2014."
weight = "50"
+++

Historical listing of HCC Events
----------

{{% children %}}

content/Events/2015/_index.md

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
+++
title = "2015"
description = "Historical listing of various HCC events for the year 2015."
weight = "40"
+++

Historical listing of HCC Events
----------

{{% children %}}

content/Events/2016/_index.md

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
+++
title = "2016"
description = "Historical listing of various HCC events for the year 2016."
weight = "30"
+++

Historical listing of HCC Events
----------

{{% children %}}

content/Events/2017/_index.md

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
+++
title = "2017"
description = "Historical listing of various HCC events for the year 2017."
weight = "20"
+++

Historical listing of HCC Events
----------

{{% children %}}

content/Events/2018/_index.md

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
+++
title = "2018"
description = "Listing of various HCC events for the year 2018."
weight = "10"
+++

Historical listing of HCC Events
----------

{{% children %}}

content/Events/_index.md

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
+++
title = "Events"
description = "Historical listing of various HCC events."
weight = "70"
hidden = true
+++

Historical listing of HCC Events
----------

{{% children sort="weight" description="true" %}}

content/FAQ/_index.md

deleted100644 → 0
+0 −174
Original line number Diff line number Diff line
+++
title = "FAQ"
description = "HCC Frequently Asked Questions"
weight = "95"
+++

- [I have an account, now what?](#i-have-an-account-now-what)
- [How do I change my password?](#how-do-i-change-my-password)
- [I forgot my password, how can I retrieve it?](#i-forgot-my-password-how-can-i-retrieve-it)
- [I just deleted some files and didn't mean to! Can I get them back?](#i-just-deleted-some-files-and-didn-t-mean-to-can-i-get-them-back)
- [How do I (re)activate Duo?](#how-do-i-re-activate-duo)
- [How many nodes/memory/time should I request?](#how-many-nodes-memory-time-should-i-request)
- [I am trying to run a job but nothing happens?](#i-am-trying-to-run-a-job-but-nothing-happens)
- [I keep getting the error "slurmstepd: error: Exceeded step memory limit at some point." What does this mean and how do I fix it?](#i-keep-getting-the-error-slurmstepd-error-exceeded-step-memory-limit-at-some-point-what-does-this-mean-and-how-do-i-fix-it)
- [I want to talk to a human about my problem. Can I do that?](#i-want-to-talk-to-a-human-about-my-problem-can-i-do-that)

---

#### I have an account, now what?

Congrats on getting an HCC account! Now you need to connect to a Holland
cluster. To do this, we use an SSH connection. SSH stands for Secure
Shell, and it allows you to securely connect to a remote computer and
operate it just like you would a personal machine.

Depending on your operating system, you may need to install software to
make this connection. Check out our documentation on [Connecting to HCC Clusters]
({{< relref "../connecting/" >}}).

#### How do I change my password?

#### I forgot my password, how can I retrieve it?

Information on how to change or retrieve your password can be found on
the documentation page: [How to change your
password]({{< relref "/accounts/how_to_change_your_password" >}})


All passwords must be at least 8 characters in length and must contain
at least one capital letter and one numeric digit. Passwords also cannot
contain any dictionary words. If you need help picking a good password,
consider using a (secure!) password generator such as
[this one provided by Random.org](https://www.random.org/passwords)

To preserve the security of your account, we recommend changing the
default password you were given as soon as possible.

#### I just deleted some files and didn't mean to! Can I get them back?

That depends. Where were the files you deleted?

**If the files were in your $HOME directory (/home/group/user/):** It's
possible.

$HOME directories are backed up daily and we can restore your files as
they were at the time of our last backup. Please note that any changes
made to the files between when the backup was made and when you deleted
them will not be preserved. To have these files restored, please contact
HCC Support at
{{< icon name="envelope" >}}[hcc-support@unl.edu](mailto:hcc-support@unl.edu)
as soon as possible.

**If the files were in your $WORK directory (/work/group/user/):** No.

Unfortunately, the $WORK directories are created as a short term place
to hold job files. This storage was designed to be quickly and easily
accessed by our worker nodes and as such is not conducive to backups.
Any irreplaceable files should be backed up in a secondary location,
such as Attic, the cloud, or on your personal machine. For more
information on how to prevent file loss, check out [Preventing File
Loss]({{< relref "preventing_file_loss" >}}).

#### How do I (re)activate Duo?

**If you have not activated Duo before:**

Please stop by
[our offices](http://hcc.unl.edu/location)
along with a photo ID and we will be happy to activate it for you. If
you are not local to Omaha or Lincoln, contact us at
{{< icon name="envelope" >}}[hcc-support@unl.edu](mailto:hcc-support@unl.edu)
and we will help you activate Duo remotely.

**If you have activated Duo previously but now have a different phone
number:**

Stop by our offices along with a photo ID and we can help you reactivate
Duo and update your account with your new phone number.

**If you have activated Duo previously and have the same phone number:**

Email us at
{{< icon name="envelope" >}}[hcc-support@unl.edu](mailto:hcc-support@unl.edu)
from the email address your account is registered under and we will send
you a new link that you can use to activate Duo.

#### How many nodes/memory/time should I request?

**Short answer:** We don’t know.

**Long answer:** The amount of resources required is highly dependent on
the application you are using, the input file sizes and the parameters
you select. Sometimes it can help to speak with someone else who has
used the software before to see if they can give you an idea of what has
worked for them.

Ultimately, it comes down to trial and error; try different
combinations and see what works and what doesn’t. Good practice is to
check the output and utilization of each job you run. This will help you
determine what parameters you will need in the future.

For more information on how to determine how many resources a completed
job used, check out the documentation on [Monitoring Jobs]({{< relref "monitoring_jobs" >}}).

#### I am trying to run a job but nothing happens?

Where are you trying to run the job from? You can check this by typing
the command \`pwd\` into the terminal.

**If you are running from inside your $HOME directory
(/home/group/user/)**:

Move your files to your $WORK directory (/work/group/user) and resubmit
your job.

The worker nodes on our clusters have read-only access to the files in
$HOME directories. This means that when a job is submitted from $HOME,
the scheduler cannot write the output and error files in the directory
and the job is killed. It appears the job does nothing because no output
is produced.

**If you are running from inside your $WORK directory:**

Contact us at
{{< icon name="envelope" >}}[hcc-support@unl.edu](mailto:hcc-support@unl.edu)
with your login, the name of the cluster you are running on, and the
full path to your submit script and we will be happy to help solve the
issue.

##### I keep getting the error "slurmstepd: error: Exceeded step memory limit at some point." What does this mean and how do I fix it?

This error occurs when the job you are running uses more memory than was
requested in your submit script.

If you specified `--mem` or `--mem-per-cpu` in your submit script, try
increasing this value and resubmitting your job.

If you did not specify `--mem` or `--mem-per-cpu` in your submit script,
chances are the default amount allotted is not sufficient. Add the line

{{< highlight batch >}}
#SBATCH --mem=<memory_amount>
{{< /highlight >}}

to your script with a reasonable amount of memory and try running it again. If you keep
getting this error, continue to increase the requested memory amount and
resubmit the job until it finishes successfully.

For additional details on how to monitor usage on jobs, check out the
documentation on [Monitoring Jobs]({{< relref "monitoring_jobs" >}}).

If you continue to run into issues, please contact us at
{{< icon name="envelope" >}}[hcc-support@unl.edu](mailto:hcc-support@unl.edu)
for additional assistance.

#### I want to talk to a human about my problem. Can I do that?

Of course! We have an open door policy and invite you to stop by
[either of our offices](http://hcc.unl.edu/location)
anytime Monday through Friday between 9 am and 5 pm. One of the HCC
staff would be happy to help you with whatever problem or question you
have.  Alternatively, you can drop one of us a line and we'll arrange a
time to meet:  [Contact Us](https://hcc.unl.edu/contact-us).

content/OSG/_index.md

deleted100644 → 0
+0 −30
Original line number Diff line number Diff line
+++
title = "The Open Science Grid"
description = "How to utilize the Open Science Grid (OSG)."
weight = "80"
+++

If you find that you are not getting access to the volume of computing
resources needed for your research through HCC, you might also consider
submitting your jobs to the Open Science Grid (OSG). 

### What is the Open Science Grid?

The [Open Science Grid](http://opensciencegrid.org) advances
science through open distributed computing. The OSG is a
multi-disciplinary partnership to federate local, regional, community
and national cyber infrastructures to meet the needs of research and
academic communities at all scales. HCC participates in the OSG as a
resource provider and a resource user. We provide HCC users with a
gateway to running jobs on the OSG.

The map below shows the Open Science Grid sites located across the U.S.

{{< figure src="/images/17044917.png" >}}

This help document is divided into four sections, namely:

- [Characteristics of an OSG friendly job]({{< relref "characteristics_of_an_osg_friendly_job" >}})
- [How to submit an OSG Job with HTCondor]({{< relref "how_to_submit_an_osg_job_with_htcondor" >}})
- [A simple example of submitting an HTCondorjob]({{< relref "a_simple_example_of_submitting_an_htcondor_job" >}})
- [Using Distributed Environment Modules on OSG]({{< relref "using_distributed_environment_modules_on_osg" >}})
+0 −168
Original line number Diff line number Diff line
+++
title = "A simple example of submitting an HTCondor job"
description = "A simple example of submitting an HTCondor job."
weight=30
+++

This page describes a complete example of submitting an HTCondor job.

1.  SSH to Crane

    {{% panel theme="info" header="ssh command" %}}
    [apple@localhost]ssh apple@crane.unl.edu
    {{% /panel %}}

    {{% panel theme="info" header="output" %}}
    [apple@login.crane~]$
    {{% /panel %}}

2.  Write a simple python program in a file "hello.py" that we wish to
    run using HTCondor

    {{% panel theme="info" header="edit a python code named 'hello.py'" %}}
    [apple@login.crane ~]$ vim hello.py
    {{% /panel %}}

    Then in the edit window, please input the code below:

    {{% panel theme="info" header="hello.py" %}}
    #!/usr/bin/env python
    import sys
    import time
    i=1
    while i<=6:
            print i
            i+=1
            time.sleep(1)
    print 2**8
    print "hello world received argument = " +sys.argv[1]
    {{% /panel %}}

    This program will print 1 through 6 on stdout, then print the number
    256, and finally print  `hello world received argument = <Command
    Line Argument Sent to the hello.py>`

     

3.  Write an HTCondor submit script named "hello.submit"

    {{% panel theme="info" header="hello.submit" %}}
    Universe        = vanilla
    Executable      = hello.py
    Output          = OUTPUT/hello.out.$(Cluster).$(Process).txt
    Error           = OUTPUT/hello.error.$(Cluster).$(Process).txt
    Log             = OUTPUT/hello.log.$(Cluster).$(Process).txt
    notification = Never
    Arguments = $(Process)
    PeriodicRelease = ((JobStatus==5) && (CurentTime - EnteredCurrentStatus) > 30)
    OnExitRemove = (ExitStatus == 0)
    Queue 4
    {{% /panel %}}

4.  Create an OUTPUT directory to receive all output files that
    generated by your job (OUTPUT folder is used in the submit script
    above )

    {{% panel theme="info" header="create output directory" %}}
    [apple@login.crane ~]$ mkdir OUTPUT
    {{% /panel %}}

5.  Submit your job

    {{% panel theme="info" header="condor_submit" %}}
    [apple@login.crane ~]$ condor_submit hello.submit
    {{% /panel %}}

    {{% panel theme="info" header="Output of submit" %}}
    Submitting job(s)

    ....
    4 job(s) submitted to cluster 1013054.
    {{% /panel %}}

6.  Check status of `condor_q`

    {{% panel theme="info" header="condor_q" %}}
    [apple@login.crane ~]$ condor_q
    {{% /panel %}}

    {{% panel theme="info" header="Output of `condor_q`" %}}
    -- Schedd: login.crane.hcc.unl.edu : <129.93.227.113:9619?...
     ID      OWNER            SUBMITTED     RUN_TIME ST PRI SIZE CMD
    720587.0   logan          12/15 10:48  33+14:41:17 H  0   0.0  continuous.cron 20
    720588.0   logan          12/15 10:48 200+02:40:08 H  0   0.0  checkprogress.cron
    1012864.0   jthiltge        2/15 16:48   0+00:00:00 H  0   0.0  test.sh
    1013054.0   jennyshao       4/3  17:58   0+00:00:00 R  0   0.0  hello.py 0
    1013054.1   jennyshao       4/3  17:58   0+00:00:00 R  0   0.0  hello.py 1
    1013054.2   jennyshao       4/3  17:58   0+00:00:00 I  0   0.0  hello.py 2
    1013054.3   jennyshao       4/3  17:58   0+00:00:00 I  0   0.0  hello.py 3
    7 jobs; 0 completed, 0 removed, 0 idle, 4 running, 3 held, 0 suspended
    {{% /panel %}}

    Listed below are the three status of the jobs as observed in the
    above output

    | Symbol | Representation   |
    |--------|------------------|
    | H      | Held             |
    | R      | Running          |
    | I      | Idle and waiting |


7.  Explanation of the `$(Cluster)` and `$(Process)` in HTCondor script

    `$(Cluster)` and `$(Process)` are variables that are available in the
    variable name space in the HTCondor  script. `$(Cluster)` means the
    prefix of your job ID and `$(Process)` varies from `0` through number of
    jobs called with `Queue - 1`. If your job is a single job, then
    `$(Cluster) =` `<job ID>` else, your job ID is combined with `$(Cluster)` and
    `$(Process)`.

    In this example, `$(Cluster)`="1013054" and `$(Process)` varies from "0"
    to "3" for the above HTCondor script.
    In majority of the cases one will use these variables for modifying
    the behavior of each individual task of the HTCondor submission, for
    example one may vary the input/output file/parameters for the run
    program. In this example we are simply passing the `$(Process)` as
    arguments as `sys.argv[1]` in `hello.py`.
    The lines of interest for this discussion from file the HTCondor
    script "hello.submit" are listed below in the code section :

    {{% panel theme="info" header="for `$(Process)`" %}}
    Output= hello.out.$(Cluster).$(Process).txt
    Arguments = $(Process)
    Queue 4
    {{% /panel %}}

    The line of interest for this discussion from file "hello.py" is
    listed in the code section below:

    {{% panel theme="info" header="for `$(Process)`" %}}
    print "hello world received argument = " +sys.argv[1]
    {{% /panel %}}

8.  Viewing the results of your job

    After your job is completed you may use Linux "cat" or "vim" command
    to view the job output.

    For example in the file `hello.out.1013054.2.txt`, "1013054" means
    `$(Cluster)`, and "2" means `$(Process)` the output looks like.

    **example of one output file "hello.out.1013054.2.txt"**
    {{% panel theme="info" header="example of one output file `hello.out.1013054.2.txt`" %}}
    1
    2
    3
    4
    5
    6
    256
    hello world received argument = 2
    {{% /panel %}}

9.  Please see the link below for one more example:

    http://research.cs.wisc.edu/htcondor/tutorials/intl-grid-school-3/submit_first.html

Next: [Using Distributed Environment Modules on OSG]({{< relref "using_distributed_environment_modules_on_osg" >}})
+0 −217
Original line number Diff line number Diff line
+++
title = "How to submit an OSG job with HTCondor"
description = "How to submit an OSG job with HTCondor"
weight=20
+++

{{% notice info%}}Jobs can be submitted to the OSG from Crane, so
there is no need to logon to a different submit host or get a grid
certificate!
{{% /notice %}}

###  What is HTCondor?

The [HTCondor](http://research.cs.wisc.edu/htcondor)
project provides software to schedule individual applications,
workflows, and for sites to manage resources.  It is designed to enable
High Throughput Computing (HTC) on large collections of distributed
resources for users and serves as the job scheduler used on the OSG.
 Jobs are submitted from the Crane login node to the
OSG using an HTCondor submission script.  For those who are used to
submitting jobs with SLURM, there are a few key differences to be aware
of:

### When using HTCondor

- All files (scripts, code, executables, libraries, etc) that are
  needed by the job are transferred to the remote compute site when
  the job is scheduled.  Therefore, all of the files required by the
  job must be specified in the HTCondor submit script.  Paths can be
  absolute or relative to the local directory from which the job is
  submitted.  The main executable (specified on the `Executable` line
  of the submit script) is transferred automatically with the job. 
  All other files need to be listed on the `transfer_input_files`
  line (see example below). 
- All files that are created by
  the job on the remote host will be transferred automatically back to
  the submit host when the job has completed.  This includes
  temporary/scratch and intermediate files that are not removed by
  your job.  If you do not want to keep these files, clean up the work
  space on the remote host by removing these files before the job
  exits (this can be done using a wrapper script for example).
  Specific output file names can be specified with the
  `transfer_input_files` option.  If these files do
  not exist on the remote
  host when the job exits, then the job will not complete successfully
  (it will be place in the *held* state).
- HTCondor scripts can queue
  (submit) as many jobs as you like.  All jobs queued from a single
  submit script will be identical except for the `Arguments` used. 
  The submit script in the example below queues 5 jobs with the first
  set of specified arguments, and 1 job with the second set of
  arguments.  By default, `Queue` when it is not followed by a number
  will submit 1 job.

For more information and advanced usage, see the
[HTCondor Manual](http://research.cs.wisc.edu/htcondor/manual/v8.3/index.html).

### Creating an HTCondor Script

HTCondor, much like Slurm, needs a script to tell it how to do what the
user wants. The example below is a basic script in a file say
'applejob.txt' that can be used to handle most jobs submitted to
HTCondor.

{{% panel theme="info" header="Example of a HTCondor script" %}}
{{< highlight batch >}}
#with executable, stdin, stderr and log
Universe = vanilla
Executable = a.out
Arguments = file_name 12
Output = a.out.out
Error = a.out.err
Log = a.out.log
Queue
{{< /highlight >}}
{{% /panel %}}

The table below explains the various attributes/keywords used in the above script.

| Attribute/Keyword |  Explanation                                                                              |
| ----------------- | ----------------------------------------------------------------------------------------- |
| #                 | Lines starting with '#' are considered as comments by HTCondor.                            |
| Universe          | is the way HTCondor manages different ways it can run, or what is called in the HTCondor documentation, a runtime environment.  The vanilla universe is where most jobs should be run. |
| Executable        | is the name of the executable you want to run on HTCondor.                                |
| Arguments         | are the command line arguments for your program. For example, if one was to run `ls -l /` on HTCondor. The Executable would be `ls` and the Arguments would be `-l /`. |
| Output            | is the file where the information printed to stdout will be sent.                         |
| Error             | is the file where the information printed to stderr will be sent.                         |
| Log               | is the file where information about your HTCondor job will be sent. Information like if the job is running, if it was halted or, if running in the standard universe, if the file was check-pointed or moved. |
| Queue             | is the command to send the job to HTCondor's scheduler.                                   |


Suppose you would like to submit a job e.g. a Monte-Carlo simulation,
where the same program needs to be run several times with the same
parameters the script above can be used with the following modification.

Modify the `Queue` command by giving it the number of times the job must
be run (and hence queued in HTCondor). Thus if the `Queue` command is
changed to `Queue 5`, a.out will be run 5 times with the exact same
parameters.

In another scenario if you would like to submit the same job but with
different parameters, HTCondor accepts files with multiple `Queue`
statements. Only the parameters that need to be changed should be
changed in the HTCondor script before calling the `Queue`.

Please see "A simple example " in next chapter for the detail use of
`$(Process)`

{{% panel theme="info" header="Another Example of a HTCondor script" %}}
{{< highlight batch >}}
#with executable, stdin, stderr and log
#and multiple Argument parameters
Universe = vanilla
Executable = a.out
Arguments = file_name 10
Output = a.out.$(Process).out
Error = a.out.$(Process).err
Log = a.out.$(Process).log
Queue
Arguments = file_name 20
Queue
Arguments = file_name 30
Queue
{{< /highlight >}}
{{% /panel %}}

### How to Submit and View Your job

The steps below describe how to submit a job and other important job
management tasks that you may need in order to monitor and/or control
the submitted job:

1.  How to submit a job to OSG - assuming that you named your HTCondor
    script as a file applejob.txt

    {{< highlight bash >}}[apple@login.crane ~] $ condor_submit applejob{{< /highlight >}}

    You will see the following output after submitting the job
    {{% panel theme="info" header="Example of condor_submit" %}}
    Submitting job(s)
    ......
    6 job(s) submitted to cluster 1013038
    {{% /panel %}}

2.  How to view your job status - to view the job status of your
    submitted jobs use the following shell command
    *Please note that by providing a user name as an argument to the
    `condor_q` command you can limit the list of submitted jobs to the
    ones that are owned by the named user*


    {{< highlight bash >}}[apple@login.crane ~] $ condor_q apple{{< /highlight >}}

    The code section below shows a typical output. You may notice that
    the column ST represents the status of the job (H: Held and I: Idle
    or waiting)

    {{% panel theme="info" header="Example of condor_q" %}}
    -- Schedd: login.crane.hcc.unl.edu : <129.93.227.113:9619?...
     ID      OWNER            SUBMITTED     RUN_TIME ST PRI SIZE CMD
    1013034.4   apple       3/26 16:34   0+00:21:00 H  0   0.0  sjrun.py INPUT/INP
    1013038.0   apple       4/3  11:34   0+00:00:00 I  0   0.0  sjrun.py INPUT/INP
    1013038.1   apple       4/3  11:34   0+00:00:00 I  0   0.0  sjrun.py INPUT/INP
    1013038.2   apple       4/3  11:34   0+00:00:00 I  0   0.0  sjrun.py INPUT/INP
    1013038.3   apple       4/3  11:34   0+00:00:00 I  0   0.0  sjrun.py INPUT/INP
    ...
    16 jobs; 0 completed, 0 removed, 12 idle, 0 running, 4 held, 0 suspended
    {{% /panel %}}

3.  How to release a job - in a few cases a job may get held because of
    reasons such as authentication failure or other non-fatal errors, in
    those cases you may use the shell command below to release the job
    from the held status so that it can be rescheduled by the HTCondor.

    *Release one job:*
    {{< highlight bash >}}[apple@login.crane ~] $ condor_release 1013034.4{{< /highlight >}}

    *Release all jobs of a user apple:*
    {{< highlight bash >}}[apple@login.crane ~] $ condor_release apple{{< /highlight >}}

4.  How to delete a  submitted job - if you want to delete a submitted
    job you may use the shell commands as listed below

    *Delete one job:*
    {{< highlight bash >}}[apple@login.crane ~] $ condor_rm 1013034.4{{< /highlight >}}

    *Delete all jobs of a user apple:*
    {{< highlight bash >}}[apple@login.crane ~] $ condor_rm apple{{< /highlight >}}

5.  How to get help form HTCondor command

    You can use man to get detail explanation of HTCondor command

    {{% panel theme="info" header="Example of help of condor_q" %}}
    [apple@glidein ~]man condor_q
    {{% /panel %}}

    {{% panel theme="info" header="Output of `man condor_q`" %}}
    just-man-pages/condor_q(1)                          just-man-pages/condor_q(1)
    Name
           condor_q Display information about jobs in queue
    Synopsis
           condor_q [ -help ]
           condor_q  [  -debug  ]  [  -global ] [ -submitter submitter ] [ -name name ] [ -pool centralmanagerhost-
           name[:portnumber] ] [ -analyze ] [ -run ] [ -hold ] [ -globus ] [ -goodput ] [ -io ] [ -dag ] [ -long  ]
           [  -xml  ]  [ -attributes Attr1 [,Attr2 ... ] ] [ -format fmt attr ] [ -autoformat[:tn,lVh] attr1 [attr2
           ...]  ] [ -cputime ] [ -currentrun ] [ -avgqueuetime ] [ -jobads file ] [ -machineads file ] [  -stream-
           results ] [ -wide ] [ {cluster | cluster.process | owner | -constraint expression ... } ]
    Description
           condor_q displays information about jobs in the Condor job queue. By default, condor_q queries the local
           job queue but this behavior may be modified by specifying:
              * the -global option, which queries all job queues in the pool
              * a schedd name with the -name option, which causes the queue of the named schedd to be queried
    {{% /panel %}}


    Next: [A simple example of submitting an HTCondorjob]({{< relref "a_simple_example_of_submitting_an_htcondor_job" >}})
+0 −139
Original line number Diff line number Diff line
+++
title = "Using Distributed Environment Modules on OSG"
description = "Using Distributed Environment Modules on OSG"
weight=40
+++

Many commonly used software packages and libraries are provided on the
OSG through the `module` command.  OSG modules are made available
through the OSG Application Software Installation Service (OASIS). The
set of modules provided on OSG can differ from those on the HCC
clusters.  To switch to the OSG modules environment on an HCC machine:

{{< highlight bash >}}
[apple@login.crane~]$ source osg_oasis_init
{{< /highlight >}}

Use the module avail command to see what software and libraries are
available:

{{< highlight bash >}}
[apple@login.crane~]$ module avail
------------------- /cvmfs/oasis.opensciencegrid.org/osg/modules/modulefiles/Core --------------------

   abyss/2.0.2                 gnome_libs/1.0                   pegasus/4.7.1
   ant/1.9.4                   gnuplot/4.6.5                    pegasus/4.7.3
   ANTS/1.9.4                  graphviz/2.38.0                  pegasus/4.7.4     (D)
   ANTS/2.1.0           (D)    grass/6.4.4                      phenix/1.10
   apr/1.5.1                   gromacs/4.6.5                    poppler/0.24.1    (D)
   aprutil/1.5.3               gromacs/5.0.0             (D)    poppler/0.32
   arc-lite/2015               gromacs/5.0.5.cuda               povray/3.7
   atlas/3.10.1                gromacs/5.0.5                    proj/4.9.1
   atlas/3.10.2         (D)    gromacs/5.1.2-cuda               proot/2014
   autodock/4.2.6              gsl/1.16                         protobuf/2.5
{{< /highlight >}}
 
Loading modules is done with the `module load` command: 

{{< highlight bash >}}
[apple@login.crane~]$ module load python/2.7
{{< /highlight >}}

There are two things required in order to use modules in your HTCondor
job.

1.  Create a *wrapper script* for the job.  This script will be the
    executable for your job and will load the module before running the
    main application.  
2.  Include the following requirements in the HTCondor submission
    script:

    {{< highlight batch >}}Requirements = (HAS_MODULES =?= TRUE){{< /highlight >}}

    or 

    {{< highlight batch >}}Requirements = [Other requirements ] && (HAS_MODULES =?= TRUE){{< /highlight >}}

### A simple example using modules on OSG

The following example will demonstrate how to use modules on OSG with an
R script that implements a Monte-Carlo estimation of Pi (`mcpi.R`).

First, create a file called `mcpi.R`:

{{% panel theme="info" header="mcpi.R" %}}{{< highlight R >}}
montecarloPi <- function(trials) {
  count = 0
  for(i in 1:trials) {
    if((runif(1,0,1)^2 + runif(1,0,1)^2)<1) {
      count = count + 1
    }
  }
  return((count*4)/trials)
}

montecarloPi(1000)
{{< /highlight >}}{{% /panel %}}

Next, create a wrapper script called `R-wrapper.sh` to load the required
modules (`R` and `libgfortran`), and execute the R script:

{{% panel theme="info" header="R-wrapper.sh" %}}{{< highlight bash >}}
#!/bin/bash

EXPECTED_ARGS=1

if [ $# -ne $EXPECTED_ARGS ]; then
  echo "Usage: R-wrapper.sh file.R"
  exit 1
else
  module load R
  module load libgfortran
  Rscript $1
fi
{{< /highlight >}}{{% /panel %}}

This script takes the name of the R script (`mcpi.R`) as it's argument
and executes it in batch mode (using the `Rscript` command) after
loading the `R` and `libgfortran` modules.

Make the script executable:

{{< highlight bash >}}[apple@login.crane~]$ chmod a+x R-script.sh{{< /highlight >}}

Finally, create the HTCondor submit script, `R.submit`:

{{% panel theme="info" header="R.submit" %}}{{< highlight batch >}}
universe = vanilla
log = mcpi.log.$(Cluster).$(Process)
error = mcpi.err.$(Cluster).$(Process)
output = mcpi.out.$(Cluster).$(Process)
executable = R-wrapper.sh
transfer_input_files = mcpi.R
arguments = mcpi.R

Requirements = (HAS_MODULES =?= TRUE)
queue 100
{{< /highlight >}}{{% /panel %}}

This script will queue 100 identical jobs to estimate the value of Pi.
Notice that the wrapper script is transferred automatically with the
job because it is listed as the executable.  However, the R script
(`mcpi.R`) must be listed after `transfer_input_files` in order to be
transferred with the job.

Submit the jobs with the `condor_submit` command: 

{{< highlight bash >}}[apple@login.crane~]$ condor_submit R.submit{{< /highlight >}}

Check on the status of your jobs with `condor_q`:

{{< highlight bash >}}[apple@login.crane~]$ condor_q{{< /highlight >}}

When your jobs have completed, find the average estimate for Pi from all
100 jobs:

{{< highlight bash >}}
[apple@login.crane~]$ grep "[1]" mcpi.out.* | awk '{sum += $2} END { print "Average =", sum/NR}'
Average = 3.13821
{{< /highlight >}}

content/_footer.md

deleted100644 → 0
+0 −7
Original line number Diff line number Diff line
+++
  title = "Footer"
+++

{{< icon name="copyright-mark" >}} [Holland Computing Center](https://hcc.unl.edu) | 118 Schorr Center, Lincoln NE 68588 | {{< icon name="envelope" >}}[hcc-support@unl.edu](mailto:hcc-support@unl.edu) | {{< icon name="phone-alt" >}}402-472-5041

See something wrong?  Help us fix it by [contributing](https://git.unl.edu/hcc/hcc-docs/blob/master/CONTRIBUTING.md)!

content/_header.md

deleted100644 → 0
+0 −7
Original line number Diff line number Diff line
+++
title = "Header"
+++
{{< figure src="/images/UNMasterwhite.gif" link="https://nebraska.edu" target="_blank" >}}
### [Holland Computing Center](https://hcc.unl.edu)

#### [HCC-DOCS]({{< relref "/" >}})

content/anvil/available_images.md

deleted100644 → 0
+0 −17
Original line number Diff line number Diff line
+++
title = "Available images"
description = "HCC-provided images for Anvil"
+++

HCC provides pre-configured images available to researchers.  Below is a
list of available images.

{{< sorttable >}}

{{< readfile file="static/markdown/anvil-images.md" markdown="true" >}}

{{< /sorttable >}}

Additional images can be produced by HCC staff by request at
{{< icon name="envelope" >}}[hcc-support@unl.edu](mailto:hcc-support@unl.edu).
 
+0 −90
Original line number Diff line number Diff line
+++
title = "Formatting and mounting a volume in Linux"
description = "How to format and mount volume as a hard drive in Linux."
+++

{{% notice info %}}
This guide assumes you associated your SSH Key Pair with the instance
when it was created, and that you are connected to the [Anvil VPN]({{< relref "connecting_to_the_anvil_vpn" >}}).
{{% /notice %}}

Once you have [created and attached]({{< relref "creating_and_attaching_a_volume" >}})
your volume, it must be formatted and mounted in your Linux instance to be usable.  This
procedure is identical to what would be done when attaching a second
hard drive to a physical machine.  In this example, a 1GB volume was
created and attached to the instance.  Note that the majority of this
guide is for a newly created volume.  


{{% notice note %}}
**If you are attaching an existing volume with data already on it,
skip to [creating a directory and mounting the volume](#mounting-the-volume).**
{{% /notice %}}

#### Formatting the volume

Follow the relevant guide
([Windows]({{< relref "connecting_to_linux_instances_from_windows">}})
| [Mac]({{< relref "connecting_to_linux_instances_from_mac" >}})) for your
operating system to connect to your instance.  Formatting and mounting
the volume requires root privileges, so first run the
command `sudo su -` to get a root shell.

{{% panel theme="danger" header="**Running commands as root**" %}}**Extreme care should be taken when running commands as `root.`** It is very easy to permanently delete data or cause irreparable damage to your instance.{{% /panel %}}

{{< figure src="/images/anvil-volumes/1-sudo.png" width="576" >}}

Next, you will need to determine what device the volume is presented as
within Linux.  Typically this will be `/dev/vdb`, but it is necessary to
verify this to avoid mistakes, especially if you have more than one
volume attached to an instance.  The command `lsblk` will list the
hard drive devices and partitions.

{{< figure src="/images//anvil-volumes/2-lsblk.png" width="576" >}}

Here there is a completely empty (no partitions) disk device matching
the 1GB size of the volume, so `/dev/vdb` is the correct device.
The `parted` utility will first be used to label the device and then create a partition.

{{< highlight bash >}}
parted /dev/vdb mklabel gpt
parted /dev/vdb mkpart primary 0% 100%
{{< /highlight >}}

{{< figure src="/images/anvil-volumes/3-mkpart.png" width="576" >}}

Now that a partition has been created, it can be formatted.  Here, the
ext4 filesystem will be used.  This is the default filesystem used by
many Linux distributions including CentOS and Ubuntu, and is a good
general choice.  An alternate filesystem may be used by running a
different format command.  To format the partition using ext4, run the
command `mkfs.ext4 /dev/vdb1`.  You will see a progress message and then
be returned to the shell prompt.

{{< figure src="/images/anvil-volumes/4-mkfs.png" width="576" >}}

#### Mounting the volume

{{% notice note %}}
If you are attaching a pre-existing volume, start here.
{{% /notice %}}

Finally, the formatted partition must be mounted as a directory to be
used.  By convention this is done under `/mnt`, but you may choose to
mount it elsewhere depending on the usage.  Here, a directory
called `myvolume` will be created and the volume mounted there.  Run the
following commands to make the directory and mount the volume:

{{< highlight bash >}}
mkdir /mnt/myvolume
mount /dev/vdb1 /mnt/myvolume
{{< /highlight >}}

{{< figure src="/images/anvil-volumes/5-mount.png" width="576" >}}

Running the command `df -h` should then show the new mounted empty
volume.  

{{< figure src="/images/anvil-volumes/6-df.png" width="576" >}}

The volume can now be used.

content/applications/_index.md

deleted100644 → 0
+0 −9
Original line number Diff line number Diff line
+++
title = "Running Applications"
weight = "40"
+++

In-depth guides for using applications on HCC resources
--------------------------------------

{{% children description="true" %}}
+0 −58
Original line number Diff line number Diff line
+++
title = "Jupyter Notebooks"
description = "How to access and use a Jupyter Notebook"
weight = 20
+++

- [Connecting to JupyterHub](#connecting-to-jupyterhub)
- [Running Code](#running-code)
- [Opening a Terminal](#opening-a-terminal)
- [Using Custom Packages](#using-custom-packages)

## Connecting to JupyterHub
-----------------------
 Jupyter defines it's notebooks ("Jupyter Notebooks") as 
	an open-source web application that allows you to create and share documents that contain live code,
	equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation,
	statistical modeling, data visualization, machine learning, and much more.

1.  To open a Jupyter notebook, go to the address of the cluster, below [Crane](crane.unl.edu) will be used as an example, sign in using your hcc credentials (NOT your 
	campus credentials).
{{< figure src="/images/jupyterLogin.png" >}}

2.	Select your preferred authentication method.

	{{< figure src="/images/jupyterPush.png" >}}  

3.	Choose a job profile. Select "Noteboook via SLURM Job | Small (1 core, 4GB RAM, 8 hours)" for light tasks such as debugging or small-scale testing.
Select the other options based on your computing needs. Note that a SLURM Job will save to your "work" directory.

{{< figure src="/images/jupyterjob.png" >}}

## Running Code

1.  Select the "New" dropdown menu and select the file type you want to create.   

{{< figure src="/images/jupyterNew.png" >}}
2.	A new tab will open, where you can enter your code. Run your code by selecting the "play" icon.

{{< figure src="/images/jupyterCode.png">}}

## Opening a Terminal

1.	From your user home page, select "terminal" from the "New" drop-down menu.
{{< figure src="/images/jupyterTerminal.png">}}
2.	A terminal opens in a new tab. You can enter [Linux commands]({{< relref "basic_linux_commands" >}})
 at the prompt.
{{< figure src="/images/jupyterTerminal2.png">}}

## Using Custom Packages

Many popular `python` and `R` packages are already installed and available within Jupyter Notebooks. 
However, it is possible to install custom packages to be used in notebooks by creating a custom Anaconda 
Environment. Detailed information on how to create such an environment can be found at
 [Using an Anaconda Environment in a Jupyter Notebook on Crane]({{< relref "/applications/user_software/using_anaconda_package_manager#using-an-anaconda-environment-in-a-jupyter-notebook-on-crane" >}}).

---

 
+0 −18
Original line number Diff line number Diff line
+++
title = "Allinea Profiling & Debugging Tools"
description = "How to use the Allinea suite of tools for profiling and debugging."
+++

HCC provides both the Allinea Forge suite and Performance Reports to
assist with debugging and profiling C/C++/Fortran code.  These tools
support single-threaded, multi-threaded (pthreads/OpenMP), MPI, and CUDA
code.  The Allinea Forge suite consists of two programs:  DDT for
debugging and MAP for profiling.  The Performance Reports software
provides a convenient way to profile HPC applications.  It generates an
easy-to-read single-page HTML report.

For information on using each tool, see the following pages.

[Using Allinea Forge via Reverse Connect]({{< relref "using_allinea_forge_via_reverse_connect" >}})

[Allinea Performance Reports]({{< relref "allinea_performance_reports" >}})
+0 −7
Original line number Diff line number Diff line
+++
title = "Alignment Tools"
description = "How to use various alignment tools on HCC machines"
weight = "52"
+++

{{% children %}}
 No newline at end of file
+0 −7
Original line number Diff line number Diff line
+++
title = "Data Manipulation Tools"
description = "How to use data manipulation tools on HCC machines"
weight = "52"
+++

{{% children %}}
 No newline at end of file
+0 −7
Original line number Diff line number Diff line
+++
title = "De Novo Assembly Tools"
description = "How to use de novo assembly tools on HCC machines"
weight = "52"
+++

{{% children %}}
+0 −93
Original line number Diff line number Diff line
+++
title = "Running Trinity in Multiple Steps"
description =  "How to run Trinity in multiple steps on HCC resources"
weight = "10"
+++


## Running Trinity with Paired-End fastq data with 8 CPUs and 100GB of RAM

The first step of running Trinity is to run Trinity with the option **--no_run_chrysalis**:
{{% panel header="`trinity_step1.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Trinity_Step1
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=100gb
#SBATCH --output=Trinity_Step1.%J.out
#SBATCH --error=Trinity_Step1.%J.err

module load trinity/2.6

Trinity --seqType fq --JM 100G --left input_reads_pair_1.fastq --right input_reads_pair_2.fastq --SS_lib_type FR --output trinity_out/ --CPU $SLURM_NTASKS_PER_NODE --no_run_chrysalis
{{< /highlight >}}
{{% /panel %}}


The second step of running Trinity is to run Trinity with the option **--no_run_quantifygraph**:
{{% panel header="`trinity_step2.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Trinity_Step2
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=100gb
#SBATCH --output=Trinity_Step2.%J.out
#SBATCH --error=Trinity_Step2.%J.err

module load trinity/2.6

Trinity --seqType fq --JM 100G --left input_reads_pair_1.fastq --right input_reads_pair_2.fastq --SS_lib_type FR --output trinity_out/ --CPU $SLURM_NTASKS_PER_NODE --no_run_quantifygraph
{{< /highlight >}}
{{% /panel %}}


The third step of running Trinity is to run Trinity with the option **--no_run_butterfly**:
{{% panel header="`trinity_step3.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Trinity_Step3
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=100gb
#SBATCH --output=Trinity_Step3.%J.out
#SBATCH --error=Trinity_Step3.%J.err

module load trinity/2.6

Trinity --seqType fq --JM 100G --left input_reads_pair_1.fastq --right input_reads_pair_2.fastq --SS_lib_type FR --output trinity_out/ --CPU $SLURM_NTASKS_PER_NODE --no_run_butterfly
{{< /highlight >}}
{{% /panel %}}


The fourth step of running Trinity is to run Trinity without any additional option:
{{% panel header="`trinity_step4.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Trinity_Step4
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=100gb
#SBATCH --output=Trinity_Step4.%J.out
#SBATCH --error=Trinity_Step4.%J.err

module load trinity/2.6

Trinity --seqType fq --JM 100G --left input_reads_pair_1.fastq --right input_reads_pair_2.fastq --SS_lib_type FR --output trinity_out/ --CPU $SLURM_NTASKS_PER_NODE
{{< /highlight >}}
{{% /panel %}}


### Trinity Output

Trinity outputs number of files in its `trinity_out/` output directory after each executed step. The output file `Trinity.fasta` is the final Trinity output that contains the assembled transcripts.


{{% notice tip %}}
The Inchworm (step 1) and Chrysalis (step 2) steps can be memory intensive. A basic recommendation is to have **1GB of RAM per 1M ~76 base Illumina paired-end reads**.
{{% /notice %}}
+0 −68
Original line number Diff line number Diff line
+++
title = "Running Velvet with Paired-End Data"
description =  "How to run velvet with paired-end data on HCC resources"
weight = "10"
+++


## Running Velvet with Paired-End long fastq data with k-mer=43, 8 CPUs and 100GB of RAM

The first step of running Velvet is to run **velveth**:
{{% panel header="`velveth.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Velvet_Velveth
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=10gb
#SBATCH --output=Velveth.%J.out
#SBATCH --error=Velveth.%J.err

module load velvet/1.2
export OMP_NUM_THREADS=$SLURM_NTASKS_PER_NODE

velveth output_directory/ 43 -fastq -longPaired -separate input_reads_pair_1.fastq input_reads_pair_2.fastq
{{< /highlight >}}
{{% /panel %}}


After running **velveth**, the next step is to run **velvetg** on the `output_directory/` and files generated from **velveth**:
{{% panel header="`velvetg.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Velvet_Velvetg
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=100gb
#SBATCH --output=Velvetg.%J.out
#SBATCH --error=Velvetg.%J.err

module load velvet/1.2
export OMP_NUM_THREADS=$SLURM_NTASKS_PER_NODE

velvetg output_directory/ -min_contig_lgth 200
{{< /highlight >}}
{{% /panel %}}

Both **velveth** and **velvetg** are multi-threaded.


### Velvet Output

{{% panel header="`Output directory after velveth`"%}}
{{< highlight bash >}}
$ ls output_directory/
Log  Roadmaps  Sequences
{{< /highlight >}}
{{% /panel %}}

{{% panel header="`Output directory after velvetg`"%}}
{{< highlight bash >}}
$ ls output_directory/
contigs.fa  Graph  LastGraph  Log  PreGraph  Roadmaps  Sequences  stats.txt
{{< /highlight >}}
{{% /panel %}}

The output fasta file `contigs.fa` is the final Velvet output that contains the assembled contigs. More information about the output files is provided in the Velvet manual.
+0 −69
Original line number Diff line number Diff line
+++
title = "Running Velvet with Single-End and Paired-End Data"
description =  "How to run velvet with single-end and paired-end data on HCC resources"
weight = "10"
+++


## Running Velvet with Single-End and Paired-End short fasta data with k-mer=51, 8 CPUs and 100GB of RAM

The first step of running Velvet is to run **velveth**:
{{% panel header="`velveth.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Velvet_Velveth
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=10gb
#SBATCH --output=Velveth.%J.out
#SBATCH --error=Velveth.%J.err

module load velvet/1.2
export OMP_NUM_THREADS=$SLURM_NTASKS_PER_NODE

velveth output_directory/ 51 -fasta -short input_reads.fasta -fasta -shortPaired2 -separate input_reads_pair_1.fasta input_reads_pair_2.fasta
{{< /highlight >}}
{{% /panel %}}


After running **velveth**, the next step is to run **velvetg** on the `output_directory/` and files generated from **velveth**:
{{% panel header="`velvetg.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Velvet_Velvetg
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=100gb
#SBATCH --output=Velvetg.%J.out
#SBATCH --error=Velvetg.%J.err

module load velvet/1.2
export OMP_NUM_THREADS=$SLURM_NTASKS_PER_NODE

velvetg output_directory/ -min_contig_lgth 200
{{< /highlight >}}
{{% /panel %}}

Both **velveth** and **velvetg** are multi-threaded.



### Velvet Output

{{% panel header="`Output directory after velveth`"%}}
{{< highlight bash >}}
$ ls output_directory/
Log  Roadmaps  Sequences
{{< /highlight >}}
{{% /panel %}}

{{% panel header="`Output directory after velvetg`"%}}
{{< highlight bash >}}
$ ls output_directory/
contigs.fa  Graph  LastGraph  Log  PreGraph  Roadmaps  Sequences  stats.txt
{{< /highlight >}}
{{% /panel %}}

The output fasta file `contigs.fa` is the final Velvet output that contains the assembled contigs. More information about the output files is provided in the Velvet manual.
+0 −68
Original line number Diff line number Diff line
+++
title = "Running Velvet with Single-End Data"
description =  "How to run velvet with single-end data on HCC resources"
weight = "10"
+++


## Running Velvet with Single-End short fasta data with k-mer=31, 8 CPUs and 100GB of RAM

The first step of running Velvet is to run **velveth**:
{{% panel header="`velveth.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Velvet_Velveth
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=10gb
#SBATCH --output=Velveth.%J.out
#SBATCH --error=Velveth.%J.err

module load velvet/1.2
export OMP_NUM_THREADS=$SLURM_NTASKS_PER_NODE

velveth output_directory/ 31 -fasta -short input_reads.fasta
{{< /highlight >}}
{{% /panel %}}


After running **velveth**, the next step is to run **velvetg** on the `output_directory/` and files generated from **velveth**:
{{% panel header="`velvetg.submit`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --job-name=Velvet_Velvetg
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --time=168:00:00
#SBATCH --mem=100gb
#SBATCH --output=Velvetg.%J.out
#SBATCH --error=Velvetg.%J.err

module load velvet/1.2
export OMP_NUM_THREADS=$SLURM_NTASKS_PER_NODE

velvetg output_directory/ -min_contig_lgth 200
{{< /highlight >}}
{{% /panel %}}

Both **velveth** and **velvetg** are multi-threaded.


### Velvet Output

{{% panel header="`Output directory after velveth`"%}}
{{< highlight bash >}}
$ ls output_directory/
Log  Roadmaps  Sequences
{{< /highlight >}}
{{% /panel %}}

{{% panel header="`Output directory after velvetg`"%}}
{{< highlight bash >}}
$ ls output_directory/
contigs.fa  Graph  LastGraph  Log  PreGraph  Roadmaps  Sequences  stats.txt
{{< /highlight >}}
{{% /panel %}}

The output fasta file `contigs.fa` is the final Velvet output that contains the assembled contigs. More information about the output files is provided in the Velvet manual.
+0 −43
Original line number Diff line number Diff line
+++
title = "Downloading SRA data from NCBI"
description = "How to download data from NCBI"
weight = "52"
+++


One way to download high-volume data from NCBI is to use command line
utilities, such as **wget**, **ftp** or Aspera Connect **ascp**
plugin. The Aspera Connect plugin is commonly used high-performance transfer
plugin that provides the best transfer speed.

This plugin is available on our clusters as a module. In order to use it, load the appropriate module first:
{{< highlight bash >}}
$ module load aspera-cli
{{< /highlight >}}


The basic usage of the Aspera plugin is
{{< highlight bash >}}
$ ascp -i $ASPERA_PUBLIC_KEY -k 1 -T -l <max_download_rate_in_Mbps>m anonftp@ftp.ncbi.nlm.nih.gov:/<files_to_transfer> <local_work_output_directory>
{{< /highlight >}}
where **-k 1** enables resume of partial transfers, **-T** disables encryption for maximum throughput, and **-l** sets the transfer rate.


**\<files_to_transfer\>** mentioned in the basic usage of Aspera
plugin has a specifically defined pattern that needs to be followed:
{{< highlight bash >}}
<files_to_transfer> = /sra/sra-instant/reads/ByRun/sra/SRR|ERR|DRR/<first_6_characters_of_accession>/<accession>/<accession>.sra
{{< /highlight >}}
where **SRR\|ERR\|DRR** should be either **SRR**, **ERR **or **DRR** and should match the prefix of the target **.sra** file.


More **ascp** options can be seen by using:
{{< highlight bash >}}
$ ascp --help
{{< /highlight >}}


For example, if you want to download the **SRR304976** file from NCBI in your $WORK **data/** directory with downloading speed of **1000 Mbps**, you should use the following command:
{{< highlight bash >}}
$ ascp -i $ASPERA_PUBLIC_KEY -k 1 -T -l 1000m anonftp@ftp.ncbi.nlm.nih.gov:/sra/sra-instant/reads/ByRun/sra/SRR/SRR304/SRR304976/SRR304976.sra /work/[groupname]/[username]/data/
{{< /highlight >}}
+0 −7
Original line number Diff line number Diff line
+++
title = "Pre-processing Tools"
description = "How to use pre-processing tools on HCC machines"
weight = "52"
+++

{{% children %}}
 No newline at end of file
+0 −7
Original line number Diff line number Diff line
+++
title = "Reference-Based Assembly Tools"
description = "How to use reference based assembly tools on HCC machines"
weight = "52"
+++

{{% children %}}
 No newline at end of file
+0 −7
Original line number Diff line number Diff line
+++
title = "Tools for Removing/Detecting Redundant Sequences"
description = "How to use tools for removing/detecting redundant sequences on HCC machines"
weight = "52"
+++

{{% children %}}
+0 −322
Original line number Diff line number Diff line
+++
title = "MPI Jobs on HCC"
description = "How to compile and run MPI programs on HCC machines"
weight = "52"
+++

This quick start demonstrates how to implement a parallel (MPI)
Fortran/C program on HCC supercomputers. The sample codes and submit
scripts can be downloaded from [mpi_dir.zip](/attachments/mpi_dir.zip).

#### Login to a HCC Cluster

Connect to a HCC cluster]({{< relref "../../connecting/" >}}) and make a subdirectory 
and make a subdirectory called `mpi_dir` under your `$WORK` directory.

{{< highlight bash >}}
$ cd $WORK
$ mkdir mpi_dir
{{< /highlight >}}

In the subdirectory `mpi_dir`, save all the relevant codes. Here we
include two demo programs, `demo_f_mpi.f90` and `demo_c_mpi.c`, that
compute the sum from 1 to 20 through parallel processes. A
straightforward parallelization scheme is used for demonstration
purpose. First, the master core (i.e. `myid=0`) distributes equal
computation workload to a certain number of cores (as specified by
`--ntasks `in the submit script). Then, each worker core computes a
partial summation as output. Finally, the master core collects the
outputs from all worker cores and perform an overall summation. For easy
comparison with the serial code ([Fortran/C on HCC]({{< relref "fortran_c_on_hcc">}})), the
added lines in the parallel code (MPI) are marked with "!=" or "//=".

{{%expand "demo_f_mpi.f90" %}}
{{< highlight fortran >}}
Program demo_f_mpi
!====== MPI =====
    use mpi     
!================
    implicit none
    integer, parameter :: N = 20
    real*8 w
    integer i
    common/sol/ x
    real*8 x
    real*8, dimension(N) :: y 
!============================== MPI =================================
    integer ind
    real*8, dimension(:), allocatable :: y_local                    
    integer numnodes,myid,rc,ierr,start_local,end_local,N_local     
    real*8 allsum                                                   
!====================================================================
    
!============================== MPI =================================
    call mpi_init( ierr )                                           
    call mpi_comm_rank ( mpi_comm_world, myid, ierr )               
    call mpi_comm_size ( mpi_comm_world, numnodes, ierr )           
                                                                                                                                        !
    N_local = N/numnodes                                            
    allocate ( y_local(N_local) )                                   
    start_local = N_local*myid + 1                                  
    end_local =  N_local*myid + N_local                             
!====================================================================
    do i = start_local, end_local
        w = i*1d0
        call proc(w)
        ind = i - N_local*myid
        y_local(ind) = x
!       y(i) = x
!       write(6,*) 'i, y(i)', i, y(i)
    enddo   
!       write(6,*) 'sum(y) =',sum(y)
!============================================== MPI =====================================================
    call mpi_reduce( sum(y_local), allsum, 1, mpi_real8, mpi_sum, 0, mpi_comm_world, ierr )             
    call mpi_gather ( y_local, N_local, mpi_real8, y, N_local, mpi_real8, 0, mpi_comm_world, ierr )     
                                                                                                        
    if (myid == 0) then                                                                                 
        write(6,*) '-----------------------------------------'                                          
        write(6,*) '*Final output from... myid=', myid                                                  
        write(6,*) 'numnodes =', numnodes                                                               
        write(6,*) 'mpi_sum =', allsum  
        write(6,*) 'y=...'
        do i = 1, N
            write(6,*) y(i)
        enddo                                                                                       
        write(6,*) 'sum(y)=', sum(y)                                                                
    endif                                                                                               
                                                                                                        
    deallocate( y_local )                                                                               
    call mpi_finalize(rc)                                                                               
!========================================================================================================
    
Stop
End Program
Subroutine proc(w)
    real*8, intent(in) :: w
    common/sol/ x
    real*8 x
    
    x = w
    
Return
End Subroutine
{{< /highlight >}}
{{% /expand %}}

{{%expand "demo_c_mpi.c" %}}
{{< highlight c >}}
//demo_c_mpi
#include <stdio.h>
//======= MPI ========
#include "mpi.h"    
#include <stdlib.h>   
//====================

double proc(double w){
        double x;       
        x = w;  
        return x;
}

int main(int argc, char* argv[]){
    int N=20;
    double w;
    int i;
    double x;
    double y[N];
    double sum;
//=============================== MPI ============================
    int ind;                                                    
    double *y_local;                                            
    int numnodes,myid,rc,ierr,start_local,end_local,N_local;    
    double allsum;                                              
//================================================================
//=============================== MPI ============================
    MPI_Init(&argc, &argv);
    MPI_Comm_rank( MPI_COMM_WORLD, &myid );
    MPI_Comm_size ( MPI_COMM_WORLD, &numnodes );
    N_local = N/numnodes;
    y_local=(double *) malloc(N_local*sizeof(double));
    start_local = N_local*myid + 1;
    end_local = N_local*myid + N_local;
//================================================================
    
    for (i = start_local; i <= end_local; i++){        
        w = i*1e0;
        x = proc(w);
        ind = i - N_local*myid;
        y_local[ind-1] = x;
//      y[i-1] = x;
//      printf("i,x= %d %lf\n", i, y[i-1]) ;
    }
    sum = 0e0;
    for (i = 1; i<= N_local; i++){
        sum = sum + y_local[i-1];   
    }
//  printf("sum(y)= %lf\n", sum);    
//====================================== MPI ===========================================
    MPI_Reduce( &sum, &allsum, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD );
    MPI_Gather( &y_local[0], N_local, MPI_DOUBLE, &y[0], N_local, MPI_DOUBLE, 0, MPI_COMM_WORLD );
    
    if (myid == 0){
    printf("-----------------------------------\n");
    printf("*Final output from... myid= %d\n", myid);
    printf("numnodes = %d\n", numnodes);
    printf("mpi_sum = %lf\n", allsum);
    printf("y=...\n");
    for (i = 1; i <= N; i++){
        printf("%lf\n", y[i-1]);
    }   
    sum = 0e0;
    for (i = 1; i<= N; i++){
        sum = sum + y[i-1]; 
    }
    
    printf("sum(y) = %lf\n", sum);
    
    }
    
    free( y_local );
    MPI_Finalize ();
//======================================================================================        

return 0;
}
{{< /highlight >}}
{{% /expand %}}

---

#### Compiling the Code

The compiling of a MPI code requires first loading a compiler "engine"
such as `gcc`, `intel`, or `pgi` and then loading a MPI wrapper
`openmpi`. Here we will use the GNU Complier Collection, `gcc`, for
demonstration.

{{< highlight bash >}}
$ module load compiler/gcc/6.1 openmpi/2.1
$ mpif90 demo_f_mpi.f90 -o demo_f_mpi.x  
$ mpicc demo_c_mpi.c -o demo_c_mpi.x
{{< /highlight >}}

The above commends load the `gcc` complier with the `openmpi` wrapper.
The compiling commands `mpif90` or `mpicc` are used to compile the codes
to`.x` files (executables). 

### Creating a Submit Script

Create a submit script to request 5 cores (with `--ntasks`). A parallel
execution command `mpirun ./` needs to enter to last line before the
main program name.

{{% panel header="`submit_f.mpi`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --ntasks=5
#SBATCH --mem-per-cpu=1024
#SBATCH --time=00:01:00
#SBATCH --job-name=Fortran
#SBATCH --error=Fortran.%J.err
#SBATCH --output=Fortran.%J.out

mpirun ./demo_f_mpi.x 
{{< /highlight >}}
{{% /panel %}}

{{% panel header="`submit_c.mpi`"%}}
{{< highlight bash >}}
#!/bin/sh
#SBATCH --ntasks=5
#SBATCH --mem-per-cpu=1024
#SBATCH --time=00:01:00
#SBATCH --job-name=C
#SBATCH --error=C.%J.err
#SBATCH --output=C.%J.out

mpirun ./demo_c_mpi.x 
{{< /highlight >}}
{{% /panel %}}

#### Submit the Job

The job can be submitted through the command `sbatch`. The job status
can be monitored by entering `squeue` with the `-u` option.

{{< highlight bash >}}
$ sbatch submit_f.mpi
$ sbatch submit_c.mpi
$ squeue -u <username>
{{< /highlight >}}

Replace `<username>` with your HCC username.

Sample Output
-------------

The sum from 1 to 20 is computed and printed to the `.out` file (see
below). The outputs from the 5 cores are collected and processed by the
master core (i.e. `myid=0`).

{{%expand "Fortran.out" %}}
{{< highlight batchfile>}}
 -----------------------------------------
 *Final output from... myid=           0
 numnodes =           5
 mpi_sum =   210.00000000000000     
 y=...
   1.0000000000000000     
   2.0000000000000000     
   3.0000000000000000     
   4.0000000000000000     
   5.0000000000000000     
   6.0000000000000000     
   7.0000000000000000     
   8.0000000000000000     
   9.0000000000000000     
   10.000000000000000     
   11.000000000000000     
   12.000000000000000     
   13.000000000000000     
   14.000000000000000     
   15.000000000000000     
   16.000000000000000     
   17.000000000000000     
   18.000000000000000     
   19.000000000000000     
   20.000000000000000     
 sum(y)=   210.00000000000000     
{{< /highlight >}}
{{% /expand %}} 

{{%expand "C.out" %}}
{{< highlight batchfile>}}
-----------------------------------
*Final output from... myid= 0
numnodes = 5
mpi_sum = 210.000000
y=...
1.000000
2.000000
3.000000
4.000000
5.000000
6.000000
7.000000
8.000000
9.000000
10.000000
11.000000
12.000000
13.000000
14.000000
15.000000
16.000000
17.000000
18.000000
19.000000
20.000000
sum(y) = 210.000000
{{< /highlight >}}
{{% /expand %}}
+0 −219
Original line number Diff line number Diff line
+++
title = "Running Matlab Parallel Server"
description = "How to run Matlab Parallel Server on HCC resources."
+++

## This document provides the steps to configure MATLAB to submit jobs to a cluster, retrieve results, and debug errors.

### CONFIGURATION    
After logging into the cluster, start MATLAB.  Configure MATLAB to run parallel jobs on your cluster by calling configCluster.
```Matlab
>> configCluster
```
Jobs will now default to the cluster rather than submit to the local machine.

NOTE: If you would like to submit to the local machine then run the following command:
```Matlab
>> % Get a handle to the local resources
>> c = parcluster('local');
```

### CONFIGURING JOBS    
Prior to submitting the job, we can specify various parameters to pass to our jobs, such as queue, e-mail, walltime, etc. 
```Matlab
>> % Get a handle to the cluster
>> c = parcluster;

>> % Specify a partition to use for MATLAB jobs. The default partition is batch.			
>> c.AdditionalProperties.QueueName = 'partition-name';

>> % Run time in hh:mm:ss
>> c.AdditionalProperties.WallTime = '05:00:00';

>> % Maximum memory required per CPU (in megabytes)
>> c.AdditionalProperties.MemUsage = '4000';

>> % Specify e-mail address to receive notifications about your job
>> c.AdditionalProperties.EmailAddress = 'user-id@company.com';

>> % If you have other SLURM directives to specify such as a reservation, use the command below:
>> c.AdditionalProperties.AdditionalSubmitArgs = '';
```

Save changes after modifying AdditionalProperties for the above changes to persist between MATLAB sessions.
```Matlab
>> c.saveProfile
```

To see the values of the current configuration options, display AdditionalProperties.

```Matlab
>> % To view current properties
>> c.AdditionalProperties
```

Unset a value when no longer needed.
```Matlab
>> % Turn off email notifications 
>> c.AdditionalProperties.EmailAddress = '';
>> c.saveProfile
```

### INTERACTIVE JOBS    
To run an interactive pool job on the cluster, continue to use parpool as you’ve done before.
```Matlab
>> % Get a handle to the cluster
>> c = parcluster;

>> % Open a pool of 64 workers on the cluster
>> p = c.parpool(64);
```

Rather than running local on the local machine, the pool can now run across multiple nodes on the cluster.

```Matlab
>> % Run a parfor over 1000 iterations
>> parfor idx = 1:1000
      a(idx) = …
   end
```

Once we’re done with the pool, delete it.

```Matlab
>> % Delete the pool
>> p.delete
```

### INDEPENDENT BATCH JOB    
Rather than running interactively, use the batch command to submit asynchronous jobs to the cluster.  The batch command will return a job object which is used to access the output of the submitted job.  See the MATLAB documentation for more help on batch.
```Matlab
>> % Get a handle to the cluster
>> c = parcluster;

>> % Submit job to query where MATLAB is running on the cluster
>> j = c.batch(@pwd, 1, {});

>> % Query job for state
>> j.State

>> % If state is finished, fetch the results
>> j.fetchOutputs{:}

>> % Delete the job after results are no longer needed
>> j.delete
```

To retrieve a list of currently running or completed jobs, call parcluster to retrieve the cluster object.  The cluster object stores an array of jobs that were run, are running, or are queued to run.  This allows us to fetch the results of completed jobs.  Retrieve and view the list of jobs as shown below.
```Matlab
>> c = parcluster;
>> jobs = c.Jobs;
```

Once we’ve identified the job we want, we can retrieve the results as we’ve done previously. 
fetchOutputs is used to retrieve function output arguments; if calling batch with a script, use load instead.   Data that has been written to files on the cluster needs be retrieved directly from the file system (e.g. via ftp).
To view results of a previously completed job:
```Matlab
>> % Get a handle to the job with ID 2
>> j2 = c.Jobs(2);
```

NOTE: You can view a list of your jobs, as well as their IDs, using the above c.Jobs command.  
```Matlab
>> % Fetch results for job with ID 2
>> j2.fetchOutputs{:}
```

### PARALLEL BATCH JOB    
Users can also submit parallel workflows with the batch command.  Let’s use the following example for a parallel job 'parallel_example.m'.   
 
```Matlab
function t = parallel_example(iter)
if nargin==0, iter = 16; end
disp('Start sim')

t0 = tic;
parfor idx = 1:iter
    A(idx) = idx;
    pause(2)
end
t = toc(t0);

disp('Sim completed.')
```    

This time when we use the batch command, in order to run a parallel job, we’ll also specify a MATLAB Pool.    
```Matlab
>> % Get a handle to the cluster
>> c = parcluster;

>> % Submit a batch pool job using 4 workers for 16 simulations
>> j = c.batch(@parallel_example, 1, {}, 'Pool',4);

>> % View current job status
>> j.State

>> % Fetch the results after a finished state is retrieved
>> j.fetchOutputs{:}
ans = 
	8.8872
```

The job ran in 8.89 seconds using four workers.  Note that these jobs will always request N+1 CPU cores, since one worker is required to manage the batch job and pool of workers.   For example, a job that needs eight workers will consume nine CPU cores.  	
We’ll run the same simulation but increase the Pool size.  This time, to retrieve the results later, we’ll keep track of the job ID.
NOTE: For some applications, there will be a diminishing return when allocating too many workers, as the overhead may exceed computation time.    
```Matlab
>> % Get a handle to the cluster
>> c = parcluster;

>> % Submit a batch pool job using 8 workers for 16 simulations
>> j = c.batch(@parallel_example, 1, {}, 'Pool', 8);

>> % Get the job ID
>> id = j.ID
id =
	4
>> % Clear j from workspace (as though we quit MATLAB)
>> clear j
```

Once we have a handle to the cluster, we’ll call the findJob method to search for the job with the specified job ID.   
```Matlab
>> % Get a handle to the cluster
>> c = parcluster;

>> % Find the old job
>> j = c.findJob('ID', 4);

>> % Retrieve the state of the job
>> j.State
ans
finished
>> % Fetch the results
>> j.fetchOutputs{:};
ans = 
4.7270
```

The job now runs in 4.73 seconds using eight workers.  Run code with different number of workers to determine the ideal number to use.
Alternatively, to retrieve job results via a graphical user interface, use the Job Monitor (Parallel > Monitor Jobs).
 


### DEBUGGING    
If a serial job produces an error, call the getDebugLog method to view the error log file.  When submitting independent jobs, with multiple tasks, specify the task number.  
```Matlab
>> c.getDebugLog(j.Tasks(3))
```

For Pool jobs, only specify the job object.
```Matlab
>> c.getDebugLog(j)
```

When troubleshooting a job, the cluster admin may request the scheduler ID of the job.  This can be derived by calling schedID
```Matlab
>> schedID(j)
ans
25539
```
+0 −237
Original line number Diff line number Diff line
+++
title = "Running OLAM at HCC"
description = "How to run the OLAM (Ocean Land Atmosphere Model) on HCC resources."
+++

### OLAM compilation
##### pgi/11 compilation with mpi and openmp enabled

1.  Load modules:
    {{< highlight bash >}}
    module load compiler/pgi/11 openmpi/1.6 szip/2.1 zlib/1.2 NCL/6.1dist
    {{< /highlight >}}
2.  Edit the `include.mk` file.

{{% panel theme="info" header="include.mk" %}}
{{< highlight batch >}}
#-----------------  LINUX Intel Fortran ifort/gcc ---------------
F_COMP=mpif90
# If the compiler supports (and the user wants to use)
# the module IEEE_ARITHMETIC, uncomment below
IEEE_ARITHMETIC=yes
# If using MPI libraries:
OLAM_MPI=yes
# If parallel hdf5 is supported, uncomment the next line
OLAM_PARALLEL_HDF5=yes
# If you use the ED2 model, uncomment the next line
#USE_ED2=yes
MPI_PATH=/util/opt/openmpi/1.6/pgi/11
PAR_INCS=-I$(MPI_PATH)/include:$(MPI_PATH)/lib
PAR_LIBS=-L$(MPI_PATH)/lib -lmpi
# OPTIMIZED:
F_OPTS=-O3 -traceback -mp
#F_OPTS=-xHost -O3 -fno-alias -ip -openmp -traceback
#F_OPTS=-g -O3 -xHost -traceback
# DEBUG:
#F_OPTS=-g -fp-model precise -check bounds -traceback \
#        -debug extended -check uninit -ftrapuv
# FORTRAN FLAGS FOR BIG FILES WHICH WOULD HAVE EXCESSIVE COMPILATION TIME
#SLOW_FFLAGS=-O1 -g -no-ip -traceback
C_COMP=mpicc
#C_COMP=mpicc
C_OPTS=-DUNDERSCORE -DLITTLE
NCARG_DIR=/util/src/ncl_ncarg/ncl_ncarg-6.1.2/lib
LIBNCARG=-L$(NCARG_DIR) -lncarg -lncarg_gks -lncarg_c \
          -L/usr/lib64 -lX11 -ldl -lpthread -lgfortran -lcairo
HDF5_LIBS=-L/util/opt/hdf5/1.8.13/openmpi/1.6/pgi/11/lib -lhdf5_fortran -lhdf5 -lz -lm
HDF5_INCS=-I/util/opt/hdf5/1.8.13/openmpi/1.6/pgi/11/include
NETCDF_LIBS=-L/util/opt/netcdf/4.2/pgi/11/lib -lnetcdf
NETCDF_INCS=-I/util/opt/netcdf/4.2/pgi/11/include

LOADER=$(F_COMP)
LOADER_OPTS=-mp
#LOADER_OPTS=-static-intel $(F_OPTS)
# For Apple OSX: the stack size needs to be increased at link time
# LOADER_OPTS=-static-intel $(F_OPTS) -Wl,-stack_size -Wl,0x10000000
# to allow ifort compiler to link with pg-compiled ncar graphics:
# LIBS=-z muldefs -L/opt/pgi/linux86-64/5.2/lib -lpgftnrtl -lpgc
## IMPORTANT:  Need to specify this flag in ED2
#USE_HDF5=1
{{< /highlight >}}
{{% /panel %}}

3. Command: `make clean`

4. Command: `make -j 8`

##### intel/12 compilation with mpi and openmp enabled

1.  Load modules:
   {{< highlight bash >}}
    module load compiler/intel/12 openmpi/1.6 szip/2.1 zlib/1.2
    {{< /highlight >}}
2.  Edit the `include.mk` file.
{{% panel theme="info" header="include.mk" %}}
{{< highlight batch >}}
#-----------------  LINUX Intel Fortran ifort/gcc ---------------
F_COMP=mpif90
# If the compiler supports (and the user wants to use)
# the module IEEE_ARITHMETIC, uncomment below
IEEE_ARITHMETIC=yes
# If using MPI libraries:
OLAM_MPI=yes
# If parallel hdf5 is supported, uncomment the next line
OLAM_PARALLEL_HDF5=yes
# If you use the ED2 model, uncomment the next line
#USE_ED2=yes
MPI_PATH=/util/opt/openmpi/1.6/intel/12
PAR_INCS=-I$(MPI_PATH)/include:$(MPI_PATH)/lib
PAR_LIBS=-L$(MPI_PATH)/lib -lmpi
# OPTIMIZED:
F_OPTS=-O3 -traceback -openmp
#F_OPTS=-xHost -O3 -fno-alias -ip -openmp -traceback
#F_OPTS=-g -O3 -xHost -traceback
# DEBUG:
#F_OPTS=-g -fp-model precise -check bounds -traceback \
#        -debug extended -check uninit -ftrapuv
# FORTRAN FLAGS FOR BIG FILES WHICH WOULD HAVE EXCESSIVE COMPILATION TIME
#SLOW_FFLAGS=-O1 -g -no-ip -traceback
C_COMP=mpicc
#C_COMP=mpicc
C_OPTS=-DUNDERSCORE -DLITTLE
NCARG_DIR=/util/src/ncl_ncarg/ncl_ncarg-6.1.2/lib
LIBNCARG=-L$(NCARG_DIR) -lncarg -lncarg_gks -lncarg_c \
          -L/usr/lib64 -lX11 -ldl -lpthread -lgfortran -lcairo
HDF5_LIBS=-L/util/opt/hdf5/1.8.13/openmpi/1.6/intel/12/lib -lhdf5_fortran -lhdf5 -lz -lm
HDF5_INCS=-I/util/opt/hdf5/1.8.13/openmpi/1.6/intel/12/include
NETCDF_LIBS=-L/util/opt/netcdf/4.2/intel/12/lib -lnetcdf
NETCDF_INCS=-I/util/opt/netcdf/4.2/intel/12/include
LOADER=$(F_COMP)
LOADER_OPTS=-openmp
#LOADER_OPTS=-static-intel $(F_OPTS)
# For Apple OSX: the stack size needs to be increased at link time
# LOADER_OPTS=-static-intel $(F_OPTS) -Wl,-stack_size -Wl,0x10000000
# to allow ifort compiler to link with pg-compiled ncar graphics:
# LIBS=-z muldefs -L/opt/pgi/linux86-64/5.2/lib -lpgftnrtl -lpgc
## IMPORTANT:  Need to specify this flag in ED2
#USE_HDF5=1
{{< /highlight >}}
{{% /panel %}}

3. Command: `make clean`

4. Command: `make -j 8`

 

### OLAM compilation on Crane
##### Intel/15 compiler with OpenMPI/1.10

1.  Load modules:
    {{< highlight bash >}}
    module load compiler/intel/15 openmpi/1.10 NCL/6.1 netcdf/4.4 phdf5/1.8 szip/2.1 zlib/1.2
    {{< /highlight >}}
2.  Edit the `include.mk` file:
{{% panel theme="info" header="include.mk" %}}
{{< highlight batch >}}
#-----------------  LINUX Intel Fortran ifort/gcc ---------------
F_COMP=/util/opt/hdf5/1.8/openmpi/1.10/intel/15/bin/h5pfc

# If the compiler supports (and the user wants to use)
# the module IEEE_ARITHMETIC, uncomment below
IEEE_ARITHMETIC=yes

# If using MPI libraries:
OLAM_MPI=yes

# If parallel hdf5 is supported, uncomment the next line
OLAM_PARALLEL_HDF5=yes

# If you use the ED2 model, uncomment the next line
#USE_ED2=yes

#MPI_PATH=/usr/local/mpich
PAR_INCS=-I/util/opt/openmpi/1.10/intel/15/include
PAR_LIBS=-L/util/opt/openmpi/1.10/intel/15/lib

# OPTIMIZED:
F_OPTS=-xHost -O3 -fno-alias -ip -openmp -traceback
#F_OPTS=-g -O3 -xHost -traceback

# DEBUG:
#F_OPTS=-g -fp-model precise -check bounds -traceback \
#        -debug extended -check uninit -ftrapuv

# EXTRA OPTIONS FOR FIXED-SOURCE CODE
FIXED_SRC_FLAGS=-fixed -132

# FORTRAN FLAGS FOR BIG FILES WHICH WOULD HAVE EXCESSIVE COMPILATION TIME
SLOW_FFLAGS=-O1 -g -no-ip -traceback

#C_COMP=icc
C_COMP=mpicc
C_OPTS=-O3 -DUNDERSCORE -DLITTLE

NCARG_DIR=/util/opt/NCL/6.1/lib
LIBNCARG=-L$(NCARG_DIR) -lncarg -lncarg_gks -lncarg_c \
-L/usr/lib64 -lX11 -ldl -lpng -lpthread -lgfortran -lcairo

HDF5_LIBS=-L/util/opt/hdf5/1.8/openmpi/1.10/intel/15/lib
HDF5_INCS=-I/util/opt/hdf5/1.8/openmpi/1.10/intel/15/include

NETCDF_LIBS=-L/util/opt/netcdf/4.4/intel/15/lib -lnetcdf
NETCDF_INCS=-I/util/opt/netcdf/4.4/intel/15/include

LOADER=$(F_COMP)
LOADER_OPTS=-static-intel $(F_OPTS)

# For Apple OSX: the stack size needs to be increased at link time
# LOADER_OPTS=-static-intel $(F_OPTS) -Wl,-stack_size -Wl,0x10000000

# to allow ifort compiler to link with pg-compiled ncar graphics:
# LIBS=-z muldefs -L/opt/pgi/linux86-64/5.2/lib -lpgftnrtl -lpgc

## IMPORTANT:  Need to specify this flag in ED2
USE_HDF5=1
{{< /highlight >}}
{{% /panel %}}

3.  Command: `make clean`
4.  Command: `make -j 8`

 

### Sample SLURM submit scripts
##### PGI compiler:

{{% panel theme="info" header="Sample submit script for PGI compiler" %}}
{{< highlight batch >}}
#!/bin/sh
#SBATCH --ntasks=8                                          # 8 cores
#SBATCH --mem-per-cpu=1024                                  # Minimum memory required per CPU (in megabytes)
#SBATCH --time=03:15:00                                     # Run time in hh:mm:ss
#SBATCH --error=/work/[groupname]/[username]/job.%J.err
#SBATCH --output=/work/[groupname]/[username]/job.%J.out
 
module load compiler/pgi/11 openmpi/1.6 szip/2.1 zlib/1.2
 
mpirun /path/to/olam-4.2c-mpi
{{< /highlight >}}
{{% /panel %}}

##### Intel compiler:

{{% panel theme="info" header="Sample submit script for Intel compiler" %}}
{{< highlight batch >}}
#!/bin/sh
#SBATCH --ntasks=8                                          # 8 cores
#SBATCH --mem-per-cpu=1024                                  # Minimum memory required per CPU (in megabytes)
#SBATCH --time=03:15:00                                     # Run time in hh:mm:ss
#SBATCH --error=/work/[groupname]/[username]/job.%J.err
#SBATCH --output=/work/[groupname]/[username]/job.%J.out
 
module load compiler/intel/12 openmpi/1.6 szip/2.1 zlib/1.2
 
mpirun /path/to/olam-4.2c-mpi
{{< /highlight >}}
{{% /panel %}}
+0 −89
Original line number Diff line number Diff line
+++
title = "Running Theano"
description = "How to run the Theano on HCC resources."
+++

Theano is available on HCC resources via the modules system. Both CPU and GPU
versions are available on Crane.  Additionally, installs for both Python
2.7 and 3.6 are provided.

### Initial Setup

Theano attempts to write to a `~/.theano` directory in some
circumstances, which can cause errors as the `/home` filesystem is
read-only on HCC machines.  As a workaround, create the directory on
`/work` and make a symlink from `/home`:

{{% panel theme="info" header="Create & symlink .theano directory" %}}
{{< highlight bash >}}
mkdir -p $WORK/.theano
ln -s $WORK/.theano $HOME/.theano
{{< /highlight >}}
{{% /panel %}}

This only needs to be done once on each HCC machine.

### Running the CPU version

To use the CPU version, simply load the module and run your Python code.
 You can choose between the Python 2.7, 3.5 or 3.6 environments:

{{% panel theme="info" header="Python 2.7 version" %}}
{{< highlight bash >}}
module load theano/py27/1.0
python my_python2_script.py
{{< /highlight >}}
{{% /panel %}}

or

{{% panel theme="info" header="Python 3.5 version" %}}
{{< highlight bash >}}
module load theano/py35/1.0
python my_python3_script.py
{{< /highlight >}}
{{% /panel %}}

or

{{% panel theme="info" header="Python 3.6 version" %}}
{{< highlight bash >}}
module load theano/py36/1.0
python my_python3_script.py
{{< /highlight >}}
{{% /panel %}}

### Running the GPU version

To use the GPU version, first create a `~/.theanorc` file with the
following contents (or append to an existing file as needed):

{{% panel theme="info" header="~/.theanorc" %}}
{{< highlight batch >}}
[global]
device = cuda
{{< /highlight >}}
{{% /panel %}}

Next, load the theano module:

{{% panel theme="info" header="Load the theano module" %}}
{{< highlight bash >}}
module load theano/py27/0.9
{{< /highlight >}}
{{% /panel %}}

To test the GPU support, start an interactive job on a GPU node and
import the theano module within the Python interpreter.  You should see
output similar to the following:

{{% panel theme="info" header="GPU support test" %}}
{{< highlight