Commit b164ee24 authored by Mohammed Tanash's avatar Mohammed Tanash
Browse files

Add Examples repo to the website

parent 140be4d5
#!/bin/bash
# short.sh: a short discovery job
printf "Start time: "; /bin/date
printf "Job is running on node: "; /bin/hostname
printf "Job running as user: "; /usr/bin/id
printf "Job is running in directory: "; /bin/pwd
echo
echo "Working hard..."
sleep 20
echo "Science complete!"
#!/bin/bash
# short.sh: a short discovery job
printf "Start time: "; /bin/date
printf "Job is running on node: "; /bin/hostname
printf "Job running as user: "; /usr/bin/id
printf "Job is running in directory: "; /bin/pwd
printf "The command line argument is: "; echo $1
printf "Contents of $1 is "; cat $1
cat $1 > output.txt
printf "Working hard..."
ls -l $PWD
sleep 20
echo "Science complete!"
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --mem=4048
#SBATCH --time=00:10:00
#SBATCH --job-name=R_normalize
#SBATCH --error=R_normalize.%J.err
#SBATCH --output=R_normalize.%J.out
module load R
Rscript normalize.R
# read in the biom file
otu_matrix <- as.matrix(read.table("otu_table.csv.gz"))
# replace any missing values with 0.1
otu_matrix[is.na(otu_matrix)] <- 0.1
# normalize the matrix
otu_matrix <- scale(otu_matrix)
# convert all values to the absolute value
otu_matrix <- apply(otu_matrix, c(1,2), abs)
# transform values using Log2
otu_matrix <- apply(otu_matrix, c(1,2), log2)
# write the normalized matrix to normalized_otu_matrix.csv
write.table(otu_matrix,
"normalized_otu_matrix.csv",
sep=",",
row.names=TRUE,
col.names=TRUE)
+++
title = "R Example"
weight = "100"
+++
R Example
--------------------------------------
{{< readfile file="content/submitting_jobs/app_specific/job-examples/R/README.md" markdown="true" >}}
{{%attachments title="Related files" style="orange" /%}}
{{% children %}}
# Submit an R job on HCC
This script will read in an Operational Taxonomical Unit (OTU) Table (`otu_table.csv`) of microbial abundance counts and normalize them by cleaning out any missing entries, replacing zero-values with nomalinal values and then scaling all values. The normalized table is then written in a new file `normalized_otu_matrix.csv`.
To submit this job, use the command `sbatch R_single.submit`.
# LARGE data example - using airline.csv
# load libraries
if(!require(dplyr)) install.packages("dplyr")
if(!require(ggplot2)) install.packages("ggplot2")
if(!require(maps)) install.packages("maps")
# Load airline.csv data
flights <- read.csv("./data/airline_subsample.csv",
sep=",",
header=TRUE,
stringsAsFactors=FALSE)
# Function to estimate birthmonth of aircraft by finding the month and year of first flight
birthmonth <- function(y){
minYear <- min(y[,'Year'], na.rm=TRUE)
these <- which(y[,'Year']==minYear)
minMonth <- min(y[these, 'Month'], na.rm=TRUE)
return(12 * minYear + minMonth - 1)
}
# Remove flights with no data for ArrDelay recorded
flights <- flights[!is.na(flights$ArrDelay),]
# Create vectors for each aircraft (aircrafts) and store their birthmonth (acStart)
aircrafts <- unique(flights[,'TailNum'])
aircrafts <- aircrafts[!is.na(aircrafts)]
acStart <- rep(0, length(aircrafts))
names(acStart) <- aircrafts
for (i in aircrafts) {
acStart[i] <- birthmonth(flights[flights$TailNum==i,])
}
# Calculate flight age using the birthmonth
age <- data.frame(names(acStart), acStart, stringsAsFactors = FALSE)
colnames(age) <- c("TailNum", "acStart")
flights <- left_join(flights, age, by="TailNum")
flights <- mutate(flights, Age = (flights$Year * 12) + flights$Month - flights$acStart)
# Generate linear model for response: ArrDelay and predictors: Age and Year
lm <- lm(ArrDelay ~ Age + Year, data=flights)
summary(lm)
# Convert Months from number to factor
flights$Month <- factor(flights$Month)
levels(flights$Month) <- month.abb
# Select a subset of fields needed to graph arrival delays by month
subset_month <- select(flights, Month, ArrDelay)
# Create violin graph showing arrival delays by month
ggplot(subset_month, aes(Month,ArrDelay, fill=factor(Month))) +
geom_violin(aes(group=Month)) +
theme(legend.position="none") +
labs(y = "Arrival Delay (in minutes)") +
labs(title = "Average Flight Arrival Delay by Month")
ggsave("ave_delay_by_month.jpg", width=9, height=6)
# Load state list for airport codes and join departure state to flights dataframe
airport_codes <- read.csv("airport_codes.csv",
col.names=c("OriginState", "Origin"),
stringsAsFactors = FALSE)
flights <- left_join(flights, airport_codes, by="Origin")
# Create subset of data containing origin state and arrival delay
subset_state <- select(flights, OriginState, ArrDelay)
subset_state <- subset_state[!is.na(subset_state$ArrDelay),]
subset_state <- group_by(subset_state, OriginState)
subset_summary <- summarise(subset_state, AveDelay=mean(ArrDelay))
# Create graphic of US States colored by average delay time
map = map_data("state")
ggplot(subset_summary, aes(fill=AveDelay)) +
geom_map(aes(map_id=OriginState), map=map) +
scale_fill_distiller(name = "Average Delay (mins)", palette = "Spectral", direction=-1) +
expand_limits(x=map$long, y=map$lat) +
theme_void() +
labs(title = "Average Flight Arrival Delay by State")
ggsave("ave_delay_by_state.jpg", width=9, height=5)
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --mem=16gb
#SBATCH --time=10:00:00
#SBATCH --job-name=R_analysis
#SBATCH --error=R_analysis.%J.err
#SBATCH --output=R_analysis.%J.out
module load R
Rscript R_analysis.R
State,Code alaska,ADK alaska,AUK alaska,AFM alaska,AKP alaska,ANC alaska,MRI alaska,LHD alaska,AGN alaska,ANI alaska,ATK alaska,BRW alaska,BET alaska,BVK alaska,CFK alaska,VAK alaska,CDB alaska,CDV alaska,CGA alaska,SCC alaska,BIG alaska,DLG alaska,EEK alaska,ELI alaska,ENM alaska,KEB alaska,FAI alaska,FYU alaska,GBH alaska,GAL alaska,GAM alaska,N93 alaska,GKN alaska,GST alaska,HNS alaska,HYL alaska,HOM alaska,HNH alaska,HPB alaska,HLA alaska,HSL alaska,ILI alaska,JNU alaska,KAE alaska,BTI alaska,KLG alaska,KAL alaska,Z09 alaska,ENA alaska,KTN alaska,IAN alaska,KVC alaska,AKN alaska,IIK alaska,KVL alaska,AKW alaska,ADQ alaska,KDK alaska,T44 alaska,DUY alaska,2A9 alaska,OTZ alaska,KKA alaska,KWT alaska,GGV alaska,A85 alaska,2A3 alaska,MBA alaska,MDM alaska,3A5 alaska,MLL alaska,MCG alaska,MTM alaska,MOU alaska,WNA alaska,EWU alaska,WTK alaska,OME alaska,D76 alaska,ORV alaska,AQT alaska,NUL alaska,16A alaska,6R7 alaska,PSG alaska,0AK alaska,PHO alaska,PGM alaska,PTH alaska,ORI alaska,PPC alaska,AQH alaska,RSH alaska,SDP alaska,SVA alaska,SCM alaska,WLK alaska,SOV alaska,SHH alaska,SHG alaska,SIT alaska,SGY alaska,KSM alaska,SNP alaska,WBB alaska,TAL alaska,KTB alaska,TOG alaska,OOK alaska,TLT alaska,A61 alaska,UNK alaska,DUT alaska,VDZ alaska,AWI alaska,WRG alaska,YAK alabama,ANB alabama,BHM alabama,DHN alabama,HSV alabama,MOB alabama,MGM alabama,MSL alabama,ASN alabama,TCL arkansas,FYV arkansas,XNA arkansas,FSM arkansas,HRO arkansas,HOT arkansas,JBR arkansas,LIT arkansas,BPK arkansas,TXK arizona,IFP arizona,FLG arizona,FHU arizona,GYR arizona,GCN arizona,IGM arizona,HII arizona,MZJ arizona,IWA arizona,PGA arizona,1G4 arizona,DVT arizona,PHX arizona,PRC arizona,SOW arizona,TUS arizona,YUM california,ACV california,BFL california,BUR california,CRQ california,CIC california,CCR california,CEC california,FAT california,IPL california,IYK california,LGB california,LAX california,MMH california,MCE california,MOD california,MRY california,OAK california,ONT california,SNA california,OXR california,PSP california,PMD california,PRB california,RDD california,SMF california,MCC california,SBD california,SAN california,SFO california,SJC california,SBP california,SBA california,SMX california,STS california,TVL california,SCK california,VCV california,VIS colorado,ALS colorado,ASE colorado,COS colorado,CEZ colorado,DEN colorado,DRO colorado,EGE colorado,FNL colorado,GJT colorado,GUC colorado,HDN colorado,LAA colorado,MTJ colorado,PUB colorado,TEX connecticut,BDR connecticut,DXR connecticut,GON connecticut,HFD connecticut,HVN connecticut,OXC connecticut,BDL delaware,GED delaware,ILG florida,DAB florida,FLL florida,RSW florida,GNV florida,JAX florida,VQQ florida,EYW florida,LAL florida,MTH florida,MLB florida,MIA florida,X44 florida,APF florida,OCF florida,MCO florida,PFN florida,PNS florida,PGD florida,PIE florida,SFB florida,SRQ florida,SGJ florida,TLH florida,TPA florida,TIX florida,VPS florida,VRB florida,PBI georgia,ABY georgia,AHN georgia,ATL georgia,AGS georgia,BQK georgia,CSG georgia,MCN georgia,RMG georgia,SAV georgia,VLD hawaii,HNM hawaii,ITO hawaii,HNL hawaii,OGG hawaii,MUE hawaii,MKK hawaii,KOA hawaii,LNY hawaii,LIH iowa,BRL iowa,CID iowa,CWI iowa,DSM iowa,DBQ iowa,FOD iowa,MCW iowa,OTM iowa,SUX iowa,ALO idaho,BOI idaho,COE idaho,SUN idaho,IDA idaho,LWS idaho,PIH idaho,TWF illinois,ALN illinois,BLV illinois,BMI illinois,MDH illinois,CMI illinois,MDW illinois,ORD illinois,CGX illinois,DNV illinois,DEC illinois,MWA illinois,MTO illinois,MLI illinois,MVN illinois,PIA illinois,UIN illinois,RFD illinois,SPI illinois,SQI indiana,AID indiana,BMG indiana,BAK indiana,EKM indiana,EVV indiana,FWA indiana,GYY indiana,IND indiana,MQJ indiana,LAF indiana,MIE indiana,SBN indiana,HUF indiana,VPZ kansas,DDC kansas,GCK kansas,GLD kansas,GBD kansas,HYS kansas,HUT kansas,LBL kansas,MHK kansas,IXD kansas,SLN kansas,FOE kansas,ICT kentucky,BWG kentucky,LEX kentucky,SDF kentucky,OWB kentucky,PAH louisiana,AEX louisiana,ESF louisiana,BTR louisiana,LCH louisiana,LFT louisiana,MLU louisiana,MSY louisiana,NEW louisiana,SHV louisiana,TVR massachusetts,BED massachusetts,BOS massachusetts,HYA massachusetts,ACK massachusetts,EWB massachusetts,PVC massachusetts,CEF massachusetts,MVY massachusetts,BAF massachusetts,ORH maryland,BWI maryland,HGR maryland,SBY maine,AUG maine,BGR maine,BHB maine,PWM maine,PQI maine,RKD michigan,APN michigan,BTL michigan,ACB michigan,BEH michigan,CVX michigan,DTW michigan,DET michigan,ESC michigan,FNT michigan,GLR michigan,GRR michigan,CMX michigan,IMT michigan,IWD michigan,JXN michigan,AZO michigan,LAN michigan,MBL michigan,SAW michigan,MNM michigan,MKG michigan,PLN michigan,PTK michigan,MBS michigan,CIU michigan,TVC minnesota,AXN minnesota,BDE minnesota,BJI minnesota,BRD minnesota,DLH minnesota,ELO minnesota,FRM minnesota,GPZ minnesota,HIB minnesota,INL minnesota,MKT minnesota,MSP minnesota,RST minnesota,STC minnesota,STP minnesota,TVF minnesota,ILL minnesota,OTG missouri,CGI missouri,COU missouri,TBN missouri,JEF missouri,JLN missouri,AIZ missouri,MCI missouri,MKC missouri,IRK missouri,PLK missouri,STL missouri,SGF missouri,STJ missouri,SUS mississippi,GTR mississippi,GLH mississippi,GPT mississippi,PIB mississippi,JAN mississippi,HKS mississippi,MEI mississippi,UOX mississippi,PQL mississippi,TUP montana,BIL montana,BZN montana,BTM montana,GGW montana,GTF montana,HLN montana,GPI montana,MSO montana,SDY montana,WYS north carolina,AVL north carolina,CLT north carolina,FAY north carolina,GSO north carolina,PGV north carolina,HKY north carolina,OAJ north carolina,ISO north carolina,MQI north carolina,EWN north carolina,SOP north carolina,RDU north carolina,RWI north carolina,ILM north carolina,INT north dakota,BIS north dakota,DVL north dakota,DIK north dakota,FAR north dakota,GFK north dakota,JMS north dakota,MOT north dakota,ISN nebraska,AIA nebraska,GRI nebraska,EAR nebraska,LNK nebraska,MCK nebraska,OFK nebraska,LBF nebraska,OMA nebraska,BFF new hampshire,EEN new hampshire,LEB new hampshire,MHT new hampshire,PSM new jersey,AIY new jersey,BLM new jersey,CDW new jersey,ACY new jersey,MIV new jersey,MMU new jersey,EWR new jersey,TEB new jersey,MJX new jersey,TTN new jersey,WWD new mexico,ALM new mexico,ABQ new mexico,CNM new mexico,FMN new mexico,GUP new mexico,HOB new mexico,LRU new mexico,ROW new mexico,SRR new mexico,SAF new mexico,SVC new mexico,SKX nevada,EKO nevada,ELY nevada,LAS nevada,VGT nevada,HND nevada,RNO new york,ALB new york,BGM new york,BUF new york,ELM new york,FRG new york,GFL new york,ISP new york,ITH new york,JHW new york,MSS new york,MSV new york,JFK new york,LGA new york,JRB new york,SWF new york,OGS new york,PLB new york,POU new york,ROC new york,RME new york,SLK new york,SYR new york,UCA new york,ART new york,HPN ohio,CVG ohio,LUK ohio,CLE ohio,BKL ohio,CGF ohio,CMH ohio,LCK ohio,OSU ohio,DAY ohio,LPR ohio,MFD ohio,3T7 ohio,CAK ohio,PCW ohio,3W2 ohio,SGH ohio,TOL ohio,YNG oklahoma,WDG oklahoma,LAW oklahoma,OKC oklahoma,PNC oklahoma,SWO oklahoma,TUL oregon,AST oregon,CVO oregon,EUG oregon,LMT oregon,MMV oregon,MFR oregon,ONP oregon,OTH oregon,PDT oregon,PDX oregon,RDM oregon,SLE pennsylvania,ABE pennsylvania,AOO pennsylvania,AVP pennsylvania,BFD pennsylvania,DUJ pennsylvania,ERI pennsylvania,FKL pennsylvania,MDT pennsylvania,JST pennsylvania,LNS pennsylvania,LBE pennsylvania,PHL pennsylvania,PIT pennsylvania,AGC pennsylvania,RDG pennsylvania,UNV pennsylvania,IPT rhode island,BID rhode island,UUU rhode island,OQU rhode island,SFZ rhode island,PVD rhode island,WST south carolina,AND south carolina,CHS south carolina,CAE south carolina,FLO south carolina,GSP south carolina,GYH south carolina,HXD south carolina,MYR south dakota,ABR south dakota,BKX south dakota,HON south dakota,MHE south dakota,PIR south dakota,RAP south dakota,FSD south dakota,ATY south dakota,YKN tennessee,TRI tennessee,CHA tennessee,MKL tennessee,TYS tennessee,MEM tennessee,NQA tennessee,BNA tennessee,MQY texas,ABI texas,AMA texas,LBX texas,AUS texas,BPT texas,BRO texas,CLL texas,CRP texas,DAL texas,DFW texas,DRT texas,ELP texas,GRK texas,FTW texas,GLS texas,HRL texas,EFD texas,HOU texas,IAH texas,ILE texas,LRD texas,GGG texas,LBB texas,MFE texas,MAF texas,SJT texas,SAT texas,TPL texas,TYR texas,VCT texas,ACT texas,SPS utah,BCE utah,CDC utah,CNY utah,OGD utah,PVU utah,SLC utah,SGU virginia,CHO virginia,DAN virginia,SHD virginia,LYH virginia,PHF virginia,ORF virginia,RIC virginia,ROA vermont,MPV vermont,DDH vermont,MVL vermont,EFK vermont,RUT vermont,BTV washington,74S washington,BLI washington,PWT washington,ORS washington,PAE washington,FHR washington,MWH washington,OLM washington,PSC washington,CLM washington,PUW washington,SEA washington,BFI washington,GEG washington,ALW washington,EAT washington,YKM wisconsin,ATW wisconsin,EAU wisconsin,GRB wisconsin,JVL wisconsin,ENW wisconsin,LSE wisconsin,MSN wisconsin,MKE wisconsin,CWA wisconsin,OSH wisconsin,RHI west virginia,BKW west virginia,CRW west virginia,CKB west virginia,HTS west virginia,LWB west virginia,MGW west virginia,PKB wyoming,CPR wyoming,CYS wyoming,COD wyoming,GCC wyoming,JAC wyoming,LAR wyoming,RIW wyoming,RKS wyoming,SHR wyoming,WRL
\ No newline at end of file
#!/bin/bash
###############################################################################
# This script downloads 2009 Data Expo airline on-time performance data files,
# uncompresses them, and concatenates them into one file with the header intact.
# Then removes extra fields not used in downstream analysis and cleans the data
# for unexpected escape characters.
#
# Adapted from:
# http://www.bytemining.com/2010/08/taking-r-to-the-limit-part-ii-large-datasets-in-r/
###############################################################################
# This script makes 3 assumptions:
# 1) Bash is located at /bin/bash, if not, change the shebang.
# 2) wget is installed on your system.
# 3) THERE ARE NO OTHER FILES NAMED 19...csv or 20...csv IN THE DIRECTORY!
###############################################################################
mkdir data
cd data
for ((i=1987; i <= 2008 ; i++))
do
wget http://stat-computing.org/dataexpo/2009/$i.csv.bz2 &
done
wait
for ((i=1987; i <= 2008 ; i++))
do
bunzip2 $i.csv.bz2 &
done
wait
head -1 1987.csv >> header.tmp
tail --lines=+2 -q *.csv >airline.tmp
cat header.tmp airline.tmp >airline.csv
rm airline.tmp
cat header.tmp > airline_subsample.csv
for file in $(ls ????.csv)
do
tail --lines=+2 -q $file | shuf -n 100000 >> airline_subsample.csv
done
cat airline_subsample.csv | cut -d "," -f 1,2,11,15,17 | sed s/\'// > airline.tmp
cat airline.tmp > airline_subsample.csv
rm airline.tmp
head -1 airline_subsample.csv > airline_trunc.csv
tail --lines=+2 -q airline_subsample.csv | shuf -n 1000 >> airline_trunc.csv
for ((i=1987; i <= 2008; i++))
do
rm $i.csv &
done
wait
rm header.tmp airline.tmp
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=4
#SBATCH --mem=5gb
#SBATCH --time=00:20:00
#SBATCH --job-name=get_data
#SBATCH --error=get_data.%J.err
#SBATCH --output=get_data.%J.out
bash get_data.sh
+++
title = "R-Advanced Example"
weight = "100"
+++
R-Advanced Example
--------------------------------------
{{< readfile file="content/submitting_jobs/app_specific/job-examples/R/advanced/README.md" markdown="true" >}}
{{%attachments title="Related files" style="orange" /%}}
{{% children %}}
# HCC job examples
This repository contains scripts, data and submit files for running many popular applications on the Holland Computing Center clusters.
Applications included:
- BLAST - includes advanced examples
- MATLAB
- python
- R - includes advanced examples
- mathematica
- gaussian
- JupyterNotebook including python and R scripts
- GAMESS
For assistance or support about these examples or any HCC resources, please contact us at hcc-support@unl.edu
+++
title = "Applications Examples"
weight = "100"
+++
In-depth guides for running applications on HCC resources
--------------------------------------
{{< readfile file="content/submitting_jobs/app_specific/job-examples/README.md" markdown="true" >}}
{{% children style="div" depth="0" %}}
\ No newline at end of file
#!/bin/bash
#SBATCH --nodes=-4 # Use at most 4 nodes due to such a small problem size. Remove this as needed for larger problems.
#SBATCH --ntasks=16
#SBATCH --mincpus=2 # Need at least 2 CPUs (cores) per node for Abaqus to run in MPI mode
#SBATCH --mem-per-cpu=2gb
#SBATCH --time=01:00:00
#SBATCH --job-name=abaqus_test
#SBATCH --error=job.%J.err
#SBATCH --output=job.%J.out
if [[ "${SHELL}" =~ "tcsh" ]]
then
. /util/opt/lmod/lmod/init/profile
module use /util/opt/hcc-modules/Common
fi
module load abaqus/2019
source hcc_abaqus
abaqus job=exa_acrotflowaxi ask_delete=OFF interactive > exa_acrotflowaxi.txt 2>&1
*HEADING
CROSS SECTION FOR CIRCULAR DISK
REFERENCE FILE FOR: pstc38shhfs
*RESTART,WRITE
*NODE,NSET=TORUS_nset
101, 0.15, 0.0
106, 0.30, 0.0
201, 0.15, .15
206, 0.30, .15
*NGEN,NSET=NSIDE1
101, 106
*NGEN,NSET=NSIDE2
201, 206
*NSET,NSET=TORUS_nset
NSIDE1, NSIDE2
*NSET,NSET=NRIM
101, 201
*NSET,NSET=NTREAD
106, 206
***********************************
*ELEMENT,TYPE=ACAX4,ELSET=TORUS_Elset
101, 101,102,202,201
*ELGEN,ELSET=TORUS_Elset
101, 5
*ELSET,ELSET=ERIM
101,
*ELSET,ELSET=ETREAD
105,
*SOLID SECTION,MATERIAL=AIR320,ELSET=TORUS_Elset
1.0,
***********************************
*MATERIAL,NAME=AIR320
*ACOUSTICMEDIUM,BU
1.28E5,
*DENSITY
1.25,
***********************************
*STEP,INC=100
DO NOTHING
*STATIC
*BOUNDARY
TORUS_nset, 8
*NODE PRINT,FREQ=0
*EL PRINT,FREQ=0
*OUTPUT,FIELD
*NODE OUTPUT
POR,
*END STEP
#!/bin/bash
#SBATCH --nodes=-4 # Use at most 4 nodes due to such a small problem size. Remove this as needed for larger problems.
#SBATCH --ntasks=16
#SBATCH --mincpus=2 # Need at least 2 CPUs (cores) per node for Abaqus to run in MPI mode
#SBATCH --mem-per-cpu=2gb
#SBATCH --constraint=ib
#SBATCH --time=01:00:00
#SBATCH --job-name=abaqus_test
#SBATCH --error=job.%J.err
#SBATCH --output=job.%J.out
if [[ "${SHELL}" =~ "tcsh" ]]
then
. /util/opt/lmod/lmod/init/profile
module use /util/opt/hcc-modules/Common
fi
module load abaqus/6.14.2
source hcc_abaqus
abaqus job=exa_acrotflowaxi ask_delete=OFF interactive > exa_acrotflowaxi.txt 2>&1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment