Skip to content

Instantly share code, notes, and snippets.

@Jamsek-m
Created March 27, 2020 16:19
Show Gist options
  • Save Jamsek-m/07674404dd88982d727da8777adab533 to your computer and use it in GitHub Desktop.
Save Jamsek-m/07674404dd88982d727da8777adab533 to your computer and use it in GitHub Desktop.
#!/bin/sh
#SBATCH --job-name=wordcount # Job name
#SBATCH --nodes=1 # Use one node
#SBATCH --ntasks=1 # Run a single task
#SBATCH --mem-per-cpu=1gb # Memory per processor
#SBATCH --time=00:10:00 # Time limit hrs:min:sec
#SBATCH --output=array/array_%A-%a.out # Standard output and error log
#SBATCH --array=1-32 # Array range
#Set the number of runs that each SLURM task should do
PER_TASK=391
# Calculate the starting and ending values for this task based
# on the SLURM task and the number of runs per task.
START_NUM=$(( ($SLURM_ARRAY_TASK_ID - 1) * $PER_TASK ))
END_NUM=$(( $SLURM_ARRAY_TASK_ID * $PER_TASK - 1))
FILES=(/home/dsluga/VZR/Sentiment/IMDB-DATA/neg/*)
# Print the task and run range
echo This is task $SLURM_ARRAY_TASK_ID, which will do runs $START_NUM to $END_NUM
# Run the loop of runs for this task.
for (( run=$START_NUM; run<=END_NUM; run++ )); do
if (( $run < 12500 )); then
echo This is SLURM task that will read file ${FILES[$run]}
srun -n1 --exclusive ./words bad ${FILES[$run]} /home/mihaj/dn2/out/$run-neg-bad-result.txt &
fi
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment