<commit_before>#!/bin/zsh -f

# usage:
#  turbine-cobalt -n <PROCS> [-e <ENV>]* [-o <OUTPUT>] -t <WALLTIME>
#                 <SCRIPT> [<ARG>]*

# Variables that may have defaults set in the environment:
# PROJECT, QUEUE, TURBINE_OUTPUT_ROOT

TURBINE_HOME=$( cd $( dirname $0 )/../../.. ; /bin/pwd )
declare TURBINE_HOME
source ${TURBINE_HOME}/scripts/turbine-config.sh
source ${TURBINE_HOME}/scripts/helpers.zsh

# Defaults:
PROCS=0
WALLTIME=${WALLTIME:-00:15:00}
TURBINE_OUTPUT_ROOT=${HOME}/turbine-output

# Place to store output directory name
OUTPUT_TOKEN_FILE=output.txt

# Job environment
typeset -T ENV env
env=()

# Defaults:
VERBOSE=0

while getopts "d:e:n:o:t:v" OPTION
 do
 case ${OPTION}
   in
   d)
     OUTPUT_TOKEN_FILE=${OPTARG}
     ;;
   e) env+=${OPTARG}
     ;;
   n) PROCS=${OPTARG}
     ;;
   o) TURBINE_OUTPUT_ROOT=${OPTARG}
     ;;
   t) WALLTIME=${OPTARG}
     ;;
   v)
     VERBOSE=1
     ;;
   *)
     print "abort"
     exit 1
     ;;
 esac
done
shift $(( OPTIND-1 ))

if (( VERBOSE ))
then
  set -x
fi

SCRIPT=$1
shift
ARGS=${*}

START=$( date +%s )

checkvars QUEUE SCRIPT

[[ ${PROCS} != 0 ]]
exitcode "PROCS==0"

RUN=$( date_path )

TURBINE_OUTPUT=${TURBINE_OUTPUT_ROOT}/${RUN}
declare TURBINE_OUTPUT
print ${TURBINE_OUTPUT} > ${OUTPUT_TOKEN_FILE}
mkdir -p ${TURBINE_OUTPUT}
exitcode "mkdir failed: ${TURBINE_OUTPUT}"

LOG=${TURBINE_OUTPUT}/log.txt

print "SCRIPT: ${SCRIPT}" >> ${LOG}
SCRIPT_NAME=$( basename ${SCRIPT} )
[[ -f ${SCRIPT} ]]
exitcode "script not found: ${SCRIPT}"
cp ${SCRIPT} ${TURBINE_OUTPUT}
exitcode "copy failed: ${SCRIPT} -> ${TURBINE_OUTPUT}"

JOB_ID_FILE=${TURBINE_OUTPUT}/jobid.txt

source ${TURBINE_HOME}/scripts/turbine-config.sh
exitcode "turbine-config.sh failed!"

# Turbine-specific environment
TURBINE_ENGINES=${TURBINE_ENGINES:-1}
ADLB_SERVERS=${ADLB_SERVERS:-1}
TURBINE_WORKERS=$(( PROCS - TURBINE_ENGINES - ADLB_SERVERS ))
ADLB_EXHAUST_TIME=${ADLB_EXHAUST_TIME:-5}
TURBINE_LOG=${TURBINE_LOG:-1}
TURBINE_DEBUG=${TURBINE_DEBUG:-1}
ADLB_DEBUG=${ADLB_DEBUG:-1}

env+=( TCLLIBPATH="${TCLLIBPATH}"
       TURBINE_ENGINES=${TURBINE_ENGINES}
       TURBINE_WORKERS=${TURBINE_WORKERS}
       ADLB_SERVERS=${ADLB_SERVERS}
       ADLB_EXHAUST_TIME=${ADLB_EXHAUST_TIME}
       TURBINE_LOG=${TURBINE_LOG}
       TURBINE_DEBUG=${TURBINE_DEBUG}
       ADLB_DEBUG=${ADLB_DEBUG}
)

declare SCRIPT_NAME

NODES=$(( PROCS/4 ))
(( PROCS % 4 )) && (( NODES++ ))
declare NODES
qsub -n ${NODES} \
     -t ${WALLTIME} \
     -q ${QUEUE} \
     --cwd ${TURBINE_OUTPUT} \<commit_msg>Turn on MPI labels<commit_after>#!/bin/zsh -f

# usage:
#  turbine-cobalt -n <PROCS> [-e <ENV>]* [-o <OUTPUT>] -t <WALLTIME>
#                 <SCRIPT> [<ARG>]*

# Variables that may have defaults set in the environment:
# PROJECT, QUEUE, TURBINE_OUTPUT_ROOT

TURBINE_HOME=$( cd $( dirname $0 )/../../.. ; /bin/pwd )
declare TURBINE_HOME
source ${TURBINE_HOME}/scripts/turbine-config.sh
source ${TURBINE_HOME}/scripts/helpers.zsh

# Defaults:
PROCS=0
WALLTIME=${WALLTIME:-00:15:00}
TURBINE_OUTPUT_ROOT=${HOME}/turbine-output

# Place to store output directory name
OUTPUT_TOKEN_FILE=output.txt

# Job environment
typeset -T ENV env
env=()

# Defaults:
VERBOSE=0

while getopts "d:e:n:o:t:v" OPTION
 do
 case ${OPTION}
   in
   d)
     OUTPUT_TOKEN_FILE=${OPTARG}
     ;;
   e) env+=${OPTARG}
     ;;
   n) PROCS=${OPTARG}
     ;;
   o) TURBINE_OUTPUT_ROOT=${OPTARG}
     ;;
   t) WALLTIME=${OPTARG}
     ;;
   v)
     VERBOSE=1
     ;;
   *)
     print "abort"
     exit 1
     ;;
 esac
done
shift $(( OPTIND-1 ))

if (( VERBOSE ))
then
  set -x
fi

SCRIPT=$1
shift
ARGS=${*}

START=$( date +%s )

checkvars QUEUE SCRIPT

[[ ${PROCS} != 0 ]]
exitcode "PROCS==0"

RUN=$( date_path )

TURBINE_OUTPUT=${TURBINE_OUTPUT_ROOT}/${RUN}
declare TURBINE_OUTPUT
print ${TURBINE_OUTPUT} > ${OUTPUT_TOKEN_FILE}
mkdir -p ${TURBINE_OUTPUT}
exitcode "mkdir failed: ${TURBINE_OUTPUT}"

LOG=${TURBINE_OUTPUT}/log.txt

print "SCRIPT: ${SCRIPT}" >> ${LOG}
SCRIPT_NAME=$( basename ${SCRIPT} )
[[ -f ${SCRIPT} ]]
exitcode "script not found: ${SCRIPT}"
cp ${SCRIPT} ${TURBINE_OUTPUT}
exitcode "copy failed: ${SCRIPT} -> ${TURBINE_OUTPUT}"

JOB_ID_FILE=${TURBINE_OUTPUT}/jobid.txt

source ${TURBINE_HOME}/scripts/turbine-config.sh
exitcode "turbine-config.sh failed!"

# Turbine-specific environment
TURBINE_ENGINES=${TURBINE_ENGINES:-1}
ADLB_SERVERS=${ADLB_SERVERS:-1}
TURBINE_WORKERS=$(( PROCS - TURBINE_ENGINES - ADLB_SERVERS ))
ADLB_EXHAUST_TIME=${ADLB_EXHAUST_TIME:-5}
TURBINE_LOG=${TURBINE_LOG:-1}
TURBINE_DEBUG=${TURBINE_DEBUG:-1}
ADLB_DEBUG=${ADLB_DEBUG:-1}

env+=( TCLLIBPATH="${TCLLIBPATH}"
       TURBINE_ENGINES=${TURBINE_ENGINES}
       TURBINE_WORKERS=${TURBINE_WORKERS}
       ADLB_SERVERS=${ADLB_SERVERS}
       ADLB_EXHAUST_TIME=${ADLB_EXHAUST_TIME}
       TURBINE_LOG=${TURBINE_LOG}
       TURBINE_DEBUG=${TURBINE_DEBUG}
       ADLB_DEBUG=${ADLB_DEBUG}
       MPIRUN_LABEL=1
)

declare SCRIPT_NAME

NODES=$(( PROCS/4 ))
(( PROCS % 4 )) && (( NODES++ ))
declare NODES
qsub -n ${NODES} \
     -t ${WALLTIME} \
     -q ${QUEUE} \
     --cwd ${TURBINE_OUTPUT} \
{'fraction_non_alphanumeric': 0.16689655172413792, 'fraction_numerical': 0.009261083743842364, 'mean_word_length': 4.096385542168675, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7308921', 'n_tokens_mistral': 2240, 'n_tokens_neox': 2142, 'n_words': 378}