Fenn

Fenn

 

 

 

POLICIES AND PROCEDURES

  • Fenn users must comply with the VCU Information Security Policy and any associated standards and guidelines, and agree to not share your login credentials with others.

  • Fenn is approved for housing "Category I" confidential and sensitive data, with these exceptions:

    • Storage of data originating from VCUHS is prohibited without specific approval from that entity.

    • Payment Card Industry Data (PCI Data), such as credit/debit card numbers, is prohibited.

  • All data should be scrubbed to the fullest extent possible before placing it on fenn.  Remove any sensitive information or fields that are not needed in your analyses on fenn or replace such with a mapped random value (and keep the mapping algorithm off of fenn).

  • It is the user's responsibility to:

  • Fenn users must notify the VCU IT Support Center (itsc@vcu.edu, 828-2227) if and when their account is no longer needed.

  • To conserve storage space, Fenn users are expected to remove data from fenn when it is no longer needed there.

THE FENN ENVIRONMENT  

Fenn is a cluster of computers, or more properly, a cluster of computer 'nodes'.  

There is one 'head' node, and there are several 'work' nodes.  The nodes are named 'fennNN' (eg, 'fenn04' or 'fenn12').  To display a list of all the nodes, you can issue this command:  

qconf -sh

When you login to Fenn, your session is running on the head node.  Since the head node is used by everyone, you should not issue any direct commands in your session that will perform any significant processing on that node (eg, running a SAS program).  

Instead, to perform processing you submit a 'job', as described below, and the system will farm out your job to be run on one (or more) of the work nodes.  

SUBMITTING JOBS  

As just noted, when you need to perform any processing, you submit a 'job', and your job will be run on one or more work nodes.  When you submit the job, you can request the number of nodes to be used, the amount of memory required for the job, etc.  How to request such resources is discussed below.  Note that asking for significant resources could increase the wait time before your job begins execution.  

To submit a job, you use the 'qsub' command.  Its basic syntax is: 

qsub  OPTIONS  PROGRAMFILE  ARGUMENTS

where PROGRAMFILE can be a shell script or a binary executable file.  

If desired, you can specify various OPTIONS to affect how the job will be run, such as requesting additional resources for the job.  

You can also specify ARGUMENTS, such as a list of files to be processed by the program file.  

In the simple example below, we are submitting a job to run the script file 'MyScript.sh', without any options or arguments: 

qsub MyScript.sh

It is assumed that 'MyScript.sh' is in your current directory.

As another simple example, to have SAS process one of your SAS programs, you could issue, for example:

qsub /usr/global/SAS/SAS94-M6-20w17/SASFoundation/9.4/sas  MyProg.sas

Since the 'sas' command is not in your current directory, you must provide its path.

When you issue a 'qsub' command, such as:

qsub MyScript.sh

your job is submitted to run on a work node.  A job-ID number is assigned to the job and reported on your screen, as follows (for example):

Your job 25221 ("MyScript.sh") has been submitted

You then immediately receive another command prompt, so you can perform other tasks, or even logout, while your job is running.

To check the status of a submitted job, you can issue the 'qstat' command:

qstat

which, by default, reports information about all waiting or running jobs in the system that belong to you.  The information reported will look like this:

job-ID  prior   name           user    state submit/start at     queue
----------------------------------------------------------------------
25221 0.00000 MyScript.sh    jdoe    qw    04/23/2020 16:14:00      

In the above report, the 'qw' state means that the job is waiting in the queue to be run.  When the job eventually begins running, its state will be reported as 'r' and the work node to which it is assigned will be displayed below 'queue'.  When the job completes execution, 'qstat' will report nothing.  

For each submitted job, the system creates an error file and an output file, which will receive any error messages and output created by the job.  The names of these files are constructed as follows: 

error filename:  <jobname>.e<job-ID>
output filename:  <jobname>.o<job-ID>

(note the '.e' and '.o').  Thus, for the above submitted job, the error and output files would be named, respectively:

MyScript.sh.e25221
MyScript.sh.o25221

WORKING DIRECTORY  

By default, those '.e' and '.o' error and output files are created in your HOME directory.  Also, within your program (eg, 'MyScript.sh' in the above example), if you create or access any files that are not specified with a pathname, those files are assumed to be in your home directory.  In other words, the 'working directory' for the job is assumed, by default, to be your home directory.  If desired, you can specify a different working directory by using an option, as discussed below.

Note that if you submit a job to run a SAS program, the usual SAS log file (and perhaps listing file) will be created, in addition to the '.e' and '.o' files.  They will be created in the job's working directory.

JOB OPTIONS  

As noted above, when you submit a job using the 'qsub' command, you can specify various options to affect how your job will be run.  This section will introduce some of the available options. 

PLEASE NOTE:  For simplicity, in this section these options will be explained, one at a time, using a 'qsub' command.  

HOWEVER, in 'real life', when you submit a job to run, you will probably want to specify SEVERAL such options.  And, you will probably want to use those SAME options for many of your jobs. Therefore, for convenience (and to prevent typos), it is customary to instead create a special option file, known as a 'wrapper script', that contains all the options that you want to specify, and then to point your 'qsub' command to that file.  How to create and use a wrapper script is discussed in the WRAPPER SCRIPTS section below.  

Also, you will likely obtain wrapper scripts from other users or sources, for submitting certain types of jobs (eg, for running SAS programs).  Those wrapper scripts usually come with any required options already included in the script.  

So, as you learn about options in this section, keep in mind that, although they are explained here by specifying them directly on a 'qsub' command, you will probably instead want to specify them within a wrapper script file. 

The following options for the 'qsub' command are described in this section (there are additional options available):

Description:

Option:

Description:

Option:

Change working directory of job

-wd <foldername>

Use your current working directory

-cwd

Change job name

-N <name>

Receive an email when job completes or changes status

-M <email_address>
-m <email_options>

Change locations of the error and output files

-e <foldername>
-o <foldername>

Specify shell

-S <shell>

Submit a binary program

-b y

Request memory

-l mem_free=nG

Limit memory usage

-l h_vmem=nG

Submit an SMP job

-pe smp N

Option:  -wd  <foldername>

As noted above, by default the working directory for a job is your home directory.  To change the working directory of the job to some other folder, you can use the '-wd' option, for example:

qsub -wd /home/jdoe/myfolder MyScript.sh

You must provide the FULL pathname of the folder (it must begin with a '/' slash).

Option:  -cwd

In many situations, you want the job's working directory to simply be the directory that you are currently in (i.e., your 'current working directory').  To request that, you can use just the '-cwd' option, for example:

qsub -cwd MyScript.sh

Option:  -N  <name>

This changes the name of the job.  For example, if you issue this:

qsub -N Testjob MyScript.sh

to name your job 'Testjob', you would then see the following displayed (for example):

Your job 25221 ("Testjob") has been submitted

instead of:

Your job 25221 ("MyScript.sh") has been submitted

And, the report from the 'qstat' command would also refer to the job as 'Testjob'.

Option:  -M  <email_address>

               -m  followed by one or more of 'b,e,a,s,n'

An email will be sent to email_address when your job changes status:

b - Email is sent when the job begins.
e - Email is sent when the job ends.
a - Email is sent when the job is aborted or rescheduled.
s - Email is sent when the job is suspended.
n - No email is sent.

In the following example, mail will be sent to 'jdoe@vcu.edu' when the job begins (b) and ends (e):

qsub  -M jdoe@vcu.edu  -m be  MyScript.sh  

Option:  -e  <foldername>
              -o  <foldername>

You can use the '-e' and '-o' options to change the location of the error and output files that are automatically created, for example:

qsub  -e './x'  -o './x'  MyScript.sh

In the above command, the '-e' and '-o' options request that the error and output files be placed in the subfolder named 'x' of the job's working directory.  The '.' dot in the './x' refers to the job's working directory.

Option:  -S  <shell>

This option specifies the Unix shell under which the job will run.  If you omit this option, the default shell will be used.

You should ALWAYS specify this option to ensure the shell that is used.

If you don't know what this means or which shell to specify, then specify '-S /bin/bash':

qsub -S /bin/bash MyScript.sh

Option:  -b  y

You must specify this if the program being submitted is a binary file (instead of a script file).  For example:

qsub -b y ABinaryProgram

You can also specify '-b n' if the program is NOT a binary file, but that is the default.

(Note that the program that launches SAS is NOT a binary file.)

Option:  -l  mem_free=nG

This requests that your job only be run on a node with 'n' gigabytes of minimum memory free.  For example:

qsub -l mem_free=33G  MyScript.sh

PLEASE!! only reserve what you need.  Reserved memory cannot be used by others, and there is a limited supply.

Option:  -l  h_vmem=nG

This requests that your job be killed if its memory usage exceeds 'n' gigabytes, for example:

qsub -l h_vmem=50G  MyScript.sh

Option:  -pe  smp  N

Use this to submit an SMP (Shared Memory Parallelism) job which needs N slots, for example:

qsub -pe smp 4  MyScript.sh

DELETING A JOB

Use the 'qdel' command to delete a job that you have submitted and that is running or waiting to run.  It's syntax is:

qdel <job-ID>

Example:

qdel 25221

Recall that the job-ID is reported when you submit a job, and it is reported by the 'qstat' command.

QSUB WRAPPER SCRIPTS

As a convenience, you can create a script file, known as a wrapper script, that contains the various options and commands to be used for submitting a particular job.  This is especially useful for jobs that you submit often.

For example, each time you submit the 'MyScript.sh' program, suppose you would normally include these five options :

qsub -S /bin/bash -cwd -e './x' -o './x' -N Testjob MyScript.sh

Instead of typing that long command each time to submit the job, you could instead create a file named, for example, 'MyWrapper', that contains the following lines:

#!/usr/bin/env bash
#$ -S /bin/bash
#$ -cwd
#$ -e ./x
#$ -o ./x
#$ -N Testjob
./MyScript.sh

and then simply issue the following command to submit the job:

qsub MyWrapper

In the above wrapper script lines, the first line is a special line needed by the script file.  The next five lines contain your desired 'qsub' options. The '#$' at the start of those lines is required, and that '#$' must be typed at the very beginning of the line (i.e., not indented).  

The final line contains the program file to be run.  The path to the program file must be included.  It can be a relative path, as shown above, or a full path (begins with a slash, such as /home/jdoe/MyScript.sh).  Note that the initial dot  '.'  in './MsScript.sh' represents your current directory, and thus 'qsub' would look in your current directory for the 'MyScript.sh' file.

Note that, if desired, wrapper script can include more than one program to execute, each typed on a separate line.

To make the wrapper script more readable, you can include blank lines.  You can also include comment text, perhaps as a reminder to yourself or others of what you are doing in the script.  Comment text is ignored by the system when the job is submitted.  Comment text must begin with a '#' (but not with '#$' or '#!').  

Here is the same script file with some blank lines and comment text added: 

#!/usr/bin/env bash

# Set the shell:
#$ -S /bin/bash

# Use the current directory:
#$ -cwd

# Place the error and output files:
#$ -e ./x
#$ -o ./x

# Rename the job:
#$ -N Testjob

# The program to be submitted:
./MyScript.sh

If the program that will be executed (eg, 'MyScript.sh') requires any options or arguments, such as the names of files that it will process, you must accommodate those within the script.

For example, if 'MyScript.sh' expects there to be 3 filenames as arguments, then you must append those filenames on the final line of the script:

./MyScript.sh  falldata springdata summerdata

Or, for more flexibility, instead of typing actual filenames, you could type '$n' placeholders after the program name.  In our example, since there are 3 files to accommodate, you would add '$1 $2 $3' after the program name, as placeholders for those filenames:

./MyScript.sh $1 $2 $3

Then, when you SUBMIT the wrapper, you would type the actual filenames, surrounded by quotes:

qsub MyWrapper "falldata springdata summerdata"

With this method, should you need to use 3 different filenames in the future, you would not need to update the wrapper script, because it uses the generic '$n' placeholders.

SCRIPT VARIABLES

You might obtain 'sample' wrapper scripts, written by others, for running particular types of programs (SAS programs, etc.).  Such scripts usually include the use of script 'variables'.  

To help explain how script variables work, below is a simple script: 

#!/usr/bin/env bash
#$ -S /bin/bash
#$ -cwd
#$ -e ./x
#$ -o ./x
#$ -N Testjob
./MyScript.sh falldata springdata summerdata

and here it is re-written to use a variable named (arbitrarily) 'PROGRAM':

#!/usr/bin/env bash
#$ -S /bin/bash
#$ -cwd
#$ -e ./x
#$ -o ./x
#$ -N Testjob
PROGRAM=./MyScript.sh
$PROGRAM falldata springdata summerdata

The line:

PROGRAM=./MyScript.sh

assigns a value to the PROGRAM variable.  In this case, the value assigned is the path of the file (./MyScript.sh).

And, the final line of the script:

$PROGRAM falldata springdata summerdata

contains the variable name PROGRAM preceded by a dollar sign.  When the job is submitted, that '$PROGRAM' will be interpreted as the VALUE of the PROGRAM variable.  Thus, that line will be interpreted by 'qsub' as:

./MyScript.sh falldata springdata summerdata

You can use multiple variables in a wrapper script, and you can name them as desired, so long as the name begins with an alphanumeric character or underscore, and is followed (only) by alphanumeric or underscore characters.  

WRAPPER FOR SAS

A simple wrapper script that is suitable for submitting SAS jobs is available to all Fenn users here: 

/usr/global/SASwrapper.sh

To make a copy of this 'SASwrapper.sh' script in your own current directory, issue this command (note the dot '.' at the very end):

cp /usr/global/SASwrapper.sh .

To use it for running one of your SAS programs, you would issue, for example:

qsub  SASwrapper.sh  "mysasprog.sas"

The script sets a few basic 'qsub' options, such as '-cwd'.  Read the comment text within the script for additional usage info.

ANOTHER WRAPPER

To see a more 'complicated' wrapper script, a sample wrapper script named 'qsub_test' is available to all Fenn users here:

/usr/global/qsub_test.sh

You can make a copy of it in your own current directory by issuing this command:

cp /usr/global/qsub_test.sh .

Then you can submit your copy of the script to run by issuing:

qsub  qsub_test.sh

Afterward, you can look at the '.o' output file that the job produced to see the information that it placed there.  Note that this script uses the '-cwd' option, so that '.o' file should be created in your current directory.  Also, it uses the option '-N environment', to that '.o' output file will be named, for example, 'environment.o12345'.  

REMOTE SHELL  

When you login to Fenn, your session is running on the 'head' node.  Since the head node is used by everyone, you should not issue any direct commands in your session that will perform any significant processing on that node.  Instead, you normally use 'qsub', so that any processing will be performed on one of the Fenn 'work' nodes.  

However, as an alternative, you can issue the 'qrsh' command to open a new shell session running on a WORK node: 

qrsh

You will receive a new command prompt (the name of the work node that you are now on, eg 'fenn14', will be displayed in the prompt)

At THIS command prompt, you CAN issue direct commands to perform processing, since this session is running on a work node.  You can also launch an interactive program, such as R.

When you are finished with this session on the work node, press 'Ctrl-d' to exit back to your original session on the head node.  

Note that most, if not all, of the 'qsub' options should work with 'qrsh'.  So, if you wanted a shell session with 12 smp cores, you could issue: 

qrsh -pe smp 12

Or, if your wanted to get on a node with 33GB of ram free:

qrsh -l mem_free=33G

SEQUENTIAL JOBS

You can use the '-hold_jid' option to prevent a job from running until a previous job has completed.  For example, suppose you issue the following to submit a long running job:

qsub MyScript.sh

and your receive the following:

Your job 25221 ("MyScript.sh") has been submitted

You could now issue this:

qsub -hold_jid 25221 Script2.sh

and this second job would not start until the first job had completed.

With this 'hold_jid' option, you can also use the previous job's job name, instead of its job-ID.  For example:

qsub -hold_jid MyScript.sh Script2.sh

ARRAY JOBS

You can use task arrays to analyze multiple, independent datasets in parallel.  For examples, see:

Here is a simple example of using task arrays to process a set of SAS programs.  Suppose you need to sort these three large datasets, so they can be merged later:

falldata
springdata
summerdata

Because they are large, you would ideally want to sort them concurrently on three separate nodes.

To accomplish this, you could create three SAS program files named, for example:

sort1.sas   (to sort falldata)
sort2.sas   (to sort springdata)
sort3.sas   (to sort summerdata)

To submit these three programs, create a SINGLE wrapper script named, say, 'sort.sh'.  And in that script, specify the program to be run as:

/usr/global/SAS/cmd/sas   sort${SGE_TASK_ID}.sas

(Note the special '$SGE_TASK_ID' variable has been typed directly after the word 'sort'.  This is explained below.)

Then, when you submit the script, include the '-t' task array option, as follows:

qsub  -t  1-3   sort.sh

Because of the '-t 1-3' option, 'qsub' will actually SUBMIT the script THREE times.  And for each submission, 'qsub' will replace the variable ${SGE_TASK_ID} in the script with the value 1, 2, or 3.  Thus, that single 'qsub' command will process your three SAS programs:

sort1.sas
sort2.sas
sort3.sas

AND, the three programs will probably run concurrently, on three separate nodes (we say 'probably' because the system most likely will submit them to run on separate nodes, but there's no guarantee).

NOTE:  When you launch your script that will merge the three sorted files (not discussed here), you could use the '-hold_jid' option (see SEQUENTIAL JOBS above), so that the merge script would not begin until the above sorting script ended.