Spaces:
Runtime error
Runtime error
File size: 5,429 Bytes
951488e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
import os
sim_pack = 'braket'
task = 'hdyn'
com_cap = 'st'
prec = 'dp'
gen_path = '/data/user/gangap_a/{}_singular/gen_files/'.format(task)
sim_path = '/data/user/gangap_a/{}_singular/{}/'.format(task, sim_pack)
print(sim_path)
# os.chdir(sim_path)
print(' ############################ ')
print('### Create job scripts folder for package: {}, task: {}, compute cap: {}, precision: {}'.format(sim_pack, task, com_cap, prec))
job_scripts_path = sim_path+'job_scripts_{}_{}'.format(com_cap, prec)
print(job_scripts_path)
os.mkdir(job_scripts_path)
print('### Create job scripts')
os.chdir(job_scripts_path)
cjs = gen_path+'create_job_script.py {} {} {} {}'.format(sim_pack, task, com_cap, prec)
os.system('python3 {}'.format(cjs))
print(' ############################ ')
print('### Create bash scripts folder for package: {}, task: {}, compute cap: {}, precision: {}'.format(sim_pack, task, com_cap, prec))
bash_scripts_path = sim_path+'bash_scripts_{}_{}'.format(com_cap, prec)
os.mkdir(bash_scripts_path)
print('### Create bash scripts')
os.chdir(bash_scripts_path)
cbs = gen_path+'create_bash_script.py {} {} {} {}'.format(sim_pack, task, com_cap, prec)
os.system('python3 {}'.format(cbs))
print(' ############################ ')
print('### Create output folder')
os.mkdir(sim_path+'output_{}_{}'.format(com_cap, prec))
print('### Create error folder')
os.mkdir(sim_path+'error_{}_{}'.format(com_cap, prec))
print('### Create data folder')
os.mkdir(sim_path+'data_{}_{}'.format(com_cap, prec))
print(' ############################ ')
print('### Create run files folder package: {}, task: {}, compute cap: {}, precision: {}'.format(sim_pack, task, com_cap, prec))
run_files_path = sim_path+'run_files_{}_{}'.format(com_cap, prec)
os.mkdir(run_files_path)
sim_parser = input("Enter the python file including the path for the parser: ")
os.system('python3 {}'.format(sim_parser))
print(' ############################ ')
print('### Create bash scripts to run jobs')
os.chdir(sim_path)
with open('run_jobs_{}_{}.sh'.format(com_cap, prec), 'w') as f:
if sim_pack == 'quest':
# f.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/quest/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/{}_singular/quest/:/home\"\n'.format(task, com_cap, prec, task))
os.mkdir('/data/user/gangap_a/{}_singular/quest/build_{}_{}'.format(task, com_cap, prec))
# f.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/quest/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/hdyn_singular/quest/run_files_st_dp/:/sim_lib/quest/QuEST/hdyn/run_files_st_dp,/data/user/gangap_a/{}_singular/quest/build_{}_{}:/home\"\n'.format(task, com_cap, prec, task, com_cap, prec))
f.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/quest/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/{}_singular/quest/run_files_{}_{}/:/home,/data/user/gangap_a/{}_singular/quest/build_{}_{}:/sim_lib/quest/QuEST/build_{}_{}\"\n'.format(task, com_cap, prec, task, com_cap, prec, task, com_cap, prec, com_cap, prec))
if com_cap == 'st' or com_cap == 'mt':
f.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}.sh\n'.format(task, com_cap, prec))
elif com_cap == 'gpu':
f.write('singularity exec --nv /data/user/gangap_a/singularity_images/qucos_gpu_sim.sif bash /brf/{}_{}_{}.sh\n'.format(task, com_cap, prec))
elif sim_pack == 'qrack_sch' or sim_pack == 'qrack_opt':
os.mkdir('/data/user/gangap_a/{}_singular/{}/bin_{}_{}'.format(task, sim_pack, com_cap, prec))
f.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/{}/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/{}_singular/{}/run_files_{}_{}/:/home,/data/user/gangap_a/{}_singular/{}/bin_{}_{}:/bin_{}_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, com_cap, prec))
if com_cap == 'st' or com_cap == 'mt':
f.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}.sh\n'.format(task, com_cap, prec))
elif com_cap == 'gpu':
f.write('singularity exec --nv /data/user/gangap_a/singularity_images/qucos_gpu_sim.sif bash /brf/{}_{}_{}.sh\n'.format(task, com_cap, prec))
elif sim_pack == 'qpp':
os.mkdir('/data/user/gangap_a/{}_singular/{}/bin_{}_{}'.format(task, sim_pack, com_cap, prec))
f.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/{}/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/{}_singular/{}/run_files_{}_{}/:/home,/data/user/gangap_a/{}_singular/{}/bin_{}_{}:/bin_{}_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, com_cap, prec))
# if com_cap == 'st' or com_cap == 'mt':
# f.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}.sh\n'.format(task, com_cap, prec))
# f.write('cd /psi/home/gangap_a\n')
# f.write('rm -rf CMakeCache.txt CMakeFiles cmake_install.cmake Makefile\n')
f.write('path=\"/data/user/gangap_a/{}_singular/{}/job_scripts_{}_{}\"\n'.format(task, sim_pack, com_cap, prec))
f.write('cd $path\n')
f.write('for job_script in *.sh; do\n')
f.write('echo $job_script;\n')
f.write('sbatch $job_script;\n')
# if sim_pack == 'quest':
# f.write('sleep 2.5\n')
f.write('done\n')
|