Skip to content

Instantly share code, notes, and snippets.

@wtbarnes
wtbarnes / check_slurm_output.py
Created August 27, 2015 18:16
python script for checking many SLURM job output files to make sure all EBTEL runs were successful
import glob
import os
#get all slurm output files in home directory
files = glob.glob(os.environ['HOME']+"/slurm-*.out")
for f in files:
out_file = open(f)
lines = out_file.readlines()
if lines[-1].split(' ')[1] != "process" and lines[0][0] != '*':
@wtbarnes
wtbarnes / job_array.slurm
Created August 27, 2015 18:20
shell script for creating SLURM job array for given EBTEL parameters
#!/usr/bin/bash
### SLURM Parameters
#SBATCH --partition=commons
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --job-name=emc_single_a2.5_L120.0
#SBATCH --time=00:01:30
### EBTEL Configuration options
@wtbarnes
wtbarnes / start_jobs.sh
Created August 27, 2015 18:22
shell script for starting large number of jobs greater than SLURM policy allows by delaying job array submission by some interval
MAX_NUM=6678
MAX_JOBS=500
DELTA=$((MAX_JOBS - 1))
echo "Beginning job submission on "`date` >> batch_job_status.out
for i in `seq 0 $MAX_JOBS $MAX_NUM`
do
A=$i
B=$((i+DELTA))
if [ $B -gt $MAX_NUM ];
then
@wtbarnes
wtbarnes / run_matlab.sh
Created August 27, 2015 18:24
shell script for running MATLAB non-interactively through PBS/TORQUE. From kodiak.baylor.edu
#!/bin/bash
#PBS -S /bin/bash
#PBS -l nodes=1:ppn=1
# This script allows the user to execute a Matlab .m file using the Torque batch
# system.
# How to run this script in batch: $ qsub -v prog=myMatlabProgram.m ./run_matlab.sh
cd $PBS_O_WORKDIR
@wtbarnes
wtbarnes / job_array.pbs
Created August 27, 2015 18:29
PBS script for creating job arrays for EBTEL runs
#!/bin/bash
### QSUB Parameters (6678 for pl runs)
#PBS -q batch
#PBS -t 0-6678
#PBS -j oe
#PBS -N emc_ion_a2.5_L20.0
### EBTEL Configuration options
alpha=2.5
loopLength=20.0
species=ion
#!/usr/bin/python
import os
#Static parameters
solver = 'rka4'
tpulse = 100.0
loop_length = 40.0
#Set parameters
#astrophys-abbrev.bib
#Will Barnes
#16 July 2015
#Updated: 1 October 2015
#Abbreviations for common journals used in astronomy and astrophysics according to the journal abbreviations guidelines set out by the AAS.
#All journals and keys obtained from
#--http://james.as.arizona.edu/~psmith/proposals/SOinstructions/node33.html
#--http://doc.adsabs.harvard.edu/abs_doc/aas_macros.html
@wtbarnes
wtbarnes / gifMaker.sh
Last active March 8, 2016 19:23
shell script that uses ImageMagick utility to easily create GIFs from multiple files
#!/bin/bash
#Script to use ImageMagick to batch convert images to gif
#set command line parameters
species=$1
alpha=$2
loop_length=$3
tpulse=$4
f_ext=$5
f_out=$6
f_ext2="ebtel_L${loop_length}_tpulse${tpulse}_alpha${alpha}_${species}_heating_em_mc"
@wtbarnes
wtbarnes / build_rtd_local_img
Last active June 16, 2016 05:03
Docker image for ReadTheDocs build. Can be used for testing RTD Sphinx builds locally. Built on Python base image from Docker Hub
#################################################################################################
# Dockerfile to build ReadTheDocs
# Can be used to build RTD locally to test Sphinx build
# See RTD installation instructions http://read-the-docs.readthedocs.io/en/latest/install.html
#################################################################################################
FROM python:2-onbuild
MAINTAINER Will Barnes
@wtbarnes
wtbarnes / job_chainer.sh
Last active September 28, 2016 19:57
Chain a bunch of Torque/PBS jobs together, pulling arguments from a config file
#!/bin/bash
#chain some torque jobs together with dependencies
#set parameters
start_job=$1
start_index=0
end_index=41
conf_file=/home/wtb2/Documents/em_analysis.conf
#read config file