<commit_before>#!/usr/bin/env python3

import os
import subprocess
from uuid import uuid4

ACCRE_JOB_TEMPLATE = """\
#!/bin/bash

#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=1G
#SBATCH --time=02:00:00
#SBATCH --job-name=PCreo_Sphere

module load Anaconda3

PARAM_S=<|PARAM_S|>
PARAM_D=<|PARAM_D|>
PARAM_N=<|PARAM_N|>

echo "Creating output directory..."
until mkdir /gpfs23/scratch/zhangdk/pcreo_runs/output_data_${SLURM_JOBID}; do sleep 1; done
until cd /gpfs23/scratch/zhangdk/pcreo_runs/output_data_${SLURM_JOBID}; do sleep 1; done
echo "Compiling PCreo_Sphere for initial run..."
/home/zhangdk/pcreo/compile.py ./pcreo_sphere_exe /home/zhangdk/pcreo/src/pcreo_sphere.f90 \
PCREO_DOUBLE_PREC PCREO_PARAM_S=${PARAM_S}_rk PCREO_PARAM_D=${PARAM_D} PCREO_PARAM_N=${PARAM_N}
./pcreo_sphere_exe
rm ./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "Compiling PCreo_Sphere for extension run..."
/home/zhangdk/pcreo/compile.py ./pcreo_sphere_exe /home/zhangdk/pcreo/src/pcreo_sphere.f90 \
PCREO_QUAD_PREC PCREO_PARAM_S=${PARAM_S}_rk PCREO_PARAM_D=${PARAM_D} PCREO_PARAM_N=${PARAM_N}
./pcreo_sphere_exe
rm ./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "Compiling PCreo_Sphere for cleanup run..."
/home/zhangdk/pcreo/compile.py ./pcreo_sphere_exe /home/zhangdk/pcreo/src/pcreo_sphere.f90 \
PCREO_QUAD_PREC PCREO_GRAD_DESC PCREO_PARAM_S=${PARAM_S}_rk PCREO_PARAM_D=${PARAM_D} PCREO_PARAM_N=${PARAM_N}
./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "Performing redundant cleanup run..."
./pcreo_sphere_exe
rm ./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "PCreo job successfully completed."
"""

def submit_job(s, d, n, k):
    s = float(s)
    d = int(d)
    n = int(n)
    script_name = str(uuid4()) + '.sh'
    with open(script_name, 'w+') as script_file:
        script_file.write(ACCRE_JOB_TEMPLATE.replace(
            '<|PARAM_S|>', str(s)).replace(
            '<|PARAM_D|>', str(d)).replace(
            '<|PARAM_N|>', str(n)))
    subprocess.run(['sbatch', '--array=1-' + str(k), script_name])
    os.remove(script_name)

for n in range(20, 51):
    submit_job(2.0, 3, n, 1000)<commit_msg>Shorten expected runtime<commit_after>#!/usr/bin/env python3

import os
import subprocess
from uuid import uuid4

ACCRE_JOB_TEMPLATE = """\
#!/bin/bash

#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=1G
#SBATCH --time=0-00:30:00
#SBATCH --job-name=PCreo_Sphere

module load Anaconda3

PARAM_S=<|PARAM_S|>
PARAM_D=<|PARAM_D|>
PARAM_N=<|PARAM_N|>

echo "Creating output directory..."
until mkdir /gpfs23/scratch/zhangdk/pcreo_runs/output_data_${SLURM_JOBID}; do sleep 1; done
until cd /gpfs23/scratch/zhangdk/pcreo_runs/output_data_${SLURM_JOBID}; do sleep 1; done
echo "Compiling PCreo_Sphere for initial run..."
/home/zhangdk/pcreo/compile.py ./pcreo_sphere_exe /home/zhangdk/pcreo/src/pcreo_sphere.f90 \
PCREO_DOUBLE_PREC PCREO_PARAM_S=${PARAM_S}_rk PCREO_PARAM_D=${PARAM_D} PCREO_PARAM_N=${PARAM_N}
./pcreo_sphere_exe
rm ./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "Compiling PCreo_Sphere for extension run..."
/home/zhangdk/pcreo/compile.py ./pcreo_sphere_exe /home/zhangdk/pcreo/src/pcreo_sphere.f90 \
PCREO_QUAD_PREC PCREO_PARAM_S=${PARAM_S}_rk PCREO_PARAM_D=${PARAM_D} PCREO_PARAM_N=${PARAM_N}
./pcreo_sphere_exe
rm ./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "Compiling PCreo_Sphere for cleanup run..."
/home/zhangdk/pcreo/compile.py ./pcreo_sphere_exe /home/zhangdk/pcreo/src/pcreo_sphere.f90 \
PCREO_QUAD_PREC PCREO_GRAD_DESC PCREO_PARAM_S=${PARAM_S}_rk PCREO_PARAM_D=${PARAM_D} PCREO_PARAM_N=${PARAM_N}
./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "Performing redundant cleanup run..."
./pcreo_sphere_exe
rm ./pcreo_sphere_exe
/home/zhangdk/pcreo/out2in.py
echo "PCreo job successfully completed."
"""


def submit_job(s, d, n, k=1):
    s = float(s)
    d = int(d)
    n = int(n)
    script_name = str(uuid4()) + '.sh'
    with open(script_name, 'w+') as script_file:
        script_file.write(ACCRE_JOB_TEMPLATE.replace(
            '<|PARAM_S|>', str(s)).replace(
            '<|PARAM_D|>', str(d)).replace(
            '<|PARAM_N|>', str(n)))
    if k == 1:
        subprocess.run(['sbatch', script_name])
    else:
        subprocess.run(['sbatch', '--array=1-' + str(k), script_name])
    os.remove(script_name)


for _ in range(1000):
    for n in range(10, 51):
        submit_job(2.0, 3, n)
{'fraction_non_alphanumeric': 0.15074694431869623, 'fraction_numerical': 0.019692168401991852, 'mean_word_length': 4.4758364312267656, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2844524', 'n_tokens_mistral': 2010, 'n_tokens_neox': 1898, 'n_words': 313}